@kubuild/components 0.2.0 → 0.3.1

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 (133) hide show
  1. package/dist/blocks/forms.d.ts +6 -0
  2. package/dist/blocks/forms.d.ts.map +1 -0
  3. package/dist/blocks/index.cjs +1661 -0
  4. package/dist/blocks/index.cjs.map +1 -0
  5. package/dist/blocks/index.d.ts +11 -0
  6. package/dist/blocks/index.d.ts.map +1 -0
  7. package/dist/blocks/index.js +15 -0
  8. package/dist/blocks/index.js.map +1 -0
  9. package/dist/blocks/layout.d.ts +6 -0
  10. package/dist/blocks/layout.d.ts.map +1 -0
  11. package/dist/blocks/sections.d.ts +6 -0
  12. package/dist/blocks/sections.d.ts.map +1 -0
  13. package/dist/{blocks.d.ts → blocks/types.d.ts} +2 -5
  14. package/dist/blocks/types.d.ts.map +1 -0
  15. package/dist/chunk-JTQ35OQQ.js +1631 -0
  16. package/dist/chunk-JTQ35OQQ.js.map +1 -0
  17. package/dist/chunk-K6I6U7F3.js +2707 -0
  18. package/dist/chunk-K6I6U7F3.js.map +1 -0
  19. package/dist/chunk-OK53DS7G.js +911 -0
  20. package/dist/chunk-OK53DS7G.js.map +1 -0
  21. package/dist/definitions/constants.d.ts +10 -0
  22. package/dist/definitions/constants.d.ts.map +1 -0
  23. package/dist/definitions/data/collection.d.ts +3 -0
  24. package/dist/definitions/data/collection.d.ts.map +1 -0
  25. package/dist/definitions/data/index.d.ts +4 -0
  26. package/dist/definitions/data/index.d.ts.map +1 -0
  27. package/dist/definitions/data/list.d.ts +4 -0
  28. package/dist/definitions/data/list.d.ts.map +1 -0
  29. package/dist/definitions/data/table.d.ts +5 -0
  30. package/dist/definitions/data/table.d.ts.map +1 -0
  31. package/dist/definitions/form/button.d.ts +4 -0
  32. package/dist/definitions/form/button.d.ts.map +1 -0
  33. package/dist/definitions/form/checkbox.d.ts +3 -0
  34. package/dist/definitions/form/checkbox.d.ts.map +1 -0
  35. package/dist/definitions/form/file-upload.d.ts +3 -0
  36. package/dist/definitions/form/file-upload.d.ts.map +1 -0
  37. package/dist/definitions/form/form.d.ts +3 -0
  38. package/dist/definitions/form/form.d.ts.map +1 -0
  39. package/dist/definitions/form/index.d.ts +10 -0
  40. package/dist/definitions/form/index.d.ts.map +1 -0
  41. package/dist/definitions/form/input.d.ts +3 -0
  42. package/dist/definitions/form/input.d.ts.map +1 -0
  43. package/dist/definitions/form/radio.d.ts +5 -0
  44. package/dist/definitions/form/radio.d.ts.map +1 -0
  45. package/dist/definitions/form/select.d.ts +3 -0
  46. package/dist/definitions/form/select.d.ts.map +1 -0
  47. package/dist/definitions/form/switch.d.ts +3 -0
  48. package/dist/definitions/form/switch.d.ts.map +1 -0
  49. package/dist/definitions/form/textarea.d.ts +3 -0
  50. package/dist/definitions/form/textarea.d.ts.map +1 -0
  51. package/dist/definitions/index.cjs +3512 -0
  52. package/dist/definitions/index.cjs.map +1 -0
  53. package/dist/definitions/index.d.ts +12 -0
  54. package/dist/definitions/index.d.ts.map +1 -0
  55. package/dist/definitions/index.js +90 -0
  56. package/dist/definitions/index.js.map +1 -0
  57. package/dist/definitions/interactive/collapsible.d.ts +3 -0
  58. package/dist/definitions/interactive/collapsible.d.ts.map +1 -0
  59. package/dist/definitions/interactive/drawer.d.ts +3 -0
  60. package/dist/definitions/interactive/drawer.d.ts.map +1 -0
  61. package/dist/definitions/interactive/index.d.ts +4 -0
  62. package/dist/definitions/interactive/index.d.ts.map +1 -0
  63. package/dist/definitions/interactive/modal.d.ts +3 -0
  64. package/dist/definitions/interactive/modal.d.ts.map +1 -0
  65. package/dist/definitions/layout/columns.d.ts +3 -0
  66. package/dist/definitions/layout/columns.d.ts.map +1 -0
  67. package/dist/definitions/layout/container.d.ts +3 -0
  68. package/dist/definitions/layout/container.d.ts.map +1 -0
  69. package/dist/definitions/layout/flex.d.ts +7 -0
  70. package/dist/definitions/layout/flex.d.ts.map +1 -0
  71. package/dist/definitions/layout/grid.d.ts +7 -0
  72. package/dist/definitions/layout/grid.d.ts.map +1 -0
  73. package/dist/definitions/layout/index.d.ts +7 -0
  74. package/dist/definitions/layout/index.d.ts.map +1 -0
  75. package/dist/definitions/layout/page.d.ts +3 -0
  76. package/dist/definitions/layout/page.d.ts.map +1 -0
  77. package/dist/definitions/layout/section.d.ts +3 -0
  78. package/dist/definitions/layout/section.d.ts.map +1 -0
  79. package/dist/definitions/media/html-embed.d.ts +3 -0
  80. package/dist/definitions/media/html-embed.d.ts.map +1 -0
  81. package/dist/definitions/media/icon.d.ts +3 -0
  82. package/dist/definitions/media/icon.d.ts.map +1 -0
  83. package/dist/definitions/media/image.d.ts +3 -0
  84. package/dist/definitions/media/image.d.ts.map +1 -0
  85. package/dist/definitions/media/index.d.ts +5 -0
  86. package/dist/definitions/media/index.d.ts.map +1 -0
  87. package/dist/definitions/media/video.d.ts +3 -0
  88. package/dist/definitions/media/video.d.ts.map +1 -0
  89. package/dist/definitions/types.d.ts +5 -0
  90. package/dist/definitions/types.d.ts.map +1 -0
  91. package/dist/definitions/typography/badge.d.ts +3 -0
  92. package/dist/definitions/typography/badge.d.ts.map +1 -0
  93. package/dist/definitions/typography/blockquote.d.ts +3 -0
  94. package/dist/definitions/typography/blockquote.d.ts.map +1 -0
  95. package/dist/definitions/typography/code-block.d.ts +3 -0
  96. package/dist/definitions/typography/code-block.d.ts.map +1 -0
  97. package/dist/definitions/typography/heading.d.ts +3 -0
  98. package/dist/definitions/typography/heading.d.ts.map +1 -0
  99. package/dist/definitions/typography/index.d.ts +8 -0
  100. package/dist/definitions/typography/index.d.ts.map +1 -0
  101. package/dist/definitions/typography/link.d.ts +3 -0
  102. package/dist/definitions/typography/link.d.ts.map +1 -0
  103. package/dist/definitions/typography/paragraph.d.ts +3 -0
  104. package/dist/definitions/typography/paragraph.d.ts.map +1 -0
  105. package/dist/definitions/typography/text.d.ts +3 -0
  106. package/dist/definitions/typography/text.d.ts.map +1 -0
  107. package/dist/index.cjs +1568 -814
  108. package/dist/index.cjs.map +1 -1
  109. package/dist/index.js +120 -4332
  110. package/dist/index.js.map +1 -1
  111. package/dist/traits/common.d.ts +8 -0
  112. package/dist/traits/common.d.ts.map +1 -0
  113. package/dist/{traits.d.ts → traits/form.d.ts} +2 -109
  114. package/dist/traits/form.d.ts.map +1 -0
  115. package/dist/traits/index.cjs +998 -0
  116. package/dist/traits/index.cjs.map +1 -0
  117. package/dist/traits/index.d.ts +7 -0
  118. package/dist/traits/index.d.ts.map +1 -0
  119. package/dist/traits/index.js +129 -0
  120. package/dist/traits/index.js.map +1 -0
  121. package/dist/traits/link.d.ts +8 -0
  122. package/dist/traits/link.d.ts.map +1 -0
  123. package/dist/traits/media.d.ts +18 -0
  124. package/dist/traits/media.d.ts.map +1 -0
  125. package/dist/traits/structure.d.ts +10 -0
  126. package/dist/traits/structure.d.ts.map +1 -0
  127. package/dist/traits/types.d.ts +69 -0
  128. package/dist/traits/types.d.ts.map +1 -0
  129. package/package.json +20 -4
  130. package/dist/blocks.d.ts.map +0 -1
  131. package/dist/definitions.d.ts +0 -37
  132. package/dist/definitions.d.ts.map +0 -1
  133. package/dist/traits.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,3076 +1,119 @@
1
- // src/registry.ts
2
- var ComponentRegistry = class {
3
- components = /* @__PURE__ */ new Map();
4
- register(definition, allowOverride = false) {
5
- if (!allowOverride && this.components.has(definition.type)) {
6
- throw new Error(`Component type "${definition.type}" is already registered.`);
7
- }
8
- this.components.set(definition.type, definition);
9
- }
10
- unregister(type) {
11
- return this.components.delete(type);
12
- }
13
- get(type) {
14
- return this.components.get(type);
15
- }
16
- has(type) {
17
- return this.components.has(type);
18
- }
19
- list() {
20
- return Array.from(this.components.values());
21
- }
22
- listByCategory(category) {
23
- return this.list().filter((c) => c.category === category);
24
- }
25
- /**
26
- * Check whether `childType` is a valid insertion target under `parentType`,
27
- * covering both directions of child policy: the parent's `acceptsChildren`/
28
- * `allowedChildren` (by type, category, or `'*'`) and the child's own
29
- * `disallowedParents`. Used by the builder to reject an invalid insertion
30
- * before a node is constructed, rather than after the fact via `validateNode`.
31
- */
32
- canInsertChild(parentType, childType) {
33
- const errors = [];
34
- const parentDef = this.get(parentType);
35
- const childDef = this.get(childType);
36
- if (!parentDef) {
37
- errors.push(`Unknown target parent type: "${parentType}".`);
38
- }
39
- if (!childDef) {
40
- errors.push(`Unknown component type: "${childType}".`);
41
- }
42
- if (!parentDef || !childDef) {
43
- return { valid: false, errors };
44
- }
45
- if (!parentDef.acceptsChildren) {
46
- errors.push(`"${parentDef.label}" does not accept children.`);
47
- } else if (parentDef.allowedChildren) {
48
- const allowed = parentDef.allowedChildren.includes("*") || parentDef.allowedChildren.includes(childType) || parentDef.allowedChildren.includes(childDef.category);
49
- if (!allowed) {
50
- errors.push(`"${parentDef.label}" does not allow "${childDef.label}" as a child.`);
51
- }
52
- }
53
- if (childDef.disallowedParents?.includes(parentType)) {
54
- errors.push(`"${childDef.label}" is not allowed inside "${parentDef.label}".`);
55
- }
56
- return { valid: errors.length === 0, errors };
57
- }
58
- validateNode(node, parentType) {
59
- const def = this.get(node.type);
60
- const errors = [];
61
- if (!def) {
62
- errors.push(`Unknown component type: "${node.type}"`);
63
- return { valid: false, errors };
64
- }
65
- if (!def.acceptsChildren && node.children && node.children.length > 0) {
66
- errors.push(`Component "${node.type}" does not accept children.`);
67
- }
68
- if (def.allowedChildren && node.children) {
69
- for (const child of node.children) {
70
- const childCategory = this.get(child.type)?.category;
71
- const allowed = def.allowedChildren.includes("*") || def.allowedChildren.includes(child.type) || childCategory !== void 0 && def.allowedChildren.includes(childCategory);
72
- if (!allowed) {
73
- errors.push(`Component "${node.type}" does not allow child type "${child.type}".`);
74
- }
75
- }
76
- }
77
- if (parentType && def.disallowedParents?.includes(parentType)) {
78
- errors.push(`Component "${node.type}" is not allowed inside parent "${parentType}".`);
79
- }
80
- if (def.validateProps && node.props) {
81
- const propResult = def.validateProps(node.props);
82
- if (Array.isArray(propResult) && propResult.length > 0) {
83
- errors.push(...propResult);
84
- } else if (propResult === false) {
85
- errors.push(`Props validation failed for component "${node.type}".`);
86
- }
87
- }
88
- return { valid: errors.length === 0, errors };
89
- }
90
- };
91
-
92
- // src/definitions.ts
93
- import { isActionBinding, isAssetReference, isVariableBinding } from "@kubuild/schema";
94
-
95
- // src/traits.ts
96
- var TRAIT_GROUP_ORDER = [
97
- "identity",
98
- "link",
99
- "media",
100
- "form",
101
- "behavior",
102
- "semantic",
103
- "accessibility"
104
- ];
105
- var TRAIT_GROUP_LABELS = {
106
- identity: "Identity",
107
- link: "Link",
108
- media: "Media",
109
- form: "Form",
110
- behavior: "Behavior",
111
- semantic: "Semantic",
112
- accessibility: "Accessibility"
113
- };
114
- function withOverrides(base, overrides) {
115
- return overrides ? { ...base, ...overrides } : base;
116
- }
117
- function hrefTrait(overrides) {
118
- return withOverrides(
119
- {
120
- name: "href",
121
- label: "Link URL",
122
- type: "string",
123
- defaultValue: "#",
124
- attribute: "href",
125
- group: "link",
126
- description: "The destination URL the element navigates to when activated."
127
- },
128
- overrides
129
- );
130
- }
131
- function targetTrait(overrides) {
132
- return withOverrides(
133
- {
134
- name: "target",
135
- label: "Open In",
136
- type: "select",
137
- defaultValue: "_self",
138
- attribute: "target",
139
- group: "link",
140
- options: [
141
- { label: "Same tab (_self)", value: "_self" },
142
- { label: "New tab (_blank)", value: "_blank" },
143
- { label: "Parent frame (_parent)", value: "_parent" },
144
- { label: "Top frame (_top)", value: "_top" }
145
- ],
146
- description: "Where the linked resource should open."
147
- },
148
- overrides
149
- );
150
- }
151
- function relTrait(overrides) {
152
- return withOverrides(
153
- {
154
- name: "rel",
155
- label: "Relationship (rel)",
156
- type: "string",
157
- defaultValue: "",
158
- attribute: "rel",
159
- group: "link",
160
- description: 'Space-separated relationship tokens (e.g. "noopener noreferrer").'
161
- },
162
- overrides
163
- );
164
- }
165
- function altTrait(overrides) {
166
- return withOverrides(
167
- {
168
- name: "alt",
169
- label: "Alt Text",
170
- type: "string",
171
- attribute: "alt",
172
- group: "accessibility",
173
- required: true,
174
- description: "Alternative text describing the media for screen readers and fallback."
175
- },
176
- overrides
177
- );
178
- }
179
- function titleTrait(overrides) {
180
- return withOverrides(
181
- {
182
- name: "title",
183
- label: "Title",
184
- type: "string",
185
- attribute: "title",
186
- group: "semantic",
187
- description: "Advisory title for the element (tooltip / document title)."
188
- },
189
- overrides
190
- );
191
- }
192
- function placeholderTrait(overrides) {
193
- return withOverrides(
194
- {
195
- name: "placeholder",
196
- label: "Placeholder",
197
- type: "string",
198
- attribute: "placeholder",
199
- group: "form",
200
- description: "Hint text shown inside the control when it is empty."
201
- },
202
- overrides
203
- );
204
- }
205
- function ariaLabelTrait(overrides) {
206
- return withOverrides(
207
- {
208
- name: "ariaLabel",
209
- label: "Accessible Label (aria-label)",
210
- type: "string",
211
- attribute: "aria-label",
212
- group: "accessibility",
213
- description: "Accessible name for assistive technology when no visible label exists."
214
- },
215
- overrides
216
- );
217
- }
218
- function idTrait(overrides) {
219
- return withOverrides(
220
- {
221
- name: "id",
222
- label: "Element ID",
223
- type: "string",
224
- attribute: "id",
225
- group: "identity",
226
- description: "A custom, document-unique identifier used for anchors, CSS, and scripting."
227
- },
228
- overrides
229
- );
230
- }
231
- function fieldNameTrait(overrides) {
232
- return withOverrides(
233
- {
234
- name: "name",
235
- label: "Field Name",
236
- type: "string",
237
- attribute: "name",
238
- group: "form",
239
- required: true,
240
- description: "The name submitted with the form data for this field."
241
- },
242
- overrides
243
- );
244
- }
245
- function requiredTrait(overrides) {
246
- return withOverrides(
247
- {
248
- name: "required",
249
- label: "Required",
250
- type: "boolean",
251
- defaultValue: false,
252
- attribute: "required",
253
- group: "form",
254
- description: "Whether the field must be filled before the form can be submitted."
255
- },
256
- overrides
257
- );
258
- }
259
- function disabledTrait(overrides) {
260
- return withOverrides(
261
- {
262
- name: "disabled",
263
- label: "Disabled",
264
- type: "boolean",
265
- defaultValue: false,
266
- attribute: "disabled",
267
- group: "behavior",
268
- description: "Disables the control so it cannot be focused or activated."
269
- },
270
- overrides
271
- );
272
- }
273
- function readOnlyTrait(overrides) {
274
- return withOverrides(
275
- {
276
- name: "readOnly",
277
- label: "Read Only",
278
- type: "boolean",
279
- defaultValue: false,
280
- attribute: "readonly",
281
- group: "behavior",
282
- description: "Prevents the user from modifying the control value."
283
- },
284
- overrides
285
- );
286
- }
287
- function srcTrait(overrides) {
288
- return withOverrides(
289
- {
290
- name: "src",
291
- label: "Source URL",
292
- type: "string",
293
- attribute: "src",
294
- group: "media",
295
- required: true,
296
- description: "The source URL of the media resource."
297
- },
298
- overrides
299
- );
300
- }
301
- function posterTrait(overrides) {
302
- return withOverrides(
303
- {
304
- name: "poster",
305
- label: "Poster Image URL",
306
- type: "string",
307
- attribute: "poster",
308
- group: "media",
309
- description: "A preview image shown before the video starts playing."
310
- },
311
- overrides
312
- );
313
- }
314
- function controlsTrait(overrides) {
315
- return withOverrides(
316
- {
317
- name: "controls",
318
- label: "Show Controls",
319
- type: "boolean",
320
- defaultValue: true,
321
- attribute: "controls",
322
- group: "media",
323
- description: "Whether to show the native play/pause/volume controls."
324
- },
325
- overrides
326
- );
327
- }
328
- function autoplayTrait(overrides) {
329
- return withOverrides(
330
- {
331
- name: "autoplay",
332
- label: "Autoplay",
333
- type: "boolean",
334
- defaultValue: false,
335
- attribute: "autoplay",
336
- group: "media",
337
- description: "Whether the media starts playing automatically on load."
338
- },
339
- overrides
340
- );
341
- }
342
- function loopTrait(overrides) {
343
- return withOverrides(
344
- {
345
- name: "loop",
346
- label: "Loop",
347
- type: "boolean",
348
- defaultValue: false,
349
- attribute: "loop",
350
- group: "media",
351
- description: "Whether the media restarts automatically when it reaches the end."
352
- },
353
- overrides
354
- );
355
- }
356
- function mutedTrait(overrides) {
357
- return withOverrides(
358
- {
359
- name: "muted",
360
- label: "Muted",
361
- type: "boolean",
362
- defaultValue: false,
363
- attribute: "muted",
364
- group: "media",
365
- description: "Whether the media starts with the audio muted."
366
- },
367
- overrides
368
- );
369
- }
370
- function citeTrait(overrides) {
371
- return withOverrides(
372
- {
373
- name: "cite",
374
- label: "Citation URL (cite)",
375
- type: "string",
376
- attribute: "cite",
377
- group: "semantic",
378
- description: "The URL of the source document the quote is taken from."
379
- },
380
- overrides
381
- );
382
- }
383
- function loadingTrait(overrides) {
384
- return withOverrides(
385
- {
386
- name: "loading",
387
- label: "Loading Mode",
388
- type: "select",
389
- defaultValue: "lazy",
390
- attribute: "loading",
391
- group: "media",
392
- options: [
393
- { label: "Lazy (load when near viewport)", value: "lazy" },
394
- { label: "Eager (load immediately)", value: "eager" }
395
- ],
396
- description: "Native loading hint: lazy defers offscreen images, eager loads immediately."
397
- },
398
- overrides
399
- );
400
- }
401
- function actionTrait(overrides) {
402
- return withOverrides(
403
- {
404
- name: "action",
405
- label: "Action URL",
406
- type: "string",
407
- attribute: "action",
408
- group: "form",
409
- description: "The URL the form data is submitted to."
410
- },
411
- overrides
412
- );
413
- }
414
- function methodTrait(overrides) {
415
- return withOverrides(
416
- {
417
- name: "method",
418
- label: "Method",
419
- type: "select",
420
- defaultValue: "POST",
421
- attribute: "method",
422
- group: "form",
423
- options: [
424
- { label: "POST", value: "POST" },
425
- { label: "GET", value: "GET" }
426
- ],
427
- description: "The HTTP method used to submit the form."
428
- },
429
- overrides
430
- );
431
- }
432
- function autoCompleteTrait(overrides) {
433
- return withOverrides(
434
- {
435
- name: "autoComplete",
436
- label: "Auto Complete",
437
- type: "select",
438
- defaultValue: "on",
439
- attribute: "autocomplete",
440
- group: "form",
441
- options: [
442
- { label: "On", value: "on" },
443
- { label: "Off", value: "off" }
444
- ],
445
- description: "Whether the browser may autofill values for this form."
446
- },
447
- overrides
448
- );
449
- }
450
- function valueTrait(overrides) {
451
- return withOverrides(
452
- {
453
- name: "value",
454
- label: "Value",
455
- type: "string",
456
- attribute: "value",
457
- group: "form",
458
- description: "The value submitted with the form data when the control is selected."
459
- },
460
- overrides
461
- );
462
- }
463
- function defaultCheckedTrait(overrides) {
464
- return withOverrides(
465
- {
466
- name: "defaultChecked",
467
- label: "Default Checked",
468
- type: "boolean",
469
- defaultValue: false,
470
- attribute: "checked",
471
- group: "form",
472
- description: "Whether the control starts in the checked state."
473
- },
474
- overrides
475
- );
476
- }
477
- function defaultValueTrait(overrides) {
478
- return withOverrides(
479
- {
480
- name: "defaultValue",
481
- label: "Default Value",
482
- type: "string",
483
- attribute: "value",
484
- group: "form",
485
- description: "The initial value of the control before the user edits it."
486
- },
487
- overrides
488
- );
489
- }
490
- function rowsTrait(overrides) {
491
- return withOverrides(
492
- {
493
- name: "rows",
494
- label: "Rows",
495
- type: "number",
496
- defaultValue: 4,
497
- attribute: "rows",
498
- group: "form",
499
- description: "The number of visible text lines in the textarea."
500
- },
501
- overrides
502
- );
503
- }
504
- function colSpanTrait(overrides) {
505
- return withOverrides(
506
- {
507
- name: "colSpan",
508
- label: "Column Span (colSpan)",
509
- type: "number",
510
- defaultValue: 1,
511
- attribute: "colspan",
512
- group: "semantic",
513
- description: "The number of columns the cell spans."
514
- },
515
- overrides
516
- );
517
- }
518
- function rowSpanTrait(overrides) {
519
- return withOverrides(
520
- {
521
- name: "rowSpan",
522
- label: "Row Span (rowSpan)",
523
- type: "number",
524
- defaultValue: 1,
525
- attribute: "rowspan",
526
- group: "semantic",
527
- description: "The number of rows the cell spans."
528
- },
529
- overrides
530
- );
531
- }
532
- function tagTrait(overrides) {
533
- return withOverrides(
534
- {
535
- name: "tag",
536
- label: "HTML Tag",
537
- type: "select",
538
- attribute: "tag",
539
- group: "semantic",
540
- description: "The semantic HTML tag the component renders as."
541
- },
542
- overrides
543
- );
544
- }
545
- function inputTypeTrait(overrides) {
546
- return withOverrides(
547
- {
548
- name: "type",
549
- label: "Input Type",
550
- type: "select",
551
- defaultValue: "text",
552
- attribute: "type",
553
- group: "form",
554
- description: "The semantic input type of the control."
555
- },
556
- overrides
557
- );
558
- }
559
- function buttonTypeTrait(overrides) {
560
- return withOverrides(
561
- {
562
- name: "buttonType",
563
- label: "Button Type",
564
- type: "select",
565
- defaultValue: "button",
566
- attribute: "type",
567
- group: "form",
568
- options: [
569
- { label: "Button", value: "button" },
570
- { label: "Submit Form (submit)", value: "submit" },
571
- { label: "Reset Form (reset)", value: "reset" }
572
- ],
573
- description: "The button\u2019s behavior inside a form."
574
- },
575
- overrides
576
- );
577
- }
578
- function preventDefaultTrait(overrides) {
579
- return withOverrides(
580
- {
581
- name: "preventDefault",
582
- label: "Prevent Default",
583
- type: "boolean",
584
- defaultValue: true,
585
- group: "form",
586
- description: "Intercept the native browser submit and handle it via the KUBUILD action pipeline instead."
587
- },
588
- overrides
589
- );
590
- }
591
- function scrollToFirstErrorTrait(overrides) {
592
- return withOverrides(
593
- {
594
- name: "scrollToFirstError",
595
- label: "Scroll to First Error",
596
- type: "boolean",
597
- defaultValue: true,
598
- group: "form",
599
- description: "Automatically scroll to and focus the first invalid field when submission fails validation."
600
- },
601
- overrides
602
- );
603
- }
604
- function resetOnSubmitTrait(overrides) {
605
- return withOverrides(
606
- {
607
- name: "resetOnSubmit",
608
- label: "Reset on Submit",
609
- type: "boolean",
610
- defaultValue: false,
611
- group: "form",
612
- description: "Reset all fields to their initial values after a successful form submission."
613
- },
614
- overrides
615
- );
616
- }
617
- function patternTrait(overrides) {
618
- return withOverrides(
619
- {
620
- name: "pattern",
621
- label: "Pattern (regex)",
622
- type: "string",
623
- attribute: "pattern",
624
- group: "form",
625
- description: "A regular expression the input value must match to pass validation."
626
- },
627
- overrides
628
- );
629
- }
630
- function minLengthTrait(overrides) {
631
- return withOverrides(
632
- {
633
- name: "minLength",
634
- label: "Min Length",
635
- type: "number",
636
- attribute: "minlength",
637
- group: "form",
638
- description: "The minimum number of characters the user must enter."
639
- },
640
- overrides
641
- );
642
- }
643
- function maxLengthTrait(overrides) {
644
- return withOverrides(
645
- {
646
- name: "maxLength",
647
- label: "Max Length",
648
- type: "number",
649
- attribute: "maxlength",
650
- group: "form",
651
- description: "The maximum number of characters the user is allowed to enter."
652
- },
653
- overrides
654
- );
655
- }
656
- function prefixIconTrait(overrides) {
657
- return withOverrides(
658
- {
659
- name: "prefixIcon",
660
- label: "Prefix Icon",
661
- type: "string",
662
- group: "form",
663
- description: 'Lucide icon name displayed before the input value (e.g. "mail", "search").'
664
- },
665
- overrides
666
- );
667
- }
668
- function suffixIconTrait(overrides) {
669
- return withOverrides(
670
- {
671
- name: "suffixIcon",
672
- label: "Suffix Icon",
673
- type: "string",
674
- group: "form",
675
- description: 'Lucide icon name displayed after the input value (e.g. "eye", "check").'
676
- },
677
- overrides
678
- );
679
- }
680
- function helperTextTrait(overrides) {
681
- return withOverrides(
682
- {
683
- name: "helperText",
684
- label: "Helper Text",
685
- type: "string",
686
- group: "form",
687
- description: 'A short message displayed below the input to guide the user (e.g. "Must be at least 8 characters").'
688
- },
689
- overrides
690
- );
691
- }
692
- function resizeTrait(overrides) {
693
- return withOverrides(
694
- {
695
- name: "resize",
696
- label: "Resize",
697
- type: "select",
698
- defaultValue: "vertical",
699
- group: "form",
700
- options: [
701
- { label: "Vertical only", value: "vertical" },
702
- { label: "Horizontal only", value: "horizontal" },
703
- { label: "Both", value: "both" },
704
- { label: "None", value: "none" }
705
- ],
706
- description: "Controls whether and how the user can resize the textarea."
707
- },
708
- overrides
709
- );
710
- }
711
- function autoGrowTrait(overrides) {
712
- return withOverrides(
713
- {
714
- name: "autoGrow",
715
- label: "Auto Grow",
716
- type: "boolean",
717
- defaultValue: false,
718
- group: "form",
719
- description: "Automatically expand the textarea height to fit the content without scrolling."
720
- },
721
- overrides
722
- );
723
- }
724
- function maxCharCountTrait(overrides) {
725
- return withOverrides(
726
- {
727
- name: "maxCharCount",
728
- label: "Max Character Count",
729
- type: "number",
730
- group: "form",
731
- description: 'Maximum character limit displayed as a counter below the textarea (e.g. "120 / 500").'
732
- },
733
- overrides
734
- );
735
- }
736
- function optionsListTrait(overrides) {
737
- return withOverrides(
738
- {
739
- name: "options",
740
- label: "Options",
741
- type: "string",
742
- group: "form",
743
- description: "The list of dropdown options, each with a label and value. Editable via the inspector trait panel."
744
- },
745
- overrides
746
- );
747
- }
748
- function labelTextTrait(overrides) {
749
- return withOverrides(
750
- {
751
- name: "label",
752
- label: "Label Text",
753
- type: "string",
754
- group: "form",
755
- description: "The visible text label displayed alongside the control."
756
- },
757
- overrides
758
- );
759
- }
760
- function indeterminateTrait(overrides) {
761
- return withOverrides(
762
- {
763
- name: "indeterminate",
764
- label: "Indeterminate",
765
- type: "boolean",
766
- defaultValue: false,
767
- group: "form",
768
- description: "Renders the checkbox in a mixed/indeterminate visual state (neither checked nor unchecked)."
769
- },
770
- overrides
771
- );
772
- }
773
- function switchSizeTrait(overrides) {
774
- return withOverrides(
775
- {
776
- name: "switchSize",
777
- label: "Size",
778
- type: "select",
779
- defaultValue: "md",
780
- group: "form",
781
- options: [
782
- { label: "Small", value: "sm" },
783
- { label: "Medium", value: "md" },
784
- { label: "Large", value: "lg" }
785
- ],
786
- description: "The visual size of the switch toggle."
787
- },
788
- overrides
789
- );
790
- }
791
- function orientationTrait(overrides) {
792
- return withOverrides(
793
- {
794
- name: "orientation",
795
- label: "Orientation",
796
- type: "select",
797
- defaultValue: "vertical",
798
- group: "form",
799
- options: [
800
- { label: "Vertical", value: "vertical" },
801
- { label: "Horizontal", value: "horizontal" }
802
- ],
803
- description: "The layout direction of the child controls (vertical stack or horizontal row)."
804
- },
805
- overrides
806
- );
807
- }
808
- function defaultSelectedTrait(overrides) {
809
- return withOverrides(
810
- {
811
- name: "defaultSelected",
812
- label: "Default Selected",
813
- type: "string",
814
- group: "form",
815
- description: "The value of the radio item that is selected by default."
816
- },
817
- overrides
818
- );
819
- }
820
- function acceptTrait(overrides) {
821
- return withOverrides(
822
- {
823
- name: "accept",
824
- label: "Accepted File Types",
825
- type: "string",
826
- attribute: "accept",
827
- defaultValue: "*/*",
828
- group: "form",
829
- description: 'Comma-separated list of MIME types or file extensions accepted (e.g. "image/*,.pdf,.docx").'
830
- },
831
- overrides
832
- );
833
- }
834
- function maxFileSizeTrait(overrides) {
835
- return withOverrides(
836
- {
837
- name: "maxFileSize",
838
- label: "Max File Size (MB)",
839
- type: "number",
840
- defaultValue: 10,
841
- group: "form",
842
- description: "The maximum allowable file size in megabytes (MB)."
843
- },
844
- overrides
845
- );
846
- }
847
- function multipleTrait(overrides) {
848
- return withOverrides(
849
- {
850
- name: "multiple",
851
- label: "Allow Multiple Files",
852
- type: "boolean",
853
- attribute: "multiple",
854
- defaultValue: false,
855
- group: "form",
856
- description: "Allow multiple files to be selected and uploaded at once."
857
- },
858
- overrides
859
- );
860
- }
861
- function showPreviewTrait(overrides) {
862
- return withOverrides(
863
- {
864
- name: "showPreview",
865
- label: "Show Preview",
866
- type: "boolean",
867
- defaultValue: true,
868
- group: "form",
869
- description: "Display an interactive preview (image thumbnail or file list with badges) for selected files."
870
- },
871
- overrides
872
- );
873
- }
874
- function loadingTextTrait(overrides) {
875
- return withOverrides(
876
- {
877
- name: "loadingText",
878
- label: "Loading Text",
879
- type: "string",
880
- defaultValue: "Submitting...",
881
- group: "behavior",
882
- description: "Text displayed on the button while the form submission is in progress."
883
- },
884
- overrides
885
- );
886
- }
887
- function showSpinnerTrait(overrides) {
888
- return withOverrides(
889
- {
890
- name: "showSpinner",
891
- label: "Show Loading Spinner",
892
- type: "boolean",
893
- defaultValue: true,
894
- group: "behavior",
895
- description: "Automatically show an animated loading spinner icon while form is submitting."
896
- },
897
- overrides
898
- );
899
- }
900
- function autoDisableOnSubmitTrait(overrides) {
901
- return withOverrides(
902
- {
903
- name: "autoDisableOnSubmit",
904
- label: "Auto Disable on Submit",
905
- type: "boolean",
906
- defaultValue: true,
907
- group: "behavior",
908
- description: "Automatically disable the button to prevent duplicate submissions while the form is submitting."
909
- },
910
- overrides
911
- );
912
- }
913
- function sortTraits(traits) {
914
- const groupRank = (group) => {
915
- if (!group) return Number.MAX_SAFE_INTEGER;
916
- const idx = TRAIT_GROUP_ORDER.indexOf(group);
917
- return idx === -1 ? Number.MAX_SAFE_INTEGER : idx;
918
- };
919
- return [...traits].sort((a, b) => groupRank(a.group) - groupRank(b.group));
920
- }
921
- function collectTraitNames(traitsList) {
922
- const names = /* @__PURE__ */ new Set();
923
- for (const traits of traitsList) {
924
- for (const trait of traits) {
925
- names.add(trait.name);
926
- }
927
- }
928
- return Array.from(names);
929
- }
930
-
931
- // src/definitions.ts
932
- var LAYOUT_PARENTS = ["page", "section", "container", "columns"];
933
- var CONTENT_CHILD_TYPES = [
934
- "heading",
935
- "text",
936
- "paragraph",
937
- "link",
938
- "blockquote",
939
- "badge",
940
- "code-block",
941
- "image",
942
- "video",
943
- "icon",
944
- "html-embed",
945
- "button",
946
- "button-submit",
947
- "form",
948
- "input",
949
- "textarea",
950
- "select",
951
- "checkbox",
952
- "switch",
953
- "radio-group",
954
- "radio",
955
- "radio-item",
956
- "file-upload",
957
- "list",
958
- "table",
959
- "collection",
960
- "custom"
961
- ];
962
- var pageDefinition = {
963
- type: "page",
964
- label: "Page",
965
- category: "layout",
966
- icon: "layout",
967
- acceptsChildren: true,
968
- allowedChildren: ["section", "custom"],
969
- disallowedParents: [...LAYOUT_PARENTS, ...CONTENT_CHILD_TYPES, "list-item", "table-row", "table-cell"],
970
- defaultProps: { title: "New Page" },
971
- traits: [
972
- titleTrait({ defaultValue: "New Page", description: "The document title shown in the browser tab and search results." }),
973
- idTrait()
974
- ],
975
- defaultStyles: { base: { minHeight: "100vh", backgroundColor: "#ffffff" } }
976
- };
977
- var sectionDefinition = {
978
- type: "section",
979
- label: "Section",
980
- category: "layout",
981
- icon: "rows",
982
- acceptsChildren: true,
983
- allowedChildren: ["container", "columns", ...CONTENT_CHILD_TYPES],
984
- defaultProps: {},
985
- traits: [
986
- idTrait(),
987
- ariaLabelTrait({ description: "Accessible name for the section landmark." })
988
- ],
989
- defaultStyles: {
990
- base: {
991
- paddingTop: "48px",
992
- paddingBottom: "48px",
993
- paddingLeft: "16px",
994
- paddingRight: "16px"
995
- },
996
- tablet: {
997
- paddingTop: "32px",
998
- paddingBottom: "32px"
999
- },
1000
- mobile: {
1001
- paddingTop: "24px",
1002
- paddingBottom: "24px",
1003
- paddingLeft: "16px",
1004
- paddingRight: "16px"
1005
- }
1006
- }
1007
- };
1008
- var containerDefinition = {
1009
- type: "container",
1010
- label: "Container",
1011
- category: "layout",
1012
- icon: "box",
1013
- acceptsChildren: true,
1014
- allowedChildren: ["columns", ...CONTENT_CHILD_TYPES],
1015
- defaultProps: { maxWidth: "1200px" },
1016
- traits: [
1017
- idTrait()
1018
- ],
1019
- defaultStyles: {
1020
- base: {
1021
- maxWidth: "1200px",
1022
- margin: "0 auto",
1023
- width: "100%"
1024
- },
1025
- tablet: {
1026
- maxWidth: "720px"
1027
- },
1028
- mobile: {
1029
- maxWidth: "100%",
1030
- paddingLeft: "16px",
1031
- paddingRight: "16px"
1032
- }
1033
- }
1034
- };
1035
- var columnsDefinition = {
1036
- type: "columns",
1037
- label: "Columns",
1038
- category: "layout",
1039
- icon: "columns",
1040
- acceptsChildren: true,
1041
- allowedChildren: ["container", ...CONTENT_CHILD_TYPES],
1042
- defaultProps: { columns: 2, gap: "16px" },
1043
- traits: [
1044
- idTrait()
1045
- ],
1046
- defaultStyles: {
1047
- base: {
1048
- display: "grid",
1049
- gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
1050
- gap: "16px"
1051
- },
1052
- tablet: {
1053
- gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
1054
- gap: "12px"
1055
- },
1056
- mobile: {
1057
- gridTemplateColumns: "repeat(1, minmax(0, 1fr))",
1058
- gap: "12px"
1059
- }
1060
- }
1061
- };
1062
- var headingDefinition = {
1063
- type: "heading",
1064
- label: "Heading",
1065
- category: "typography",
1066
- icon: "heading",
1067
- acceptsChildren: false,
1068
- defaultProps: { text: "Heading Text", level: 2 },
1069
- propFields: [
1070
- { name: "text", label: "Text", type: "string", defaultValue: "Heading Text" },
1071
- {
1072
- name: "level",
1073
- label: "Heading Level",
1074
- type: "select",
1075
- defaultValue: 2,
1076
- options: [1, 2, 3, 4, 5, 6].map((level) => ({ label: `H${level}`, value: level }))
1077
- }
1078
- ],
1079
- traits: [
1080
- idTrait(),
1081
- titleTrait({ description: "Advisory title shown when hovering the heading." }),
1082
- ariaLabelTrait()
1083
- ],
1084
- validateProps: (props) => {
1085
- const errors = [];
1086
- if (!isVariableBinding(props.text) && (typeof props.text !== "string" || props.text.trim().length === 0)) {
1087
- errors.push('Heading requires a non-empty "text".');
1088
- }
1089
- if (props.level !== void 0 && (typeof props.level !== "number" || props.level < 1 || props.level > 6)) {
1090
- errors.push('Heading "level" must be a number between 1 and 6.');
1091
- }
1092
- return errors.length > 0 ? errors : true;
1093
- },
1094
- defaultStyles: {
1095
- base: {
1096
- fontSize: "32px",
1097
- fontWeight: "700",
1098
- color: "#111827",
1099
- margin: "0 0 16px 0"
1100
- }
1101
- }
1102
- };
1103
- var textDefinition = {
1104
- type: "text",
1105
- label: "Text",
1106
- category: "typography",
1107
- icon: "type",
1108
- acceptsChildren: false,
1109
- defaultProps: { content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." },
1110
- propFields: [
1111
- { name: "content", label: "Content", type: "string", defaultValue: "Lorem ipsum dolor sit amet." }
1112
- ],
1113
- traits: [
1114
- idTrait(),
1115
- titleTrait(),
1116
- ariaLabelTrait()
1117
- ],
1118
- validateProps: (props) => {
1119
- if (!isVariableBinding(props.content) && (typeof props.content !== "string" || props.content.trim().length === 0)) {
1120
- return ['Text requires a non-empty "content".'];
1121
- }
1122
- return true;
1123
- },
1124
- defaultStyles: {
1125
- base: {
1126
- fontSize: "16px",
1127
- color: "#4b5563",
1128
- lineHeight: "1.6"
1129
- }
1130
- }
1131
- };
1132
- var imageDefinition = {
1133
- type: "image",
1134
- label: "Image",
1135
- category: "media",
1136
- icon: "image",
1137
- acceptsChildren: false,
1138
- capabilities: ["assetProvider"],
1139
- defaultProps: {
1140
- src: "https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=800&auto=format&fit=crop&q=80",
1141
- alt: "Default image",
1142
- width: 600,
1143
- height: 400
1144
- },
1145
- propFields: [
1146
- { name: "src", label: "Image URL", type: "string" },
1147
- { name: "asset", label: "Asset Reference", type: "json" },
1148
- { name: "alt", label: "Alt Text", type: "string", defaultValue: "Default image" },
1149
- { name: "width", label: "Width", type: "number" },
1150
- { name: "height", label: "Height", type: "number" }
1151
- ],
1152
- traits: [
1153
- srcTrait(),
1154
- altTrait({ defaultValue: "Default image" }),
1155
- loadingTrait(),
1156
- idTrait(),
1157
- titleTrait(),
1158
- ariaLabelTrait({ description: "Override the alt text for assistive technology (rarely needed)." })
1159
- ],
1160
- validateProps: (props) => {
1161
- const errors = [];
1162
- const hasSrc = typeof props.src === "string" && props.src.trim().length > 0 || isVariableBinding(props.src);
1163
- const hasAsset = isAssetReference(props.asset);
1164
- if (!hasSrc && !hasAsset) {
1165
- errors.push('Image requires either a non-empty "src" URL or a valid "asset" reference.');
1166
- }
1167
- const hasAlt = typeof props.alt === "string" && props.alt.trim().length > 0 || isVariableBinding(props.alt);
1168
- if (!hasAlt) {
1169
- errors.push('Image requires non-empty "alt" text.');
1170
- }
1171
- return errors.length > 0 ? errors : true;
1172
- },
1173
- defaultStyles: {
1174
- base: {
1175
- maxWidth: "100%",
1176
- height: "auto",
1177
- borderRadius: "8px"
1178
- }
1179
- }
1180
- };
1181
- var buttonDefinition = {
1182
- type: "button",
1183
- label: "Button",
1184
- category: "interactive",
1185
- icon: "mouse-pointer",
1186
- acceptsChildren: false,
1187
- capabilities: ["actionRegistry"],
1188
- defaultProps: {
1189
- label: "Click Me",
1190
- variant: "primary"
1191
- },
1192
- propFields: [
1193
- { name: "label", label: "Label", type: "string", defaultValue: "Click Me" },
1194
- { name: "href", label: "Link URL", type: "string" },
1195
- { name: "action", label: "Action", type: "action" },
1196
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
1197
- {
1198
- name: "buttonType",
1199
- label: "Button Type",
1200
- type: "select",
1201
- defaultValue: "button",
1202
- options: [
1203
- { label: "Button", value: "button" },
1204
- { label: "Submit Form (submit)", value: "submit" },
1205
- { label: "Reset Form (reset)", value: "reset" }
1206
- ]
1207
- },
1208
- {
1209
- name: "variant",
1210
- label: "Variant",
1211
- type: "select",
1212
- defaultValue: "primary",
1213
- options: [
1214
- { label: "Primary", value: "primary" },
1215
- { label: "Secondary", value: "secondary" }
1216
- ]
1217
- }
1218
- ],
1219
- traits: [
1220
- buttonTypeTrait(),
1221
- disabledTrait(),
1222
- hrefTrait({ description: "Optional URL \u2014 when set, the button renders as an anchor styled like a button." }),
1223
- targetTrait({ description: "Where to open the href URL (only used when href is set)." }),
1224
- relTrait({ description: "Relationship tokens (only used when href is set)." }),
1225
- idTrait(),
1226
- titleTrait(),
1227
- ariaLabelTrait()
1228
- ],
1229
- validateProps: (props) => {
1230
- const errors = [];
1231
- const hasLabel = typeof props.label === "string" && props.label.trim().length > 0 || isVariableBinding(props.label);
1232
- if (!hasLabel) {
1233
- errors.push('Button requires a non-empty "label".');
1234
- }
1235
- if (props.href !== void 0 && typeof props.href !== "string" && !isVariableBinding(props.href)) {
1236
- errors.push('Button "href" must be a string when provided.');
1237
- }
1238
- if (props.buttonType !== void 0 && !isVariableBinding(props.buttonType)) {
1239
- if (!["button", "submit", "reset"].includes(props.buttonType)) {
1240
- errors.push('Button "buttonType" must be one of: "button", "submit", "reset".');
1241
- }
1242
- }
1243
- if (props.action !== void 0 && !isActionBinding(props.action)) {
1244
- errors.push('Button "action" must be a valid action binding when provided.');
1245
- }
1246
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
1247
- errors.push('Button "disabled" must be a boolean when provided.');
1248
- }
1249
- return errors.length > 0 ? errors : true;
1250
- },
1251
- defaultStyles: {
1252
- base: {
1253
- backgroundColor: "#2563eb",
1254
- color: "#ffffff",
1255
- paddingTop: "10px",
1256
- paddingBottom: "10px",
1257
- paddingLeft: "20px",
1258
- paddingRight: "20px",
1259
- borderRadius: "6px",
1260
- fontWeight: "500",
1261
- fontSize: "15px",
1262
- border: "none",
1263
- cursor: "pointer"
1264
- }
1265
- }
1266
- };
1267
- var collectionDefinition = {
1268
- type: "collection",
1269
- label: "Collection",
1270
- category: "data",
1271
- icon: "database",
1272
- acceptsChildren: true,
1273
- defaultProps: {
1274
- sourceKey: "items",
1275
- itemAlias: "item"
1276
- },
1277
- propFields: [
1278
- { name: "sourceKey", label: "Source Variable", type: "string", defaultValue: "items" },
1279
- { name: "itemAlias", label: "Item Alias", type: "string", defaultValue: "item" }
1280
- ],
1281
- traits: [
1282
- idTrait(),
1283
- ariaLabelTrait({ description: 'Accessible name summarizing the repeated collection (e.g. "Product list").' })
1284
- ]
1285
- };
1286
- var listDefinition = {
1287
- type: "list",
1288
- label: "List",
1289
- category: "typography",
1290
- icon: "list",
1291
- acceptsChildren: true,
1292
- allowedChildren: ["list-item"],
1293
- defaultProps: {
1294
- tag: "ul",
1295
- listStyleType: "disc"
1296
- },
1297
- defaultChildren: [
1298
- { type: "list-item", props: { text: "List item 1" } },
1299
- { type: "list-item", props: { text: "List item 2" } },
1300
- { type: "list-item", props: { text: "List item 3" } }
1301
- ],
1302
- propFields: [
1303
- {
1304
- name: "tag",
1305
- label: "Tag",
1306
- type: "select",
1307
- defaultValue: "ul",
1308
- options: [
1309
- { label: "Unordered (ul)", value: "ul" },
1310
- { label: "Ordered (ol)", value: "ol" }
1311
- ]
1312
- },
1313
- {
1314
- name: "listStyleType",
1315
- label: "List Style Type",
1316
- type: "select",
1317
- defaultValue: "disc",
1318
- options: [
1319
- { label: "Disc", value: "disc" },
1320
- { label: "Circle", value: "circle" },
1321
- { label: "Square", value: "square" },
1322
- { label: "Decimal", value: "decimal" },
1323
- { label: "None", value: "none" },
1324
- { label: "Custom Icon", value: "custom-icon" }
1325
- ]
1326
- }
1327
- ],
1328
- traits: [
1329
- idTrait(),
1330
- ariaLabelTrait({ description: 'Accessible name for the list (e.g. "Navigation menu", "Features").' })
1331
- ],
1332
- validateProps: (props) => {
1333
- const errors = [];
1334
- if (props.tag !== void 0 && !isVariableBinding(props.tag)) {
1335
- if (props.tag !== "ul" && props.tag !== "ol") {
1336
- errors.push('List "tag" must be either "ul" or "ol".');
1337
- }
1338
- }
1339
- if (props.listStyleType !== void 0 && !isVariableBinding(props.listStyleType)) {
1340
- const allowed = ["disc", "circle", "square", "decimal", "none", "custom-icon"];
1341
- if (typeof props.listStyleType !== "string" || !allowed.includes(props.listStyleType)) {
1342
- errors.push(`List "listStyleType" must be one of: ${allowed.join(", ")}.`);
1343
- }
1344
- }
1345
- return errors.length > 0 ? errors : true;
1346
- },
1347
- defaultStyles: {
1348
- base: {
1349
- margin: "0 0 16px 0",
1350
- paddingLeft: "24px"
1351
- }
1352
- }
1353
- };
1354
- var listItemDefinition = {
1355
- type: "list-item",
1356
- label: "List Item",
1357
- category: "typography",
1358
- icon: "list-item",
1359
- acceptsChildren: true,
1360
- allowedChildren: [
1361
- "heading",
1362
- "text",
1363
- "paragraph",
1364
- "link",
1365
- "blockquote",
1366
- "badge",
1367
- "code-block",
1368
- "image",
1369
- "video",
1370
- "icon",
1371
- "html-embed",
1372
- "button",
1373
- "list",
1374
- "custom"
1375
- ],
1376
- defaultProps: {
1377
- text: "List item"
1378
- },
1379
- propFields: [
1380
- {
1381
- name: "text",
1382
- label: "Text",
1383
- type: "string",
1384
- defaultValue: "List item"
1385
- }
1386
- ],
1387
- traits: [
1388
- idTrait(),
1389
- titleTrait(),
1390
- ariaLabelTrait()
1391
- ],
1392
- validateProps: (props) => {
1393
- const errors = [];
1394
- if (props.text !== void 0 && typeof props.text !== "string" && !isVariableBinding(props.text)) {
1395
- errors.push('List Item "text" must be a string when provided.');
1396
- }
1397
- return errors.length > 0 ? errors : true;
1398
- },
1399
- defaultStyles: {
1400
- base: {
1401
- margin: "4px 0",
1402
- fontSize: "16px",
1403
- color: "#374151",
1404
- lineHeight: "1.5"
1405
- }
1406
- }
1407
- };
1408
- var paragraphDefinition = {
1409
- type: "paragraph",
1410
- label: "Paragraph",
1411
- category: "typography",
1412
- icon: "paragraph",
1413
- acceptsChildren: false,
1414
- defaultProps: {
1415
- text: "A paragraph of text with clean semantic typography."
1416
- },
1417
- propFields: [
1418
- {
1419
- name: "text",
1420
- label: "Text",
1421
- type: "string",
1422
- defaultValue: "A paragraph of text with clean semantic typography."
1423
- }
1424
- ],
1425
- traits: [
1426
- idTrait(),
1427
- titleTrait(),
1428
- ariaLabelTrait()
1429
- ],
1430
- validateProps: (props) => {
1431
- const errors = [];
1432
- const textVal = props.text ?? props.content;
1433
- if (textVal !== void 0 && !isVariableBinding(textVal) && (typeof textVal !== "string" || textVal.trim().length === 0)) {
1434
- errors.push('Paragraph requires a non-empty "text".');
1435
- }
1436
- return errors.length > 0 ? errors : true;
1437
- },
1438
- defaultStyles: {
1439
- base: {
1440
- fontSize: "16px",
1441
- color: "#4b5563",
1442
- lineHeight: "1.6",
1443
- margin: "0 0 16px 0"
1444
- }
1445
- }
1446
- };
1447
- var linkDefinition = {
1448
- type: "link",
1449
- label: "Link",
1450
- category: "typography",
1451
- icon: "link",
1452
- acceptsChildren: false,
1453
- defaultProps: {
1454
- text: "Click here",
1455
- href: "#",
1456
- target: "_self",
1457
- rel: ""
1458
- },
1459
- propFields: [
1460
- { name: "text", label: "Link Text", type: "string", defaultValue: "Click here" },
1461
- { name: "href", label: "URL (href)", type: "string", defaultValue: "#" },
1462
- {
1463
- name: "target",
1464
- label: "Target",
1465
- type: "select",
1466
- defaultValue: "_self",
1467
- options: [
1468
- { label: "Same tab (_self)", value: "_self" },
1469
- { label: "New tab (_blank)", value: "_blank" },
1470
- { label: "Parent (_parent)", value: "_parent" },
1471
- { label: "Top (_top)", value: "_top" }
1472
- ]
1473
- },
1474
- { name: "rel", label: "Relationship (rel)", type: "string", defaultValue: "" }
1475
- ],
1476
- traits: [
1477
- hrefTrait(),
1478
- targetTrait(),
1479
- relTrait(),
1480
- idTrait(),
1481
- titleTrait({ description: "Advisory title shown when hovering the link." }),
1482
- ariaLabelTrait()
1483
- ],
1484
- validateProps: (props) => {
1485
- const errors = [];
1486
- if (props.text !== void 0 && !isVariableBinding(props.text) && (typeof props.text !== "string" || props.text.trim().length === 0)) {
1487
- errors.push('Link requires a non-empty "text".');
1488
- }
1489
- if (props.href !== void 0 && typeof props.href !== "string" && !isVariableBinding(props.href)) {
1490
- errors.push('Link "href" must be a string when provided.');
1491
- }
1492
- if (props.target !== void 0 && !isVariableBinding(props.target)) {
1493
- const allowedTargets = ["_self", "_blank", "_parent", "_top"];
1494
- if (typeof props.target !== "string" || !allowedTargets.includes(props.target)) {
1495
- errors.push(`Link "target" must be one of: ${allowedTargets.join(", ")}.`);
1496
- }
1497
- }
1498
- if (props.rel !== void 0 && typeof props.rel !== "string" && !isVariableBinding(props.rel)) {
1499
- errors.push('Link "rel" must be a string when provided.');
1500
- }
1501
- return errors.length > 0 ? errors : true;
1502
- },
1503
- defaultStyles: {
1504
- base: {
1505
- color: "#2563eb",
1506
- textDecoration: "underline",
1507
- cursor: "pointer"
1508
- }
1509
- }
1510
- };
1511
- var blockquoteDefinition = {
1512
- type: "blockquote",
1513
- label: "Blockquote",
1514
- category: "typography",
1515
- icon: "blockquote",
1516
- acceptsChildren: true,
1517
- allowedChildren: [
1518
- "paragraph",
1519
- "text",
1520
- "heading",
1521
- "link",
1522
- "badge",
1523
- "code-block",
1524
- "image",
1525
- "video",
1526
- "icon",
1527
- "html-embed",
1528
- "custom"
1529
- ],
1530
- defaultProps: {
1531
- text: "\u201CSimplicity is the soul of efficiency.\u201D"
1532
- },
1533
- propFields: [
1534
- {
1535
- name: "text",
1536
- label: "Quote Text",
1537
- type: "string",
1538
- defaultValue: "\u201CSimplicity is the soul of efficiency.\u201D"
1539
- },
1540
- { name: "cite", label: "Citation URL (cite)", type: "string" }
1541
- ],
1542
- traits: [
1543
- citeTrait(),
1544
- idTrait(),
1545
- titleTrait(),
1546
- ariaLabelTrait()
1547
- ],
1548
- validateProps: (props) => {
1549
- const errors = [];
1550
- if (props.text !== void 0 && typeof props.text !== "string" && !isVariableBinding(props.text)) {
1551
- errors.push('Blockquote "text" must be a string when provided.');
1552
- }
1553
- if (props.cite !== void 0 && typeof props.cite !== "string" && !isVariableBinding(props.cite)) {
1554
- errors.push('Blockquote "cite" must be a string when provided.');
1555
- }
1556
- return errors.length > 0 ? errors : true;
1557
- },
1558
- defaultStyles: {
1559
- base: {
1560
- borderLeftWidth: "4px",
1561
- borderLeftColor: "#3b82f6",
1562
- borderLeftStyle: "solid",
1563
- paddingTop: "8px",
1564
- paddingBottom: "8px",
1565
- paddingLeft: "16px",
1566
- paddingRight: "12px",
1567
- margin: "0 0 16px 0",
1568
- fontStyle: "italic",
1569
- color: "#4b5563",
1570
- backgroundColor: "#f8fafc"
1571
- }
1572
- }
1573
- };
1574
- var badgeDefinition = {
1575
- type: "badge",
1576
- label: "Badge",
1577
- category: "typography",
1578
- icon: "badge",
1579
- acceptsChildren: false,
1580
- defaultProps: {
1581
- text: "Badge",
1582
- variant: "default"
1583
- },
1584
- propFields: [
1585
- { name: "text", label: "Badge Text", type: "string", defaultValue: "Badge" },
1586
- {
1587
- name: "variant",
1588
- label: "Variant",
1589
- type: "select",
1590
- defaultValue: "default",
1591
- options: [
1592
- { label: "Default", value: "default" },
1593
- { label: "Success", value: "success" },
1594
- { label: "Warning", value: "warning" },
1595
- { label: "Danger", value: "danger" },
1596
- { label: "Info", value: "info" }
1597
- ]
1598
- }
1599
- ],
1600
- traits: [
1601
- idTrait(),
1602
- titleTrait(),
1603
- ariaLabelTrait()
1604
- ],
1605
- validateProps: (props) => {
1606
- const errors = [];
1607
- if (props.text !== void 0 && !isVariableBinding(props.text) && (typeof props.text !== "string" || props.text.trim().length === 0)) {
1608
- errors.push('Badge requires a non-empty "text".');
1609
- }
1610
- if (props.variant !== void 0 && typeof props.variant !== "string" && !isVariableBinding(props.variant)) {
1611
- errors.push('Badge "variant" must be a string.');
1612
- }
1613
- return errors.length > 0 ? errors : true;
1614
- },
1615
- defaultStyles: {
1616
- base: {
1617
- display: "inline-flex",
1618
- alignItems: "center",
1619
- paddingLeft: "10px",
1620
- paddingRight: "10px",
1621
- paddingTop: "2px",
1622
- paddingBottom: "2px",
1623
- borderRadius: "9999px",
1624
- fontSize: "12px",
1625
- fontWeight: "500",
1626
- lineHeight: "1.4",
1627
- backgroundColor: "#e0e7ff",
1628
- color: "#3730a3"
1629
- }
1630
- }
1631
- };
1632
- var codeBlockDefinition = {
1633
- type: "code-block",
1634
- label: "Code Block",
1635
- category: "typography",
1636
- icon: "code-block",
1637
- acceptsChildren: false,
1638
- defaultProps: {
1639
- code: 'console.log("Hello, world!");',
1640
- language: "javascript"
1641
- },
1642
- propFields: [
1643
- {
1644
- name: "code",
1645
- label: "Code",
1646
- type: "textarea",
1647
- defaultValue: 'console.log("Hello, world!");'
1648
- },
1649
- {
1650
- name: "language",
1651
- label: "Language",
1652
- type: "string",
1653
- defaultValue: "javascript"
1654
- }
1655
- ],
1656
- traits: [
1657
- idTrait(),
1658
- titleTrait(),
1659
- ariaLabelTrait({ description: "Accessible label describing what the code example shows." })
1660
- ],
1661
- validateProps: (props) => {
1662
- const errors = [];
1663
- if (props.code !== void 0 && typeof props.code !== "string" && !isVariableBinding(props.code)) {
1664
- errors.push('Code Block "code" must be a string when provided.');
1665
- }
1666
- if (props.language !== void 0 && typeof props.language !== "string" && !isVariableBinding(props.language)) {
1667
- errors.push('Code Block "language" must be a string when provided.');
1668
- }
1669
- return errors.length > 0 ? errors : true;
1670
- },
1671
- defaultStyles: {
1672
- base: {
1673
- backgroundColor: "#1e293b",
1674
- color: "#f8fafc",
1675
- padding: "16px",
1676
- borderRadius: "8px",
1677
- fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
1678
- fontSize: "14px",
1679
- lineHeight: "1.5",
1680
- overflowX: "auto",
1681
- margin: "0 0 16px 0",
1682
- whiteSpace: "pre"
1683
- }
1684
- }
1685
- };
1686
- var videoDefinition = {
1687
- type: "video",
1688
- label: "Video",
1689
- category: "media",
1690
- icon: "video",
1691
- acceptsChildren: false,
1692
- defaultProps: {
1693
- src: "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
1694
- provider: "auto",
1695
- poster: "",
1696
- controls: true,
1697
- autoplay: false,
1698
- loop: false,
1699
- muted: false,
1700
- aspectRatio: "16:9"
1701
- },
1702
- propFields: [
1703
- {
1704
- name: "src",
1705
- label: "Video URL (HTML5, YouTube, Vimeo)",
1706
- type: "string",
1707
- defaultValue: "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
1708
- },
1709
- {
1710
- name: "provider",
1711
- label: "Provider",
1712
- type: "select",
1713
- defaultValue: "auto",
1714
- options: [
1715
- { label: "Auto Detect", value: "auto" },
1716
- { label: "HTML5 Video", value: "html5" },
1717
- { label: "YouTube Embed", value: "youtube" },
1718
- { label: "Vimeo Embed", value: "vimeo" }
1719
- ]
1720
- },
1721
- { name: "poster", label: "Poster Image URL", type: "string", defaultValue: "" },
1722
- { name: "controls", label: "Show Controls", type: "boolean", defaultValue: true },
1723
- { name: "autoplay", label: "Autoplay", type: "boolean", defaultValue: false },
1724
- { name: "loop", label: "Loop", type: "boolean", defaultValue: false },
1725
- { name: "muted", label: "Muted", type: "boolean", defaultValue: false },
1726
- {
1727
- name: "aspectRatio",
1728
- label: "Aspect Ratio",
1729
- type: "select",
1730
- defaultValue: "16:9",
1731
- options: [
1732
- { label: "16:9 (Widescreen)", value: "16:9" },
1733
- { label: "4:3 (Standard)", value: "4:3" },
1734
- { label: "1:1 (Square)", value: "1:1" },
1735
- { label: "9:16 (Vertical)", value: "9:16" },
1736
- { label: "Auto", value: "auto" }
1737
- ]
1738
- }
1739
- ],
1740
- traits: [
1741
- srcTrait(),
1742
- posterTrait(),
1743
- controlsTrait(),
1744
- autoplayTrait(),
1745
- loopTrait(),
1746
- mutedTrait(),
1747
- idTrait(),
1748
- titleTrait(),
1749
- ariaLabelTrait({ description: "Accessible name summarizing the video content." })
1750
- ],
1751
- validateProps: (props) => {
1752
- const errors = [];
1753
- if (props.src !== void 0 && typeof props.src !== "string" && !isVariableBinding(props.src)) {
1754
- errors.push('Video "src" must be a string when provided.');
1755
- }
1756
- if (props.provider !== void 0 && !isVariableBinding(props.provider)) {
1757
- const allowed = ["auto", "html5", "youtube", "vimeo"];
1758
- if (typeof props.provider !== "string" || !allowed.includes(props.provider)) {
1759
- errors.push(`Video "provider" must be one of: ${allowed.join(", ")}.`);
1760
- }
1761
- }
1762
- if (props.controls !== void 0 && typeof props.controls !== "boolean" && !isVariableBinding(props.controls)) {
1763
- errors.push('Video "controls" must be a boolean.');
1764
- }
1765
- if (props.autoplay !== void 0 && typeof props.autoplay !== "boolean" && !isVariableBinding(props.autoplay)) {
1766
- errors.push('Video "autoplay" must be a boolean.');
1767
- }
1768
- if (props.loop !== void 0 && typeof props.loop !== "boolean" && !isVariableBinding(props.loop)) {
1769
- errors.push('Video "loop" must be a boolean.');
1770
- }
1771
- if (props.muted !== void 0 && typeof props.muted !== "boolean" && !isVariableBinding(props.muted)) {
1772
- errors.push('Video "muted" must be a boolean.');
1773
- }
1774
- return errors.length > 0 ? errors : true;
1775
- },
1776
- defaultStyles: {
1777
- base: {
1778
- width: "100%",
1779
- maxWidth: "800px",
1780
- borderRadius: "8px",
1781
- overflow: "hidden",
1782
- display: "block",
1783
- margin: "0 0 16px 0"
1784
- }
1785
- }
1786
- };
1787
- var iconDefinition = {
1788
- type: "icon",
1789
- label: "Icon",
1790
- category: "media",
1791
- icon: "sparkles",
1792
- acceptsChildren: false,
1793
- defaultProps: {
1794
- name: "star",
1795
- size: 24,
1796
- color: "#2563eb",
1797
- strokeWidth: 2
1798
- },
1799
- propFields: [
1800
- { name: "name", label: "Icon Name (Lucide)", type: "string", defaultValue: "star" },
1801
- { name: "size", label: "Size (px)", type: "number", defaultValue: 24 },
1802
- { name: "color", label: "Color", type: "color", defaultValue: "#2563eb" },
1803
- { name: "strokeWidth", label: "Stroke Width", type: "number", defaultValue: 2 }
1804
- ],
1805
- traits: [
1806
- idTrait(),
1807
- titleTrait(),
1808
- ariaLabelTrait({ required: true, description: "Required: describes what the icon represents for screen readers." })
1809
- ],
1810
- validateProps: (props) => {
1811
- const errors = [];
1812
- if (props.name !== void 0 && !isVariableBinding(props.name) && (typeof props.name !== "string" || props.name.trim().length === 0)) {
1813
- errors.push('Icon requires a non-empty "name".');
1814
- }
1815
- if (props.size !== void 0 && !isVariableBinding(props.size)) {
1816
- if (typeof props.size !== "number" || props.size < 0) {
1817
- errors.push('Icon "size" must be a non-negative number.');
1818
- }
1819
- }
1820
- if (props.strokeWidth !== void 0 && !isVariableBinding(props.strokeWidth)) {
1821
- if (typeof props.strokeWidth !== "number" || props.strokeWidth < 0) {
1822
- errors.push('Icon "strokeWidth" must be a non-negative number.');
1823
- }
1824
- }
1825
- return errors.length > 0 ? errors : true;
1826
- },
1827
- defaultStyles: {
1828
- base: {
1829
- display: "inline-flex",
1830
- alignItems: "center",
1831
- justifyContent: "center"
1832
- }
1833
- }
1834
- };
1835
- var htmlEmbedDefinition = {
1836
- type: "html-embed",
1837
- label: "HTML Embed",
1838
- category: "custom",
1839
- icon: "code",
1840
- acceptsChildren: false,
1841
- defaultProps: {
1842
- html: '<div style="padding: 16px; background: #f1f5f9; border-radius: 8px; text-align: center; font-family: sans-serif; color: #475569;">Custom HTML Embed Content</div>'
1843
- },
1844
- propFields: [
1845
- {
1846
- name: "html",
1847
- label: "HTML / Embed Code",
1848
- type: "textarea",
1849
- defaultValue: '<div style="padding: 16px; background: #f1f5f9; border-radius: 8px; text-align: center; font-family: sans-serif; color: #475569;">Custom HTML Embed Content</div>'
1850
- }
1851
- ],
1852
- traits: [
1853
- idTrait(),
1854
- ariaLabelTrait()
1855
- ],
1856
- validateProps: (props) => {
1857
- const errors = [];
1858
- if (props.html !== void 0 && typeof props.html !== "string" && !isVariableBinding(props.html)) {
1859
- errors.push('HTML Embed "html" must be a string.');
1860
- }
1861
- return errors.length > 0 ? errors : true;
1862
- },
1863
- defaultStyles: {
1864
- base: {
1865
- width: "100%",
1866
- margin: "0 0 16px 0"
1867
- }
1868
- }
1869
- };
1870
- var tableDefinition = {
1871
- type: "table",
1872
- label: "Table",
1873
- category: "layout",
1874
- icon: "table",
1875
- acceptsChildren: true,
1876
- allowedChildren: ["table-row"],
1877
- defaultProps: {
1878
- striped: false,
1879
- bordered: true,
1880
- compact: false
1881
- },
1882
- defaultChildren: [
1883
- {
1884
- type: "table-row",
1885
- children: [
1886
- { type: "table-cell", props: { tag: "th", text: "Header 1" } },
1887
- { type: "table-cell", props: { tag: "th", text: "Header 2" } }
1888
- ]
1889
- },
1890
- {
1891
- type: "table-row",
1892
- children: [
1893
- { type: "table-cell", props: { tag: "td", text: "Data 1" } },
1894
- { type: "table-cell", props: { tag: "td", text: "Data 2" } }
1895
- ]
1896
- }
1897
- ],
1898
- propFields: [
1899
- { name: "striped", label: "Striped Rows", type: "boolean", defaultValue: false },
1900
- { name: "bordered", label: "Bordered", type: "boolean", defaultValue: true },
1901
- { name: "compact", label: "Compact Spacing", type: "boolean", defaultValue: false }
1902
- ],
1903
- traits: [
1904
- idTrait(),
1905
- ariaLabelTrait({ description: "Required: provides a caption summary for the table when no visible caption exists." })
1906
- ],
1907
- validateProps: (props) => {
1908
- const errors = [];
1909
- if (props.striped !== void 0 && typeof props.striped !== "boolean" && !isVariableBinding(props.striped)) {
1910
- errors.push('Table "striped" must be a boolean.');
1911
- }
1912
- if (props.bordered !== void 0 && typeof props.bordered !== "boolean" && !isVariableBinding(props.bordered)) {
1913
- errors.push('Table "bordered" must be a boolean.');
1914
- }
1915
- if (props.compact !== void 0 && typeof props.compact !== "boolean" && !isVariableBinding(props.compact)) {
1916
- errors.push('Table "compact" must be a boolean.');
1917
- }
1918
- return errors.length > 0 ? errors : true;
1919
- },
1920
- defaultStyles: {
1921
- base: {
1922
- width: "100%",
1923
- margin: "0 0 16px 0",
1924
- borderCollapse: "collapse"
1925
- }
1926
- }
1927
- };
1928
- var tableRowDefinition = {
1929
- type: "table-row",
1930
- label: "Table Row",
1931
- category: "layout",
1932
- icon: "table-row",
1933
- acceptsChildren: true,
1934
- allowedChildren: ["table-cell"],
1935
- disallowedParents: ["page"],
1936
- defaultProps: {},
1937
- defaultChildren: [
1938
- { type: "table-cell", props: { tag: "td", text: "Data" } }
1939
- ],
1940
- traits: [
1941
- idTrait(),
1942
- ariaLabelTrait()
1943
- ],
1944
- defaultStyles: {
1945
- base: {}
1946
- }
1947
- };
1948
- var tableCellDefinition = {
1949
- type: "table-cell",
1950
- label: "Table Cell",
1951
- category: "layout",
1952
- icon: "table-cell",
1953
- acceptsChildren: true,
1954
- allowedChildren: [
1955
- "heading",
1956
- "text",
1957
- "paragraph",
1958
- "link",
1959
- "blockquote",
1960
- "badge",
1961
- "code-block",
1962
- "image",
1963
- "video",
1964
- "icon",
1965
- "html-embed",
1966
- "button",
1967
- "list",
1968
- "custom"
1969
- ],
1970
- disallowedParents: ["page"],
1971
- defaultProps: {
1972
- tag: "td",
1973
- text: "Cell",
1974
- colSpan: 1,
1975
- rowSpan: 1
1976
- },
1977
- propFields: [
1978
- {
1979
- name: "tag",
1980
- label: "Cell Type",
1981
- type: "select",
1982
- defaultValue: "td",
1983
- options: [
1984
- { label: "Data Cell (td)", value: "td" },
1985
- { label: "Header Cell (th)", value: "th" }
1986
- ]
1987
- },
1988
- { name: "text", label: "Text", type: "string", defaultValue: "Cell" },
1989
- { name: "colSpan", label: "Column Span (colSpan)", type: "number", defaultValue: 1 },
1990
- { name: "rowSpan", label: "Row Span (rowSpan)", type: "number", defaultValue: 1 }
1991
- ],
1992
- traits: [
1993
- colSpanTrait(),
1994
- rowSpanTrait(),
1995
- idTrait(),
1996
- ariaLabelTrait()
1997
- ],
1998
- validateProps: (props) => {
1999
- const errors = [];
2000
- if (props.tag !== void 0 && !isVariableBinding(props.tag)) {
2001
- if (props.tag !== "td" && props.tag !== "th") {
2002
- errors.push('Table Cell "tag" must be either "td" or "th".');
2003
- }
2004
- }
2005
- if (props.colSpan !== void 0 && !isVariableBinding(props.colSpan)) {
2006
- if (typeof props.colSpan !== "number" || props.colSpan < 1 || !Number.isInteger(props.colSpan)) {
2007
- errors.push('Table Cell "colSpan" must be a positive integer (>= 1).');
2008
- }
2009
- }
2010
- if (props.rowSpan !== void 0 && !isVariableBinding(props.rowSpan)) {
2011
- if (typeof props.rowSpan !== "number" || props.rowSpan < 1 || !Number.isInteger(props.rowSpan)) {
2012
- errors.push('Table Cell "rowSpan" must be a positive integer (>= 1).');
2013
- }
2014
- }
2015
- if (props.text !== void 0 && typeof props.text !== "string" && !isVariableBinding(props.text)) {
2016
- errors.push('Table Cell "text" must be a string when provided.');
2017
- }
2018
- return errors.length > 0 ? errors : true;
2019
- },
2020
- defaultStyles: {
2021
- base: {
2022
- padding: "8px 12px",
2023
- borderWidth: "1px",
2024
- borderColor: "#e2e8f0",
2025
- borderStyle: "solid",
2026
- textAlign: "left"
2027
- }
2028
- }
2029
- };
2030
- var formDefinition = {
2031
- type: "form",
2032
- label: "Form",
2033
- category: "form",
2034
- icon: "form",
2035
- acceptsChildren: true,
2036
- allowedChildren: [
2037
- ...CONTENT_CHILD_TYPES,
2038
- "container",
2039
- "columns",
2040
- "section"
2041
- ],
2042
- disallowedParents: ["page"],
2043
- defaultProps: {
2044
- name: "contact_form",
2045
- method: "POST",
2046
- action: "",
2047
- target: "_self",
2048
- autoComplete: "on",
2049
- preventDefault: true,
2050
- scrollToFirstError: true,
2051
- resetOnSubmit: false
2052
- },
2053
- defaultChildren: [
2054
- { type: "input", props: { name: "name", type: "text", placeholder: "Your Name", required: true } },
2055
- { type: "input", props: { name: "email", type: "email", placeholder: "Your Email", required: true } },
2056
- { type: "textarea", props: { name: "message", placeholder: "Your Message", rows: 4, required: true } },
2057
- { type: "checkbox", props: { name: "agree", label: "I agree to the terms and privacy policy", required: true } },
2058
- { type: "button", props: { label: "Send Message", variant: "primary", buttonType: "submit" } }
2059
- ],
2060
- propFields: [
2061
- { name: "name", label: "Form Name", type: "string", defaultValue: "contact_form" },
2062
- { name: "action", label: "Action URL", type: "string" },
2063
- {
2064
- name: "method",
2065
- label: "Method",
2066
- type: "select",
2067
- defaultValue: "POST",
2068
- options: [
2069
- { label: "POST", value: "POST" },
2070
- { label: "GET", value: "GET" }
2071
- ]
2072
- },
2073
- {
2074
- name: "target",
2075
- label: "Target",
2076
- type: "select",
2077
- defaultValue: "_self",
2078
- options: [
2079
- { label: "Same Window (_self)", value: "_self" },
2080
- { label: "New Tab (_blank)", value: "_blank" }
2081
- ]
2082
- },
2083
- {
2084
- name: "autoComplete",
2085
- label: "Auto Complete",
2086
- type: "select",
2087
- defaultValue: "on",
2088
- options: [
2089
- { label: "On", value: "on" },
2090
- { label: "Off", value: "off" }
2091
- ]
2092
- },
2093
- { name: "preventDefault", label: "Prevent Default", type: "boolean", defaultValue: true },
2094
- { name: "scrollToFirstError", label: "Scroll to First Error", type: "boolean", defaultValue: true },
2095
- { name: "resetOnSubmit", label: "Reset on Submit", type: "boolean", defaultValue: false }
2096
- ],
2097
- traits: [
2098
- fieldNameTrait({ defaultValue: "contact_form", required: false }),
2099
- actionTrait(),
2100
- methodTrait(),
2101
- targetTrait({ options: [
2102
- { label: "Same Window (_self)", value: "_self" },
2103
- { label: "New Tab (_blank)", value: "_blank" },
2104
- { label: "Parent (_parent)", value: "_parent" },
2105
- { label: "Top (_top)", value: "_top" }
2106
- ] }),
2107
- autoCompleteTrait(),
2108
- preventDefaultTrait(),
2109
- scrollToFirstErrorTrait(),
2110
- resetOnSubmitTrait(),
2111
- idTrait(),
2112
- ariaLabelTrait({ description: "Accessible name for the form landmark." })
2113
- ],
2114
- validateProps: (props) => {
2115
- const errors = [];
2116
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2117
- errors.push('Form "name" must be a string when provided.');
2118
- }
2119
- if (props.action !== void 0 && typeof props.action !== "string" && !isVariableBinding(props.action)) {
2120
- errors.push('Form "action" must be a string when provided.');
2121
- }
2122
- if (props.method !== void 0 && !isVariableBinding(props.method)) {
2123
- if (!["GET", "POST", "get", "post"].includes(props.method)) {
2124
- errors.push('Form "method" must be either "GET" or "POST".');
2125
- }
2126
- }
2127
- if (props.target !== void 0 && !isVariableBinding(props.target)) {
2128
- if (!["_self", "_blank", "_parent", "_top"].includes(props.target)) {
2129
- errors.push('Form "target" must be one of: "_self", "_blank", "_parent", "_top".');
2130
- }
2131
- }
2132
- if (props.autoComplete !== void 0 && !isVariableBinding(props.autoComplete)) {
2133
- if (!["on", "off"].includes(props.autoComplete)) {
2134
- errors.push('Form "autoComplete" must be either "on" or "off".');
2135
- }
2136
- }
2137
- if (props.preventDefault !== void 0 && typeof props.preventDefault !== "boolean" && !isVariableBinding(props.preventDefault)) {
2138
- errors.push('Form "preventDefault" must be a boolean when provided.');
2139
- }
2140
- if (props.scrollToFirstError !== void 0 && typeof props.scrollToFirstError !== "boolean" && !isVariableBinding(props.scrollToFirstError)) {
2141
- errors.push('Form "scrollToFirstError" must be a boolean when provided.');
2142
- }
2143
- if (props.resetOnSubmit !== void 0 && typeof props.resetOnSubmit !== "boolean" && !isVariableBinding(props.resetOnSubmit)) {
2144
- errors.push('Form "resetOnSubmit" must be a boolean when provided.');
2145
- }
2146
- return errors.length > 0 ? errors : true;
2147
- },
2148
- defaultStyles: {
2149
- base: {
2150
- width: "100%",
2151
- display: "flex",
2152
- flexDirection: "column",
2153
- gap: "16px"
2154
- }
2155
- }
2156
- };
2157
- var inputDefinition = {
2158
- type: "input",
2159
- label: "Input",
2160
- category: "form",
2161
- icon: "input",
2162
- acceptsChildren: false,
2163
- disallowedParents: ["page"],
2164
- defaultProps: {
2165
- name: "input_field",
2166
- type: "text",
2167
- placeholder: "Enter text...",
2168
- defaultValue: "",
2169
- required: false,
2170
- disabled: false,
2171
- readOnly: false,
2172
- pattern: "",
2173
- minLength: void 0,
2174
- maxLength: void 0,
2175
- prefixIcon: "",
2176
- suffixIcon: "",
2177
- helperText: ""
2178
- },
2179
- propFields: [
2180
- { name: "name", label: "Field Name", type: "string", defaultValue: "input_field" },
2181
- {
2182
- name: "type",
2183
- label: "Input Type",
2184
- type: "select",
2185
- defaultValue: "text",
2186
- options: [
2187
- { label: "Text", value: "text" },
2188
- { label: "Email", value: "email" },
2189
- { label: "Number", value: "number" },
2190
- { label: "Password", value: "password" },
2191
- { label: "Phone (tel)", value: "tel" },
2192
- { label: "URL", value: "url" },
2193
- { label: "Search", value: "search" },
2194
- { label: "Date", value: "date" }
2195
- ]
2196
- },
2197
- { name: "placeholder", label: "Placeholder", type: "string", defaultValue: "Enter text..." },
2198
- { name: "defaultValue", label: "Default Value", type: "string" },
2199
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2200
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2201
- { name: "readOnly", label: "Read Only", type: "boolean", defaultValue: false },
2202
- { name: "pattern", label: "Pattern (regex)", type: "string" },
2203
- { name: "minLength", label: "Min Length", type: "number" },
2204
- { name: "maxLength", label: "Max Length", type: "number" },
2205
- { name: "prefixIcon", label: "Prefix Icon", type: "string" },
2206
- { name: "suffixIcon", label: "Suffix Icon", type: "string" },
2207
- { name: "helperText", label: "Helper Text", type: "string" }
2208
- ],
2209
- traits: [
2210
- inputTypeTrait({ options: [
2211
- { label: "Text", value: "text" },
2212
- { label: "Email", value: "email" },
2213
- { label: "Number", value: "number" },
2214
- { label: "Password", value: "password" },
2215
- { label: "Phone (tel)", value: "tel" },
2216
- { label: "URL", value: "url" },
2217
- { label: "Search", value: "search" },
2218
- { label: "Date", value: "date" },
2219
- { label: "Hidden", value: "hidden" }
2220
- ] }),
2221
- fieldNameTrait({ defaultValue: "input_field" }),
2222
- placeholderTrait({ defaultValue: "Enter text..." }),
2223
- defaultValueTrait(),
2224
- requiredTrait(),
2225
- patternTrait(),
2226
- minLengthTrait(),
2227
- maxLengthTrait(),
2228
- prefixIconTrait(),
2229
- suffixIconTrait(),
2230
- helperTextTrait(),
2231
- disabledTrait(),
2232
- readOnlyTrait(),
2233
- idTrait(),
2234
- ariaLabelTrait()
2235
- ],
2236
- validateProps: (props) => {
2237
- const errors = [];
2238
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2239
- errors.push('Input "name" must be a string when provided.');
2240
- }
2241
- if (props.type !== void 0 && !isVariableBinding(props.type)) {
2242
- const validTypes = ["text", "email", "number", "password", "tel", "url", "search", "date", "hidden"];
2243
- if (!validTypes.includes(props.type)) {
2244
- errors.push(`Input "type" must be one of: ${validTypes.join(", ")}.`);
2245
- }
2246
- }
2247
- if (props.placeholder !== void 0 && typeof props.placeholder !== "string" && !isVariableBinding(props.placeholder)) {
2248
- errors.push('Input "placeholder" must be a string when provided.');
2249
- }
2250
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2251
- errors.push('Input "required" must be a boolean when provided.');
2252
- }
2253
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2254
- errors.push('Input "disabled" must be a boolean when provided.');
2255
- }
2256
- if (props.readOnly !== void 0 && typeof props.readOnly !== "boolean" && !isVariableBinding(props.readOnly)) {
2257
- errors.push('Input "readOnly" must be a boolean when provided.');
2258
- }
2259
- if (props.pattern !== void 0 && typeof props.pattern !== "string" && !isVariableBinding(props.pattern)) {
2260
- errors.push('Input "pattern" must be a string when provided.');
2261
- }
2262
- if (props.minLength !== void 0 && !isVariableBinding(props.minLength)) {
2263
- if (typeof props.minLength !== "number" || props.minLength < 0 || !Number.isInteger(props.minLength)) {
2264
- errors.push('Input "minLength" must be a non-negative integer when provided.');
2265
- }
2266
- }
2267
- if (props.maxLength !== void 0 && !isVariableBinding(props.maxLength)) {
2268
- if (typeof props.maxLength !== "number" || props.maxLength < 0 || !Number.isInteger(props.maxLength)) {
2269
- errors.push('Input "maxLength" must be a non-negative integer when provided.');
2270
- }
2271
- }
2272
- if (props.prefixIcon !== void 0 && typeof props.prefixIcon !== "string" && !isVariableBinding(props.prefixIcon)) {
2273
- errors.push('Input "prefixIcon" must be a string when provided.');
2274
- }
2275
- if (props.suffixIcon !== void 0 && typeof props.suffixIcon !== "string" && !isVariableBinding(props.suffixIcon)) {
2276
- errors.push('Input "suffixIcon" must be a string when provided.');
2277
- }
2278
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2279
- errors.push('Input "helperText" must be a string when provided.');
2280
- }
2281
- return errors.length > 0 ? errors : true;
2282
- },
2283
- defaultStyles: {
2284
- base: {
2285
- width: "100%",
2286
- paddingTop: "10px",
2287
- paddingBottom: "10px",
2288
- paddingLeft: "14px",
2289
- paddingRight: "14px",
2290
- borderRadius: "6px",
2291
- borderWidth: "1px",
2292
- borderStyle: "solid",
2293
- borderColor: "#cbd5e1",
2294
- fontSize: "14px",
2295
- backgroundColor: "#ffffff",
2296
- color: "#1e293b",
2297
- boxSizing: "border-box"
2298
- }
2299
- }
2300
- };
2301
- var textareaDefinition = {
2302
- type: "textarea",
2303
- label: "Textarea",
2304
- category: "form",
2305
- icon: "textarea",
2306
- acceptsChildren: false,
2307
- disallowedParents: ["page"],
2308
- defaultProps: {
2309
- name: "message",
2310
- placeholder: "Enter your message...",
2311
- defaultValue: "",
2312
- rows: 4,
2313
- required: false,
2314
- disabled: false,
2315
- readOnly: false,
2316
- resize: "vertical",
2317
- autoGrow: false,
2318
- maxCharCount: void 0,
2319
- helperText: ""
2320
- },
2321
- propFields: [
2322
- { name: "name", label: "Field Name", type: "string", defaultValue: "message" },
2323
- { name: "placeholder", label: "Placeholder", type: "string", defaultValue: "Enter your message..." },
2324
- { name: "defaultValue", label: "Default Value", type: "textarea" },
2325
- { name: "rows", label: "Rows", type: "number", defaultValue: 4 },
2326
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2327
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2328
- { name: "readOnly", label: "Read Only", type: "boolean", defaultValue: false },
2329
- {
2330
- name: "resize",
2331
- label: "Resize",
2332
- type: "select",
2333
- defaultValue: "vertical",
2334
- options: [
2335
- { label: "Vertical only", value: "vertical" },
2336
- { label: "Horizontal only", value: "horizontal" },
2337
- { label: "Both", value: "both" },
2338
- { label: "None", value: "none" }
2339
- ]
2340
- },
2341
- { name: "autoGrow", label: "Auto Grow", type: "boolean", defaultValue: false },
2342
- { name: "maxCharCount", label: "Max Character Count", type: "number" },
2343
- { name: "helperText", label: "Helper Text", type: "string" }
2344
- ],
2345
- traits: [
2346
- fieldNameTrait({ defaultValue: "message" }),
2347
- placeholderTrait({ defaultValue: "Enter your message..." }),
2348
- defaultValueTrait(),
2349
- rowsTrait(),
2350
- resizeTrait(),
2351
- autoGrowTrait(),
2352
- maxCharCountTrait(),
2353
- helperTextTrait(),
2354
- requiredTrait(),
2355
- disabledTrait(),
2356
- readOnlyTrait(),
2357
- idTrait(),
2358
- ariaLabelTrait()
2359
- ],
2360
- validateProps: (props) => {
2361
- const errors = [];
2362
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2363
- errors.push('Textarea "name" must be a string when provided.');
2364
- }
2365
- if (props.rows !== void 0 && !isVariableBinding(props.rows)) {
2366
- if (typeof props.rows !== "number" || props.rows < 1 || !Number.isInteger(props.rows)) {
2367
- errors.push('Textarea "rows" must be a positive integer (>= 1).');
2368
- }
2369
- }
2370
- if (props.placeholder !== void 0 && typeof props.placeholder !== "string" && !isVariableBinding(props.placeholder)) {
2371
- errors.push('Textarea "placeholder" must be a string when provided.');
2372
- }
2373
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2374
- errors.push('Textarea "required" must be a boolean when provided.');
2375
- }
2376
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2377
- errors.push('Textarea "disabled" must be a boolean when provided.');
2378
- }
2379
- if (props.readOnly !== void 0 && typeof props.readOnly !== "boolean" && !isVariableBinding(props.readOnly)) {
2380
- errors.push('Textarea "readOnly" must be a boolean when provided.');
2381
- }
2382
- if (props.resize !== void 0 && !isVariableBinding(props.resize)) {
2383
- const allowedResize = ["vertical", "horizontal", "both", "none"];
2384
- if (typeof props.resize !== "string" || !allowedResize.includes(props.resize)) {
2385
- errors.push(`Textarea "resize" must be one of: ${allowedResize.join(", ")}.`);
2386
- }
2387
- }
2388
- if (props.autoGrow !== void 0 && typeof props.autoGrow !== "boolean" && !isVariableBinding(props.autoGrow)) {
2389
- errors.push('Textarea "autoGrow" must be a boolean when provided.');
2390
- }
2391
- if (props.maxCharCount !== void 0 && !isVariableBinding(props.maxCharCount)) {
2392
- if (typeof props.maxCharCount !== "number" || props.maxCharCount < 1 || !Number.isInteger(props.maxCharCount)) {
2393
- errors.push('Textarea "maxCharCount" must be a positive integer (>= 1) when provided.');
2394
- }
2395
- }
2396
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2397
- errors.push('Textarea "helperText" must be a string when provided.');
2398
- }
2399
- return errors.length > 0 ? errors : true;
2400
- },
2401
- defaultStyles: {
2402
- base: {
2403
- width: "100%",
2404
- paddingTop: "10px",
2405
- paddingBottom: "10px",
2406
- paddingLeft: "14px",
2407
- paddingRight: "14px",
2408
- borderRadius: "6px",
2409
- borderWidth: "1px",
2410
- borderStyle: "solid",
2411
- borderColor: "#cbd5e1",
2412
- fontSize: "14px",
2413
- backgroundColor: "#ffffff",
2414
- color: "#1e293b",
2415
- boxSizing: "border-box"
2416
- }
2417
- }
2418
- };
2419
- var selectDefinition = {
2420
- type: "select",
2421
- label: "Select",
2422
- category: "form",
2423
- icon: "select",
2424
- acceptsChildren: false,
2425
- disallowedParents: ["page"],
2426
- defaultProps: {
2427
- name: "select_field",
2428
- placeholder: "Select an option...",
2429
- options: [
2430
- { label: "Option 1", value: "option1" },
2431
- { label: "Option 2", value: "option2" },
2432
- { label: "Option 3", value: "option3" }
2433
- ],
2434
- defaultValue: "",
2435
- required: false,
2436
- disabled: false,
2437
- helperText: ""
2438
- },
2439
- propFields: [
2440
- { name: "name", label: "Field Name", type: "string", defaultValue: "select_field" },
2441
- { name: "placeholder", label: "Placeholder", type: "string", defaultValue: "Select an option..." },
2442
- {
2443
- name: "options",
2444
- label: "Options (JSON list)",
2445
- type: "json",
2446
- defaultValue: [
2447
- { label: "Option 1", value: "option1" },
2448
- { label: "Option 2", value: "option2" },
2449
- { label: "Option 3", value: "option3" }
2450
- ]
2451
- },
2452
- { name: "defaultValue", label: "Default Selected Value", type: "string" },
2453
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2454
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2455
- { name: "helperText", label: "Helper Text", type: "string" }
2456
- ],
2457
- traits: [
2458
- fieldNameTrait({ defaultValue: "select_field" }),
2459
- placeholderTrait({ defaultValue: "Select an option..." }),
2460
- optionsListTrait({ description: "The list of dropdown choices (label + value pairs). Editable via the inspector trait panel." }),
2461
- defaultValueTrait({ description: "The initially selected option value (must match one of the option values)." }),
2462
- helperTextTrait(),
2463
- requiredTrait(),
2464
- disabledTrait(),
2465
- idTrait(),
2466
- ariaLabelTrait()
2467
- ],
2468
- validateProps: (props) => {
2469
- const errors = [];
2470
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2471
- errors.push('Select "name" must be a string when provided.');
2472
- }
2473
- if (props.options !== void 0 && !isVariableBinding(props.options)) {
2474
- if (!Array.isArray(props.options) && typeof props.options !== "string") {
2475
- errors.push('Select "options" must be an array of option objects or a JSON string.');
2476
- }
2477
- }
2478
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2479
- errors.push('Select "required" must be a boolean when provided.');
2480
- }
2481
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2482
- errors.push('Select "disabled" must be a boolean when provided.');
2483
- }
2484
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2485
- errors.push('Select "helperText" must be a string when provided.');
2486
- }
2487
- return errors.length > 0 ? errors : true;
2488
- },
2489
- defaultStyles: {
2490
- base: {
2491
- width: "100%",
2492
- paddingTop: "10px",
2493
- paddingBottom: "10px",
2494
- paddingLeft: "14px",
2495
- paddingRight: "14px",
2496
- borderRadius: "6px",
2497
- borderWidth: "1px",
2498
- borderStyle: "solid",
2499
- borderColor: "#cbd5e1",
2500
- fontSize: "14px",
2501
- backgroundColor: "#ffffff",
2502
- color: "#1e293b",
2503
- boxSizing: "border-box"
2504
- }
2505
- }
2506
- };
2507
- var checkboxDefinition = {
2508
- type: "checkbox",
2509
- label: "Checkbox",
2510
- category: "form",
2511
- icon: "checkbox",
2512
- acceptsChildren: false,
2513
- disallowedParents: ["page"],
2514
- defaultProps: {
2515
- name: "checkbox_field",
2516
- label: "I agree to the terms and conditions",
2517
- value: "yes",
2518
- defaultChecked: false,
2519
- indeterminate: false,
2520
- required: false,
2521
- disabled: false,
2522
- helperText: ""
2523
- },
2524
- propFields: [
2525
- { name: "name", label: "Field Name", type: "string", defaultValue: "checkbox_field" },
2526
- { name: "label", label: "Label Text", type: "string", defaultValue: "I agree to the terms and conditions" },
2527
- { name: "value", label: "Checked Value", type: "string", defaultValue: "yes" },
2528
- { name: "defaultChecked", label: "Default Checked", type: "boolean", defaultValue: false },
2529
- { name: "indeterminate", label: "Indeterminate", type: "boolean", defaultValue: false },
2530
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2531
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2532
- { name: "helperText", label: "Helper Text", type: "string" }
2533
- ],
2534
- traits: [
2535
- fieldNameTrait({ defaultValue: "checkbox_field" }),
2536
- labelTextTrait({ defaultValue: "I agree to the terms and conditions" }),
2537
- valueTrait({ defaultValue: "yes" }),
2538
- defaultCheckedTrait(),
2539
- indeterminateTrait(),
2540
- helperTextTrait(),
2541
- requiredTrait(),
2542
- disabledTrait(),
2543
- idTrait(),
2544
- ariaLabelTrait()
2545
- ],
2546
- validateProps: (props) => {
2547
- const errors = [];
2548
- if (props.label !== void 0 && typeof props.label !== "string" && !isVariableBinding(props.label)) {
2549
- errors.push('Checkbox "label" must be a string when provided.');
2550
- }
2551
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2552
- errors.push('Checkbox "name" must be a string when provided.');
2553
- }
2554
- if (props.value !== void 0 && typeof props.value !== "string" && !isVariableBinding(props.value)) {
2555
- errors.push('Checkbox "value" must be a string when provided.');
2556
- }
2557
- if (props.defaultChecked !== void 0 && typeof props.defaultChecked !== "boolean" && !isVariableBinding(props.defaultChecked)) {
2558
- errors.push('Checkbox "defaultChecked" must be a boolean when provided.');
2559
- }
2560
- if (props.indeterminate !== void 0 && typeof props.indeterminate !== "boolean" && !isVariableBinding(props.indeterminate)) {
2561
- errors.push('Checkbox "indeterminate" must be a boolean when provided.');
2562
- }
2563
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2564
- errors.push('Checkbox "required" must be a boolean when provided.');
2565
- }
2566
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2567
- errors.push('Checkbox "disabled" must be a boolean when provided.');
2568
- }
2569
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2570
- errors.push('Checkbox "helperText" must be a string when provided.');
2571
- }
2572
- return errors.length > 0 ? errors : true;
2573
- },
2574
- defaultStyles: {
2575
- base: {
2576
- display: "inline-flex",
2577
- alignItems: "center",
2578
- gap: "8px",
2579
- fontSize: "14px",
2580
- color: "#1e293b",
2581
- cursor: "pointer",
2582
- userSelect: "none"
2583
- }
2584
- }
2585
- };
2586
- var switchDefinition = {
2587
- type: "switch",
2588
- label: "Switch",
2589
- category: "form",
2590
- icon: "switch",
2591
- acceptsChildren: false,
2592
- disallowedParents: ["page"],
2593
- defaultProps: {
2594
- name: "switch_field",
2595
- label: "Enable feature",
2596
- value: "yes",
2597
- defaultChecked: false,
2598
- switchSize: "md",
2599
- required: false,
2600
- disabled: false,
2601
- helperText: ""
2602
- },
2603
- propFields: [
2604
- { name: "name", label: "Field Name", type: "string", defaultValue: "switch_field" },
2605
- { name: "label", label: "Label Text", type: "string", defaultValue: "Enable feature" },
2606
- { name: "value", label: "Checked Value", type: "string", defaultValue: "yes" },
2607
- { name: "defaultChecked", label: "Default Checked", type: "boolean", defaultValue: false },
2608
- {
2609
- name: "switchSize",
2610
- label: "Size",
2611
- type: "select",
2612
- defaultValue: "md",
2613
- options: [
2614
- { label: "Small", value: "sm" },
2615
- { label: "Medium", value: "md" },
2616
- { label: "Large", value: "lg" }
2617
- ]
2618
- },
2619
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2620
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2621
- { name: "helperText", label: "Helper Text", type: "string" }
2622
- ],
2623
- traits: [
2624
- fieldNameTrait({ defaultValue: "switch_field" }),
2625
- labelTextTrait({ defaultValue: "Enable feature" }),
2626
- valueTrait({ defaultValue: "yes" }),
2627
- defaultCheckedTrait(),
2628
- switchSizeTrait(),
2629
- helperTextTrait(),
2630
- requiredTrait(),
2631
- disabledTrait(),
2632
- idTrait(),
2633
- ariaLabelTrait()
2634
- ],
2635
- validateProps: (props) => {
2636
- const errors = [];
2637
- if (props.label !== void 0 && typeof props.label !== "string" && !isVariableBinding(props.label)) {
2638
- errors.push('Switch "label" must be a string when provided.');
2639
- }
2640
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2641
- errors.push('Switch "name" must be a string when provided.');
2642
- }
2643
- if (props.value !== void 0 && typeof props.value !== "string" && !isVariableBinding(props.value)) {
2644
- errors.push('Switch "value" must be a string when provided.');
2645
- }
2646
- if (props.defaultChecked !== void 0 && typeof props.defaultChecked !== "boolean" && !isVariableBinding(props.defaultChecked)) {
2647
- errors.push('Switch "defaultChecked" must be a boolean when provided.');
2648
- }
2649
- if (props.switchSize !== void 0 && !isVariableBinding(props.switchSize)) {
2650
- const allowedSizes = ["sm", "md", "lg"];
2651
- if (typeof props.switchSize !== "string" || !allowedSizes.includes(props.switchSize)) {
2652
- errors.push(`Switch "switchSize" must be one of: ${allowedSizes.join(", ")}.`);
2653
- }
2654
- }
2655
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2656
- errors.push('Switch "required" must be a boolean when provided.');
2657
- }
2658
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2659
- errors.push('Switch "disabled" must be a boolean when provided.');
2660
- }
2661
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2662
- errors.push('Switch "helperText" must be a string when provided.');
2663
- }
2664
- return errors.length > 0 ? errors : true;
2665
- },
2666
- defaultStyles: {
2667
- base: {
2668
- display: "inline-flex",
2669
- alignItems: "center",
2670
- gap: "8px",
2671
- fontSize: "14px",
2672
- color: "#1e293b",
2673
- cursor: "pointer",
2674
- userSelect: "none"
2675
- }
2676
- }
2677
- };
2678
- var radioGroupDefinition = {
2679
- type: "radio-group",
2680
- label: "Radio Group",
2681
- category: "form",
2682
- icon: "radio-group",
2683
- acceptsChildren: true,
2684
- allowedChildren: ["radio", "radio-item", "custom"],
2685
- disallowedParents: ["page"],
2686
- defaultProps: {
2687
- name: "radio_group",
2688
- defaultSelected: "option1",
2689
- orientation: "vertical",
2690
- required: false,
2691
- disabled: false,
2692
- helperText: ""
2693
- },
2694
- defaultChildren: [
2695
- { type: "radio", props: { name: "radio_group", label: "Option 1", value: "option1", defaultChecked: true } },
2696
- { type: "radio", props: { name: "radio_group", label: "Option 2", value: "option2", defaultChecked: false } },
2697
- { type: "radio", props: { name: "radio_group", label: "Option 3", value: "option3", defaultChecked: false } }
2698
- ],
2699
- propFields: [
2700
- { name: "name", label: "Group Name", type: "string", defaultValue: "radio_group" },
2701
- { name: "defaultSelected", label: "Default Selected", type: "string", defaultValue: "option1" },
2702
- {
2703
- name: "orientation",
2704
- label: "Orientation",
2705
- type: "select",
2706
- defaultValue: "vertical",
2707
- options: [
2708
- { label: "Vertical", value: "vertical" },
2709
- { label: "Horizontal", value: "horizontal" }
2710
- ]
2711
- },
2712
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2713
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2714
- { name: "helperText", label: "Helper Text", type: "string" }
2715
- ],
2716
- traits: [
2717
- fieldNameTrait({ defaultValue: "radio_group", label: "Group Name" }),
2718
- defaultSelectedTrait({ defaultValue: "option1" }),
2719
- orientationTrait(),
2720
- helperTextTrait(),
2721
- requiredTrait(),
2722
- disabledTrait(),
2723
- idTrait(),
2724
- ariaLabelTrait()
2725
- ],
2726
- validateProps: (props) => {
2727
- const errors = [];
2728
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2729
- errors.push('RadioGroup "name" must be a string when provided.');
2730
- }
2731
- if (props.defaultSelected !== void 0 && typeof props.defaultSelected !== "string" && !isVariableBinding(props.defaultSelected)) {
2732
- errors.push('RadioGroup "defaultSelected" must be a string when provided.');
2733
- }
2734
- if (props.orientation !== void 0 && !isVariableBinding(props.orientation)) {
2735
- const allowedOrientations = ["vertical", "horizontal"];
2736
- if (typeof props.orientation !== "string" || !allowedOrientations.includes(props.orientation)) {
2737
- errors.push(`RadioGroup "orientation" must be one of: ${allowedOrientations.join(", ")}.`);
2738
- }
2739
- }
2740
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2741
- errors.push('RadioGroup "required" must be a boolean when provided.');
2742
- }
2743
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2744
- errors.push('RadioGroup "disabled" must be a boolean when provided.');
2745
- }
2746
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2747
- errors.push('RadioGroup "helperText" must be a string when provided.');
2748
- }
2749
- return errors.length > 0 ? errors : true;
2750
- },
2751
- defaultStyles: {
2752
- base: {
2753
- display: "flex",
2754
- flexDirection: "column",
2755
- gap: "8px"
2756
- }
2757
- }
2758
- };
2759
- var radioDefinition = {
2760
- type: "radio",
2761
- label: "Radio",
2762
- category: "form",
2763
- icon: "radio",
2764
- acceptsChildren: false,
2765
- disallowedParents: ["page"],
2766
- defaultProps: {
2767
- name: "radio_group",
2768
- label: "Option 1",
2769
- value: "option1",
2770
- defaultChecked: false,
2771
- required: false,
2772
- disabled: false,
2773
- helperText: ""
2774
- },
2775
- propFields: [
2776
- { name: "name", label: "Group Name", type: "string", defaultValue: "radio_group" },
2777
- { name: "label", label: "Label Text", type: "string", defaultValue: "Option 1" },
2778
- { name: "value", label: "Radio Value", type: "string", defaultValue: "option1" },
2779
- { name: "defaultChecked", label: "Default Selected", type: "boolean", defaultValue: false },
2780
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2781
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2782
- { name: "helperText", label: "Helper Text", type: "string" }
2783
- ],
2784
- traits: [
2785
- fieldNameTrait({ defaultValue: "radio_group", label: "Group Name" }),
2786
- labelTextTrait({ defaultValue: "Option 1" }),
2787
- valueTrait({ defaultValue: "option1" }),
2788
- defaultCheckedTrait(),
2789
- helperTextTrait(),
2790
- requiredTrait(),
2791
- disabledTrait(),
2792
- idTrait(),
2793
- ariaLabelTrait()
2794
- ],
2795
- validateProps: (props) => {
2796
- const errors = [];
2797
- if (props.label !== void 0 && typeof props.label !== "string" && !isVariableBinding(props.label)) {
2798
- errors.push('Radio "label" must be a string when provided.');
2799
- }
2800
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2801
- errors.push('Radio "name" must be a string when provided.');
2802
- }
2803
- if (props.value !== void 0 && typeof props.value !== "string" && !isVariableBinding(props.value)) {
2804
- errors.push('Radio "value" must be a string when provided.');
2805
- }
2806
- if (props.defaultChecked !== void 0 && typeof props.defaultChecked !== "boolean" && !isVariableBinding(props.defaultChecked)) {
2807
- errors.push('Radio "defaultChecked" must be a boolean when provided.');
2808
- }
2809
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2810
- errors.push('Radio "required" must be a boolean when provided.');
2811
- }
2812
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2813
- errors.push('Radio "disabled" must be a boolean when provided.');
2814
- }
2815
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2816
- errors.push('Radio "helperText" must be a string when provided.');
2817
- }
2818
- return errors.length > 0 ? errors : true;
2819
- },
2820
- defaultStyles: {
2821
- base: {
2822
- display: "inline-flex",
2823
- alignItems: "center",
2824
- gap: "8px",
2825
- fontSize: "14px",
2826
- color: "#1e293b",
2827
- cursor: "pointer",
2828
- userSelect: "none"
2829
- }
2830
- }
2831
- };
2832
- var radioItemDefinition = {
2833
- ...radioDefinition,
2834
- type: "radio-item",
2835
- label: "Radio Item"
2836
- };
2837
- var fileUploadDefinition = {
2838
- type: "file-upload",
2839
- label: "File Upload",
2840
- category: "form",
2841
- icon: "upload",
2842
- acceptsChildren: false,
2843
- disallowedParents: ["page"],
2844
- defaultProps: {
2845
- name: "file_upload",
2846
- label: "Upload File",
2847
- accept: "*/*",
2848
- maxFileSize: 10,
2849
- multiple: false,
2850
- showPreview: true,
2851
- required: false,
2852
- disabled: false,
2853
- helperText: ""
2854
- },
2855
- propFields: [
2856
- { name: "name", label: "Field Name", type: "string", defaultValue: "file_upload" },
2857
- { name: "label", label: "Label Text", type: "string", defaultValue: "Upload File" },
2858
- { name: "accept", label: "Accepted File Types", type: "string", defaultValue: "*/*" },
2859
- { name: "maxFileSize", label: "Max File Size (MB)", type: "number", defaultValue: 10 },
2860
- { name: "multiple", label: "Allow Multiple Files", type: "boolean", defaultValue: false },
2861
- { name: "showPreview", label: "Show Preview", type: "boolean", defaultValue: true },
2862
- { name: "required", label: "Required", type: "boolean", defaultValue: false },
2863
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2864
- { name: "helperText", label: "Helper Text", type: "string" }
2865
- ],
2866
- traits: [
2867
- fieldNameTrait({ defaultValue: "file_upload" }),
2868
- labelTextTrait({ defaultValue: "Upload File" }),
2869
- acceptTrait(),
2870
- maxFileSizeTrait(),
2871
- multipleTrait(),
2872
- showPreviewTrait(),
2873
- helperTextTrait(),
2874
- requiredTrait(),
2875
- disabledTrait(),
2876
- idTrait(),
2877
- ariaLabelTrait()
2878
- ],
2879
- validateProps: (props) => {
2880
- const errors = [];
2881
- if (props.label !== void 0 && typeof props.label !== "string" && !isVariableBinding(props.label)) {
2882
- errors.push('FileUpload "label" must be a string when provided.');
2883
- }
2884
- if (props.name !== void 0 && typeof props.name !== "string" && !isVariableBinding(props.name)) {
2885
- errors.push('FileUpload "name" must be a string when provided.');
2886
- }
2887
- if (props.accept !== void 0 && typeof props.accept !== "string" && !isVariableBinding(props.accept)) {
2888
- errors.push('FileUpload "accept" must be a string when provided.');
2889
- }
2890
- if (props.maxFileSize !== void 0 && !isVariableBinding(props.maxFileSize)) {
2891
- if (typeof props.maxFileSize !== "number" || props.maxFileSize <= 0) {
2892
- errors.push('FileUpload "maxFileSize" must be a positive number when provided.');
2893
- }
2894
- }
2895
- if (props.multiple !== void 0 && typeof props.multiple !== "boolean" && !isVariableBinding(props.multiple)) {
2896
- errors.push('FileUpload "multiple" must be a boolean when provided.');
2897
- }
2898
- if (props.showPreview !== void 0 && typeof props.showPreview !== "boolean" && !isVariableBinding(props.showPreview)) {
2899
- errors.push('FileUpload "showPreview" must be a boolean when provided.');
2900
- }
2901
- if (props.required !== void 0 && typeof props.required !== "boolean" && !isVariableBinding(props.required)) {
2902
- errors.push('FileUpload "required" must be a boolean when provided.');
2903
- }
2904
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
2905
- errors.push('FileUpload "disabled" must be a boolean when provided.');
2906
- }
2907
- if (props.helperText !== void 0 && typeof props.helperText !== "string" && !isVariableBinding(props.helperText)) {
2908
- errors.push('FileUpload "helperText" must be a string when provided.');
2909
- }
2910
- return errors.length > 0 ? errors : true;
2911
- },
2912
- defaultStyles: {
2913
- base: {
2914
- display: "flex",
2915
- flexDirection: "column",
2916
- gap: "8px",
2917
- fontSize: "14px",
2918
- color: "#1e293b"
2919
- }
2920
- }
2921
- };
2922
- var buttonSubmitDefinition = {
2923
- type: "button-submit",
2924
- label: "Submit Button",
2925
- category: "form",
2926
- icon: "send",
2927
- acceptsChildren: false,
2928
- capabilities: ["actionRegistry"],
2929
- disallowedParents: ["page"],
2930
- defaultProps: {
2931
- label: "Submit",
2932
- loadingText: "Submitting...",
2933
- showSpinner: true,
2934
- autoDisableOnSubmit: true,
2935
- variant: "primary",
2936
- disabled: false,
2937
- buttonType: "submit"
2938
- },
2939
- propFields: [
2940
- { name: "label", label: "Label", type: "string", defaultValue: "Submit" },
2941
- { name: "loadingText", label: "Loading Text", type: "string", defaultValue: "Submitting..." },
2942
- { name: "showSpinner", label: "Show Loading Spinner", type: "boolean", defaultValue: true },
2943
- { name: "autoDisableOnSubmit", label: "Auto Disable on Submit", type: "boolean", defaultValue: true },
2944
- {
2945
- name: "buttonType",
2946
- label: "Button Type",
2947
- type: "select",
2948
- defaultValue: "submit",
2949
- options: [
2950
- { label: "Submit Form (submit)", value: "submit" },
2951
- { label: "Reset Form (reset)", value: "reset" }
2952
- ]
2953
- },
2954
- {
2955
- name: "variant",
2956
- label: "Variant",
2957
- type: "select",
2958
- defaultValue: "primary",
2959
- options: [
2960
- { label: "Primary", value: "primary" },
2961
- { label: "Secondary", value: "secondary" }
2962
- ]
2963
- },
2964
- { name: "disabled", label: "Disabled", type: "boolean", defaultValue: false },
2965
- { name: "prefixIcon", label: "Prefix Icon", type: "string" },
2966
- { name: "suffixIcon", label: "Suffix Icon", type: "string" }
2967
- ],
2968
- traits: [
2969
- buttonTypeTrait({
2970
- defaultValue: "submit",
2971
- options: [
2972
- { label: "Submit Form (submit)", value: "submit" },
2973
- { label: "Reset Form (reset)", value: "reset" }
2974
- ]
2975
- }),
2976
- labelTextTrait({ defaultValue: "Submit", label: "Label" }),
2977
- loadingTextTrait(),
2978
- showSpinnerTrait(),
2979
- autoDisableOnSubmitTrait(),
2980
- disabledTrait(),
2981
- prefixIconTrait(),
2982
- suffixIconTrait(),
2983
- idTrait(),
2984
- titleTrait(),
2985
- ariaLabelTrait()
2986
- ],
2987
- validateProps: (props) => {
2988
- const errors = [];
2989
- const hasLabel = typeof props.label === "string" && props.label.trim().length > 0 || isVariableBinding(props.label);
2990
- if (!hasLabel) {
2991
- errors.push('Submit Button requires a non-empty "label".');
2992
- }
2993
- if (props.loadingText !== void 0 && typeof props.loadingText !== "string" && !isVariableBinding(props.loadingText)) {
2994
- errors.push('Submit Button "loadingText" must be a string when provided.');
2995
- }
2996
- if (props.showSpinner !== void 0 && typeof props.showSpinner !== "boolean" && !isVariableBinding(props.showSpinner)) {
2997
- errors.push('Submit Button "showSpinner" must be a boolean when provided.');
2998
- }
2999
- if (props.autoDisableOnSubmit !== void 0 && typeof props.autoDisableOnSubmit !== "boolean" && !isVariableBinding(props.autoDisableOnSubmit)) {
3000
- errors.push('Submit Button "autoDisableOnSubmit" must be a boolean when provided.');
3001
- }
3002
- if (props.buttonType !== void 0 && !isVariableBinding(props.buttonType)) {
3003
- if (!["submit", "reset", "button"].includes(props.buttonType)) {
3004
- errors.push('Submit Button "buttonType" must be one of: "submit", "reset", "button".');
3005
- }
3006
- }
3007
- if (props.disabled !== void 0 && typeof props.disabled !== "boolean" && !isVariableBinding(props.disabled)) {
3008
- errors.push('Submit Button "disabled" must be a boolean when provided.');
3009
- }
3010
- return errors.length > 0 ? errors : true;
3011
- },
3012
- defaultStyles: {
3013
- base: {
3014
- backgroundColor: "#2563eb",
3015
- color: "#ffffff",
3016
- paddingTop: "10px",
3017
- paddingBottom: "10px",
3018
- paddingLeft: "20px",
3019
- paddingRight: "20px",
3020
- borderRadius: "6px",
3021
- fontWeight: "500",
3022
- fontSize: "15px",
3023
- border: "none",
3024
- cursor: "pointer",
3025
- display: "inline-flex",
3026
- alignItems: "center",
3027
- justifyContent: "center",
3028
- gap: "8px"
3029
- }
3030
- }
3031
- };
3032
- var coreComponentDefinitions = [
3033
- pageDefinition,
3034
- sectionDefinition,
3035
- containerDefinition,
3036
- columnsDefinition,
3037
- headingDefinition,
3038
- textDefinition,
3039
- paragraphDefinition,
3040
- linkDefinition,
3041
- blockquoteDefinition,
1
+ import {
2
+ CONTENT_CHILD_TYPES,
3
+ ComponentRegistry,
4
+ LAYOUT_PARENTS,
3042
5
  badgeDefinition,
3043
- codeBlockDefinition,
3044
- imageDefinition,
3045
- videoDefinition,
3046
- iconDefinition,
3047
- htmlEmbedDefinition,
6
+ blockquoteDefinition,
3048
7
  buttonDefinition,
3049
8
  buttonSubmitDefinition,
3050
- formDefinition,
3051
- inputDefinition,
3052
- textareaDefinition,
3053
- selectDefinition,
3054
9
  checkboxDefinition,
3055
- switchDefinition,
3056
- radioGroupDefinition,
3057
- radioDefinition,
3058
- radioItemDefinition,
3059
- fileUploadDefinition,
10
+ codeBlockDefinition,
11
+ collapsibleDefinition,
3060
12
  collectionDefinition,
13
+ columnsDefinition,
14
+ containerDefinition,
15
+ coreComponentDefinitions,
16
+ createDefaultComponentRegistry,
17
+ drawerDefinition,
18
+ fileUploadDefinition,
19
+ flexDefinition,
20
+ formDefinition,
21
+ gridDefinition,
22
+ headingDefinition,
23
+ htmlEmbedDefinition,
24
+ iconDefinition,
25
+ imageDefinition,
26
+ inputDefinition,
27
+ linkDefinition,
3061
28
  listDefinition,
3062
29
  listItemDefinition,
30
+ modalDefinition,
31
+ pageDefinition,
32
+ paragraphDefinition,
33
+ radioDefinition,
34
+ radioGroupDefinition,
35
+ radioItemDefinition,
36
+ sectionDefinition,
37
+ selectDefinition,
38
+ switchDefinition,
39
+ tableCellDefinition,
3063
40
  tableDefinition,
3064
41
  tableRowDefinition,
3065
- tableCellDefinition
3066
- ];
3067
- function createDefaultComponentRegistry() {
3068
- const registry = new ComponentRegistry();
3069
- for (const def of coreComponentDefinitions) {
3070
- registry.register(def);
3071
- }
3072
- return registry;
3073
- }
42
+ textDefinition,
43
+ textareaDefinition,
44
+ videoDefinition
45
+ } from "./chunk-K6I6U7F3.js";
46
+ import {
47
+ TRAIT_GROUP_LABELS,
48
+ TRAIT_GROUP_ORDER,
49
+ acceptTrait,
50
+ actionTrait,
51
+ altTrait,
52
+ ariaLabelTrait,
53
+ autoCompleteTrait,
54
+ autoDisableOnSubmitTrait,
55
+ autoGrowTrait,
56
+ autoplayTrait,
57
+ buttonTypeTrait,
58
+ citeTrait,
59
+ colSpanTrait,
60
+ collectTraitNames,
61
+ controlsTrait,
62
+ defaultCheckedTrait,
63
+ defaultSelectedTrait,
64
+ defaultValueTrait,
65
+ disabledTrait,
66
+ fieldNameTrait,
67
+ helperTextTrait,
68
+ hrefTrait,
69
+ idTrait,
70
+ indeterminateTrait,
71
+ inputTypeTrait,
72
+ labelTextTrait,
73
+ loadingTextTrait,
74
+ loadingTrait,
75
+ loopTrait,
76
+ maxCharCountTrait,
77
+ maxFileSizeTrait,
78
+ maxLengthTrait,
79
+ methodTrait,
80
+ minLengthTrait,
81
+ multipleTrait,
82
+ mutedTrait,
83
+ optionsListTrait,
84
+ orientationTrait,
85
+ patternTrait,
86
+ placeholderTrait,
87
+ posterTrait,
88
+ prefixIconTrait,
89
+ preventDefaultTrait,
90
+ readOnlyTrait,
91
+ relTrait,
92
+ requiredTrait,
93
+ resetOnSubmitTrait,
94
+ resizeTrait,
95
+ rowSpanTrait,
96
+ rowsTrait,
97
+ scrollToFirstErrorTrait,
98
+ showPreviewTrait,
99
+ showSpinnerTrait,
100
+ sortTraits,
101
+ srcTrait,
102
+ suffixIconTrait,
103
+ switchSizeTrait,
104
+ tagTrait,
105
+ targetTrait,
106
+ titleTrait,
107
+ valueTrait,
108
+ withOverrides
109
+ } from "./chunk-OK53DS7G.js";
110
+ import {
111
+ FORM_STARTER_BLOCKS,
112
+ LAYOUT_STARTER_BLOCKS,
113
+ STARTER_BLOCKS,
114
+ UI_STARTER_BLOCKS,
115
+ defaultGenId
116
+ } from "./chunk-JTQ35OQQ.js";
3074
117
 
3075
118
  // src/requirements.ts
3076
119
  function extractComponentRequirements(root, registry) {
@@ -3111,1278 +154,16 @@ function primitiveTypeForField(field) {
3111
154
  function isBindableField(field) {
3112
155
  return primitiveTypeForField(field) !== void 0;
3113
156
  }
3114
-
3115
- // src/blocks.ts
3116
- var nextId = 1;
3117
- function defaultGenId(prefix = "node") {
3118
- return `${prefix}-${Date.now().toString(36)}-${(nextId++).toString(36)}`;
3119
- }
3120
- var STARTER_BLOCKS = [
3121
- // --- Layout Blocks (STORA-241) ---
3122
- {
3123
- id: "layout-1-col",
3124
- name: "1 Column",
3125
- category: "layout",
3126
- categoryLabel: "Layout Blocks",
3127
- description: "Full-width single column container inside a section",
3128
- icon: "layout",
3129
- createNodeTree: (gen = defaultGenId) => ({
3130
- id: gen("section"),
3131
- type: "section",
3132
- styles: { base: { padding: "40px 20px", width: "100%" } },
3133
- children: [
3134
- {
3135
- id: gen("container"),
3136
- type: "container",
3137
- props: { tag: "div" },
3138
- styles: { base: { maxWidth: "1200px", margin: "0 auto", width: "100%" } },
3139
- children: []
3140
- }
3141
- ]
3142
- })
3143
- },
3144
- {
3145
- id: "layout-2-col-50-50",
3146
- name: "2 Columns (50/50)",
3147
- category: "layout",
3148
- categoryLabel: "Layout Blocks",
3149
- description: "Two equal-width 50/50 columns with flexible layout",
3150
- icon: "columns",
3151
- createNodeTree: (gen = defaultGenId) => ({
3152
- id: gen("section"),
3153
- type: "section",
3154
- styles: { base: { padding: "40px 20px", width: "100%" } },
3155
- children: [
3156
- {
3157
- id: gen("columns"),
3158
- type: "columns",
3159
- props: { columns: 2, gap: "24px" },
3160
- styles: { base: { display: "flex", gap: "24px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
3161
- children: [
3162
- {
3163
- id: gen("container"),
3164
- type: "container",
3165
- props: { tag: "div" },
3166
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3167
- children: []
3168
- },
3169
- {
3170
- id: gen("container"),
3171
- type: "container",
3172
- props: { tag: "div" },
3173
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3174
- children: []
3175
- }
3176
- ]
3177
- }
3178
- ]
3179
- })
3180
- },
3181
- {
3182
- id: "layout-2-col-30-70",
3183
- name: "2 Columns (30/70)",
3184
- category: "layout",
3185
- categoryLabel: "Layout Blocks",
3186
- description: "Two asymmetric columns: 30% sidebar and 70% main area",
3187
- icon: "columns",
3188
- createNodeTree: (gen = defaultGenId) => ({
3189
- id: gen("section"),
3190
- type: "section",
3191
- styles: { base: { padding: "40px 20px", width: "100%" } },
3192
- children: [
3193
- {
3194
- id: gen("columns"),
3195
- type: "columns",
3196
- props: { columns: 2, gap: "24px" },
3197
- styles: { base: { display: "flex", gap: "24px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
3198
- children: [
3199
- {
3200
- id: gen("container"),
3201
- type: "container",
3202
- props: { tag: "div" },
3203
- styles: { base: { flex: "0 0 30%", minWidth: "0" } },
3204
- children: []
3205
- },
3206
- {
3207
- id: gen("container"),
3208
- type: "container",
3209
- props: { tag: "div" },
3210
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3211
- children: []
3212
- }
3213
- ]
3214
- }
3215
- ]
3216
- })
3217
- },
3218
- {
3219
- id: "layout-3-col",
3220
- name: "3 Columns",
3221
- category: "layout",
3222
- categoryLabel: "Layout Blocks",
3223
- description: "Three equal-width columns for grid showcases or card groups",
3224
- icon: "grid",
3225
- createNodeTree: (gen = defaultGenId) => ({
3226
- id: gen("section"),
3227
- type: "section",
3228
- styles: { base: { padding: "40px 20px", width: "100%" } },
3229
- children: [
3230
- {
3231
- id: gen("columns"),
3232
- type: "columns",
3233
- props: { columns: 3, gap: "24px" },
3234
- styles: { base: { display: "flex", gap: "24px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
3235
- children: [
3236
- {
3237
- id: gen("container"),
3238
- type: "container",
3239
- props: { tag: "div" },
3240
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3241
- children: []
3242
- },
3243
- {
3244
- id: gen("container"),
3245
- type: "container",
3246
- props: { tag: "div" },
3247
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3248
- children: []
3249
- },
3250
- {
3251
- id: gen("container"),
3252
- type: "container",
3253
- props: { tag: "div" },
3254
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3255
- children: []
3256
- }
3257
- ]
3258
- }
3259
- ]
3260
- })
3261
- },
3262
- {
3263
- id: "layout-4-col",
3264
- name: "4 Columns",
3265
- category: "layout",
3266
- categoryLabel: "Layout Blocks",
3267
- description: "Four equal columns for metric stats, logos, or compact feature cards",
3268
- icon: "grid",
3269
- createNodeTree: (gen = defaultGenId) => ({
3270
- id: gen("section"),
3271
- type: "section",
3272
- styles: { base: { padding: "40px 20px", width: "100%" } },
3273
- children: [
3274
- {
3275
- id: gen("columns"),
3276
- type: "columns",
3277
- props: { columns: 4, gap: "16px" },
3278
- styles: { base: { display: "flex", gap: "16px", width: "100%", maxWidth: "1200px", margin: "0 auto" } },
3279
- children: [
3280
- {
3281
- id: gen("container"),
3282
- type: "container",
3283
- props: { tag: "div" },
3284
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3285
- children: []
3286
- },
3287
- {
3288
- id: gen("container"),
3289
- type: "container",
3290
- props: { tag: "div" },
3291
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3292
- children: []
3293
- },
3294
- {
3295
- id: gen("container"),
3296
- type: "container",
3297
- props: { tag: "div" },
3298
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3299
- children: []
3300
- },
3301
- {
3302
- id: gen("container"),
3303
- type: "container",
3304
- props: { tag: "div" },
3305
- styles: { base: { flex: "1 1 0%", minWidth: "0" } },
3306
- children: []
3307
- }
3308
- ]
3309
- }
3310
- ]
3311
- })
3312
- },
3313
- // --- Pre-composed UI Blocks (STORA-242) ---
3314
- {
3315
- id: "hero-section",
3316
- name: "Hero Section",
3317
- category: "sections",
3318
- categoryLabel: "Hero & Headers",
3319
- description: "Engaging hero banner with headline, lead paragraph, and call-to-action button",
3320
- icon: "layout",
3321
- createNodeTree: (gen = defaultGenId) => ({
3322
- id: gen("section"),
3323
- type: "section",
3324
- styles: {
3325
- base: {
3326
- padding: "80px 24px",
3327
- backgroundColor: "#f8fafc",
3328
- textAlign: "center",
3329
- width: "100%"
3330
- }
3331
- },
3332
- children: [
3333
- {
3334
- id: gen("container"),
3335
- type: "container",
3336
- props: { tag: "div" },
3337
- styles: { base: { maxWidth: "768px", margin: "0 auto" } },
3338
- children: [
3339
- {
3340
- id: gen("heading"),
3341
- type: "heading",
3342
- props: { text: "Build Remarkable Experiences", level: 1 },
3343
- styles: {
3344
- base: {
3345
- fontSize: "44px",
3346
- fontWeight: "800",
3347
- color: "#0f172a",
3348
- marginBottom: "16px",
3349
- lineHeight: "1.2"
3350
- }
3351
- }
3352
- },
3353
- {
3354
- id: gen("paragraph"),
3355
- type: "paragraph",
3356
- props: {
3357
- content: "A visual builder designed for maximum craft, responsiveness, and performance."
3358
- },
3359
- styles: {
3360
- base: {
3361
- fontSize: "18px",
3362
- color: "#475569",
3363
- marginBottom: "32px",
3364
- lineHeight: "1.6"
3365
- }
3366
- }
3367
- },
3368
- {
3369
- id: gen("button"),
3370
- type: "button",
3371
- props: { label: "Get Started Today", href: "#explore" },
3372
- styles: {
3373
- base: {
3374
- backgroundColor: "#2563eb",
3375
- color: "#ffffff",
3376
- padding: "12px 28px",
3377
- borderRadius: "8px",
3378
- fontWeight: "600",
3379
- display: "inline-block"
3380
- },
3381
- states: {
3382
- ":hover": { backgroundColor: "#1d4ed8" }
3383
- }
3384
- }
3385
- }
3386
- ]
3387
- }
3388
- ]
3389
- })
3390
- },
3391
- {
3392
- id: "feature-card",
3393
- name: "Feature Card",
3394
- category: "ui",
3395
- categoryLabel: "UI Blocks",
3396
- description: "Clean elevated feature card with badge, title, text, and action link",
3397
- icon: "box",
3398
- createNodeTree: (gen = defaultGenId) => ({
3399
- id: gen("container"),
3400
- type: "container",
3401
- props: { tag: "div" },
3402
- styles: {
3403
- base: {
3404
- padding: "24px",
3405
- backgroundColor: "#ffffff",
3406
- borderRadius: "12px",
3407
- border: "1px solid #e2e8f0",
3408
- boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.05)"
3409
- }
3410
- },
3411
- children: [
3412
- {
3413
- id: gen("badge"),
3414
- type: "badge",
3415
- props: { label: "PRO FEATURE", variant: "primary" },
3416
- styles: { base: { marginBottom: "12px", display: "inline-block" } }
3417
- },
3418
- {
3419
- id: gen("heading"),
3420
- type: "heading",
3421
- props: { text: "Next-Gen Performance", level: 3 },
3422
- styles: {
3423
- base: { fontSize: "20px", fontWeight: "700", color: "#1e293b", marginBottom: "8px" }
3424
- }
3425
- },
3426
- {
3427
- id: gen("paragraph"),
3428
- type: "paragraph",
3429
- props: {
3430
- content: "Engineered for sub-millisecond render updates and zero runtime overhead."
3431
- },
3432
- styles: { base: { fontSize: "14px", color: "#64748b", lineHeight: "1.5" } }
3433
- }
3434
- ]
3435
- })
3436
- },
3437
- {
3438
- id: "media-object",
3439
- name: "Media Object",
3440
- category: "ui",
3441
- categoryLabel: "UI Blocks",
3442
- description: "Horizontal media layout with image beside text content",
3443
- icon: "image",
3444
- createNodeTree: (gen = defaultGenId) => ({
3445
- id: gen("container"),
3446
- type: "container",
3447
- props: { tag: "div" },
3448
- styles: {
3449
- base: {
3450
- display: "flex",
3451
- gap: "16px",
3452
- alignItems: "flex-start",
3453
- padding: "16px",
3454
- backgroundColor: "#ffffff",
3455
- borderRadius: "8px",
3456
- border: "1px solid #e2e8f0"
3457
- }
3458
- },
3459
- children: [
3460
- {
3461
- id: gen("image"),
3462
- type: "image",
3463
- props: {
3464
- src: "https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=160&auto=format&fit=crop&q=80",
3465
- alt: "Visual preview"
3466
- },
3467
- styles: {
3468
- base: {
3469
- width: "80px",
3470
- height: "80px",
3471
- borderRadius: "8px",
3472
- objectFit: "cover",
3473
- flexShrink: "0"
3474
- }
3475
- }
3476
- },
3477
- {
3478
- id: gen("container"),
3479
- type: "container",
3480
- props: { tag: "div" },
3481
- styles: { base: { flex: "1 1 0%" } },
3482
- children: [
3483
- {
3484
- id: gen("heading"),
3485
- type: "heading",
3486
- props: { text: "Creative Studio Asset", level: 4 },
3487
- styles: {
3488
- base: { fontSize: "16px", fontWeight: "600", color: "#0f172a", marginBottom: "4px" }
3489
- }
3490
- },
3491
- {
3492
- id: gen("paragraph"),
3493
- type: "paragraph",
3494
- props: { content: "High dynamic range gradients crafted for modern presentations." },
3495
- styles: { base: { fontSize: "13px", color: "#64748b", lineHeight: "1.4" } }
3496
- }
3497
- ]
3498
- }
3499
- ]
3500
- })
3501
- },
3502
- {
3503
- id: "pricing-table",
3504
- name: "Pricing Table",
3505
- category: "pricing",
3506
- categoryLabel: "Pricing",
3507
- description: "Highlighted subscription pricing plan with price, feature list, and buy button",
3508
- icon: "table",
3509
- createNodeTree: (gen = defaultGenId) => ({
3510
- id: gen("container"),
3511
- type: "container",
3512
- props: { tag: "div" },
3513
- styles: {
3514
- base: {
3515
- padding: "32px 24px",
3516
- backgroundColor: "#ffffff",
3517
- borderRadius: "16px",
3518
- border: "2px solid #3b82f6",
3519
- boxShadow: "0 10px 15px -3px rgba(59, 130, 246, 0.1)",
3520
- textAlign: "center",
3521
- maxWidth: "360px"
3522
- }
3523
- },
3524
- children: [
3525
- {
3526
- id: gen("badge"),
3527
- type: "badge",
3528
- props: { label: "MOST POPULAR", variant: "primary" },
3529
- styles: { base: { marginBottom: "12px", display: "inline-block" } }
3530
- },
3531
- {
3532
- id: gen("heading"),
3533
- type: "heading",
3534
- props: { text: "Professional", level: 3 },
3535
- styles: { base: { fontSize: "22px", fontWeight: "700", color: "#0f172a" } }
3536
- },
3537
- {
3538
- id: gen("heading"),
3539
- type: "heading",
3540
- props: { text: "$29 / mo", level: 2 },
3541
- styles: {
3542
- base: { fontSize: "36px", fontWeight: "800", color: "#2563eb", margin: "16px 0 24px 0" }
3543
- }
3544
- },
3545
- {
3546
- id: gen("paragraph"),
3547
- type: "paragraph",
3548
- props: { content: "Includes unlimited pages, custom domains, and team collaboration." },
3549
- styles: { base: { fontSize: "14px", color: "#64748b", marginBottom: "24px" } }
3550
- },
3551
- {
3552
- id: gen("button"),
3553
- type: "button",
3554
- props: { label: "Upgrade to Pro", href: "#checkout" },
3555
- styles: {
3556
- base: {
3557
- width: "100%",
3558
- backgroundColor: "#2563eb",
3559
- color: "#ffffff",
3560
- padding: "12px",
3561
- borderRadius: "8px",
3562
- fontWeight: "600",
3563
- display: "block"
3564
- },
3565
- states: {
3566
- ":hover": { backgroundColor: "#1d4ed8" }
3567
- }
3568
- }
3569
- }
3570
- ]
3571
- })
3572
- },
3573
- {
3574
- id: "cta-banner",
3575
- name: "CTA Banner",
3576
- category: "cta",
3577
- categoryLabel: "Call to Action",
3578
- description: "High-contrast conversion banner with title and action button",
3579
- icon: "layout",
3580
- createNodeTree: (gen = defaultGenId) => ({
3581
- id: gen("section"),
3582
- type: "section",
3583
- styles: {
3584
- base: {
3585
- padding: "60px 24px",
3586
- backgroundColor: "#0f172a",
3587
- color: "#ffffff",
3588
- borderRadius: "16px",
3589
- textAlign: "center",
3590
- width: "100%"
3591
- }
3592
- },
3593
- children: [
3594
- {
3595
- id: gen("heading"),
3596
- type: "heading",
3597
- props: { text: "Ready to boost your workflow?", level: 2 },
3598
- styles: {
3599
- base: { fontSize: "32px", fontWeight: "700", color: "#ffffff", marginBottom: "12px" }
3600
- }
3601
- },
3602
- {
3603
- id: gen("paragraph"),
3604
- type: "paragraph",
3605
- props: { content: "Start building with zero installation and instant live preview." },
3606
- styles: {
3607
- base: { fontSize: "16px", color: "#94a3b8", marginBottom: "24px", maxWidth: "600px", margin: "0 auto 24px auto" }
3608
- }
3609
- },
3610
- {
3611
- id: gen("button"),
3612
- type: "button",
3613
- props: { label: "Start Free Trial", href: "#signup" },
3614
- styles: {
3615
- base: {
3616
- backgroundColor: "#ffffff",
3617
- color: "#0f172a",
3618
- padding: "12px 28px",
3619
- borderRadius: "8px",
3620
- fontWeight: "700",
3621
- display: "inline-block"
3622
- },
3623
- states: {
3624
- ":hover": { backgroundColor: "#f1f5f9" }
3625
- }
3626
- }
3627
- }
3628
- ]
3629
- })
3630
- },
3631
- // --- Starter Form Templates (STORA-350) ---
3632
- {
3633
- id: "form-contact-us",
3634
- name: "Contact Us Form",
3635
- category: "forms",
3636
- categoryLabel: "Form Templates",
3637
- description: "Contact form with Name, Email, Subject, Message, and submit action pipeline with API request and toast notifications",
3638
- icon: "form",
3639
- createNodeTree: (gen = defaultGenId) => ({
3640
- id: gen("section"),
3641
- type: "section",
3642
- styles: {
3643
- base: {
3644
- padding: "64px 20px",
3645
- backgroundColor: "#f8fafc",
3646
- width: "100%"
3647
- }
3648
- },
3649
- children: [
3650
- {
3651
- id: gen("container"),
3652
- type: "container",
3653
- props: { tag: "div", maxWidth: "640px" },
3654
- styles: {
3655
- base: {
3656
- maxWidth: "640px",
3657
- margin: "0 auto",
3658
- width: "100%",
3659
- backgroundColor: "#ffffff",
3660
- padding: "36px",
3661
- borderRadius: "16px",
3662
- boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05)",
3663
- border: "1px solid #e2e8f0"
3664
- }
3665
- },
3666
- children: [
3667
- {
3668
- id: gen("heading"),
3669
- type: "heading",
3670
- props: { text: "Contact Us", level: 2 },
3671
- styles: {
3672
- base: {
3673
- fontSize: "28px",
3674
- fontWeight: "700",
3675
- color: "#0f172a",
3676
- marginBottom: "8px",
3677
- textAlign: "center"
3678
- }
3679
- }
3680
- },
3681
- {
3682
- id: gen("paragraph"),
3683
- type: "paragraph",
3684
- props: {
3685
- content: "Have questions or need assistance? Fill out the form below and we will get back to you shortly."
3686
- },
3687
- styles: {
3688
- base: {
3689
- fontSize: "15px",
3690
- color: "#64748b",
3691
- marginBottom: "28px",
3692
- textAlign: "center",
3693
- lineHeight: "1.5"
3694
- }
3695
- }
3696
- },
3697
- {
3698
- id: gen("form"),
3699
- type: "form",
3700
- props: {
3701
- name: "contact_us_form",
3702
- method: "POST",
3703
- preventDefault: true,
3704
- scrollToFirstError: true,
3705
- resetOnSubmit: true
3706
- },
3707
- styles: {
3708
- base: {
3709
- display: "flex",
3710
- flexDirection: "column",
3711
- gap: "20px",
3712
- width: "100%"
3713
- }
3714
- },
3715
- actions: [
3716
- {
3717
- id: gen("pipeline"),
3718
- trigger: "submit",
3719
- label: "Submit Contact Form",
3720
- enabled: true,
3721
- steps: [
3722
- {
3723
- id: gen("step"),
3724
- type: "api_request",
3725
- label: "Send Contact Message",
3726
- payload: {
3727
- url: "/api/mock/submit-lead",
3728
- method: "POST",
3729
- bodyFormat: "json"
3730
- },
3731
- onSuccess: [
3732
- {
3733
- id: gen("step"),
3734
- type: "show_toast",
3735
- label: "Show Success Toast",
3736
- payload: {
3737
- message: "Thank you! Your message has been sent successfully.",
3738
- type: "success",
3739
- title: "Message Sent",
3740
- duration: 4e3
3741
- }
3742
- },
3743
- {
3744
- id: gen("step"),
3745
- type: "reset_form",
3746
- label: "Reset Form",
3747
- payload: {}
3748
- }
3749
- ],
3750
- onError: [
3751
- {
3752
- id: gen("step"),
3753
- type: "show_toast",
3754
- label: "Show Error Toast",
3755
- payload: {
3756
- message: "Failed to send message. Please check your connection and try again.",
3757
- type: "error",
3758
- title: "Submission Failed",
3759
- duration: 5e3
3760
- }
3761
- }
3762
- ]
3763
- }
3764
- ]
3765
- }
3766
- ],
3767
- children: [
3768
- {
3769
- id: gen("input"),
3770
- type: "input",
3771
- props: {
3772
- name: "name",
3773
- label: "Your Name",
3774
- type: "text",
3775
- placeholder: "Jane Doe",
3776
- required: true,
3777
- rules: [
3778
- { type: "required", message: "Please enter your name" },
3779
- { type: "min_length", value: 2, message: "Name must be at least 2 characters" }
3780
- ]
3781
- },
3782
- styles: {
3783
- base: {
3784
- width: "100%",
3785
- padding: "10px 14px",
3786
- borderRadius: "8px",
3787
- border: "1px solid #cbd5e1",
3788
- fontSize: "14px"
3789
- }
3790
- }
3791
- },
3792
- {
3793
- id: gen("input"),
3794
- type: "input",
3795
- props: {
3796
- name: "email",
3797
- label: "Email Address",
3798
- type: "email",
3799
- placeholder: "jane@example.com",
3800
- required: true,
3801
- rules: [
3802
- { type: "required", message: "Please enter your email" },
3803
- { type: "email", message: "Please enter a valid email address" }
3804
- ]
3805
- },
3806
- styles: {
3807
- base: {
3808
- width: "100%",
3809
- padding: "10px 14px",
3810
- borderRadius: "8px",
3811
- border: "1px solid #cbd5e1",
3812
- fontSize: "14px"
3813
- }
3814
- }
3815
- },
3816
- {
3817
- id: gen("input"),
3818
- type: "input",
3819
- props: {
3820
- name: "subject",
3821
- label: "Subject",
3822
- type: "text",
3823
- placeholder: "How can we help you?",
3824
- required: true,
3825
- rules: [
3826
- { type: "required", message: "Please enter a subject" }
3827
- ]
3828
- },
3829
- styles: {
3830
- base: {
3831
- width: "100%",
3832
- padding: "10px 14px",
3833
- borderRadius: "8px",
3834
- border: "1px solid #cbd5e1",
3835
- fontSize: "14px"
3836
- }
3837
- }
3838
- },
3839
- {
3840
- id: gen("textarea"),
3841
- type: "textarea",
3842
- props: {
3843
- name: "message",
3844
- label: "Message",
3845
- placeholder: "Write your message here...",
3846
- rows: 4,
3847
- required: true,
3848
- rules: [
3849
- { type: "required", message: "Please enter your message" },
3850
- { type: "min_length", value: 10, message: "Message must be at least 10 characters" }
3851
- ]
3852
- },
3853
- styles: {
3854
- base: {
3855
- width: "100%",
3856
- padding: "10px 14px",
3857
- borderRadius: "8px",
3858
- border: "1px solid #cbd5e1",
3859
- fontSize: "14px"
3860
- }
3861
- }
3862
- },
3863
- {
3864
- id: gen("button"),
3865
- type: "button",
3866
- props: {
3867
- label: "Send Message",
3868
- variant: "primary",
3869
- buttonType: "submit"
3870
- },
3871
- styles: {
3872
- base: {
3873
- width: "100%",
3874
- backgroundColor: "#2563eb",
3875
- color: "#ffffff",
3876
- padding: "12px",
3877
- borderRadius: "8px",
3878
- fontWeight: "600",
3879
- fontSize: "15px",
3880
- display: "inline-block",
3881
- textAlign: "center"
3882
- },
3883
- states: {
3884
- ":hover": { backgroundColor: "#1d4ed8" }
3885
- }
3886
- }
3887
- }
3888
- ]
3889
- }
3890
- ]
3891
- }
3892
- ]
3893
- })
3894
- },
3895
- {
3896
- id: "form-newsletter",
3897
- name: "Newsletter Subscribe Form",
3898
- category: "forms",
3899
- categoryLabel: "Form Templates",
3900
- description: "Inline email newsletter subscription form with real-time feedback",
3901
- icon: "mail",
3902
- createNodeTree: (gen = defaultGenId) => ({
3903
- id: gen("section"),
3904
- type: "section",
3905
- styles: {
3906
- base: {
3907
- padding: "48px 20px",
3908
- backgroundColor: "#f1f5f9",
3909
- width: "100%"
3910
- }
3911
- },
3912
- children: [
3913
- {
3914
- id: gen("container"),
3915
- type: "container",
3916
- props: { tag: "div", maxWidth: "580px" },
3917
- styles: {
3918
- base: {
3919
- maxWidth: "580px",
3920
- margin: "0 auto",
3921
- width: "100%",
3922
- textAlign: "center"
3923
- }
3924
- },
3925
- children: [
3926
- {
3927
- id: gen("heading"),
3928
- type: "heading",
3929
- props: { text: "Stay in the Loop", level: 3 },
3930
- styles: {
3931
- base: {
3932
- fontSize: "26px",
3933
- fontWeight: "700",
3934
- color: "#0f172a",
3935
- marginBottom: "8px"
3936
- }
3937
- }
3938
- },
3939
- {
3940
- id: gen("paragraph"),
3941
- type: "paragraph",
3942
- props: {
3943
- content: "Subscribe to our newsletter for weekly curated insights, updates, and best practices."
3944
- },
3945
- styles: {
3946
- base: {
3947
- fontSize: "15px",
3948
- color: "#64748b",
3949
- marginBottom: "24px",
3950
- lineHeight: "1.5"
3951
- }
3952
- }
3953
- },
3954
- {
3955
- id: gen("form"),
3956
- type: "form",
3957
- props: {
3958
- name: "newsletter_form",
3959
- method: "POST",
3960
- preventDefault: true,
3961
- resetOnSubmit: true
3962
- },
3963
- styles: {
3964
- base: {
3965
- display: "flex",
3966
- flexDirection: "row",
3967
- gap: "8px",
3968
- alignItems: "center",
3969
- width: "100%"
3970
- },
3971
- mobile: {
3972
- flexDirection: "column"
3973
- }
3974
- },
3975
- actions: [
3976
- {
3977
- id: gen("pipeline"),
3978
- trigger: "submit",
3979
- label: "Subscribe to Newsletter",
3980
- enabled: true,
3981
- steps: [
3982
- {
3983
- id: gen("step"),
3984
- type: "api_request",
3985
- label: "Submit Subscription",
3986
- payload: {
3987
- url: "/api/mock/submit-lead",
3988
- method: "POST",
3989
- bodyFormat: "json"
3990
- },
3991
- onSuccess: [
3992
- {
3993
- id: gen("step"),
3994
- type: "show_toast",
3995
- label: "Show Success Toast",
3996
- payload: {
3997
- message: "Thank you for subscribing to our newsletter!",
3998
- type: "success",
3999
- title: "Subscription Confirmed",
4000
- duration: 4e3
4001
- }
4002
- },
4003
- {
4004
- id: gen("step"),
4005
- type: "reset_form",
4006
- label: "Reset Form",
4007
- payload: {}
4008
- }
4009
- ],
4010
- onError: [
4011
- {
4012
- id: gen("step"),
4013
- type: "show_toast",
4014
- label: "Show Error Toast",
4015
- payload: {
4016
- message: "Unable to subscribe right now. Please try again later.",
4017
- type: "error",
4018
- title: "Error",
4019
- duration: 5e3
4020
- }
4021
- }
4022
- ]
4023
- }
4024
- ]
4025
- }
4026
- ],
4027
- children: [
4028
- {
4029
- id: gen("input"),
4030
- type: "input",
4031
- props: {
4032
- name: "email",
4033
- type: "email",
4034
- placeholder: "Enter your email address...",
4035
- required: true,
4036
- rules: [
4037
- { type: "required", message: "Email address is required" },
4038
- { type: "email", message: "Please enter a valid email address" }
4039
- ]
4040
- },
4041
- styles: {
4042
- base: {
4043
- flex: "1 1 0%",
4044
- minWidth: "0",
4045
- padding: "12px 16px",
4046
- borderRadius: "8px",
4047
- border: "1px solid #cbd5e1",
4048
- backgroundColor: "#ffffff",
4049
- fontSize: "14px"
4050
- }
4051
- }
4052
- },
4053
- {
4054
- id: gen("button"),
4055
- type: "button",
4056
- props: {
4057
- label: "Subscribe",
4058
- variant: "primary",
4059
- buttonType: "submit"
4060
- },
4061
- styles: {
4062
- base: {
4063
- backgroundColor: "#2563eb",
4064
- color: "#ffffff",
4065
- padding: "12px 24px",
4066
- borderRadius: "8px",
4067
- fontWeight: "600",
4068
- fontSize: "14px",
4069
- whiteSpace: "nowrap"
4070
- },
4071
- states: {
4072
- ":hover": { backgroundColor: "#1d4ed8" }
4073
- }
4074
- }
4075
- }
4076
- ]
4077
- }
4078
- ]
4079
- }
4080
- ]
4081
- })
4082
- },
4083
- {
4084
- id: "form-lead-gen",
4085
- name: "Lead Generation Form",
4086
- category: "forms",
4087
- categoryLabel: "Form Templates",
4088
- description: "Multi-field lead generation form with phone validation, interest dropdown, and API submission pipeline",
4089
- icon: "users",
4090
- createNodeTree: (gen = defaultGenId) => ({
4091
- id: gen("section"),
4092
- type: "section",
4093
- styles: {
4094
- base: {
4095
- padding: "64px 20px",
4096
- backgroundColor: "#ffffff",
4097
- width: "100%"
4098
- }
4099
- },
4100
- children: [
4101
- {
4102
- id: gen("container"),
4103
- type: "container",
4104
- props: { tag: "div", maxWidth: "640px" },
4105
- styles: {
4106
- base: {
4107
- maxWidth: "640px",
4108
- margin: "0 auto",
4109
- width: "100%",
4110
- backgroundColor: "#ffffff",
4111
- padding: "36px",
4112
- borderRadius: "16px",
4113
- border: "1px solid #e2e8f0",
4114
- boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.05)"
4115
- }
4116
- },
4117
- children: [
4118
- {
4119
- id: gen("badge"),
4120
- type: "badge",
4121
- props: { label: "FREE CONSULTATION", variant: "primary" },
4122
- styles: { base: { marginBottom: "12px", display: "inline-block" } }
4123
- },
4124
- {
4125
- id: gen("heading"),
4126
- type: "heading",
4127
- props: { text: "Schedule a Consultation", level: 2 },
4128
- styles: {
4129
- base: {
4130
- fontSize: "28px",
4131
- fontWeight: "700",
4132
- color: "#0f172a",
4133
- marginBottom: "8px"
4134
- }
4135
- }
4136
- },
4137
- {
4138
- id: gen("paragraph"),
4139
- type: "paragraph",
4140
- props: {
4141
- content: "Share your project details with our solutions team. We will analyze your needs and provide a personalized roadmap."
4142
- },
4143
- styles: {
4144
- base: {
4145
- fontSize: "15px",
4146
- color: "#64748b",
4147
- marginBottom: "28px",
4148
- lineHeight: "1.5"
4149
- }
4150
- }
4151
- },
4152
- {
4153
- id: gen("form"),
4154
- type: "form",
4155
- props: {
4156
- name: "lead_generation_form",
4157
- method: "POST",
4158
- preventDefault: true,
4159
- scrollToFirstError: true,
4160
- resetOnSubmit: true
4161
- },
4162
- styles: {
4163
- base: {
4164
- display: "flex",
4165
- flexDirection: "column",
4166
- gap: "18px",
4167
- width: "100%"
4168
- }
4169
- },
4170
- actions: [
4171
- {
4172
- id: gen("pipeline"),
4173
- trigger: "submit",
4174
- label: "Submit Lead Form",
4175
- enabled: true,
4176
- steps: [
4177
- {
4178
- id: gen("step"),
4179
- type: "api_request",
4180
- label: "Send Lead Data",
4181
- payload: {
4182
- url: "/api/mock/submit-lead",
4183
- method: "POST",
4184
- bodyFormat: "json"
4185
- },
4186
- onSuccess: [
4187
- {
4188
- id: gen("step"),
4189
- type: "show_toast",
4190
- label: "Show Success Toast",
4191
- payload: {
4192
- message: "Thank you! Your request has been received. Our team will contact you shortly.",
4193
- type: "success",
4194
- title: "Request Submitted",
4195
- duration: 4e3
4196
- }
4197
- },
4198
- {
4199
- id: gen("step"),
4200
- type: "reset_form",
4201
- label: "Reset Form",
4202
- payload: {}
4203
- }
4204
- ],
4205
- onError: [
4206
- {
4207
- id: gen("step"),
4208
- type: "show_toast",
4209
- label: "Show Error Toast",
4210
- payload: {
4211
- message: "Submission failed. Please verify your information and try again.",
4212
- type: "error",
4213
- title: "Submission Error",
4214
- duration: 5e3
4215
- }
4216
- }
4217
- ]
4218
- }
4219
- ]
4220
- }
4221
- ],
4222
- children: [
4223
- {
4224
- id: gen("input"),
4225
- type: "input",
4226
- props: {
4227
- name: "full_name",
4228
- label: "Full Name",
4229
- type: "text",
4230
- placeholder: "Alex Morgan",
4231
- required: true,
4232
- rules: [
4233
- { type: "required", message: "Full name is required" },
4234
- { type: "min_length", value: 2, message: "Name must be at least 2 characters" }
4235
- ]
4236
- },
4237
- styles: {
4238
- base: {
4239
- width: "100%",
4240
- padding: "10px 14px",
4241
- borderRadius: "8px",
4242
- border: "1px solid #cbd5e1",
4243
- fontSize: "14px"
4244
- }
4245
- }
4246
- },
4247
- {
4248
- id: gen("input"),
4249
- type: "input",
4250
- props: {
4251
- name: "email",
4252
- label: "Business Email",
4253
- type: "email",
4254
- placeholder: "alex@company.com",
4255
- required: true,
4256
- rules: [
4257
- { type: "required", message: "Business email is required" },
4258
- { type: "email", message: "Please enter a valid email address" }
4259
- ]
4260
- },
4261
- styles: {
4262
- base: {
4263
- width: "100%",
4264
- padding: "10px 14px",
4265
- borderRadius: "8px",
4266
- border: "1px solid #cbd5e1",
4267
- fontSize: "14px"
4268
- }
4269
- }
4270
- },
4271
- {
4272
- id: gen("input"),
4273
- type: "input",
4274
- props: {
4275
- name: "phone",
4276
- label: "Phone Number",
4277
- type: "tel",
4278
- placeholder: "+62 812-3456-7890",
4279
- required: true,
4280
- rules: [
4281
- { type: "required", message: "Phone number is required" },
4282
- {
4283
- type: "custom_regex",
4284
- value: "^[+]?[0-9\\s-()]{8,20}$",
4285
- message: "Please enter a valid phone number (min 8 digits)"
4286
- }
4287
- ]
4288
- },
4289
- styles: {
4290
- base: {
4291
- width: "100%",
4292
- padding: "10px 14px",
4293
- borderRadius: "8px",
4294
- border: "1px solid #cbd5e1",
4295
- fontSize: "14px"
4296
- }
4297
- }
4298
- },
4299
- {
4300
- id: gen("select"),
4301
- type: "select",
4302
- props: {
4303
- name: "interest",
4304
- label: "Area of Interest",
4305
- placeholder: "Select your interest / service...",
4306
- required: true,
4307
- defaultValue: "",
4308
- options: [
4309
- { label: "Web Platform Development", value: "web_platform" },
4310
- { label: "Mobile Application", value: "mobile_app" },
4311
- { label: "Cloud Architecture & DevOps", value: "cloud_devops" },
4312
- { label: "UI/UX Product Design", value: "product_design" },
4313
- { label: "General Inquiry", value: "general" }
4314
- ],
4315
- rules: [
4316
- { type: "required", message: "Please select an area of interest" }
4317
- ]
4318
- },
4319
- styles: {
4320
- base: {
4321
- width: "100%",
4322
- padding: "10px 14px",
4323
- borderRadius: "8px",
4324
- border: "1px solid #cbd5e1",
4325
- fontSize: "14px",
4326
- backgroundColor: "#ffffff"
4327
- }
4328
- }
4329
- },
4330
- {
4331
- id: gen("input"),
4332
- type: "input",
4333
- props: {
4334
- name: "company",
4335
- label: "Company Name (Optional)",
4336
- type: "text",
4337
- placeholder: "Company / Organization"
4338
- },
4339
- styles: {
4340
- base: {
4341
- width: "100%",
4342
- padding: "10px 14px",
4343
- borderRadius: "8px",
4344
- border: "1px solid #cbd5e1",
4345
- fontSize: "14px"
4346
- }
4347
- }
4348
- },
4349
- {
4350
- id: gen("button"),
4351
- type: "button",
4352
- props: {
4353
- label: "Request Consultation",
4354
- variant: "primary",
4355
- buttonType: "submit"
4356
- },
4357
- styles: {
4358
- base: {
4359
- width: "100%",
4360
- backgroundColor: "#2563eb",
4361
- color: "#ffffff",
4362
- padding: "12px 24px",
4363
- borderRadius: "8px",
4364
- fontWeight: "600",
4365
- fontSize: "15px",
4366
- marginTop: "4px"
4367
- },
4368
- states: {
4369
- ":hover": { backgroundColor: "#1d4ed8" }
4370
- }
4371
- }
4372
- }
4373
- ]
4374
- }
4375
- ]
4376
- }
4377
- ]
4378
- })
4379
- }
4380
- ];
4381
157
  export {
158
+ CONTENT_CHILD_TYPES,
4382
159
  ComponentRegistry,
160
+ FORM_STARTER_BLOCKS,
161
+ LAYOUT_PARENTS,
162
+ LAYOUT_STARTER_BLOCKS,
4383
163
  STARTER_BLOCKS,
4384
164
  TRAIT_GROUP_LABELS,
4385
165
  TRAIT_GROUP_ORDER,
166
+ UI_STARTER_BLOCKS,
4386
167
  acceptTrait,
4387
168
  actionTrait,
4388
169
  altTrait,
@@ -4400,6 +181,7 @@ export {
4400
181
  citeTrait,
4401
182
  codeBlockDefinition,
4402
183
  colSpanTrait,
184
+ collapsibleDefinition,
4403
185
  collectTraitNames,
4404
186
  collectionDefinition,
4405
187
  columnsDefinition,
@@ -4408,13 +190,17 @@ export {
4408
190
  coreComponentDefinitions,
4409
191
  createDefaultComponentRegistry,
4410
192
  defaultCheckedTrait,
193
+ defaultGenId,
4411
194
  defaultSelectedTrait,
4412
195
  defaultValueTrait,
4413
196
  disabledTrait,
197
+ drawerDefinition,
4414
198
  extractComponentRequirements,
4415
199
  fieldNameTrait,
4416
200
  fileUploadDefinition,
201
+ flexDefinition,
4417
202
  formDefinition,
203
+ gridDefinition,
4418
204
  headingDefinition,
4419
205
  helperTextTrait,
4420
206
  hrefTrait,
@@ -4438,6 +224,7 @@ export {
4438
224
  maxLengthTrait,
4439
225
  methodTrait,
4440
226
  minLengthTrait,
227
+ modalDefinition,
4441
228
  multipleTrait,
4442
229
  mutedTrait,
4443
230
  optionsListTrait,
@@ -4479,6 +266,7 @@ export {
4479
266
  textareaDefinition,
4480
267
  titleTrait,
4481
268
  valueTrait,
4482
- videoDefinition
269
+ videoDefinition,
270
+ withOverrides
4483
271
  };
4484
272
  //# sourceMappingURL=index.js.map