@poadio/app-core 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/catalog.ts ADDED
@@ -0,0 +1,499 @@
1
+ // Catalogue des composants qu'on pose sur la grille d'une page (boîte à outils du designer de la console).
2
+ //
3
+ // Un élément du catalogue dit tout ce que la console et le moteur ont besoin de savoir d'un type, sans framework :
4
+ // sa catégorie, son libellé (fr, en), son icône (jeu d'icônes de @poadio/ui-core), sa taille par défaut et sa
5
+ // taille minimale en unités de la grille (24 colonnes × lignes de `rowHeight` px), et ses propriétés principales
6
+ // avec leurs valeurs par défaut. Le rendu (quel composant de @poadio/ui-vue, avec quelles props) est l'affaire du
7
+ // moteur (@poadio/app-vue) ; l'édition (panneau de propriétés) celle de la console.
8
+ //
9
+ // Ajouter un type : une entrée ici, son rendu dans app-vue (items/), et la liste `type` de schema/front.v1.json
10
+ // (le test catalog.test.ts vérifie que les deux disent la même chose).
11
+ //
12
+ // Pas encore : liaison aux données (store @poadio/data), événements et actions, composants imbriqués
13
+ // (un conteneur garde un texte, pas d'éléments enfants), disposition propre à chaque taille d'écran.
14
+
15
+ export type Localized = { fr: string; en: string };
16
+ export type CatalogLang = 'fr' | 'en';
17
+
18
+ export type CategoryId = 'layout' | 'forms' | 'data' | 'planning' | 'navigation' | 'display';
19
+
20
+ export type Category = { id: CategoryId; label: Localized; icon: string };
21
+
22
+ /** Les catégories, dans l'ordre de la boîte à outils */
23
+ export const CATEGORIES: readonly Category[] = [
24
+ { id: 'layout', label: { fr: 'Mise en page', en: 'Layout' }, icon: 'layers' },
25
+ { id: 'forms', label: { fr: 'Formulaires', en: 'Forms' }, icon: 'text-cursor-input' },
26
+ { id: 'data', label: { fr: 'Données', en: 'Data' }, icon: 'table' },
27
+ { id: 'planning', label: { fr: 'Planification', en: 'Planning' }, icon: 'calendar-days' },
28
+ { id: 'navigation', label: { fr: 'Navigation', en: 'Navigation' }, icon: 'compass' },
29
+ { id: 'display', label: { fr: 'Affichage', en: 'Display' }, icon: 'image' },
30
+ ];
31
+
32
+ /**
33
+ * Une propriété éditable :
34
+ * text une ligne de texte (maxLength : 200 par défaut)
35
+ * longtext plusieurs lignes (maxLength : 2000 par défaut)
36
+ * lines une liste de textes, un par ligne (stockée en tableau ; 50 au plus)
37
+ * number un nombre, borné par min / max
38
+ * boolean oui / non
39
+ * choice une valeur parmi `options`
40
+ */
41
+ export type PropKind = 'text' | 'longtext' | 'lines' | 'number' | 'boolean' | 'choice';
42
+ export type PropValue = string | number | boolean | string[];
43
+ export type PropOption = { value: string; label: Localized };
44
+ export type PropSpec = {
45
+ key: string;
46
+ kind: PropKind;
47
+ label: Localized;
48
+ /** Valeur par défaut ; un texte peut dépendre de la langue de la console qui pose le composant */
49
+ default: PropValue | Localized | { fr: string[]; en: string[] };
50
+ options?: readonly PropOption[];
51
+ min?: number;
52
+ max?: number;
53
+ maxLength?: number;
54
+ };
55
+
56
+ export type GridSize = { w: number; h: number };
57
+
58
+ export type CatalogEntry = {
59
+ /** Clé du type, écrite dans la définition (`type` d'un élément de grille) */
60
+ type: string;
61
+ category: CategoryId;
62
+ label: Localized;
63
+ /** Nom d'une icône du jeu de @poadio/ui-core */
64
+ icon: string;
65
+ /** Taille posée par défaut (colonnes, lignes) */
66
+ size: GridSize;
67
+ /** Taille minimale (colonnes, lignes) */
68
+ min: GridSize;
69
+ /** Mots de recherche en plus du libellé (sans accent, minuscules) */
70
+ keywords?: readonly string[];
71
+ props: readonly PropSpec[];
72
+ };
73
+
74
+ // ------------------------------------------------------------------ aides de déclaration
75
+
76
+ const L = (fr: string, en: string): Localized => ({ fr, en });
77
+ const opt = (value: string, fr: string, en: string): PropOption => ({ value, label: L(fr, en) });
78
+
79
+ const SEVERITY = [
80
+ opt('primary', 'Principale', 'Primary'),
81
+ opt('secondary', 'Secondaire', 'Secondary'),
82
+ opt('success', 'Succès', 'Success'),
83
+ opt('warning', 'Attention', 'Warning'),
84
+ opt('danger', 'Danger', 'Danger'),
85
+ opt('info', 'Information', 'Info'),
86
+ ] as const;
87
+ const TONE = [
88
+ opt('primary', 'Principale', 'Primary'),
89
+ opt('success', 'Succès', 'Success'),
90
+ opt('warning', 'Attention', 'Warning'),
91
+ opt('danger', 'Danger', 'Danger'),
92
+ opt('info', 'Information', 'Info'),
93
+ opt('neutral', 'Neutre', 'Neutral'),
94
+ ] as const;
95
+ const ALIGN = [opt('left', 'À gauche', 'Left'), opt('center', 'Centré', 'Center'), opt('right', 'À droite', 'Right')] as const;
96
+ const SIZES = [opt('sm', 'Petite', 'Small'), opt('md', 'Moyenne', 'Medium'), opt('lg', 'Grande', 'Large')] as const;
97
+ const ORIENTATION = [opt('horizontal', 'Horizontale', 'Horizontal'), opt('vertical', 'Verticale', 'Vertical')] as const;
98
+
99
+ const text = (key: string, label: Localized, def: Localized | string = '', maxLength?: number): PropSpec => ({ key, kind: 'text', label, default: def, ...(maxLength ? { maxLength } : {}) });
100
+ const longtext = (key: string, label: Localized, def: Localized | string = ''): PropSpec => ({ key, kind: 'longtext', label, default: def });
101
+ const lines = (key: string, label: Localized, fr: string[], en: string[]): PropSpec => ({ key, kind: 'lines', label, default: { fr, en } });
102
+ const num = (key: string, label: Localized, def: number, min: number, max: number): PropSpec => ({ key, kind: 'number', label, default: def, min, max });
103
+ const bool = (key: string, label: Localized, def = false): PropSpec => ({ key, kind: 'boolean', label, default: def });
104
+ const choice = (key: string, label: Localized, def: string, options: readonly PropOption[]): PropSpec => ({ key, kind: 'choice', label, default: def, options });
105
+
106
+ // Libellés de propriétés employés plusieurs fois
107
+ const P = {
108
+ label: L('Libellé', 'Label'),
109
+ title: L('Titre', 'Title'),
110
+ subtitle: L('Sous-titre', 'Subtitle'),
111
+ content: L('Contenu', 'Content'),
112
+ placeholder: L('Texte indicatif', 'Placeholder'),
113
+ hint: L('Aide', 'Hint'),
114
+ required: L('Obligatoire', 'Required'),
115
+ options: L('Options (une par ligne)', 'Options (one per line)'),
116
+ items: L('Éléments (un par ligne)', 'Items (one per line)'),
117
+ severity: L('Couleur', 'Color'),
118
+ variant: L('Aspect', 'Style'),
119
+ size: L('Taille', 'Size'),
120
+ align: L('Alignement', 'Alignment'),
121
+ orientation: L('Orientation', 'Orientation'),
122
+ collapsible: L('Repliable', 'Collapsible'),
123
+ multiple: L('Choix multiple', 'Multiple choice'),
124
+ min: L('Minimum', 'Minimum'),
125
+ max: L('Maximum', 'Maximum'),
126
+ value: L('Valeur', 'Value'),
127
+ checked: L('Cochée au départ', 'Checked at start'),
128
+ on: L('Activé au départ', 'On at start'),
129
+ };
130
+
131
+ const OPTIONS_FR = ['Option 1', 'Option 2', 'Option 3'];
132
+ const OPTIONS_EN = ['Option 1', 'Option 2', 'Option 3'];
133
+
134
+ // ------------------------------------------------------------------ le catalogue
135
+
136
+ export const CATALOG: readonly CatalogEntry[] = [
137
+ // ---------------------------------------------------------------- Mise en page
138
+ {
139
+ type: 'card', category: 'layout', label: L('Carte', 'Card'), icon: 'square', size: { w: 8, h: 5 }, min: { w: 3, h: 2 }, keywords: ['card', 'bloc', 'encart'],
140
+ props: [text('header', P.title, L('Titre de la carte', 'Card title')), text('subheader', P.subtitle), longtext('body', P.content, L('Le contenu de la carte.', 'The card content.'))],
141
+ },
142
+ {
143
+ type: 'panel', category: 'layout', label: L('Panneau', 'Panel'), icon: 'panel-top', size: { w: 12, h: 5 }, min: { w: 4, h: 2 },
144
+ props: [text('header', P.title, L('Panneau', 'Panel')), bool('toggleable', P.collapsible), longtext('body', P.content, L('Le contenu du panneau.', 'The panel content.'))],
145
+ },
146
+ {
147
+ type: 'fieldset', category: 'layout', label: L('Groupe de champs', 'Fieldset'), icon: 'rows', size: { w: 12, h: 4 }, min: { w: 4, h: 2 }, keywords: ['legende', 'legend'],
148
+ props: [text('legend', L('Légende', 'Legend'), L('Informations', 'Details')), bool('toggleable', P.collapsible), longtext('body', P.content, L('Les champs du groupe se poseront ici.', 'The group fields will go here.'))],
149
+ },
150
+ {
151
+ type: 'divider', category: 'layout', label: L('Séparateur', 'Divider'), icon: 'minus', size: { w: 24, h: 1 }, min: { w: 2, h: 1 }, keywords: ['ligne', 'trait', 'separator', 'hr'],
152
+ props: [text('label', P.label), choice('align', P.align, 'center', ALIGN), bool('dashed', L('Tirets', 'Dashed'))],
153
+ },
154
+ {
155
+ type: 'tabs', category: 'layout', label: L('Onglets', 'Tabs'), icon: 'panel-top', size: { w: 24, h: 5 }, min: { w: 6, h: 2 },
156
+ props: [
157
+ lines('tabs', L('Onglets (un par ligne)', 'Tabs (one per line)'), ['Onglet 1', 'Onglet 2', 'Onglet 3'], ['Tab 1', 'Tab 2', 'Tab 3']),
158
+ choice('variant', P.variant, 'line', [opt('line', 'Trait', 'Line'), opt('pill', 'Pastille', 'Pill'), opt('enclosed', 'Encadré', 'Enclosed')]),
159
+ ],
160
+ },
161
+ {
162
+ type: 'accordion', category: 'layout', label: L('Accordéon', 'Accordion'), icon: 'list', size: { w: 12, h: 5 }, min: { w: 4, h: 3 },
163
+ props: [lines('panels', L('Sections (une par ligne)', 'Sections (one per line)'), ['Section 1', 'Section 2', 'Section 3'], ['Section 1', 'Section 2', 'Section 3']), bool('multiple', L('Plusieurs ouvertes', 'Several open'))],
164
+ },
165
+ {
166
+ type: 'stepper', category: 'layout', label: L('Étapes', 'Stepper'), icon: 'milestone', size: { w: 24, h: 3 }, min: { w: 8, h: 2 }, keywords: ['wizard', 'assistant'],
167
+ props: [lines('steps', L('Étapes (une par ligne)', 'Steps (one per line)'), ['Informations', 'Validation', 'Terminé'], ['Details', 'Review', 'Done']), num('current', L('Étape en cours (rang)', 'Current step (index)'), 0, 0, 49)],
168
+ },
169
+ {
170
+ type: 'splitter', category: 'layout', label: L('Panneaux redimensionnables', 'Splitter'), icon: 'columns', size: { w: 24, h: 6 }, min: { w: 6, h: 3 },
171
+ props: [choice('layout', P.orientation, 'horizontal', ORIENTATION), lines('panels', L('Panneaux (un par ligne)', 'Panels (one per line)'), ['Gauche', 'Droite'], ['Left', 'Right'])],
172
+ },
173
+
174
+ // ---------------------------------------------------------------- Formulaires
175
+ {
176
+ type: 'field', category: 'forms', label: L('Champ texte', 'Text field'), icon: 'text-cursor-input', size: { w: 8, h: 2 }, min: { w: 3, h: 2 }, keywords: ['input', 'saisie', 'texte'],
177
+ props: [
178
+ text('label', P.label, L('Libellé', 'Label')), text('placeholder', P.placeholder), text('hint', P.hint), bool('required', P.required),
179
+ choice('inputType', L('Type de saisie', 'Input type'), 'text', [opt('text', 'Texte', 'Text'), opt('email', 'Adresse e-mail', 'Email'), opt('tel', 'Téléphone', 'Phone'), opt('url', 'Adresse web', 'URL')]),
180
+ ],
181
+ },
182
+ {
183
+ type: 'textarea', category: 'forms', label: L('Zone de texte', 'Text area'), icon: 'file-text', size: { w: 12, h: 3 }, min: { w: 4, h: 2 }, keywords: ['multiligne', 'multiline'],
184
+ props: [text('label', P.label, L('Commentaire', 'Comment')), text('placeholder', P.placeholder), bool('required', P.required)],
185
+ },
186
+ {
187
+ type: 'button', category: 'forms', label: L('Bouton', 'Button'), icon: 'square', size: { w: 4, h: 1 }, min: { w: 2, h: 1 }, keywords: ['action', 'bouton'],
188
+ props: [
189
+ text('label', P.label, L('Valider', 'Submit'), 80),
190
+ choice('severity', P.severity, 'primary', SEVERITY),
191
+ choice('variant', P.variant, 'solid', [opt('solid', 'Plein', 'Solid'), opt('outline', 'Contour', 'Outline'), opt('text', 'Texte seul', 'Text')]),
192
+ bool('block', L('Toute la largeur', 'Full width')),
193
+ ],
194
+ },
195
+ {
196
+ type: 'button-group', category: 'forms', label: L('Groupe de boutons', 'Button group'), icon: 'columns', size: { w: 8, h: 1 }, min: { w: 3, h: 1 },
197
+ props: [lines('buttons', L('Boutons (un par ligne)', 'Buttons (one per line)'), ['Jour', 'Semaine', 'Mois'], ['Day', 'Week', 'Month']), choice('size', P.size, 'md', SIZES)],
198
+ },
199
+ {
200
+ type: 'checkbox', category: 'forms', label: L('Case à cocher', 'Checkbox'), icon: 'check-square', size: { w: 6, h: 1 }, min: { w: 2, h: 1 },
201
+ props: [text('label', P.label, L('J’accepte les conditions', 'I accept the terms')), bool('checked', P.checked)],
202
+ },
203
+ {
204
+ type: 'radio', category: 'forms', label: L('Boutons radio', 'Radio buttons'), icon: 'circle-dot', size: { w: 6, h: 3 }, min: { w: 3, h: 1 },
205
+ props: [text('label', P.label, L('Choix', 'Choice')), lines('options', P.options, OPTIONS_FR, OPTIONS_EN), choice('orientation', P.orientation, 'vertical', ORIENTATION)],
206
+ },
207
+ {
208
+ type: 'switch', category: 'forms', label: L('Interrupteur', 'Switch'), icon: 'toggle-left', size: { w: 6, h: 1 }, min: { w: 2, h: 1 }, keywords: ['toggle', 'bascule'],
209
+ props: [text('label', P.label, L('Notifications', 'Notifications')), bool('checked', P.on)],
210
+ },
211
+ {
212
+ type: 'toggle-button', category: 'forms', label: L('Bouton bascule', 'Toggle button'), icon: 'toggle-right', size: { w: 4, h: 1 }, min: { w: 2, h: 1 },
213
+ props: [text('onLabel', L('Libellé activé', 'On label'), L('Activé', 'On')), text('offLabel', L('Libellé désactivé', 'Off label'), L('Désactivé', 'Off'))],
214
+ },
215
+ {
216
+ type: 'segmented', category: 'forms', label: L('Choix segmenté', 'Segmented control'), icon: 'columns', size: { w: 8, h: 1 }, min: { w: 3, h: 1 },
217
+ props: [lines('options', P.options, ['Liste', 'Grille', 'Carte'], ['List', 'Grid', 'Map']), bool('block', L('Toute la largeur', 'Full width'))],
218
+ },
219
+ {
220
+ type: 'select', category: 'forms', label: L('Liste déroulante', 'Select'), icon: 'chevron-down', size: { w: 8, h: 2 }, min: { w: 3, h: 2 }, keywords: ['dropdown', 'liste'],
221
+ props: [text('label', P.label, L('Choix', 'Choice')), text('placeholder', P.placeholder, L('Choisir…', 'Choose…')), lines('options', P.options, OPTIONS_FR, OPTIONS_EN), bool('required', P.required)],
222
+ },
223
+ {
224
+ type: 'combo', category: 'forms', label: L('Saisie avec suggestions', 'Combo box'), icon: 'search', size: { w: 8, h: 2 }, min: { w: 3, h: 2 }, keywords: ['autocomplete', 'autocompletion'],
225
+ props: [text('label', P.label, L('Recherche', 'Search')), text('placeholder', P.placeholder, L('Tapez pour chercher', 'Type to search')), lines('options', L('Suggestions (une par ligne)', 'Suggestions (one per line)'), ['Paris', 'Lyon', 'Marseille', 'Nantes'], ['London', 'Paris', 'Berlin', 'Madrid'])],
226
+ },
227
+ {
228
+ type: 'listbox', category: 'forms', label: L('Liste de choix', 'List box'), icon: 'list-checks', size: { w: 6, h: 5 }, min: { w: 3, h: 2 },
229
+ props: [lines('options', P.options, OPTIONS_FR, OPTIONS_EN), bool('multiple', P.multiple), bool('filter', L('Recherche', 'Search box'))],
230
+ },
231
+ {
232
+ type: 'number', category: 'forms', label: L('Nombre', 'Number'), icon: 'hash', size: { w: 6, h: 2 }, min: { w: 2, h: 2 }, keywords: ['numerique', 'numeric', 'quantite'],
233
+ props: [text('label', P.label, L('Quantité', 'Quantity')), num('min', P.min, 0, -1e9, 1e9), num('max', P.max, 100, -1e9, 1e9), text('suffix', L('Unité', 'Unit'), '', 20)],
234
+ },
235
+ {
236
+ type: 'password', category: 'forms', label: L('Mot de passe', 'Password'), icon: 'key', size: { w: 8, h: 2 }, min: { w: 3, h: 2 },
237
+ props: [text('label', P.label, L('Mot de passe', 'Password')), text('placeholder', P.placeholder), bool('feedback', L('Indicateur de robustesse', 'Strength meter'))],
238
+ },
239
+ {
240
+ type: 'mask', category: 'forms', label: L('Saisie masquée', 'Masked input'), icon: 'text-cursor-input', size: { w: 8, h: 2 }, min: { w: 3, h: 2 }, keywords: ['telephone', 'phone', 'siret', 'masque'],
241
+ props: [
242
+ text('label', P.label, L('Téléphone', 'Phone')),
243
+ choice('preset', L('Format', 'Format'), 'phone', [opt('phone', 'Téléphone', 'Phone'), opt('postal', 'Code postal', 'Postal code'), opt('siret', 'SIRET', 'SIRET'), opt('date', 'Date', 'Date'), opt('time', 'Heure', 'Time'), opt('iban', 'IBAN', 'IBAN')]),
244
+ ],
245
+ },
246
+ {
247
+ type: 'datepicker', category: 'forms', label: L('Date', 'Date'), icon: 'calendar', size: { w: 6, h: 2 }, min: { w: 3, h: 2 }, keywords: ['date', 'calendrier', 'heure'],
248
+ props: [
249
+ text('label', P.label, L('Date', 'Date')),
250
+ choice('mode', L('Ce qu’on choisit', 'Picks'), 'date', [opt('date', 'Une date', 'A date'), opt('datetime', 'Date et heure', 'Date and time'), opt('time', 'Une heure', 'A time'), opt('month', 'Un mois', 'A month')]),
251
+ bool('range', L('Intervalle', 'Range')),
252
+ ],
253
+ },
254
+ {
255
+ type: 'color', category: 'forms', label: L('Couleur', 'Color'), icon: 'palette', size: { w: 6, h: 2 }, min: { w: 3, h: 2 }, keywords: ['colorpicker', 'teinte'],
256
+ props: [text('label', P.label, L('Couleur', 'Color')), bool('alpha', L('Opacité', 'Opacity'))],
257
+ },
258
+ {
259
+ type: 'slider', category: 'forms', label: L('Curseur', 'Slider'), icon: 'sliders-horizontal', size: { w: 8, h: 2 }, min: { w: 3, h: 1 }, keywords: ['range', 'glissiere'],
260
+ props: [text('label', P.label, L('Volume', 'Volume')), num('min', P.min, 0, -1e9, 1e9), num('max', P.max, 100, -1e9, 1e9), num('step', L('Pas', 'Step'), 1, 0.001, 1e9)],
261
+ },
262
+ {
263
+ type: 'rating', category: 'forms', label: L('Note', 'Rating'), icon: 'star', size: { w: 4, h: 1 }, min: { w: 2, h: 1 }, keywords: ['etoiles', 'stars'],
264
+ props: [num('max', L('Nombre d’étoiles', 'Number of stars'), 5, 1, 10), bool('readonly', L('Lecture seule', 'Read-only'))],
265
+ },
266
+ {
267
+ type: 'upload', category: 'forms', label: L('Envoi de fichiers', 'File upload'), icon: 'upload', size: { w: 12, h: 4 }, min: { w: 4, h: 1 }, keywords: ['fichier', 'file', 'televerser'],
268
+ props: [
269
+ choice('mode', L('Présentation', 'Presentation'), 'dropzone', [opt('advanced', 'Complète', 'Full'), opt('dropzone', 'Zone de dépôt', 'Drop zone'), opt('basic', 'Un bouton', 'A button')]),
270
+ bool('multiple', L('Plusieurs fichiers', 'Several files')),
271
+ text('accept', L('Types acceptés', 'Accepted types'), '', 120),
272
+ ],
273
+ },
274
+ {
275
+ type: 'richtext', category: 'forms', label: L('Texte riche', 'Rich text'), icon: 'type', size: { w: 12, h: 5 }, min: { w: 6, h: 3 }, keywords: ['editeur', 'editor', 'wysiwyg'],
276
+ props: [text('placeholder', P.placeholder, L('Écrivez ici…', 'Write here…'))],
277
+ },
278
+
279
+ // ---------------------------------------------------------------- Données
280
+ {
281
+ type: 'table', category: 'data', label: L('Tableau', 'Table'), icon: 'table', size: { w: 24, h: 8 }, min: { w: 8, h: 3 }, keywords: ['grille', 'datatable', 'lignes'],
282
+ props: [
283
+ lines('columns', L('Colonnes (une par ligne)', 'Columns (one per line)'), ['Nom', 'Statut', 'Date'], ['Name', 'Status', 'Date']),
284
+ text('emptyMessage', L('Message sans ligne', 'Empty message'), L('Aucune ligne : la source de données viendra à l’étape suivante.', 'No rows yet: the data source comes next.')),
285
+ bool('paginator', L('Pagination', 'Pagination')),
286
+ bool('striped', L('Lignes alternées', 'Striped rows')),
287
+ ],
288
+ },
289
+ {
290
+ type: 'dataview', category: 'data', label: L('Liste de fiches', 'Data view'), icon: 'grid', size: { w: 24, h: 8 }, min: { w: 6, h: 3 },
291
+ props: [choice('layout', L('Présentation', 'Layout'), 'grid', [opt('list', 'Liste', 'List'), opt('grid', 'Grille', 'Grid')]), text('emptyMessage', L('Message sans fiche', 'Empty message'), L('Aucune fiche pour l’instant.', 'Nothing to show yet.'))],
292
+ },
293
+ {
294
+ type: 'tree', category: 'data', label: L('Arbre', 'Tree'), icon: 'folder-tree', size: { w: 8, h: 8 }, min: { w: 4, h: 3 }, keywords: ['arborescence', 'hierarchie'],
295
+ props: [lines('nodes', L('Nœuds racines (un par ligne)', 'Root nodes (one per line)'), ['Documents', 'Images', 'Archives'], ['Documents', 'Pictures', 'Archive'])],
296
+ },
297
+ {
298
+ type: 'paginator', category: 'data', label: L('Pagination', 'Paginator'), icon: 'ellipsis', size: { w: 12, h: 1 }, min: { w: 6, h: 1 },
299
+ props: [num('totalRecords', L('Nombre de lignes', 'Total rows'), 120, 0, 1e9), num('rows', L('Lignes par page', 'Rows per page'), 10, 1, 1000)],
300
+ },
301
+ {
302
+ type: 'chart', category: 'data', label: L('Graphique', 'Chart'), icon: 'chart-bar', size: { w: 12, h: 7 }, min: { w: 4, h: 4 }, keywords: ['diagramme', 'courbe', 'histogramme', 'camembert'],
303
+ props: [
304
+ choice('chartType', L('Type', 'Type'), 'bar', [opt('bar', 'Barres', 'Bars'), opt('line', 'Courbe', 'Line'), opt('pie', 'Secteurs', 'Pie'), opt('doughnut', 'Anneau', 'Doughnut')]),
305
+ text('series', L('Nom de la série', 'Series name'), L('Ventes', 'Sales')),
306
+ lines('labels', L('Étiquettes (une par ligne)', 'Labels (one per line)'), ['Jan', 'Fév', 'Mar', 'Avr', 'Mai'], ['Jan', 'Feb', 'Mar', 'Apr', 'May']),
307
+ lines('values', L('Valeurs (une par ligne)', 'Values (one per line)'), ['12', '19', '7', '15', '22'], ['12', '19', '7', '15', '22']),
308
+ ],
309
+ },
310
+ {
311
+ type: 'meter', category: 'data', label: L('Jauge', 'Meter'), icon: 'gauge', size: { w: 12, h: 2 }, min: { w: 4, h: 1 },
312
+ props: [text('label', P.label, L('Espace utilisé', 'Space used')), num('value', P.value, 64, 0, 1e9), num('max', P.max, 100, 1, 1e9), text('unit', L('Unité', 'Unit'), '%', 20)],
313
+ },
314
+ {
315
+ type: 'progress', category: 'data', label: L('Barre de progression', 'Progress bar'), icon: 'loader', size: { w: 8, h: 1 }, min: { w: 3, h: 1 },
316
+ props: [text('label', P.label), num('value', P.value, 40, 0, 100), bool('showValue', L('Afficher la valeur', 'Show value'), true), choice('severity', P.severity, 'primary', TONE.filter((o) => o.value !== 'neutral'))],
317
+ },
318
+ {
319
+ type: 'timeline', category: 'data', label: L('Frise chronologique', 'Timeline'), icon: 'activity', size: { w: 8, h: 6 }, min: { w: 4, h: 3 },
320
+ props: [lines('events', L('Évènements (un par ligne)', 'Events (one per line)'), ['Commande', 'Préparation', 'Expédition', 'Livraison'], ['Ordered', 'Processing', 'Shipped', 'Delivered']), choice('layout', P.orientation, 'vertical', ORIENTATION)],
321
+ },
322
+ {
323
+ type: 'orgchart', category: 'data', label: L('Organigramme', 'Org chart'), icon: 'git-fork', size: { w: 16, h: 8 }, min: { w: 6, h: 4 },
324
+ props: [text('root', L('Racine', 'Root'), L('Direction', 'Management')), lines('children', L('Branches (une par ligne)', 'Branches (one per line)'), ['Études', 'Travaux', 'Support'], ['Research', 'Operations', 'Support'])],
325
+ },
326
+
327
+ // ---------------------------------------------------------------- Planification
328
+ {
329
+ type: 'calendar', category: 'planning', label: L('Calendrier', 'Calendar'), icon: 'calendar-days', size: { w: 24, h: 12 }, min: { w: 8, h: 6 }, keywords: ['agenda', 'evenements'],
330
+ props: [choice('view', L('Vue', 'View'), 'month', [opt('month', 'Mois', 'Month'), opt('week', 'Semaine', 'Week'), opt('day', 'Jour', 'Day'), opt('agenda', 'Agenda', 'Agenda')])],
331
+ },
332
+ {
333
+ type: 'scheduler', category: 'planning', label: L('Planning de ressources', 'Resource scheduler'), icon: 'calendar-range', size: { w: 24, h: 10 }, min: { w: 10, h: 5 }, keywords: ['ressources', 'resources'],
334
+ props: [choice('scale', L('Échelle', 'Scale'), 'week', [opt('day', 'Jour', 'Day'), opt('week', 'Semaine', 'Week'), opt('month', 'Mois', 'Month')])],
335
+ },
336
+ {
337
+ type: 'gantt', category: 'planning', label: L('Diagramme de Gantt', 'Gantt chart'), icon: 'chart-no-axes-gantt', size: { w: 24, h: 10 }, min: { w: 10, h: 5 }, keywords: ['taches', 'projet'],
338
+ props: [choice('scale', L('Échelle', 'Scale'), 'week', [opt('day', 'Jour', 'Day'), opt('week', 'Semaine', 'Week'), opt('month', 'Mois', 'Month')])],
339
+ },
340
+ {
341
+ type: 'taskboard', category: 'planning', label: L('Tableau de tâches', 'Task board'), icon: 'kanban', size: { w: 24, h: 10 }, min: { w: 8, h: 5 }, keywords: ['kanban', 'colonnes'],
342
+ props: [choice('mode', L('Présentation', 'Presentation'), 'board', [opt('board', 'Cartes', 'Board'), opt('list', 'Liste', 'List')])],
343
+ },
344
+
345
+ // ---------------------------------------------------------------- Navigation
346
+ {
347
+ type: 'menubar', category: 'navigation', label: L('Barre de menu', 'Menu bar'), icon: 'menu', size: { w: 24, h: 2 }, min: { w: 6, h: 2 },
348
+ props: [choice('source', L('Éléments', 'Items'), 'pages', [opt('pages', 'Les pages du front', 'The front pages'), opt('custom', 'Liste libre', 'Custom list')]), lines('items', L('Liste libre (un par ligne)', 'Custom list (one per line)'), ['Accueil', 'Produits', 'Contact'], ['Home', 'Products', 'Contact'])],
349
+ },
350
+ {
351
+ type: 'breadcrumb', category: 'navigation', label: L('Fil d’Ariane', 'Breadcrumb'), icon: 'chevrons-right', size: { w: 12, h: 1 }, min: { w: 4, h: 1 },
352
+ props: [lines('items', P.items, ['Accueil', 'Catalogue', 'Fiche'], ['Home', 'Catalog', 'Item'])],
353
+ },
354
+ {
355
+ type: 'bottom-nav', category: 'navigation', label: L('Barre de navigation mobile', 'Bottom navigation'), icon: 'panel-bottom', size: { w: 24, h: 2 }, min: { w: 6, h: 2 }, keywords: ['onglets', 'mobile'],
356
+ props: [choice('source', L('Éléments', 'Items'), 'pages', [opt('pages', 'Les pages du front', 'The front pages'), opt('custom', 'Liste libre', 'Custom list')]), lines('items', L('Liste libre (un par ligne)', 'Custom list (one per line)'), ['Accueil', 'Recherche', 'Profil'], ['Home', 'Search', 'Profile'])],
357
+ },
358
+ {
359
+ type: 'speed-dial', category: 'navigation', label: L('Bouton d’actions', 'Speed dial'), icon: 'plus', size: { w: 2, h: 2 }, min: { w: 2, h: 2 }, keywords: ['fab', 'actions'],
360
+ props: [lines('items', L('Actions (une par ligne)', 'Actions (one per line)'), ['Modifier', 'Partager', 'Supprimer'], ['Edit', 'Share', 'Delete']), choice('direction', L('Direction', 'Direction'), 'up', [opt('up', 'Vers le haut', 'Up'), opt('down', 'Vers le bas', 'Down'), opt('left', 'Vers la gauche', 'Left'), opt('right', 'Vers la droite', 'Right')])],
361
+ },
362
+
363
+ // ---------------------------------------------------------------- Affichage
364
+ {
365
+ type: 'heading', category: 'display', label: L('Titre', 'Heading'), icon: 'heading', size: { w: 12, h: 1 }, min: { w: 2, h: 1 }, keywords: ['titre', 'h1', 'h2'],
366
+ props: [text('text', L('Texte', 'Text'), L('Titre de la section', 'Section title')), choice('level', L('Niveau', 'Level'), 'h2', [opt('h1', 'Titre 1', 'Heading 1'), opt('h2', 'Titre 2', 'Heading 2'), opt('h3', 'Titre 3', 'Heading 3')]), choice('align', P.align, 'left', ALIGN)],
367
+ },
368
+ {
369
+ type: 'text', category: 'display', label: L('Texte', 'Text'), icon: 'type', size: { w: 12, h: 2 }, min: { w: 2, h: 1 }, keywords: ['paragraphe', 'paragraph'],
370
+ props: [longtext('text', L('Texte', 'Text'), L('Un paragraphe de texte. Modifiez-le dans le panneau des propriétés.', 'A paragraph of text. Edit it in the properties panel.')), choice('align', P.align, 'left', ALIGN)],
371
+ },
372
+ {
373
+ type: 'image', category: 'display', label: L('Image', 'Image'), icon: 'image', size: { w: 8, h: 5 }, min: { w: 2, h: 2 }, keywords: ['photo', 'illustration'],
374
+ props: [text('src', L('Adresse de l’image', 'Image address'), '', 500), text('alt', L('Texte de remplacement', 'Alternative text')), choice('fit', L('Cadrage', 'Fit'), 'cover', [opt('cover', 'Remplir', 'Cover'), opt('contain', 'Contenir', 'Contain')]), bool('rounded', L('Coins arrondis', 'Rounded corners'))],
375
+ },
376
+ {
377
+ type: 'avatar', category: 'display', label: L('Avatar', 'Avatar'), icon: 'user', size: { w: 2, h: 2 }, min: { w: 1, h: 1 },
378
+ props: [text('text', L('Nom', 'Name'), 'Ada Lovelace', 80), choice('size', P.size, 'lg', SIZES), choice('shape', L('Forme', 'Shape'), 'circle', [opt('circle', 'Rond', 'Circle'), opt('square', 'Carré', 'Square')])],
379
+ },
380
+ {
381
+ type: 'badge', category: 'display', label: L('Pastille', 'Badge'), icon: 'circle', size: { w: 2, h: 1 }, min: { w: 1, h: 1 }, keywords: ['compteur', 'counter'],
382
+ props: [text('value', P.value, '3', 12), choice('severity', P.severity, 'danger', TONE)],
383
+ },
384
+ {
385
+ type: 'tag', category: 'display', label: L('Étiquette', 'Tag'), icon: 'tag', size: { w: 3, h: 1 }, min: { w: 1, h: 1 },
386
+ props: [text('value', P.label, L('Nouveau', 'New'), 60), choice('severity', P.severity, 'primary', TONE), bool('rounded', L('Arrondie', 'Rounded'))],
387
+ },
388
+ {
389
+ type: 'chip', category: 'display', label: L('Puce', 'Chip'), icon: 'tags', size: { w: 4, h: 1 }, min: { w: 2, h: 1 },
390
+ props: [text('label', P.label, L('Filtre', 'Filter'), 60), bool('removable', L('Bouton de retrait', 'Remove button'))],
391
+ },
392
+ {
393
+ type: 'carousel', category: 'display', label: L('Carrousel', 'Carousel'), icon: 'images', size: { w: 24, h: 6 }, min: { w: 6, h: 3 }, keywords: ['diaporama', 'slider'],
394
+ props: [lines('slides', L('Diapositives (une par ligne)', 'Slides (one per line)'), ['Première', 'Deuxième', 'Troisième'], ['First', 'Second', 'Third']), num('numVisible', L('Visibles à la fois', 'Visible at once'), 1, 1, 6)],
395
+ },
396
+ {
397
+ type: 'icon', category: 'display', label: L('Icône', 'Icon'), icon: 'smile', size: { w: 1, h: 1 }, min: { w: 1, h: 1 },
398
+ props: [text('name', L('Nom de l’icône', 'Icon name'), 'star', 40), num('size', P.size, 24, 8, 128)],
399
+ },
400
+ {
401
+ type: 'message', category: 'display', label: L('Message', 'Message'), icon: 'info', size: { w: 12, h: 2 }, min: { w: 3, h: 1 }, keywords: ['alerte', 'alert', 'notice'],
402
+ props: [text('text', L('Texte', 'Text'), L('Un message à l’attention des visiteurs.', 'A message for visitors.'), 500), choice('severity', P.severity, 'info', [opt('info', 'Information', 'Info'), opt('success', 'Succès', 'Success'), opt('warning', 'Attention', 'Warning'), opt('danger', 'Danger', 'Danger')])],
403
+ },
404
+ {
405
+ type: 'skeleton', category: 'display', label: L('Squelette', 'Skeleton'), icon: 'square-dashed', size: { w: 8, h: 2 }, min: { w: 1, h: 1 }, keywords: ['chargement', 'loading'],
406
+ props: [choice('shape', L('Forme', 'Shape'), 'text', [opt('text', 'Lignes de texte', 'Text lines'), opt('rect', 'Bloc', 'Block'), opt('circle', 'Rond', 'Circle')]), num('lines', L('Lignes', 'Lines'), 3, 1, 12)],
407
+ },
408
+ ];
409
+
410
+ // ------------------------------------------------------------------ accès
411
+
412
+ const BY_TYPE = new Map(CATALOG.map((e) => [e.type, e]));
413
+
414
+ /** Les clés de type du catalogue, dans l'ordre */
415
+ export const CATALOG_TYPES: readonly string[] = CATALOG.map((e) => e.type);
416
+
417
+ export const catalogEntry = (type: string): CatalogEntry | undefined => BY_TYPE.get(type);
418
+
419
+ export const localize = (v: Localized, lang: CatalogLang): string => v[lang] ?? v.fr;
420
+
421
+ /** Langue du catalogue d'après une langue d'interface (en, en-GB → en ; le reste → fr) */
422
+ export const catalogLang = (lang: string | null | undefined): CatalogLang => (lang && lang.toLowerCase().startsWith('en') ? 'en' : 'fr');
423
+
424
+ const isLocalized = (v: unknown): v is Localized | { fr: string[]; en: string[] } => typeof v === 'object' && v !== null && !Array.isArray(v) && 'fr' in v;
425
+
426
+ /** Valeur par défaut d'une propriété dans une langue */
427
+ export const defaultValue = (spec: PropSpec, lang: CatalogLang): PropValue => {
428
+ const d = spec.default;
429
+ if (isLocalized(d)) {
430
+ const v = (d as Record<CatalogLang, string | string[]>)[lang] ?? (d as Record<CatalogLang, string | string[]>).fr;
431
+ return Array.isArray(v) ? [...v] : v;
432
+ }
433
+ return Array.isArray(d) ? [...d] : (d as PropValue);
434
+ };
435
+
436
+ /** Les props d'un composant neuf : toutes ses propriétés à leur valeur par défaut, dans la langue de la console */
437
+ export const defaultProps = (type: string, lang: CatalogLang = 'fr'): Record<string, PropValue> => {
438
+ const e = catalogEntry(type);
439
+ if (!e) return {};
440
+ return Object.fromEntries(e.props.map((p) => [p.key, defaultValue(p, lang)]));
441
+ };
442
+
443
+ export const MAX_TEXT = 200;
444
+ export const MAX_LONGTEXT = 2000;
445
+ export const MAX_LINES = 50;
446
+ export const MAX_LINE = 200;
447
+
448
+ /** Écart d'une valeur de propriété à sa déclaration ; null si elle convient */
449
+ export const checkPropValue = (spec: PropSpec, v: unknown): string | null => {
450
+ switch (spec.kind) {
451
+ case 'text':
452
+ case 'longtext': {
453
+ if (typeof v !== 'string') return 'must be a string';
454
+ const max = spec.maxLength ?? (spec.kind === 'text' ? MAX_TEXT : MAX_LONGTEXT);
455
+ return [...v].length > max ? `must be at most ${max} characters` : null;
456
+ }
457
+ case 'lines':
458
+ if (!Array.isArray(v) || v.some((x) => typeof x !== 'string')) return 'must be an array of strings';
459
+ if (v.length > MAX_LINES) return `must have at most ${MAX_LINES} lines`;
460
+ return v.some((x: string) => [...x].length > MAX_LINE) ? `each line must be at most ${MAX_LINE} characters` : null;
461
+ case 'number':
462
+ if (typeof v !== 'number' || !Number.isFinite(v)) return 'must be a number';
463
+ if (spec.min !== undefined && v < spec.min) return `must be ≥ ${spec.min}`;
464
+ if (spec.max !== undefined && v > spec.max) return `must be ≤ ${spec.max}`;
465
+ return null;
466
+ case 'boolean':
467
+ return typeof v === 'boolean' ? null : 'must be a boolean';
468
+ case 'choice':
469
+ return typeof v === 'string' && (spec.options ?? []).some((o) => o.value === v) ? null : `must be one of ${(spec.options ?? []).map((o) => JSON.stringify(o.value)).join(', ')}`;
470
+ }
471
+ };
472
+
473
+ /**
474
+ * Les props d'un élément, complétées par les valeurs par défaut (une propriété ajoutée au catalogue après coup
475
+ * prend sa valeur par défaut, en français) ; une valeur qui ne convient pas est remplacée par la valeur par défaut.
476
+ * Le moteur affiche toujours ce résultat, jamais la définition brute.
477
+ */
478
+ export const resolveProps = (type: string, props: Record<string, unknown> | undefined, lang: CatalogLang = 'fr'): Record<string, PropValue> => {
479
+ const e = catalogEntry(type);
480
+ if (!e) return {};
481
+ const out: Record<string, PropValue> = {};
482
+ for (const spec of e.props) {
483
+ const v = props?.[spec.key];
484
+ out[spec.key] = v !== undefined && checkPropValue(spec, v) === null ? (v as PropValue) : defaultValue(spec, lang);
485
+ }
486
+ return out;
487
+ };
488
+
489
+ /** Catalogue par catégorie, filtré par une recherche (libellé fr ou en, clé du type, mots-clés ; sans accent) */
490
+ export const searchCatalog = (query: string, lang: CatalogLang = 'fr'): { category: Category; entries: CatalogEntry[] }[] => {
491
+ const fold = (s: string) => s.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
492
+ const words = fold(query).split(/\s+/).filter(Boolean);
493
+ const match = (e: CatalogEntry) => {
494
+ if (!words.length) return true;
495
+ const hay = fold([e.label.fr, e.label.en, e.type, ...(e.keywords ?? []), localize(CATEGORIES.find((c) => c.id === e.category)!.label, lang)].join(' '));
496
+ return words.every((w) => hay.includes(w));
497
+ };
498
+ return CATEGORIES.map((category) => ({ category, entries: CATALOG.filter((e) => e.category === category.id && match(e)) })).filter((g) => g.entries.length > 0);
499
+ };
@@ -0,0 +1,4 @@
1
+ // @poadio/app-core/designer : ce dont le designer de la console a besoin (catalogue des composants, gestes sur la
2
+ // grille), sans le schéma JSON ni le reste du moteur. Mêmes fonctions que l'entrée principale.
3
+ export * from './catalog.js';
4
+ export * from './grid.js';
@@ -0,0 +1,104 @@
1
+ // Barre du brouillon : la petite barre flottante de la Lecture du brouillon (cookie de lecture posé par le lien de la
2
+ // console), jamais montrée à un visiteur. Ici l'état et ses règles, sans DOM : largeur d'écran simulée, thème, barre
3
+ // repliée ou fermée, côté de l'écran ; ce qui est gardé pour l'onglet (sessionStorage) ; ce qui est écrit dans le
4
+ // puits de logs. Jamais de lien vers la console ni de copie du lien du brouillon : il ne doit pas circuler.
5
+ import type { Theme } from './preview.js';
6
+
7
+ export type DraftDevice = 'desktop' | 'tablet' | 'phone';
8
+ /** Les mêmes largeurs que les tailles d'écran du designer de la console */
9
+ export const DRAFT_DEVICE_WIDTHS: Readonly<Record<DraftDevice, number>> = { desktop: 1280, tablet: 820, phone: 390 };
10
+ export const DRAFT_DEVICES: readonly DraftDevice[] = ['desktop', 'tablet', 'phone'];
11
+
12
+ export type DraftToolbarState = {
13
+ device: DraftDevice;
14
+ /** Thème choisi dans la barre ; null : celui du système */
15
+ theme: Theme | null;
16
+ collapsed: boolean;
17
+ side: 'left' | 'right';
18
+ /** Fermée pour cet onglet */
19
+ closed: boolean;
20
+ };
21
+
22
+ export const DRAFT_TOOLBAR_DEFAULT: DraftToolbarState = { device: 'desktop', theme: null, collapsed: false, side: 'left', closed: false };
23
+
24
+ /** Clé de l'onglet (sessionStorage), par front */
25
+ export const draftToolbarKey = (frontId: string) => `poad.draft-toolbar.${frontId}`;
26
+
27
+ const isDevice = (v: unknown): v is DraftDevice => v === 'desktop' || v === 'tablet' || v === 'phone';
28
+
29
+ /** L'état gardé pour l'onglet ; ce qui est absent ou illisible prend la valeur par défaut */
30
+ export const readDraftToolbar = (raw: string | null | undefined): DraftToolbarState => {
31
+ let v: Record<string, unknown> = {};
32
+ try {
33
+ const parsed: unknown = raw ? JSON.parse(raw) : {};
34
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) v = parsed as Record<string, unknown>;
35
+ } catch {
36
+ /* illisible : valeurs par défaut */
37
+ }
38
+ return {
39
+ device: isDevice(v['device']) ? v['device'] : DRAFT_TOOLBAR_DEFAULT.device,
40
+ theme: v['theme'] === 'light' || v['theme'] === 'dark' ? v['theme'] : null,
41
+ collapsed: v['collapsed'] === true,
42
+ side: v['side'] === 'right' ? 'right' : 'left',
43
+ closed: v['closed'] === true,
44
+ };
45
+ };
46
+
47
+ export const writeDraftToolbar = (s: DraftToolbarState): string => JSON.stringify(s);
48
+
49
+ export type DraftToolbarAction =
50
+ | { type: 'device'; device: DraftDevice }
51
+ | { type: 'theme'; theme: Theme }
52
+ | { type: 'collapse' }
53
+ | { type: 'expand' }
54
+ | { type: 'move' }
55
+ | { type: 'close' }
56
+ | { type: 'reload' }
57
+ | { type: 'page'; page: string };
58
+
59
+ /** L'état après un geste (recharger et aller à une page ne changent pas l'état de la barre) */
60
+ export const draftToolbarReduce = (s: DraftToolbarState, a: DraftToolbarAction): DraftToolbarState => {
61
+ switch (a.type) {
62
+ case 'device':
63
+ return { ...s, device: a.device };
64
+ case 'theme':
65
+ return { ...s, theme: a.theme };
66
+ case 'collapse':
67
+ return { ...s, collapsed: true };
68
+ case 'expand':
69
+ return { ...s, collapsed: false };
70
+ case 'move':
71
+ return { ...s, side: s.side === 'left' ? 'right' : 'left' };
72
+ case 'close':
73
+ return { ...s, closed: true };
74
+ default:
75
+ return s;
76
+ }
77
+ };
78
+
79
+ /**
80
+ * Largeur où contenir la page pour la taille choisie, dans une fenêtre de `available` pixels ; null : aucune.
81
+ * Ordinateur : jamais de cadre, la page occupe toute la fenêtre comme pour un vrai visiteur (le moteur publié ne
82
+ * borne pas la largeur). Tablette et Téléphone : la page contenue à leur largeur, si la fenêtre est plus large.
83
+ */
84
+ export const draftFrameWidth = (device: DraftDevice, available: number): number | null => {
85
+ if (device === 'desktop') return null;
86
+ const w = DRAFT_DEVICE_WIDTHS[device];
87
+ return available > w ? w : null;
88
+ };
89
+
90
+ /**
91
+ * Sens du chevron qui replie ou déplie la barre : il montre où la barre va. Dépliée à gauche, elle se replie vers la
92
+ * gauche ; repliée à gauche, elle se déplie vers la droite ; l'inverse quand elle est à droite.
93
+ */
94
+ export const draftFoldIcon = (s: Pick<DraftToolbarState, 'collapsed' | 'side'>): 'chevron-left' | 'chevron-right' =>
95
+ (s.side === 'left') === !s.collapsed ? 'chevron-left' : 'chevron-right';
96
+
97
+ /** La ligne du puits de logs pour un geste : l'action et ses valeurs, jamais de jeton ni de cookie */
98
+ export const draftToolbarLog = (a: DraftToolbarAction): { msg: string; attrs: Record<string, string> } => {
99
+ const attrs: Record<string, string> = { action: a.type };
100
+ if (a.type === 'device') attrs['device'] = a.device;
101
+ if (a.type === 'theme') attrs['theme'] = a.theme;
102
+ if (a.type === 'page') attrs['target'] = a.page;
103
+ return { msg: `barre du brouillon : ${a.type}`, attrs };
104
+ };