@hale-bopp/valentino-engine 2.1.0 → 2.3.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.
Files changed (102) hide show
  1. package/README.md +63 -2
  2. package/dist/bin/commands/cockpit.d.ts +16 -0
  3. package/dist/bin/commands/cockpit.d.ts.map +1 -0
  4. package/dist/bin/commands/cockpit.js +205 -0
  5. package/dist/bin/commands/cockpit.js.map +1 -0
  6. package/dist/bin/commands/theme-audit.d.ts +7 -0
  7. package/dist/bin/commands/theme-audit.d.ts.map +1 -0
  8. package/dist/bin/commands/theme-audit.js +70 -0
  9. package/dist/bin/commands/theme-audit.js.map +1 -0
  10. package/dist/bin/commands/validate.d.ts.map +1 -1
  11. package/dist/bin/commands/validate.js +94 -1
  12. package/dist/bin/commands/validate.js.map +1 -1
  13. package/dist/bin/valentino.js +15 -1
  14. package/dist/bin/valentino.js.map +1 -1
  15. package/dist/cockpit-server.d.ts +17 -0
  16. package/dist/cockpit-server.d.ts.map +1 -0
  17. package/dist/cockpit-server.js +505 -0
  18. package/dist/cockpit-server.js.map +1 -0
  19. package/dist/cockpit-web/index.html +979 -0
  20. package/dist/core/cockpit-api.d.ts +99 -0
  21. package/dist/core/cockpit-api.d.ts.map +1 -0
  22. package/dist/core/cockpit-api.js +269 -0
  23. package/dist/core/cockpit-api.js.map +1 -0
  24. package/dist/core/cockpit-repl.d.ts +51 -0
  25. package/dist/core/cockpit-repl.d.ts.map +1 -0
  26. package/dist/core/cockpit-repl.js +217 -0
  27. package/dist/core/cockpit-repl.js.map +1 -0
  28. package/dist/core/contrast-usage-probe.d.ts +84 -0
  29. package/dist/core/contrast-usage-probe.d.ts.map +1 -0
  30. package/dist/core/contrast-usage-probe.js +244 -0
  31. package/dist/core/contrast-usage-probe.js.map +1 -0
  32. package/dist/core/contrast-usage-probe.test.d.ts +2 -0
  33. package/dist/core/contrast-usage-probe.test.d.ts.map +1 -0
  34. package/dist/core/contrast-usage-probe.test.js +186 -0
  35. package/dist/core/contrast-usage-probe.test.js.map +1 -0
  36. package/dist/core/editor.d.ts +80 -0
  37. package/dist/core/editor.d.ts.map +1 -0
  38. package/dist/core/editor.js +421 -0
  39. package/dist/core/editor.js.map +1 -0
  40. package/dist/core/gallery.d.ts +53 -0
  41. package/dist/core/gallery.d.ts.map +1 -0
  42. package/dist/core/gallery.js +123 -0
  43. package/dist/core/gallery.js.map +1 -0
  44. package/dist/core/gallery.test.d.ts +2 -0
  45. package/dist/core/gallery.test.d.ts.map +1 -0
  46. package/dist/core/gallery.test.js +127 -0
  47. package/dist/core/gallery.test.js.map +1 -0
  48. package/dist/core/intent-parser.d.ts +67 -0
  49. package/dist/core/intent-parser.d.ts.map +1 -0
  50. package/dist/core/intent-parser.js +485 -0
  51. package/dist/core/intent-parser.js.map +1 -0
  52. package/dist/core/openrouter-client.d.ts +38 -0
  53. package/dist/core/openrouter-client.d.ts.map +1 -0
  54. package/dist/core/openrouter-client.js +123 -0
  55. package/dist/core/openrouter-client.js.map +1 -0
  56. package/dist/core/page-generator.d.ts +85 -0
  57. package/dist/core/page-generator.d.ts.map +1 -0
  58. package/dist/core/page-generator.js +353 -0
  59. package/dist/core/page-generator.js.map +1 -0
  60. package/dist/core/page-generator.test.d.ts +2 -0
  61. package/dist/core/page-generator.test.d.ts.map +1 -0
  62. package/dist/core/page-generator.test.js +138 -0
  63. package/dist/core/page-generator.test.js.map +1 -0
  64. package/dist/core/page-status.d.ts +15 -1
  65. package/dist/core/page-status.d.ts.map +1 -1
  66. package/dist/core/page-status.js +21 -0
  67. package/dist/core/page-status.js.map +1 -1
  68. package/dist/core/project-adapter.d.ts +73 -0
  69. package/dist/core/project-adapter.d.ts.map +1 -0
  70. package/dist/core/project-adapter.js +364 -0
  71. package/dist/core/project-adapter.js.map +1 -0
  72. package/dist/core/schema-export.d.ts +32 -0
  73. package/dist/core/schema-export.d.ts.map +1 -0
  74. package/dist/core/schema-export.js +493 -0
  75. package/dist/core/schema-export.js.map +1 -0
  76. package/dist/core/theme-audit.d.ts +104 -0
  77. package/dist/core/theme-audit.d.ts.map +1 -0
  78. package/dist/core/theme-audit.js +127 -0
  79. package/dist/core/theme-audit.js.map +1 -0
  80. package/dist/core/theme-audit.test.d.ts +2 -0
  81. package/dist/core/theme-audit.test.d.ts.map +1 -0
  82. package/dist/core/theme-audit.test.js +198 -0
  83. package/dist/core/theme-audit.test.js.map +1 -0
  84. package/dist/core/url-import.d.ts +41 -0
  85. package/dist/core/url-import.d.ts.map +1 -0
  86. package/dist/core/url-import.js +207 -0
  87. package/dist/core/url-import.js.map +1 -0
  88. package/dist/core/video-import.d.ts +46 -0
  89. package/dist/core/video-import.d.ts.map +1 -0
  90. package/dist/core/video-import.js +192 -0
  91. package/dist/core/video-import.js.map +1 -0
  92. package/dist/core/visual-import.d.ts +42 -0
  93. package/dist/core/visual-import.d.ts.map +1 -0
  94. package/dist/core/visual-import.js +227 -0
  95. package/dist/core/visual-import.js.map +1 -0
  96. package/dist/index.d.ts +31 -2
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +31 -1
  99. package/dist/index.js.map +1 -1
  100. package/dist/mcp/index.js +32 -0
  101. package/dist/mcp/index.js.map +1 -1
  102. package/package.json +10 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/core/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACR,UAAU,EACV,WAAW,EAGd,MAAM,YAAY,CAAC;AAOpB,MAAM,MAAM,eAAe,GACrB,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AAEb,MAAM,MAAM,eAAe,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAA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AU,CAKZ;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACvB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GAChB,UAAU,CASZ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC,GACzD,UAAU,CAEZ"}
@@ -0,0 +1,421 @@
1
+ /**
2
+ * Editor utilities — Pure functions for visual page spec editing.
3
+ * PBI #602 — Editor visuale non-tecnico.
4
+ *
5
+ * Provides:
6
+ * - generateEditorSchema(sectionType) — JSON-like schema for form generation
7
+ * - applySectionPatch(spec, sectionIndex, patch) — immutable update + validation
8
+ * - getEditableSectionTypes() — list of section types supported by editor
9
+ */
10
+ import { validatePageSpec } from './page-spec.js';
11
+ // ---------------------------------------------------------------------------
12
+ // Shared field definitions (reusable across section types)
13
+ // ---------------------------------------------------------------------------
14
+ const presentationFields = [
15
+ { key: 'presentation.surface', label: 'Surface', type: 'enum', enumValues: ['default', 'muted', 'accent', 'dark', 'shell-dark', 'reading-light', 'ops-light'], group: 'presentation' },
16
+ { key: 'presentation.surfaceScreen', label: 'Surface Screen', type: 'enum', enumValues: ['none', 'soft', 'immersive', 'inherit'], group: 'presentation' },
17
+ { key: 'presentation.height', label: 'Height', type: 'enum', enumValues: ['content', 'screen-sm', 'screen-md', 'screen-full'], group: 'presentation' },
18
+ { key: 'presentation.tone', label: 'Tone', type: 'enum', enumValues: ['default', 'elevated', 'immersive'], group: 'presentation' },
19
+ { key: 'presentation.rhythmProfile', label: 'Rhythm Profile', type: 'enum', enumValues: ['hero', 'transition', 'feature', 'reading', 'proof', 'metrics', 'ops'], group: 'presentation' },
20
+ { key: 'presentation.rhythmGroup', label: 'Rhythm Group', type: 'string', group: 'presentation' },
21
+ { key: 'presentation.seamProfile', label: 'Seam Profile', type: 'enum', enumValues: ['none', 'hero-intro-merge', 'hero-to-light'], group: 'presentation' },
22
+ { key: 'presentation.surfaceEntry', label: 'Surface Entry', type: 'enum', enumValues: ['slab', 'bleed', 'floating'], group: 'presentation' },
23
+ { key: 'presentation.contentLift', label: 'Content Lift', type: 'enum', enumValues: ['none', 'sm', 'md', 'lg'], group: 'presentation' },
24
+ { key: 'presentation.visualStage', label: 'Visual Stage', type: 'string', group: 'presentation' },
25
+ { key: 'presentation.presetId', label: 'Preset ID', type: 'string', group: 'presentation' },
26
+ ];
27
+ const animationFields = [
28
+ { key: 'animation.entrance', label: 'Entrance Animation', type: 'enum', enumValues: ['fade-up', 'fade-in', 'slide-left', 'slide-right', 'scale-in', 'none'], group: 'animation' },
29
+ { key: 'animation.delay', label: 'Delay', type: 'enum', enumValues: ['none', 'stagger'], group: 'animation' },
30
+ { key: 'animation.trigger', label: 'Trigger', type: 'enum', enumValues: ['viewport', 'immediate'], group: 'animation' },
31
+ { key: 'animation.duration', label: 'Duration (ms)', type: 'number', defaultValue: 400, group: 'animation' },
32
+ ];
33
+ const ctaFields = (prefix, label) => [
34
+ { key: `${prefix}.labelKey`, label: `${label} Label Key`, type: 'string', group: 'content' },
35
+ { key: `${prefix}.action.type`, label: `${label} Action Type`, type: 'enum', enumValues: ['link', 'noop'], group: 'content' },
36
+ { key: `${prefix}.action.href`, label: `${label} Href`, type: 'string', group: 'content' },
37
+ ];
38
+ // ---------------------------------------------------------------------------
39
+ // Per-section-type schema definitions
40
+ // ---------------------------------------------------------------------------
41
+ const SECTION_SCHEMAS = {
42
+ hero: () => ({
43
+ sectionType: 'hero',
44
+ label: 'Hero',
45
+ fields: [
46
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true, group: 'content' },
47
+ { key: 'eyebrowKey', label: 'Eyebrow Key', type: 'string', group: 'content' },
48
+ { key: 'taglineKey', label: 'Tagline Key', type: 'string', group: 'content' },
49
+ { key: 'supportKey', label: 'Support Key', type: 'string', group: 'content' },
50
+ { key: 'mottoKey', label: 'Motto Key', type: 'string', group: 'content' },
51
+ { key: 'poeticAsideKey', label: 'Poetic Aside Key', type: 'string', group: 'content' },
52
+ { key: 'layout', label: 'Layout', type: 'enum', enumValues: ['default', 'split'], group: 'layout' },
53
+ { key: 'layoutMode', label: 'Layout Mode', type: 'enum', enumValues: ['stack', 'split', 'stage-right'], group: 'layout' },
54
+ { key: 'primaryFocus', label: 'Primary Focus', type: 'enum', enumValues: ['copy', 'action-box', 'balanced'], group: 'layout' },
55
+ { key: 'heroPanel', label: 'Hero Panel', type: 'enum', enumValues: ['none', 'inline', 'right-box'], group: 'layout' },
56
+ { key: 'foldVisibility', label: 'Fold Visibility', type: 'enum', enumValues: ['immediate', 'scroll'], group: 'layout' },
57
+ ...ctaFields('cta', 'CTA'),
58
+ ...ctaFields('ctaSecondary', 'CTA Secondary'),
59
+ { key: 'visualAssetPath', label: 'Visual Asset Path', type: 'string', group: 'content' },
60
+ ...presentationFields,
61
+ ...animationFields,
62
+ ],
63
+ }),
64
+ cards: () => ({
65
+ sectionType: 'cards',
66
+ label: 'Cards',
67
+ fields: [
68
+ { key: 'titleKey', label: 'Title Key', type: 'string', group: 'content' },
69
+ { key: 'descKey', label: 'Description Key', type: 'string', group: 'content' },
70
+ { key: 'variant', label: 'Variant', type: 'enum', enumValues: ['catalog'], required: true, group: 'layout' },
71
+ { key: 'density', label: 'Density', type: 'enum', enumValues: ['default', 'compact'], group: 'layout' },
72
+ {
73
+ key: 'items', label: 'Cards', type: 'array', required: true, group: 'content',
74
+ itemFields: [
75
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true },
76
+ { key: 'descKey', label: 'Description Key', type: 'string' },
77
+ { key: 'iconText', label: 'Icon Text', type: 'string' },
78
+ { key: 'badgeKey', label: 'Badge Key', type: 'string' },
79
+ ],
80
+ },
81
+ ...presentationFields,
82
+ ...animationFields,
83
+ ],
84
+ }),
85
+ comparison: () => ({
86
+ sectionType: 'comparison',
87
+ label: 'Comparison',
88
+ fields: [
89
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true, group: 'content' },
90
+ { key: 'subtitleKey', label: 'Subtitle Key', type: 'string', group: 'content' },
91
+ { key: 'left.titleKey', label: 'Left Title Key', type: 'string', required: true, group: 'content' },
92
+ { key: 'left.itemsKeys', label: 'Left Items Keys', type: 'json', required: true, group: 'content', description: 'JSON array of i18n keys' },
93
+ { key: 'right.titleKey', label: 'Right Title Key', type: 'string', required: true, group: 'content' },
94
+ { key: 'right.itemsKeys', label: 'Right Items Keys', type: 'json', required: true, group: 'content', description: 'JSON array of i18n keys' },
95
+ ...presentationFields,
96
+ ...animationFields,
97
+ ],
98
+ }),
99
+ cta: () => ({
100
+ sectionType: 'cta',
101
+ label: 'Call to Action',
102
+ fields: [
103
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true, group: 'content' },
104
+ { key: 'bodyKey', label: 'Body Key', type: 'string', group: 'content' },
105
+ ...ctaFields('primary', 'Primary CTA'),
106
+ ...ctaFields('secondary', 'Secondary CTA'),
107
+ ...presentationFields,
108
+ ...animationFields,
109
+ ],
110
+ }),
111
+ form: () => ({
112
+ sectionType: 'form',
113
+ label: 'Form',
114
+ fields: [
115
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true, group: 'content' },
116
+ { key: 'leadKey', label: 'Lead Key', type: 'string', group: 'content' },
117
+ { key: 'variant', label: 'Variant', type: 'enum', enumValues: ['demo'], group: 'layout' },
118
+ { key: 'submitKey', label: 'Submit Label Key', type: 'string', required: true, group: 'content' },
119
+ { key: 'consentKey', label: 'Consent Key', type: 'string', group: 'content' },
120
+ { key: 'legalKey', label: 'Legal Key', type: 'string', group: 'content' },
121
+ {
122
+ key: 'fields', label: 'Form Fields', type: 'array', required: true, group: 'content',
123
+ itemFields: [
124
+ { key: 'name', label: 'Field Name', type: 'string', required: true },
125
+ { key: 'type', label: 'Field Type', type: 'enum', enumValues: ['text', 'email', 'select', 'textarea', 'checkbox'], required: true },
126
+ { key: 'labelKey', label: 'Label Key', type: 'string', required: true },
127
+ { key: 'placeholderKey', label: 'Placeholder Key', type: 'string' },
128
+ { key: 'required', label: 'Required', type: 'boolean' },
129
+ { key: 'width', label: 'Width', type: 'enum', enumValues: ['half', 'full'] },
130
+ ],
131
+ },
132
+ ...presentationFields,
133
+ ...animationFields,
134
+ ],
135
+ }),
136
+ manifesto: () => ({
137
+ sectionType: 'manifesto',
138
+ label: 'Manifesto',
139
+ fields: [
140
+ { key: 'contentPrefix', label: 'Content Prefix', type: 'string', group: 'content', description: 'i18n key prefix for manifesto paragraphs' },
141
+ { key: 'ctaLabelKey', label: 'CTA Label Key', type: 'string', group: 'content' },
142
+ { key: 'ctaHref', label: 'CTA Href', type: 'string', group: 'content' },
143
+ ...presentationFields,
144
+ ...animationFields,
145
+ ],
146
+ }),
147
+ spacer: () => ({
148
+ sectionType: 'spacer',
149
+ label: 'Spacer',
150
+ fields: [
151
+ { key: 'size', label: 'Size', type: 'enum', enumValues: ['sm', 'md', 'lg'], group: 'layout' },
152
+ ...presentationFields,
153
+ ],
154
+ }),
155
+ stats: () => ({
156
+ sectionType: 'stats',
157
+ label: 'Stats',
158
+ fields: [
159
+ { key: 'titleKey', label: 'Title Key', type: 'string', group: 'content' },
160
+ {
161
+ key: 'items', label: 'Stat Items', type: 'array', required: true, group: 'content',
162
+ itemFields: [
163
+ { key: 'valueKey', label: 'Value Key', type: 'string', required: true },
164
+ { key: 'labelKey', label: 'Label Key', type: 'string', required: true },
165
+ ],
166
+ },
167
+ ...presentationFields,
168
+ ...animationFields,
169
+ ],
170
+ }),
171
+ 'how-it-works': () => ({
172
+ sectionType: 'how-it-works',
173
+ label: 'How It Works',
174
+ fields: [
175
+ { key: 'titleKey', label: 'Title Key', type: 'string', group: 'content' },
176
+ { key: 'subtitleKey', label: 'Subtitle Key', type: 'string', group: 'content' },
177
+ {
178
+ key: 'steps', label: 'Steps', type: 'array', required: true, group: 'content',
179
+ itemFields: [
180
+ { key: 'numKey', label: 'Number Key', type: 'string', required: true },
181
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true },
182
+ { key: 'descKey', label: 'Description Key', type: 'string', required: true },
183
+ ],
184
+ },
185
+ ...presentationFields,
186
+ ...animationFields,
187
+ ],
188
+ }),
189
+ advisor: () => ({
190
+ sectionType: 'advisor',
191
+ label: 'Advisor',
192
+ fields: [
193
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true, group: 'content' },
194
+ { key: 'leadKey', label: 'Lead Key', type: 'string', group: 'content' },
195
+ { key: 'promptPlaceholderKey', label: 'Prompt Placeholder Key', type: 'string', group: 'content' },
196
+ { key: 'submitKey', label: 'Submit Key', type: 'string', required: true, group: 'content' },
197
+ { key: 'submitUrl', label: 'Submit URL', type: 'string', group: 'content' },
198
+ { key: 'loadingKey', label: 'Loading Key', type: 'string', group: 'content' },
199
+ { key: 'fallbackTitleKey', label: 'Fallback Title Key', type: 'string', required: true, group: 'content' },
200
+ { key: 'fallbackBodyKey', label: 'Fallback Body Key', type: 'string', required: true, group: 'content' },
201
+ {
202
+ key: 'prompts', label: 'Quick Prompts', type: 'array', required: true, group: 'content',
203
+ itemFields: [
204
+ { key: 'id', label: 'ID', type: 'string', required: true },
205
+ { key: 'labelKey', label: 'Label Key', type: 'string', required: true },
206
+ { key: 'answerTitleKey', label: 'Answer Title Key', type: 'string', required: true },
207
+ { key: 'answerBodyKey', label: 'Answer Body Key', type: 'string', required: true },
208
+ ],
209
+ },
210
+ ...presentationFields,
211
+ ...animationFields,
212
+ ],
213
+ }),
214
+ 'mermaid-diagram': () => ({
215
+ sectionType: 'mermaid-diagram',
216
+ label: 'Mermaid Diagram',
217
+ fields: [
218
+ { key: 'titleKey', label: 'Title Key', type: 'string', group: 'content' },
219
+ { key: 'descKey', label: 'Description Key', type: 'string', group: 'content' },
220
+ { key: 'mermaidCode', label: 'Mermaid Code', type: 'text', required: true, group: 'content' },
221
+ { key: 'height', label: 'Height', type: 'enum', enumValues: ['auto', 'sm', 'md', 'lg'], group: 'layout' },
222
+ ...presentationFields,
223
+ ...animationFields,
224
+ ],
225
+ }),
226
+ 'data-list': () => ({
227
+ sectionType: 'data-list',
228
+ label: 'Data List',
229
+ fields: [
230
+ { key: 'titleKey', label: 'Title Key', type: 'string', group: 'content' },
231
+ { key: 'dataUrl', label: 'Data URL', type: 'string', required: true, group: 'content' },
232
+ {
233
+ key: 'columns', label: 'Columns', type: 'array', required: true, group: 'content',
234
+ itemFields: [
235
+ { key: 'key', label: 'Key', type: 'string', required: true },
236
+ { key: 'labelKey', label: 'Label Key', type: 'string', required: true },
237
+ { key: 'format', label: 'Format', type: 'enum', enumValues: ['datetime', 'date', 'currency'] },
238
+ ],
239
+ },
240
+ ...presentationFields,
241
+ ...animationFields,
242
+ ],
243
+ }),
244
+ 'action-form': () => ({
245
+ sectionType: 'action-form',
246
+ label: 'Action Form',
247
+ fields: [
248
+ { key: 'titleKey', label: 'Title Key', type: 'string', required: true, group: 'content' },
249
+ { key: 'submitUrl', label: 'Submit URL', type: 'string', required: true, group: 'content' },
250
+ { key: 'submitKey', label: 'Submit Label Key', type: 'string', required: true, group: 'content' },
251
+ { key: 'successKey', label: 'Success Message Key', type: 'string', required: true, group: 'content' },
252
+ {
253
+ key: 'fields', label: 'Fields', type: 'array', required: true, group: 'content',
254
+ itemFields: [
255
+ { key: 'name', label: 'Field Name', type: 'string', required: true },
256
+ { key: 'type', label: 'Field Type', type: 'enum', enumValues: ['text', 'email', 'number', 'date', 'datetime-local', 'textarea'], required: true },
257
+ { key: 'labelKey', label: 'Label Key', type: 'string', required: true },
258
+ { key: 'placeholderKey', label: 'Placeholder Key', type: 'string' },
259
+ { key: 'required', label: 'Required', type: 'boolean' },
260
+ ],
261
+ },
262
+ ...presentationFields,
263
+ ...animationFields,
264
+ ],
265
+ }),
266
+ };
267
+ // ---------------------------------------------------------------------------
268
+ // Public API
269
+ // ---------------------------------------------------------------------------
270
+ /**
271
+ * Returns the list of section types that the editor supports.
272
+ */
273
+ export function getEditableSectionTypes() {
274
+ return Object.keys(SECTION_SCHEMAS);
275
+ }
276
+ /**
277
+ * Generates the editor schema for a given section type.
278
+ * Returns null if the section type is not supported.
279
+ */
280
+ export function generateEditorSchema(sectionType) {
281
+ const factory = SECTION_SCHEMAS[sectionType];
282
+ return factory ? factory() : null;
283
+ }
284
+ /**
285
+ * Returns editor schemas for all supported section types.
286
+ */
287
+ export function generateAllEditorSchemas() {
288
+ return Object.values(SECTION_SCHEMAS).map((factory) => factory());
289
+ }
290
+ /**
291
+ * Deep-get a value from an object using a dot-separated path.
292
+ */
293
+ function deepGet(obj, path) {
294
+ const parts = path.split('.');
295
+ let current = obj;
296
+ for (const part of parts) {
297
+ if (current == null || typeof current !== 'object')
298
+ return undefined;
299
+ current = current[part];
300
+ }
301
+ return current;
302
+ }
303
+ /**
304
+ * Deep-set a value in an object using a dot-separated path (immutable — returns new object).
305
+ */
306
+ function deepSet(obj, path, value) {
307
+ const parts = path.split('.');
308
+ if (parts.length === 1) {
309
+ return { ...obj, [parts[0]]: value };
310
+ }
311
+ const [head, ...rest] = parts;
312
+ const child = (obj[head] != null && typeof obj[head] === 'object')
313
+ ? { ...obj[head] }
314
+ : {};
315
+ return { ...obj, [head]: deepSet(child, rest.join('.'), value) };
316
+ }
317
+ /**
318
+ * Apply a patch (key-value map) to a section within a PageSpec.
319
+ * Returns a new PageSpec (immutable) + validation warnings.
320
+ *
321
+ * Keys use dot notation for nested fields (e.g. "presentation.surface").
322
+ * If value is null/undefined, the field is removed.
323
+ */
324
+ export function applySectionPatch(spec, sectionIndex, patch) {
325
+ const warnings = [];
326
+ if (sectionIndex < 0 || sectionIndex >= spec.sections.length) {
327
+ return {
328
+ spec,
329
+ warnings: [{ field: '_index', message: `Section index ${sectionIndex} out of bounds (0..${spec.sections.length - 1})` }],
330
+ };
331
+ }
332
+ // Clone sections array
333
+ const newSections = [...spec.sections];
334
+ let section = { ...newSections[sectionIndex] };
335
+ // Apply each patch field
336
+ for (const [key, value] of Object.entries(patch)) {
337
+ if (value === null || value === undefined) {
338
+ // Remove field — rebuild without it
339
+ const parts = key.split('.');
340
+ if (parts.length === 1) {
341
+ const { [key]: _removed, ...rest } = section;
342
+ section = rest;
343
+ }
344
+ else {
345
+ // For nested, set to undefined and let JSON.parse(JSON.stringify) clean it
346
+ section = deepSet(section, key, undefined);
347
+ }
348
+ }
349
+ else {
350
+ section = deepSet(section, key, value);
351
+ }
352
+ }
353
+ // Validate: section must still have a type
354
+ if (!section.type || typeof section.type !== 'string') {
355
+ warnings.push({ field: 'type', message: 'Section type is missing or invalid after patch' });
356
+ }
357
+ // Validate: check required fields per schema
358
+ const schema = section.type ? generateEditorSchema(section.type) : null;
359
+ if (schema) {
360
+ for (const field of schema.fields) {
361
+ if (field.required && deepGet(section, field.key) == null) {
362
+ warnings.push({ field: field.key, message: `Required field "${field.label}" is missing` });
363
+ }
364
+ }
365
+ }
366
+ newSections[sectionIndex] = section;
367
+ const newSpec = {
368
+ ...spec,
369
+ sections: newSections,
370
+ };
371
+ // Final validation
372
+ if (!validatePageSpec(newSpec)) {
373
+ warnings.push({ field: '_spec', message: 'Patched spec failed PageSpecV1 validation' });
374
+ }
375
+ return { spec: newSpec, warnings };
376
+ }
377
+ /**
378
+ * Add a new section to a PageSpec at a given index.
379
+ * Returns the updated spec.
380
+ */
381
+ export function addSection(spec, section, atIndex) {
382
+ const newSections = [...spec.sections];
383
+ const idx = atIndex ?? newSections.length;
384
+ newSections.splice(idx, 0, section);
385
+ return { ...spec, sections: newSections };
386
+ }
387
+ /**
388
+ * Remove a section from a PageSpec by index.
389
+ * Returns the updated spec.
390
+ */
391
+ export function removeSection(spec, sectionIndex) {
392
+ if (sectionIndex < 0 || sectionIndex >= spec.sections.length)
393
+ return spec;
394
+ const newSections = [...spec.sections];
395
+ newSections.splice(sectionIndex, 1);
396
+ return { ...spec, sections: newSections };
397
+ }
398
+ /**
399
+ * Move a section within a PageSpec (reorder).
400
+ * Returns the updated spec.
401
+ */
402
+ export function moveSection(spec, fromIndex, toIndex) {
403
+ if (fromIndex < 0 || fromIndex >= spec.sections.length)
404
+ return spec;
405
+ if (toIndex < 0 || toIndex >= spec.sections.length)
406
+ return spec;
407
+ if (fromIndex === toIndex)
408
+ return spec;
409
+ const newSections = [...spec.sections];
410
+ const [moved] = newSections.splice(fromIndex, 1);
411
+ newSections.splice(toIndex, 0, moved);
412
+ return { ...spec, sections: newSections };
413
+ }
414
+ /**
415
+ * Update page-level fields (id, titleKey, profile, themeId, chrome, seo).
416
+ * Returns the updated spec.
417
+ */
418
+ export function applyPagePatch(spec, patch) {
419
+ return { ...spec, ...patch, version: '1', sections: spec.sections };
420
+ }
421
+ //# sourceMappingURL=editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.js","sourceRoot":"","sources":["../../src/core/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAqClD,8EAA8E;AAC9E,2DAA2D;AAC3D,8EAA8E;AAE9E,MAAM,kBAAkB,GAAsB;IAC1C,EAAE,GAAG,EAAE,sBAAsB,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE;IACtL,EAAE,GAAG,EAAE,4BAA4B,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE;IACzJ,EAAE,GAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE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AG,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACpC,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CACvB,IAAgB,EAChB,SAAiB,EACjB,OAAe;IAEf,IAAI,SAAS,GAAG,CAAC,IAAI,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACpE,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAChE,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IAEvC,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IACjD,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC1B,IAAgB,EAChB,KAAwD;IAExD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Template Gallery — Pure helpers for enumerating catalog entries.
3
+ * PBI #610 — Provides gallery-ready metadata from ValentinoCatalogV1.
4
+ *
5
+ * No DOM, no fetch — pure functions only.
6
+ * The consumer (portal) renders the gallery UI.
7
+ */
8
+ import type { ValentinoCatalogV1, PageSpecV1, PagesManifestV1 } from './types.js';
9
+ export type GalleryEntryKind = 'blueprint' | 'template' | 'page';
10
+ export type GalleryEntry = {
11
+ /** Unique key (blueprint ID, template ID, or page ID) */
12
+ id: string;
13
+ kind: GalleryEntryKind;
14
+ /** Display name (derived from ID) */
15
+ name: string;
16
+ /** Description for the gallery card */
17
+ description: string;
18
+ /** Page profile (if available) */
19
+ profile?: string;
20
+ /** Theme ID (if available) */
21
+ themeId?: string;
22
+ /** Number of sections in the blueprint/page */
23
+ sectionCount: number;
24
+ /** Section types present (for preview/filtering) */
25
+ sectionTypes: string[];
26
+ /** Governance tier (if available) */
27
+ governanceTier?: string;
28
+ };
29
+ export type GalleryFilter = {
30
+ kind?: GalleryEntryKind | GalleryEntryKind[];
31
+ profile?: string;
32
+ sectionType?: string;
33
+ search?: string;
34
+ };
35
+ /**
36
+ * List all gallery entries from a catalog.
37
+ * Returns blueprints first, then templates.
38
+ */
39
+ export declare function listCatalogEntries(catalog: ValentinoCatalogV1): GalleryEntry[];
40
+ /**
41
+ * List gallery entries from a pages manifest (existing pages as starting points).
42
+ * Optionally provide a specs map (pageId -> PageSpecV1) for richer metadata.
43
+ */
44
+ export declare function listPageEntries(manifest: PagesManifestV1, specs?: Map<string, PageSpecV1>): GalleryEntry[];
45
+ /**
46
+ * List all gallery entries: catalog + manifest pages.
47
+ */
48
+ export declare function listAllGalleryEntries(catalog: ValentinoCatalogV1, manifest?: PagesManifestV1, specs?: Map<string, PageSpecV1>): GalleryEntry[];
49
+ /**
50
+ * Filter gallery entries by criteria.
51
+ */
52
+ export declare function filterGalleryEntries(entries: GalleryEntry[], filter: GalleryFilter): GalleryEntry[];
53
+ //# sourceMappingURL=gallery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../src/core/gallery.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACR,kBAAkB,EAGlB,UAAU,EACV,eAAe,EAGlB,MAAM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,MAAM,EAAE,aAAa,GACtB,YAAY,EAAE,CAgBhB"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Template Gallery — Pure helpers for enumerating catalog entries.
3
+ * PBI #610 — Provides gallery-ready metadata from ValentinoCatalogV1.
4
+ *
5
+ * No DOM, no fetch — pure functions only.
6
+ * The consumer (portal) renders the gallery UI.
7
+ */
8
+ // ---------------------------------------------------------------------------
9
+ // Helpers
10
+ // ---------------------------------------------------------------------------
11
+ /** Convert a kebab-case or camelCase ID to a human-readable name */
12
+ function humanize(id) {
13
+ return id
14
+ .replace(/[-_]/g, ' ')
15
+ .replace(/([a-z])([A-Z])/g, '$1 $2')
16
+ .replace(/\b\w/g, c => c.toUpperCase())
17
+ .trim();
18
+ }
19
+ function uniqueSectionTypes(sections) {
20
+ return [...new Set(sections.map(s => s.type))];
21
+ }
22
+ // ---------------------------------------------------------------------------
23
+ // Entry builders
24
+ // ---------------------------------------------------------------------------
25
+ function blueprintToEntry(id, entry) {
26
+ const spec = entry.spec;
27
+ return {
28
+ id,
29
+ kind: 'blueprint',
30
+ name: humanize(id),
31
+ description: `Blueprint: ${spec.sections.length} sections, profile ${spec.profile || 'generic'}`,
32
+ profile: spec.profile,
33
+ themeId: spec.themeId,
34
+ sectionCount: spec.sections.length,
35
+ sectionTypes: uniqueSectionTypes(spec.sections),
36
+ governanceTier: entry.governance?.tier,
37
+ };
38
+ }
39
+ function templateToEntry(id, entry) {
40
+ return {
41
+ id,
42
+ kind: 'template',
43
+ name: humanize(id),
44
+ description: `Template: profile ${entry.page?.profile || 'generic'}`,
45
+ profile: entry.page?.profile,
46
+ themeId: entry.page?.themeId,
47
+ sectionCount: 0,
48
+ sectionTypes: [],
49
+ };
50
+ }
51
+ function manifestPageToEntry(page, pageSpec) {
52
+ const sections = pageSpec?.sections || [];
53
+ return {
54
+ id: page.id,
55
+ kind: 'page',
56
+ name: humanize(page.id),
57
+ description: `Page: ${page.route}`,
58
+ profile: pageSpec?.profile,
59
+ themeId: pageSpec?.themeId,
60
+ sectionCount: sections.length,
61
+ sectionTypes: uniqueSectionTypes(sections),
62
+ };
63
+ }
64
+ // ---------------------------------------------------------------------------
65
+ // Public API
66
+ // ---------------------------------------------------------------------------
67
+ /**
68
+ * List all gallery entries from a catalog.
69
+ * Returns blueprints first, then templates.
70
+ */
71
+ export function listCatalogEntries(catalog) {
72
+ const entries = [];
73
+ for (const [id, entry] of Object.entries(catalog.pageBlueprints)) {
74
+ entries.push(blueprintToEntry(id, entry));
75
+ }
76
+ for (const [id, entry] of Object.entries(catalog.templates)) {
77
+ entries.push(templateToEntry(id, entry));
78
+ }
79
+ return entries;
80
+ }
81
+ /**
82
+ * List gallery entries from a pages manifest (existing pages as starting points).
83
+ * Optionally provide a specs map (pageId -> PageSpecV1) for richer metadata.
84
+ */
85
+ export function listPageEntries(manifest, specs) {
86
+ return manifest.pages
87
+ .filter(p => p.status === 'published')
88
+ .map(p => manifestPageToEntry(p, specs?.get(p.id)));
89
+ }
90
+ /**
91
+ * List all gallery entries: catalog + manifest pages.
92
+ */
93
+ export function listAllGalleryEntries(catalog, manifest, specs) {
94
+ const entries = listCatalogEntries(catalog);
95
+ if (manifest) {
96
+ entries.push(...listPageEntries(manifest, specs));
97
+ }
98
+ return entries;
99
+ }
100
+ /**
101
+ * Filter gallery entries by criteria.
102
+ */
103
+ export function filterGalleryEntries(entries, filter) {
104
+ return entries.filter(entry => {
105
+ if (filter.kind) {
106
+ const kinds = Array.isArray(filter.kind) ? filter.kind : [filter.kind];
107
+ if (!kinds.includes(entry.kind))
108
+ return false;
109
+ }
110
+ if (filter.profile && entry.profile !== filter.profile)
111
+ return false;
112
+ if (filter.sectionType && !entry.sectionTypes.includes(filter.sectionType))
113
+ return false;
114
+ if (filter.search) {
115
+ const q = filter.search.toLowerCase();
116
+ if (!entry.name.toLowerCase().includes(q) && !entry.description.toLowerCase().includes(q)) {
117
+ return false;
118
+ }
119
+ }
120
+ return true;
121
+ });
122
+ }
123
+ //# sourceMappingURL=gallery.js.map