From f54651cdfdce4dbc2a65e8f6699d2e3e76303edf Mon Sep 17 00:00:00 2001 From: Leo Nicolle Date: Tue, 31 Oct 2023 18:50:16 +0100 Subject: [PATCH] added style for non solution --- client/public/test-db-4.json | 1318 ++++++++++++++++ client/public/test-db-5.json | 1330 +++++++++++++++++ client/src/api/index.ts | 14 +- client/src/components/fonts/FontLoader.vue | 11 +- client/src/components/fonts/FontSelector.vue | 2 + client/src/components/fonts/load-font.ts | 17 +- client/src/components/forms/GridStyleForm.vue | 14 +- client/src/components/svg-renderer/Grid.vue | 40 +- client/src/i18n/languages/en-en.ts | 1 + client/src/i18n/languages/es-es.ts | 1 + client/src/i18n/languages/fr-fr.ts | 1 + client/src/views/Fonts.vue | 2 - client/src/views/editors/SolutionsEditor.vue | 5 +- client/src/views/editors/StyleEditor.vue | 1 + database/src/idb.ts | 98 +- database/src/supadb.ts | 2 +- database/src/types.ts | 1 - grid/src/types.ts | 9 + 18 files changed, 2792 insertions(+), 75 deletions(-) create mode 100644 client/public/test-db-4.json create mode 100644 client/public/test-db-5.json diff --git a/client/public/test-db-4.json b/client/public/test-db-4.json new file mode 100644 index 0000000..b60782a --- /dev/null +++ b/client/public/test-db-4.json @@ -0,0 +1,1318 @@ +{ + "grids": [ + { + "id": "bf487ae7-e131-4fe9-bd58-0929d5a3c552", + "rows": 10, + "cols": 10, + "cells": [ + [ + { + "x": 0, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "rightdown", + "none", + "downright" + ], + "suggestion": "", + "text": "Def\n\nDef2" + }, + { + "x": 1, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "C" + }, + { + "x": 1, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "O" + }, + { + "x": 2, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "U" + }, + { + "x": 3, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "C" + }, + { + "x": 4, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "O" + }, + { + "x": 5, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "U" + }, + { + "x": 6, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 1, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 2, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 2, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 3, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 3, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 4, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 4, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 5, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 6, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 6, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 6, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 7, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 7, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 8, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 9, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ] + ], + "comment": "", + "created": 1698414350249, + "title": "Nouvelle Grille", + "styleId": "default" + } + ], + "styles": [ + { + "id": "default", + "name": "Default", + "grid": { + "cellSize": 54, + "borderSize": 1, + "borderColor": "#000000", + "outerBorderSize": 2, + "outerBorderColor": "#000000", + "spaceSize": 4 + }, + "definition": { + "font": "sans-serif", + "size": 12, + "color": "black", + "backgroundColor": "#ccc" + }, + "arrow": { + "size": 10, + "color": "#000000" + }, + "paper": { + "width": 21, + "height": 29.7, + "orientation": "portrait", + "dpi": 300, + "margin": { + "top": 1, + "bottom": 1, + "left": 1, + "right": 1 + } + } + }, + { + "id": "solution", + "name": "solution", + "grid": { + "cellSize": 20, + "borderSize": 1, + "borderColor": "#000000", + "outerBorderSize": 2, + "outerBorderColor": "#000000", + "spaceSize": 4 + }, + "definition": { + "font": "sans-serif", + "size": 12, + "color": "black", + "backgroundColor": "#ccc" + }, + "arrow": { + "size": 10, + "color": "#000000" + }, + "paper": { + "width": 21, + "height": 29.7, + "orientation": "portrait", + "dpi": 300, + "margin": { + "top": 1, + "bottom": 1, + "left": 1, + "right": 1 + } + }, + "grids": { + "rows": 2, + "cols": 2, + "gridN": { + "font": "sans-serif", + "size": "1em", + "color": "black", + "margin": { + "bottom": "0.5rem" + } + } + }, + "words": { + "font": "sans-serif", + "size": "1em", + "color": "black", + "tolerance": 2 + }, + "size": { + "font": "sans-serif", + "size": "1.5em", + "color": "black" + }, + "pagination": { + "font": "sans-serif", + "size": "1.5em", + "color": "black", + "startIdx": 1, + "align": "left", + "margin": { + "top": "1rem", + "bottom": "1rem", + "left": "1rem" + } + }, + "isSolution": true + } + ], + "words": [] +} \ No newline at end of file diff --git a/client/public/test-db-5.json b/client/public/test-db-5.json new file mode 100644 index 0000000..b55035f --- /dev/null +++ b/client/public/test-db-5.json @@ -0,0 +1,1330 @@ +{ + "fonts": [], + "grids": [ + { + "id": "3740f074-01f1-4c9d-9329-a68351812ea2", + "rows": 10, + "cols": 10, + "cells": [ + [ + { + "x": 0, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "coucou\n\ncaca" + }, + { + "x": 1, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 0, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 0, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "C" + }, + { + "x": 1, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "O" + }, + { + "x": 2, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "U" + }, + { + "x": 3, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "C" + }, + { + "x": 4, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "O" + }, + { + "x": 5, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "U" + }, + { + "x": 6, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "C" + }, + { + "x": 7, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "O" + }, + { + "x": 8, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "U" + }, + { + "x": 9, + "y": 1, + "definition": false, + "highlighted": true, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "C" + } + ], + [ + { + "x": 0, + "y": 2, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 2, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 2, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 2, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 3, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 3, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 3, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 4, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 4, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 5, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 5, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 5, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 6, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 6, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 6, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 7, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 7, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 8, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 8, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ], + [ + { + "x": 0, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 1, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 2, + "y": 9, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 3, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 4, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 5, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 6, + "y": 9, + "definition": true, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [ + "none", + "none", + "none" + ], + "suggestion": "", + "text": "" + }, + { + "x": 7, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 8, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + }, + { + "x": 9, + "y": 9, + "definition": false, + "highlighted": false, + "spaceV": false, + "spaceH": false, + "arrows": [], + "suggestion": "", + "text": "" + } + ] + ], + "comment": "", + "created": 1698760656952, + "title": "Nouvelle Grille", + "styleId": "default" + } + ], + "styles": [ + { + "id": "default", + "name": "Default", + "grid": { + "cellSize": 54, + "borderSize": 1, + "borderColor": "#000000", + "outerBorderSize": 2, + "outerBorderColor": "#000000", + "spaceSize": 4 + }, + "definition": { + "family": "Roboto", + "isGoogle": true, + "weight": "400", + "size": 12, + "color": "black", + "backgroundColor": "#ccc" + }, + "arrow": { + "size": 10, + "color": "#000000" + }, + "paper": { + "width": 21, + "height": 29.7, + "orientation": "portrait", + "dpi": 300, + "margin": { + "top": 1, + "bottom": 1, + "left": 1, + "right": 1 + } + } + }, + { + "id": "solution", + "name": "solution", + "grid": { + "cellSize": 20, + "borderSize": 1, + "borderColor": "#000000", + "outerBorderSize": 2, + "outerBorderColor": "#000000", + "spaceSize": 4 + }, + "definition": { + "family": "Roboto", + "isGoogle": true, + "weight": "400", + "size": 12, + "color": "black", + "backgroundColor": "#ccc" + }, + "arrow": { + "size": 10, + "color": "#000000" + }, + "paper": { + "width": 21, + "height": 29.7, + "orientation": "portrait", + "dpi": 300, + "margin": { + "top": 1, + "bottom": 1, + "left": 1, + "right": 1 + } + }, + "grids": { + "rows": 2, + "cols": 2, + "gridN": { + "family": "Roboto", + "isGoogle": true, + "weight": "400", + "size": "1em", + "color": "black", + "margin": { + "bottom": "0.5rem" + } + } + }, + "words": { + "family": "Roboto", + "isGoogle": true, + "weight": "400", + "size": "1em", + "color": "black", + "tolerance": 2 + }, + "size": { + "family": "Roboto", + "isGoogle": true, + "weight": "400", + "size": "1.5em", + "color": "black" + }, + "pagination": { + "family": "Roboto", + "isGoogle": true, + "weight": "400", + "size": "1.5em", + "color": "black", + "startIdx": 1, + "align": "left", + "margin": { + "bottom": "1rem", + "left": "1rem" + } + }, + "isSolution": true + } + ], + "words": [] +} \ No newline at end of file diff --git a/client/src/api/index.ts b/client/src/api/index.ts index 0cb75b7..94a2e9d 100644 --- a/client/src/api/index.ts +++ b/client/src/api/index.ts @@ -1,19 +1,17 @@ import { Grid } from 'grid'; import { Idatabase, SupaDB, setDatabase } from 'database'; import axios from 'axios'; -const debugMigration = false; +const debugMigration = true; class API { public idb: Idatabase; public supadb: SupaDB; public _mode: string; constructor(mode: string = 'unknown') { - let prepromise: Promise = Promise.resolve(); - if (debugMigration) { - prepromise = prepromise - .then(() => axios.get('/test-db.json')) - .then(({ data }) => setDatabase(data, 4)) - } - this.idb = new Idatabase(prepromise); + // axios.get('/test-db-5.json') + // .then(({ data }) => { + // setDatabase(data, 5) + // }); + this.idb = new Idatabase(); this.supadb = new SupaDB('https://tnvxmrqhkdlynhtdzmpw.supabase.co', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRudnhtcnFoa2RseW5odGR6bXB3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODIyNTM0MTEsImV4cCI6MTk5NzgyOTQxMX0.4PczPPAxbkwBvig7NTHNbR8JumuwPPqfyS_kGnkxP5I'); this._mode = mode; } diff --git a/client/src/components/fonts/FontLoader.vue b/client/src/components/fonts/FontLoader.vue index 4c2906b..40c5993 100644 --- a/client/src/components/fonts/FontLoader.vue +++ b/client/src/components/fonts/FontLoader.vue @@ -3,7 +3,7 @@ diff --git a/client/src/components/fonts/FontSelector.vue b/client/src/components/fonts/FontSelector.vue index 9efad60..5c44fa8 100644 --- a/client/src/components/fonts/FontSelector.vue +++ b/client/src/components/fonts/FontSelector.vue @@ -26,6 +26,8 @@ v-else :role="`${rolePrefix}-size`" v-model:value="value.size" + :precision="2" + :step="0.1" /> diff --git a/client/src/components/fonts/load-font.ts b/client/src/components/fonts/load-font.ts index 460bfbc..b16d75f 100644 --- a/client/src/components/fonts/load-font.ts +++ b/client/src/components/fonts/load-font.ts @@ -1,7 +1,18 @@ import { LocalFont } from "grid"; +import { api } from "../../api"; +export const loadedFonts = new Set(); export function loadFont(font: LocalFont) { - const fontface = new FontFace(font.family, `url(${font.content})`); - return fontface.load() - .then((fontface) => document.fonts.add(fontface)); + if (loadedFonts.has(font.family)) { + return Promise.resolve(); + } + return api.db.getFont(font.family) + .then((font) => { + const fontface = new FontFace(font.family, `url(${font.content})`); + return fontface.load(); + }) + .then((fontface) => { + loadedFonts.add(font.family); + document.fonts.add(fontface); + }); } \ No newline at end of file diff --git a/client/src/components/forms/GridStyleForm.vue b/client/src/components/forms/GridStyleForm.vue index 93d3365..3a44378 100644 --- a/client/src/components/forms/GridStyleForm.vue +++ b/client/src/components/forms/GridStyleForm.vue @@ -51,6 +51,16 @@ +

{{ $t("forms.solutions") }}

+ + + +

{{ $t("forms.definitions") }}

@@ -126,7 +136,9 @@ const emit = defineEmits<{ (event: "update:modelValue", value: GridStyle): void; }>(); const value = useModel(props, emit); - +watch(value.value, () => { + emit("update:modelValue", value.value); +});