@perkyzz/emvb 1.2.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 (36) hide show
  1. package/THIRD_PARTY_NOTICES.md +2 -2
  2. package/package.json +4 -4
  3. package/src/admin/editor/canvas/vnode-react.tsx +3 -0
  4. package/src/admin/editor/dnd/new-element.ts +60 -0
  5. package/src/admin/editor/element-chrome.ts +28 -0
  6. package/src/admin/editor/panels/settings/ItemList.tsx +33 -0
  7. package/src/astro/request-data.ts +6 -0
  8. package/src/astro/resolve.ts +9 -0
  9. package/src/astro/widgets/EmVBCountdownRuntime.astro +8 -0
  10. package/src/astro/widgets/EmVBCounterRuntime.astro +8 -0
  11. package/src/astro/widgets/EmVBHeadlineRuntime.astro +9 -0
  12. package/src/astro/widgets/EmVBMapRuntime.astro +8 -0
  13. package/src/astro/widgets/EmVBShareRuntime.astro +9 -0
  14. package/src/astro/widgets/EmVBWidgetRuntimes.astro +10 -0
  15. package/src/astro/widgets/countdown.ts +80 -0
  16. package/src/astro/widgets/counter.ts +98 -0
  17. package/src/astro/widgets/headline.ts +90 -0
  18. package/src/astro/widgets/map.ts +37 -0
  19. package/src/astro/widgets/share.ts +21 -0
  20. package/src/constants.ts +1 -1
  21. package/src/core/a11y/audit.ts +28 -5
  22. package/src/core/arrange.ts +52 -0
  23. package/src/core/canvas-collections.ts +28 -0
  24. package/src/core/elements/counter-format.ts +15 -0
  25. package/src/core/elements/index.ts +30 -0
  26. package/src/core/elements/marketing.ts +1490 -0
  27. package/src/core/elements/widgets.ts +28 -3
  28. package/src/core/export/runtimes.generated.ts +5 -0
  29. package/src/core/export/site.ts +5 -0
  30. package/src/core/import/elementor/widgets.ts +418 -281
  31. package/src/core/limits.ts +6 -0
  32. package/src/core/render/index.ts +21 -1
  33. package/src/core/render/vnode.ts +1 -1
  34. package/src/core/schema/layout.ts +420 -17
  35. package/src/core/theme/dynamic.ts +2 -0
  36. package/src/server/plugin.ts +2 -1
@@ -13,6 +13,12 @@ export const MAX_SOCIAL_LINKS = 20;
13
13
  export const MAX_GALLERY_IMAGES = 60;
14
14
  /** W-1018: most slides one Carousel holds. */
15
15
  export const MAX_CAROUSEL_SLIDES = 20;
16
+ /** W-1043: most rows one Price list holds. */
17
+ export const MAX_PRICE_ITEMS = 50;
18
+ /** W-1047: most share links one Share buttons element holds. */
19
+ export const MAX_SHARE_LINKS = 12;
20
+ /** W-1048: most markers one Hotspots picture holds. */
21
+ export const MAX_HOTSPOTS = 20;
16
22
 
17
23
  /**
18
24
  * W-509: `text` cut to at most `max` UTF-16 units, as schema limits count, without leaving half
@@ -1,7 +1,7 @@
1
1
  import { isShadowingId } from "../shadowing-ids.ts";
2
2
  import { renderableDesign, renderableDynamic, renderableLayout } from "../contract.ts";
3
3
  import { markColors } from "../text-marks.ts";
4
- import type { TextMark } from "../schema/layout.ts";
4
+ import type { HotspotNode, ShareLinkNode, TextMark } from "../schema/layout.ts";
5
5
  import { LIST_MARKERS } from "../css-keywords.ts";
6
6
  import { MAX_NODES } from "../limits.ts";
7
7
  import { loneAbTests, variantShows } from "../audience/variants.ts";
@@ -17,6 +17,7 @@ import {
17
17
  } from "../css/scope.ts";
18
18
  import { ELEMENTS } from "../elements/index.ts";
19
19
  import { nodeRuntime, type WidgetRuntime } from "../elements/widgets.ts";
20
+ import { hotspotPlace, shareLinkVNode } from "../elements/marketing.ts";
20
21
  import { controlId } from "../elements/field-id.ts";
21
22
  import { layoutHasForm } from "../forms/binding.ts";
22
23
  import { nodeChildren, someNode } from "../tree-ops.ts";
@@ -487,6 +488,13 @@ export function renderPage(
487
488
  declarations.push({ property: "gap", value: `${gap}px` });
488
489
  }
489
490
  }
491
+ if (node.type === "hotspot") {
492
+ // W-1048: each marker sits at its own place on the picture, per device.
493
+ const place = hotspotPlace(node.props as HotspotNode["props"]);
494
+ declarations.push(...placeAt(place.desktop));
495
+ if (place.tablet.length > 0) tablet.declarations.unshift(...placeAt(place.tablet));
496
+ if (place.mobile.length > 0) mobile.declarations.unshift(...placeAt(place.mobile));
497
+ }
490
498
  const queryStyle = node.query ? styleDeclarations(node.query.style) : undefined;
491
499
  for (const key of queryStyle?.rejected ?? []) {
492
500
  warnings.push({ nodeId, code: "rejected-style", detail: key });
@@ -684,6 +692,12 @@ export function renderPage(
684
692
  );
685
693
  }
686
694
  if (isTabsNode(node)) return finish(node, renderTabs(node, id, attrs, ctx, dynamic));
695
+ // W-1047: share links point at this page; a public page without its address shows none.
696
+ if (node.type === "share-link") {
697
+ const url = dynamic?.pageUrl ?? (mode === "editor" ? "https://example.com/" : undefined);
698
+ if (!url) return undefined;
699
+ return finish(node, shareLinkVNode(node as ShareLinkNode, attrs, url));
700
+ }
687
701
  if (node.type === "language-switcher") {
688
702
  const links = languageLinks(dynamic?.translations, mode);
689
703
  // W-937: a page in one language has nothing to switch to; the public page shows nothing.
@@ -851,6 +865,12 @@ const columnCount = (tracks: unknown, columns: unknown): number | undefined =>
851
865
  : undefined;
852
866
 
853
867
  /** A grid's column count on desktop, tablet and mobile; unset follows the next wider device. */
868
+ /** W-1048: a Hotspot marker's left and top. */
869
+ const placeAt = ([left, top]: string[]) => [
870
+ { property: "left", value: left ?? "50%" },
871
+ { property: "top", value: top ?? "50%" },
872
+ ];
873
+
854
874
  function gridColumnCounts(grid: LayoutNode): [number, number, number] {
855
875
  const props = grid.props as Record<string, unknown>;
856
876
  const desktop = columnCount(props["columnTracks"], props["columns"]) ?? 1;
@@ -78,7 +78,7 @@ const TAGS = new Set([
78
78
  const VOID = new Set(["hr", "img", "input", "br"]);
79
79
  // iframe/video are not void — they need closing tags.
80
80
  const ATTR_NAME =
81
- /^(?:class|id|href|src|srcset|sizes|alt|width|height|loading|decoding|fetchpriority|dir|lang|hreflang|role|type|checked|target|rel|aria-[a-z][a-z0-9-]*|title|allow|referrerpolicy|preload|controls|allowfullscreen|sandbox|xmlns|viewBox|fill|stroke|stroke-width|stroke-linecap|stroke-linejoin|stroke-dasharray|stroke-opacity|fill-opacity|opacity|transform|focusable|d|cx|cy|r|x|y|x1|y1|x2|y2|points|rx|ry|xlink:href|preserveAspectRatio|gradientUnits|gradientTransform|offset|stop-color|stop-opacity|clipPathUnits|maskUnits|maskContentUnits|patternUnits|patternContentUnits|patternTransform|markerUnits|markerWidth|markerHeight|refX|refY|orient|font-size|font-family|font-weight|text-anchor|dominant-baseline|dx|dy|clip-path|mask|method|action|name|value|placeholder|for|tabindex|autocomplete|open|datetime|muted|loop|playsinline|autoplay|required|novalidate|minlength|maxlength|min|max|pattern|step|start|data-[a-z][a-z0-9-]*)$/;
81
+ /^(?:class|id|href|src|srcset|sizes|alt|width|height|loading|decoding|fetchpriority|dir|lang|hreflang|role|type|checked|target|rel|aria-[a-z][a-z0-9-]*|title|allow|referrerpolicy|preload|controls|allowfullscreen|sandbox|xmlns|viewBox|fill|stroke|stroke-width|stroke-linecap|stroke-linejoin|stroke-dasharray|stroke-opacity|fill-opacity|opacity|transform|focusable|d|cx|cy|r|x|y|x1|y1|x2|y2|points|rx|ry|xlink:href|preserveAspectRatio|gradientUnits|gradientTransform|offset|stop-color|stop-opacity|clipPathUnits|maskUnits|maskContentUnits|patternUnits|patternContentUnits|patternTransform|markerUnits|markerWidth|markerHeight|refX|refY|orient|font-size|font-family|font-weight|text-anchor|dominant-baseline|dx|dy|clip-path|mask|method|action|name|value|placeholder|for|tabindex|autocomplete|open|popover|popovertarget|popovertargetaction|datetime|muted|loop|playsinline|autoplay|required|novalidate|minlength|maxlength|min|max|pattern|step|start|data-[a-z][a-z0-9-]*)$/;
82
82
 
83
83
  export const isAllowedTag = (tag: string) => TAGS.has(tag);
84
84
  export const isAllowedAttr = (name: string) => ATTR_NAME.test(name);
@@ -782,6 +782,20 @@ export const KNOWN_ELEMENT_TYPES = [
782
782
  "gallery-image",
783
783
  "carousel",
784
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",
785
799
  ] as const;
786
800
 
787
801
  /** Headings on this page, as a list of links. No script (W-345). */
@@ -843,6 +857,148 @@ export const AlertNode = leafNode(
843
857
  }),
844
858
  );
845
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
+
846
1002
  /** W-1020: where a media box puts its icon or image: above, or before or after the words. */
847
1003
  export const MEDIA_BOX_POSITIONS = ["top", "left", "right"] as const;
848
1004
 
@@ -876,6 +1032,15 @@ export const IconBoxNode = leafNode(
876
1032
  /** W-1021: how much of the box's width an image box's picture takes when beside the words. */
877
1033
  export const IMAGE_BOX_SIZES = ["small", "medium", "large", "full"] as const;
878
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
+
879
1044
  /**
880
1045
  * W-1021: a picture above (or beside) a title and text, like Elementor's Image Box. The picture
881
1046
  * keys are an Image's, so the media library fills them the same way; alt text is required unless
@@ -887,11 +1052,7 @@ export const ImageBoxNode = leafNode(
887
1052
  src: z.string().max(2000),
888
1053
  alt: z.string().max(500),
889
1054
  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(),
1055
+ ...PICKED_MEDIA,
895
1056
  /** Beside the words: small 25 %, medium 40 %, large 60 % of the box. Unset = medium. */
896
1057
  imageSize: z.enum(IMAGE_BOX_SIZES).optional(),
897
1058
  ...MediaBoxText,
@@ -915,11 +1076,7 @@ export const TestimonialNode = leafNode(
915
1076
  src: z.string().max(2000).optional(),
916
1077
  /** Written by the media library; never rendered (the photo is beside the name). */
917
1078
  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(),
1079
+ ...PICKED_MEDIA,
923
1080
  /** Stars out of `ratingMax` (unset 5); no stars when unset. */
924
1081
  rating: z.number().min(0).max(MAX_RATING).optional(),
925
1082
  ratingMax: z.number().int().min(1).max(MAX_RATING).optional(),
@@ -1005,11 +1162,7 @@ export const GalleryImageNode = leafNode(
1005
1162
  src: z.string().max(2000),
1006
1163
  alt: z.string().max(500),
1007
1164
  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(),
1165
+ ...PICKED_MEDIA,
1013
1166
  caption: z.string().max(500).optional(),
1014
1167
  }),
1015
1168
  ).refine((node) => node.props.decorative === true || node.props.alt.length > 0, {
@@ -1048,6 +1201,193 @@ export const CarouselSlideNode = parentNode(
1048
1201
  }),
1049
1202
  );
1050
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
+
1051
1391
  const knownTypeSet = new Set<string>(KNOWN_ELEMENT_TYPES);
1052
1392
 
1053
1393
  /**
@@ -1092,6 +1432,20 @@ const KnownLayoutNode = z.discriminatedUnion("type", [
1092
1432
  GalleryImageNode,
1093
1433
  CarouselNodeSchema,
1094
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,
1095
1449
  SpacerNode,
1096
1450
  DividerNode,
1097
1451
  TextNode,
@@ -1134,6 +1488,17 @@ export type TocNode = z.infer<typeof TocNode>;
1134
1488
  export type LanguageSwitcherNode = z.infer<typeof LanguageSwitcherNode>;
1135
1489
  export type RatingNode = z.infer<typeof RatingNode>;
1136
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>;
1137
1502
  export type IconBoxNode = z.infer<typeof IconBoxNode>;
1138
1503
  export type ImageBoxNode = z.infer<typeof ImageBoxNode>;
1139
1504
  export type TestimonialNode = z.infer<typeof TestimonialNode>;
@@ -1322,6 +1687,24 @@ export type CarouselSlideNode = NodeEnvelope & {
1322
1687
  children: LayoutNode[];
1323
1688
  };
1324
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
+
1325
1708
  export type GalleryNode = NodeEnvelope & {
1326
1709
  type: "gallery";
1327
1710
  props: z.infer<typeof GalleryNodeSchema>["props"];
@@ -1373,6 +1756,20 @@ export type LayoutNode =
1373
1756
  | GalleryImageNode
1374
1757
  | CarouselNode
1375
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
1376
1773
  | SpacerNode
1377
1774
  | DividerNode
1378
1775
  | TextNode
@@ -1587,7 +1984,10 @@ export const isParentNode = (
1587
1984
  | SocialIconsNode
1588
1985
  | GalleryNode
1589
1986
  | CarouselNode
1590
- | CarouselSlideNode =>
1987
+ | CarouselSlideNode
1988
+ | PriceListNode
1989
+ | ShareButtonsNode
1990
+ | HotspotsNode =>
1591
1991
  node.type === "container" ||
1592
1992
  node.type === "div-block" ||
1593
1993
  node.type === "layout-section" ||
@@ -1606,7 +2006,10 @@ export const isParentNode = (
1606
2006
  node.type === "social-icons" ||
1607
2007
  node.type === "gallery" ||
1608
2008
  node.type === "carousel" ||
1609
- node.type === "carousel-slide";
2009
+ node.type === "carousel-slide" ||
2010
+ node.type === "price-list" ||
2011
+ node.type === "share-buttons" ||
2012
+ node.type === "hotspots";
1610
2013
 
1611
2014
  export const isFormFieldType = (type: string): boolean =>
1612
2015
  (FORM_FIELD_TYPES as readonly string[]).includes(type);
@@ -70,6 +70,8 @@ export type ThemeDynamicData = {
70
70
  params?: Readonly<Record<string, string>>;
71
71
  /** The page's own origin, e.g. `https://example.com`: URL-parameter links stay on it (W-307). */
72
72
  origin?: string;
73
+ /** W-1047: this page's address, without its query, for Share buttons. Hosts fill this. */
74
+ pageUrl?: string;
73
75
  };
74
76
 
75
77
  /** Editor canvas placeholders when no live post is bound. */
@@ -33,7 +33,7 @@ import {
33
33
  pageAgentVersionsRoute,
34
34
  } from "./agent-settings.ts";
35
35
  import { canvasStyleUrls } from "../core/canvas-styles.ts";
36
- import { canvasCollectionSlugs } from "../core/canvas-collections.ts";
36
+ import { canvasCollectionSlugs, setCanvasCollections } from "../core/canvas-collections.ts";
37
37
  import { manifestsFromOptions } from "../core/extensions/index.ts";
38
38
  import { TOOLS } from "../mcp/tools.ts";
39
39
  import { mcpRoutes, mcpToolConfig } from "./mcp-routes.ts";
@@ -55,6 +55,7 @@ export function createPlugin(
55
55
  ) {
56
56
  setGeoTrust(options.trustGeoHeaders);
57
57
  setLoopCollections(options.loopCollections);
58
+ setCanvasCollections(options.canvasCollections);
58
59
  const canvasStyles = canvasStyleUrls(options.canvasStyles);
59
60
  const canvasCollections = canvasCollectionSlugs(options.canvasCollections);
60
61
  const extensions = manifestsFromOptions(options.extensions);