@spillway-cms/blocks 0.0.0-stage → 0.1.2

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/dist/ask.d.ts +39 -0
  3. package/dist/ask.js +96 -0
  4. package/dist/ask.js.map +1 -0
  5. package/dist/calendar.d.ts +42 -0
  6. package/dist/calendar.js +96 -0
  7. package/dist/calendar.js.map +1 -0
  8. package/dist/collection.d.ts +89 -0
  9. package/dist/collection.js +304 -0
  10. package/dist/collection.js.map +1 -0
  11. package/dist/config.d.ts +246 -0
  12. package/dist/config.js +638 -0
  13. package/dist/config.js.map +1 -0
  14. package/dist/css.d.ts +1 -0
  15. package/dist/css.js +606 -0
  16. package/dist/css.js.map +1 -0
  17. package/dist/docs-feedback.d.ts +34 -0
  18. package/dist/docs-feedback.js +57 -0
  19. package/dist/docs-feedback.js.map +1 -0
  20. package/dist/examples.d.ts +12 -0
  21. package/dist/examples.js +85 -0
  22. package/dist/examples.js.map +1 -0
  23. package/dist/experiment.d.ts +18 -0
  24. package/dist/experiment.js +20 -0
  25. package/dist/experiment.js.map +1 -0
  26. package/dist/form.d.ts +40 -0
  27. package/dist/form.js +252 -0
  28. package/dist/form.js.map +1 -0
  29. package/dist/gallery.d.ts +36 -0
  30. package/dist/gallery.js +114 -0
  31. package/dist/gallery.js.map +1 -0
  32. package/dist/image.d.ts +41 -0
  33. package/dist/image.js +39 -0
  34. package/dist/image.js.map +1 -0
  35. package/dist/index.d.ts +54 -0
  36. package/dist/index.js +31 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/layouts.d.ts +8 -0
  39. package/dist/layouts.js +81 -0
  40. package/dist/layouts.js.map +1 -0
  41. package/dist/markdown.d.ts +32 -0
  42. package/dist/markdown.js +283 -0
  43. package/dist/markdown.js.map +1 -0
  44. package/dist/marketing.d.ts +70 -0
  45. package/dist/marketing.js +208 -0
  46. package/dist/marketing.js.map +1 -0
  47. package/dist/menu.d.ts +43 -0
  48. package/dist/menu.js +75 -0
  49. package/dist/menu.js.map +1 -0
  50. package/dist/meta.d.ts +14 -0
  51. package/dist/meta.js +198 -0
  52. package/dist/meta.js.map +1 -0
  53. package/dist/module-block.d.ts +32 -0
  54. package/dist/module-block.js +76 -0
  55. package/dist/module-block.js.map +1 -0
  56. package/dist/motion.d.ts +19 -0
  57. package/dist/motion.js +161 -0
  58. package/dist/motion.js.map +1 -0
  59. package/dist/personalize.d.ts +18 -0
  60. package/dist/personalize.js +32 -0
  61. package/dist/personalize.js.map +1 -0
  62. package/dist/players.d.ts +30 -0
  63. package/dist/players.js +95 -0
  64. package/dist/players.js.map +1 -0
  65. package/dist/registry-browse.d.ts +31 -0
  66. package/dist/registry-browse.js +97 -0
  67. package/dist/registry-browse.js.map +1 -0
  68. package/dist/registry-gallery.d.ts +22 -0
  69. package/dist/registry-gallery.js +73 -0
  70. package/dist/registry-gallery.js.map +1 -0
  71. package/dist/registry-org.d.ts +22 -0
  72. package/dist/registry-org.js +44 -0
  73. package/dist/registry-org.js.map +1 -0
  74. package/dist/registry-package.d.ts +27 -0
  75. package/dist/registry-package.js +145 -0
  76. package/dist/registry-package.js.map +1 -0
  77. package/dist/registry-publisher.d.ts +20 -0
  78. package/dist/registry-publisher.js +46 -0
  79. package/dist/registry-publisher.js.map +1 -0
  80. package/dist/registry-shared.d.ts +29 -0
  81. package/dist/registry-shared.js +122 -0
  82. package/dist/registry-shared.js.map +1 -0
  83. package/dist/registry-stats.d.ts +15 -0
  84. package/dist/registry-stats.js +42 -0
  85. package/dist/registry-stats.js.map +1 -0
  86. package/dist/registry-types.d.ts +218 -0
  87. package/dist/registry-types.js +29 -0
  88. package/dist/registry-types.js.map +1 -0
  89. package/dist/sanitize.d.ts +37 -0
  90. package/dist/sanitize.js +293 -0
  91. package/dist/sanitize.js.map +1 -0
  92. package/dist/search.d.ts +25 -0
  93. package/dist/search.js +77 -0
  94. package/dist/search.js.map +1 -0
  95. package/dist/shared.d.ts +27 -0
  96. package/dist/shared.js +59 -0
  97. package/dist/shared.js.map +1 -0
  98. package/dist/status-board.d.ts +49 -0
  99. package/dist/status-board.js +81 -0
  100. package/dist/status-board.js.map +1 -0
  101. package/dist/story.d.ts +23 -0
  102. package/dist/story.js +58 -0
  103. package/dist/story.js.map +1 -0
  104. package/dist/styles.css +1361 -0
  105. package/dist/styles.d.ts +37 -0
  106. package/dist/styles.js +242 -0
  107. package/dist/styles.js.map +1 -0
  108. package/package.json +47 -3
  109. package/README.md +0 -3
@@ -0,0 +1,32 @@
1
+ /**
2
+ * ModuleBlock: a block a module provides (docs/modules.md, "Blocks in the page builder"). The page stores
3
+ * `{ module, key, props }`; the server's resolver asks the module system for the HTML (sanitised for sandboxed
4
+ * modules, the module's own markup for trusted ones) and puts it in `html`. When the module is disabled,
5
+ * uninstalled, in safe mode or fails to render, `placeholder` is set and the block shows its label instead of
6
+ * breaking the page. Server-safe: no hooks, no browser APIs; the admin swaps in its own fields and a live preview.
7
+ */
8
+ import type { ComponentConfig } from '@puckeditor/core';
9
+ import { type SceneRender } from '@spillway-cms/shared';
10
+ export interface ModuleBlockProps {
11
+ /** The module's name as installed (manifest `name`). */
12
+ module: string;
13
+ /** The block key the module's manifest declares (`blockKey`, because React reserves `key`). */
14
+ blockKey: string;
15
+ /** The block's own props, shaped by the manifest's field definitions. */
16
+ props: Record<string, unknown>;
17
+ /** The block style's key, for a block whose manifest declares `styles` or `styleSlots` (stored next to `props`). */
18
+ style?: string;
19
+ /** Resolved by the server before render; never stored in the layout. `styleSet` is the style set the key belongs to. */
20
+ styleSet?: string | null;
21
+ html?: string | null;
22
+ placeholder?: boolean | null;
23
+ label?: string | null;
24
+ reason?: string | null;
25
+ /** A scene block's frame and poster (resolved by the server, like `html`); the page's motion script runs the frame. */
26
+ scene?: SceneRender | null;
27
+ }
28
+ export declare function moduleBlockClass(module: string, key: string): string;
29
+ export declare const moduleBlockComponent: ComponentConfig<{
30
+ props: ModuleBlockProps;
31
+ }>;
32
+ export declare const moduleBlockCss = "/* ---------- Module block ---------- */\n\n/* The module's HTML sits in the page container; a trusted module that brings its own container gets no second gutter. */\n.sw-module-block__body > * + * { margin-top: 1em; }\n.sw-module-block__body .sw-container { max-width: none; padding-inline: 0; }\n.sw-module-block__body figure { margin: 0; }\n.sw-module-block__body img { display: block; max-width: 100%; height: auto; border-radius: var(--sw-radius, 8px); }\n.sw-module-block__body ul { padding-left: 1.4em; }\n.sw-module-block__body table { margin: 0; }\n.sw-module-block__body caption { padding-bottom: var(--sw-space-1); text-align: left; font-weight: 600; }\n.sw-module-block__body thead th { border-bottom: 2px solid var(--sw-color-border); }\n\n/* Scenes (docs/dev/motion.md, layer 3): the poster until the frame says it is ready, then the frame over it. */\n.sw-scene { margin: 0; }\n.sw-scene__stage { position: relative; height: var(--sw-scene-height, 420px); border-radius: var(--sw-radius, 8px); overflow: hidden; background: var(--sw-color-surface); }\n.sw-scene--s { --sw-scene-height: 280px; }\n.sw-scene--l { --sw-scene-height: 600px; }\n@media (max-width: 640px) { .sw-scene--l { --sw-scene-height: 420px; } }\n.sw-scene__poster { display: block; width: 100%; height: 100%; object-fit: cover; }\n.sw-scene__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 400ms ease; }\n.sw-scene:not(.sw-scene--interactive) .sw-scene__frame { pointer-events: none; }\n.sw-scene-ready .sw-scene__frame { opacity: 1; }\n.sw-scene-ready .sw-scene__poster { visibility: hidden; }\n.sw-scene-toggle { display: block; margin: var(--sw-space-1, 0.5rem) 0 0 auto; font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-scene-toggle[hidden] { display: none; }\n.sw-scene__content { margin-top: var(--sw-space-3, 1.5rem); }\n\n.sw-module-block--placeholder { padding-block: var(--sw-space-2); }\n.sw-module-block__placeholder {\n padding: var(--sw-space-3);\n border: 1px dashed var(--sw-color-border);\n border-radius: var(--sw-radius, 8px);\n background: var(--sw-color-surface);\n color: var(--sw-color-muted);\n font-size: 0.9rem;\n text-align: center;\n}\n";
@@ -0,0 +1,76 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BLOCK_STYLE_KEY_RE, blockStyleClass } from '@spillway-cms/shared';
3
+ /** A scene's stage: the poster (what visitors without motion get), a pause button, and the data the motion script needs. */
4
+ function SceneStage({ scene }) {
5
+ return (_jsxs("figure", { className: `sw-scene sw-scene--${scene.height}${scene.interactive ? ' sw-scene--interactive' : ''}`, "data-sw-scene": scene.frame, "data-scene-props": JSON.stringify(scene.props ?? {}), "data-scene-title": scene.alt, "data-scene-interactive": scene.interactive ? '' : undefined, children: [_jsx("div", { className: "sw-scene__stage", children: _jsx("img", { className: "sw-scene__poster", src: scene.poster, alt: scene.alt, loading: "lazy" }) }), _jsx("button", { type: "button", className: "sw-scene-toggle", "data-sw-scene-toggle": "", "aria-pressed": "false", hidden: true, children: "Pause animation" })] }));
6
+ }
7
+ export function moduleBlockClass(module, key) {
8
+ const slug = (s) => s.replace(/^@/, '').replace(/[^a-z0-9]+/gi, '-').replace(/^-+|-+$/g, '').toLowerCase();
9
+ return `sw-module-block--${slug(module)}-${slug(key)}`;
10
+ }
11
+ export const moduleBlockComponent = {
12
+ label: 'Module block',
13
+ fields: {
14
+ module: { type: 'text', label: 'Module' },
15
+ blockKey: { type: 'text', label: 'Block key' },
16
+ props: { type: 'object', label: 'Props', objectFields: {} },
17
+ },
18
+ defaultProps: { module: '', blockKey: '', props: {} },
19
+ render: ({ module, blockKey: rawKey, html, placeholder, label, reason, style, styleSet, scene }) => {
20
+ const name = String(module ?? '');
21
+ const blockKey = String(rawKey ?? '');
22
+ // A styled module block's wrapper carries its style's class (sw-style-cards-filled for a block that uses the Cards styles).
23
+ const styled = typeof styleSet === 'string' && styleSet && typeof style === 'string' && BLOCK_STYLE_KEY_RE.test(style) ? ` ${blockStyleClass(styleSet, style)}` : '';
24
+ if (scene && !placeholder) {
25
+ // A scene: the stage in the page container, the module's HTML (its content without motion) below it.
26
+ return (_jsx("section", { className: `sw-block sw-module-block sw-scene-block ${moduleBlockClass(name, blockKey)}${styled}`, "data-module": name, "data-block": blockKey, "data-style": styled ? style : undefined, children: _jsxs("div", { className: "sw-container", children: [_jsx(SceneStage, { scene: scene }), typeof html === 'string' && html ? _jsx("div", { className: "sw-prose sw-module-block__body sw-scene__content", dangerouslySetInnerHTML: { __html: html } }) : null] }) }));
27
+ }
28
+ if (typeof html === 'string' && html && !placeholder) {
29
+ // Like a core block: a section in the page's rhythm, the content in the container with prose styles (a sandboxed
30
+ // module's HTML is prose: paragraphs, lists, tables, images).
31
+ return (_jsx("section", { className: `sw-block sw-module-block ${moduleBlockClass(name, blockKey)}${styled}`, "data-module": name, "data-block": blockKey, "data-style": styled ? style : undefined, children: _jsx("div", { className: "sw-container sw-prose sw-module-block__body", dangerouslySetInnerHTML: { __html: html } }) }));
32
+ }
33
+ const title = label || (name && blockKey ? `${name}/${blockKey}` : '');
34
+ const text = !name || !blockKey ? 'Module block: none selected' : placeholder ? `Module block: ${title}${reason ? ` (${reason})` : ''}` : `Module block: ${title}`;
35
+ return (_jsx("section", { className: `sw-block sw-module-block sw-module-block--placeholder ${name && blockKey ? moduleBlockClass(name, blockKey) : ''}`.trim(), "data-module": name || undefined, "data-block": blockKey || undefined, children: _jsx("div", { className: "sw-container", children: _jsx("div", { className: "sw-module-block__placeholder", role: "note", children: text }) }) }));
36
+ },
37
+ };
38
+ export const moduleBlockCss = `/* ---------- Module block ---------- */
39
+
40
+ /* The module's HTML sits in the page container; a trusted module that brings its own container gets no second gutter. */
41
+ .sw-module-block__body > * + * { margin-top: 1em; }
42
+ .sw-module-block__body .sw-container { max-width: none; padding-inline: 0; }
43
+ .sw-module-block__body figure { margin: 0; }
44
+ .sw-module-block__body img { display: block; max-width: 100%; height: auto; border-radius: var(--sw-radius, 8px); }
45
+ .sw-module-block__body ul { padding-left: 1.4em; }
46
+ .sw-module-block__body table { margin: 0; }
47
+ .sw-module-block__body caption { padding-bottom: var(--sw-space-1); text-align: left; font-weight: 600; }
48
+ .sw-module-block__body thead th { border-bottom: 2px solid var(--sw-color-border); }
49
+
50
+ /* Scenes (docs/dev/motion.md, layer 3): the poster until the frame says it is ready, then the frame over it. */
51
+ .sw-scene { margin: 0; }
52
+ .sw-scene__stage { position: relative; height: var(--sw-scene-height, 420px); border-radius: var(--sw-radius, 8px); overflow: hidden; background: var(--sw-color-surface); }
53
+ .sw-scene--s { --sw-scene-height: 280px; }
54
+ .sw-scene--l { --sw-scene-height: 600px; }
55
+ @media (max-width: 640px) { .sw-scene--l { --sw-scene-height: 420px; } }
56
+ .sw-scene__poster { display: block; width: 100%; height: 100%; object-fit: cover; }
57
+ .sw-scene__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 400ms ease; }
58
+ .sw-scene:not(.sw-scene--interactive) .sw-scene__frame { pointer-events: none; }
59
+ .sw-scene-ready .sw-scene__frame { opacity: 1; }
60
+ .sw-scene-ready .sw-scene__poster { visibility: hidden; }
61
+ .sw-scene-toggle { display: block; margin: var(--sw-space-1, 0.5rem) 0 0 auto; font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }
62
+ .sw-scene-toggle[hidden] { display: none; }
63
+ .sw-scene__content { margin-top: var(--sw-space-3, 1.5rem); }
64
+
65
+ .sw-module-block--placeholder { padding-block: var(--sw-space-2); }
66
+ .sw-module-block__placeholder {
67
+ padding: var(--sw-space-3);
68
+ border: 1px dashed var(--sw-color-border);
69
+ border-radius: var(--sw-radius, 8px);
70
+ background: var(--sw-color-surface);
71
+ color: var(--sw-color-muted);
72
+ font-size: 0.9rem;
73
+ text-align: center;
74
+ }
75
+ `;
76
+ //# sourceMappingURL=module-block.js.map
@@ -0,0 +1 @@
1
+ {"version":3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E,iBAAe,IAAI,IAAI,SAAS,gBAAc,QAAQ,IAAI,SAAS,YAC/M,cAAK,SAAS,EAAC,cAAc,YAC3B,cAAK,SAAS,EAAC,8BAA8B,EAAC,IAAI,EAAC,MAAM,YACtD,IAAI,GACD,GACF,GACE,CACX,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC7B,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Motion (docs/dev/motion.md, phase 1): the presets behind a block's Motion settings, the page script that arms them, and the
3
+ * visitor's Reduce motion switch.
4
+ *
5
+ * Nothing is hidden by CSS alone: a block only starts hidden once the page script has added `sw-motion-ready` to the root element,
6
+ * and the script first marks every block already on screen as arrived, so the content above the fold never waits for an animation
7
+ * and a page without the script (an adapter, a feed reader, a failed load) shows everything. The brand's motion level sits on the
8
+ * root as `data-sw-motion`: `subtle` plays scale and slides as a short rise and turns tilt off. Reduced motion, from the operating
9
+ * system or the visitor's switch (`sw-reduce-motion` on the root), turns every rule off.
10
+ */
11
+ export declare const MOTION_CSS = "\n/* Motion: entrances (armed by the page's motion script), stagger and hover. */\n[data-motion] { --sw-motion-from: none; --sw-motion-wait: 0ms; }\n[data-motion=\"rise\"] { --sw-motion-from: translateY(var(--sw-motion-distance, 24px)); }\n[data-motion=\"scale\"] { --sw-motion-from: scale(0.94); }\n[data-motion=\"slide-left\"] { --sw-motion-from: translateX(calc(-1 * var(--sw-motion-distance, 24px))); }\n[data-motion=\"slide-right\"] { --sw-motion-from: translateX(var(--sw-motion-distance, 24px)); }\n[data-sw-motion=\"subtle\"] :is([data-motion=\"scale\"], [data-motion=\"slide-left\"], [data-motion=\"slide-right\"]) { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }\n[data-sw-motion=\"subtle\"] [data-motion=\"rise\"] { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }\n[data-motion-delay=\"short\"] { --sw-motion-wait: 150ms; }\n[data-motion-delay=\"medium\"] { --sw-motion-wait: 300ms; }\n/* The transition runs only as a block arrives (sw-in), so hiding the blocks below the fold is instant. */\n.sw-motion-ready [data-motion].sw-in:not([data-motion-stagger]),\n.sw-motion-ready [data-motion].sw-in[data-motion-stagger] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > * {\n transition: opacity var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1)), transform var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1));\n transition-delay: calc(var(--sw-motion-wait) + var(--sw-motion-index, 0) * 80ms);\n}\n.sw-motion-ready [data-motion]:not([data-motion-stagger]):not(.sw-in),\n.sw-motion-ready [data-motion][data-motion-stagger]:not(.sw-in) :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > * { opacity: 0; transform: var(--sw-motion-from); }\n[data-motion-hover] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, [data-motion-hover].sw-image, [data-motion-hover] img { transition: transform 200ms ease, box-shadow 200ms ease; }\n[data-sw-motion] [data-motion-hover=\"lift\"] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *:hover, [data-sw-motion] [data-motion-hover=\"lift\"].sw-image:hover { transform: translateY(-4px); box-shadow: var(--sw-shadow, 0 8px 24px rgba(0, 0, 0, 0.12)); }\n[data-motion-hover=\"zoom\"] :is(:is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, .sw-image) { overflow: hidden; }\n[data-sw-motion] [data-motion-hover=\"zoom\"] :is(:is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, .sw-image):hover img, [data-sw-motion] [data-motion-hover=\"zoom\"].sw-image:hover img { transform: scale(1.05); }\n[data-sw-motion=\"expressive\"] [data-motion-hover=\"tilt\"] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *:hover { transform: perspective(800px) rotateX(2deg) rotateY(-3deg) translateY(-2px); }\n/* On scroll: the page script writes --sw-scroll (0 as the block enters at the bottom, 1 as it leaves at the top); unset, every\n effect sits at rest. Parallax moves a Hero's background slower than the page (half as far at the subtle level). */\n[data-motion-scroll=\"parallax\"] { --sw-parallax: 16%; }\n[data-sw-motion=\"subtle\"] [data-motion-scroll=\"parallax\"] { --sw-parallax: 8%; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-hero--image { overflow: hidden; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"] .sw-hero__bg { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-hero--image:not(:has(.sw-hero__bg)) { background-position: center calc(50% + (var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax) * 4); }\n[data-sw-motion] [data-motion-scroll=\"fade-out\"] { opacity: clamp(0, calc((1 - var(--sw-scroll, 0)) / 0.35), 1); }\n[data-sw-motion] [data-motion-scroll=\"pin\"] { position: sticky; top: 0; z-index: 0; }\n[data-sw-motion] [data-motion-scroll=\"pin\"] ~ * { position: relative; z-index: 1; }\n.sw-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n.sw-hero { position: relative; }\n.sw-video-toggle { position: absolute; right: var(--sw-space-3, 1rem); bottom: var(--sw-space-3, 1rem); z-index: 1; font: inherit; font-size: 0.8125rem; color: #ffffff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 0.3rem 0.85rem; cursor: pointer; }\n.sw-video-toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }\n/* Marquee (Logo strip, Testimonials): the page script adds sw-marquee-on and copies the items (the copies are hidden from\n assistive technology) so the row loops; items carry their spacing as a margin so moving by half is seamless. */\n[data-motion-marquee]:not(.sw-marquee-on) [data-sw-marquee-clone] { display: none; }\n.sw-marquee-on .sw-container { overflow: hidden; }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 0; width: max-content; animation: sw-marquee var(--sw-marquee-duration, 40s) linear infinite; }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) > * { flex: none; margin-inline-end: var(--sw-marquee-gap, var(--sw-space-4, 2rem)); }\n.sw-testimonials.sw-marquee-on .sw-testimonials__grid > * { width: min(22rem, 80vw); --sw-marquee-gap: var(--sw-space-3, 1.5rem); }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):hover, .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):focus-within, .sw-marquee-paused :is(.sw-logos__list, .sw-testimonials__grid) { animation-play-state: paused; }\n@keyframes sw-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }\n.sw-lottie-toggle { display: block; margin: var(--sw-space-1, 0.5rem) auto 0; font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-lottie-toggle[hidden] { display: none; }\n.sw-marquee-toggle { display: block; margin: 0 auto var(--sw-space-3, 1rem); font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-marquee-toggle[hidden] { display: none; }\n.sw-motion-switch { font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-motion-switch[aria-pressed=\"true\"] { background: var(--sw-color-text); color: var(--sw-color-bg); opacity: 1; }\n.sw-reduce-motion *, .sw-reduce-motion *::before, .sw-reduce-motion *::after { transition: none !important; animation: none !important; }\n.sw-reduce-motion [data-motion], .sw-reduce-motion [data-motion] *, .sw-reduce-motion [data-motion-scroll], .sw-reduce-motion [data-motion-scroll] * { opacity: 1 !important; transform: none !important; }\n@media (prefers-reduced-motion: reduce) {\n html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]), html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]) * { opacity: 1 !important; transform: none !important; transition: none !important; }\n html:not(.sw-motion-allowed) .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { animation: none !important; }\n}\n";
12
+ /** The visitor's choice in local storage: "1" reduce, "0" allow; absent follows the operating system. */
13
+ export declare const MOTION_STORAGE_KEY = "sw-reduce-motion";
14
+ /**
15
+ * The page's motion script (inline with the page's nonce, only on pages with motion). It applies the visitor's choice, wires the
16
+ * Reduce motion switch, and arms the entrances: blocks already on screen arrive at once, the rest when they scroll into view.
17
+ * Stagger numbers a block's items so each waits a little longer than the one before.
18
+ */
19
+ export declare const MOTION_SCRIPT: string;
package/dist/motion.js ADDED
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Motion (docs/dev/motion.md, phase 1): the presets behind a block's Motion settings, the page script that arms them, and the
3
+ * visitor's Reduce motion switch.
4
+ *
5
+ * Nothing is hidden by CSS alone: a block only starts hidden once the page script has added `sw-motion-ready` to the root element,
6
+ * and the script first marks every block already on screen as arrived, so the content above the fold never waits for an animation
7
+ * and a page without the script (an adapter, a feed reader, a failed load) shows everything. The brand's motion level sits on the
8
+ * root as `data-sw-motion`: `subtle` plays scale and slides as a short rise and turns tilt off. Reduced motion, from the operating
9
+ * system or the visitor's switch (`sw-reduce-motion` on the root), turns every rule off.
10
+ */
11
+ /** The containers whose children are a block's items (cards, quotes, logos, figures, list items, buttons). */
12
+ const ITEMS = ':is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons)';
13
+ export const MOTION_CSS = `
14
+ /* Motion: entrances (armed by the page's motion script), stagger and hover. */
15
+ [data-motion] { --sw-motion-from: none; --sw-motion-wait: 0ms; }
16
+ [data-motion="rise"] { --sw-motion-from: translateY(var(--sw-motion-distance, 24px)); }
17
+ [data-motion="scale"] { --sw-motion-from: scale(0.94); }
18
+ [data-motion="slide-left"] { --sw-motion-from: translateX(calc(-1 * var(--sw-motion-distance, 24px))); }
19
+ [data-motion="slide-right"] { --sw-motion-from: translateX(var(--sw-motion-distance, 24px)); }
20
+ [data-sw-motion="subtle"] :is([data-motion="scale"], [data-motion="slide-left"], [data-motion="slide-right"]) { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }
21
+ [data-sw-motion="subtle"] [data-motion="rise"] { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }
22
+ [data-motion-delay="short"] { --sw-motion-wait: 150ms; }
23
+ [data-motion-delay="medium"] { --sw-motion-wait: 300ms; }
24
+ /* The transition runs only as a block arrives (sw-in), so hiding the blocks below the fold is instant. */
25
+ .sw-motion-ready [data-motion].sw-in:not([data-motion-stagger]),
26
+ .sw-motion-ready [data-motion].sw-in[data-motion-stagger] ${ITEMS} > * {
27
+ transition: opacity var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1)), transform var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1));
28
+ transition-delay: calc(var(--sw-motion-wait) + var(--sw-motion-index, 0) * 80ms);
29
+ }
30
+ .sw-motion-ready [data-motion]:not([data-motion-stagger]):not(.sw-in),
31
+ .sw-motion-ready [data-motion][data-motion-stagger]:not(.sw-in) ${ITEMS} > * { opacity: 0; transform: var(--sw-motion-from); }
32
+ [data-motion-hover] ${ITEMS} > *, [data-motion-hover].sw-image, [data-motion-hover] img { transition: transform 200ms ease, box-shadow 200ms ease; }
33
+ [data-sw-motion] [data-motion-hover="lift"] ${ITEMS} > *:hover, [data-sw-motion] [data-motion-hover="lift"].sw-image:hover { transform: translateY(-4px); box-shadow: var(--sw-shadow, 0 8px 24px rgba(0, 0, 0, 0.12)); }
34
+ [data-motion-hover="zoom"] :is(${ITEMS} > *, .sw-image) { overflow: hidden; }
35
+ [data-sw-motion] [data-motion-hover="zoom"] :is(${ITEMS} > *, .sw-image):hover img, [data-sw-motion] [data-motion-hover="zoom"].sw-image:hover img { transform: scale(1.05); }
36
+ [data-sw-motion="expressive"] [data-motion-hover="tilt"] ${ITEMS} > *:hover { transform: perspective(800px) rotateX(2deg) rotateY(-3deg) translateY(-2px); }
37
+ /* On scroll: the page script writes --sw-scroll (0 as the block enters at the bottom, 1 as it leaves at the top); unset, every
38
+ effect sits at rest. Parallax moves a Hero's background slower than the page (half as far at the subtle level). */
39
+ [data-motion-scroll="parallax"] { --sw-parallax: 16%; }
40
+ [data-sw-motion="subtle"] [data-motion-scroll="parallax"] { --sw-parallax: 8%; }
41
+ [data-sw-motion] [data-motion-scroll="parallax"].sw-hero--image { overflow: hidden; }
42
+ [data-sw-motion] [data-motion-scroll="parallax"] .sw-hero__bg { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }
43
+ [data-sw-motion] [data-motion-scroll="parallax"].sw-hero--image:not(:has(.sw-hero__bg)) { background-position: center calc(50% + (var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax) * 4); }
44
+ [data-sw-motion] [data-motion-scroll="fade-out"] { opacity: clamp(0, calc((1 - var(--sw-scroll, 0)) / 0.35), 1); }
45
+ [data-sw-motion] [data-motion-scroll="pin"] { position: sticky; top: 0; z-index: 0; }
46
+ [data-sw-motion] [data-motion-scroll="pin"] ~ * { position: relative; z-index: 1; }
47
+ .sw-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
48
+ .sw-hero { position: relative; }
49
+ .sw-video-toggle { position: absolute; right: var(--sw-space-3, 1rem); bottom: var(--sw-space-3, 1rem); z-index: 1; font: inherit; font-size: 0.8125rem; color: #ffffff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 0.3rem 0.85rem; cursor: pointer; }
50
+ .sw-video-toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
51
+ /* Marquee (Logo strip, Testimonials): the page script adds sw-marquee-on and copies the items (the copies are hidden from
52
+ assistive technology) so the row loops; items carry their spacing as a margin so moving by half is seamless. */
53
+ [data-motion-marquee]:not(.sw-marquee-on) [data-sw-marquee-clone] { display: none; }
54
+ .sw-marquee-on .sw-container { overflow: hidden; }
55
+ .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 0; width: max-content; animation: sw-marquee var(--sw-marquee-duration, 40s) linear infinite; }
56
+ .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) > * { flex: none; margin-inline-end: var(--sw-marquee-gap, var(--sw-space-4, 2rem)); }
57
+ .sw-testimonials.sw-marquee-on .sw-testimonials__grid > * { width: min(22rem, 80vw); --sw-marquee-gap: var(--sw-space-3, 1.5rem); }
58
+ .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):hover, .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):focus-within, .sw-marquee-paused :is(.sw-logos__list, .sw-testimonials__grid) { animation-play-state: paused; }
59
+ @keyframes sw-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
60
+ .sw-lottie-toggle { display: block; margin: var(--sw-space-1, 0.5rem) auto 0; font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }
61
+ .sw-lottie-toggle[hidden] { display: none; }
62
+ .sw-marquee-toggle { display: block; margin: 0 auto var(--sw-space-3, 1rem); font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }
63
+ .sw-marquee-toggle[hidden] { display: none; }
64
+ .sw-motion-switch { font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }
65
+ .sw-motion-switch[aria-pressed="true"] { background: var(--sw-color-text); color: var(--sw-color-bg); opacity: 1; }
66
+ .sw-reduce-motion *, .sw-reduce-motion *::before, .sw-reduce-motion *::after { transition: none !important; animation: none !important; }
67
+ .sw-reduce-motion [data-motion], .sw-reduce-motion [data-motion] *, .sw-reduce-motion [data-motion-scroll], .sw-reduce-motion [data-motion-scroll] * { opacity: 1 !important; transform: none !important; }
68
+ @media (prefers-reduced-motion: reduce) {
69
+ html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]), html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]) * { opacity: 1 !important; transform: none !important; transition: none !important; }
70
+ html:not(.sw-motion-allowed) .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { animation: none !important; }
71
+ }
72
+ `;
73
+ /** The visitor's choice in local storage: "1" reduce, "0" allow; absent follows the operating system. */
74
+ export const MOTION_STORAGE_KEY = 'sw-reduce-motion';
75
+ /**
76
+ * The page's motion script (inline with the page's nonce, only on pages with motion). It applies the visitor's choice, wires the
77
+ * Reduce motion switch, and arms the entrances: blocks already on screen arrive at once, the rest when they scroll into view.
78
+ * Stagger numbers a block's items so each waits a little longer than the one before.
79
+ */
80
+ export const MOTION_SCRIPT = `(function(){var d=document,h=d.documentElement,K=${JSON.stringify(MOTION_STORAGE_KEY)};
81
+ function stored(){try{return localStorage.getItem(K)}catch(e){return null}}
82
+ var sys=window.matchMedia?matchMedia('(prefers-reduced-motion: reduce)'):{matches:false};
83
+ function reduced(){var s=stored();return s===null?sys.matches:s==='1'}
84
+ function sync(){var r=reduced();h.classList.toggle('sw-reduce-motion',r);h.classList.toggle('sw-motion-allowed',!r);d.querySelectorAll('[data-sw-motion-switch]').forEach(function(b){b.setAttribute('aria-pressed',r?'true':'false')});return r}
85
+ function arrive(el){el.classList.add('sw-in')}
86
+ var videos=[].slice.call(d.querySelectorAll('[data-sw-bg-video]')),vio=null;
87
+ var saveData=!!(navigator.connection&&navigator.connection.saveData);
88
+ function videoAllowed(){return !reduced()&&!saveData&&h.hasAttribute('data-sw-motion')}
89
+ function toggleOf(v){var t=v.parentNode&&v.parentNode.querySelector('[data-sw-video-toggle]');return t}
90
+ function setVideos(){videos.forEach(function(v){var t=toggleOf(v);if(!videoAllowed()){v.pause();if(t)t.hidden=true;return}if(t)t.hidden=false})
91
+ if(videoAllowed()&&'IntersectionObserver' in window){if(!vio)vio=new IntersectionObserver(function(es){es.forEach(function(en){var v=en.target;if(en.isIntersecting&&videoAllowed()&&v.dataset.userPaused!=='1'){var p=v.play();if(p&&p.catch)p.catch(function(){})}else v.pause()})},{threshold:0.1});videos.forEach(function(v){vio.observe(v)})}else if(vio){videos.forEach(function(v){vio.unobserve(v)})}}
92
+ var marquees=[].slice.call(d.querySelectorAll('[data-motion-marquee]'));
93
+ function listOf(m){return m.querySelector('.sw-logos__list,.sw-testimonials__grid')}
94
+ function buildMarquee(m){var ul=listOf(m);if(!ul||m.dataset.marqueeBuilt)return;var items=[].slice.call(ul.children);if(!items.length)return;m.dataset.marqueeBuilt='1';
95
+ var box=(ul.parentNode&&ul.parentNode.clientWidth)||h.clientWidth,w=ul.scrollWidth||1,reps=Math.max(1,Math.min(8,Math.ceil(box/w))),n=reps*2;
96
+ for(var r=1;r<n;r++)items.forEach(function(it){var c=it.cloneNode(true);c.setAttribute('aria-hidden','true');c.setAttribute('data-sw-marquee-clone','');[].slice.call(c.querySelectorAll('a,button,[tabindex]')).forEach(function(a){a.setAttribute('tabindex','-1')});ul.appendChild(c)});
97
+ var per=m.getAttribute('data-motion-marquee')==='slow'?8:3;m.style.setProperty('--sw-marquee-duration',(per*items.length*reps)+'s')}
98
+ function setMarquees(){var ok=!reduced()&&h.hasAttribute('data-sw-motion');marquees.forEach(function(m){var t=m.querySelector('[data-sw-marquee-toggle]');if(!ok){m.classList.remove('sw-marquee-on');if(t)t.hidden=true;return}m.classList.add('sw-marquee-on');buildMarquee(m);if(t)t.hidden=false})}
99
+ var stories=[].slice.call(d.querySelectorAll('[data-motion-story]')),sio=null;
100
+ function stepsOf(s){return [].slice.call(s.querySelectorAll('li[data-story-step]'))}
101
+ function activate(s,i){var st=stepsOf(s),pic=+(st[i]&&st[i].getAttribute('data-story-image'));st.forEach(function(x,k){x.classList.toggle('sw-story-active',k===i)});[].slice.call(s.querySelectorAll('.sw-story__media img')).forEach(function(im){im.classList.toggle('sw-story-shown',+im.getAttribute('data-story-step')===pic)})}
102
+ function buildStory(s){var lay=s.querySelector('.sw-story__layout');if(!lay||s.dataset.storyBuilt)return;s.dataset.storyBuilt='1';var media=d.createElement('div');media.className='sw-story__media';media.setAttribute('aria-hidden','true');var first=-1,last=-1;
103
+ stepsOf(s).forEach(function(st,i){var im=st.querySelector('.sw-story__figure img');if(im){var c=d.createElement('img');c.src=im.currentSrc||im.getAttribute('src');c.alt='';c.loading='lazy';c.setAttribute('data-story-step',String(i));media.appendChild(c);last=i;if(first<0)first=i}st.setAttribute('data-story-image',String(last))});
104
+ stepsOf(s).forEach(function(st){if(st.getAttribute('data-story-image')==='-1')st.setAttribute('data-story-image',String(first))});
105
+ lay.insertBefore(media,lay.firstChild);activate(s,0)}
106
+ function setStories(){var ok=!reduced()&&h.hasAttribute('data-sw-motion')&&'IntersectionObserver' in window;if(ok&&!sio)sio=new IntersectionObserver(function(es){es.forEach(function(en){if(!en.isIntersecting)return;var s=en.target.closest('[data-motion-story]');if(s)activate(s,stepsOf(s).indexOf(en.target))})},{rootMargin:'-45% 0px -45% 0px'});
107
+ stories.forEach(function(s){if(ok){s.classList.add('sw-story-on');buildStory(s);stepsOf(s).forEach(function(st){sio.observe(st)})}else{s.classList.remove('sw-story-on');if(sio)stepsOf(s).forEach(function(st){sio.unobserve(st)})}})}
108
+ function loadPlayer(src,mod){return new Promise(function(ok,no){var s=d.createElement('script');if(mod)s.type='module';s.src=src;s.onload=ok;s.onerror=no;d.head.appendChild(s)})}
109
+ var lotties=[].slice.call(d.querySelectorAll('[data-sw-lottie]')),lottieP=null;
110
+ function lottieAllowed(){return !reduced()&&h.hasAttribute('data-sw-motion')}
111
+ function posterOf(f){return f.querySelector('.sw-lottie__poster')}
112
+ function startLottie(f){if(f._swStarted)return;f._swStarted=1;(lottieP=lottieP||loadPlayer('/_motion/lottie.js')).then(function(){if(!window.lottie)return;var a=window.lottie.loadAnimation({container:f.querySelector('.sw-lottie__stage'),renderer:'svg',loop:f.getAttribute('data-lottie-loop')==='true',autoplay:false,path:f.getAttribute('data-sw-lottie'),rendererSettings:{preserveAspectRatio:'xMidYMid meet'}});
113
+ a.addEventListener('DOMLoaded',function(){f._sw=a;if(a.animationData&&a.animationData.w&&a.animationData.h)f.style.setProperty('--sw-lottie-ratio',a.animationData.w+' / '+a.animationData.h);syncLottie(f)})}).catch(function(){})}
114
+ function syncLottie(f){var a=f._sw,t=f.querySelector('[data-sw-lottie-toggle]'),ok=lottieAllowed();if(t)t.hidden=!ok||!a;if(!a)return;
115
+ if(!ok){a.pause();if(posterOf(f))f.classList.remove('sw-lottie-ready');else{a.goToAndStop(Math.max(0,a.totalFrames-1),true);f.classList.add('sw-lottie-ready')}return}
116
+ f.classList.add('sw-lottie-ready');if(f._vis&&f.dataset.userPaused!=='1')a.play();else a.pause()}
117
+ function watchLotties(){if(!lotties.length)return;if(!('IntersectionObserver' in window)){lotties.forEach(function(f){f._vis=true;if(lottieAllowed()||!posterOf(f))startLottie(f)});return}
118
+ var lio=new IntersectionObserver(function(es){es.forEach(function(en){var f=en.target;f._vis=en.isIntersecting;if(en.isIntersecting&&(lottieAllowed()||!posterOf(f)))startLottie(f);syncLottie(f)})},{rootMargin:'200px 0px'});lotties.forEach(function(f){lio.observe(f)})}
119
+ function setLotties(){lotties.forEach(function(f){if(f._vis&&(lottieAllowed()||!posterOf(f)))startLottie(f);syncLottie(f)})}
120
+ var models=[].slice.call(d.querySelectorAll('[data-sw-model] model-viewer')),modelP=null;
121
+ function setModels(){var spin=!reduced()&&h.hasAttribute('data-sw-motion');models.forEach(function(m){if(spin&&m.hasAttribute('data-auto-rotate'))m.setAttribute('auto-rotate','');else m.removeAttribute('auto-rotate')})}
122
+ function watchModels(){if(!models.length)return;function go(){modelP=modelP||loadPlayer('/_motion/model-viewer.js',true).catch(function(){})}if(!('IntersectionObserver' in window)){go();return}
123
+ var mio=new IntersectionObserver(function(es){if(es.some(function(en){return en.isIntersecting})){mio.disconnect();go()}},{rootMargin:'400px 0px'});models.forEach(function(m){mio.observe(m)})}
124
+ var scenes=[].slice.call(d.querySelectorAll('[data-sw-scene]'));
125
+ function sceneOk(){return !reduced()&&!saveData&&h.hasAttribute('data-sw-motion')&&'IntersectionObserver' in window}
126
+ function scenePlaying(f){return sceneOk()&&!!f._vis&&f.dataset.userPaused!=='1'}
127
+ function themeOf(){var cs=getComputedStyle(h),o={};['primary','accent','text','bg','surface','muted','border'].forEach(function(k){var v=cs.getPropertyValue('--sw-color-'+k).trim();if(v)o[k]=v});return o}
128
+ function post(f,type,value){if(f._ready&&f._frame&&f._frame.contentWindow)f._frame.contentWindow.postMessage({sw:'scene',type:type,value:value},'*')}
129
+ function startScene(f){if(f._frame)return;var fr=d.createElement('iframe');fr.className='sw-scene__frame';fr.setAttribute('sandbox','allow-scripts');fr.setAttribute('title',f.getAttribute('data-scene-title')||'');if(!f.hasAttribute('data-scene-interactive')){fr.setAttribute('tabindex','-1');fr.setAttribute('aria-hidden','true')}fr.src=f.getAttribute('data-sw-scene');f._frame=fr;f.querySelector('.sw-scene__stage').appendChild(fr)}
130
+ function stopScene(f){if(f._frame){f._frame.remove();f._frame=null}f._ready=0;f.classList.remove('sw-scene-ready');var t=f.querySelector('[data-sw-scene-toggle]');if(t)t.hidden=true}
131
+ function syncScene(f){var t=f.querySelector('[data-sw-scene-toggle]');if(!sceneOk()){if(f._frame)stopScene(f);return}if(t)t.hidden=!f._ready;post(f,'playing',scenePlaying(f))}
132
+ window.addEventListener('message',function(e){var m=e.data;if(!m||m.sw!=='scene')return;scenes.forEach(function(f){if(!f._frame||e.source!==f._frame.contentWindow)return;
133
+ if(m.type==='loaded'){var props={};try{props=JSON.parse(f.getAttribute('data-scene-props')||'{}')}catch(x){}f._frame.contentWindow.postMessage({sw:'scene',type:'init',title:f.getAttribute('data-scene-title')||'',props:props,theme:themeOf(),progress:f._p||0,playing:scenePlaying(f),reducedMotion:reduced(),state:f._state||null},'*')}
134
+ else if(m.type==='ready'){f._ready=1;f.classList.add('sw-scene-ready');syncScene(f)}else if(m.type==='error'){f._failed=1;stopScene(f)}
135
+ else if(m.type==='navigate'&&typeof m.href==='string'){var href=m.href,local=href.charAt(0)==='/'&&href.charAt(1)!=='/';if((local||/^https?:/.test(href))&&(f.getAttribute('data-scene-props')||'').indexOf(JSON.stringify(href))>=0)location.assign(href)}})});
136
+ function watchScenes(){if(!scenes.length||!('IntersectionObserver' in window))return;var scio=new IntersectionObserver(function(es){es.forEach(function(en){var f=en.target;f._vis=en.isIntersecting;if(en.isIntersecting&&sceneOk()&&!f._failed)startScene(f);syncScene(f)})},{rootMargin:'300px 0px'});scenes.forEach(function(f){scio.observe(f)})}
137
+ function setScenes(){scenes.forEach(function(f){if(f._vis&&sceneOk()&&!f._failed)startScene(f);syncScene(f)})}
138
+ function fmt(el,v){var dec=+el.getAttribute('data-count-decimals')||0;var s=v.toFixed(dec);if(el.hasAttribute('data-count-group')){var p=s.split('.');p[0]=p[0].replace(/\B(?=(\d{3})+(?!\d))/g,',');s=p.join('.')}return (el.getAttribute('data-count-prefix')||'')+s+(el.getAttribute('data-count-suffix')||'')}
139
+ function count(block){[].slice.call(block.querySelectorAll('[data-count-to]')).forEach(function(el){var to=+el.getAttribute('data-count-to'),final=el.textContent,t0=0,dur=1200;el.textContent=fmt(el,0);function step(t){if(!t0)t0=t;var k=Math.min(1,(t-t0)/dur),e=1-Math.pow(1-k,3);el.textContent=k<1?fmt(el,to*e):final;if(k<1&&!reduced())requestAnimationFrame(step);else el.textContent=final}requestAnimationFrame(step)})}
140
+ d.addEventListener('click',function(e){var tg=e.target&&e.target.closest?e.target.closest('[data-sw-video-toggle]'):null;if(tg){var v=tg.parentNode.querySelector('[data-sw-bg-video]');if(!v)return;if(v.paused){v.dataset.userPaused='0';var p=v.play();if(p&&p.catch)p.catch(function(){});tg.setAttribute('aria-pressed','false');tg.textContent='Pause background video'}else{v.dataset.userPaused='1';v.pause();tg.setAttribute('aria-pressed','true');tg.textContent='Play background video'}return}
141
+ var stg=e.target&&e.target.closest?e.target.closest('[data-sw-scene-toggle]'):null;if(stg){var sf=stg.closest('[data-sw-scene]');if(!sf)return;var sp=sf.dataset.userPaused!=='1';sf.dataset.userPaused=sp?'1':'0';stg.setAttribute('aria-pressed',sp?'true':'false');stg.textContent=sp?'Play animation':'Pause animation';syncScene(sf);return}
142
+ var lt=e.target&&e.target.closest?e.target.closest('[data-sw-lottie-toggle]'):null;if(lt){var lf=lt.closest('[data-sw-lottie]');if(!lf)return;var lp=lf.dataset.userPaused!=='1';lf.dataset.userPaused=lp?'1':'0';lt.setAttribute('aria-pressed',lp?'true':'false');lt.textContent=lp?'Play animation':'Pause animation';syncLottie(lf);return}
143
+ var mt=e.target&&e.target.closest?e.target.closest('[data-sw-marquee-toggle]'):null;if(mt){var mq=mt.closest('[data-motion-marquee]');if(!mq)return;var paused=mq.classList.toggle('sw-marquee-paused');mt.setAttribute('aria-pressed',paused?'true':'false');mt.textContent=paused?'Play scrolling':'Pause scrolling';return}
144
+ var b=e.target&&e.target.closest?e.target.closest('[data-sw-motion-switch]'):null;if(!b)return;var next=!reduced();try{localStorage.setItem(K,next?'1':'0')}catch(err){}if(sync())d.querySelectorAll('[data-motion]').forEach(arrive);if(scrollers.length)onScroll();setVideos();setMarquees();setStories();setLotties();setModels();setScenes()});
145
+ var blocks=[].slice.call(d.querySelectorAll('[data-motion]'));
146
+ var scrollers=[].slice.call(d.querySelectorAll('[data-motion-scroll="parallax"],[data-motion-scroll="fade-out"],[data-sw-scene]')),ticking=false;
147
+ function measure(){ticking=false;var vh=window.innerHeight||h.clientHeight;scrollers.forEach(function(el){if(reduced()){el.style.removeProperty('--sw-scroll');return}var r=el.getBoundingClientRect();var p=Math.max(0,Math.min(1,(vh-r.top)/(vh+r.height)));if(el.hasAttribute('data-sw-scene')){el._p=p;post(el,'progress',p);return}el.style.setProperty('--sw-scroll',String(p.toFixed(3)))})}
148
+ function onScroll(){if(!ticking){ticking=true;requestAnimationFrame(measure)}}
149
+ if(scrollers.length){window.addEventListener('scroll',onScroll,{passive:true});window.addEventListener('resize',onScroll);measure()}
150
+ blocks.forEach(function(b){if(b.hasAttribute('data-motion-stagger'))[].slice.call(b.querySelectorAll(${JSON.stringify(ITEMS + ' > *')})).forEach(function(it,i){it.style.setProperty('--sw-motion-index',String(Math.min(i,12)))})});
151
+ setVideos();setMarquees();setStories();setModels();watchModels();watchLotties();watchScenes();
152
+ if(sync()||!h.hasAttribute('data-sw-motion')||!('IntersectionObserver' in window)){blocks.forEach(arrive);return}
153
+ var counters=[].slice.call(d.querySelectorAll('[data-motion-count]'));
154
+ var cio=new IntersectionObserver(function(es){es.forEach(function(en){if(en.isIntersecting){cio.unobserve(en.target);count(en.target)}})},{threshold:0.4});
155
+ counters.forEach(function(c){cio.observe(c)});
156
+ var vh=window.innerHeight||d.documentElement.clientHeight;
157
+ var io=new IntersectionObserver(function(es){es.forEach(function(en){if(en.isIntersecting){arrive(en.target);io.unobserve(en.target)}})},{rootMargin:'0px 0px -8% 0px'});
158
+ blocks.forEach(function(b){if(b.getBoundingClientRect().top<vh)arrive(b);else io.observe(b)});
159
+ h.classList.add('sw-motion-ready');
160
+ })();`;
161
+ //# sourceMappingURL=motion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion.js","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8GAA8G;AAC9G,MAAM,KAAK,GAAG,qJAAqJ,CAAC;AAEpK,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;4DAakC,KAAK;;;;;kEAKC,KAAK;sBACjD,KAAK;8CACmB,KAAK;iCAClB,KAAK;kDACY,KAAK;2DACI,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC/D,CAAC;AAEF,yGAAyG;AACzG,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAErD;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,oDAAoD,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uGAsEZ,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC;;;;;;;;;;MAU/H,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Personalize block: two slots, `default` and `variant`; visitors who match the audience get the
3
+ * variant. On a cached page the server renders the default inside `<div data-sw-island="…">` and the
4
+ * island script swaps in the visitor's version; the island endpoint renders the block with `show`
5
+ * set. In the editor both slots are shown stacked with labels. Server-safe.
6
+ */
7
+ import type { ComponentConfig, Slot } from '@puckeditor/core';
8
+ export interface PersonalizeProps {
9
+ audienceKey: string;
10
+ default: Slot;
11
+ variant: Slot;
12
+ /** Set by the server on cached pages: `<entityId>/<blockId>`; null renders the content inline. Never stored. */
13
+ island?: string | null;
14
+ /** Set by the island endpoint: which slot this visitor sees. Never stored. */
15
+ show?: string;
16
+ }
17
+ export declare const personalizeComponent: ComponentConfig<PersonalizeProps>;
18
+ export declare const islandCss = "/* ---------- Personalize and Experiment islands ---------- */\n\n.sw-island--editing { padding: var(--sw-space-2); border: 1px dashed var(--sw-color-border); border-radius: var(--sw-radius, 8px); }\n.sw-island__label {\n margin: var(--sw-space-1) 0;\n font-size: 0.8rem;\n font-weight: 600;\n letter-spacing: 0.02em;\n text-transform: uppercase;\n color: var(--sw-color-muted);\n}\n.sw-island__slot { min-height: 0; }\n.sw-island--editing .sw-island__slot { min-height: 2.5rem; }\n";
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const personalizeComponent = {
3
+ label: 'Personalize',
4
+ fields: {
5
+ audienceKey: { type: 'text', label: 'Audience key', placeholder: 'from Audiences in the admin' },
6
+ default: { type: 'slot', label: 'Default content' },
7
+ variant: { type: 'slot', label: 'Content for the audience' },
8
+ },
9
+ defaultProps: { audienceKey: '', default: [], variant: [] },
10
+ render: ({ audienceKey, default: Default, variant: Variant, island, show, puck }) => {
11
+ if (puck?.isEditing) {
12
+ return (_jsxs("div", { className: "sw-island sw-island--editing", "data-sw-audience": audienceKey || undefined, children: [_jsx("div", { className: "sw-island__label", children: "Default (everyone else)" }), _jsx(Default, { className: "sw-island__slot" }), _jsxs("div", { className: "sw-island__label", children: ["Audience: ", audienceKey || 'none selected'] }), _jsx(Variant, { className: "sw-island__slot" })] }));
13
+ }
14
+ const Content = show === 'variant' ? Variant : Default;
15
+ return (_jsx("div", { className: "sw-island sw-personalize", "data-sw-island": island || undefined, "data-sw-audience": audienceKey || undefined, "data-sw-variant": show === 'variant' ? 'variant' : undefined, children: _jsx(Content, { className: "sw-island__slot" }) }));
16
+ },
17
+ };
18
+ export const islandCss = `/* ---------- Personalize and Experiment islands ---------- */
19
+
20
+ .sw-island--editing { padding: var(--sw-space-2); border: 1px dashed var(--sw-color-border); border-radius: var(--sw-radius, 8px); }
21
+ .sw-island__label {
22
+ margin: var(--sw-space-1) 0;
23
+ font-size: 0.8rem;
24
+ font-weight: 600;
25
+ letter-spacing: 0.02em;
26
+ text-transform: uppercase;
27
+ color: var(--sw-color-muted);
28
+ }
29
+ .sw-island__slot { min-height: 0; }
30
+ .sw-island--editing .sw-island__slot { min-height: 2.5rem; }
31
+ `;
32
+ //# sourceMappingURL=personalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personalize.js","sourceRoot":"","sources":["../src/personalize.tsx"],"names":[],"mappings":";AAkBA,MAAM,CAAC,MAAM,oBAAoB,GAAsC;IACrE,KAAK,EAAE,aAAa;IACpB,MAAM,EAAE;QACN,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,6BAA6B,EAAE;QAChG,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE;QACnD,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B,EAAE;KAC7D;IACD,YAAY,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAC3D,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QAClF,IAAI,IAAI,EAAE,SAAS,EAAE,CAAC;YACpB,OAAO,CACL,eAAK,SAAS,EAAC,8BAA8B,sBAAmB,WAAW,IAAI,SAAS,aACtF,cAAK,SAAS,EAAC,kBAAkB,wCAA8B,EAC/D,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,GAAG,EACvC,eAAK,SAAS,EAAC,kBAAkB,2BAAY,WAAW,IAAI,eAAe,IAAO,EAClF,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,GAAG,IACnC,CACP,CAAC;QACJ,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QACvD,OAAO,CACL,cAAK,SAAS,EAAC,0BAA0B,oBAAiB,MAAM,IAAI,SAAS,sBAAoB,WAAW,IAAI,SAAS,qBAAmB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,YACpL,KAAC,OAAO,IAAC,SAAS,EAAC,iBAAiB,GAAG,GACnC,CACP,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;CAaxB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ /** A Lottie file the player reads: JSON from the media library or another URL. */
3
+ export declare const isLottieFile: (src: string | undefined) => boolean;
4
+ /** A model file <model-viewer> reads. */
5
+ export declare const isModelFile: (src: string | undefined) => boolean;
6
+ export interface LottieProps {
7
+ src: string;
8
+ /** Shown while the player loads and to visitors who see no motion. */
9
+ poster: string;
10
+ /** What the animation shows, for screen readers; empty when it is decoration. */
11
+ alt: string;
12
+ loop: boolean;
13
+ size: 's' | 'm' | 'l';
14
+ caption: string;
15
+ }
16
+ export declare const lottieComponent: ComponentConfig<LottieProps>;
17
+ export interface Model3DProps {
18
+ src: string;
19
+ /** Required: what the model is, for screen readers and search engines. */
20
+ alt: string;
21
+ /** Shown until the model loads, and without JavaScript. */
22
+ poster: string;
23
+ autoRotate: boolean;
24
+ /** "View in your space" on phones that support it. */
25
+ ar: boolean;
26
+ height: 's' | 'm' | 'l';
27
+ caption: string;
28
+ }
29
+ export declare const model3dComponent: ComponentConfig<Model3DProps>;
30
+ export declare const PLAYERS_CSS = "\n/* Lottie: the poster until the player has drawn the first frame (sw-lottie-ready), then the animation's own SVG. */\n.sw-lottie { margin-inline: auto; text-align: center; }\n.sw-lottie--s { max-width: 240px; }\n.sw-lottie--m { max-width: 480px; }\n.sw-lottie--l { max-width: 720px; }\n.sw-lottie__stage { position: relative; }\n.sw-lottie:not(:has(.sw-lottie__poster)) .sw-lottie__stage { aspect-ratio: var(--sw-lottie-ratio, 1); }\n.sw-lottie__poster { display: block; width: 100%; height: auto; }\n.sw-lottie__stage > svg { position: absolute; inset: 0; }\n.sw-lottie:not(.sw-lottie-ready) .sw-lottie__stage > svg, .sw-lottie-ready .sw-lottie__poster { visibility: hidden; }\n.sw-lottie__caption, .sw-model__caption { margin-top: var(--sw-space-1, 0.5rem); font-size: 0.875rem; color: var(--sw-color-muted); text-align: center; }\n/* 3D model: the viewer fills the figure; its poster shows until the model loads, and without JavaScript. */\n.sw-model { margin-inline: auto; }\n.sw-model__viewer, .sw-model > .sw-model__poster { display: block; width: 100%; height: var(--sw-model-height, 420px); background: var(--sw-color-surface, transparent); border-radius: var(--sw-radius, 8px); }\n.sw-model__poster { object-fit: contain; }\n.sw-model--s { --sw-model-height: 280px; }\n.sw-model--l { --sw-model-height: 600px; }\n@media (max-width: 640px) { .sw-model--l { --sw-model-height: 420px; } }\nmodel-viewer:not(:defined) > .sw-model__poster { display: block; width: 100%; height: 100%; object-fit: contain; }\n";
@@ -0,0 +1,95 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Lottie and 3D model blocks (docs/dev/motion.md, phase 2). Both render on the server as a figure with their poster image, which
4
+ * is all a visitor gets without JavaScript; the page's motion script loads a self-hosted player (`/_motion/lottie.js`,
5
+ * `/_motion/model-viewer.js`) only when the block comes near the screen.
6
+ *
7
+ * - Lottie plays a vector animation (.json) when in view, looped with a pause button or once. Without motion (the brand's level
8
+ * off, or the visitor reduces motion) it shows the poster, or the animation's last frame when there is no poster.
9
+ * - 3D model shows a .glb or .gltf file people can turn and zoom, with an optional AR button on phones. It is not motion: it loads
10
+ * whatever the motion level, and only its auto-rotation stops when the visitor reduces motion.
11
+ */
12
+ import { createElement } from 'react';
13
+ const cx = (...c) => c.filter(Boolean).join(' ');
14
+ const sizeOptions = [
15
+ { label: 'Small', value: 's' },
16
+ { label: 'Medium', value: 'm' },
17
+ { label: 'Large', value: 'l' },
18
+ ];
19
+ /** A Lottie file the player reads: JSON from the media library or another URL. */
20
+ export const isLottieFile = (src) => /\.json(\?.*)?$/i.test((src ?? '').trim());
21
+ /** A model file <model-viewer> reads. */
22
+ export const isModelFile = (src) => /\.(glb|gltf)(\?.*)?$/i.test((src ?? '').trim());
23
+ export const lottieComponent = {
24
+ label: 'Lottie animation',
25
+ fields: {
26
+ src: { type: 'text', label: 'Animation file URL (.json)', placeholder: '/media/....json' },
27
+ poster: { type: 'text', label: 'Poster image URL (shown without motion)', placeholder: '/media/...' },
28
+ alt: { type: 'text', label: 'Alt text (empty when it is decoration)', placeholder: 'Describe what it shows' },
29
+ loop: { type: 'radio', label: 'Play', options: [{ label: 'In a loop, with a pause button', value: true }, { label: 'Once', value: false }] },
30
+ size: { type: 'radio', label: 'Size', options: sizeOptions },
31
+ caption: { type: 'text', label: 'Caption' },
32
+ },
33
+ defaultProps: { src: '', poster: '', alt: '', loop: true, size: 'm', caption: '' },
34
+ render: ({ src, poster, alt, loop, size, caption }) => {
35
+ const file = isLottieFile(src) ? src.trim() : '';
36
+ const label = (alt ?? '').trim();
37
+ return (_jsxs("figure", { className: cx('sw-block', 'sw-lottie', `sw-lottie--${size || 'm'}`), "data-sw-lottie": file || undefined, "data-lottie-loop": loop ? 'true' : 'false', children: [_jsx("div", { className: "sw-lottie__stage", ...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': 'true' }), children: poster?.trim() ? _jsx("img", { className: "sw-lottie__poster", src: poster.trim(), alt: "", loading: "lazy" }) : null }), file && loop ? (_jsx("button", { type: "button", className: "sw-lottie-toggle", "data-sw-lottie-toggle": "", "aria-pressed": "false", hidden: true, children: "Pause animation" })) : null, caption?.trim() ? _jsx("figcaption", { className: "sw-lottie__caption", children: caption }) : null] }));
38
+ },
39
+ };
40
+ export const model3dComponent = {
41
+ label: '3D model',
42
+ fields: {
43
+ src: { type: 'text', label: 'Model file URL (.glb or .gltf)', placeholder: '/media/....glb' },
44
+ alt: { type: 'text', label: 'Alt text (required)', placeholder: 'Describe the object' },
45
+ poster: { type: 'text', label: 'Poster image URL (shown while it loads)', placeholder: '/media/...' },
46
+ autoRotate: { type: 'radio', label: 'Turn slowly on its own', options: [{ label: 'Yes', value: true }, { label: 'No', value: false }] },
47
+ ar: { type: 'radio', label: 'View in your space (AR on phones)', options: [{ label: 'Yes', value: true }, { label: 'No', value: false }] },
48
+ height: { type: 'radio', label: 'Height', options: sizeOptions },
49
+ caption: { type: 'text', label: 'Caption' },
50
+ },
51
+ defaultProps: { src: '', alt: '', poster: '', autoRotate: true, ar: false, height: 'm', caption: '' },
52
+ render: ({ src, alt, poster, autoRotate, ar, height, caption }) => {
53
+ const file = isModelFile(src) ? src.trim() : '';
54
+ const label = (alt ?? '').trim();
55
+ const still = poster?.trim() ? _jsx("img", { className: "sw-model__poster", slot: "poster", src: poster.trim(), alt: label }) : null;
56
+ // <model-viewer> is a custom element the self-hosted player defines; until then (and without JavaScript) its poster shows.
57
+ const viewer = file
58
+ ? createElement('model-viewer', {
59
+ className: 'sw-model__viewer',
60
+ src: file,
61
+ alt: label || undefined,
62
+ 'camera-controls': '',
63
+ 'touch-action': 'pan-y',
64
+ 'interaction-prompt': 'auto',
65
+ 'shadow-intensity': '1',
66
+ loading: 'lazy',
67
+ ...(autoRotate ? { 'data-auto-rotate': '' } : {}),
68
+ ...(ar ? { ar: '', 'ar-modes': 'webxr scene-viewer quick-look' } : {}),
69
+ }, still)
70
+ : still;
71
+ return (_jsxs("figure", { className: cx('sw-block', 'sw-model', `sw-model--${height || 'm'}`), "data-sw-model": file ? '' : undefined, children: [viewer, caption?.trim() ? _jsx("figcaption", { className: "sw-model__caption", children: caption }) : null] }));
72
+ },
73
+ };
74
+ export const PLAYERS_CSS = `
75
+ /* Lottie: the poster until the player has drawn the first frame (sw-lottie-ready), then the animation's own SVG. */
76
+ .sw-lottie { margin-inline: auto; text-align: center; }
77
+ .sw-lottie--s { max-width: 240px; }
78
+ .sw-lottie--m { max-width: 480px; }
79
+ .sw-lottie--l { max-width: 720px; }
80
+ .sw-lottie__stage { position: relative; }
81
+ .sw-lottie:not(:has(.sw-lottie__poster)) .sw-lottie__stage { aspect-ratio: var(--sw-lottie-ratio, 1); }
82
+ .sw-lottie__poster { display: block; width: 100%; height: auto; }
83
+ .sw-lottie__stage > svg { position: absolute; inset: 0; }
84
+ .sw-lottie:not(.sw-lottie-ready) .sw-lottie__stage > svg, .sw-lottie-ready .sw-lottie__poster { visibility: hidden; }
85
+ .sw-lottie__caption, .sw-model__caption { margin-top: var(--sw-space-1, 0.5rem); font-size: 0.875rem; color: var(--sw-color-muted); text-align: center; }
86
+ /* 3D model: the viewer fills the figure; its poster shows until the model loads, and without JavaScript. */
87
+ .sw-model { margin-inline: auto; }
88
+ .sw-model__viewer, .sw-model > .sw-model__poster { display: block; width: 100%; height: var(--sw-model-height, 420px); background: var(--sw-color-surface, transparent); border-radius: var(--sw-radius, 8px); }
89
+ .sw-model__poster { object-fit: contain; }
90
+ .sw-model--s { --sw-model-height: 280px; }
91
+ .sw-model--l { --sw-model-height: 600px; }
92
+ @media (max-width: 640px) { .sw-model--l { --sw-model-height: 420px; } }
93
+ model-viewer:not(:defined) > .sw-model__poster { display: block; width: 100%; height: 100%; object-fit: contain; }
94
+ `;
95
+ //# sourceMappingURL=players.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"players.js","sourceRoot":"","sources":["../src/players.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;AACH,OAAO,EAA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OAAO,EAAE,MAAM;gBACf,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjD,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,+BAA+B,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACvE,EACD,KAAK,CACN;YACH,CAAC,CAAC,KAAK,CAAC;QACV,OAAO,CACL,kBAAQ,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,MAAM,IAAI,GAAG,EAAE,CAAC,mBAAiB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,aAC9G,MAAM,EACN,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,qBAAY,SAAS,EAAC,mBAAmB,YAAE,OAAO,GAAc,CAAC,CAAC,CAAC,IAAI,IACnF,CACV,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;CAoB1B,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * RegistryBrowse: search and browse the package registry. The stored props hold the defaults
3
+ * (kind, page size, whether to show the search box); the server fills `data` from the registry
4
+ * service and the page URL (?q=&kind=&sort=&page=), so the form is a plain GET form and the
5
+ * page works without JavaScript. Server-safe.
6
+ */
7
+ import type { ComponentConfig } from '@puckeditor/core';
8
+ import type { RegistryBrowseData, RegistryKindFilter, RegistrySort } from './registry-types.js';
9
+ export interface RegistryBrowseProps {
10
+ /** The kind the page opens on when the URL names none. */
11
+ kind: RegistryKindFilter;
12
+ pageSize: number;
13
+ showSearch: boolean;
14
+ showKinds: boolean;
15
+ showSort: boolean;
16
+ layout: 'list' | 'grid';
17
+ emptyText: string;
18
+ /** The package names' heading level. H2 (the default) suits a list right under the page title; H3 one under its own H2 heading. */
19
+ titleLevel?: 'h2' | 'h3';
20
+ /** Resolved by the server; never stored. */
21
+ data?: RegistryBrowseData;
22
+ }
23
+ export declare const BROWSE_SORTS: {
24
+ key: RegistrySort;
25
+ label: string;
26
+ }[];
27
+ export declare function RegistryPager({ data }: {
28
+ data: Pick<RegistryBrowseData, 'page' | 'pages' | 'prevHref' | 'nextHref' | 'pageHrefs'>;
29
+ }): import("react").JSX.Element | null;
30
+ export declare const registryBrowseComponent: ComponentConfig<RegistryBrowseProps>;
31
+ export declare const registryBrowseCss = "/* ---------- Registry: browse ---------- */\n\n.sw-reg-search { display: flex; flex-wrap: wrap; gap: var(--sw-space-2); align-items: flex-end; margin-bottom: var(--sw-space-2); }\n.sw-reg-search__field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 16rem; min-width: 0; }\n.sw-reg-search__field--sort { flex: 0 1 14rem; }\n.sw-reg-search__label { font-size: 0.85rem; font-weight: 600; }\n.sw-reg-search__input { font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--sw-color-border); border-radius: var(--sw-radius, 8px); background: var(--sw-color-bg, #fff); color: inherit; min-width: 0; }\n.sw-reg-search__input:focus { outline: none; box-shadow: var(--sw-focus-ring); }\n.sw-reg-search__actions { display: flex; gap: var(--sw-space-2); align-items: center; }\n.sw-reg-search__reset { font-size: 0.9rem; }\n.sw-reg-tabs { margin-bottom: var(--sw-space-2); border-bottom: 1px solid var(--sw-color-border); overflow-x: auto; }\n.sw-reg-tabs__list { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }\n.sw-reg-tab { display: inline-flex; align-items: center; gap: 6px; padding: 0.55rem 0.9rem; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--sw-color-muted); text-decoration: none; font-weight: 600; white-space: nowrap; }\n.sw-reg-tab:hover { color: var(--sw-color-text); text-decoration: none; }\n.sw-reg-tab--current { color: var(--sw-color-primary, #1d4ed8); border-bottom-color: var(--sw-color-primary, #1d4ed8); }\n.sw-reg-tab__count { font-size: 0.75rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--sw-color-surface); color: var(--sw-color-muted); }\n";