@perkyzz/emvb 1.2.0 → 1.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 (150) hide show
  1. package/README.md +2 -2
  2. package/THIRD_PARTY_NOTICES.md +2 -2
  3. package/package.json +4 -4
  4. package/src/admin/bulk-api.ts +5 -1
  5. package/src/admin/editor/A11yCopilot.tsx +3 -1
  6. package/src/admin/editor/Editor.tsx +22 -2
  7. package/src/admin/editor/Timeline.tsx +1 -8
  8. package/src/admin/editor/canvas/DeviceBar.tsx +7 -2
  9. package/src/admin/editor/canvas/EmptyCanvas.tsx +11 -2
  10. package/src/admin/editor/canvas/use-canvas-dnd.ts +1 -20
  11. package/src/admin/editor/canvas/vnode-react.tsx +5 -0
  12. package/src/admin/editor/co-design.ts +36 -1
  13. package/src/admin/editor/dnd/dragged-source.ts +22 -0
  14. package/src/admin/editor/dnd/layer-drop.ts +141 -0
  15. package/src/admin/editor/dnd/new-element.ts +76 -0
  16. package/src/admin/editor/editor-css.ts +9 -1
  17. package/src/admin/editor/element-chrome.ts +34 -0
  18. package/src/admin/editor/feature-css.ts +22 -0
  19. package/src/admin/editor/inert-links.ts +8 -0
  20. package/src/admin/editor/panels/ColorControl.tsx +2 -2
  21. package/src/admin/editor/panels/FontFaces.tsx +342 -0
  22. package/src/admin/editor/panels/LayersPanel.tsx +56 -6
  23. package/src/admin/editor/panels/LeftPanel.tsx +153 -29
  24. package/src/admin/editor/panels/SettingsPanel.tsx +1 -0
  25. package/src/admin/editor/panels/SiteStylesDrawer.tsx +5 -0
  26. package/src/admin/editor/panels/TemplatesPanel.tsx +205 -0
  27. package/src/admin/editor/panels/TokenScales.tsx +2 -0
  28. package/src/admin/editor/panels/TriggersEditor.tsx +203 -9
  29. package/src/admin/editor/panels/VariableSection.tsx +111 -7
  30. package/src/admin/editor/panels/color-space.ts +71 -6
  31. package/src/admin/editor/panels/settings/AudienceEditor.tsx +3 -0
  32. package/src/admin/editor/panels/settings/FieldControl.tsx +18 -0
  33. package/src/admin/editor/panels/settings/ItemList.tsx +33 -0
  34. package/src/admin/editor/panels/settings/LoopItemBindControl.tsx +9 -3
  35. package/src/admin/editor/panels/settings/StickyControl.tsx +97 -0
  36. package/src/admin/editor/panels/settings/StyleRow.tsx +14 -0
  37. package/src/admin/editor/panels/settings/style-sections.ts +19 -2
  38. package/src/admin/editor/panels/url-rules.ts +43 -0
  39. package/src/admin/editor/panels/use-layers-drop.ts +232 -0
  40. package/src/admin/editor/store.ts +4 -2
  41. package/src/admin/editor/useExtensions.ts +3 -1
  42. package/src/admin/editor/useNodeActions.ts +74 -1
  43. package/src/admin/editor/useSave.ts +116 -85
  44. package/src/admin/export-api.ts +25 -2
  45. package/src/admin/extension-outputs.ts +179 -0
  46. package/src/admin/font-files-api.ts +38 -0
  47. package/src/admin/pages/ImportButton.tsx +15 -4
  48. package/src/admin/pages/ImportElementorDialog.tsx +22 -188
  49. package/src/admin/pages/ImportHtmlDialog.tsx +209 -0
  50. package/src/admin/pages/ImportImageCopies.tsx +167 -0
  51. package/src/admin/pages/ImportReport.tsx +63 -0
  52. package/src/admin/pages/NewPageDialog.tsx +54 -32
  53. package/src/admin/pages/PageList.tsx +9 -0
  54. package/src/admin/pages/ThemePartList.tsx +9 -0
  55. package/src/astro/EmVBPage.astro +5 -2
  56. package/src/astro/extension-styles.ts +35 -0
  57. package/src/astro/forms/EmVBFormsClient.astro +3 -0
  58. package/src/astro/forms/enhance.ts +107 -0
  59. package/src/astro/popups/runtime.ts +47 -2
  60. package/src/astro/render.ts +19 -4
  61. package/src/astro/request-data.ts +6 -0
  62. package/src/astro/resolve-theme.ts +11 -4
  63. package/src/astro/resolve.ts +9 -0
  64. package/src/astro/widgets/EmVBCountdownRuntime.astro +8 -0
  65. package/src/astro/widgets/EmVBCounterRuntime.astro +8 -0
  66. package/src/astro/widgets/EmVBHeadlineRuntime.astro +9 -0
  67. package/src/astro/widgets/EmVBMapRuntime.astro +8 -0
  68. package/src/astro/widgets/EmVBShareRuntime.astro +9 -0
  69. package/src/astro/widgets/EmVBStickyRuntime.astro +9 -0
  70. package/src/astro/widgets/EmVBThemeRuntime.astro +9 -0
  71. package/src/astro/widgets/EmVBWidgetRuntimes.astro +22 -0
  72. package/src/astro/widgets/alerts.ts +16 -2
  73. package/src/astro/widgets/carousel.ts +65 -24
  74. package/src/astro/widgets/countdown.ts +91 -0
  75. package/src/astro/widgets/counter.ts +98 -0
  76. package/src/astro/widgets/extension-runtimes.ts +27 -0
  77. package/src/astro/widgets/headline.ts +99 -0
  78. package/src/astro/widgets/map.ts +37 -0
  79. package/src/astro/widgets/share.ts +21 -0
  80. package/src/astro/widgets/sticky.ts +87 -0
  81. package/src/astro/widgets/theme.ts +52 -0
  82. package/src/constants.ts +1 -1
  83. package/src/core/a11y/audit.ts +177 -6
  84. package/src/core/arrange.ts +71 -1
  85. package/src/core/canvas-collections.ts +28 -0
  86. package/src/core/css/font-face.ts +72 -0
  87. package/src/core/css/generate.ts +35 -1
  88. package/src/core/elements/counter-format.ts +15 -0
  89. package/src/core/elements/form-elements.ts +119 -9
  90. package/src/core/elements/icon-svg.ts +14 -0
  91. package/src/core/elements/index.ts +54 -4
  92. package/src/core/elements/input-limits.ts +44 -0
  93. package/src/core/elements/marketing.ts +1490 -0
  94. package/src/core/elements/menu.ts +109 -47
  95. package/src/core/elements/site.ts +108 -0
  96. package/src/core/elements/widgets.ts +40 -5
  97. package/src/core/export/runtimes.generated.ts +10 -3
  98. package/src/core/export/site.ts +55 -4
  99. package/src/core/extensions/classes.ts +114 -0
  100. package/src/core/extensions/index.ts +17 -2
  101. package/src/core/extensions/normalize.ts +13 -0
  102. package/src/core/extensions/registry.ts +134 -10
  103. package/src/core/extensions/render-ext.ts +66 -21
  104. package/src/core/extensions/safe-nodes.ts +67 -11
  105. package/src/core/extensions/types.ts +48 -1
  106. package/src/core/fonts/files.ts +74 -0
  107. package/src/core/fonts/google.ts +112 -0
  108. package/src/core/fonts/test-font.ts +9 -0
  109. package/src/core/import/elementor/context.ts +13 -4
  110. package/src/core/import/elementor/index.ts +32 -21
  111. package/src/core/import/elementor/widgets.ts +532 -293
  112. package/src/core/import/html/blocks.ts +602 -0
  113. package/src/core/import/html/index.ts +155 -0
  114. package/src/core/import/html/map.ts +958 -0
  115. package/src/core/import/html/parse.ts +430 -0
  116. package/src/core/index.ts +45 -0
  117. package/src/core/limits.ts +6 -0
  118. package/src/core/migrate/v18.ts +3 -0
  119. package/src/core/public-attributes.ts +17 -0
  120. package/src/core/render/extras.ts +31 -7
  121. package/src/core/render/form.ts +103 -10
  122. package/src/core/render/index.ts +172 -16
  123. package/src/core/render/section.ts +31 -1
  124. package/src/core/render/spacer-basis.ts +102 -0
  125. package/src/core/render/theme-boot.ts +16 -0
  126. package/src/core/render/vnode.ts +1 -1
  127. package/src/core/sanitize/css.ts +68 -3
  128. package/src/core/sanitize/motion.ts +12 -0
  129. package/src/core/schema/design.ts +40 -0
  130. package/src/core/schema/layout.ts +534 -22
  131. package/src/core/schema/style.ts +28 -0
  132. package/src/core/templates/index.ts +218 -0
  133. package/src/core/templates/pages.ts +29 -0
  134. package/src/core/templates/sections.ts +794 -0
  135. package/src/core/templates/types.ts +9 -0
  136. package/src/core/theme/dynamic.ts +11 -6
  137. package/src/core/theme/popup-markup.ts +21 -2
  138. package/src/core/theme/popup-rules.ts +36 -0
  139. package/src/core/theme/triggers.ts +64 -5
  140. package/src/core/translatable.ts +5 -2
  141. package/src/extension-build.ts +331 -0
  142. package/src/index.ts +25 -3
  143. package/src/mcp/brief.ts +191 -0
  144. package/src/mcp/prompts.ts +33 -0
  145. package/src/mcp/read.ts +29 -1
  146. package/src/mcp/tools.ts +40 -1
  147. package/src/mcp/write.ts +41 -1
  148. package/src/server/extension-routes.ts +73 -0
  149. package/src/server/font-routes.ts +301 -0
  150. package/src/server/plugin.ts +11 -1
@@ -492,6 +492,14 @@ export const MenuItemNode = parentNode(
492
492
  newTab: z.boolean().optional(),
493
493
  /** The panel stretches across the menu instead of sitting under the item. */
494
494
  wide: z.boolean().optional(),
495
+ /**
496
+ * W-1069: a mega menu. The published Section theme part whose layout fills this item's
497
+ * dropdown panel, in place of its children. A missing part leaves the item's own children
498
+ * (none: a plain link).
499
+ */
500
+ panelPartId: z.string().max(128).optional(),
501
+ /** W-1069: the mega panel's width (the most it takes when `wide`). Unset: its content's. */
502
+ panelWidth: Length.optional(),
495
503
  }),
496
504
  );
497
505
 
@@ -529,6 +537,21 @@ export const FormNode = parentNode(
529
537
  z.strictObject({
530
538
  /** Empty until the editor binds a forms-plugin form (W-036). */
531
539
  formId: z.string().max(64),
540
+ /** W-1065: the Next and Previous buttons of a form with steps. Unset: "Next", "Previous". */
541
+ nextLabel: z.string().max(80).optional(),
542
+ prevLabel: z.string().max(80).optional(),
543
+ }),
544
+ );
545
+
546
+ /**
547
+ * W-1065: one step of a form, placed directly inside it. With the forms script the visitor sees
548
+ * one step at a time; without it every step shows, as one long form. All steps send together.
549
+ */
550
+ export const FormStepNode = parentNode(
551
+ "form-step",
552
+ z.strictObject({
553
+ /** The step's legend, read out when it opens. Unset: "Step 2". */
554
+ title: z.string().max(200).optional(),
532
555
  }),
533
556
  );
534
557
 
@@ -538,7 +561,36 @@ const InputFieldProps = z.strictObject({
538
561
  placeholder: z.string().max(200).optional(),
539
562
  });
540
563
 
541
- export const TextInputNode = leafNode("text-input", InputFieldProps);
564
+ /** W-1065: the most a number input's limits and step may be, either way. */
565
+ export const MAX_INPUT_NUMBER = 1e12;
566
+ const InputNumber = z.number().min(-MAX_INPUT_NUMBER).max(MAX_INPUT_NUMBER);
567
+ /** A calendar date as date inputs take it: YYYY-MM-DD, a real day of years 1000 to 9999. */
568
+ const InputDate = z
569
+ .string()
570
+ .regex(/^[1-9]\d{3}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/, "Dates are YYYY-MM-DD")
571
+ .refine((value) => {
572
+ const [y, m, d] = value.split("-").map(Number) as [number, number, number];
573
+ const day = new Date(Date.UTC(y, m - 1, d));
574
+ return day.getUTCMonth() === m - 1 && day.getUTCDate() === d;
575
+ }, "That day doesn't exist");
576
+
577
+ /** W-1065: input kinds a Text input may ask for when its form field is plain text. */
578
+ export const TEXT_INPUT_TYPES = ["number", "date"] as const;
579
+
580
+ export const TextInputNode = leafNode(
581
+ "text-input",
582
+ InputFieldProps.extend({
583
+ /** W-1065: a number or date box; the form field's own type (email, number, date) wins. */
584
+ inputType: z.enum(TEXT_INPUT_TYPES).optional(),
585
+ /** Lowest and highest number, and the step between allowed numbers (unset: any). */
586
+ min: InputNumber.optional(),
587
+ max: InputNumber.optional(),
588
+ step: z.number().positive().max(MAX_INPUT_NUMBER).optional(),
589
+ /** Earliest and latest date (YYYY-MM-DD). */
590
+ minDate: InputDate.optional(),
591
+ maxDate: InputDate.optional(),
592
+ }),
593
+ );
542
594
 
543
595
  export const TextareaNode = leafNode("textarea", InputFieldProps);
544
596
 
@@ -782,6 +834,23 @@ export const KNOWN_ELEMENT_TYPES = [
782
834
  "gallery-image",
783
835
  "carousel",
784
836
  "carousel-slide",
837
+ "counter",
838
+ "progress",
839
+ "countdown",
840
+ "map",
841
+ "price-table",
842
+ "price-list",
843
+ "price-list-item",
844
+ "cta",
845
+ "flip-box",
846
+ "headline",
847
+ "share-buttons",
848
+ "share-link",
849
+ "hotspots",
850
+ "hotspot",
851
+ "search-form",
852
+ "theme-toggle",
853
+ "form-step",
785
854
  ] as const;
786
855
 
787
856
  /** Headings on this page, as a list of links. No script (W-345). */
@@ -843,6 +912,148 @@ export const AlertNode = leafNode(
843
912
  }),
844
913
  );
845
914
 
915
+ /** W-1038: the thousands separators a Counter can use. */
916
+ export const COUNTER_SEPARATORS = [",", ".", " ", "'"] as const;
917
+
918
+ /** W-1038: the largest number a Counter shows, either way (beyond it, rounding shows). */
919
+ export const MAX_COUNTER = 1e12;
920
+
921
+ /**
922
+ * W-1038: a number to show off, such as "1,200+ clients": `value` with optional `prefix`,
923
+ * `suffix` and `title`, as text. `countUp` asks for the opt-in counter runtime, which counts from
924
+ * `start` (unset 0) to `value` over `duration` ms when the number scrolls into view; under
925
+ * reduced motion, and without the script, the final number shows at once.
926
+ */
927
+ export const CounterNode = leafNode(
928
+ "counter",
929
+ z.strictObject({
930
+ value: z.number().min(-MAX_COUNTER).max(MAX_COUNTER),
931
+ start: z.number().min(-MAX_COUNTER).max(MAX_COUNTER).optional(),
932
+ /** Digits after the decimal point. Unset = 0. */
933
+ decimals: z.number().int().min(0).max(3).optional(),
934
+ /** Thousands separator. Unset = none. */
935
+ separator: z.enum(COUNTER_SEPARATORS).optional(),
936
+ prefix: z.string().max(20).optional(),
937
+ suffix: z.string().max(20).optional(),
938
+ title: z.string().max(200).optional(),
939
+ countUp: z.boolean().optional(),
940
+ /** How long the count-up takes, in ms; at most 5 s, so it never needs a pause (WCAG 2.2.2). Unset = 2000. */
941
+ duration: z.number().int().min(300).max(5000).optional(),
942
+ }),
943
+ );
944
+
945
+ /** W-1039: what a Progress bar means: a measurement (a skill level) or how far a task has got. */
946
+ export const PROGRESS_KINDS = ["meter", "progressbar"] as const;
947
+
948
+ /** W-1039: the largest `max` a Progress bar takes. */
949
+ export const MAX_PROGRESS = 1e6;
950
+
951
+ /**
952
+ * W-1039: a labelled bar filled to `value` out of `max` (unset 100). Screen readers get it as a
953
+ * meter or a progress bar (`kind`, unset meter) with the value as text. `grow` lets the fill grow
954
+ * in as it scrolls into view, with CSS only and not under reduced motion. A value above `max`
955
+ * shows as full, so lowering `max` never makes a page invalid.
956
+ */
957
+ export const ProgressNode = leafNode(
958
+ "progress",
959
+ z.strictObject({
960
+ value: z.number().min(0).max(MAX_PROGRESS),
961
+ max: z.number().positive().max(MAX_PROGRESS).optional(),
962
+ label: z.string().max(120).optional(),
963
+ showValue: z.boolean().optional(),
964
+ kind: z.enum(PROGRESS_KINDS).optional(),
965
+ /** The bar's height in px. Unset = 8. */
966
+ thickness: z.number().int().min(2).max(48).optional(),
967
+ grow: z.boolean().optional(),
968
+ }),
969
+ );
970
+
971
+ /** W-1040: a date and time with its UTC offset, such as 2026-12-01T09:00-05:00 or …T14:00Z. */
972
+ export const COUNTDOWN_TARGET =
973
+ /^(\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)$/;
974
+
975
+ /** W-1040: what a ticking Countdown does when its time is up. */
976
+ export const COUNTDOWN_EXPIRED = ["text", "hide", "link"] as const;
977
+
978
+ /**
979
+ * W-1040: a deadline. Without script it is a sentence with the target as `<time>` ("Ends 1 Dec
980
+ * 2026, 09:00 UTC−5"). `ticking` asks for the opt-in countdown runtime: days, hours, minutes and
981
+ * seconds that screen readers skip (the sentence stays for them), a Pause button, and at the end
982
+ * `expired`: show `expiredText`, hide the Countdown, or show `expiredText` as a link to
983
+ * `expiredHref`.
984
+ */
985
+ export const CountdownNode = leafNode(
986
+ "countdown",
987
+ z.strictObject({
988
+ target: z
989
+ .string()
990
+ .regex(COUNTDOWN_TARGET, "Use a date, time and UTC offset such as 2026-12-01T09:00-05:00")
991
+ .refine((value) => !Number.isNaN(Date.parse(value)), "This date doesn't exist"),
992
+ title: z.string().max(200).optional(),
993
+ /** The words before the date. Unset = "Ends". */
994
+ label: z.string().max(40).optional(),
995
+ ticking: z.boolean().optional(),
996
+ hideSeconds: z.boolean().optional(),
997
+ expired: z.enum(COUNTDOWN_EXPIRED).optional(),
998
+ /** Unset = "This offer has ended." */
999
+ expiredText: z.string().max(200).optional(),
1000
+ expiredHref: z.string().max(2000).optional(),
1001
+ }),
1002
+ );
1003
+
1004
+ /** W-1041: the map services a Map links to and embeds. */
1005
+ export const MAP_PROVIDERS = ["osm", "google"] as const;
1006
+
1007
+ /**
1008
+ * W-1041: a place. Without script it is the address and a link to it on OpenStreetMap or Google
1009
+ * Maps (`provider`, unset osm), at `lat`/`lng` when set. `embed` asks for the opt-in map runtime:
1010
+ * a "Show the map" button that loads the map in an iframe only when pressed, so the page makes
1011
+ * no request to the map service until the visitor asks. OpenStreetMap embeds need `lat`/`lng`.
1012
+ */
1013
+ export const MapNode = leafNode(
1014
+ "map",
1015
+ z.strictObject({
1016
+ address: z.string().min(1).max(300),
1017
+ provider: z.enum(MAP_PROVIDERS).optional(),
1018
+ lat: z.number().min(-90).max(90).optional(),
1019
+ lng: z.number().min(-180).max(180).optional(),
1020
+ /** Unset = 15. */
1021
+ zoom: z.number().int().min(1).max(19).optional(),
1022
+ /** The link's words. Unset = "Open in OpenStreetMap" or "Open in Google Maps". */
1023
+ linkText: z.string().max(80).optional(),
1024
+ embed: z.boolean().optional(),
1025
+ /** The embedded map's height in px. Unset = 360. */
1026
+ height: z.number().int().min(150).max(800).optional(),
1027
+ }),
1028
+ );
1029
+
1030
+ /**
1031
+ * W-1042: a plan card: title, price (with `currency` and `period`; `regularPrice` shows struck
1032
+ * through before it as on sale), what is in the plan (`features`) and what isn't (`excluded`),
1033
+ * a button link, and an optional ribbon when `featured`. No script.
1034
+ */
1035
+ export const PriceTableNode = leafNode(
1036
+ "price-table",
1037
+ z.strictObject({
1038
+ title: z.string().max(120),
1039
+ /** The title's heading level. Unset = 3. */
1040
+ titleLevel: z.number().int().min(2).max(6).optional(),
1041
+ description: z.string().max(500).optional(),
1042
+ price: z.string().max(20),
1043
+ currency: z.string().max(5).optional(),
1044
+ period: z.string().max(40).optional(),
1045
+ regularPrice: z.string().max(20).optional(),
1046
+ features: boundedArray(z.string().max(200), 30).optional(),
1047
+ excluded: boundedArray(z.string().max(200), 30).optional(),
1048
+ buttonText: z.string().max(80).optional(),
1049
+ buttonHref: z.string().max(2000).optional(),
1050
+ newTab: z.boolean().optional(),
1051
+ featured: z.boolean().optional(),
1052
+ /** The ribbon's words when `featured`. Unset = "Featured". */
1053
+ ribbon: z.string().max(30).optional(),
1054
+ }),
1055
+ );
1056
+
846
1057
  /** W-1020: where a media box puts its icon or image: above, or before or after the words. */
847
1058
  export const MEDIA_BOX_POSITIONS = ["top", "left", "right"] as const;
848
1059
 
@@ -876,6 +1087,15 @@ export const IconBoxNode = leafNode(
876
1087
  /** W-1021: how much of the box's width an image box's picture takes when beside the words. */
877
1088
  export const IMAGE_BOX_SIZES = ["small", "medium", "large", "full"] as const;
878
1089
 
1090
+ /** A picture picked from the media library: its id, intrinsic size and focal point (as Image). */
1091
+ const PICKED_MEDIA = {
1092
+ mediaId: z.string().min(1).max(128).optional(),
1093
+ width: z.number().int().positive().max(10000).optional(),
1094
+ height: z.number().int().positive().max(10000).optional(),
1095
+ focalX: z.number().int().min(0).max(100).optional(),
1096
+ focalY: z.number().int().min(0).max(100).optional(),
1097
+ };
1098
+
879
1099
  /**
880
1100
  * W-1021: a picture above (or beside) a title and text, like Elementor's Image Box. The picture
881
1101
  * keys are an Image's, so the media library fills them the same way; alt text is required unless
@@ -887,11 +1107,7 @@ export const ImageBoxNode = leafNode(
887
1107
  src: z.string().max(2000),
888
1108
  alt: z.string().max(500),
889
1109
  decorative: z.boolean().optional(),
890
- mediaId: z.string().min(1).max(128).optional(),
891
- width: z.number().int().positive().max(10000).optional(),
892
- height: z.number().int().positive().max(10000).optional(),
893
- focalX: z.number().int().min(0).max(100).optional(),
894
- focalY: z.number().int().min(0).max(100).optional(),
1110
+ ...PICKED_MEDIA,
895
1111
  /** Beside the words: small 25 %, medium 40 %, large 60 % of the box. Unset = medium. */
896
1112
  imageSize: z.enum(IMAGE_BOX_SIZES).optional(),
897
1113
  ...MediaBoxText,
@@ -915,11 +1131,7 @@ export const TestimonialNode = leafNode(
915
1131
  src: z.string().max(2000).optional(),
916
1132
  /** Written by the media library; never rendered (the photo is beside the name). */
917
1133
  alt: z.string().max(500).optional(),
918
- mediaId: z.string().min(1).max(128).optional(),
919
- width: z.number().int().positive().max(10000).optional(),
920
- height: z.number().int().positive().max(10000).optional(),
921
- focalX: z.number().int().min(0).max(100).optional(),
922
- focalY: z.number().int().min(0).max(100).optional(),
1134
+ ...PICKED_MEDIA,
923
1135
  /** Stars out of `ratingMax` (unset 5); no stars when unset. */
924
1136
  rating: z.number().min(0).max(MAX_RATING).optional(),
925
1137
  ratingMax: z.number().int().min(1).max(MAX_RATING).optional(),
@@ -1005,11 +1217,7 @@ export const GalleryImageNode = leafNode(
1005
1217
  src: z.string().max(2000),
1006
1218
  alt: z.string().max(500),
1007
1219
  decorative: z.boolean().optional(),
1008
- mediaId: z.string().min(1).max(128).optional(),
1009
- width: z.number().int().positive().max(10000).optional(),
1010
- height: z.number().int().positive().max(10000).optional(),
1011
- focalX: z.number().int().min(0).max(100).optional(),
1012
- focalY: z.number().int().min(0).max(100).optional(),
1220
+ ...PICKED_MEDIA,
1013
1221
  caption: z.string().max(500).optional(),
1014
1222
  }),
1015
1223
  ).refine((node) => node.props.decorative === true || node.props.alt.length > 0, {
@@ -1048,6 +1256,220 @@ export const CarouselSlideNode = parentNode(
1048
1256
  }),
1049
1257
  );
1050
1258
 
1259
+ /**
1260
+ * W-1043: a menu-style list of items with prices, such as a restaurant menu or a list of
1261
+ * services. Holds Price list items only. `label` names the list for screen readers.
1262
+ */
1263
+ export const PriceListNodeSchema = parentNode(
1264
+ "price-list",
1265
+ z.strictObject({
1266
+ label: z.string().max(80).optional(),
1267
+ }),
1268
+ );
1269
+
1270
+ /**
1271
+ * W-1043: one row of a Price list: the title, a dotted leader and the price on one line, an
1272
+ * optional description under them, an optional picture before them (its alt text unset: the
1273
+ * picture is decorative) and an optional link on the title.
1274
+ */
1275
+ export const PriceListItemNode = leafNode(
1276
+ "price-list-item",
1277
+ z.strictObject({
1278
+ title: z.string().max(120),
1279
+ price: z.string().max(20),
1280
+ description: z.string().max(500).optional(),
1281
+ src: z.string().max(2000).optional(),
1282
+ alt: z.string().max(500).optional(),
1283
+ ...PICKED_MEDIA,
1284
+ href: z.string().max(2000).optional(),
1285
+ newTab: z.boolean().optional(),
1286
+ }),
1287
+ );
1288
+
1289
+ /** W-1044: where a Call to action puts its picture: behind the words, or above or beside them. */
1290
+ export const CTA_LAYOUTS = ["behind", "top", "left", "right"] as const;
1291
+
1292
+ /**
1293
+ * W-1044: a box with a picture, title, text and a button. With `href` the title is the link and
1294
+ * the whole box opens it (the button repeats it for the eye only). `layout` (unset `behind`)
1295
+ * puts the picture behind the words under a dark overlay, or above or beside them. `ribbon`
1296
+ * adds a small label in a corner.
1297
+ */
1298
+ export const CtaNode = leafNode(
1299
+ "cta",
1300
+ z.strictObject({
1301
+ title: z.string().max(200),
1302
+ /** The title's heading level. Unset = 3. */
1303
+ titleLevel: z.number().int().min(2).max(6).optional(),
1304
+ text: z.string().max(MAX_TEXT_LENGTH).optional(),
1305
+ src: z.string().max(2000).optional(),
1306
+ alt: z.string().max(500).optional(),
1307
+ ...PICKED_MEDIA,
1308
+ layout: z.enum(CTA_LAYOUTS).optional(),
1309
+ buttonText: z.string().max(80).optional(),
1310
+ href: z.string().max(2000).optional(),
1311
+ newTab: z.boolean().optional(),
1312
+ ribbon: z.string().max(30).optional(),
1313
+ }),
1314
+ );
1315
+
1316
+ /** W-1045: which way a Flip box turns over. */
1317
+ export const FLIP_DIRECTIONS = ["left", "right", "up", "down"] as const;
1318
+
1319
+ /**
1320
+ * W-1045: a card with a front and a back. It turns over on hover (where the device can hover)
1321
+ * and when keyboard focus reaches the back; a native checkbox ("Turn over") turns it on touch
1322
+ * screens and for keyboards, with no script. Both faces stay in the page for screen readers.
1323
+ * Under reduced motion it swaps faces without the turn.
1324
+ */
1325
+ export const FlipBoxNode = leafNode(
1326
+ "flip-box",
1327
+ z.strictObject({
1328
+ frontTitle: z.string().max(200),
1329
+ frontText: z.string().max(MAX_TEXT_LENGTH).optional(),
1330
+ backTitle: z.string().max(200).optional(),
1331
+ backText: z.string().max(MAX_TEXT_LENGTH).optional(),
1332
+ /** Both titles' heading level. Unset = 3. */
1333
+ titleLevel: z.number().int().min(2).max(6).optional(),
1334
+ buttonText: z.string().max(80).optional(),
1335
+ href: z.string().max(2000).optional(),
1336
+ newTab: z.boolean().optional(),
1337
+ direction: z.enum(FLIP_DIRECTIONS).optional(),
1338
+ /** The checkbox's words. Unset = "Turn over". */
1339
+ toggleLabel: z.string().max(40).optional(),
1340
+ }),
1341
+ );
1342
+
1343
+ /** W-1046: how an Animated headline marks its highlighted words. */
1344
+ export const HEADLINE_MARKS = ["underline", "circle", "strike", "none"] as const;
1345
+
1346
+ /**
1347
+ * W-1046: a heading (`level`, unset 2) of `before`, the highlighted `highlight` and `after`,
1348
+ * read as one sentence. `mark` (unset underline) is drawn once in CSS, already drawn under
1349
+ * reduced motion. `rotate` lists other words for the highlight: `rotating` asks for the opt-in
1350
+ * headline runtime, which cycles them every `interval` seconds for `turns` rounds and stops on
1351
+ * the first word, with a Pause button; screen readers keep the sentence with the first word.
1352
+ */
1353
+ export const HeadlineNode = leafNode(
1354
+ "headline",
1355
+ z.strictObject({
1356
+ level: z.number().int().min(1).max(6).optional(),
1357
+ before: z.string().max(200).optional(),
1358
+ highlight: z.string().min(1).max(120),
1359
+ after: z.string().max(200).optional(),
1360
+ mark: z.enum(HEADLINE_MARKS).optional(),
1361
+ rotate: boundedArray(z.string().max(120), 10).optional(),
1362
+ rotating: z.boolean().optional(),
1363
+ /** Seconds per word. Unset = 2.5. */
1364
+ interval: z.number().min(1.5).max(10).optional(),
1365
+ /** Rounds through the words before it stops. Unset = 2. */
1366
+ turns: z.number().int().min(1).max(5).optional(),
1367
+ }),
1368
+ );
1369
+
1370
+ /** W-1047: the services a Share link can share to; each has a Social icons preset icon. */
1371
+ export const SHARE_NETWORKS = [
1372
+ "facebook",
1373
+ "x",
1374
+ "linkedin",
1375
+ "whatsapp",
1376
+ "telegram",
1377
+ "reddit",
1378
+ "bluesky",
1379
+ "threads",
1380
+ "email",
1381
+ ] as const;
1382
+
1383
+ /**
1384
+ * W-1047: links that share the current page, with no tracking script: each a service's own
1385
+ * share address with the page's URL in it. Holds Share links only. The host gives the page URL
1386
+ * (`resolveEmVBPage` does); without it the public page shows no links. `nativeShare` opts in to
1387
+ * the share runtime, which adds a Share button for the browser's own share sheet where it has
1388
+ * one. `label` names the list (unset "Share this page").
1389
+ */
1390
+ export const ShareButtonsNodeSchema = parentNode(
1391
+ "share-buttons",
1392
+ z.strictObject({
1393
+ label: z.string().max(80).optional(),
1394
+ shape: z.enum(SOCIAL_SHAPES).optional(),
1395
+ brandColors: z.boolean().optional(),
1396
+ nativeShare: z.boolean().optional(),
1397
+ }),
1398
+ );
1399
+
1400
+ /** W-1047: one share link. `label` replaces "Share on Facebook". */
1401
+ export const ShareLinkNode = leafNode(
1402
+ "share-link",
1403
+ z.strictObject({
1404
+ network: z.enum(SHARE_NETWORKS),
1405
+ label: z.string().max(80).optional(),
1406
+ }),
1407
+ );
1408
+
1409
+ /**
1410
+ * W-1048: a picture with numbered markers. Holds Hotspots only. The picture keys are an Image's;
1411
+ * `label` names the list of markers for screen readers (unset "Points on the picture").
1412
+ */
1413
+ export const HotspotsNodeSchema = parentNode(
1414
+ "hotspots",
1415
+ z.strictObject({
1416
+ src: z.string().max(2000),
1417
+ alt: z.string().max(500),
1418
+ decorative: z.boolean().optional(),
1419
+ ...PICKED_MEDIA,
1420
+ label: z.string().max(80).optional(),
1421
+ }),
1422
+ );
1423
+
1424
+ /** A marker's place across or down the picture, in percent. */
1425
+ const HotspotPlace = z.number().min(0).max(100);
1426
+
1427
+ /**
1428
+ * W-1048: one marker: a numbered button at `x`/`y` percent of the picture (tablet and mobile
1429
+ * values follow the wider device when unset) that opens its note, `title` and `text`, with the
1430
+ * native Popover API: no script, Escape and a click outside close it.
1431
+ */
1432
+ export const HotspotNode = leafNode(
1433
+ "hotspot",
1434
+ z.strictObject({
1435
+ title: z.string().min(1).max(120),
1436
+ text: z.string().max(1000).optional(),
1437
+ x: HotspotPlace,
1438
+ y: HotspotPlace,
1439
+ xTablet: HotspotPlace.optional(),
1440
+ yTablet: HotspotPlace.optional(),
1441
+ xMobile: HotspotPlace.optional(),
1442
+ yMobile: HotspotPlace.optional(),
1443
+ }),
1444
+ );
1445
+
1446
+ /**
1447
+ * W-1073: a site search box: a plain GET form to `action` (unset "/search", the page EmDash's
1448
+ * own Search widget and site templates use) with the words in `q`. No script. `label` names the
1449
+ * field and the search landmark for screen readers (unset "Search"); `buttonText` unset "Search".
1450
+ */
1451
+ export const SearchFormNode = leafNode(
1452
+ "search-form",
1453
+ z.strictObject({
1454
+ action: z.string().max(500).optional(),
1455
+ label: z.string().max(80).optional(),
1456
+ placeholder: z.string().max(120).optional(),
1457
+ buttonText: z.string().max(40).optional(),
1458
+ }),
1459
+ );
1460
+
1461
+ /**
1462
+ * W-1067: a button that switches the site between light and dark (colour variables' dark
1463
+ * values), remembered on the visitor's browser. It needs the opt-in theme runtime, so without it
1464
+ * the button stays hidden. `label` is its text (unset "Dark mode"); it is a toggle (aria-pressed).
1465
+ */
1466
+ export const ThemeToggleNode = leafNode(
1467
+ "theme-toggle",
1468
+ z.strictObject({
1469
+ label: z.string().max(40).optional(),
1470
+ }),
1471
+ );
1472
+
1051
1473
  const knownTypeSet = new Set<string>(KNOWN_ELEMENT_TYPES);
1052
1474
 
1053
1475
  /**
@@ -1092,6 +1514,22 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
1092
1514
  GalleryImageNode,
1093
1515
  CarouselNodeSchema,
1094
1516
  CarouselSlideNode,
1517
+ PriceListNodeSchema,
1518
+ PriceListItemNode,
1519
+ CtaNode,
1520
+ FlipBoxNode,
1521
+ HeadlineNode,
1522
+ ShareButtonsNodeSchema,
1523
+ ShareLinkNode,
1524
+ HotspotsNodeSchema,
1525
+ HotspotNode,
1526
+ SearchFormNode,
1527
+ ThemeToggleNode,
1528
+ CounterNode,
1529
+ ProgressNode,
1530
+ CountdownNode,
1531
+ MapNode,
1532
+ PriceTableNode,
1095
1533
  SpacerNode,
1096
1534
  DividerNode,
1097
1535
  TextNode,
@@ -1103,6 +1541,7 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
1103
1541
  IconNode,
1104
1542
  VideoNode,
1105
1543
  FormNode,
1544
+ FormStepNode,
1106
1545
  TextInputNode,
1107
1546
  TextareaNode,
1108
1547
  SelectNode,
@@ -1134,6 +1573,19 @@ export type TocNode = z.infer<typeof TocNode>;
1134
1573
  export type LanguageSwitcherNode = z.infer<typeof LanguageSwitcherNode>;
1135
1574
  export type RatingNode = z.infer<typeof RatingNode>;
1136
1575
  export type AlertNode = z.infer<typeof AlertNode>;
1576
+ export type CounterNode = z.infer<typeof CounterNode>;
1577
+ export type ProgressNode = z.infer<typeof ProgressNode>;
1578
+ export type CountdownNode = z.infer<typeof CountdownNode>;
1579
+ export type MapNode = z.infer<typeof MapNode>;
1580
+ export type PriceTableNode = z.infer<typeof PriceTableNode>;
1581
+ export type PriceListItemNode = z.infer<typeof PriceListItemNode>;
1582
+ export type CtaNode = z.infer<typeof CtaNode>;
1583
+ export type FlipBoxNode = z.infer<typeof FlipBoxNode>;
1584
+ export type HeadlineNode = z.infer<typeof HeadlineNode>;
1585
+ export type ShareLinkNode = z.infer<typeof ShareLinkNode>;
1586
+ export type HotspotNode = z.infer<typeof HotspotNode>;
1587
+ export type SearchFormNode = z.infer<typeof SearchFormNode>;
1588
+ export type ThemeToggleNode = z.infer<typeof ThemeToggleNode>;
1137
1589
  export type IconBoxNode = z.infer<typeof IconBoxNode>;
1138
1590
  export type ImageBoxNode = z.infer<typeof ImageBoxNode>;
1139
1591
  export type TestimonialNode = z.infer<typeof TestimonialNode>;
@@ -1268,7 +1720,13 @@ export type TabsNode = NodeEnvelope & {
1268
1720
 
1269
1721
  export type FormNode = NodeEnvelope & {
1270
1722
  type: "form";
1271
- props: { formId: string };
1723
+ props: { formId: string; nextLabel?: string; prevLabel?: string };
1724
+ children: LayoutNode[];
1725
+ };
1726
+
1727
+ export type FormStepNode = NodeEnvelope & {
1728
+ type: "form-step";
1729
+ props: { title?: string };
1272
1730
  children: LayoutNode[];
1273
1731
  };
1274
1732
 
@@ -1322,6 +1780,24 @@ export type CarouselSlideNode = NodeEnvelope & {
1322
1780
  children: LayoutNode[];
1323
1781
  };
1324
1782
 
1783
+ export type ShareButtonsNode = NodeEnvelope & {
1784
+ type: "share-buttons";
1785
+ props: z.infer<typeof ShareButtonsNodeSchema>["props"];
1786
+ children: LayoutNode[];
1787
+ };
1788
+
1789
+ export type HotspotsNode = NodeEnvelope & {
1790
+ type: "hotspots";
1791
+ props: z.infer<typeof HotspotsNodeSchema>["props"];
1792
+ children: LayoutNode[];
1793
+ };
1794
+
1795
+ export type PriceListNode = NodeEnvelope & {
1796
+ type: "price-list";
1797
+ props: z.infer<typeof PriceListNodeSchema>["props"];
1798
+ children: LayoutNode[];
1799
+ };
1800
+
1325
1801
  export type GalleryNode = NodeEnvelope & {
1326
1802
  type: "gallery";
1327
1803
  props: z.infer<typeof GalleryNodeSchema>["props"];
@@ -1336,7 +1812,14 @@ export type MenuNode = NodeEnvelope & {
1336
1812
 
1337
1813
  export type MenuItemNode = NodeEnvelope & {
1338
1814
  type: "menu-item";
1339
- props: { text: string; href?: string; newTab?: boolean; wide?: boolean };
1815
+ props: {
1816
+ text: string;
1817
+ href?: string;
1818
+ newTab?: boolean;
1819
+ wide?: boolean;
1820
+ panelPartId?: string;
1821
+ panelWidth?: z.infer<typeof Length>;
1822
+ };
1340
1823
  children: LayoutNode[];
1341
1824
  };
1342
1825
 
@@ -1356,6 +1839,7 @@ export type LayoutNode =
1356
1839
  | TabsNode
1357
1840
  | TabPanelNode
1358
1841
  | FormNode
1842
+ | FormStepNode
1359
1843
  | LoopNode
1360
1844
  | LoopEmptyNode
1361
1845
  | SectionNode
@@ -1373,6 +1857,22 @@ export type LayoutNode =
1373
1857
  | GalleryImageNode
1374
1858
  | CarouselNode
1375
1859
  | CarouselSlideNode
1860
+ | CounterNode
1861
+ | ProgressNode
1862
+ | CountdownNode
1863
+ | MapNode
1864
+ | PriceTableNode
1865
+ | PriceListNode
1866
+ | PriceListItemNode
1867
+ | CtaNode
1868
+ | FlipBoxNode
1869
+ | HeadlineNode
1870
+ | ShareButtonsNode
1871
+ | ShareLinkNode
1872
+ | HotspotsNode
1873
+ | HotspotNode
1874
+ | SearchFormNode
1875
+ | ThemeToggleNode
1376
1876
  | SpacerNode
1377
1877
  | DividerNode
1378
1878
  | TextNode
@@ -1513,6 +2013,8 @@ export const isContainerNode = (node: LayoutNode): node is ContainerNode =>
1513
2013
 
1514
2014
  export const isFormNode = (node: LayoutNode): node is FormNode => node.type === "form";
1515
2015
 
2016
+ export const isFormStepNode = (node: LayoutNode): node is FormStepNode => node.type === "form-step";
2017
+
1516
2018
  export const isLoopNode = (node: LayoutNode): node is LoopNode => node.type === "loop";
1517
2019
 
1518
2020
  /**
@@ -1552,7 +2054,8 @@ export const isLayoutParentNode = (
1552
2054
  | LoopEmptyNode
1553
2055
  | AccordionItemNode
1554
2056
  | MenuItemNode
1555
- | CarouselSlideNode =>
2057
+ | CarouselSlideNode
2058
+ | FormStepNode =>
1556
2059
  node.type === "container" ||
1557
2060
  node.type === "div-block" ||
1558
2061
  node.type === "layout-section" ||
@@ -1563,7 +2066,8 @@ export const isLayoutParentNode = (
1563
2066
  node.type === "loop-empty" ||
1564
2067
  node.type === "accordion-item" ||
1565
2068
  node.type === "menu-item" ||
1566
- node.type === "carousel-slide";
2069
+ node.type === "carousel-slide" ||
2070
+ node.type === "form-step";
1567
2071
 
1568
2072
  /** Nodes that may hold children. */
1569
2073
  export const isParentNode = (
@@ -1575,6 +2079,7 @@ export const isParentNode = (
1575
2079
  | FlexboxNode
1576
2080
  | GridNode
1577
2081
  | FormNode
2082
+ | FormStepNode
1578
2083
  | LoopNode
1579
2084
  | LoopEmptyNode
1580
2085
  | SectionNode
@@ -1587,13 +2092,17 @@ export const isParentNode = (
1587
2092
  | SocialIconsNode
1588
2093
  | GalleryNode
1589
2094
  | CarouselNode
1590
- | CarouselSlideNode =>
2095
+ | CarouselSlideNode
2096
+ | PriceListNode
2097
+ | ShareButtonsNode
2098
+ | HotspotsNode =>
1591
2099
  node.type === "container" ||
1592
2100
  node.type === "div-block" ||
1593
2101
  node.type === "layout-section" ||
1594
2102
  node.type === "flexbox" ||
1595
2103
  node.type === "grid" ||
1596
2104
  node.type === "form" ||
2105
+ node.type === "form-step" ||
1597
2106
  node.type === "loop" ||
1598
2107
  node.type === "loop-empty" ||
1599
2108
  node.type === "part-ref" ||
@@ -1606,7 +2115,10 @@ export const isParentNode = (
1606
2115
  node.type === "social-icons" ||
1607
2116
  node.type === "gallery" ||
1608
2117
  node.type === "carousel" ||
1609
- node.type === "carousel-slide";
2118
+ node.type === "carousel-slide" ||
2119
+ node.type === "price-list" ||
2120
+ node.type === "share-buttons" ||
2121
+ node.type === "hotspots";
1610
2122
 
1611
2123
  export const isFormFieldType = (type: string): boolean =>
1612
2124
  (FORM_FIELD_TYPES as readonly string[]).includes(type);