@perkyzz/emvb 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/README.md +4 -2
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/package.json +3 -1
  4. package/src/admin/access/role.ts +9 -3
  5. package/src/admin/api.ts +17 -7
  6. package/src/admin/content-api.ts +7 -51
  7. package/src/admin/content-item.ts +22 -0
  8. package/src/admin/design-api.ts +30 -0
  9. package/src/admin/editor/A11yCopilot.tsx +1 -1
  10. package/src/admin/editor/Editor.tsx +106 -332
  11. package/src/admin/editor/EditorOverlay.tsx +3 -1
  12. package/src/admin/editor/PerfMeter.tsx +1 -1
  13. package/src/admin/editor/ShortcutsDialog.tsx +4 -1
  14. package/src/admin/editor/Timeline.tsx +16 -3
  15. package/src/admin/editor/canvas/CanvasFrame.tsx +51 -368
  16. package/src/admin/editor/canvas/DeviceBar.tsx +4 -1
  17. package/src/admin/editor/canvas/SelectionOverlay.tsx +86 -46
  18. package/src/admin/editor/canvas/canvas-scale.ts +20 -0
  19. package/src/admin/editor/canvas/drop-line.ts +24 -0
  20. package/src/admin/editor/canvas/use-canvas-dnd.ts +207 -0
  21. package/src/admin/editor/canvas/use-canvas-session.ts +216 -0
  22. package/src/admin/editor/collection-previews.ts +28 -5
  23. package/src/admin/editor/editor-chrome.tsx +346 -0
  24. package/src/admin/editor/editor-commands.ts +360 -0
  25. package/src/admin/editor/element-chrome.ts +89 -0
  26. package/src/admin/editor/feature-css.ts +15 -15
  27. package/src/admin/editor/host.ts +33 -0
  28. package/src/admin/editor/icons/IconLibraryDialog.tsx +64 -218
  29. package/src/admin/editor/icons/library.ts +29 -19
  30. package/src/admin/editor/icons/use-icon-library.ts +315 -0
  31. package/src/admin/editor/palette-items.ts +36 -5
  32. package/src/admin/editor/palette.ts +3 -2
  33. package/src/admin/editor/panels/AddPanel.tsx +2 -67
  34. package/src/admin/editor/panels/ColorControl.tsx +2 -10
  35. package/src/admin/editor/panels/ElementPanel.tsx +40 -99
  36. package/src/admin/editor/panels/LayersPanel.tsx +34 -62
  37. package/src/admin/editor/panels/SettingsPanel.tsx +1 -0
  38. package/src/admin/editor/panels/SiteStylesDrawer.tsx +16 -10
  39. package/src/admin/editor/panels/VariableSection.tsx +1 -10
  40. package/src/admin/editor/panels/inline-error.tsx +11 -0
  41. package/src/admin/editor/panels/settings/AdvancedFields.tsx +87 -1
  42. package/src/admin/editor/panels/settings/AudienceEditor.tsx +73 -3
  43. package/src/admin/editor/panels/settings/DraftTextField.tsx +4 -0
  44. package/src/admin/editor/panels/settings/FormBindControl.tsx +8 -4
  45. package/src/admin/editor/panels/settings/ItemList.tsx +34 -1
  46. package/src/admin/editor/panels/settings/StyleRow.tsx +14 -2
  47. package/src/admin/editor/panels/settings/form-names.ts +7 -11
  48. package/src/admin/editor/panels/settings/length-units.ts +15 -4
  49. package/src/admin/editor/panels/settings/style-sections.ts +5 -1
  50. package/src/admin/editor/panels/style-target.ts +105 -0
  51. package/src/admin/editor/section-templates.ts +43 -21
  52. package/src/admin/editor/shortcuts.ts +4 -0
  53. package/src/admin/editor/store.ts +10 -1
  54. package/src/admin/editor/useClipboardActions.ts +1 -1
  55. package/src/admin/editor/useEditorCommands.ts +61 -13
  56. package/src/admin/editor/useEditorData.ts +7 -1
  57. package/src/admin/editor/useEditorShortcuts.ts +23 -15
  58. package/src/admin/editor/useNodeActions.ts +6 -1
  59. package/src/admin/forms-api.ts +17 -6
  60. package/src/admin/icon-uploads-api.ts +18 -0
  61. package/src/admin/theme-api.ts +5 -18
  62. package/src/astro/content-port.ts +24 -0
  63. package/src/astro/forms/EmVBFormsClient.astro +11 -0
  64. package/src/astro/forms/EmVBFormsRuntime.astro +6 -7
  65. package/src/astro/forms/client.ts +1 -0
  66. package/src/astro/forms-definitions.ts +24 -11
  67. package/src/astro/index.ts +1 -0
  68. package/src/astro/render-session.ts +85 -0
  69. package/src/astro/request-data.ts +20 -8
  70. package/src/astro/resolve-theme.ts +166 -76
  71. package/src/astro/resolve.ts +57 -16
  72. package/src/astro/theme-posts.ts +16 -5
  73. package/src/astro/visitor.ts +67 -5
  74. package/src/constants.ts +1 -1
  75. package/src/core/arrange.ts +63 -38
  76. package/src/core/audience/rules.ts +22 -2
  77. package/src/core/canvas-styles.ts +24 -0
  78. package/src/core/clipboard.ts +11 -32
  79. package/src/core/css/generate.ts +9 -0
  80. package/src/core/css/print.ts +12 -0
  81. package/src/core/css/scope.ts +3 -3
  82. package/src/core/css-keywords.ts +83 -0
  83. package/src/core/data/bindings.ts +4 -6
  84. package/src/core/design/classes.ts +13 -15
  85. package/src/core/design/diff.ts +55 -0
  86. package/src/core/design/merge.ts +127 -0
  87. package/src/core/design/variables.ts +25 -21
  88. package/src/core/elements/dynamic-elements.ts +30 -0
  89. package/src/core/elements/form-elements.ts +1 -0
  90. package/src/core/elements/index.ts +183 -7
  91. package/src/core/forms/binding.ts +4 -13
  92. package/src/core/index.ts +10 -0
  93. package/src/core/local-style.ts +27 -0
  94. package/src/core/migrate/index.ts +9 -4
  95. package/src/core/nesting.ts +4 -23
  96. package/src/core/perf/scripts.ts +9 -6
  97. package/src/core/record.ts +3 -0
  98. package/src/core/render/context.ts +2 -0
  99. package/src/core/render/dynamic-post.ts +1 -2
  100. package/src/core/render/form.ts +133 -10
  101. package/src/core/render/index.ts +155 -13
  102. package/src/core/render/vnode.ts +12 -2
  103. package/src/core/sanitize/css.ts +90 -77
  104. package/src/core/sanitize/svg.ts +8 -3
  105. package/src/core/sanitize/url.ts +10 -1
  106. package/src/core/schema/design.ts +5 -7
  107. package/src/core/schema/layout.ts +153 -181
  108. package/src/core/schema/style.ts +53 -63
  109. package/src/core/share/link.ts +68 -28
  110. package/src/core/tabs/presence.ts +7 -17
  111. package/src/core/theme/dynamic.ts +200 -39
  112. package/src/core/theme/float.ts +1 -1
  113. package/src/core/tree-ops.ts +57 -0
  114. package/src/index.ts +14 -2
  115. package/src/server/design-routes.ts +4 -1
  116. package/src/server/icon-routes.ts +68 -16
  117. package/src/server/plugin.ts +8 -2
  118. package/src/admin/editor/icons/sets/fontawesome.json +0 -1
  119. package/src/admin/editor/icons/sets/lucide.json +0 -1
  120. package/src/admin/editor/icons/sets/remix.json +0 -1
  121. package/src/admin/editor/icons/sets/tabler.json +0 -1
@@ -3,13 +3,18 @@ import { MAX_TEXT_LENGTH } from "../limits.ts";
3
3
  import { DeviceStyles, HiddenOn, Length, StyleProps, StyleStates } from "./style.ts";
4
4
 
5
5
  /**
6
+ * 15 since W-341: optional per-element `dir`, image link/caption/focal point/sources, button icons,
7
+ * a table-of-contents element, and container queries. Every other value is unchanged.
8
+ * 14 since W-329: optional visitor `segments` in an element's audience (the host names them);
9
+ * W-330 Loop permalink, image, excerpt and filter options; W-331 `ch` lengths and negative
10
+ * margins. Every other value is unchanged.
6
11
  * 13 since W-307: optional `bind` on a node (live data bindings); W-308 collection Loops and the
7
12
  * Loop's Empty state element. Every other value is unchanged.
8
13
  * 12 since W-160: gradient type, stop locations, and up to 10 stops. v11 gradients
9
14
  * (`{ angle, from, to }`) become a linear gradient on read.
10
15
  * 11 since W-156 and W-157 (D-045): the layout Section element and an editor-only node label.
11
16
  */
12
- export const LAYOUT_SCHEMA_VERSION = 13;
17
+ export const LAYOUT_SCHEMA_VERSION = 15;
13
18
 
14
19
  export const NodeId = z
15
20
  .string()
@@ -96,6 +101,10 @@ export const Variant = z.strictObject({
96
101
  export type Variant = z.infer<typeof Variant>;
97
102
 
98
103
  export const AUDIENCE_DEVICES = ["mobile", "tablet", "desktop"] as const;
104
+ /** A visitor segment name the host passes and a Visitors rule matches (W-329). */
105
+ /** A host segment name: letters, digits, and `:` `_` `-`, up to 64 characters (`plan:pro`). */
106
+ export const AUDIENCE_SEGMENT = /^[a-z0-9][a-z0-9:_-]{0,63}$/;
107
+ const SEGMENT_HINT = "Segments are lowercase letters, digits, - or _, e.g. member";
99
108
 
100
109
  /**
101
110
  * Who sees an element (W-313): visitors from these countries, on these devices, new or
@@ -123,6 +132,11 @@ export const Audience = z.strictObject({
123
132
  .regex(/^[A-Za-z][A-Za-z0-9_+-]*(\/[A-Za-z0-9_+-]+){0,2}$/)
124
133
  .max(64)
125
134
  .optional(),
135
+ /**
136
+ * Visitor segments the host passes (W-329), e.g. `member`, `plan:pro`: the rule matches a
137
+ * visitor in any of them. A letter or digit, then letters, digits, `:`, `_` or `-`, up to 64.
138
+ */
139
+ segments: z.array(z.string().regex(AUDIENCE_SEGMENT, SEGMENT_HINT)).min(1).max(20).optional(),
126
140
  hide: z.boolean().optional(),
127
141
  });
128
142
  export type Audience = z.infer<typeof Audience>;
@@ -133,11 +147,12 @@ const BoxLink = {
133
147
  newTab: z.boolean().optional(),
134
148
  };
135
149
 
136
- /** The fields every element has; `props` is the element's own strict props schema. */
137
- const nodeFields = <T extends string, P extends z.ZodType>(type: T, props: P) => ({
138
- id: NodeId,
139
- type: z.literal(type),
140
- props,
150
+ /**
151
+ * Fields every element carries, known or unknown (W-352). One object so a new field cannot
152
+ * land on known nodes and be stripped from unknown ones, which is what happened to
153
+ * `dir`, `container` and `query` before this.
154
+ */
155
+ const sharedNodeFields = {
141
156
  style: StyleProps.optional(),
142
157
  states: StyleStates.optional(),
143
158
  devices: DeviceStyles.optional(),
@@ -149,6 +164,28 @@ const nodeFields = <T extends string, P extends z.ZodType>(type: T, props: P) =>
149
164
  bind: Bindings.optional(),
150
165
  variant: Variant.optional(),
151
166
  audience: Audience.optional(),
167
+ /** Text direction for this element only (W-341). Unset follows the site direction. */
168
+ dir: z.enum(["ltr", "rtl", "auto"]).optional(),
169
+ /** This box is a container-query container (`container-type: inline-size`) (W-346). */
170
+ container: z.literal(true).optional(),
171
+ /**
172
+ * Style overrides when the nearest query container is at least `min` px wide (W-346).
173
+ * Emitted as `@container (min-width: Npx)`, not a viewport media query.
174
+ */
175
+ query: z
176
+ .strictObject({
177
+ min: z.number().int().min(1).max(3840),
178
+ style: StyleProps,
179
+ })
180
+ .optional(),
181
+ };
182
+
183
+ /** The fields every element has; `props` is the element's own strict props schema. */
184
+ const nodeFields = <T extends string, P extends z.ZodType>(type: T, props: P) => ({
185
+ id: NodeId,
186
+ type: z.literal(type),
187
+ props,
188
+ ...sharedNodeFields,
152
189
  });
153
190
 
154
191
  const leafNode = <T extends string, P extends z.ZodType>(type: T, props: P) =>
@@ -212,6 +249,12 @@ export const ButtonNode = leafNode(
212
249
  text: z.string().max(MAX_TEXT_LENGTH),
213
250
  href: z.string().max(2000).optional(),
214
251
  newTab: z.boolean().optional(),
252
+ /** Icon shown with the label (W-343). The SVG is stored on the button, like an Icon element. */
253
+ iconId: z.string().max(64).optional(),
254
+ iconSvg: z.string().max(32_768).optional(),
255
+ iconPosition: z.enum(["before", "after"]).optional(),
256
+ iconGap: z.number().int().min(0).max(64).optional(),
257
+ iconSize: z.enum(["sm", "md", "lg"]).optional(),
215
258
  }),
216
259
  );
217
260
 
@@ -279,6 +322,23 @@ export const ImageNode = leafNode(
279
322
  mediaId: z.string().min(1).max(128).optional(),
280
323
  /** Load right away (eager, high fetch priority) for the hero/LCP image (W-226). */
281
324
  priority: z.boolean().optional(),
325
+ /** Link around the image. Size styles stay on the img (W-342). */
326
+ href: z.string().max(2000).optional(),
327
+ newTab: z.boolean().optional(),
328
+ caption: z.string().max(500).optional(),
329
+ /** Focal point as object-position percentages (W-344). */
330
+ focalX: z.number().int().min(0).max(100).optional(),
331
+ focalY: z.number().int().min(0).max(100).optional(),
332
+ /** Extra widths for srcset. Omitted when there is no distinct URL (W-344). */
333
+ sources: z
334
+ .array(
335
+ z.strictObject({
336
+ src: z.string().max(2000),
337
+ width: z.number().int().min(1).max(8000),
338
+ }),
339
+ )
340
+ .max(6)
341
+ .optional(),
282
342
  }),
283
343
  ).refine((node) => node.props.decorative === true || node.props.alt.length > 0, {
284
344
  message: "Alt text is required unless the image is marked decorative.",
@@ -321,15 +381,29 @@ export const LayoutSectionNode = parentNode(
321
381
  export const FlexboxNode = parentNode("flexbox", z.strictObject({ ...BoxLink }));
322
382
 
323
383
  /**
324
- * Equal columns. Children span with `gridColumnSpan` and `gridRowSpan` on their style. Tablet
325
- * and mobile may have their own count (W-139); unset follows the next wider device.
384
+ * Equal columns, or custom tracks when `columnTracks` is set for that device. Children span
385
+ * with `gridColumnSpan` and `gridRowSpan`, and can start on a line with `gridColumnStart` and
386
+ * `gridRowStart`. Tablet and mobile may have their own count (W-139); unset follows the next
387
+ * wider device.
326
388
  */
389
+ /**
390
+ * One grid track: `1fr`/`2fr`/`3fr`, `auto`, `min-content`, `max-content`, or a length
391
+ * in the same units as other lengths (`200px`, `20%`, `1.5rem`).
392
+ */
393
+ const GRID_TRACK =
394
+ /^(?:1fr|2fr|3fr|auto|min-content|max-content|0|(?:\d+(?:\.\d+)?)(?:px|rem|em|%|vw|vh|ch))$/;
395
+ const GridTracks = z.array(z.string().regex(GRID_TRACK)).min(1).max(12);
396
+
327
397
  export const GridNode = parentNode(
328
398
  "grid",
329
399
  z.strictObject({
330
400
  columns: z.number().int().min(1).max(12),
331
401
  columnsTablet: z.number().int().min(1).max(12).optional(),
332
402
  columnsMobile: z.number().int().min(1).max(12).optional(),
403
+ /** Replaces equal `columns` on that device when set. */
404
+ columnTracks: GridTracks.optional(),
405
+ columnTracksTablet: GridTracks.optional(),
406
+ columnTracksMobile: GridTracks.optional(),
333
407
  ...BoxLink,
334
408
  }),
335
409
  );
@@ -486,6 +560,15 @@ export const PostLinkNode = leafNode(
486
560
  */
487
561
  /** How a Loop lays out its items (W-308): one design, shown as a list, a grid or cards. */
488
562
  export const LOOP_DISPLAYS = ["list", "grid", "cards"] as const;
563
+ /** A collection field's slug, e.g. `photo` (W-330). */
564
+ const FIELD_SLUG = /^[a-z][a-z0-9_]{0,63}$/;
565
+ const FIELD_SLUG_HINT = "Use the field's slug, e.g. photo";
566
+ /** A site path with `{slug}` or `{id}`, and no other placeholders (W-330). */
567
+ export const LOOP_PERMALINK =
568
+ /^(?=.*\{(?:slug|id)\})\/(?!\/)(?:[A-Za-z0-9._~/-]|\{slug\}|\{id\})*$/;
569
+ /** `field=value` pairs separated by `;` (W-330). Values have no `;`, `=` or angle brackets. */
570
+ export const LOOP_FILTER =
571
+ /^\s*[a-z][a-z0-9_]{0,63}\s*=\s*[^;=<>]{1,100}?(?:\s*;\s*[a-z][a-z0-9_]{0,63}\s*=\s*[^;=<>]{1,100}?)*\s*;?\s*$/;
489
572
  /** Which entries a collection Loop shows first (W-308). */
490
573
  export const LOOP_ORDERS = ["newest", "oldest", "title"] as const;
491
574
 
@@ -509,6 +592,28 @@ export const LoopNode = parentNode(
509
592
  display: z.enum(LOOP_DISPLAYS).optional(),
510
593
  /** Columns for grid and cards, 1–6 (one column on phones). Unset = 3. */
511
594
  columns: z.number().int().min(1).max(6).optional(),
595
+ /**
596
+ * Where each entry links (W-330), e.g. `/team/{slug}`; `{slug}` and `{id}` are filled in.
597
+ * Unset = `/<collection>/{slug}`.
598
+ */
599
+ permalink: z
600
+ .string()
601
+ .max(200)
602
+ .regex(LOOP_PERMALINK, "A site path with {slug} or {id}, e.g. /team/{slug}")
603
+ .optional(),
604
+ /** The entry field holding the image Post Image shows (W-330). Unset = featured_image. */
605
+ imageField: z.string().regex(FIELD_SLUG, FIELD_SLUG_HINT).optional(),
606
+ /** The entry field Post Excerpt shows (W-330). Unset = excerpt. */
607
+ excerptField: z.string().regex(FIELD_SLUG, FIELD_SLUG_HINT).optional(),
608
+ /**
609
+ * Only entries where `field=value` (W-330), pairs separated by `;`, at most 5. A taxonomy name
610
+ * filters by term; the same field twice matches either value.
611
+ */
612
+ filter: z
613
+ .string()
614
+ .max(300)
615
+ .regex(LOOP_FILTER, "Use field=value pairs separated by ;")
616
+ .optional(),
512
617
  }),
513
618
  );
514
619
 
@@ -588,8 +693,17 @@ export const KNOWN_ELEMENT_TYPES = [
588
693
  "menu",
589
694
  "menu-item",
590
695
  "layout-section",
696
+ "toc",
591
697
  ] as const;
592
698
 
699
+ /** Headings on this page, as a list of links. No script (W-345). */
700
+ export const TocNode = leafNode(
701
+ "toc",
702
+ z.strictObject({
703
+ title: z.string().max(80).optional(),
704
+ }),
705
+ );
706
+
593
707
  const knownTypeSet = new Set<string>(KNOWN_ELEMENT_TYPES);
594
708
 
595
709
  /**
@@ -604,15 +718,7 @@ const UnknownNodeSchema = z.strictObject({
604
718
  .max(64)
605
719
  .refine((value) => !knownTypeSet.has(value), "Unknown element type"),
606
720
  props: z.record(z.string(), z.unknown()),
607
- style: StyleProps.optional(),
608
- states: StyleStates.optional(),
609
- classes: ClassIds.optional(),
610
- htmlId: HtmlId.optional(),
611
- attributes: HtmlAttributes.optional(),
612
- label: NodeLabel.optional(),
613
- bind: Bindings.optional(),
614
- variant: Variant.optional(),
615
- audience: Audience.optional(),
721
+ ...sharedNodeFields,
616
722
  get children(): z.ZodType<LayoutNode[] | undefined> {
617
723
  return z.array(LayoutNode).optional();
618
724
  },
@@ -628,6 +734,7 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
628
734
  TabsNodeSchema,
629
735
  TabPanelNode,
630
736
  HeadingNode,
737
+ TocNode,
631
738
  SpacerNode,
632
739
  DividerNode,
633
740
  TextNode,
@@ -663,6 +770,7 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
663
770
  ]);
664
771
 
665
772
  export type HeadingNode = z.infer<typeof HeadingNode>;
773
+ export type TocNode = z.infer<typeof TocNode>;
666
774
  export type SpacerNode = z.infer<typeof SpacerNode>;
667
775
  export type DividerNode = z.infer<typeof DividerNode>;
668
776
  export type TextNode = z.infer<typeof TextNode>;
@@ -702,13 +810,14 @@ export type NodeExtras = {
702
810
  bind?: Record<string, Binding>;
703
811
  variant?: Variant;
704
812
  audience?: Audience;
813
+ dir?: "ltr" | "rtl" | "auto";
814
+ container?: true;
815
+ query?: { min: number; style: StyleOf };
705
816
  };
706
817
 
707
- /** Manual recursive types so UnknownNode does not poison `z.infer` of the tree. */
708
- export type UnknownNode = NodeExtras & {
818
+ /** Identity, style and extras shared by every node type (W-352). */
819
+ type NodeEnvelope = {
709
820
  id: IdOf;
710
- type: string;
711
- props: Record<string, unknown>;
712
821
  style?: StyleOf;
713
822
  states?: StatesOf;
714
823
  devices?: DevicesOf;
@@ -717,60 +826,38 @@ export type UnknownNode = NodeExtras & {
717
826
  htmlId?: HtmlIdOf;
718
827
  attributes?: HtmlAttributeOf[];
719
828
  label?: string;
829
+ } & NodeExtras;
830
+
831
+ /** Manual recursive types so UnknownNode does not poison `z.infer` of the tree. */
832
+ export type UnknownNode = NodeEnvelope & {
833
+ type: string;
834
+ props: Record<string, unknown>;
720
835
  children?: LayoutNode[];
721
836
  };
722
837
 
723
- export type ContainerNode = NodeExtras & {
724
- id: IdOf;
838
+ export type ContainerNode = NodeEnvelope & {
725
839
  type: "container";
726
840
  props: { tag?: (typeof CONTAINER_TAGS)[number]; href?: string; newTab?: boolean };
727
- style?: StyleOf;
728
- states?: StatesOf;
729
- devices?: DevicesOf;
730
- hiddenOn?: HiddenOnOf;
731
- classes?: ClassesOf;
732
- htmlId?: HtmlIdOf;
733
- attributes?: HtmlAttributeOf[];
734
- label?: string;
735
841
  children: LayoutNode[];
736
842
  };
737
843
 
738
- export type DivBlockNode = NodeExtras & {
739
- id: IdOf;
844
+ export type DivBlockNode = NodeEnvelope & {
740
845
  type: "div-block";
741
846
  props: { href?: string; newTab?: boolean };
742
- style?: StyleOf;
743
- states?: StatesOf;
744
- devices?: DevicesOf;
745
- hiddenOn?: HiddenOnOf;
746
- classes?: ClassesOf;
747
- htmlId?: HtmlIdOf;
748
- attributes?: HtmlAttributeOf[];
749
- label?: string;
750
847
  children: LayoutNode[];
751
848
  };
752
849
 
753
- export type LayoutSectionNode = NodeExtras & {
754
- id: IdOf;
850
+ export type LayoutSectionNode = NodeEnvelope & {
755
851
  type: "layout-section";
756
852
  props: {
757
853
  tag?: (typeof CONTAINER_TAGS)[number];
758
854
  contentWidth?: z.infer<typeof Length>;
759
855
  fullWidth?: boolean;
760
856
  };
761
- style?: StyleOf;
762
- states?: StatesOf;
763
- devices?: DevicesOf;
764
- hiddenOn?: HiddenOnOf;
765
- classes?: ClassesOf;
766
- htmlId?: HtmlIdOf;
767
- attributes?: HtmlAttributeOf[];
768
- label?: string;
769
857
  children: LayoutNode[];
770
858
  };
771
859
 
772
- export type GridNode = NodeExtras & {
773
- id: IdOf;
860
+ export type GridNode = NodeEnvelope & {
774
861
  type: "grid";
775
862
  props: {
776
863
  columns: number;
@@ -779,34 +866,16 @@ export type GridNode = NodeExtras & {
779
866
  href?: string;
780
867
  newTab?: boolean;
781
868
  };
782
- style?: StyleOf;
783
- states?: StatesOf;
784
- devices?: DevicesOf;
785
- hiddenOn?: HiddenOnOf;
786
- classes?: ClassesOf;
787
- htmlId?: HtmlIdOf;
788
- attributes?: HtmlAttributeOf[];
789
- label?: string;
790
869
  children: LayoutNode[];
791
870
  };
792
871
 
793
- export type FlexboxNode = NodeExtras & {
794
- id: IdOf;
872
+ export type FlexboxNode = NodeEnvelope & {
795
873
  type: "flexbox";
796
874
  props: { href?: string; newTab?: boolean };
797
- style?: StyleOf;
798
- states?: StatesOf;
799
- devices?: DevicesOf;
800
- hiddenOn?: HiddenOnOf;
801
- classes?: ClassesOf;
802
- htmlId?: HtmlIdOf;
803
- attributes?: HtmlAttributeOf[];
804
- label?: string;
805
875
  children: LayoutNode[];
806
876
  };
807
877
 
808
- export type SvgNode = NodeExtras & {
809
- id: IdOf;
878
+ export type SvgNode = NodeEnvelope & {
810
879
  type: "svg";
811
880
  props: {
812
881
  markup: string;
@@ -814,63 +883,27 @@ export type SvgNode = NodeExtras & {
814
883
  decorative?: boolean;
815
884
  size?: number;
816
885
  };
817
- style?: StyleOf;
818
- states?: StatesOf;
819
- devices?: DevicesOf;
820
- hiddenOn?: HiddenOnOf;
821
- classes?: ClassesOf;
822
- htmlId?: HtmlIdOf;
823
- attributes?: HtmlAttributeOf[];
824
- label?: string;
825
886
  };
826
887
 
827
- export type TabPanelNode = NodeExtras & {
828
- id: IdOf;
888
+ export type TabPanelNode = NodeEnvelope & {
829
889
  type: "tab-panel";
830
890
  props: { label: string };
831
- style?: StyleOf;
832
- states?: StatesOf;
833
- devices?: DevicesOf;
834
- hiddenOn?: HiddenOnOf;
835
- classes?: ClassesOf;
836
- htmlId?: HtmlIdOf;
837
- attributes?: HtmlAttributeOf[];
838
- label?: string;
839
891
  children: LayoutNode[];
840
892
  };
841
893
 
842
- export type TabsNode = NodeExtras & {
843
- id: IdOf;
894
+ export type TabsNode = NodeEnvelope & {
844
895
  type: "tabs";
845
896
  props: { href?: string; newTab?: boolean };
846
- style?: StyleOf;
847
- states?: StatesOf;
848
- devices?: DevicesOf;
849
- hiddenOn?: HiddenOnOf;
850
- classes?: ClassesOf;
851
- htmlId?: HtmlIdOf;
852
- attributes?: HtmlAttributeOf[];
853
- label?: string;
854
897
  children: LayoutNode[];
855
898
  };
856
899
 
857
- export type FormNode = NodeExtras & {
858
- id: IdOf;
900
+ export type FormNode = NodeEnvelope & {
859
901
  type: "form";
860
902
  props: { formId: string };
861
- style?: StyleOf;
862
- states?: StatesOf;
863
- devices?: DevicesOf;
864
- hiddenOn?: HiddenOnOf;
865
- classes?: ClassesOf;
866
- htmlId?: HtmlIdOf;
867
- attributes?: HtmlAttributeOf[];
868
- label?: string;
869
903
  children: LayoutNode[];
870
904
  };
871
905
 
872
- export type LoopNode = NodeExtras & {
873
- id: IdOf;
906
+ export type LoopNode = NodeEnvelope & {
874
907
  type: "loop";
875
908
  props: {
876
909
  itemPartId?: string;
@@ -881,104 +914,42 @@ export type LoopNode = NodeExtras & {
881
914
  display?: (typeof LOOP_DISPLAYS)[number];
882
915
  columns?: number;
883
916
  };
884
- style?: StyleOf;
885
- states?: StatesOf;
886
- devices?: DevicesOf;
887
- hiddenOn?: HiddenOnOf;
888
- classes?: ClassesOf;
889
- htmlId?: HtmlIdOf;
890
- attributes?: HtmlAttributeOf[];
891
- label?: string;
892
917
  children: LayoutNode[];
893
918
  };
894
919
 
895
- export type LoopEmptyNode = NodeExtras & {
896
- id: IdOf;
920
+ export type LoopEmptyNode = NodeEnvelope & {
897
921
  type: "loop-empty";
898
922
  props: Record<string, never>;
899
- style?: StyleOf;
900
- states?: StatesOf;
901
- devices?: DevicesOf;
902
- hiddenOn?: HiddenOnOf;
903
- classes?: ClassesOf;
904
- htmlId?: HtmlIdOf;
905
- attributes?: HtmlAttributeOf[];
906
- label?: string;
907
923
  children: LayoutNode[];
908
924
  };
909
925
 
910
- export type SectionNode = NodeExtras & {
911
- id: IdOf;
926
+ export type SectionNode = NodeEnvelope & {
912
927
  type: "section";
913
928
  props: { partId?: string };
914
- style?: StyleOf;
915
- states?: StatesOf;
916
- devices?: DevicesOf;
917
- hiddenOn?: HiddenOnOf;
918
- classes?: ClassesOf;
919
- htmlId?: HtmlIdOf;
920
- attributes?: HtmlAttributeOf[];
921
- label?: string;
922
929
  children: LayoutNode[];
923
930
  };
924
931
 
925
- export type AccordionNode = NodeExtras & {
926
- id: IdOf;
932
+ export type AccordionNode = NodeEnvelope & {
927
933
  type: "accordion";
928
934
  props: Record<string, never>;
929
- style?: StyleOf;
930
- states?: StatesOf;
931
- devices?: DevicesOf;
932
- hiddenOn?: HiddenOnOf;
933
- classes?: ClassesOf;
934
- htmlId?: HtmlIdOf;
935
- attributes?: HtmlAttributeOf[];
936
- label?: string;
937
935
  children: LayoutNode[];
938
936
  };
939
937
 
940
- export type MenuNode = NodeExtras & {
941
- id: IdOf;
938
+ export type MenuNode = NodeEnvelope & {
942
939
  type: "menu";
943
940
  props: { direction: "row" | "column"; label?: string };
944
- style?: StyleOf;
945
- states?: StatesOf;
946
- devices?: DevicesOf;
947
- hiddenOn?: HiddenOnOf;
948
- classes?: ClassesOf;
949
- htmlId?: HtmlIdOf;
950
- attributes?: HtmlAttributeOf[];
951
- label?: string;
952
941
  children: LayoutNode[];
953
942
  };
954
943
 
955
- export type MenuItemNode = NodeExtras & {
956
- id: IdOf;
944
+ export type MenuItemNode = NodeEnvelope & {
957
945
  type: "menu-item";
958
946
  props: { text: string; href?: string; newTab?: boolean; wide?: boolean };
959
- style?: StyleOf;
960
- states?: StatesOf;
961
- devices?: DevicesOf;
962
- hiddenOn?: HiddenOnOf;
963
- classes?: ClassesOf;
964
- htmlId?: HtmlIdOf;
965
- attributes?: HtmlAttributeOf[];
966
- label?: string;
967
947
  children: LayoutNode[];
968
948
  };
969
949
 
970
- export type AccordionItemNode = NodeExtras & {
971
- id: IdOf;
950
+ export type AccordionItemNode = NodeEnvelope & {
972
951
  type: "accordion-item";
973
952
  props: { summary: string; open?: boolean };
974
- style?: StyleOf;
975
- states?: StatesOf;
976
- devices?: DevicesOf;
977
- hiddenOn?: HiddenOnOf;
978
- classes?: ClassesOf;
979
- htmlId?: HtmlIdOf;
980
- attributes?: HtmlAttributeOf[];
981
- label?: string;
982
953
  children: LayoutNode[];
983
954
  };
984
955
 
@@ -996,6 +967,7 @@ export type LayoutNode =
996
967
  | LoopEmptyNode
997
968
  | SectionNode
998
969
  | HeadingNode
970
+ | TocNode
999
971
  | SpacerNode
1000
972
  | DividerNode
1001
973
  | TextNode