@drawbridge/components 0.1.45 → 0.1.47

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 (63) hide show
  1. package/dist/bridge/form-subdomain-shop.js +4 -1
  2. package/dist/bridge/form-subdomain-shop.mjs +4 -1
  3. package/dist/bridge/form-subdomain.js +23 -5
  4. package/dist/bridge/form-subdomain.mjs +23 -5
  5. package/dist/bridge/lib/entry.js +41 -0
  6. package/dist/bridge/lib/entry.mjs +40 -0
  7. package/dist/bridge/product-tile.js +4 -0
  8. package/dist/bridge/product-tile.mjs +4 -0
  9. package/dist/bridge/template-layout.js +27 -8
  10. package/dist/bridge/template-layout.mjs +28 -9
  11. package/dist/bridge/template-modal.js +11 -1
  12. package/dist/bridge/template-modal.mjs +11 -1
  13. package/dist/dashboard/avatar.js +2 -3
  14. package/dist/dashboard/avatar.mjs +2 -3
  15. package/dist/dashboard/campaign-form.js +172 -153
  16. package/dist/dashboard/campaign-form.mjs +172 -153
  17. package/dist/dashboard/campaign-share.js +347 -0
  18. package/dist/dashboard/campaign-share.mjs +314 -0
  19. package/dist/dashboard/card-affiliate.js +1 -1
  20. package/dist/dashboard/card-affiliate.mjs +1 -1
  21. package/dist/dashboard/card-campaign-switch.js +4 -1
  22. package/dist/dashboard/card-campaign-switch.mjs +4 -1
  23. package/dist/dashboard/form-organization-campaign-field-item.js +4 -1
  24. package/dist/dashboard/form-organization-campaign-field-item.mjs +4 -1
  25. package/dist/dashboard/form-organization-campaign-page.js +73 -39
  26. package/dist/dashboard/form-organization-campaign-page.mjs +73 -39
  27. package/dist/dashboard/input-combobox.js +6 -0
  28. package/dist/dashboard/input-combobox.mjs +6 -0
  29. package/dist/dashboard/input-fields.js +26 -3
  30. package/dist/dashboard/input-fields.mjs +26 -3
  31. package/dist/dashboard/input-font.js +2 -0
  32. package/dist/dashboard/input-font.mjs +2 -0
  33. package/dist/dashboard/input-group-ai.js +15 -3
  34. package/dist/dashboard/input-group-ai.mjs +15 -3
  35. package/dist/dashboard/lib/ab-tests.js +2 -2
  36. package/dist/dashboard/lib/ab-tests.mjs +2 -2
  37. package/dist/dashboard/lib/menu.js +19 -0
  38. package/dist/dashboard/lib/menu.mjs +18 -0
  39. package/dist/dashboard/menu.js +13 -2
  40. package/dist/dashboard/menu.mjs +13 -2
  41. package/dist/dashboard/preview.js +119 -52
  42. package/dist/dashboard/preview.mjs +119 -52
  43. package/dist/dashboard/recharts.js +10 -4
  44. package/dist/dashboard/recharts.mjs +10 -4
  45. package/dist/dashboard/template-dashboard.js +11 -1
  46. package/dist/dashboard/template-dashboard.mjs +11 -1
  47. package/dist/dashboard/template-design.js +209 -130
  48. package/dist/dashboard/template-design.mjs +210 -131
  49. package/dist/dashboard/template-ui.js +157 -55
  50. package/dist/dashboard/template-ui.mjs +158 -56
  51. package/dist/icons/flags.js +134 -0
  52. package/dist/icons/flags.mjs +115 -0
  53. package/dist/shared/carousel.js +14 -5
  54. package/dist/shared/carousel.mjs +14 -5
  55. package/package.json +11 -1
  56. package/types/bridge/form-subdomain.d.ts +13 -0
  57. package/types/bridge/lib/entry.d.ts +5 -0
  58. package/types/bridge/product-tile.d.ts +2 -0
  59. package/types/dashboard/campaign-share.d.ts +16 -0
  60. package/types/dashboard/form-organization-campaign-page.d.ts +8 -1
  61. package/types/dashboard/input-combobox.d.ts +2 -0
  62. package/types/dashboard/preview.d.ts +11 -3
  63. package/types/icons/flags.d.ts +5 -0
@@ -31,6 +31,7 @@ __export(input_group_ai_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(input_group_ai_exports);
33
33
  var import_jsx_runtime = require("react/jsx-runtime");
34
+ var import_react = require("react");
34
35
  var import_react_query = require("@tanstack/react-query");
35
36
  var import_form_ai = require("./form-ai");
36
37
  var import_error = __toESM(require("../shared/error"));
@@ -50,6 +51,7 @@ const InputGroupAI = ({
50
51
  ...rest
51
52
  }) => {
52
53
  const queryClient = (0, import_react_query.useQueryClient)();
54
+ const id = (0, import_react.useId)();
53
55
  const classes = [
54
56
  "input-group"
55
57
  ];
@@ -80,13 +82,21 @@ const InputGroupAI = ({
80
82
  },
81
83
  children: [
82
84
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
83
- "label",
85
+ "div",
84
86
  {
85
87
  ...{
86
88
  className: "flex items-center justify-between"
87
89
  },
88
90
  children: [
89
- label,
91
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
+ "label",
93
+ {
94
+ ...{
95
+ htmlFor: id
96
+ },
97
+ children: label
98
+ }
99
+ ),
90
100
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
91
101
  import_button.default,
92
102
  {
@@ -128,7 +138,9 @@ const InputGroupAI = ({
128
138
  ]
129
139
  }
130
140
  ),
131
- input
141
+ (0, import_react.isValidElement)(input) ? (0, import_react.cloneElement)(input, {
142
+ id: input.props.id || id
143
+ }) : input
132
144
  ]
133
145
  }
134
146
  ),
@@ -1,4 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cloneElement, isValidElement, useId } from "react";
2
3
  import { useQueryClient } from "@tanstack/react-query";
3
4
  import { FormAiText } from "./form-ai.mjs";
4
5
  import Error from "../shared/error.mjs";
@@ -18,6 +19,7 @@ const InputGroupAI = ({
18
19
  ...rest
19
20
  }) => {
20
21
  const queryClient = useQueryClient();
22
+ const id = useId();
21
23
  const classes = [
22
24
  "input-group"
23
25
  ];
@@ -48,13 +50,21 @@ const InputGroupAI = ({
48
50
  },
49
51
  children: [
50
52
  /* @__PURE__ */ jsxs(
51
- "label",
53
+ "div",
52
54
  {
53
55
  ...{
54
56
  className: "flex items-center justify-between"
55
57
  },
56
58
  children: [
57
- label,
59
+ /* @__PURE__ */ jsx(
60
+ "label",
61
+ {
62
+ ...{
63
+ htmlFor: id
64
+ },
65
+ children: label
66
+ }
67
+ ),
58
68
  /* @__PURE__ */ jsx(
59
69
  Button,
60
70
  {
@@ -96,7 +106,9 @@ const InputGroupAI = ({
96
106
  ]
97
107
  }
98
108
  ),
99
- input
109
+ isValidElement(input) ? cloneElement(input, {
110
+ id: input.props.id || id
111
+ }) : input
100
112
  ]
101
113
  }
102
114
  ),
@@ -72,7 +72,7 @@ const lines = (total) => total > 3 ? ["actions", "campaigns", "connections", "co
72
72
  const variantAction = (row) => (row == null ? void 0 : row.disabled) ? "enable" : (row == null ? void 0 : row.leads) ? "disable" : "delete";
73
73
  const variantHref = ({ campaign, main, organization, test, variant }) => {
74
74
  const base = "/organizations/" + organization + "/campaigns/" + campaign;
75
- return main || !test ? base + "/page" : base + "/tests/" + test + "/variants/" + variant;
75
+ return main || !test ? base + "/design" : base + "/tests/" + test + "/variants/" + variant;
76
76
  };
77
77
  const variantPage = ({ campaign, organization, test, variant }) => ({
78
78
  back: test ? "/organizations/" + organization + "/campaigns/" + campaign + "/tests/" + test : void 0,
@@ -110,7 +110,7 @@ const variantSaved = ({ campaign, organization }) => [
110
110
  ];
111
111
  const variantPreview = (campaign) => {
112
112
  var _a, _b, _c;
113
- return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "");
113
+ return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) ? campaign.share.url + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "") : null;
114
114
  };
115
115
  // Annotate the CommonJS export names for ESM import in node:
116
116
  0 && (module.exports = {
@@ -36,7 +36,7 @@ const lines = (total) => total > 3 ? ["actions", "campaigns", "connections", "co
36
36
  const variantAction = (row) => (row == null ? void 0 : row.disabled) ? "enable" : (row == null ? void 0 : row.leads) ? "disable" : "delete";
37
37
  const variantHref = ({ campaign, main, organization, test, variant }) => {
38
38
  const base = "/organizations/" + organization + "/campaigns/" + campaign;
39
- return main || !test ? base + "/page" : base + "/tests/" + test + "/variants/" + variant;
39
+ return main || !test ? base + "/design" : base + "/tests/" + test + "/variants/" + variant;
40
40
  };
41
41
  const variantPage = ({ campaign, organization, test, variant }) => ({
42
42
  back: test ? "/organizations/" + organization + "/campaigns/" + campaign + "/tests/" + test : void 0,
@@ -74,7 +74,7 @@ const variantSaved = ({ campaign, organization }) => [
74
74
  ];
75
75
  const variantPreview = (campaign) => {
76
76
  var _a, _b, _c;
77
- return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "");
77
+ return ((_a = campaign == null ? void 0 : campaign.share) == null ? void 0 : _a.url) ? campaign.share.url + (((_c = (_b = campaign == null ? void 0 : campaign.tokens) == null ? void 0 : _b.admin) == null ? void 0 : _c.text) ? "?drwbrdg_pre=" + campaign.tokens.admin.text : "") : null;
78
78
  };
79
79
  export {
80
80
  WEEK,
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var menu_exports = {};
19
19
  __export(menu_exports, {
20
+ headerSettings: () => headerSettings,
20
21
  isActive: () => isActive,
21
22
  menuRow: () => menuRow
22
23
  });
@@ -43,8 +44,26 @@ const menuRow = (row = {}, path = "") => {
43
44
  open
44
45
  };
45
46
  };
47
+ const headerSettings = ({ campaign, organization, params, path }) => {
48
+ var _a, _b, _c, _d;
49
+ if (!(params == null ? void 0 : params.organization)) return null;
50
+ const base = "/organizations/" + params.organization + (params.campaign ? "/campaigns/" + params.campaign : "");
51
+ const capabilities = (organization == null ? void 0 : organization.capabilities) || {};
52
+ const open = params.campaign ? (_a = capabilities == null ? void 0 : capabilities.campaigns) == null ? void 0 : _a.settings : capabilities.settings || capabilities.members || capabilities.exports;
53
+ const level = params.campaign ? campaign : organization;
54
+ const list = ((_b = level == null ? void 0 : level.tasks) == null ? void 0 : _b.list) || {};
55
+ if (!open) return null;
56
+ return {
57
+ // Lit on Settings and on the pages it opens ( Members, Exports ).
58
+ active: path === base + "/settings" || String(path).startsWith(base + "/settings/"),
59
+ // Members' next steps ride the organization's gear, as Members opens from it.
60
+ error: Boolean(((_c = list.settings) == null ? void 0 : _c.count) || !params.campaign && ((_d = list.members) == null ? void 0 : _d.count)),
61
+ href: base + "/settings"
62
+ };
63
+ };
46
64
  // Annotate the CommonJS export names for ESM import in node:
47
65
  0 && (module.exports = {
66
+ headerSettings,
48
67
  isActive,
49
68
  menuRow
50
69
  });
@@ -20,7 +20,25 @@ const menuRow = (row = {}, path = "") => {
20
20
  open
21
21
  };
22
22
  };
23
+ const headerSettings = ({ campaign, organization, params, path }) => {
24
+ var _a, _b, _c, _d;
25
+ if (!(params == null ? void 0 : params.organization)) return null;
26
+ const base = "/organizations/" + params.organization + (params.campaign ? "/campaigns/" + params.campaign : "");
27
+ const capabilities = (organization == null ? void 0 : organization.capabilities) || {};
28
+ const open = params.campaign ? (_a = capabilities == null ? void 0 : capabilities.campaigns) == null ? void 0 : _a.settings : capabilities.settings || capabilities.members || capabilities.exports;
29
+ const level = params.campaign ? campaign : organization;
30
+ const list = ((_b = level == null ? void 0 : level.tasks) == null ? void 0 : _b.list) || {};
31
+ if (!open) return null;
32
+ return {
33
+ // Lit on Settings and on the pages it opens ( Members, Exports ).
34
+ active: path === base + "/settings" || String(path).startsWith(base + "/settings/"),
35
+ // Members' next steps ride the organization's gear, as Members opens from it.
36
+ error: Boolean(((_c = list.settings) == null ? void 0 : _c.count) || !params.campaign && ((_d = list.members) == null ? void 0 : _d.count)),
37
+ href: base + "/settings"
38
+ };
39
+ };
23
40
  export {
41
+ headerSettings,
24
42
  isActive,
25
43
  menuRow
26
44
  };
@@ -62,12 +62,16 @@ var import_external = __toESM(require("../icons/external"));
62
62
  var import_chart = __toESM(require("../icons/chart"));
63
63
  var import_document = __toESM(require("../icons/document"));
64
64
  var import_flag = __toESM(require("../icons/flag"));
65
+ var import_flags = __toESM(require("../icons/flags"));
66
+ var import_bolt = __toESM(require("../icons/bolt"));
65
67
  var import_home = __toESM(require("../icons/home"));
68
+ var import_image = __toESM(require("../icons/image"));
66
69
  var import_link2 = __toESM(require("../icons/link"));
67
70
  var import_puzzle_piece = __toESM(require("../icons/puzzle-piece"));
68
- var import_queue = __toESM(require("../icons/queue"));
71
+ var import_shop = __toESM(require("../icons/shop"));
69
72
  var import_share = __toESM(require("../icons/share"));
70
73
  var import_star = __toESM(require("../icons/star"));
74
+ var import_swatch = __toESM(require("../icons/swatch"));
71
75
  var import_users = __toESM(require("../icons/users"));
72
76
  var import_book_open = __toESM(require("../icons/book-open"));
73
77
  var import_lifebuoy = __toESM(require("../icons/lifebuoy"));
@@ -76,17 +80,24 @@ var import_menu = require("./lib/menu");
76
80
  const icons = {
77
81
  // The rail's three, as the phone menu's rows (MenuRail).
78
82
  "book-open": import_book_open.default,
83
+ // The campaign's Workflows and Design rows ( Darren, 2026-11-20 ).
84
+ bolt: import_bolt.default,
79
85
  chart: import_chart.default,
80
86
  document: import_document.default,
81
87
  flag: import_flag.default,
88
+ flags: import_flags.default,
82
89
  home: import_home.default,
90
+ // The organization's Library row ( Darren, 2026-11-20 ).
91
+ image: import_image.default,
83
92
  lifebuoy: import_lifebuoy.default,
84
93
  link: import_link2.default,
85
94
  // Connections (Darren, Dulce Local walk, 2026-10-29).
86
95
  "puzzle-piece": import_puzzle_piece.default,
87
- queue: import_queue.default,
96
+ // The campaign's Shop row ( Darren, 2026-11-20 ).
97
+ shop: import_shop.default,
88
98
  share: import_share.default,
89
99
  star: import_star.default,
100
+ swatch: import_swatch.default,
90
101
  task: import_task.default,
91
102
  users: import_users.default
92
103
  };
@@ -23,12 +23,16 @@ import External from "../icons/external.mjs";
23
23
  import Chart from "../icons/chart.mjs";
24
24
  import Document from "../icons/document.mjs";
25
25
  import Flag from "../icons/flag.mjs";
26
+ import Flags from "../icons/flags.mjs";
27
+ import Bolt from "../icons/bolt.mjs";
26
28
  import Home from "../icons/home.mjs";
29
+ import ImageIcon from "../icons/image.mjs";
27
30
  import LinkIcon from "../icons/link.mjs";
28
31
  import PuzzlePiece from "../icons/puzzle-piece.mjs";
29
- import Queue from "../icons/queue.mjs";
32
+ import ShopIcon from "../icons/shop.mjs";
30
33
  import Share from "../icons/share.mjs";
31
34
  import Star from "../icons/star.mjs";
35
+ import SwatchIcon from "../icons/swatch.mjs";
32
36
  import Users from "../icons/users.mjs";
33
37
  import BookOpen from "../icons/book-open.mjs";
34
38
  import Lifebuoy from "../icons/lifebuoy.mjs";
@@ -37,17 +41,24 @@ import { menuRow } from "./lib/menu.mjs";
37
41
  const icons = {
38
42
  // The rail's three, as the phone menu's rows (MenuRail).
39
43
  "book-open": BookOpen,
44
+ // The campaign's Workflows and Design rows ( Darren, 2026-11-20 ).
45
+ bolt: Bolt,
40
46
  chart: Chart,
41
47
  document: Document,
42
48
  flag: Flag,
49
+ flags: Flags,
43
50
  home: Home,
51
+ // The organization's Library row ( Darren, 2026-11-20 ).
52
+ image: ImageIcon,
44
53
  lifebuoy: Lifebuoy,
45
54
  link: LinkIcon,
46
55
  // Connections (Darren, Dulce Local walk, 2026-10-29).
47
56
  "puzzle-piece": PuzzlePiece,
48
- queue: Queue,
57
+ // The campaign's Shop row ( Darren, 2026-11-20 ).
58
+ shop: ShopIcon,
49
59
  share: Share,
50
60
  star: Star,
61
+ swatch: SwatchIcon,
51
62
  task: Task,
52
63
  users: Users
53
64
  };
@@ -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
  ...{