@perkyzz/emvb 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/THIRD_PARTY_NOTICES.md +3 -2
  2. package/package.json +11 -10
  3. package/src/admin/agents-api.ts +5 -1
  4. package/src/admin/content-api.ts +29 -0
  5. package/src/admin/editor/Editor.tsx +6 -1
  6. package/src/admin/editor/ScheduleDialog.tsx +167 -0
  7. package/src/admin/editor/TopBar.tsx +33 -1
  8. package/src/admin/editor/canvas/vnode-react.tsx +3 -0
  9. package/src/admin/editor/dnd/new-element.ts +106 -0
  10. package/src/admin/editor/editor-chrome.tsx +9 -0
  11. package/src/admin/editor/element-chrome.ts +50 -0
  12. package/src/admin/editor/panels/ElementPanel.tsx +5 -1
  13. package/src/admin/editor/panels/settings/DraftTextField.tsx +33 -1
  14. package/src/admin/editor/panels/settings/FieldBindControl.tsx +6 -1
  15. package/src/admin/editor/panels/settings/FieldControl.tsx +10 -1
  16. package/src/admin/editor/panels/settings/IconPicker.tsx +4 -1
  17. package/src/admin/editor/panels/settings/ItemList.tsx +69 -2
  18. package/src/admin/editor/panels/settings/advanced-rules.ts +3 -0
  19. package/src/admin/editor/store.ts +7 -1
  20. package/src/admin/editor/useEditorData.ts +4 -0
  21. package/src/admin/editor/useSave.ts +47 -3
  22. package/src/admin/export-api.ts +20 -3
  23. package/src/admin/menus-api.ts +113 -0
  24. package/src/admin/pages/ImportElementorDialog.tsx +25 -1
  25. package/src/astro/EmVBPage.astro +3 -0
  26. package/src/astro/render.ts +43 -18
  27. package/src/astro/request-data.ts +9 -0
  28. package/src/astro/resolve-theme.ts +77 -44
  29. package/src/astro/resolve.ts +9 -0
  30. package/src/astro/visitor.ts +23 -4
  31. package/src/astro/widgets/EmVBAlertsRuntime.astro +8 -0
  32. package/src/astro/widgets/EmVBCarouselRuntime.astro +8 -0
  33. package/src/astro/widgets/EmVBCountdownRuntime.astro +8 -0
  34. package/src/astro/widgets/EmVBCounterRuntime.astro +8 -0
  35. package/src/astro/widgets/EmVBHeadlineRuntime.astro +9 -0
  36. package/src/astro/widgets/EmVBLightboxRuntime.astro +8 -0
  37. package/src/astro/widgets/EmVBMapRuntime.astro +8 -0
  38. package/src/astro/widgets/EmVBShareRuntime.astro +9 -0
  39. package/src/astro/widgets/EmVBWidgetRuntimes.astro +29 -0
  40. package/src/astro/widgets/alerts.ts +37 -0
  41. package/src/astro/widgets/carousel.ts +167 -0
  42. package/src/astro/widgets/countdown.ts +80 -0
  43. package/src/astro/widgets/counter.ts +98 -0
  44. package/src/astro/widgets/headline.ts +90 -0
  45. package/src/astro/widgets/index.ts +1 -0
  46. package/src/astro/widgets/lightbox.ts +123 -0
  47. package/src/astro/widgets/map.ts +37 -0
  48. package/src/astro/widgets/share.ts +21 -0
  49. package/src/constants.ts +1 -1
  50. package/src/core/a11y/audit.ts +127 -5
  51. package/src/core/arrange.ts +109 -1
  52. package/src/core/bounded-array.ts +16 -13
  53. package/src/core/canvas-collections.ts +28 -0
  54. package/src/core/contract.ts +4 -1
  55. package/src/core/elements/counter-format.ts +15 -0
  56. package/src/core/elements/icon-svg.ts +135 -0
  57. package/src/core/elements/index.ts +63 -127
  58. package/src/core/elements/marketing.ts +1490 -0
  59. package/src/core/elements/widgets.ts +932 -0
  60. package/src/core/export/runtimes.generated.ts +8 -0
  61. package/src/core/export/site.ts +25 -3
  62. package/src/core/extensions/schema.ts +2 -1
  63. package/src/core/geo-trust.ts +18 -0
  64. package/src/core/icons/social.generated.ts +29 -0
  65. package/src/core/image-edit/schema.ts +2 -1
  66. package/src/core/import/elementor/context.ts +18 -0
  67. package/src/core/import/elementor/index.ts +50 -7
  68. package/src/core/import/elementor/widgets.ts +783 -385
  69. package/src/core/issue-cap.ts +19 -0
  70. package/src/core/limits.ts +12 -0
  71. package/src/core/loop-collections.ts +33 -0
  72. package/src/core/proposals.ts +8 -2
  73. package/src/core/render/index.ts +48 -5
  74. package/src/core/render/vnode.ts +44 -6
  75. package/src/core/sanitize/svg-upload.ts +276 -23
  76. package/src/core/sanitize/svg.ts +3 -3
  77. package/src/core/schema/descriptors.ts +4 -0
  78. package/src/core/schema/design.ts +6 -5
  79. package/src/core/schema/layout.ts +798 -15
  80. package/src/core/schema/style.ts +2 -1
  81. package/src/core/shadowing-ids.ts +41 -0
  82. package/src/core/theme/conditions.ts +2 -1
  83. package/src/core/theme/dynamic.ts +2 -0
  84. package/src/core/theme/parse-doc.ts +10 -5
  85. package/src/core/theme/triggers.ts +3 -2
  86. package/src/core/validate.ts +3 -2
  87. package/src/index.ts +23 -2
  88. package/src/mcp/ports.ts +18 -7
  89. package/src/mcp/proposals.ts +36 -11
  90. package/src/mcp/tools.ts +1 -1
  91. package/src/server/agent-settings.ts +12 -1
  92. package/src/server/hooks.ts +41 -6
  93. package/src/server/mcp-routes.ts +11 -5
  94. package/src/server/plugin.ts +29 -3
  95. package/src/server/presence.ts +5 -1
  96. package/src/server/proposals.ts +16 -4
  97. package/src/server/requests.ts +60 -11
  98. package/src/server/site-origin.ts +13 -0
  99. package/src/server/targets.ts +26 -0
@@ -1,3 +1,4 @@
1
+ import { boundedArray } from "../bounded-array.ts";
1
2
  import { z } from "zod";
2
3
  import { LIST_MARKERS } from "../css-keywords.ts";
3
4
  import { MAX_TEXT_LENGTH } from "../limits.ts";
@@ -41,7 +42,7 @@ export const CONTRACT_VERSION = "1.0";
41
42
  export const NodeId = z
42
43
  .string()
43
44
  .regex(/^[A-Za-z0-9_-]{4,24}$/, "Ids are 4-24 letters, digits, _ or -");
44
- const ClassIds = z.array(z.string().regex(/^[a-z0-9-]{1,40}$/)).max(20);
45
+ const ClassIds = boundedArray(z.string().regex(/^[a-z0-9-]{1,40}$/), 20);
45
46
  /** CSS id attribute (Advanced). Letters first; unique on the page (checked in validateLayout). */
46
47
  const HtmlId = z
47
48
  .string()
@@ -76,7 +77,7 @@ const HtmlAttribute = z.strictObject({
76
77
  value: z.string().max(200),
77
78
  });
78
79
 
79
- const HtmlAttributes = z.array(HtmlAttribute).max(20);
80
+ const HtmlAttributes = boundedArray(HtmlAttribute, 20);
80
81
 
81
82
  /** Where a bound field reads its live value (W-307). */
82
83
  export const BIND_SOURCES = ["post", "site", "param"] as const;
@@ -140,14 +141,14 @@ export const Audience = z.strictObject({
140
141
  .min(1)
141
142
  .max(50)
142
143
  .optional(),
143
- devices: z.array(z.enum(AUDIENCE_DEVICES)).min(1).max(3).optional(),
144
+ devices: boundedArray(z.enum(AUDIENCE_DEVICES), 3, 1).optional(),
144
145
  visitor: z.enum(["new", "returning"]).optional(),
145
146
  /** From hour `from` up to (not including) hour `to`, 0–24; wraps past midnight when to < from. */
146
147
  hours: z
147
148
  .strictObject({ from: z.number().int().min(0).max(23), to: z.number().int().min(0).max(24) })
148
149
  .optional(),
149
150
  /** Days of the week, 0 = Sunday. */
150
- days: z.array(z.number().int().min(0).max(6)).min(1).max(7).optional(),
151
+ days: boundedArray(z.number().int().min(0).max(6), 7, 1).optional(),
151
152
  /** IANA time zone for hours and days, e.g. America/Toronto. Unset = UTC. */
152
153
  timeZone: z
153
154
  .string()
@@ -158,7 +159,7 @@ export const Audience = z.strictObject({
158
159
  * Visitor segments the host passes (W-329), e.g. `member`, `plan:pro`: the rule matches a
159
160
  * visitor in any of them. A letter or digit, then letters, digits, `:`, `_` or `-`, up to 64.
160
161
  */
161
- segments: z.array(z.string().regex(AUDIENCE_SEGMENT, SEGMENT_HINT)).min(1).max(20).optional(),
162
+ segments: boundedArray(z.string().regex(AUDIENCE_SEGMENT, SEGMENT_HINT), 20, 1).optional(),
162
163
  hide: z.boolean().optional(),
163
164
  });
164
165
  export type Audience = z.infer<typeof Audience>;
@@ -218,7 +219,7 @@ const parentNode = <T extends string, P extends z.ZodType>(type: T, props: P) =>
218
219
  z.strictObject({
219
220
  ...nodeFields(type, props),
220
221
  get children(): z.ZodType<LayoutNode[]> {
221
- return z.array(LayoutNode);
222
+ return ChildList;
222
223
  },
223
224
  });
224
225
 
@@ -240,7 +241,7 @@ export const TextMark = z.strictObject({
240
241
  newTab: z.literal(true).optional(),
241
242
  });
242
243
  export type TextMark = z.infer<typeof TextMark>;
243
- const TextMarks = z.array(TextMark).max(MAX_TEXT_MARKS);
244
+ const TextMarks = boundedArray(TextMark, MAX_TEXT_MARKS);
244
245
 
245
246
  export const HeadingNode = leafNode(
246
247
  "heading",
@@ -313,7 +314,7 @@ export const ListNode = leafNode(
313
314
  marker: z.enum(LIST_MARKERS).optional(),
314
315
  /** W-952: the first number of a numbered list. */
315
316
  start: z.number().int().min(1).max(9999).optional(),
316
- items: z.array(z.string().max(MAX_TEXT_LENGTH)).max(200),
317
+ items: boundedArray(z.string().max(MAX_TEXT_LENGTH), 200),
317
318
  }),
318
319
  );
319
320
 
@@ -445,7 +446,7 @@ export const FlexboxNode = parentNode("flexbox", z.strictObject({ ...BoxLink }))
445
446
  */
446
447
  const GRID_TRACK =
447
448
  /^(?:1fr|2fr|3fr|auto|min-content|max-content|0|(?:\d+(?:\.\d+)?)(?:px|rem|em|%|vw|vh|ch))$/;
448
- const GridTracks = z.array(z.string().regex(GRID_TRACK)).min(1).max(12);
449
+ const GridTracks = boundedArray(z.string().regex(GRID_TRACK), 12, 1);
449
450
 
450
451
  export const GridNode = parentNode(
451
452
  "grid",
@@ -770,6 +771,31 @@ export const KNOWN_ELEMENT_TYPES = [
770
771
  "layout-section",
771
772
  "toc",
772
773
  "language-switcher",
774
+ "rating",
775
+ "alert",
776
+ "icon-box",
777
+ "image-box",
778
+ "testimonial",
779
+ "social-icons",
780
+ "social-link",
781
+ "gallery",
782
+ "gallery-image",
783
+ "carousel",
784
+ "carousel-slide",
785
+ "counter",
786
+ "progress",
787
+ "countdown",
788
+ "map",
789
+ "price-table",
790
+ "price-list",
791
+ "price-list-item",
792
+ "cta",
793
+ "flip-box",
794
+ "headline",
795
+ "share-buttons",
796
+ "share-link",
797
+ "hotspots",
798
+ "hotspot",
773
799
  ] as const;
774
800
 
775
801
  /** Headings on this page, as a list of links. No script (W-345). */
@@ -791,6 +817,577 @@ export const LanguageSwitcherNode = leafNode(
791
817
  }),
792
818
  );
793
819
 
820
+ /** W-1023: most stars a Rating shows. */
821
+ export const MAX_RATING = 10;
822
+
823
+ /**
824
+ * W-1023: a star rating, `value` out of `max` (5 when unset), in steps as fine as a tenth. Screen
825
+ * readers hear `label` with {value} and {max} filled in; unset it says "Rated 4.5 out of 5".
826
+ * A value above `max` shows as `max`, so lowering the number of stars never makes a page invalid.
827
+ */
828
+ export const RatingNode = leafNode(
829
+ "rating",
830
+ z.strictObject({
831
+ value: z.number().min(0).max(MAX_RATING),
832
+ max: z.number().int().min(1).max(MAX_RATING).optional(),
833
+ label: z.string().max(120).optional(),
834
+ /** Each star's width and height in px. Unset = 20. */
835
+ size: z.number().int().min(8).max(128).optional(),
836
+ }),
837
+ );
838
+
839
+ /** W-1025: the kinds of Alert, each with its own colours and icon. */
840
+ export const ALERT_VARIANTS = ["info", "success", "warning", "danger"] as const;
841
+
842
+ /**
843
+ * W-1025: a notice: an optional title and text in the variant's colours, with its icon unless
844
+ * `hideIcon`. `dismissible` adds a close button that the opt-in alerts runtime shows and wires;
845
+ * without that script the notice simply stays.
846
+ */
847
+ export const AlertNode = leafNode(
848
+ "alert",
849
+ z.strictObject({
850
+ variant: z.enum(ALERT_VARIANTS),
851
+ title: z.string().max(200).optional(),
852
+ text: z.string().max(MAX_TEXT_LENGTH),
853
+ hideIcon: z.boolean().optional(),
854
+ dismissible: z.boolean().optional(),
855
+ /** The close button's name for screen readers. Unset = "Dismiss". */
856
+ dismissLabel: z.string().max(80).optional(),
857
+ }),
858
+ );
859
+
860
+ /** W-1038: the thousands separators a Counter can use. */
861
+ export const COUNTER_SEPARATORS = [",", ".", " ", "'"] as const;
862
+
863
+ /** W-1038: the largest number a Counter shows, either way (beyond it, rounding shows). */
864
+ export const MAX_COUNTER = 1e12;
865
+
866
+ /**
867
+ * W-1038: a number to show off, such as "1,200+ clients": `value` with optional `prefix`,
868
+ * `suffix` and `title`, as text. `countUp` asks for the opt-in counter runtime, which counts from
869
+ * `start` (unset 0) to `value` over `duration` ms when the number scrolls into view; under
870
+ * reduced motion, and without the script, the final number shows at once.
871
+ */
872
+ export const CounterNode = leafNode(
873
+ "counter",
874
+ z.strictObject({
875
+ value: z.number().min(-MAX_COUNTER).max(MAX_COUNTER),
876
+ start: z.number().min(-MAX_COUNTER).max(MAX_COUNTER).optional(),
877
+ /** Digits after the decimal point. Unset = 0. */
878
+ decimals: z.number().int().min(0).max(3).optional(),
879
+ /** Thousands separator. Unset = none. */
880
+ separator: z.enum(COUNTER_SEPARATORS).optional(),
881
+ prefix: z.string().max(20).optional(),
882
+ suffix: z.string().max(20).optional(),
883
+ title: z.string().max(200).optional(),
884
+ countUp: z.boolean().optional(),
885
+ /** How long the count-up takes, in ms; at most 5 s, so it never needs a pause (WCAG 2.2.2). Unset = 2000. */
886
+ duration: z.number().int().min(300).max(5000).optional(),
887
+ }),
888
+ );
889
+
890
+ /** W-1039: what a Progress bar means: a measurement (a skill level) or how far a task has got. */
891
+ export const PROGRESS_KINDS = ["meter", "progressbar"] as const;
892
+
893
+ /** W-1039: the largest `max` a Progress bar takes. */
894
+ export const MAX_PROGRESS = 1e6;
895
+
896
+ /**
897
+ * W-1039: a labelled bar filled to `value` out of `max` (unset 100). Screen readers get it as a
898
+ * meter or a progress bar (`kind`, unset meter) with the value as text. `grow` lets the fill grow
899
+ * in as it scrolls into view, with CSS only and not under reduced motion. A value above `max`
900
+ * shows as full, so lowering `max` never makes a page invalid.
901
+ */
902
+ export const ProgressNode = leafNode(
903
+ "progress",
904
+ z.strictObject({
905
+ value: z.number().min(0).max(MAX_PROGRESS),
906
+ max: z.number().positive().max(MAX_PROGRESS).optional(),
907
+ label: z.string().max(120).optional(),
908
+ showValue: z.boolean().optional(),
909
+ kind: z.enum(PROGRESS_KINDS).optional(),
910
+ /** The bar's height in px. Unset = 8. */
911
+ thickness: z.number().int().min(2).max(48).optional(),
912
+ grow: z.boolean().optional(),
913
+ }),
914
+ );
915
+
916
+ /** W-1040: a date and time with its UTC offset, such as 2026-12-01T09:00-05:00 or …T14:00Z. */
917
+ export const COUNTDOWN_TARGET =
918
+ /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?(Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
919
+
920
+ /** W-1040: what a ticking Countdown does when its time is up. */
921
+ export const COUNTDOWN_EXPIRED = ["text", "hide", "link"] as const;
922
+
923
+ /**
924
+ * W-1040: a deadline. Without script it is a sentence with the target as `<time>` ("Ends 1 Dec
925
+ * 2026, 09:00 UTC−5"). `ticking` asks for the opt-in countdown runtime: days, hours, minutes and
926
+ * seconds that screen readers skip (the sentence stays for them), a Pause button, and at the end
927
+ * `expired`: show `expiredText`, hide the Countdown, or show `expiredText` as a link to
928
+ * `expiredHref`.
929
+ */
930
+ export const CountdownNode = leafNode(
931
+ "countdown",
932
+ z.strictObject({
933
+ target: z
934
+ .string()
935
+ .regex(COUNTDOWN_TARGET, "Use a date, time and UTC offset such as 2026-12-01T09:00-05:00")
936
+ .refine((value) => !Number.isNaN(Date.parse(value)), "This date doesn't exist"),
937
+ title: z.string().max(200).optional(),
938
+ /** The words before the date. Unset = "Ends". */
939
+ label: z.string().max(40).optional(),
940
+ ticking: z.boolean().optional(),
941
+ hideSeconds: z.boolean().optional(),
942
+ expired: z.enum(COUNTDOWN_EXPIRED).optional(),
943
+ /** Unset = "This offer has ended." */
944
+ expiredText: z.string().max(200).optional(),
945
+ expiredHref: z.string().max(2000).optional(),
946
+ }),
947
+ );
948
+
949
+ /** W-1041: the map services a Map links to and embeds. */
950
+ export const MAP_PROVIDERS = ["osm", "google"] as const;
951
+
952
+ /**
953
+ * W-1041: a place. Without script it is the address and a link to it on OpenStreetMap or Google
954
+ * Maps (`provider`, unset osm), at `lat`/`lng` when set. `embed` asks for the opt-in map runtime:
955
+ * a "Show the map" button that loads the map in an iframe only when pressed, so the page makes
956
+ * no request to the map service until the visitor asks. OpenStreetMap embeds need `lat`/`lng`.
957
+ */
958
+ export const MapNode = leafNode(
959
+ "map",
960
+ z.strictObject({
961
+ address: z.string().min(1).max(300),
962
+ provider: z.enum(MAP_PROVIDERS).optional(),
963
+ lat: z.number().min(-90).max(90).optional(),
964
+ lng: z.number().min(-180).max(180).optional(),
965
+ /** Unset = 15. */
966
+ zoom: z.number().int().min(1).max(19).optional(),
967
+ /** The link's words. Unset = "Open in OpenStreetMap" or "Open in Google Maps". */
968
+ linkText: z.string().max(80).optional(),
969
+ embed: z.boolean().optional(),
970
+ /** The embedded map's height in px. Unset = 360. */
971
+ height: z.number().int().min(150).max(800).optional(),
972
+ }),
973
+ );
974
+
975
+ /**
976
+ * W-1042: a plan card: title, price (with `currency` and `period`; `regularPrice` shows struck
977
+ * through before it as on sale), what is in the plan (`features`) and what isn't (`excluded`),
978
+ * a button link, and an optional ribbon when `featured`. No script.
979
+ */
980
+ export const PriceTableNode = leafNode(
981
+ "price-table",
982
+ z.strictObject({
983
+ title: z.string().max(120),
984
+ /** The title's heading level. Unset = 3. */
985
+ titleLevel: z.number().int().min(2).max(6).optional(),
986
+ description: z.string().max(500).optional(),
987
+ price: z.string().max(20),
988
+ currency: z.string().max(5).optional(),
989
+ period: z.string().max(40).optional(),
990
+ regularPrice: z.string().max(20).optional(),
991
+ features: boundedArray(z.string().max(200), 30).optional(),
992
+ excluded: boundedArray(z.string().max(200), 30).optional(),
993
+ buttonText: z.string().max(80).optional(),
994
+ buttonHref: z.string().max(2000).optional(),
995
+ newTab: z.boolean().optional(),
996
+ featured: z.boolean().optional(),
997
+ /** The ribbon's words when `featured`. Unset = "Featured". */
998
+ ribbon: z.string().max(30).optional(),
999
+ }),
1000
+ );
1001
+
1002
+ /** W-1020: where a media box puts its icon or image: above, or before or after the words. */
1003
+ export const MEDIA_BOX_POSITIONS = ["top", "left", "right"] as const;
1004
+
1005
+ /** W-1020 / W-1021: what an icon box and an image box share: title, text, link, layout. */
1006
+ const MediaBoxText = {
1007
+ title: z.string().max(200),
1008
+ /** The title's heading level. Unset = 3. */
1009
+ titleLevel: z.number().int().min(2).max(6).optional(),
1010
+ text: z.string().max(MAX_TEXT_LENGTH),
1011
+ position: z.enum(MEDIA_BOX_POSITIONS).optional(),
1012
+ /** Optional link: the title is the link, and the whole box is clickable. */
1013
+ href: z.string().max(2000).optional(),
1014
+ newTab: z.boolean().optional(),
1015
+ };
1016
+
1017
+ /**
1018
+ * W-1020: an icon above (or beside) a title and text, like Elementor's Icon Box. The icon is
1019
+ * decorative: the title says what the box is. `iconId` and `iconSvg` work as on an Icon.
1020
+ */
1021
+ export const IconBoxNode = leafNode(
1022
+ "icon-box",
1023
+ z.strictObject({
1024
+ iconId: z.string().min(1).max(64),
1025
+ iconSvg: z.string().max(ICON_SVG_MAX).optional(),
1026
+ /** The icon's width and height in px. Unset = 48. */
1027
+ iconSize: z.number().int().min(8).max(512).optional(),
1028
+ ...MediaBoxText,
1029
+ }),
1030
+ );
1031
+
1032
+ /** W-1021: how much of the box's width an image box's picture takes when beside the words. */
1033
+ export const IMAGE_BOX_SIZES = ["small", "medium", "large", "full"] as const;
1034
+
1035
+ /** A picture picked from the media library: its id, intrinsic size and focal point (as Image). */
1036
+ const PICKED_MEDIA = {
1037
+ mediaId: z.string().min(1).max(128).optional(),
1038
+ width: z.number().int().positive().max(10000).optional(),
1039
+ height: z.number().int().positive().max(10000).optional(),
1040
+ focalX: z.number().int().min(0).max(100).optional(),
1041
+ focalY: z.number().int().min(0).max(100).optional(),
1042
+ };
1043
+
1044
+ /**
1045
+ * W-1021: a picture above (or beside) a title and text, like Elementor's Image Box. The picture
1046
+ * keys are an Image's, so the media library fills them the same way; alt text is required unless
1047
+ * the picture is decorative.
1048
+ */
1049
+ export const ImageBoxNode = leafNode(
1050
+ "image-box",
1051
+ z.strictObject({
1052
+ src: z.string().max(2000),
1053
+ alt: z.string().max(500),
1054
+ decorative: z.boolean().optional(),
1055
+ ...PICKED_MEDIA,
1056
+ /** Beside the words: small 25 %, medium 40 %, large 60 % of the box. Unset = medium. */
1057
+ imageSize: z.enum(IMAGE_BOX_SIZES).optional(),
1058
+ ...MediaBoxText,
1059
+ }),
1060
+ ).refine((node) => node.props.decorative === true || node.props.alt.length > 0, {
1061
+ message: "Alt text is required unless the image is marked decorative.",
1062
+ path: ["props", "alt"],
1063
+ });
1064
+
1065
+ /**
1066
+ * W-1022: a quote in a figure: the words as a blockquote, then who said them (name and role) with
1067
+ * an optional photo, and an optional star rating read as "Rated 5 out of 5". The photo is shown
1068
+ * beside the name, so it is decorative; its keys are an Image's so the media library fills them.
1069
+ */
1070
+ export const TestimonialNode = leafNode(
1071
+ "testimonial",
1072
+ z.strictObject({
1073
+ quote: z.string().max(MAX_TEXT_LENGTH),
1074
+ name: z.string().max(200),
1075
+ role: z.string().max(200).optional(),
1076
+ src: z.string().max(2000).optional(),
1077
+ /** Written by the media library; never rendered (the photo is beside the name). */
1078
+ alt: z.string().max(500).optional(),
1079
+ ...PICKED_MEDIA,
1080
+ /** Stars out of `ratingMax` (unset 5); no stars when unset. */
1081
+ rating: z.number().min(0).max(MAX_RATING).optional(),
1082
+ ratingMax: z.number().int().min(1).max(MAX_RATING).optional(),
1083
+ }),
1084
+ );
1085
+
1086
+ /** W-1024: the Social icons presets (Font Awesome Free brand icons, plus email, RSS, website). */
1087
+ export const SOCIAL_NETWORKS = [
1088
+ "facebook",
1089
+ "instagram",
1090
+ "x",
1091
+ "linkedin",
1092
+ "youtube",
1093
+ "tiktok",
1094
+ "bluesky",
1095
+ "mastodon",
1096
+ "threads",
1097
+ "github",
1098
+ "pinterest",
1099
+ "whatsapp",
1100
+ "discord",
1101
+ "twitch",
1102
+ "reddit",
1103
+ "dribbble",
1104
+ "behance",
1105
+ "telegram",
1106
+ "spotify",
1107
+ "email",
1108
+ "rss",
1109
+ "website",
1110
+ ] as const;
1111
+ /** W-1024: how each icon is drawn: on its own, or in a circle, rounded or square badge. */
1112
+ export const SOCIAL_SHAPES = ["plain", "circle", "rounded", "square"] as const;
1113
+
1114
+ /**
1115
+ * W-1024: a list of links to the site's social profiles, each a brand icon named for screen
1116
+ * readers ("Instagram"). Holds Social links only. `label` names the list (unset "Social media");
1117
+ * `brandColors` paints each icon in its network's colour; icons follow the font size.
1118
+ */
1119
+ export const SocialIconsNodeSchema = parentNode(
1120
+ "social-icons",
1121
+ z.strictObject({
1122
+ label: z.string().max(80).optional(),
1123
+ shape: z.enum(SOCIAL_SHAPES).optional(),
1124
+ brandColors: z.boolean().optional(),
1125
+ }),
1126
+ );
1127
+
1128
+ /** W-1024: one profile link in Social icons. `label` replaces the network's name. */
1129
+ export const SocialLinkNode = leafNode(
1130
+ "social-link",
1131
+ z.strictObject({
1132
+ network: z.enum(SOCIAL_NETWORKS),
1133
+ href: z.string().max(2000),
1134
+ label: z.string().max(80).optional(),
1135
+ newTab: z.boolean().optional(),
1136
+ }),
1137
+ );
1138
+
1139
+ /** W-1019: a Gallery's layout: equal squares in a grid, or each picture its own height. */
1140
+ export const GALLERY_LAYOUTS = ["grid", "masonry"] as const;
1141
+
1142
+ /**
1143
+ * W-1019: pictures from the media library in a grid or masonry columns (1–6 on wide screens; at
1144
+ * most 2 on tablets and 1 on phones). Holds Gallery images only. `lightbox` opts in to a script
1145
+ * that opens each picture large in a native dialog; without it the gallery uses no script.
1146
+ */
1147
+ export const GalleryNodeSchema = parentNode(
1148
+ "gallery",
1149
+ z.strictObject({
1150
+ layout: z.enum(GALLERY_LAYOUTS).optional(),
1151
+ columns: z.number().int().min(1).max(6).optional(),
1152
+ lightbox: z.boolean().optional(),
1153
+ /** Names the list for screen readers. Unset = no name. */
1154
+ label: z.string().max(80).optional(),
1155
+ }),
1156
+ );
1157
+
1158
+ /** W-1019: one picture in a Gallery: an Image's picture keys, alt text and an optional caption. */
1159
+ export const GalleryImageNode = leafNode(
1160
+ "gallery-image",
1161
+ z.strictObject({
1162
+ src: z.string().max(2000),
1163
+ alt: z.string().max(500),
1164
+ decorative: z.boolean().optional(),
1165
+ ...PICKED_MEDIA,
1166
+ caption: z.string().max(500).optional(),
1167
+ }),
1168
+ ).refine((node) => node.props.decorative === true || node.props.alt.length > 0, {
1169
+ message: "Alt text is required unless the picture is marked decorative.",
1170
+ path: ["props", "alt"],
1171
+ });
1172
+
1173
+ /**
1174
+ * W-1018: slides on a horizontal track that snaps to each one, swiped, scrolled or moved with
1175
+ * the arrow keys, with no script. `arrows`, `dots` and `autoplay` opt in to the carousel
1176
+ * script, which adds those controls. Autoplay is off unless set; when on, a visible Pause button
1177
+ * comes first, hovering or focusing the carousel pauses it, and under reduced motion it starts
1178
+ * paused (WCAG 2.2.2). `perView` slides show at once (at most 2 on tablets, 1 on phones).
1179
+ */
1180
+ export const CarouselNodeSchema = parentNode(
1181
+ "carousel",
1182
+ z.strictObject({
1183
+ /** Names the carousel for screen readers. Unset = "Carousel". */
1184
+ label: z.string().max(80).optional(),
1185
+ perView: z.number().int().min(1).max(4).optional(),
1186
+ arrows: z.boolean().optional(),
1187
+ dots: z.boolean().optional(),
1188
+ autoplay: z.boolean().optional(),
1189
+ /** Seconds per slide while playing. Unset = 6. */
1190
+ interval: z.number().int().min(3).max(30).optional(),
1191
+ /** After the last slide, Next and autoplay go back to the first. */
1192
+ loop: z.boolean().optional(),
1193
+ }),
1194
+ );
1195
+
1196
+ /** W-1018: one slide; holds any elements. `label` names it instead of "2 of 5". */
1197
+ export const CarouselSlideNode = parentNode(
1198
+ "carousel-slide",
1199
+ z.strictObject({
1200
+ label: z.string().max(80).optional(),
1201
+ }),
1202
+ );
1203
+
1204
+ /**
1205
+ * W-1043: a menu-style list of items with prices, such as a restaurant menu or a list of
1206
+ * services. Holds Price list items only. `label` names the list for screen readers.
1207
+ */
1208
+ export const PriceListNodeSchema = parentNode(
1209
+ "price-list",
1210
+ z.strictObject({
1211
+ label: z.string().max(80).optional(),
1212
+ }),
1213
+ );
1214
+
1215
+ /**
1216
+ * W-1043: one row of a Price list: the title, a dotted leader and the price on one line, an
1217
+ * optional description under them, an optional picture before them (its alt text unset: the
1218
+ * picture is decorative) and an optional link on the title.
1219
+ */
1220
+ export const PriceListItemNode = leafNode(
1221
+ "price-list-item",
1222
+ z.strictObject({
1223
+ title: z.string().max(120),
1224
+ price: z.string().max(20),
1225
+ description: z.string().max(500).optional(),
1226
+ src: z.string().max(2000).optional(),
1227
+ alt: z.string().max(500).optional(),
1228
+ ...PICKED_MEDIA,
1229
+ href: z.string().max(2000).optional(),
1230
+ newTab: z.boolean().optional(),
1231
+ }),
1232
+ );
1233
+
1234
+ /** W-1044: where a Call to action puts its picture: behind the words, or above or beside them. */
1235
+ export const CTA_LAYOUTS = ["behind", "top", "left", "right"] as const;
1236
+
1237
+ /**
1238
+ * W-1044: a box with a picture, title, text and a button. With `href` the title is the link and
1239
+ * the whole box opens it (the button repeats it for the eye only). `layout` (unset `behind`)
1240
+ * puts the picture behind the words under a dark overlay, or above or beside them. `ribbon`
1241
+ * adds a small label in a corner.
1242
+ */
1243
+ export const CtaNode = leafNode(
1244
+ "cta",
1245
+ z.strictObject({
1246
+ title: z.string().max(200),
1247
+ /** The title's heading level. Unset = 3. */
1248
+ titleLevel: z.number().int().min(2).max(6).optional(),
1249
+ text: z.string().max(MAX_TEXT_LENGTH).optional(),
1250
+ src: z.string().max(2000).optional(),
1251
+ alt: z.string().max(500).optional(),
1252
+ ...PICKED_MEDIA,
1253
+ layout: z.enum(CTA_LAYOUTS).optional(),
1254
+ buttonText: z.string().max(80).optional(),
1255
+ href: z.string().max(2000).optional(),
1256
+ newTab: z.boolean().optional(),
1257
+ ribbon: z.string().max(30).optional(),
1258
+ }),
1259
+ );
1260
+
1261
+ /** W-1045: which way a Flip box turns over. */
1262
+ export const FLIP_DIRECTIONS = ["left", "right", "up", "down"] as const;
1263
+
1264
+ /**
1265
+ * W-1045: a card with a front and a back. It turns over on hover (where the device can hover)
1266
+ * and when keyboard focus reaches the back; a native checkbox ("Turn over") turns it on touch
1267
+ * screens and for keyboards, with no script. Both faces stay in the page for screen readers.
1268
+ * Under reduced motion it swaps faces without the turn.
1269
+ */
1270
+ export const FlipBoxNode = leafNode(
1271
+ "flip-box",
1272
+ z.strictObject({
1273
+ frontTitle: z.string().max(200),
1274
+ frontText: z.string().max(MAX_TEXT_LENGTH).optional(),
1275
+ backTitle: z.string().max(200).optional(),
1276
+ backText: z.string().max(MAX_TEXT_LENGTH).optional(),
1277
+ /** Both titles' heading level. Unset = 3. */
1278
+ titleLevel: z.number().int().min(2).max(6).optional(),
1279
+ buttonText: z.string().max(80).optional(),
1280
+ href: z.string().max(2000).optional(),
1281
+ newTab: z.boolean().optional(),
1282
+ direction: z.enum(FLIP_DIRECTIONS).optional(),
1283
+ /** The checkbox's words. Unset = "Turn over". */
1284
+ toggleLabel: z.string().max(40).optional(),
1285
+ }),
1286
+ );
1287
+
1288
+ /** W-1046: how an Animated headline marks its highlighted words. */
1289
+ export const HEADLINE_MARKS = ["underline", "circle", "strike", "none"] as const;
1290
+
1291
+ /**
1292
+ * W-1046: a heading (`level`, unset 2) of `before`, the highlighted `highlight` and `after`,
1293
+ * read as one sentence. `mark` (unset underline) is drawn once in CSS, already drawn under
1294
+ * reduced motion. `rotate` lists other words for the highlight: `rotating` asks for the opt-in
1295
+ * headline runtime, which cycles them every `interval` seconds for `turns` rounds and stops on
1296
+ * the first word, with a Pause button; screen readers keep the sentence with the first word.
1297
+ */
1298
+ export const HeadlineNode = leafNode(
1299
+ "headline",
1300
+ z.strictObject({
1301
+ level: z.number().int().min(1).max(6).optional(),
1302
+ before: z.string().max(200).optional(),
1303
+ highlight: z.string().min(1).max(120),
1304
+ after: z.string().max(200).optional(),
1305
+ mark: z.enum(HEADLINE_MARKS).optional(),
1306
+ rotate: boundedArray(z.string().max(120), 10).optional(),
1307
+ rotating: z.boolean().optional(),
1308
+ /** Seconds per word. Unset = 2.5. */
1309
+ interval: z.number().min(1.5).max(10).optional(),
1310
+ /** Rounds through the words before it stops. Unset = 2. */
1311
+ turns: z.number().int().min(1).max(5).optional(),
1312
+ }),
1313
+ );
1314
+
1315
+ /** W-1047: the services a Share link can share to; each has a Social icons preset icon. */
1316
+ export const SHARE_NETWORKS = [
1317
+ "facebook",
1318
+ "x",
1319
+ "linkedin",
1320
+ "whatsapp",
1321
+ "telegram",
1322
+ "reddit",
1323
+ "bluesky",
1324
+ "threads",
1325
+ "email",
1326
+ ] as const;
1327
+
1328
+ /**
1329
+ * W-1047: links that share the current page, with no tracking script: each a service's own
1330
+ * share address with the page's URL in it. Holds Share links only. The host gives the page URL
1331
+ * (`resolveEmVBPage` does); without it the public page shows no links. `nativeShare` opts in to
1332
+ * the share runtime, which adds a Share button for the browser's own share sheet where it has
1333
+ * one. `label` names the list (unset "Share this page").
1334
+ */
1335
+ export const ShareButtonsNodeSchema = parentNode(
1336
+ "share-buttons",
1337
+ z.strictObject({
1338
+ label: z.string().max(80).optional(),
1339
+ shape: z.enum(SOCIAL_SHAPES).optional(),
1340
+ brandColors: z.boolean().optional(),
1341
+ nativeShare: z.boolean().optional(),
1342
+ }),
1343
+ );
1344
+
1345
+ /** W-1047: one share link. `label` replaces "Share on Facebook". */
1346
+ export const ShareLinkNode = leafNode(
1347
+ "share-link",
1348
+ z.strictObject({
1349
+ network: z.enum(SHARE_NETWORKS),
1350
+ label: z.string().max(80).optional(),
1351
+ }),
1352
+ );
1353
+
1354
+ /**
1355
+ * W-1048: a picture with numbered markers. Holds Hotspots only. The picture keys are an Image's;
1356
+ * `label` names the list of markers for screen readers (unset "Points on the picture").
1357
+ */
1358
+ export const HotspotsNodeSchema = parentNode(
1359
+ "hotspots",
1360
+ z.strictObject({
1361
+ src: z.string().max(2000),
1362
+ alt: z.string().max(500),
1363
+ decorative: z.boolean().optional(),
1364
+ ...PICKED_MEDIA,
1365
+ label: z.string().max(80).optional(),
1366
+ }),
1367
+ );
1368
+
1369
+ /** A marker's place across or down the picture, in percent. */
1370
+ const HotspotPlace = z.number().min(0).max(100);
1371
+
1372
+ /**
1373
+ * W-1048: one marker: a numbered button at `x`/`y` percent of the picture (tablet and mobile
1374
+ * values follow the wider device when unset) that opens its note, `title` and `text`, with the
1375
+ * native Popover API: no script, Escape and a click outside close it.
1376
+ */
1377
+ export const HotspotNode = leafNode(
1378
+ "hotspot",
1379
+ z.strictObject({
1380
+ title: z.string().min(1).max(120),
1381
+ text: z.string().max(1000).optional(),
1382
+ x: HotspotPlace,
1383
+ y: HotspotPlace,
1384
+ xTablet: HotspotPlace.optional(),
1385
+ yTablet: HotspotPlace.optional(),
1386
+ xMobile: HotspotPlace.optional(),
1387
+ yMobile: HotspotPlace.optional(),
1388
+ }),
1389
+ );
1390
+
794
1391
  const knownTypeSet = new Set<string>(KNOWN_ELEMENT_TYPES);
795
1392
 
796
1393
  /**
@@ -808,7 +1405,7 @@ const UnknownNodeSchema = z.strictObject({
808
1405
  props: z.record(z.string(), z.unknown()),
809
1406
  ...sharedNodeFields,
810
1407
  get children(): z.ZodType<LayoutNode[] | undefined> {
811
- return z.array(LayoutNode).optional();
1408
+ return ChildList.optional();
812
1409
  },
813
1410
  });
814
1411
 
@@ -824,6 +1421,31 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
824
1421
  HeadingNode,
825
1422
  TocNode,
826
1423
  LanguageSwitcherNode,
1424
+ RatingNode,
1425
+ AlertNode,
1426
+ IconBoxNode,
1427
+ ImageBoxNode,
1428
+ TestimonialNode,
1429
+ SocialIconsNodeSchema,
1430
+ SocialLinkNode,
1431
+ GalleryNodeSchema,
1432
+ GalleryImageNode,
1433
+ CarouselNodeSchema,
1434
+ CarouselSlideNode,
1435
+ PriceListNodeSchema,
1436
+ PriceListItemNode,
1437
+ CtaNode,
1438
+ FlipBoxNode,
1439
+ HeadlineNode,
1440
+ ShareButtonsNodeSchema,
1441
+ ShareLinkNode,
1442
+ HotspotsNodeSchema,
1443
+ HotspotNode,
1444
+ CounterNode,
1445
+ ProgressNode,
1446
+ CountdownNode,
1447
+ MapNode,
1448
+ PriceTableNode,
827
1449
  SpacerNode,
828
1450
  DividerNode,
829
1451
  TextNode,
@@ -864,6 +1486,24 @@ export const KNOWN_NODE_SCHEMAS = KnownLayoutNode.options;
864
1486
  export type HeadingNode = z.infer<typeof HeadingNode>;
865
1487
  export type TocNode = z.infer<typeof TocNode>;
866
1488
  export type LanguageSwitcherNode = z.infer<typeof LanguageSwitcherNode>;
1489
+ export type RatingNode = z.infer<typeof RatingNode>;
1490
+ export type AlertNode = z.infer<typeof AlertNode>;
1491
+ export type CounterNode = z.infer<typeof CounterNode>;
1492
+ export type ProgressNode = z.infer<typeof ProgressNode>;
1493
+ export type CountdownNode = z.infer<typeof CountdownNode>;
1494
+ export type MapNode = z.infer<typeof MapNode>;
1495
+ export type PriceTableNode = z.infer<typeof PriceTableNode>;
1496
+ export type PriceListItemNode = z.infer<typeof PriceListItemNode>;
1497
+ export type CtaNode = z.infer<typeof CtaNode>;
1498
+ export type FlipBoxNode = z.infer<typeof FlipBoxNode>;
1499
+ export type HeadlineNode = z.infer<typeof HeadlineNode>;
1500
+ export type ShareLinkNode = z.infer<typeof ShareLinkNode>;
1501
+ export type HotspotNode = z.infer<typeof HotspotNode>;
1502
+ export type IconBoxNode = z.infer<typeof IconBoxNode>;
1503
+ export type ImageBoxNode = z.infer<typeof ImageBoxNode>;
1504
+ export type TestimonialNode = z.infer<typeof TestimonialNode>;
1505
+ export type SocialLinkNode = z.infer<typeof SocialLinkNode>;
1506
+ export type GalleryImageNode = z.infer<typeof GalleryImageNode>;
867
1507
  export type SpacerNode = z.infer<typeof SpacerNode>;
868
1508
  export type DividerNode = z.infer<typeof DividerNode>;
869
1509
  export type TextNode = z.infer<typeof TextNode>;
@@ -1029,6 +1669,48 @@ export type AccordionNode = NodeEnvelope & {
1029
1669
  children: LayoutNode[];
1030
1670
  };
1031
1671
 
1672
+ export type SocialIconsNode = NodeEnvelope & {
1673
+ type: "social-icons";
1674
+ props: z.infer<typeof SocialIconsNodeSchema>["props"];
1675
+ children: LayoutNode[];
1676
+ };
1677
+
1678
+ export type CarouselNode = NodeEnvelope & {
1679
+ type: "carousel";
1680
+ props: z.infer<typeof CarouselNodeSchema>["props"];
1681
+ children: LayoutNode[];
1682
+ };
1683
+
1684
+ export type CarouselSlideNode = NodeEnvelope & {
1685
+ type: "carousel-slide";
1686
+ props: { label?: string };
1687
+ children: LayoutNode[];
1688
+ };
1689
+
1690
+ export type ShareButtonsNode = NodeEnvelope & {
1691
+ type: "share-buttons";
1692
+ props: z.infer<typeof ShareButtonsNodeSchema>["props"];
1693
+ children: LayoutNode[];
1694
+ };
1695
+
1696
+ export type HotspotsNode = NodeEnvelope & {
1697
+ type: "hotspots";
1698
+ props: z.infer<typeof HotspotsNodeSchema>["props"];
1699
+ children: LayoutNode[];
1700
+ };
1701
+
1702
+ export type PriceListNode = NodeEnvelope & {
1703
+ type: "price-list";
1704
+ props: z.infer<typeof PriceListNodeSchema>["props"];
1705
+ children: LayoutNode[];
1706
+ };
1707
+
1708
+ export type GalleryNode = NodeEnvelope & {
1709
+ type: "gallery";
1710
+ props: z.infer<typeof GalleryNodeSchema>["props"];
1711
+ children: LayoutNode[];
1712
+ };
1713
+
1032
1714
  export type MenuNode = NodeEnvelope & {
1033
1715
  type: "menu";
1034
1716
  props: { direction: "row" | "column"; label?: string };
@@ -1063,6 +1745,31 @@ export type LayoutNode =
1063
1745
  | HeadingNode
1064
1746
  | TocNode
1065
1747
  | LanguageSwitcherNode
1748
+ | RatingNode
1749
+ | AlertNode
1750
+ | IconBoxNode
1751
+ | ImageBoxNode
1752
+ | TestimonialNode
1753
+ | SocialIconsNode
1754
+ | SocialLinkNode
1755
+ | GalleryNode
1756
+ | GalleryImageNode
1757
+ | CarouselNode
1758
+ | CarouselSlideNode
1759
+ | CounterNode
1760
+ | ProgressNode
1761
+ | CountdownNode
1762
+ | MapNode
1763
+ | PriceTableNode
1764
+ | PriceListNode
1765
+ | PriceListItemNode
1766
+ | CtaNode
1767
+ | FlipBoxNode
1768
+ | HeadlineNode
1769
+ | ShareButtonsNode
1770
+ | ShareLinkNode
1771
+ | HotspotsNode
1772
+ | HotspotNode
1066
1773
  | SpacerNode
1067
1774
  | DividerNode
1068
1775
  | TextNode
@@ -1093,6 +1800,9 @@ export type LayoutNode =
1093
1800
  | MenuItemNode
1094
1801
  | UnknownNode;
1095
1802
 
1803
+ /** S-03: the issues one element reports before "…and N more". */
1804
+ const MAX_NODE_ISSUES = 10;
1805
+
1096
1806
  /**
1097
1807
  * Prefer the known-type schema when `type` is registered so path-specific Zod issues stay
1098
1808
  * intact; only fall through to UnknownNode for types EmVB does not implement (W-022 / R-033).
@@ -1114,7 +1824,8 @@ const LayoutNode: z.ZodType<LayoutNode> = z.lazy(() =>
1114
1824
  ? KnownLayoutNode.safeParse(input)
1115
1825
  : UnknownNodeSchema.safeParse(input);
1116
1826
  if (!result.success) {
1117
- for (const issue of result.error.issues) {
1827
+ const issues = result.error.issues;
1828
+ for (const issue of issues.slice(0, MAX_NODE_ISSUES)) {
1118
1829
  ctx.addIssue({
1119
1830
  code: "custom",
1120
1831
  path: issue.path,
@@ -1122,12 +1833,68 @@ const LayoutNode: z.ZodType<LayoutNode> = z.lazy(() =>
1122
1833
  params: { zodCode: issue.code },
1123
1834
  });
1124
1835
  }
1836
+ // S-03: a node re-emits a few issues, not one per bad item, so a parent's count stays small.
1837
+ if (issues.length > MAX_NODE_ISSUES) {
1838
+ ctx.addIssue({
1839
+ code: "custom",
1840
+ path: [],
1841
+ message: `…and ${issues.length - MAX_NODE_ISSUES} more problems in this element.`,
1842
+ params: { zodCode: "too_many_issues" },
1843
+ });
1844
+ }
1125
1845
  return z.NEVER;
1126
1846
  }
1127
1847
  return result.data as LayoutNode;
1128
1848
  }),
1129
1849
  );
1130
1850
 
1851
+ /** S-03: the issues a list of children reports before the rest of them is skipped. */
1852
+ const MAX_CHILD_ISSUES = 40;
1853
+
1854
+ /**
1855
+ * Children parse one at a time and stop once they have reported MAX_CHILD_ISSUES issues: a
1856
+ * page of a thousand bad elements cost one issue list per element (180 MB on a 512 KB page).
1857
+ */
1858
+ const ChildList: z.ZodType<LayoutNode[]> = z.lazy(() =>
1859
+ z.array(z.unknown()).transform((items, ctx) => {
1860
+ const nodes: LayoutNode[] = [];
1861
+ let reported = 0;
1862
+ for (const [index, item] of items.entries()) {
1863
+ if (reported >= MAX_CHILD_ISSUES) {
1864
+ ctx.addIssue({
1865
+ code: "custom",
1866
+ path: [index],
1867
+ message: "…and more problems in the elements after this one.",
1868
+ params: { zodCode: "too_many_issues" },
1869
+ });
1870
+ return z.NEVER;
1871
+ }
1872
+ const result = LayoutNode.safeParse(item);
1873
+ if (result.success) {
1874
+ nodes.push(result.data);
1875
+ continue;
1876
+ }
1877
+ for (const issue of result.error.issues) {
1878
+ const params =
1879
+ "params" in issue ? (issue.params as { zodCode?: unknown } | undefined) : undefined;
1880
+ ctx.addIssue({
1881
+ code: "custom",
1882
+ path: [index, ...issue.path],
1883
+ message: issue.message,
1884
+ params: {
1885
+ zodCode:
1886
+ issue.code === "custom" && typeof params?.zodCode === "string"
1887
+ ? params.zodCode
1888
+ : issue.code,
1889
+ },
1890
+ });
1891
+ reported++;
1892
+ }
1893
+ }
1894
+ return reported > 0 ? z.NEVER : nodes;
1895
+ }),
1896
+ );
1897
+
1131
1898
  export const Layout = z.strictObject({
1132
1899
  schemaVersion: z.literal(LAYOUT_SCHEMA_VERSION),
1133
1900
  root: ContainerNode,
@@ -1181,7 +1948,8 @@ export const isLayoutParentNode = (
1181
1948
  | SectionNode
1182
1949
  | LoopEmptyNode
1183
1950
  | AccordionItemNode
1184
- | MenuItemNode =>
1951
+ | MenuItemNode
1952
+ | CarouselSlideNode =>
1185
1953
  node.type === "container" ||
1186
1954
  node.type === "div-block" ||
1187
1955
  node.type === "layout-section" ||
@@ -1191,7 +1959,8 @@ export const isLayoutParentNode = (
1191
1959
  node.type === "part-ref" ||
1192
1960
  node.type === "loop-empty" ||
1193
1961
  node.type === "accordion-item" ||
1194
- node.type === "menu-item";
1962
+ node.type === "menu-item" ||
1963
+ node.type === "carousel-slide";
1195
1964
 
1196
1965
  /** Nodes that may hold children. */
1197
1966
  export const isParentNode = (
@@ -1211,7 +1980,14 @@ export const isParentNode = (
1211
1980
  | AccordionNode
1212
1981
  | AccordionItemNode
1213
1982
  | MenuNode
1214
- | MenuItemNode =>
1983
+ | MenuItemNode
1984
+ | SocialIconsNode
1985
+ | GalleryNode
1986
+ | CarouselNode
1987
+ | CarouselSlideNode
1988
+ | PriceListNode
1989
+ | ShareButtonsNode
1990
+ | HotspotsNode =>
1215
1991
  node.type === "container" ||
1216
1992
  node.type === "div-block" ||
1217
1993
  node.type === "layout-section" ||
@@ -1226,7 +2002,14 @@ export const isParentNode = (
1226
2002
  node.type === "accordion" ||
1227
2003
  node.type === "accordion-item" ||
1228
2004
  node.type === "menu" ||
1229
- node.type === "menu-item";
2005
+ node.type === "menu-item" ||
2006
+ node.type === "social-icons" ||
2007
+ node.type === "gallery" ||
2008
+ node.type === "carousel" ||
2009
+ node.type === "carousel-slide" ||
2010
+ node.type === "price-list" ||
2011
+ node.type === "share-buttons" ||
2012
+ node.type === "hotspots";
1230
2013
 
1231
2014
  export const isFormFieldType = (type: string): boolean =>
1232
2015
  (FORM_FIELD_TYPES as readonly string[]).includes(type);