@drawbridge/components 0.1.46 → 0.1.48

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 (162) hide show
  1. package/dist/bridge/cart-drawer.js +152 -0
  2. package/dist/bridge/cart-drawer.mjs +123 -0
  3. package/dist/bridge/fields.js +278 -0
  4. package/dist/bridge/fields.mjs +276 -1
  5. package/dist/bridge/form-subdomain-checkout.js +687 -0
  6. package/dist/bridge/form-subdomain-checkout.mjs +665 -0
  7. package/dist/bridge/form-subdomain-shop-modal.js +234 -274
  8. package/dist/bridge/form-subdomain-shop-modal.mjs +233 -275
  9. package/dist/bridge/form-subdomain-shop.js +4 -1
  10. package/dist/bridge/form-subdomain-shop.mjs +4 -1
  11. package/dist/bridge/form-subdomain.js +24 -5
  12. package/dist/bridge/form-subdomain.mjs +25 -6
  13. package/dist/bridge/lib/age-gate.js +12 -0
  14. package/dist/bridge/lib/age-gate.mjs +11 -0
  15. package/dist/bridge/lib/cart.js +79 -0
  16. package/dist/bridge/lib/cart.mjs +48 -0
  17. package/dist/bridge/lib/checkout-kit.js +2 -32
  18. package/dist/bridge/lib/checkout-kit.mjs +2 -32
  19. package/dist/bridge/lib/entry.js +41 -0
  20. package/dist/bridge/lib/entry.mjs +40 -0
  21. package/dist/bridge/product-tile.js +13 -6
  22. package/dist/bridge/product-tile.mjs +13 -6
  23. package/dist/bridge/template-layout.js +263 -129
  24. package/dist/bridge/template-layout.mjs +264 -130
  25. package/dist/bridge/template-modal.js +39 -74
  26. package/dist/bridge/template-modal.mjs +40 -75
  27. package/dist/dashboard/avatar.js +2 -3
  28. package/dist/dashboard/avatar.mjs +2 -3
  29. package/dist/dashboard/buttons-subscription.js +1 -1
  30. package/dist/dashboard/buttons-subscription.mjs +1 -1
  31. package/dist/dashboard/campaign-form.js +179 -155
  32. package/dist/dashboard/campaign-form.mjs +179 -155
  33. package/dist/dashboard/campaign-share.js +347 -0
  34. package/dist/dashboard/campaign-share.mjs +314 -0
  35. package/dist/dashboard/card-affiliate.js +1 -1
  36. package/dist/dashboard/card-affiliate.mjs +1 -1
  37. package/dist/dashboard/card-campaign-switch.js +4 -1
  38. package/dist/dashboard/card-campaign-switch.mjs +4 -1
  39. package/dist/dashboard/card-order.js +22 -4
  40. package/dist/dashboard/card-order.mjs +22 -4
  41. package/dist/dashboard/embed-stripe.js +145 -0
  42. package/dist/dashboard/embed-stripe.mjs +116 -0
  43. package/dist/dashboard/form-admin-provider.js +71 -17
  44. package/dist/dashboard/form-admin-provider.mjs +71 -17
  45. package/dist/dashboard/form-file-upload.js +3 -2
  46. package/dist/dashboard/form-file-upload.mjs +4 -3
  47. package/dist/dashboard/form-organization-campaign-advertisements.js +47 -6
  48. package/dist/dashboard/form-organization-campaign-advertisements.mjs +47 -6
  49. package/dist/dashboard/form-organization-campaign-field-birthday.js +193 -0
  50. package/dist/dashboard/form-organization-campaign-field-birthday.mjs +164 -0
  51. package/dist/dashboard/form-organization-campaign-field-rating.js +246 -0
  52. package/dist/dashboard/form-organization-campaign-field-rating.mjs +217 -0
  53. package/dist/dashboard/form-organization-campaign-page.js +73 -39
  54. package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
  55. package/dist/dashboard/form-organization-campaign.js +82 -0
  56. package/dist/dashboard/form-organization-campaign.mjs +81 -0
  57. package/dist/dashboard/form-organization-connection.js +48 -6
  58. package/dist/dashboard/form-organization-connection.mjs +48 -7
  59. package/dist/dashboard/form-organization-product.js +1461 -0
  60. package/dist/dashboard/form-organization-product.mjs +1425 -0
  61. package/dist/dashboard/form-organization-workflow.js +72 -1
  62. package/dist/dashboard/form-organization-workflow.mjs +69 -1
  63. package/dist/dashboard/form-otc.js +4 -5
  64. package/dist/dashboard/form-otc.mjs +4 -5
  65. package/dist/dashboard/form-stripe.js +12 -5
  66. package/dist/dashboard/form-stripe.mjs +12 -5
  67. package/dist/dashboard/input-combobox.js +6 -0
  68. package/dist/dashboard/input-combobox.mjs +6 -0
  69. package/dist/dashboard/input-fields.js +37 -161
  70. package/dist/dashboard/input-fields.mjs +37 -161
  71. package/dist/dashboard/input-file.js +21 -4
  72. package/dist/dashboard/input-file.mjs +21 -4
  73. package/dist/dashboard/input-font.js +2 -0
  74. package/dist/dashboard/input-font.mjs +2 -0
  75. package/dist/dashboard/input-gallery.js +201 -0
  76. package/dist/dashboard/input-gallery.mjs +172 -0
  77. package/dist/dashboard/input-group-ai.js +15 -3
  78. package/dist/dashboard/input-group-ai.mjs +15 -3
  79. package/dist/dashboard/lib/ab-tests.js +2 -2
  80. package/dist/dashboard/lib/ab-tests.mjs +2 -2
  81. package/dist/dashboard/lib/connection-controls.js +5 -2
  82. package/dist/dashboard/lib/connection-controls.mjs +3 -1
  83. package/dist/dashboard/lib/form-page.js +1 -1
  84. package/dist/dashboard/lib/form-page.mjs +1 -1
  85. package/dist/dashboard/lib/menu.js +19 -0
  86. package/dist/dashboard/lib/menu.mjs +18 -0
  87. package/dist/dashboard/lib/products.js +169 -0
  88. package/dist/dashboard/lib/products.mjs +135 -0
  89. package/dist/dashboard/lib/settings-paths.js +35 -0
  90. package/dist/dashboard/lib/settings-paths.mjs +11 -0
  91. package/dist/dashboard/lib/uppy.js +10 -1
  92. package/dist/dashboard/lib/uppy.mjs +11 -2
  93. package/dist/dashboard/menu.js +13 -2
  94. package/dist/dashboard/menu.mjs +13 -2
  95. package/dist/dashboard/order-sections.js +456 -6
  96. package/dist/dashboard/order-sections.mjs +453 -7
  97. package/dist/dashboard/preview.js +119 -52
  98. package/dist/dashboard/preview.mjs +119 -52
  99. package/dist/dashboard/provider-ui.js +9 -7
  100. package/dist/dashboard/provider-ui.mjs +9 -7
  101. package/dist/dashboard/recharts.js +10 -4
  102. package/dist/dashboard/recharts.mjs +10 -4
  103. package/dist/dashboard/shipping-rates.js +404 -0
  104. package/dist/dashboard/shipping-rates.mjs +371 -0
  105. package/dist/dashboard/template-buyer.js +301 -0
  106. package/dist/dashboard/template-buyer.mjs +267 -0
  107. package/dist/dashboard/template-dashboard.js +11 -1
  108. package/dist/dashboard/template-dashboard.mjs +11 -1
  109. package/dist/dashboard/template-design.js +209 -130
  110. package/dist/dashboard/template-design.mjs +210 -131
  111. package/dist/dashboard/template-ui.js +157 -55
  112. package/dist/dashboard/template-ui.mjs +158 -56
  113. package/dist/icons/flags.js +134 -0
  114. package/dist/icons/flags.mjs +115 -0
  115. package/dist/input-checkbox.js +28 -10
  116. package/dist/input-checkbox.mjs +28 -10
  117. package/dist/product.js +96 -24
  118. package/dist/product.mjs +97 -25
  119. package/dist/shared/carousel.js +14 -5
  120. package/dist/shared/carousel.mjs +14 -5
  121. package/dist/shared/lib/helpers.js +54 -6
  122. package/dist/shared/lib/helpers.mjs +53 -8
  123. package/dist/shared/order-summary.js +139 -0
  124. package/dist/shared/order-summary.mjs +110 -0
  125. package/package.json +84 -4
  126. package/types/bridge/cart-drawer.d.ts +31 -0
  127. package/types/bridge/fields.d.ts +14 -2
  128. package/types/bridge/form-subdomain-checkout.d.ts +20 -0
  129. package/types/bridge/form-subdomain-shop-modal.d.ts +27 -3
  130. package/types/bridge/form-subdomain.d.ts +13 -0
  131. package/types/bridge/lib/age-gate.d.ts +5 -0
  132. package/types/bridge/lib/cart.d.ts +44 -0
  133. package/types/bridge/lib/checkout-kit.d.ts +2 -10
  134. package/types/bridge/lib/entry.d.ts +5 -0
  135. package/types/bridge/product-tile.d.ts +2 -0
  136. package/types/dashboard/campaign-share.d.ts +16 -0
  137. package/types/dashboard/card-order.d.ts +6 -0
  138. package/types/dashboard/embed-stripe.d.ts +25 -0
  139. package/types/dashboard/form-admin-provider.d.ts +9 -2
  140. package/types/dashboard/form-file-upload.d.ts +2 -1
  141. package/types/dashboard/form-organization-campaign-advertisements.d.ts +3 -0
  142. package/types/dashboard/form-organization-campaign-field-birthday.d.ts +31 -0
  143. package/types/dashboard/form-organization-campaign-field-rating.d.ts +33 -0
  144. package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
  145. package/types/dashboard/form-organization-campaign.d.ts +3 -0
  146. package/types/dashboard/form-organization-connection.d.ts +11 -0
  147. package/types/dashboard/form-organization-product.d.ts +24 -0
  148. package/types/dashboard/form-otc.d.ts +5 -1
  149. package/types/dashboard/form-stripe.d.ts +3 -2
  150. package/types/dashboard/input-combobox.d.ts +2 -0
  151. package/types/dashboard/input-file.d.ts +2 -0
  152. package/types/dashboard/input-gallery.d.ts +14 -0
  153. package/types/dashboard/lib/products.d.ts +14 -0
  154. package/types/dashboard/lib/settings-paths.d.ts +5 -0
  155. package/types/dashboard/order-sections.d.ts +24 -1
  156. package/types/dashboard/preview.d.ts +11 -3
  157. package/types/dashboard/shipping-rates.d.ts +26 -0
  158. package/types/dashboard/template-buyer.d.ts +50 -0
  159. package/types/icons/flags.d.ts +5 -0
  160. package/types/input-checkbox.d.ts +2 -0
  161. package/types/shared/lib/helpers.d.ts +4 -0
  162. package/types/shared/order-summary.d.ts +19 -0
@@ -172,6 +172,11 @@ const States = ({
172
172
  title: option.key
173
173
  }))
174
174
  ] : options.map((option) => nests(option) ? {
175
+ // Impeccable audit, 2026-11-21: the option shown is marked at the top too,
176
+ // as a nested one is, so the menu says what the preview holds.
177
+ ...option.value === top && {
178
+ "aria-current": true
179
+ },
175
180
  "aria-haspopup": "menu",
176
181
  element: "button",
177
182
  icon: import_chevron_right.default,
@@ -186,6 +191,10 @@ const States = ({
186
191
  }
187
192
  )
188
193
  } : {
194
+ ...option.value === top && {
195
+ "aria-current": true,
196
+ icon: import_check.default
197
+ },
189
198
  element: "button",
190
199
  onClick: () => onChange(nested ? [option.value] : option.value),
191
200
  title: option.key
@@ -474,7 +483,7 @@ const scrollerOf = (node) => {
474
483
  return page || null;
475
484
  };
476
485
  const fillHeight = ({ foot, gap, top }) => Math.max(0, Math.floor(foot - top - gap));
477
- const useFill = (box, open) => (0, import_react.useEffect)(() => {
486
+ const useFill = (box, open, inset = 0, property = "height") => (0, import_react.useEffect)(() => {
478
487
  const node = box.current;
479
488
  const page = scrollerOf(node);
480
489
  if (open || !node || !page) return void 0;
@@ -482,9 +491,9 @@ const useFill = (box, open) => (0, import_react.useEffect)(() => {
482
491
  const gap = parseFloat(getComputedStyle(page).paddingBottom) || 0;
483
492
  let frame;
484
493
  const read = () => {
485
- node.style.height = wide.matches ? fillHeight({
494
+ node.style[property] = wide.matches ? fillHeight({
486
495
  foot: page.getBoundingClientRect().bottom,
487
- gap,
496
+ gap: gap + inset,
488
497
  top: node.getBoundingClientRect().top
489
498
  }) + "px" : "";
490
499
  };
@@ -505,9 +514,9 @@ const useFill = (box, open) => (0, import_react.useEffect)(() => {
505
514
  observer.disconnect();
506
515
  wide.removeEventListener("change", measure);
507
516
  page.removeEventListener("scroll", measure);
508
- node.style.height = "";
517
+ node.style[property] = "";
509
518
  };
510
- }, [open]);
519
+ }, [open, inset, property]);
511
520
  const Slider = (0, import_react.createContext)(null);
512
521
  const useCard = (id) => {
513
522
  const slider = (0, import_react.useContext)(Slider);
@@ -532,14 +541,16 @@ const SliderLayout = ({
532
541
  blank,
533
542
  children,
534
543
  last,
544
+ page,
535
545
  plain,
536
546
  slides = [],
537
547
  style,
538
548
  zooms = ZOOMS
539
549
  }) => {
540
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
550
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
541
551
  const [nodes, setNodes] = (0, import_react.useState)({});
542
552
  const [picked, setPicked] = (0, import_react.useState)(null);
553
+ const paged = Boolean(page);
543
554
  const [states, setStates] = (0, import_react.useState)({});
544
555
  const [zoom, setZoom] = (0, import_react.useState)(zooms[0].value);
545
556
  const peek = usePeek();
@@ -550,25 +561,48 @@ const SliderLayout = ({
550
561
  const select = (id, node, target) => {
551
562
  if (!slides.some((slide) => slide.id === id)) return;
552
563
  setPicked(id);
553
- const page = scrollerOf(node);
554
- if (!page || !node || !pressScrolls(target, node) || !window.matchMedia(WIDE).matches) return;
555
- page.scrollTo({
564
+ const page2 = scrollerOf(node);
565
+ if (!page2 || !node || !pressScrolls(target, node) || !window.matchMedia(WIDE).matches) return;
566
+ page2.scrollTo({
556
567
  behavior: "smooth",
557
568
  top: scrollTarget({
558
569
  node: node.getBoundingClientRect().top,
559
- page: page.getBoundingClientRect().top,
560
- scrollTop: page.scrollTop
570
+ page: page2.getBoundingClientRect().top,
571
+ scrollTop: page2.scrollTop
561
572
  })
562
573
  });
563
574
  };
575
+ const picker = slides.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
576
+ States,
577
+ {
578
+ ...{
579
+ align: "start",
580
+ onChange: (path) => {
581
+ var _a2, _b2;
582
+ const [id, state] = [].concat(path);
583
+ select(id, (_a2 = layout.current) == null ? void 0 : _a2.querySelector('[data-slide="' + id + '"]'));
584
+ if (state !== void 0) (_b2 = states[id]) == null ? void 0 : _b2.onChange(state);
585
+ },
586
+ options: slides.map((slide) => {
587
+ var _a2;
588
+ return {
589
+ key: slide.title,
590
+ options: (_a2 = states[slide.id]) == null ? void 0 : _a2.options,
591
+ value: slide.id
592
+ };
593
+ }),
594
+ value: [current == null ? void 0 : current.id, (_a = states[current == null ? void 0 : current.id]) == null ? void 0 : _a.value]
595
+ }
596
+ }
597
+ );
564
598
  useFill(peek.pane, peek.open);
565
599
  useFit(blank ? null : shown, zoom);
566
600
  (0, import_react.useEffect)(() => {
567
601
  if (cards.current) cards.current.inert = peek.open;
568
602
  }, [peek.open]);
569
603
  const register = (0, import_react.useCallback)((id, own) => setStates((list) => {
570
- var _a2, _b2;
571
- return ((_a2 = list[id]) == null ? void 0 : _a2.value) === (own == null ? void 0 : own.value) && ((_b2 = list[id]) == null ? void 0 : _b2.options) === (own == null ? void 0 : own.options) ? list : {
604
+ var _a2, _b2, _c2;
605
+ return ((_a2 = list[id]) == null ? void 0 : _a2.value) === (own == null ? void 0 : own.value) && ((_b2 = list[id]) == null ? void 0 : _b2.options) === (own == null ? void 0 : own.options) && ((_c2 = list[id]) == null ? void 0 : _c2.page) === (own == null ? void 0 : own.page) ? list : {
572
606
  ...list,
573
607
  [id]: own
574
608
  };
@@ -606,32 +640,7 @@ const SliderLayout = ({
606
640
  // cards; drawn on the right, in view as the page scrolls ( useFill ).
607
641
  "data-preview-panel": true,
608
642
  className: "xl:sticky xl:top-0 xl:order-last min-w-0 xl:min-h-[480px] xl:rounded",
609
- // The one step picker, each step's own states nested under it ( Darren,
610
- // 2026-11-15 ). No steps yet ( a chain with none ): no chips, and the
611
- // panel says there is nothing to preview.
612
- left: slides.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
613
- States,
614
- {
615
- ...{
616
- align: "start",
617
- onChange: (path) => {
618
- var _a2, _b2;
619
- const [id, state] = [].concat(path);
620
- select(id, (_a2 = layout.current) == null ? void 0 : _a2.querySelector('[data-slide="' + id + '"]'));
621
- if (state !== void 0) (_b2 = states[id]) == null ? void 0 : _b2.onChange(state);
622
- },
623
- options: slides.map((slide) => {
624
- var _a2;
625
- return {
626
- key: slide.title,
627
- options: (_a2 = states[slide.id]) == null ? void 0 : _a2.options,
628
- value: slide.id
629
- };
630
- }),
631
- value: [current == null ? void 0 : current.id, (_a = states[current == null ? void 0 : current.id]) == null ? void 0 : _a.value]
632
- }
633
- }
634
- ),
643
+ left: picker,
635
644
  peek,
636
645
  right: slides.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
637
646
  View,
@@ -645,7 +654,11 @@ const SliderLayout = ({
645
654
  ),
646
655
  style: {
647
656
  backgroundColor: plain ? void 0 : ((_c = (_b = style == null ? void 0 : style.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || ((_e = (_d = style == null ? void 0 : style.background) == null ? void 0 : _d.color) == null ? void 0 : _e.hex),
648
- color: plain ? void 0 : ((_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb) || ((_i = (_h = style == null ? void 0 : style.text) == null ? void 0 : _h.color) == null ? void 0 : _i.hex)
657
+ color: plain ? void 0 : ((_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb) || ((_i = (_h = style == null ? void 0 : style.text) == null ? void 0 : _h.color) == null ? void 0 : _i.hex),
658
+ // Hidden under the real page; the steps still register their states in it.
659
+ ...paged && {
660
+ display: "none"
661
+ }
649
662
  }
650
663
  },
651
664
  children: [
@@ -671,6 +684,31 @@ const SliderLayout = ({
671
684
  ]
672
685
  }
673
686
  ),
687
+ paged && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
688
+ "div",
689
+ {
690
+ ...{
691
+ className: "min-w-0 xl:sticky xl:top-0 xl:order-last"
692
+ },
693
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
694
+ PreviewPage,
695
+ {
696
+ ...{
697
+ left: picker,
698
+ open: {
699
+ ...((_j = states[current == null ? void 0 : current.id]) == null ? void 0 : _j.page) && {
700
+ panel: JSON.parse(states[current.id].page)
701
+ },
702
+ state: (_k = states[current == null ? void 0 : current.id]) == null ? void 0 : _k.value,
703
+ step: current == null ? void 0 : current.id
704
+ },
705
+ url: page.url,
706
+ version: page.version
707
+ }
708
+ }
709
+ )
710
+ }
711
+ ),
674
712
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
675
713
  "div",
676
714
  {
@@ -679,7 +717,7 @@ const SliderLayout = ({
679
717
  className: "min-w-0"
680
718
  },
681
719
  children: [
682
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
720
+ !paged && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
683
721
  PeekButton,
684
722
  {
685
723
  ...{
@@ -708,13 +746,18 @@ const SliderLayout = ({
708
746
  const Preview = ({
709
747
  children,
710
748
  id,
749
+ page,
711
750
  states
712
751
  }) => {
713
752
  const slider = (0, import_react.useContext)(Slider);
714
753
  const register = slider == null ? void 0 : slider.register;
754
+ const drawn = page ? JSON.stringify(page) : void 0;
715
755
  (0, import_react.useEffect)(() => {
716
- register == null ? void 0 : register(id, states);
717
- }, [id, register, states == null ? void 0 : states.onChange, states == null ? void 0 : states.options, states == null ? void 0 : states.value]);
756
+ register == null ? void 0 : register(id, {
757
+ ...states,
758
+ page: drawn
759
+ });
760
+ }, [drawn, id, register, states == null ? void 0 : states.onChange, states == null ? void 0 : states.options, states == null ? void 0 : states.value]);
718
761
  if (!slider) return null;
719
762
  return slider.nodes[id] && (0, import_react_dom.createPortal)(
720
763
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children }) }),
@@ -773,8 +816,10 @@ const PreviewPage = ({
773
816
  fill = true,
774
817
  html,
775
818
  left,
819
+ open,
776
820
  update,
777
821
  url,
822
+ version,
778
823
  zooms = ZOOMS
779
824
  }) => {
780
825
  const area = (0, import_react.useRef)(null);
@@ -790,17 +835,32 @@ const PreviewPage = ({
790
835
  const [zoom, setZoom] = (0, import_react.useState)(zooms[0].value);
791
836
  const peek = usePeek();
792
837
  const [previous, setPrevious] = (0, import_react.useState)(url);
838
+ const [loaded, setLoaded] = (0, import_react.useState)(version);
793
839
  if (previous !== url) {
794
840
  setPrevious(url);
795
841
  setLoading(true);
796
842
  }
843
+ if (loaded !== version) {
844
+ setLoaded(version);
845
+ setLoading(true);
846
+ }
847
+ const applied = (0, import_react.useRef)(version);
848
+ (0, import_react.useEffect)(() => {
849
+ if (applied.current === version) return;
850
+ applied.current = version;
851
+ if (frame.current && url) frame.current.src = url;
852
+ }, [version]);
797
853
  const { height, width } = url ? SIZES.find((item) => item.key === size) : {
798
854
  height: tall,
799
- width: MAIL
855
+ width: size === "phone" ? SIZES[0].width : MAIL
800
856
  };
801
857
  const scale = zoom === "fit" ? fitScale(space, { height, width }) : zoom;
802
- const origin = url ? new URL(url).origin : null;
803
- const message = JSON.stringify({ update });
858
+ const origin = url && URL.canParse(url) ? new URL(url).origin : null;
859
+ const none = Boolean(url) ? !origin : typeof html !== "string";
860
+ const message = JSON.stringify({
861
+ open,
862
+ update
863
+ });
804
864
  const post = () => {
805
865
  var _a, _b;
806
866
  return origin && origin !== "null" && ((_b = (_a = frame.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(JSON.parse(message), origin));
@@ -858,9 +918,7 @@ const PreviewPage = ({
858
918
  View,
859
919
  {
860
920
  ...{
861
- ...url && {
862
- onSize: setSize
863
- },
921
+ onSize: setSize,
864
922
  onZoom: setZoom,
865
923
  size,
866
924
  zoom,
@@ -877,7 +935,16 @@ const PreviewPage = ({
877
935
  ref: area
878
936
  },
879
937
  children: [
880
- url && loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
938
+ none && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
939
+ "div",
940
+ {
941
+ ...{
942
+ className: "absolute inset-0 flex items-center justify-center"
943
+ },
944
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NoPreview, {})
945
+ }
946
+ ),
947
+ url && !none && loading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
881
948
  import_loader.default,
882
949
  {
883
950
  ...{
@@ -889,7 +956,7 @@ const PreviewPage = ({
889
956
  "div",
890
957
  {
891
958
  ...{
892
- className: "origin-top-left",
959
+ className: "origin-top-left" + (none ? " hidden" : ""),
893
960
  ref: screen,
894
961
  style: {
895
962
  ...url && {
@@ -904,7 +971,7 @@ const PreviewPage = ({
904
971
  width
905
972
  }
906
973
  },
907
- children: url ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
974
+ children: url && !none ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
908
975
  "iframe",
909
976
  {
910
977
  ...{
@@ -124,6 +124,11 @@ const States = ({
124
124
  title: option.key
125
125
  }))
126
126
  ] : options.map((option) => nests(option) ? {
127
+ // Impeccable audit, 2026-11-21: the option shown is marked at the top too,
128
+ // as a nested one is, so the menu says what the preview holds.
129
+ ...option.value === top && {
130
+ "aria-current": true
131
+ },
127
132
  "aria-haspopup": "menu",
128
133
  element: "button",
129
134
  icon: ChevronRight,
@@ -138,6 +143,10 @@ const States = ({
138
143
  }
139
144
  )
140
145
  } : {
146
+ ...option.value === top && {
147
+ "aria-current": true,
148
+ icon: Check
149
+ },
141
150
  element: "button",
142
151
  onClick: () => onChange(nested ? [option.value] : option.value),
143
152
  title: option.key
@@ -426,7 +435,7 @@ const scrollerOf = (node) => {
426
435
  return page || null;
427
436
  };
428
437
  const fillHeight = ({ foot, gap, top }) => Math.max(0, Math.floor(foot - top - gap));
429
- const useFill = (box, open) => useEffect(() => {
438
+ const useFill = (box, open, inset = 0, property = "height") => useEffect(() => {
430
439
  const node = box.current;
431
440
  const page = scrollerOf(node);
432
441
  if (open || !node || !page) return void 0;
@@ -434,9 +443,9 @@ const useFill = (box, open) => useEffect(() => {
434
443
  const gap = parseFloat(getComputedStyle(page).paddingBottom) || 0;
435
444
  let frame;
436
445
  const read = () => {
437
- node.style.height = wide.matches ? fillHeight({
446
+ node.style[property] = wide.matches ? fillHeight({
438
447
  foot: page.getBoundingClientRect().bottom,
439
- gap,
448
+ gap: gap + inset,
440
449
  top: node.getBoundingClientRect().top
441
450
  }) + "px" : "";
442
451
  };
@@ -457,9 +466,9 @@ const useFill = (box, open) => useEffect(() => {
457
466
  observer.disconnect();
458
467
  wide.removeEventListener("change", measure);
459
468
  page.removeEventListener("scroll", measure);
460
- node.style.height = "";
469
+ node.style[property] = "";
461
470
  };
462
- }, [open]);
471
+ }, [open, inset, property]);
463
472
  const Slider = createContext(null);
464
473
  const useCard = (id) => {
465
474
  const slider = useContext(Slider);
@@ -484,14 +493,16 @@ const SliderLayout = ({
484
493
  blank,
485
494
  children,
486
495
  last,
496
+ page,
487
497
  plain,
488
498
  slides = [],
489
499
  style,
490
500
  zooms = ZOOMS
491
501
  }) => {
492
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
502
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
493
503
  const [nodes, setNodes] = useState({});
494
504
  const [picked, setPicked] = useState(null);
505
+ const paged = Boolean(page);
495
506
  const [states, setStates] = useState({});
496
507
  const [zoom, setZoom] = useState(zooms[0].value);
497
508
  const peek = usePeek();
@@ -502,25 +513,48 @@ const SliderLayout = ({
502
513
  const select = (id, node, target) => {
503
514
  if (!slides.some((slide) => slide.id === id)) return;
504
515
  setPicked(id);
505
- const page = scrollerOf(node);
506
- if (!page || !node || !pressScrolls(target, node) || !window.matchMedia(WIDE).matches) return;
507
- page.scrollTo({
516
+ const page2 = scrollerOf(node);
517
+ if (!page2 || !node || !pressScrolls(target, node) || !window.matchMedia(WIDE).matches) return;
518
+ page2.scrollTo({
508
519
  behavior: "smooth",
509
520
  top: scrollTarget({
510
521
  node: node.getBoundingClientRect().top,
511
- page: page.getBoundingClientRect().top,
512
- scrollTop: page.scrollTop
522
+ page: page2.getBoundingClientRect().top,
523
+ scrollTop: page2.scrollTop
513
524
  })
514
525
  });
515
526
  };
527
+ const picker = slides.length > 0 && /* @__PURE__ */ jsx(
528
+ States,
529
+ {
530
+ ...{
531
+ align: "start",
532
+ onChange: (path) => {
533
+ var _a2, _b2;
534
+ const [id, state] = [].concat(path);
535
+ select(id, (_a2 = layout.current) == null ? void 0 : _a2.querySelector('[data-slide="' + id + '"]'));
536
+ if (state !== void 0) (_b2 = states[id]) == null ? void 0 : _b2.onChange(state);
537
+ },
538
+ options: slides.map((slide) => {
539
+ var _a2;
540
+ return {
541
+ key: slide.title,
542
+ options: (_a2 = states[slide.id]) == null ? void 0 : _a2.options,
543
+ value: slide.id
544
+ };
545
+ }),
546
+ value: [current == null ? void 0 : current.id, (_a = states[current == null ? void 0 : current.id]) == null ? void 0 : _a.value]
547
+ }
548
+ }
549
+ );
516
550
  useFill(peek.pane, peek.open);
517
551
  useFit(blank ? null : shown, zoom);
518
552
  useEffect(() => {
519
553
  if (cards.current) cards.current.inert = peek.open;
520
554
  }, [peek.open]);
521
555
  const register = useCallback((id, own) => setStates((list) => {
522
- var _a2, _b2;
523
- return ((_a2 = list[id]) == null ? void 0 : _a2.value) === (own == null ? void 0 : own.value) && ((_b2 = list[id]) == null ? void 0 : _b2.options) === (own == null ? void 0 : own.options) ? list : {
556
+ var _a2, _b2, _c2;
557
+ return ((_a2 = list[id]) == null ? void 0 : _a2.value) === (own == null ? void 0 : own.value) && ((_b2 = list[id]) == null ? void 0 : _b2.options) === (own == null ? void 0 : own.options) && ((_c2 = list[id]) == null ? void 0 : _c2.page) === (own == null ? void 0 : own.page) ? list : {
524
558
  ...list,
525
559
  [id]: own
526
560
  };
@@ -558,32 +592,7 @@ const SliderLayout = ({
558
592
  // cards; drawn on the right, in view as the page scrolls ( useFill ).
559
593
  "data-preview-panel": true,
560
594
  className: "xl:sticky xl:top-0 xl:order-last min-w-0 xl:min-h-[480px] xl:rounded",
561
- // The one step picker, each step's own states nested under it ( Darren,
562
- // 2026-11-15 ). No steps yet ( a chain with none ): no chips, and the
563
- // panel says there is nothing to preview.
564
- left: slides.length > 0 && /* @__PURE__ */ jsx(
565
- States,
566
- {
567
- ...{
568
- align: "start",
569
- onChange: (path) => {
570
- var _a2, _b2;
571
- const [id, state] = [].concat(path);
572
- select(id, (_a2 = layout.current) == null ? void 0 : _a2.querySelector('[data-slide="' + id + '"]'));
573
- if (state !== void 0) (_b2 = states[id]) == null ? void 0 : _b2.onChange(state);
574
- },
575
- options: slides.map((slide) => {
576
- var _a2;
577
- return {
578
- key: slide.title,
579
- options: (_a2 = states[slide.id]) == null ? void 0 : _a2.options,
580
- value: slide.id
581
- };
582
- }),
583
- value: [current == null ? void 0 : current.id, (_a = states[current == null ? void 0 : current.id]) == null ? void 0 : _a.value]
584
- }
585
- }
586
- ),
595
+ left: picker,
587
596
  peek,
588
597
  right: slides.length > 0 && /* @__PURE__ */ jsx(
589
598
  View,
@@ -597,7 +606,11 @@ const SliderLayout = ({
597
606
  ),
598
607
  style: {
599
608
  backgroundColor: plain ? void 0 : ((_c = (_b = style == null ? void 0 : style.background) == null ? void 0 : _b.color) == null ? void 0 : _c.rgb) || ((_e = (_d = style == null ? void 0 : style.background) == null ? void 0 : _d.color) == null ? void 0 : _e.hex),
600
- color: plain ? void 0 : ((_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb) || ((_i = (_h = style == null ? void 0 : style.text) == null ? void 0 : _h.color) == null ? void 0 : _i.hex)
609
+ color: plain ? void 0 : ((_g = (_f = style == null ? void 0 : style.text) == null ? void 0 : _f.color) == null ? void 0 : _g.rgb) || ((_i = (_h = style == null ? void 0 : style.text) == null ? void 0 : _h.color) == null ? void 0 : _i.hex),
610
+ // Hidden under the real page; the steps still register their states in it.
611
+ ...paged && {
612
+ display: "none"
613
+ }
601
614
  }
602
615
  },
603
616
  children: [
@@ -623,6 +636,31 @@ const SliderLayout = ({
623
636
  ]
624
637
  }
625
638
  ),
639
+ paged && /* @__PURE__ */ jsx(
640
+ "div",
641
+ {
642
+ ...{
643
+ className: "min-w-0 xl:sticky xl:top-0 xl:order-last"
644
+ },
645
+ children: /* @__PURE__ */ jsx(
646
+ PreviewPage,
647
+ {
648
+ ...{
649
+ left: picker,
650
+ open: {
651
+ ...((_j = states[current == null ? void 0 : current.id]) == null ? void 0 : _j.page) && {
652
+ panel: JSON.parse(states[current.id].page)
653
+ },
654
+ state: (_k = states[current == null ? void 0 : current.id]) == null ? void 0 : _k.value,
655
+ step: current == null ? void 0 : current.id
656
+ },
657
+ url: page.url,
658
+ version: page.version
659
+ }
660
+ }
661
+ )
662
+ }
663
+ ),
626
664
  /* @__PURE__ */ jsxs(
627
665
  "div",
628
666
  {
@@ -631,7 +669,7 @@ const SliderLayout = ({
631
669
  className: "min-w-0"
632
670
  },
633
671
  children: [
634
- /* @__PURE__ */ jsx(
672
+ !paged && /* @__PURE__ */ jsx(
635
673
  PeekButton,
636
674
  {
637
675
  ...{
@@ -660,13 +698,18 @@ const SliderLayout = ({
660
698
  const Preview = ({
661
699
  children,
662
700
  id,
701
+ page,
663
702
  states
664
703
  }) => {
665
704
  const slider = useContext(Slider);
666
705
  const register = slider == null ? void 0 : slider.register;
706
+ const drawn = page ? JSON.stringify(page) : void 0;
667
707
  useEffect(() => {
668
- register == null ? void 0 : register(id, states);
669
- }, [id, register, states == null ? void 0 : states.onChange, states == null ? void 0 : states.options, states == null ? void 0 : states.value]);
708
+ register == null ? void 0 : register(id, {
709
+ ...states,
710
+ page: drawn
711
+ });
712
+ }, [drawn, id, register, states == null ? void 0 : states.onChange, states == null ? void 0 : states.options, states == null ? void 0 : states.value]);
670
713
  if (!slider) return null;
671
714
  return slider.nodes[id] && createPortal(
672
715
  /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { children }) }),
@@ -725,8 +768,10 @@ const PreviewPage = ({
725
768
  fill = true,
726
769
  html,
727
770
  left,
771
+ open,
728
772
  update,
729
773
  url,
774
+ version,
730
775
  zooms = ZOOMS
731
776
  }) => {
732
777
  const area = useRef(null);
@@ -742,17 +787,32 @@ const PreviewPage = ({
742
787
  const [zoom, setZoom] = useState(zooms[0].value);
743
788
  const peek = usePeek();
744
789
  const [previous, setPrevious] = useState(url);
790
+ const [loaded, setLoaded] = useState(version);
745
791
  if (previous !== url) {
746
792
  setPrevious(url);
747
793
  setLoading(true);
748
794
  }
795
+ if (loaded !== version) {
796
+ setLoaded(version);
797
+ setLoading(true);
798
+ }
799
+ const applied = useRef(version);
800
+ useEffect(() => {
801
+ if (applied.current === version) return;
802
+ applied.current = version;
803
+ if (frame.current && url) frame.current.src = url;
804
+ }, [version]);
749
805
  const { height, width } = url ? SIZES.find((item) => item.key === size) : {
750
806
  height: tall,
751
- width: MAIL
807
+ width: size === "phone" ? SIZES[0].width : MAIL
752
808
  };
753
809
  const scale = zoom === "fit" ? fitScale(space, { height, width }) : zoom;
754
- const origin = url ? new URL(url).origin : null;
755
- const message = JSON.stringify({ update });
810
+ const origin = url && URL.canParse(url) ? new URL(url).origin : null;
811
+ const none = Boolean(url) ? !origin : typeof html !== "string";
812
+ const message = JSON.stringify({
813
+ open,
814
+ update
815
+ });
756
816
  const post = () => {
757
817
  var _a, _b;
758
818
  return origin && origin !== "null" && ((_b = (_a = frame.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(JSON.parse(message), origin));
@@ -810,9 +870,7 @@ const PreviewPage = ({
810
870
  View,
811
871
  {
812
872
  ...{
813
- ...url && {
814
- onSize: setSize
815
- },
873
+ onSize: setSize,
816
874
  onZoom: setZoom,
817
875
  size,
818
876
  zoom,
@@ -829,7 +887,16 @@ const PreviewPage = ({
829
887
  ref: area
830
888
  },
831
889
  children: [
832
- url && loading && /* @__PURE__ */ jsx(
890
+ none && /* @__PURE__ */ jsx(
891
+ "div",
892
+ {
893
+ ...{
894
+ className: "absolute inset-0 flex items-center justify-center"
895
+ },
896
+ children: /* @__PURE__ */ jsx(NoPreview, {})
897
+ }
898
+ ),
899
+ url && !none && loading && /* @__PURE__ */ jsx(
833
900
  LoaderComponent,
834
901
  {
835
902
  ...{
@@ -841,7 +908,7 @@ const PreviewPage = ({
841
908
  "div",
842
909
  {
843
910
  ...{
844
- className: "origin-top-left",
911
+ className: "origin-top-left" + (none ? " hidden" : ""),
845
912
  ref: screen,
846
913
  style: {
847
914
  ...url && {
@@ -856,7 +923,7 @@ const PreviewPage = ({
856
923
  width
857
924
  }
858
925
  },
859
- children: url ? /* @__PURE__ */ jsx(
926
+ children: url && !none ? /* @__PURE__ */ jsx(
860
927
  "iframe",
861
928
  {
862
929
  ...{