efficient-web-builder 73.2.0 → 74.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/editor/components/CustomHtmlCodeWindow.d.ts +11 -0
  3. package/dist/editor/components/CustomHtmlCodeWindow.js +20 -0
  4. package/dist/editor/components/PreviewPartAnchors.d.ts +2 -1
  5. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  6. package/dist/editor/components/SectionThemePicker.d.ts +3 -2
  7. package/dist/editor/components/SectionThemePicker.js +1 -1
  8. package/dist/editor/components/SiteTextStylesField.d.ts +2 -1
  9. package/dist/editor/components/SiteTextStylesField.js +1 -1
  10. package/dist/editor/components/StandaloneSectionEditor.js +1 -1
  11. package/dist/editor/components/StorefrontEditor.js +1 -1
  12. package/dist/editor/components/WebsiteSettingsPanel.d.ts +2 -0
  13. package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
  14. package/dist/editor/components/storefront-editor.css +111 -0
  15. package/dist/editor/lib/document/blocks/general/CustomHTML/fields.d.ts +6 -0
  16. package/dist/editor/lib/document/blocks/general/CustomHTML/fields.js +1 -0
  17. package/dist/editor/lib/document/blocks/general/index.js +1 -1
  18. package/dist/editor/lib/document/controls.d.ts +2 -0
  19. package/dist/editor/lib/document/controls.js +1 -1
  20. package/dist/editor/lib/document/custom-html-preview.d.ts +12 -0
  21. package/dist/editor/lib/document/custom-html-preview.js +1 -0
  22. package/dist/editor/lib/document/own-pad-fields.d.ts +7 -1
  23. package/dist/editor/lib/document/own-pad-fields.js +1 -1
  24. package/dist/format/lib/animation/hover.js +1 -1
  25. package/dist/format/lib/animation/loop.js +1 -1
  26. package/dist/format/lib/content/accordion-row-style.js +1 -1
  27. package/dist/format/lib/content/borders.d.ts +2 -1
  28. package/dist/format/lib/content/borders.js +1 -1
  29. package/dist/format/lib/content/box-layout.js +1 -1
  30. package/dist/format/lib/content/button-icon.js +1 -1
  31. package/dist/format/lib/content/card-place.js +1 -1
  32. package/dist/format/lib/content/chat-launcher.js +1 -1
  33. package/dist/format/lib/content/container-direction.js +1 -1
  34. package/dist/format/lib/content/footprint.js +1 -1
  35. package/dist/format/lib/content/image-fit.js +1 -1
  36. package/dist/format/lib/content/image-text-rows.js +1 -1
  37. package/dist/format/lib/content/list-number.js +1 -1
  38. package/dist/format/lib/content/list-position.js +1 -1
  39. package/dist/format/lib/content/text-tag.js +1 -1
  40. package/dist/format/lib/document/blocks/block-types.d.ts +1 -0
  41. package/dist/format/lib/document/blocks/general/text-part-shapes.json +0 -6
  42. package/dist/format/lib/document/box-footer.js +1 -1
  43. package/dist/format/lib/document/custom-html-place.d.ts +19 -0
  44. package/dist/format/lib/document/custom-html-place.js +7 -0
  45. package/dist/format/lib/document/left-view.js +1 -1
  46. package/dist/format/lib/document/mockup-variant-fields.js +1 -1
  47. package/dist/format/lib/document/part-inks.d.ts +1 -0
  48. package/dist/format/lib/document/part-inks.js +1 -1
  49. package/dist/format/lib/document/passes/types.d.ts +4 -2
  50. package/dist/format/lib/editor-words-catalogue.d.ts +19 -0
  51. package/dist/format/lib/editor-words-catalogue.js +4 -4
  52. package/dist/format/lib/hero-arrows.js +1 -1
  53. package/dist/format/lib/hero-group-placement.js +1 -1
  54. package/dist/format/lib/hero-media-layout.js +1 -1
  55. package/dist/format/lib/hero-phone-stack.js +1 -1
  56. package/dist/format/lib/hero-video.js +1 -1
  57. package/dist/format/lib/reel.js +1 -1
  58. package/dist/format/lib/sections/divider-style.js +1 -1
  59. package/dist/format/lib/sections/hero-overlay.js +1 -1
  60. package/dist/format/lib/sections/intro-bleed-layout.js +1 -1
  61. package/dist/format/lib/sections/logo-look.js +1 -1
  62. package/dist/format/lib/sections/product-card-style.js +1 -1
  63. package/dist/format/lib/sections/section-eyebrow-look.js +1 -1
  64. package/dist/format/lib/sections/section-head-placement.js +1 -1
  65. package/dist/format/lib/sections/section-head-style.js +1 -1
  66. package/dist/format/lib/sections/section-number-style.js +1 -1
  67. package/dist/format/lib/sections/strip-shape.d.ts +1 -0
  68. package/dist/format/lib/sections/strip-shape.js +1 -1
  69. package/dist/format/lib/sections/ticker-style.js +1 -1
  70. package/dist/format/lib/text-style-face.d.ts +6 -0
  71. package/dist/format/lib/text-style-face.js +2 -1
  72. package/dist/format/lib/theme.d.ts +2 -1
  73. package/dist/format/lib/theme.js +3 -3
  74. package/dist/render/components/BoxTabs.js +1 -1
  75. package/dist/render/components/Breadcrumb.d.ts +4 -1
  76. package/dist/render/components/Breadcrumb.js +1 -1
  77. package/dist/render/components/PhoneMenuTools.d.ts +3 -1
  78. package/dist/render/components/PhoneMenuTools.js +1 -1
  79. package/dist/render/components/PublishedPartStylesContext.d.ts +2 -1
  80. package/dist/render/components/PublishedPartStylesContext.js +1 -1
  81. package/dist/render/components/SpecStrip.d.ts +4 -1
  82. package/dist/render/components/SpecStrip.js +1 -1
  83. package/dist/render/lib/content/section-padding.d.ts +24 -14
  84. package/dist/render/lib/content/section-padding.js +1 -1
  85. package/dist/render/lib/document/blocks/general/Breadcrumb/render.js +1 -1
  86. package/dist/render/lib/document/blocks/general/CustomHTML/render.js +1 -1
  87. package/dist/render/lib/document/blocks/general/LocationMap/render.js +1 -1
  88. package/dist/render/lib/document/blocks/general/SpecStrip/render.js +1 -1
  89. package/dist/render/lib/document/blocks/general/section-head-looks.js +1 -1
  90. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +1 -0
  91. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  92. package/dist/render/lib/document/blocks/general/section-to-box-rows-editorial.js +1 -1
  93. package/dist/render/lib/document/blocks/general/section-to-box-rows-logos.js +1 -1
  94. package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -1
  95. package/dist/render/lib/document/blocks/general/section-to-box-rows-strip.js +1 -1
  96. package/dist/render/lib/document/custom-css.d.ts +4 -0
  97. package/dist/render/lib/document/custom-css.js +3 -2
  98. package/dist/render/lib/document/header-clearance.js +1 -1
  99. package/dist/render/lib/document/header-ink.js +1 -1
  100. package/dist/render/lib/document/part-styles.d.ts +7 -4
  101. package/dist/render/lib/document/part-styles.js +2 -2
  102. package/dist/render/lib/document/passes/clickable-parts.js +1 -1
  103. package/dist/render/lib/document/passes/section-padding.d.ts +2 -1
  104. package/dist/render/lib/document/passes/section-padding.js +1 -1
  105. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  106. package/dist/routine-index.json +1 -1
  107. package/dist/value-index.json +1 -1
  108. package/package.json +27 -6
  109. package/dist/format/lib/document/blocks/general/CustomHTML/fields.d.ts +0 -2
  110. package/dist/format/lib/document/blocks/general/CustomHTML/fields.js +0 -1
  111. package/dist/format/lib/parse-option.d.ts +0 -3
  112. package/dist/format/lib/parse-option.js +0 -1
  113. package/dist/format/lib/source-rules/one-option-parser.d.ts +0 -12
  114. package/dist/format/lib/source-rules/one-option-parser.js +0 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## 74.1.0 - 2026-11-21
4
+
5
+ From main at `f81d0ed3`: #824, #825.
6
+
7
+ A minor: the Breadcrumb and the Spec Strip draw one padding, a block can cap the size of the parts it names, and the Cart can join the phone menu. New exports and new optional meta fields; no new peer. No stored key or value moves. An unset Breadcrumb or Spec Strip draws the same bytes as before; a stored one keeps its drawn total.
8
+
9
+ **For hosts:**
10
+ - storefront-blocks: a block that fits a headline to its box (`ProductName`) can declare `partSizeCaps: { name: true }` in its meta and set `--sf-part-size-cap` (`PART_SIZE_CAP_VAR`) to its fit.
11
+ - storefront-blocks: the header tool blocks (Search, Account, Cart, Country, Theme) can take `phonePlaceField(<today's place>)` and offer themselves with `useOfferToPhoneMenu`; a Cart block offers `"cart"`.
12
+
13
+ ### Fixed
14
+
15
+ - **Breadcrumb and Spec Strip draw one vertical padding.** They own their top and bottom padding, as Text and Heading do: their Padding row keeps its keys (`sectionPadding*`), shows the section's own default for an empty side, and an edit names its key in `padTotal`. A total is drawn on their own root (the nav; the strip's row), not on an outer wrapper over a fixed `py-*`, so a top of 40 draws 40, not 40 + 24 (Breadcrumb) or 40 + 16 (Spec Strip), and the strip no longer shows bare page round its dark band. One reader, `framePadAttrs` in `lib/content/section-padding`, with the `py-*` text in `PY_CLASS`; the default numbers have one home (`lib/sections/strip-shape` `CRUMB_PAD`, `SPEC_PAD`), read by the component, the panel and the Box converter (which adds no own px to a total). A node with no total, which is every stored node, draws the same bytes as before: its classes, and any older value on the outer wrapper at its old lines (720 for a tablet or phone value). The Spec Strip's row carries the edge mark when it draws a total's view classes, so its default phone value turns at 800, as its class did. (#825)
16
+ - **The corner and border size limits come from efficient-easel.** `CORNER_RADIUS_MAX` (`lib/theme`) and `BORDER_MAX` (`lib/content/borders`) are now taken from `efficient-easel/screen/lib/content/style-keys` (easel's `BORDER_WIDTH_MAX` under the old name `BORDER_MAX`), not declared here. The names and the values (40, 20) do not change. The draw-imports guard checks that neither file declares its own copy. (#824)
17
+
18
+ ### Added
19
+
20
+ - **A block caps the size of the parts it names.** `BlockRender.partSizeCaps` (`Readonly<Record<string, true>>`) and `PartDeclarationOptions.sizeCap`: a named part draws its own Font size as `min(<size>, var(--sf-part-size-cap, <size>))` on desktop, tablet and phone, on the published sheet and on the canvas. `blockCapsPartSize` and `PART_SIZE_CAP_VAR` are exported. A part that is not named draws the CSS it drew. (#825)
21
+ - **The Cart can join the phone menu.** `PhoneMenuTool` takes `"cart"`; `usePhoneMenuTools()` reports `cart`. `PhonePlace` (`"header" | "menu"`) and `phonePlaceField(fallback)`: the one "On a phone" dropdown (In the header / In the menu) for the header tools. (#825)
22
+
23
+ ## 74.0.0 - 2026-11-19
24
+
25
+ From main at `80ccf42a`: #817, #818, #820, #823.
26
+
27
+ A major: the Custom HTML block gets a code window (Site styles, live preview, Format code), and `parseOption` now comes only from `efficient-shell/format`. The `efficient-shell` and `efficient-easel` peers narrow, nine code-editor peers are new, and two `format/` paths are removed. No stored key or value moves.
28
+
29
+ **Breaking:**
30
+ - `efficient-shell` peer `^13.24.1 || ^14.0.0` -> `^14.5.1` (`CodeEditor.place()`/`format()` and `efficient-shell/code/format`; Shift+Option+F on a Mac). (#820, #818)
31
+ - `efficient-easel` peer `^37.1.0` -> `^37.3.0` (`TextStylesList onPick`, `.sf-editor-tokens`). (#820)
32
+ - New peers: `@codemirror/commands` ^6.11.1, `@codemirror/lang-css` ^6.3.1, `@codemirror/language` ^6.13.1, `@codemirror/state` ^6.7.6, `@codemirror/view` ^6.43.15, `@lezer/common` ^1.5.5, `@lezer/highlight` ^1.2.5, `@lezer/html` ^1.3.13 (required), and `prettier` ^3.0.0 (optional: with none, there is no Format code button). (#820)
33
+ - Removed: `efficient-web-builder/format/lib/parse-option` (use `efficient-shell/format`) and `format/lib/source-rules/one-option-parser` (use the shell ui-check kind `option-read`). (#818)
34
+ - Moved: `lib/document/blocks/general/CustomHTML/fields` from `format/` to `editor/`. No host imports the old path. (#820)
35
+
36
+ **For hosts** (storefront-blocks, admin-portal, storefront), each in its web-builder 74 bump PR:
37
+ 1. Install `efficient-shell` ^14.5.1 and `efficient-easel` ^37.3.0.
38
+ 2. Add all 9 packages explicitly (do not rely on auto-install-peers): `@codemirror/commands@6.11.1 @codemirror/lang-css@6.3.1 @codemirror/language@6.13.1 @codemirror/state@6.7.6 @codemirror/view@6.43.15 @lezer/common@1.5.5 @lezer/highlight@1.2.5 @lezer/html@1.3.13 prettier@3.9.5`.
39
+ 3. Replace every `efficient-web-builder/format/lib/parse-option` import with `efficient-shell/format`. storefront-blocks has 24 src files and 3 scripts that import it; the storefront has 5 hits, all in its vendored blocks copy (they follow the blocks re-vendor). Admin-portal and easel have none.
40
+ 4. storefront-blocks only: rebuild, because it bundles the editor's general blocks and `storefront-editor.css`. The other hosts see the new Custom HTML row only after they install that rebuilt storefront-blocks.
41
+
42
+ ### Added
43
+
44
+ - **Custom HTML code window.** The block's HTML row is one "Edit code" button. It opens a full-size shell `Dialog` with three columns: Styles (pick only: themes, the six palette colours, text styles, block gap; a click places a link in the code at the cursor in one undo step, through `CodeEditor.place()`), a desktop/phone preview in a sandboxed `iframe` drawn by `customHtmlDrawn` (the same function the block render uses), and the shell `CodeEditor` with Format code. A banner names what the sanitiser removes. (#820)
45
+ - **Pick-only Site styles parts.** `SectionThemePicker` takes `canEdit` (default `true`); `SectionThemeMenu` `onEdit` is optional; `SiteTextStylesField` takes `onPick` (easel's picker). Every current host is unchanged by default. (#817)
46
+
47
+ ### Changed
48
+
49
+ - **`parseOption` has one home, `efficient-shell/format`.** 44 files import it from there. `src/lib/parse-option.ts`, the `one-option-parser` rule and their tests are deleted; the shell ui-check kind `option-read` replaces the rule, with 13 allow entries, each with its reason. (#818)
50
+
51
+ ### Guards
52
+
53
+ - **The removal list names every deleted module.** `verify-published-entries` names the two `one-option-parser` files #818 deleted, and a new guard fails when a module the major deletes is missing from the list. (#823)
54
+
3
55
  ## 73.2.0 - 2026-11-19
4
56
 
5
57
  From main at `99f31fec`: #808, #810, #811, #812, #813, #814, #816, #819, #821.
@@ -0,0 +1,11 @@
1
+ import { type CodeFormatter } from "efficient-shell/code";
2
+ export type CodeFormatterLoader = () => Promise<CodeFormatter | null>;
3
+ export declare const loadShellFormatter: CodeFormatterLoader;
4
+ export interface CustomHtmlCodeWindowProps {
5
+ open: boolean;
6
+ onClose: () => void;
7
+ value: string;
8
+ onChange: (next: string) => void;
9
+ loadFormatter?: CodeFormatterLoader;
10
+ }
11
+ export default function CustomHtmlCodeWindow({ open, onClose, value, onChange, loadFormatter }: CustomHtmlCodeWindowProps): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use client";import{jsx as e,jsxs as i,Fragment as te}from"react/jsx-runtime";import{Suspense as oe,useContext as se,useEffect as B,useMemo as x,useRef as M,useState as h}from"react";import{AccordionHeading as k,Banner as ne,Button as C,Card as ie,Dialog as re,DropdownMenu as de,Segmented as ae,Text as r,buttonClasses as le,colorFill as ce,colorSwatchClasses as me,fitFrameStyle as he,fitScale as fe}from"efficient-shell/ui";import{CodeEditor as ue}from"efficient-shell/code";import{ChevronDownIcon as pe}from"efficient-shell/icons/efficient";import{AlignSeparateIcon as we}from"efficient-easel/icons";import{ScreenDocumentContext as ye}from"efficient-easel/screen/components/ScreenDocumentContext";import{usePreviewHeader as be}from"../../render/components/PreviewHeaderContext.js";import ve from"./SectionThemePicker.js";import ge from"./SiteTextStylesField.js";import{siteTextStyleSizeOf as xe}from"./WebsiteSettingsPanel.js";import{useSiteTextStylesWriter as ke}from"../lib/site-text-styles-writer.js";import{siteTextColourNameOf as Ce,siteTextColours as Se}from"../../format/lib/text-styles/site-text-colours.js";import{faceClassOf as Ne,storedTextStyles as Te,textStylesCss as $e}from"../../render/lib/text-styles/site-text-styles.js";import{normalizeTheme as Ae,themePresetAccentVars as ze}from"../../format/lib/theme.js";import{fontRoleStyle as Ee}from"../../format/lib/fonts.js";import{SECTION_PALETTE as W}from"../../format/lib/content/ink.js";import{CONTAINER_GAP_BUILT_IN as Oe,SITE_BLOCK_GAP_VAR as O,siteBlockGapTokens as _e}from"../../format/lib/content/container-gap.js";import{PHONE_EDGE as De}from"../../format/lib/content/view-lines.js";import{placeInsert as Pe}from"../../format/lib/document/custom-html-place.js";import{toHex as Ie}from"../../format/lib/document/part-inks.js";import{CUSTOM_HTML_PREVIEW_SANDBOX as Le,customHtmlPreviewDoc as Re,customHtmlRemoved as He,hostStylesheets as Fe}from"../lib/document/custom-html-preview.js";import{say as o}from"../../format/lib/editor-words.js";const Ge={bg:"Background",fg:"Text",surface:"Card","surface-2":"Card 2",line:"Line",muted:"Soft text"},U=`${Oe.Flex}px`,_=`var(${O}, ${U})`,Be=[{key:"heading",label:"Heading and text",code:`<h2 class="font-heading2">Title</h2>
2
+ <p class="font-body" style="color: var(--fg-dim)">Text</p>
3
+ `},{key:"columns",label:"Two columns",code:`<div style="display: grid; grid-template-columns: 1fr 1fr; gap: ${_}">
4
+ <div><h3 class="font-heading3">Left</h3><p class="font-body">Text</p></div>
5
+ <div><h3 class="font-heading3">Right</h3><p class="font-body">Text</p></div>
6
+ </div>
7
+ `},{key:"table",label:"Table",code:`<table style="width: 100%; border-collapse: collapse">
8
+ <tr><th class="font-mono">Name</th><th class="font-mono">Value</th></tr>
9
+ <tr><td class="font-body">A</td><td class="font-body">1</td></tr>
10
+ </table>
11
+ `},{key:"popup",label:"Icon with popup",code:`<button type="button" popovertarget="more" aria-label="More">ⓘ</button>
12
+ <div popover id="more">
13
+ <h3 class="font-heading3">Title</h3>
14
+ <p class="font-body">Text</p>
15
+ </div>
16
+ `},{key:"faq",label:"Question and answer",code:`<details>
17
+ <summary class="font-heading3">Question</summary>
18
+ <p class="font-body">Answer</p>
19
+ </details>
20
+ `}],Me=()=>import("efficient-shell/code/format").then(n=>n.prettierFormatter,()=>null);function We(n){if(typeof document>"u"||!n)return n;const d=document.createElement("span");if(d.style.color=n,!d.style.color)return n;document.body.appendChild(d);const a=getComputedStyle(d).color;d.remove();const c=document.createElement("canvas").getContext("2d");if(!c)return n;c.fillStyle=a,c.fillRect(0,0,1,1);const[f,S,u]=c.getImageData(0,0,1,1).data;return(Ie(`rgb(${f}, ${S}, ${u})`)??n).toUpperCase()}function Ue({open:n,onClose:d,value:a,onChange:c,loadFormatter:f=Me}){const{theme:S,fonts:u,blockGap:D,siteLengthUnits:P}=be(),m=Ae(S),I=!se(ye)?.capabilities?.hasSiteTheme,p=ke({themeFromDocument:I,persist:()=>{}}),[w,j]=h(m.selected),[N,V]=h("desktop"),[K,Q]=h(void 0),[T,L]=h(null),[R,q]=h(null),$=M(null);B(()=>{if(!n)return;let t=!0;return f().then(s=>{t&&q(s?{format:s.format}:null)}),()=>{t=!1}},[n,f]);const A=x(()=>{const t=ze(m),s=t[`--theme-preset-${w}-bg`]?w:m.selected,l={"--accent":t[`--theme-preset-${s}-accent`]??""};for(const g of W)l[g.token]=t[`--theme-preset-${s}-${g.role}`]??"";return l},[m,w]),H=_e(I?void 0:D,P.blockGapUnit),X=H[O]??U,F=x(()=>{const t=Object.fromEntries(Object.entries(Ee(u)).filter(([s])=>s.startsWith("--")));return{head:typeof document>"u"?"":Fe(document),htmlClass:typeof document>"u"?"":document.documentElement.className,bodyClass:typeof document>"u"?"":document.body.className,vars:{...A,...t,...H},css:$e(Te(p.saved))}},[A,u,D,P.blockGapUnit,p.saved,n]),J=x(()=>Re(a,F),[a,F]),z=x(()=>typeof DOMParser>"u"?[]:He(a),[a]),G=M(null),[E,Y]=h(0);B(()=>{const t=G.current;if(!t||typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>Y(t.clientWidth));return s.observe(t),()=>s.disconnect()},[n]);const y=N==="phone"?390:E>0?Math.max(E,De):1280,b=N==="phone"?1:fe(E,y),v=async t=>{const s=await $.current?.place((l,g,ee)=>Pe(l,g,ee,t));s&&L(s)},Z=async()=>{await $.current?.format()==="formatted"&&L(null)};return e(re,{open:n,onClose:d,size:"full",title:o("Custom HTML"),description:o("Build this section in HTML and CSS. The CSS changes this section only. Scripts do not run."),footer:e(C,{variant:"primary",onClick:d,children:o("Done")}),children:i("div",{className:"sf-code-window","data-code-window":"body",children:[i("aside",{className:"sf-code-window-styles","data-code-window":"styles",children:[e(k,{title:o("Styles"),level:2}),i("div",{className:"es-group-body sf-code-window-group",children:[e(r,{size:"xs",tone:"secondary",as:"p",children:o("Click a colour, text style or spacing to put a link to it in your code, at the cursor. If you change Styles later, this section changes with it.")}),e("div",{className:"es-editor sf-editor-tokens","data-code-window":"theme",children:e(ve,{value:w,onChange:j,hint:o("Shows the preview in this Theme. It adds no code. The section uses the Theme in its own settings."),canEdit:!1})})]}),e(k,{title:o("Colours"),level:2}),e("div",{className:"es-group-body",children:e("div",{className:"sf-code-window-list",role:"list",children:W.map(t=>{const s=o(Ge[t.role]??t.role),l=We(A[t.token]??"");return e("div",{role:"listitem",children:i(C,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${s}: ${o("add")} var(${t.token})`,onClick:()=>{Q(t.token),v({kind:"value",value:`var(${t.token})`,property:"color"})},children:[e("span",{className:me({size:"sm",selected:K===t.token}),"aria-hidden":"true",children:e("span",{className:"absolute inset-0",style:ce(l)})}),e(r,{size:"sm",weight:"medium",children:s}),e(r,{size:"2xs",tone:"tertiary",mono:!0,children:l}),e("span",{className:"sf-code-window-row-sub",children:e(r,{size:"2xs",tone:"secondary",mono:!0,children:t.token})})]})},t.token)})})}),e(k,{title:o("Text styles"),level:2}),e("div",{className:"es-group-body",children:e(ge,{saved:p.saved,old:p.old,colours:Se(m),colourNameOf:Ce(m),sizeOf:xe,onChange:()=>{},onPick:t=>{v({kind:"class",className:Ne(t)})}})}),e(k,{title:o("Spacing"),level:2}),e("div",{className:"es-group-body",children:i(C,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${o("Gap between blocks")}: ${o("add")} ${_}`,onClick:()=>{v({kind:"value",value:_,property:"padding"})},children:[e("span",{className:"sf-code-window-row-icon","aria-hidden":"true",children:e(r,{tone:"secondary",children:e(we,{})})}),e(r,{size:"sm",weight:"medium",children:o("Gap between blocks")}),e(r,{size:"2xs",tone:"tertiary",children:X.replace(/(\d)px$/,"$1 px")}),e("span",{className:"sf-code-window-row-sub",children:e(r,{size:"2xs",tone:"secondary",mono:!0,children:O})})]})})]}),i("div",{className:"sf-code-window-column","data-code-window":"preview-column",children:[i("div",{className:"sf-code-window-bar",children:[e(ae,{size:"sm",value:N,onChange:V,options:[{value:"desktop",label:o("Desktop")},{value:"phone",label:o("Phone")}]}),e(r,{size:"xs",tone:"secondary",children:`${y} px · ${Math.round(b*100)}%`})]}),e(ie,{padding:"sm",className:"sf-code-window-fill",children:e("div",{className:"sf-code-window-fill",children:e("div",{ref:G,className:"sf-code-window-stage es-editor sf-editor-tokens sf-center",children:e("div",{className:"sf-frame",style:{width:y*b,flex:"none"},children:e("iframe",{title:o("Preview"),sandbox:Le,srcDoc:J,"data-code-window":"preview",style:{...he(y,b),height:`${100/b}%`}})})})})}),e("div",{role:"status","data-code-window":"status",children:e(ne,{tone:z.length?"warning":"success",emphasis:"subtle",children:z.length?`${o("Not published")}: ${z.join(", ")}. ${o("Scripts and event attributes are removed for safety.")}`:o("Everything here is published as written.")})})]}),i("div",{className:"sf-code-window-column","data-code-window":"code",children:[i("div",{className:"sf-code-window-bar",children:[e(r,{size:"xs",weight:"semibold",children:o("Code")}),i("div",{className:"sf-code-window-actions",children:[R?e(C,{variant:"secondary",onClick:()=>{Z()},children:o("Format code")}):null,e(de,{"aria-label":o("Add a ready-made part"),triggerClassName:le({variant:"secondary"}),align:"end",trigger:i(te,{children:[o("Add part")," ",e(pe,{size:12})]}),items:Be.map(t=>({key:t.key,label:o(t.label),onSelect:()=>{v({kind:"block",code:t.code})}}))})]})]}),T?i("div",{className:"sf-code-window-added","data-code-window":"added",children:[e(r,{size:"xs",tone:"secondary",children:`${o("Added on line")} ${T.line}:`}),e(r,{size:"2xs",mono:!0,truncate:!0,children:T.text})]}):null,e("div",{className:"sf-code-window-editor",children:e(oe,{fallback:null,children:e(ue,{ref:$,value:a,onChange:c,label:o("Section code"),lineWrap:!0,formatter:R??void 0})})})]})]})})}export{Ue as default,Me as loadShellFormatter};
@@ -9,10 +9,11 @@ export declare function styleTagsOf(element: HTMLElement): {
9
9
  sizeGroup: TypeGroup | null;
10
10
  };
11
11
  export declare function measureStyleBase(element: HTMLElement, shown?: ShownDeclarations): PartStyleBase;
12
- export default function PreviewPartAnchors({ needles, styles, motions, type, children, }: {
12
+ export default function PreviewPartAnchors({ needles, styles, motions, type, sizeCaps, children, }: {
13
13
  needles: PartNeedle[];
14
14
  styles: PartStyles;
15
15
  motions?: Readonly<Record<string, PartMotion>>;
16
16
  type?: string;
17
+ sizeCaps?: Readonly<Record<string, true>>;
17
18
  children: ReactNode;
18
19
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as Y}from"react/jsx-runtime";import{readInks as $}from"../../format/lib/document/part-inks.js";import{useEffect as j,useRef as x}from"react";import{markOverlayPortal as G}from"../../format/lib/document/overlay-portal.js";import{usePreviewParts as q}from"efficient-easel/draw/client";import{usePartStyle as U}from"./PreviewPartStyleContext.js";import{usePreviewDevice as V}from"efficient-easel/draw/client";import{shownTier as Q}from"efficient-easel/screen/lib/document/device-fields";import{decodePartId as I,encodePartId as X}from"efficient-easel/draw";import{BLOCK_ATTRIBUTE as Z}from"efficient-easel/canvas";import{engagePartAnchors as tt}from"../lib/document/part-anchors.js";import{PART_ATTR as P,PART_STYLE_KIND_ATTR as b,PART_STYLE_OWNER_ATTR as et,partStyleOwnerOf as g}from"../../render/lib/document/text-parts.js";import{PART_STYLE_PROPERTIES as D,applyPartStyles as C,blockDrawsTextStyle as F,partFontKeyOf as rt,partShownDeclarations as ot,partStyleBase as nt,partStyleSource as st,storedPartStyle as it}from"../../render/lib/document/part-styles.js";import{fontRoleOfClassName as lt,styleRoleOfClassName as at}from"../../format/lib/fonts.js";import{typeScaleGroupOfClassName as k}from"../../format/lib/theme.js";import{styleKeyForPart as A}from"../../format/lib/sections/section-text-kinds.js";import{NO_MOTIONS as pt,PART_HOST_ATTR as ct}from"../../render/lib/animation/part-motion.js";import{paintPartMotion as ft}from"../lib/document/part-motion-canvas.js";import{viewOfTier as ut}from"../../format/lib/content/view-tier.js";function mt(c){let s=null,o=null;for(let e=c;e&&(s===null||o===null);e=e.parentElement){const r=e.getAttribute("class");s??=at(r),o??=k(r)}return{faceRole:s??"body",sizeGroup:o}}function z(c,s={}){const o=c.style,e={};for(const n of D)e[n]=o[n]??"",o[n]="";s.fontFamily&&(o.fontFamily=s.fontFamily),s.fontSize&&(o.fontSize=s.fontSize);const r=getComputedStyle(c),S=getComputedStyle(c.ownerDocument.documentElement),a=nt({fontSize:r.fontSize,fontWeight:r.fontWeight,lineHeight:r.lineHeight,letterSpacing:r.letterSpacing,textAlign:r.textAlign,textTransform:r.textTransform,paddingTop:r.paddingTop},rt(r.fontFamily,n=>S.getPropertyValue(n)));for(const n of D)o[n]=e[n];return a}function yt({needles:c,styles:s,motions:o=pt,type:e,children:r}){const S=x(null),{selectedPartId:a}=q(),{setPartStyle:n}=U(),y=Q(V()),h=JSON.stringify(c),R=JSON.stringify(s),w=JSON.stringify(o),J=x(new Map);return j(()=>{const d=S.current;if(!d)return;const E=[],v=()=>d.parentElement,M=p=>{const i=v();if(!i)return null;const u=new MutationObserver(p);return u.observe(i,{attributes:!0,attributeFilter:[Z]}),()=>u.disconnect()},L=p=>{const i=new MutationObserver(p);return i.observe(d,{childList:!0,subtree:!0,characterData:!0}),()=>i.disconnect()};let f=[];E.push(()=>{for(const p of f)p();f=[]});const W=JSON.parse(h),T=JSON.parse(R),B=JSON.parse(w),H=tt(d,W,v,M,(p,i,u)=>{for(const t of f)t();f=[];const _=[];for(const t of u){const l=t,m=G(l);m&&f.push(m),l.getAttribute(P)===a&&_.push(l)}const K=st(i,a,_,t=>lt(t)!==null||k(t)!==null);if(K&&a){const t=K,l=I(a)?.propKey??"",m=g(t)?{}:ot(it(T,A(e,l)),y,{blockDrawsStyle:F(e,l)});n({partId:a,...mt(t),base:z(t,m),inks:$(t),...(()=>{const N=g(t);return N?{styleOwner:N}:{}})()})}C(u.filter(t=>!g(t)).map(t=>({element:t,partId:t.getAttribute(P)??""})),T,t=>z(t),t=>A(e,t),void 0,y,t=>F(e,t));const O=[...d.querySelectorAll(`[${et}="${CSS.escape(i)}"][${b}]`)];O.length&&C(O.map(t=>({element:t,partId:X(i,t.getAttribute(b)??"")})),T,void 0,t=>t,void 0,y),f.push(ft([...u.filter(t=>!g(t)).map(t=>{const l=t,m=I(l.getAttribute(P)??"")?.propKey??"";return{element:l,partKey:A(e,m)}}),...O.map(t=>({element:t,partKey:t.getAttribute(b)??""}))],t=>B[t],ut(y),J.current))},L);return()=>{H();for(const p of E)p()}},[h,R,w,a,n,y,e]),Y("div",{ref:S,[ct]:"",style:{display:"contents"},children:r})}export{yt as default,z as measureStyleBase,mt as styleTagsOf};
1
+ "use client";import{jsx as j}from"react/jsx-runtime";import{readInks as G}from"../../format/lib/document/part-inks.js";import{useEffect as q,useRef as I}from"react";import{markOverlayPortal as U}from"../../format/lib/document/overlay-portal.js";import{usePreviewParts as V}from"efficient-easel/draw/client";import{usePartStyle as Q}from"./PreviewPartStyleContext.js";import{usePreviewDevice as X}from"efficient-easel/draw/client";import{shownTier as Z}from"efficient-easel/screen/lib/document/device-fields";import{decodePartId as C,encodePartId as tt}from"efficient-easel/draw";import{BLOCK_ATTRIBUTE as et}from"efficient-easel/canvas";import{engagePartAnchors as rt}from"../lib/document/part-anchors.js";import{PART_ATTR as P,PART_STYLE_KIND_ATTR as b,PART_STYLE_OWNER_ATTR as ot,partStyleOwnerOf as S}from"../../render/lib/document/text-parts.js";import{PART_STYLE_PROPERTIES as D,applyPartStyles as k,blockCapsPartSize as z,blockDrawsTextStyle as F,partFontKeyOf as nt,partShownDeclarations as st,partStyleBase as it,partStyleSource as at,storedPartStyle as lt}from"../../render/lib/document/part-styles.js";import{fontRoleOfClassName as pt,styleRoleOfClassName as ct}from"../../format/lib/fonts.js";import{typeScaleGroupOfClassName as J}from"../../format/lib/theme.js";import{styleKeyForPart as A}from"../../format/lib/sections/section-text-kinds.js";import{NO_MOTIONS as ft,PART_HOST_ATTR as ut}from"../../render/lib/animation/part-motion.js";import{paintPartMotion as mt}from"../lib/document/part-motion-canvas.js";import{viewOfTier as yt}from"../../format/lib/content/view-tier.js";function dt(p){let s=null,n=null;for(let r=p;r&&(s===null||n===null);r=r.parentElement){const o=r.getAttribute("class");s??=ct(o),n??=J(o)}return{faceRole:s??"body",sizeGroup:n}}function M(p,s={}){const n=p.style,r={};for(const e of D)r[e]=n[e]??"",n[e]="";s.fontFamily&&(n.fontFamily=s.fontFamily),s.fontSize&&(n.fontSize=s.fontSize);const o=getComputedStyle(p),g=getComputedStyle(p.ownerDocument.documentElement),d=it({fontSize:o.fontSize,fontWeight:o.fontWeight,lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,textAlign:o.textAlign,textTransform:o.textTransform,paddingTop:o.paddingTop},nt(o.fontFamily,e=>g.getPropertyValue(e)));for(const e of D)n[e]=r[e];return d}function St({needles:p,styles:s,motions:n=ft,type:r,sizeCaps:o,children:g}){const d=I(null),{selectedPartId:e}=V(),{setPartStyle:h}=Q(),m=Z(X()),R=JSON.stringify(p),w=JSON.stringify(s),E=JSON.stringify(n),L=I(new Map);return q(()=>{const y=d.current;if(!y)return;const v=[],_=()=>y.parentElement,W=l=>{const a=_();if(!a)return null;const f=new MutationObserver(l);return f.observe(a,{attributes:!0,attributeFilter:[et]}),()=>f.disconnect()},B=l=>{const a=new MutationObserver(l);return a.observe(y,{childList:!0,subtree:!0,characterData:!0}),()=>a.disconnect()};let c=[];v.push(()=>{for(const l of c)l();c=[]});const H=JSON.parse(R),T=JSON.parse(w),Y=JSON.parse(E),$=rt(y,H,_,W,(l,a,f)=>{for(const t of c)t();c=[];const K=[];for(const t of f){const i=t,u=U(i);u&&c.push(u),i.getAttribute(P)===e&&K.push(i)}const N=at(a,e,K,t=>pt(t)!==null||J(t)!==null);if(N&&e){const t=N,i=C(e)?.propKey??"",u=S(t)?{}:st(lt(T,A(r,i)),m,{blockDrawsStyle:F(r,i),sizeCap:z(o,i)});h({partId:e,...dt(t),base:M(t,u),inks:G(t),...(()=>{const x=S(t);return x?{styleOwner:x}:{}})()})}k(f.filter(t=>!S(t)).map(t=>({element:t,partId:t.getAttribute(P)??""})),T,t=>M(t),t=>A(r,t),void 0,m,t=>F(r,t),t=>z(o,t));const O=[...y.querySelectorAll(`[${ot}="${CSS.escape(a)}"][${b}]`)];O.length&&k(O.map(t=>({element:t,partId:tt(a,t.getAttribute(b)??"")})),T,void 0,t=>t,void 0,m),c.push(mt([...f.filter(t=>!S(t)).map(t=>{const i=t,u=C(i.getAttribute(P)??"")?.propKey??"";return{element:i,partKey:A(r,u)}}),...O.map(t=>({element:t,partKey:t.getAttribute(b)??""}))],t=>Y[t],yt(m),L.current))},B);return()=>{$();for(const l of v)l()}},[R,w,E,e,h,m,r]),j("div",{ref:d,[ut]:"",style:{display:"contents"},children:g})}export{St as default,M as measureStyleBase,dt as styleTagsOf};
@@ -7,7 +7,7 @@ export declare function SectionThemeMenu({ themes, value, onPick, onEdit, menuId
7
7
  themes: ThemeColors[];
8
8
  value: number | null;
9
9
  onPick: (next: number) => void;
10
- onEdit: (index: number) => void;
10
+ onEdit?: (index: number) => void;
11
11
  menuId?: string;
12
12
  followLabel?: string;
13
13
  }): import("react").JSX.Element;
@@ -17,9 +17,10 @@ export declare function SectionThemeEditor({ index, colors, onChange, onDone, }:
17
17
  onChange: (next: ThemeColors) => void;
18
18
  onDone: () => void;
19
19
  }): import("react").JSX.Element;
20
- export default function SectionThemePicker({ value, onChange, followLabel, hint, }: {
20
+ export default function SectionThemePicker({ value, onChange, followLabel, hint, canEdit, }: {
21
21
  value: unknown;
22
22
  onChange: (next: number) => void;
23
+ canEdit?: boolean;
23
24
  followLabel?: string;
24
25
  hint?: ReactNode;
25
26
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as i,Fragment as M}from"react/jsx-runtime";import{useCallback as _,useContext as W,useId as S,useRef as y,useState as O}from"react";import{ThemeIcon as V}from"efficient-easel/icons";import{Button as q,useClickOutside as G}from"efficient-shell/ui";import{SettingsField as J}from"efficient-easel/panel";import{usePreviewHeader as Q}from"../../render/components/PreviewHeaderContext.js";import{ScreenDocumentContext as U}from"efficient-easel/screen/components/ScreenDocumentContext";import{ThemeCard as X,ThemeCardTrigger as Y,ThemeColourRows as Z,themeName as b}from"./ThemeCard.js";import{useThemeRowPersist as ee}from"../lib/theme-row-persist.js";import{say as u}from"../../format/lib/editor-words.js";import{normalizeTheme as D,normalizeThemeColors as te,selectedThemeColors as ne}from"../../format/lib/theme.js";import{SECTION_ACCENT_INHERIT as se,resolveSectionAccent as oe}from"../../format/lib/content/section-surface.js";const ce="Follow the page",Ie="Follow the slideshow",re=s=>u("Editing {name} changes it everywhere.",{name:s});function ie({colors:s}){if(!s)return e("span",{className:"sf-secttheme-chip sf-secttheme-chip--none","aria-hidden":"true"});const t=te(s);return i("span",{className:"sf-secttheme-chip","aria-hidden":"true",children:[e("i",{style:{background:t.background}}),e("i",{className:"sf-secttheme-chip-accent",style:{background:t.accent}})]})}function le({themes:s,value:t,onPick:r,onEdit:f,menuId:l,followLabel:m}){return i("div",{className:"sf-multi-menu sf-secttheme-menu",id:l,role:"listbox",children:[m!==void 0&&i(M,{children:[i("button",{type:"button",role:"option","aria-selected":t===null,className:`sf-secttheme-item${t===null?" is-active":""}`,onClick:()=>r(se),children:[e(ie,{}),e("span",{className:"sf-secttheme-name",children:u(m)})]}),e("div",{className:"sf-secttheme-sep",role:"presentation"})]}),t!==null&&s[t]&&e("p",{className:"sf-secttheme-oncard",role:"presentation",children:u("{name} is on this section",{name:b(t)})}),s.map((E,c)=>c===t?null:e(X,{role:"option",index:c,colors:E,selected:!1,onPick:()=>r(c),onEdit:()=>f(c)},c))]})}function me({index:s,colors:t,onChange:r,onDone:f}){const l=b(s),m=S();return i("div",{className:"sf-secttheme-sheet",children:[i("div",{className:"sf-secttheme-sheet-head",children:[e("span",{children:l}),e(q,{variant:"secondary",className:"sf-secttheme-done",onClick:f,children:u("Done")})]}),e("div",{className:"sf-secttheme-rows",children:e(Z,{colors:t,onChange:r,idPrefix:m})}),e("p",{className:"sf-secttheme-warn",children:re(l)})]})}function ae({value:s,onChange:t,followLabel:r,hint:f}){const{theme:l,setTheme:m}=Q(),E=D(l),c=W(U),R=c?.tokenRef,F=c?.siteId??null,L=!c?.capabilities?.hasSiteTheme,{persist:P,flush:N}=ee({themeFromDocument:L,tokenRef:R,siteId:F}),g=D(E),a=g.themes,d=oe(s),v=d!==null?a[d]:void 0,j=v??(a.length?ne(g):void 0),[p,C]=O(!1),[o,x]=O(null),w=y(null),k=y(null),T=S(),h=_(()=>{C(!1),x(null)},[]),A=_(()=>{!p&&o===null||(N(),h())},[p,o,h,N]);G(w,A);const B=n=>{t(n),h()},H=n=>{if(o===null)return;const $=a.map((z,K)=>K===o?n:z),I={...g,themes:$};m(I),P({selected_preset:I.selected,theme_presets:I.themes})};return i("div",{className:"sf-secttheme",ref:w,children:[e(J,{label:u("Theme"),icon:e(V,{}),labelId:`${T}-label`,hint:f,children:e(Y,{colors:j,onEdit:d!==null?()=>{x(d),C(!1)}:void 0,name:v?b(d):u(r??ce),nameId:`${T}-value`,labelId:`${T}-label`,open:p,menuId:T,buttonRef:k,onClick:()=>{x(null),C(n=>!n)},onKeyDown:n=>{n.key==="Escape"&&(p||o!==null)&&(n.preventDefault(),h())}})}),p&&o===null&&e("div",{onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),h(),k.current?.focus())},children:e(le,{themes:a,value:d,onPick:B,onEdit:n=>{x(n),C(!1)},menuId:T,followLabel:r})}),o!==null&&a[o]&&e(me,{index:o,colors:a[o],onChange:H,onDone:()=>{N(),h(),k.current?.focus()}})]})}export{Ie as BLOCK_THEME_FOLLOW_LABEL,ce as SECTION_THEME_FOLLOW_LABEL,me as SectionThemeEditor,le as SectionThemeMenu,ae as default,re as sectionThemeEditWarning};
1
+ "use client";import{jsx as e,jsxs as l,Fragment as W}from"react/jsx-runtime";import{useCallback as S,useContext as V,useId as y,useRef as O,useState as D}from"react";import{ThemeIcon as q}from"efficient-easel/icons";import{Button as G,useClickOutside as J}from"efficient-shell/ui";import{SettingsField as Q}from"efficient-easel/panel";import{usePreviewHeader as U}from"../../render/components/PreviewHeaderContext.js";import{ScreenDocumentContext as X}from"efficient-easel/screen/components/ScreenDocumentContext";import{ThemeCard as Y,ThemeCardTrigger as Z,ThemeColourRows as ee,themeName as v}from"./ThemeCard.js";import{useThemeRowPersist as te}from"../lib/theme-row-persist.js";import{say as f}from"../../format/lib/editor-words.js";import{normalizeTheme as R,normalizeThemeColors as ne,selectedThemeColors as se}from"../../format/lib/theme.js";import{SECTION_ACCENT_INHERIT as oe,resolveSectionAccent as ce}from"../../format/lib/content/section-surface.js";const re="Follow the page",be="Follow the slideshow",ie=s=>f("Editing {name} changes it everywhere.",{name:s});function le({colors:s}){if(!s)return e("span",{className:"sf-secttheme-chip sf-secttheme-chip--none","aria-hidden":"true"});const t=ne(s);return l("span",{className:"sf-secttheme-chip","aria-hidden":"true",children:[e("i",{style:{background:t.background}}),e("i",{className:"sf-secttheme-chip-accent",style:{background:t.accent}})]})}function me({themes:s,value:t,onPick:r,onEdit:m,menuId:c,followLabel:a}){return l("div",{className:"sf-multi-menu sf-secttheme-menu",id:c,role:"listbox",children:[a!==void 0&&l(W,{children:[l("button",{type:"button",role:"option","aria-selected":t===null,className:`sf-secttheme-item${t===null?" is-active":""}`,onClick:()=>r(oe),children:[e(le,{}),e("span",{className:"sf-secttheme-name",children:f(a)})]}),e("div",{className:"sf-secttheme-sep",role:"presentation"})]}),t!==null&&s[t]&&e("p",{className:"sf-secttheme-oncard",role:"presentation",children:f("{name} is on this section",{name:v(t)})}),s.map((N,i)=>i===t?null:e(Y,{role:"option",index:i,colors:N,selected:!1,onPick:()=>r(i),onEdit:m?()=>m(i):void 0},i))]})}function ae({index:s,colors:t,onChange:r,onDone:m}){const c=v(s),a=y();return l("div",{className:"sf-secttheme-sheet",children:[l("div",{className:"sf-secttheme-sheet-head",children:[e("span",{children:c}),e(G,{variant:"secondary",className:"sf-secttheme-done",onClick:m,children:f("Done")})]}),e("div",{className:"sf-secttheme-rows",children:e(ee,{colors:t,onChange:r,idPrefix:a})}),e("p",{className:"sf-secttheme-warn",children:ie(c)})]})}function de({value:s,onChange:t,followLabel:r,hint:m,canEdit:c=!0}){const{theme:a,setTheme:N}=U(),i=R(a),g=V(X),F=g?.tokenRef,L=g?.siteId??null,P=!g?.capabilities?.hasSiteTheme,{persist:j,flush:k}=te({themeFromDocument:P,tokenRef:F,siteId:L}),E=R(i),d=E.themes,h=ce(s),w=h!==null?d[h]:void 0,A=w??(d.length?se(E):void 0),[p,C]=D(!1),[o,x]=D(null),_=O(null),I=O(null),T=y(),u=S(()=>{C(!1),x(null)},[]),B=S(()=>{!p&&o===null||(k(),u())},[p,o,u,k]);J(_,B);const H=n=>{t(n),u()},$=n=>{if(o===null)return;const z=d.map((K,M)=>M===o?n:K),b={...E,themes:z};N(b),j({selected_preset:b.selected,theme_presets:b.themes})};return l("div",{className:"sf-secttheme",ref:_,children:[e(Q,{label:f("Theme"),icon:e(q,{}),labelId:`${T}-label`,hint:m,children:e(Z,{colors:A,onEdit:c&&h!==null?()=>{x(h),C(!1)}:void 0,name:w?v(h):f(r??re),nameId:`${T}-value`,labelId:`${T}-label`,open:p,menuId:T,buttonRef:I,onClick:()=>{x(null),C(n=>!n)},onKeyDown:n=>{n.key==="Escape"&&(p||o!==null)&&(n.preventDefault(),u())}})}),p&&o===null&&e("div",{onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),u(),I.current?.focus())},children:e(me,{themes:d,value:h,onPick:H,onEdit:c?n=>{x(n),C(!1)}:void 0,menuId:T,followLabel:r})}),c&&o!==null&&d[o]&&e(ae,{index:o,colors:d[o],onChange:$,onDone:()=>{k(),u(),I.current?.focus()}})]})}export{be as BLOCK_THEME_FOLLOW_LABEL,re as SECTION_THEME_FOLLOW_LABEL,ae as SectionThemeEditor,me as SectionThemeMenu,de as default,ie as sectionThemeEditWarning};
@@ -1,7 +1,7 @@
1
1
  import { type TextStyleColour, type TextStyleColourNameOf, type TextStyleFont } from "efficient-easel/text-styles";
2
2
  import { type OldSiteText, type StoredTextStyle } from "../../render/lib/text-styles/site-text-styles.js";
3
3
  export declare const SITE_FONTS: TextStyleFont[];
4
- export default function SiteTextStylesField({ saved, old, colours, colourNameOf, sizeOf, onChange, openId, onOpenChange, readOnly, withoutSize, }: {
4
+ export default function SiteTextStylesField({ saved, old, colours, colourNameOf, sizeOf, onChange, openId, onOpenChange, readOnly, withoutSize, onPick, }: {
5
5
  saved: unknown;
6
6
  old: OldSiteText;
7
7
  colours: readonly TextStyleColour[];
@@ -15,4 +15,5 @@ export default function SiteTextStylesField({ saved, old, colours, colourNameOf,
15
15
  onOpenChange?: (id: string | null) => void;
16
16
  readOnly?: boolean;
17
17
  withoutSize?: boolean;
18
+ onPick?: (style: StoredTextStyle) => void;
18
19
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as y}from"react/jsx-runtime";import{useState as w}from"react";import{TextStylesList as x}from"efficient-easel/text-styles";import{FONT_OPTIONS as I}from"../../format/lib/fonts.js";import{viewOfTier as _}from"../../format/lib/content/view-tier.js";import{usePreviewDevice as C}from"efficient-easel/draw/client";import{applyListChange as E,resolveTextStyles as N,toPanelStyles as L}from"../../render/lib/text-styles/site-text-styles.js";const f=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],b=["size","lineSpacing","letterSpacing","letterCase"],k=500,A=I.map(e=>({value:e.key,label:e.label,family:`var(${e.cssVar})`,italic:e.italicLoaded}));function F({saved:e,old:s,colours:p,colourNameOf:S,sizeOf:a,onChange:m,openId:l,onOpenChange:d,readOnly:u=!1,withoutSize:g=!1}){const T=C(),[O,h]=w(null),r=N(e,s),i=_(T),c=L(r,a,i);return y(x,{styles:c,onChange:t=>m(E({saved:e,old:s,cur:c,next:t,sizeOf:a,panelView:i})),fonts:A,colours:p,colourNameOf:S,settings:g?f.filter(t=>t!=="size"):f,auto:b,openId:l===void 0?O:l,onOpenChange:d??h,readOnly:u,device:i,fallback:t=>{const n=r.find(v=>v.id===(t.kind==="heading"?"heading-1":"body-1")),o={};return n?.values.font&&t.id!==n.id&&(o.font=n.values.font),t.kind==="heading"&&(o.weight=k),o}})}export{A as SITE_FONTS,F as default};
1
+ "use client";import{jsx as w}from"react/jsx-runtime";import{useState as x}from"react";import{TextStylesList as I}from"efficient-easel/text-styles";import{FONT_OPTIONS as _}from"../../format/lib/fonts.js";import{viewOfTier as C}from"../../format/lib/content/view-tier.js";import{usePreviewDevice as E}from"efficient-easel/draw/client";import{applyListChange as N,resolveTextStyles as L,toPanelStyles as b}from"../../render/lib/text-styles/site-text-styles.js";const p=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],k=["size","lineSpacing","letterSpacing","letterCase"],A=500,F=_.map(t=>({value:t.key,label:t.label,family:`var(${t.cssVar})`,italic:t.italicLoaded}));function z({saved:t,old:a,colours:d,colourNameOf:S,sizeOf:l,onChange:m,openId:r,onOpenChange:u,readOnly:g=!1,withoutSize:T=!1,onPick:c}){const O=E(),[h,v]=x(null),s=L(t,a),o=C(O),f=b(s,l,o);return w(I,{styles:f,onChange:e=>m(N({saved:t,old:a,cur:f,next:e,sizeOf:l,panelView:o})),fonts:F,colours:d,colourNameOf:S,settings:T?p.filter(e=>e!=="size"):p,auto:k,openId:r===void 0?h:r,onOpenChange:u??v,readOnly:g,device:o,onPick:c?e=>{const i=s.find(n=>n.id===e.id);i&&c(i)}:void 0,fallback:e=>{const i=s.find(y=>y.id===(e.kind==="heading"?"heading-1":"body-1")),n={};return i?.values.font&&e.id!==i.id&&(n.font=i.values.font),e.kind==="heading"&&(n.weight=A),n}})}export{F as SITE_FONTS,z as default};
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import X from"./WebsiteHintsProvider.js";import{useCallback as H,useEffect as P,useMemo as l,useRef as Z,useState as f}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as $}from"../lib/document/build-config.js";import{withTemplateMediaPlaceholders as ee}from"../../format/lib/document/templateFields.js";import{setEditorPageSlug as B}from"../../format/lib/document/editor-page-context.js";import{ScreenDocumentContext as te}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as re}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as oe}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as ie}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as ne}from"efficient-easel/draw/client";import{CanvasPartsBridge as se}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as de}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as ae}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"efficient-easel/screen/lib/section-templates";import{saveSectionTemplate as R}from"../lib/editor-document-adapter.js";import{nodeToDoc as me,docToNode as F}from"efficient-easel/screen/lib/document/section-doc";import{newNodeId as ce}from"efficient-easel/draw";import{migrateRenamedProps as le}from"../../format/lib/document/renamed-props.js";import{buildSlotSeedChildren as fe}from"../../render/lib/document/slot-specs.js";import{FOOTER_TYPE as ue,buildDefaultFooterBlocks as pe}from"../lib/document/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as ve,useAdminBridge as ge}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as he}from"efficient-easel/screen/lib/host";import{ChromeWrap as Pe}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as Ee}from"efficient-easel/screen/lib/session";import{useEaselSession as Se}from"efficient-easel/screen/lib/session-context";import{say as L}from"../../format/lib/editor-words.js";import{retargetWhenSaved as ye}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as Te}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as we}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as E,THEME_MODE_KEY as Ne}from"../../format/lib/theme.js";import{makeSitePageAdapter as U}from"../lib/editor-document-adapter.js";import{documentPermissions as Ce}from"efficient-easel/edit-lock";import{useAutosave as ke}from"efficient-easel/autosave";import{saveStatusOf as Ae}from"efficient-easel/screen/lib/document-switch";import{blocksOf as Me}from"../lib/website-session.js";import{parseOption as Oe}from"../../format/lib/parse-option.js";import{THEME_MODES as be}from"../../format/lib/theme.js";const Ie=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),De=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),W="Hero",Y="Untitled section";function _e(s,S){const d=S.components,r=d[s]?s:W,y=d[r]?.defaultProps??{},i=fe(r,u=>d[u]?.defaultProps??{}),n=r===ue?{blocks:pe()}:null;return{type:r,props:{id:ce(r),...y,...i?{[i.slot]:i.children}:null,...n}}}function He(){if(typeof window>"u")return E;try{const s=window.localStorage.getItem(Ne);return Oe(be,E,s)}catch{return E}}function xe({id:s,initialType:S,initialName:d=Y}){const[r,y]=f(s),i=Z(r);P(()=>{i.current=r},[r]);const n=he(),[u,j]=f(S),[b,K]=f(d),[a,T]=f(void 0),[G,q]=f(E),{token:w,tokenRef:I}=ge({onMessage:e=>{if(we(e)||Te(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const M=t.target.id;if(M===i.current)return;const Q=t.target.type,V=t.target.name;ye(C,()=>{j(Q),K(V||Y),y(M),n.address.show({kind:"section",id:M})},()=>n.send("storefront-editor:save-failed"))}}}),N=ke({save:e=>R(O,e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&n.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:C}=N;P(()=>q(He()),[]);const m=Se(),v=m.usesBridgedToken?!!w:!0,g=l(()=>$(Ee(m),Me(m)),[m]);P(()=>{if(!v)return;let e=!1;return T(void 0),O.ensure(r,b,_e(u??W,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,u,b,v,g]);const k=H(e=>{n.send("storefront-editor:dirty");const t=F(e);t&&D({id:i.current,node:t})},[D,n]),h=n.send,_=H(async e=>{try{return await e(I.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),z=l(()=>ee(g,!0),[g]);P(()=>(B(null),()=>B(null)),[]);const c=l(()=>a?le(me(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:U(void 0),capabilities:U(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:I,notifyParent:h,runAuthed:_,docId:r,data:c,getLiveData:()=>c,error:null,redirecting:!1,saveStatus:Ae(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:k,flushSave:C,onPublish:async e=>{const t=F(e);t&&await R(O,i.current,t)},bridgeCapabilities:ve,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,c,p,k,C,N.retryNow]),J=l(()=>Ce(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:L("Loading…")}):a===null||!c?o("div",{className:"sf-msg sf-msg--error",children:L("Couldn’t open this section.")}):o(te.Provider,{value:A,children:o(X,{children:o(re,{themeMode:G,chromePlaceholder:!0,children:o(Pe,{wrap:m.chrome?.wrap,surface:"section",children:o(oe,{children:o(ie,{children:o(ne,{children:o(de,{children:o(se,{children:o(ae,{children:o(Ie,{config:z,data:c,onChange:k,permissions:J,children:o(De,{})},r)})})})})})})})})})})}export{xe as default};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import X from"./WebsiteHintsProvider.js";import{useCallback as H,useEffect as P,useMemo as l,useRef as Z,useState as f}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as $}from"../lib/document/build-config.js";import{withTemplateMediaPlaceholders as ee}from"../../format/lib/document/templateFields.js";import{setEditorPageSlug as B}from"../../format/lib/document/editor-page-context.js";import{ScreenDocumentContext as te}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as re}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as oe}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as ie}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as ne}from"efficient-easel/draw/client";import{CanvasPartsBridge as se}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as de}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as ae}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"efficient-easel/screen/lib/section-templates";import{saveSectionTemplate as R}from"../lib/editor-document-adapter.js";import{nodeToDoc as me,docToNode as F}from"efficient-easel/screen/lib/document/section-doc";import{newNodeId as ce}from"efficient-easel/draw";import{migrateRenamedProps as le}from"../../format/lib/document/renamed-props.js";import{buildSlotSeedChildren as fe}from"../../render/lib/document/slot-specs.js";import{FOOTER_TYPE as ue,buildDefaultFooterBlocks as pe}from"../lib/document/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as ve,useAdminBridge as ge}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as he}from"efficient-easel/screen/lib/host";import{ChromeWrap as Pe}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as Ee}from"efficient-easel/screen/lib/session";import{useEaselSession as Se}from"efficient-easel/screen/lib/session-context";import{say as L}from"../../format/lib/editor-words.js";import{retargetWhenSaved as ye}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as Te}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as we}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as E,THEME_MODE_KEY as Ne}from"../../format/lib/theme.js";import{makeSitePageAdapter as U}from"../lib/editor-document-adapter.js";import{documentPermissions as Ce}from"efficient-easel/edit-lock";import{useAutosave as ke}from"efficient-easel/autosave";import{saveStatusOf as Ae}from"efficient-easel/screen/lib/document-switch";import{blocksOf as Me}from"../lib/website-session.js";import{parseOption as Oe}from"efficient-shell/format";import{THEME_MODES as be}from"../../format/lib/theme.js";const Ie=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),De=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),W="Hero",Y="Untitled section";function _e(s,S){const d=S.components,r=d[s]?s:W,y=d[r]?.defaultProps??{},i=fe(r,u=>d[u]?.defaultProps??{}),n=r===ue?{blocks:pe()}:null;return{type:r,props:{id:ce(r),...y,...i?{[i.slot]:i.children}:null,...n}}}function He(){if(typeof window>"u")return E;try{const s=window.localStorage.getItem(Ne);return Oe(be,E,s)}catch{return E}}function xe({id:s,initialType:S,initialName:d=Y}){const[r,y]=f(s),i=Z(r);P(()=>{i.current=r},[r]);const n=he(),[u,j]=f(S),[b,K]=f(d),[a,T]=f(void 0),[G,q]=f(E),{token:w,tokenRef:I}=ge({onMessage:e=>{if(we(e)||Te(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const M=t.target.id;if(M===i.current)return;const Q=t.target.type,V=t.target.name;ye(C,()=>{j(Q),K(V||Y),y(M),n.address.show({kind:"section",id:M})},()=>n.send("storefront-editor:save-failed"))}}}),N=ke({save:e=>R(O,e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&n.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:C}=N;P(()=>q(He()),[]);const m=Se(),v=m.usesBridgedToken?!!w:!0,g=l(()=>$(Ee(m),Me(m)),[m]);P(()=>{if(!v)return;let e=!1;return T(void 0),O.ensure(r,b,_e(u??W,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,u,b,v,g]);const k=H(e=>{n.send("storefront-editor:dirty");const t=F(e);t&&D({id:i.current,node:t})},[D,n]),h=n.send,_=H(async e=>{try{return await e(I.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),z=l(()=>ee(g,!0),[g]);P(()=>(B(null),()=>B(null)),[]);const c=l(()=>a?le(me(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:U(void 0),capabilities:U(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:I,notifyParent:h,runAuthed:_,docId:r,data:c,getLiveData:()=>c,error:null,redirecting:!1,saveStatus:Ae(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:k,flushSave:C,onPublish:async e=>{const t=F(e);t&&await R(O,i.current,t)},bridgeCapabilities:ve,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,c,p,k,C,N.retryNow]),J=l(()=>Ce(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:L("Loading…")}):a===null||!c?o("div",{className:"sf-msg sf-msg--error",children:L("Couldn’t open this section.")}):o(te.Provider,{value:A,children:o(X,{children:o(re,{themeMode:G,chromePlaceholder:!0,children:o(Pe,{wrap:m.chrome?.wrap,surface:"section",children:o(oe,{children:o(ie,{children:o(ne,{children:o(de,{children:o(se,{children:o(ae,{children:o(Ie,{config:z,data:c,onChange:k,permissions:J,children:o(De,{})},r)})})})})})})})})})})}export{xe as default};
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as wt}from"react/jsx-runtime";import{useCallback as o,useEffect as f,useMemo as Ct,useRef as g,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{useHostConfig as _t}from"../lib/document/host-config.js";import{ChromeWrap as Pt}from"efficient-easel/screen/lib/host-chrome";import{refreshSiteLiveState as Tt}from"../lib/site-live-state.js";import{holdSiteWrites as Et}from"../../format/lib/site-writes.js";import{backendOf as k}from"../lib/website-session.js";import{useEaselSession as yt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Gt}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/document/templateFields.js";import{setEditorPage as he}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as Ht}from"./EditorPagePathProvider.js";import{AddPageOnOpen as Wt}from"./AddPageOnOpen.js";import{resolveSiteName as kt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Bt,normalizeSiteGutterPhone as Rt,normalizeSiteWidth as Ft}from"../../format/lib/content/page-width.js";import{siteLengthNumber as w,siteLengthUnitsOfRow as It}from"../../format/lib/content/css-length.js";import{normalizeSiteBackground as ue}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as le}from"../../format/lib/content/container-gap.js";import Dt,{DocumentScreen as Ot}from"efficient-easel/screen/components/ScreenMount";import Mt from"./WebsiteHintsProvider.js";import{useScreenDocument as bt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Nt,siteThemeRow as xt,themeEdited as Ut,themeSeeded as At}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Lt}from"./PreviewFooterContext.js";import{PreviewChatProvider as zt,DEFAULT_CHAT_PREVIEW as Yt}from"./PreviewChatContext.js";import{PreviewSocialProvider as jt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Vt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Xt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as qt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Jt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Qt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as $t}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as er}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as tr,DEFAULT_HEADING_COMPRESSION as rr,DEFAULT_HEADING_TYPOGRAPHY as or,DEFAULT_SWITCH_SHOWN as B,DEFAULT_SIZES as nr,DEFAULT_THEME_MODE as T,normalizeCornerRadius as ir,normalizeCornerStyle as ar,normalizeCardShadow as cr,normalizeCardGap as sr,normalizeHoverEffect as dr,IDENTITY_CARD_GAP as me,IDENTITY_CARD_SHADOW as hr,IDENTITY_HOVER_EFFECT as ur,THEME_MODE_KEY as pe,THEME_STORAGE_KEY as lr,THEME_SWITCH_HIDE as Se,THEME_SWITCH_KEY as R}from"../../format/lib/theme.js";import{pictureShadowColor as mr}from"efficient-easel/screen/lib/document/shadow-values";import{DEFAULT_FONTS as pr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Sr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as fr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as gr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as wr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as Cr}from"./PreviewChatContext.js";import{parseOption as _r}from"../../format/lib/parse-option.js";import{THEME_MODES as Pr}from"../../format/lib/theme.js";const Tr=()=>{if(typeof window>"u")return T;try{const d=window.localStorage.getItem(pe);return _r(Pr,T,d)}catch{return T}},fe=d=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pe,d)}catch{}},Er=()=>{if(typeof window>"u")return B;try{return window.localStorage.getItem(R)!==Se}catch{return B}},yr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(lr)}catch{}},ge=d=>{if(!(typeof window>"u"))try{d?window.localStorage.removeItem(R):window.localStorage.setItem(R,Se)}catch{}};function Gr(){const{adapter:d,capabilities:s,templateId:F,ready:_,token:h,siteId:c,currentSlug:I,currentKind:D}=bt();f(()=>(he(I,D),()=>he(null,null)),[I,D]);const E=s.placeholderFrames,[we,O]=r(null),[Ce,M]=r("");f(()=>{const e=d.templateName;if(!_||!F||!e){M("");return}let i=!1;return e().then(u=>!i&&M(u??"")).catch(()=>{}),()=>{i=!0}},[_,h,F,d]);const[_e,y]=r(T),[Pe,G]=r(B),[b,N]=r({value:{selected:0,themes:[]},readFor:null}),Te=b.value,[Ee,x]=r(pr),[ye,U]=r(nr),[Ge,A]=r(null),[ve,L]=r(rr),[He,z]=r(null),[We,Y]=r(null),[ke,j]=r(me),[Be,K]=r(null),[Re,V]=r(null),[Fe,X]=r(null),[Ie,Z]=r(null),[v,q]=r(null),[H,J]=r(null),[De,Q]=r({}),Oe=o(e=>Q(i=>({...i,...e})),[]),l=yt(),$=_t(),Me=Ct(()=>Gt(vt($,E),v,H),[$,E,v,H]),[be,ee]=r(or),[Ne,te]=r(null),[xe,re]=r(null),[Ue,oe]=r(null),[Ae,ne]=r(null),[Le,ie]=r(null),ae=g(null),n=g(!1);f(()=>{y(Tr()),G(Er())},[]);const ze=o(e=>{n.current=!0,yr(),fe(e),y(e)},[]),Ye=o(e=>{n.current=!0,ge(e),G(e)},[]),je=o(e=>{n.current=!0,N(i=>Ut(i,e,c??""))},[c]),Ke=o(e=>{n.current=!0,x(e)},[]),Ve=o(e=>{n.current=!0,U(e)},[]),Xe=o(e=>{n.current=!0,A(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,z(e)},[]),Je=o(e=>{n.current=!0,Y(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,K(e)},[]),et=o(e=>{n.current=!0,ee(e)},[]),[tt,ce]=r(null),[rt,ot]=r(null),nt=o(e=>{n.current=!0,ce(e)},[]),it=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),ct=o(e=>{n.current=!0,Z(e)},[]),st=o(e=>{n.current=!0,q(e)},[]),dt=o(e=>{n.current=!0,J(e)},[]),ht=o(e=>{n.current=!0,te(e)},[]),ut=o(e=>{n.current=!0,re(e)},[]),lt=o(e=>{n.current=!0,oe(e)},[]),mt=o(e=>{n.current=!0,ne(e)},[]),pt=o(e=>{n.current=!0,ie(e)},[]);f(()=>{const e=k(l).theme;if(!h||!s.hasSiteTheme||!e)return;const i=c??"";ae.current!==i&&(ae.current=i,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;fe(t.default_mode),ge(t.show_theme_switch),y(t.default_mode),G(t.show_theme_switch),N(At({selected:t.selected_preset,themes:t.theme_presets},i));const C=gr(t);x(C.fonts),U(C.sizes);const S=It(t);Q(S),A(t.corner_radius_px===void 0?tr[ar(t.corner_style)]:w(t.corner_radius_px,S.cornerRadiusUnit,ir)),L(C.compression),z(t.card_shadow==null?hr:cr(t.card_shadow)),j(t.card_gap==null?me:sr(t.card_gap)),K(t.hover_effect==null?ur:dr(t.hover_effect)),Y(mr(t.shadow_color)),V(w(t.site_width,S.siteWidthUnit,Ft)),X(w(t.site_gutter,S.siteGutterUnit,Bt)),Z(w(t.site_gutter_phone,S.siteGutterPhoneUnit,Rt)),q(w(t.block_gap,S.blockGapUnit,le)),J(w(t.block_gap_phone,S.blockGapPhoneUnit,le)),ee(C.typography),ce(C.textStyles),ot(wr(t)),te(t.hero_background_follows_width===!0),re(ue(t.section_background_width)),oe(ue(t.section_content_width)),ne(t.photography_grayscale===!0),ie(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[h,c,s.hasSiteTheme,l]);const St=Kt({token:h,siteId:c,enabled:s.hasSiteSettings}),[ft,se]=r(Yt),de=g(null),W=g(!1),m=g(null),p=g({}),P=o(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await k(l).chat?.update(e,c?{siteId:c}:void 0),Tt()}catch(i){throw p.current={...e,...p.current},i}},[l,c]);f(()=>Et(()=>m.current||Object.keys(p.current).length>0?P():void 0),[P]);const gt=o(e=>{W.current=!0,se(i=>({...i,...e})),!(!s.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{P().catch(()=>{})},500))},[s.hasSiteSettings,h,P]);return f(()=>{if(!h||!s.hasSiteSettings)return;const e=c??"";de.current!==e&&(de.current=e,W.current=!1);let i=!1;const u=k(l).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{i||W.current||se(Cr(t))}).catch(()=>{}),()=>{i=!0}},[h,c,s.hasSiteSettings,l]),f(()=>{const e=d.site;if(!_||!s.hasSiteRecord||!e){O(null);return}let i=!1;return e().then(u=>{i||O(kt(u.name))}).catch(()=>{}),()=>{i=!0}},[_,h,s.hasSiteRecord,c,d]),a(Ot,{config:Me,parts:Sr,wrap:(e,i)=>a(Nt,{websiteName:we,templateChrome:E,templateName:Ce||null,themeMode:_e,onThemeModeChange:ze,themeSwitchShown:Pe,onThemeSwitchShownChange:Ye,theme:Te,themeRow:xt(s.hasSiteTheme,b.readFor,c??""),onThemeChange:je,fonts:Ee,onFontsChange:Ke,cornerRadiusPx:Ge,onCornerRadiusPxChange:Xe,cardShadow:He,onCardShadowChange:qe,shadowColor:We,onShadowColorChange:Je,cardGap:ke,onCardGapChange:Qe,hoverEffect:Be,onHoverEffectChange:$e,headingCompression:ve,onHeadingCompressionChange:Ze,headingTypography:be,onHeadingTypographyChange:et,textStyles:tt,onTextStylesChange:nt,wordStyles:rt,sizes:ye,onSizesChange:Ve,siteWidth:Re,onSiteWidthChange:it,siteGutter:Fe,onSiteGutterChange:at,siteGutterPhone:Ie,onSiteGutterPhoneChange:ct,blockGap:v,onBlockGapChange:st,blockGapPhone:H,onBlockGapPhoneChange:dt,siteLengthUnits:De,onSiteLengthUnitsChange:Oe,heroBackgroundFollowsWidth:Ne,onHeroBackgroundFollowsWidthChange:ht,sectionBackgroundWidth:xe,onSectionBackgroundWidthChange:ut,sectionContentWidth:Ue,onSectionContentWidthChange:lt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:mt,shareButtonOnPosts:Le,onShareButtonOnPostsChange:pt,themeFromDocument:!s.hasSiteTheme,children:a(Lt,{children:a(Pt,{wrap:l.chrome?.wrap,surface:"page",children:a(Zt,{children:a(qt,{children:a(Jt,{children:a($t,{children:a(Qt,{children:wt(er,{children:[a(zt,{chat:ft,onChatChange:gt,children:a(jt,{value:St,children:a(Vt,{children:a(Ht,{children:a(Mt,{children:e})})})})}),i]})})})})})})})})})})}function vr({target:d,openAddPage:s}){return a(Wt,{open:s,children:a(Dt,{target:d,addressing:Xt,onHostMessage:fr,children:a(Gr,{})})})}export{vr as default};
1
+ "use client";import{jsx as a,jsxs as wt}from"react/jsx-runtime";import{useCallback as o,useEffect as f,useMemo as Ct,useRef as g,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{useHostConfig as _t}from"../lib/document/host-config.js";import{ChromeWrap as Pt}from"efficient-easel/screen/lib/host-chrome";import{refreshSiteLiveState as Tt}from"../lib/site-live-state.js";import{holdSiteWrites as Et}from"../../format/lib/site-writes.js";import{backendOf as k}from"../lib/website-session.js";import{useEaselSession as yt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Gt}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/document/templateFields.js";import{setEditorPage as he}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as Ht}from"./EditorPagePathProvider.js";import{AddPageOnOpen as Wt}from"./AddPageOnOpen.js";import{resolveSiteName as kt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Bt,normalizeSiteGutterPhone as Rt,normalizeSiteWidth as Ft}from"../../format/lib/content/page-width.js";import{siteLengthNumber as w,siteLengthUnitsOfRow as It}from"../../format/lib/content/css-length.js";import{normalizeSiteBackground as ue}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as le}from"../../format/lib/content/container-gap.js";import Dt,{DocumentScreen as Ot}from"efficient-easel/screen/components/ScreenMount";import Mt from"./WebsiteHintsProvider.js";import{useScreenDocument as bt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Nt,siteThemeRow as xt,themeEdited as Ut,themeSeeded as At}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Lt}from"./PreviewFooterContext.js";import{PreviewChatProvider as zt,DEFAULT_CHAT_PREVIEW as Yt}from"./PreviewChatContext.js";import{PreviewSocialProvider as jt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Vt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Xt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as qt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Jt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Qt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as $t}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as er}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as tr,DEFAULT_HEADING_COMPRESSION as rr,DEFAULT_HEADING_TYPOGRAPHY as or,DEFAULT_SWITCH_SHOWN as B,DEFAULT_SIZES as nr,DEFAULT_THEME_MODE as T,normalizeCornerRadius as ir,normalizeCornerStyle as ar,normalizeCardShadow as cr,normalizeCardGap as sr,normalizeHoverEffect as dr,IDENTITY_CARD_GAP as me,IDENTITY_CARD_SHADOW as hr,IDENTITY_HOVER_EFFECT as ur,THEME_MODE_KEY as pe,THEME_STORAGE_KEY as lr,THEME_SWITCH_HIDE as Se,THEME_SWITCH_KEY as R}from"../../format/lib/theme.js";import{pictureShadowColor as mr}from"efficient-easel/screen/lib/document/shadow-values";import{DEFAULT_FONTS as pr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Sr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as fr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as gr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as wr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as Cr}from"./PreviewChatContext.js";import{parseOption as _r}from"efficient-shell/format";import{THEME_MODES as Pr}from"../../format/lib/theme.js";const Tr=()=>{if(typeof window>"u")return T;try{const d=window.localStorage.getItem(pe);return _r(Pr,T,d)}catch{return T}},fe=d=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pe,d)}catch{}},Er=()=>{if(typeof window>"u")return B;try{return window.localStorage.getItem(R)!==Se}catch{return B}},yr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(lr)}catch{}},ge=d=>{if(!(typeof window>"u"))try{d?window.localStorage.removeItem(R):window.localStorage.setItem(R,Se)}catch{}};function Gr(){const{adapter:d,capabilities:s,templateId:F,ready:_,token:h,siteId:c,currentSlug:I,currentKind:D}=bt();f(()=>(he(I,D),()=>he(null,null)),[I,D]);const E=s.placeholderFrames,[we,O]=r(null),[Ce,M]=r("");f(()=>{const e=d.templateName;if(!_||!F||!e){M("");return}let i=!1;return e().then(u=>!i&&M(u??"")).catch(()=>{}),()=>{i=!0}},[_,h,F,d]);const[_e,y]=r(T),[Pe,G]=r(B),[b,N]=r({value:{selected:0,themes:[]},readFor:null}),Te=b.value,[Ee,x]=r(pr),[ye,U]=r(nr),[Ge,A]=r(null),[ve,L]=r(rr),[He,z]=r(null),[We,Y]=r(null),[ke,j]=r(me),[Be,K]=r(null),[Re,V]=r(null),[Fe,X]=r(null),[Ie,Z]=r(null),[v,q]=r(null),[H,J]=r(null),[De,Q]=r({}),Oe=o(e=>Q(i=>({...i,...e})),[]),l=yt(),$=_t(),Me=Ct(()=>Gt(vt($,E),v,H),[$,E,v,H]),[be,ee]=r(or),[Ne,te]=r(null),[xe,re]=r(null),[Ue,oe]=r(null),[Ae,ne]=r(null),[Le,ie]=r(null),ae=g(null),n=g(!1);f(()=>{y(Tr()),G(Er())},[]);const ze=o(e=>{n.current=!0,yr(),fe(e),y(e)},[]),Ye=o(e=>{n.current=!0,ge(e),G(e)},[]),je=o(e=>{n.current=!0,N(i=>Ut(i,e,c??""))},[c]),Ke=o(e=>{n.current=!0,x(e)},[]),Ve=o(e=>{n.current=!0,U(e)},[]),Xe=o(e=>{n.current=!0,A(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,z(e)},[]),Je=o(e=>{n.current=!0,Y(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,K(e)},[]),et=o(e=>{n.current=!0,ee(e)},[]),[tt,ce]=r(null),[rt,ot]=r(null),nt=o(e=>{n.current=!0,ce(e)},[]),it=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),ct=o(e=>{n.current=!0,Z(e)},[]),st=o(e=>{n.current=!0,q(e)},[]),dt=o(e=>{n.current=!0,J(e)},[]),ht=o(e=>{n.current=!0,te(e)},[]),ut=o(e=>{n.current=!0,re(e)},[]),lt=o(e=>{n.current=!0,oe(e)},[]),mt=o(e=>{n.current=!0,ne(e)},[]),pt=o(e=>{n.current=!0,ie(e)},[]);f(()=>{const e=k(l).theme;if(!h||!s.hasSiteTheme||!e)return;const i=c??"";ae.current!==i&&(ae.current=i,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;fe(t.default_mode),ge(t.show_theme_switch),y(t.default_mode),G(t.show_theme_switch),N(At({selected:t.selected_preset,themes:t.theme_presets},i));const C=gr(t);x(C.fonts),U(C.sizes);const S=It(t);Q(S),A(t.corner_radius_px===void 0?tr[ar(t.corner_style)]:w(t.corner_radius_px,S.cornerRadiusUnit,ir)),L(C.compression),z(t.card_shadow==null?hr:cr(t.card_shadow)),j(t.card_gap==null?me:sr(t.card_gap)),K(t.hover_effect==null?ur:dr(t.hover_effect)),Y(mr(t.shadow_color)),V(w(t.site_width,S.siteWidthUnit,Ft)),X(w(t.site_gutter,S.siteGutterUnit,Bt)),Z(w(t.site_gutter_phone,S.siteGutterPhoneUnit,Rt)),q(w(t.block_gap,S.blockGapUnit,le)),J(w(t.block_gap_phone,S.blockGapPhoneUnit,le)),ee(C.typography),ce(C.textStyles),ot(wr(t)),te(t.hero_background_follows_width===!0),re(ue(t.section_background_width)),oe(ue(t.section_content_width)),ne(t.photography_grayscale===!0),ie(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[h,c,s.hasSiteTheme,l]);const St=Kt({token:h,siteId:c,enabled:s.hasSiteSettings}),[ft,se]=r(Yt),de=g(null),W=g(!1),m=g(null),p=g({}),P=o(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await k(l).chat?.update(e,c?{siteId:c}:void 0),Tt()}catch(i){throw p.current={...e,...p.current},i}},[l,c]);f(()=>Et(()=>m.current||Object.keys(p.current).length>0?P():void 0),[P]);const gt=o(e=>{W.current=!0,se(i=>({...i,...e})),!(!s.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{P().catch(()=>{})},500))},[s.hasSiteSettings,h,P]);return f(()=>{if(!h||!s.hasSiteSettings)return;const e=c??"";de.current!==e&&(de.current=e,W.current=!1);let i=!1;const u=k(l).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{i||W.current||se(Cr(t))}).catch(()=>{}),()=>{i=!0}},[h,c,s.hasSiteSettings,l]),f(()=>{const e=d.site;if(!_||!s.hasSiteRecord||!e){O(null);return}let i=!1;return e().then(u=>{i||O(kt(u.name))}).catch(()=>{}),()=>{i=!0}},[_,h,s.hasSiteRecord,c,d]),a(Ot,{config:Me,parts:Sr,wrap:(e,i)=>a(Nt,{websiteName:we,templateChrome:E,templateName:Ce||null,themeMode:_e,onThemeModeChange:ze,themeSwitchShown:Pe,onThemeSwitchShownChange:Ye,theme:Te,themeRow:xt(s.hasSiteTheme,b.readFor,c??""),onThemeChange:je,fonts:Ee,onFontsChange:Ke,cornerRadiusPx:Ge,onCornerRadiusPxChange:Xe,cardShadow:He,onCardShadowChange:qe,shadowColor:We,onShadowColorChange:Je,cardGap:ke,onCardGapChange:Qe,hoverEffect:Be,onHoverEffectChange:$e,headingCompression:ve,onHeadingCompressionChange:Ze,headingTypography:be,onHeadingTypographyChange:et,textStyles:tt,onTextStylesChange:nt,wordStyles:rt,sizes:ye,onSizesChange:Ve,siteWidth:Re,onSiteWidthChange:it,siteGutter:Fe,onSiteGutterChange:at,siteGutterPhone:Ie,onSiteGutterPhoneChange:ct,blockGap:v,onBlockGapChange:st,blockGapPhone:H,onBlockGapPhoneChange:dt,siteLengthUnits:De,onSiteLengthUnitsChange:Oe,heroBackgroundFollowsWidth:Ne,onHeroBackgroundFollowsWidthChange:ht,sectionBackgroundWidth:xe,onSectionBackgroundWidthChange:ut,sectionContentWidth:Ue,onSectionContentWidthChange:lt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:mt,shareButtonOnPosts:Le,onShareButtonOnPostsChange:pt,themeFromDocument:!s.hasSiteTheme,children:a(Lt,{children:a(Pt,{wrap:l.chrome?.wrap,surface:"page",children:a(Zt,{children:a(qt,{children:a(Jt,{children:a($t,{children:a(Qt,{children:wt(er,{children:[a(zt,{chat:ft,onChatChange:gt,children:a(jt,{value:St,children:a(Vt,{children:a(Ht,{children:a(Mt,{children:e})})})})}),i]})})})})})})})})})})}function vr({target:d,openAddPage:s}){return a(Wt,{open:s,children:a(Dt,{target:d,addressing:Xt,onHostMessage:fr,children:a(Gr,{})})})}export{vr as default};
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode, type RefObject } from "react";
2
2
  import type { SiteThemeRowPatch } from "../../format/lib/site-theme-row.js";
3
+ import type { StoredTextStyle } from "../../render/lib/text-styles/site-text-styles.js";
3
4
  import { type CardShadow, type HoverEffect } from "../../format/lib/theme.js";
4
5
  export declare const SITE_STYLES_ID_PREFIX = "sf-site-styles";
5
6
  export declare const TABPANEL_CLASS = "sf-site-styles-tabpanel";
@@ -12,6 +13,7 @@ export type SiteStylesTabItem = {
12
13
  icon?: ReactNode;
13
14
  };
14
15
  export declare const SITE_STYLES_TABS: SiteStylesTabItem[];
16
+ export declare function siteTextStyleSizeOf(style: StoredTextStyle): number;
15
17
  export declare function SideSpaceRootField({ persist, }: {
16
18
  persist: (p: SiteThemeRowPatch, immediate?: boolean) => void;
17
19
  }): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- "use client";import{jsx as t,Fragment as x,jsxs as w}from"react/jsx-runtime";import{useEasel as O,useRootFields as H}from"efficient-easel/easel";import{Inspector as Y}from"efficient-easel/fields";import{SettingsGroup as j}from"efficient-easel/panel";import{useEffect as X,useRef as q,useState as G}from"react";import K from"./ThemeField.js";import M from"./CornersField.js";import $ from"./CardShadowField.js";import V from"./ShadowColourField.js";import J,{blockGapRow as Q}from"./BlockGapField.js";import Z from"./HoverEffectField.js";import D from"./PhotographyField.js";import ee from"./ShareButtonField.js";import{usePreviewDevice as k}from"efficient-easel/draw/client";import te,{sideSpaceRow as oe}from"./SideSpaceField.js";import{BackgroundWidthRow as ne,ContentWidthRow as re,SITE_BACKGROUND_HINT as ie,SITE_CONTENT_HINT as se}from"./SectionWidthRows.js";import ae from"./SiteAccentField.js";import le from"./SiteTextStylesField.js";import{usePreviewHeader as g}from"../../render/components/PreviewHeaderContext.js";import{useSiteLengthRow as P}from"./useSiteLengthRow.js";import{siteLengthRowAt as F}from"../lib/content/site-length-rows.js";import{EmptyState as ce,SliderGroup as ue,Tabs as de,Tooltip as pe,tabButtonId as he,tabPanelId as fe}from"efficient-shell/ui";import{ContrastIcon as ge,SettingsIcon as me,TypeIcon as Se}from"efficient-easel/icons";import{useThemeRowPersist as _e}from"../lib/theme-row-persist.js";import{themeSaveNotice as Ce}from"../../format/lib/theme-save-message.js";import{say as S}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as we}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as R}from"../../format/lib/content/page-width.js";import{storedUnit as xe}from"../../format/lib/content/css-length.js";import{PAGE_STYLE_FIELDS as Te}from"../lib/document/page-root-fields.js";import{previewFrame as be}from"efficient-easel/screen/lib/document/preview-dom";import{siteTextColourNameOf as ye,siteTextColours as Pe}from"../../format/lib/text-styles/site-text-colours.js";import{useSiteTextStylesWriter as Re}from"../lib/site-text-styles-writer.js";import{CORNER_STYLE_TO_PX as Ee,normalizeCornerRadius as Ge,normalizeCornerStyle as ke}from"../../format/lib/theme.js";import{pictureShadowColor as ve}from"efficient-easel/screen/lib/document/shadow-values";const v="sf-site-styles",Ie="sf-site-styles-tabpanel",Wt="text",A="basics",B="this-page-group",E=[{id:A,label:"Basics",icon:t(me,{})},{id:"theme",label:"Theme",icon:t(ge,{})},{id:"text",label:"Text",icon:t(Se,{})}];function Oe({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=O(c=>c),{theme:r,setTheme:u}=g(),a=n.data,i=a.root?.props??{},p=c=>{if(e){const h={...i,theme:c};s({type:"replaceRoot",root:{...a.root,props:h},recordHistory:!0})}else u(c);o({selected_preset:c.selected,theme_presets:c.themes})};return t(K,{value:e?i.theme:r,onChange:p})}function Fe({themeFromDocument:e,persist:o}){const[n,s]=G(null),{theme:r,setFonts:u,setSizes:a,setHeadingTypography:i}=g(),p=Re({themeFromDocument:e,persist:o}),{old:c,saved:h,writeRoot:f}=p,m=p.fonts,d=p.sizes,C=p.typography,T=l=>l.values.size??Ne(Ae[l.id]??"body")??Be[l.kind],b=l=>p.write(l),y=Pe(r),L=ye(r),N=l=>{const _={...m,accent:l};e?f({fonts:_}):u(_),o({accent_font:l})},W=l=>{a({...d,accent:l}),o({accent_size_px:l})},z=l=>{const _={...C,weightStrong:l};e?f({headingTypography:_}):i(_),o({heading_weight_strong:l})},U=l=>{const _={...C,italicStrong:l};e?f({headingTypography:_}):i(_),o({accent_italic:l})};return w(x,{children:[t(le,{saved:h,old:c,colours:y,colourNameOf:L,sizeOf:T,onChange:b,openId:n===I?null:n,onOpenChange:s,withoutSize:e}),t(ae,{font:m.accent,size:d.accent,weight:C.weightStrong,italic:C.italicStrong,headingWeight:C.weight,open:n===I,onOpenChange:l=>s(l?I:null),onChange:l=>{l.key==="font"?N(l.value):l.key==="size"?W(l.value):l.key==="weight"?z(l.value):U(l.value)},withoutSize:e})]})}const I="accent",Ae={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},Be={heading:32,body:14},Le={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function Ne(e){if(typeof document>"u")return null;const n=(be()?.contentDocument??document).querySelector(Le[e]);if(!n)return null;const s=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(s)?s:null}function We({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=O(d=>d),{cornerRadiusPx:r,setCornerRadiusPx:u}=g(),a=n.data,i=a.root?.props??{},p=i.cornerRadiusPx===void 0?Ee[ke(i.cornerStyle)]:Ge(i.cornerRadiusPx),c=e?p:r,h=P("cornerRadius",r,u,o),f=d=>s({type:"replaceRoot",root:{...a.root,props:{...i,...d}},recordHistory:!0});return t(M,{value:c,onChange:d=>{e?(f({cornerRadiusPx:d}),o({corner_radius_px:d})):h.write(d)},...e?{}:{length:h.length}})}function ze({persist:e}){const{siteWidth:o,setSiteWidth:n,sectionBackgroundWidth:s,setSectionBackgroundWidth:r,sectionContentWidth:u,setSectionContentWidth:a}=g(),i=k(),p=P("siteWidth",o??null,n,e);if(i!=="desktop")return null;const c=typeof o=="number"?o:p.shown(R.default),h=p.write,f=d=>{r(d),e({section_background_width:d},!0)},m=d=>{a(d),e({section_content_width:d},!0)};return w(x,{children:[t(ne,{value:s??"full",changed:s!==null,detail:S("Full width"),onChange:f,onReset:()=>f(null),hint:ie}),t(re,{mode:u??"content",px:c,min:R.min,max:R.max,changed:typeof o=="number"||u!==null,detail:`${S("Content width")} ${R.default}px`,onMode:m,onPx:d=>h(d),onReset:()=>{m(null),h(null)},hint:se,length:p.length})]})}function Ue({persist:e}){const{siteGutter:o,siteGutterPhone:n,setSiteGutter:s,setSiteGutterPhone:r,siteLengthUnits:u}=g(),a=oe(k(),{gutter:o,phone:n,gutterUnit:u.siteGutterUnit}),i=a?.key==="site_gutter_phone",p=P(F("siteGutter",i?"mobile":"desktop"),a?.value??null,i?r:s,e);return a?t(te,{value:a.value,onChange:p.write,unsetPx:a.unsetPx,restsOn:p.shown(a.unsetPx),bounds:a.bounds,length:p.length}):null}function He({persist:e}){const{blockGap:o,blockGapPhone:n,setBlockGap:s,setBlockGapPhone:r,siteLengthUnits:u}=g(),a=Q(k(),{gap:o,phone:n}),i=a?.key==="block_gap_phone",p=a?.followsPx==null?null:{figure:a.followsPx,unit:xe(u.blockGapUnit)},c=P(F("blockGap",i?"mobile":"desktop"),a?.value??null,i?r:s,e,p);return a?t(J,{value:a.value,onChange:c.write,followsPx:c.rest,followsUnit:c.length.unit,length:c.length}):null}function Ye({persist:e}){return w(x,{children:[t(ze,{persist:e}),t(Ue,{persist:e}),t(He,{persist:e})]})}function je(e){return{card_shadow:e}}function Xe(e){return e===null?{shadow_color:null}:{shadow_color:ve(e)}}function qe(e){return{hover_effect:e}}function Ke({persist:e}){const{cardShadow:o,setCardShadow:n,shadowColor:s,setShadowColor:r,hoverEffect:u,setHoverEffect:a}=g();return w(x,{children:[t($,{value:o,onChange:i=>{n(i),e(je(i),!0)}}),t(V,{value:s,onChange:i=>{r(i),e(Xe(i),i===null)}}),t(Z,{value:u,onChange:i=>{a(i),e(qe(i),!0)}})]})}function Me(e){return{photography_grayscale:e}}function $e({persist:e}){const{photographyGrayscale:o,setPhotographyGrayscale:n}=g();return t(D,{value:o,onChange:r=>{n(r),e(Me(r),!0)}})}function Ve({persist:e}){return t(x,{children:t($e,{persist:e})})}function Je(e){return{share_button_on_posts:e}}function Qe({persist:e}){const{shareButtonOnPosts:o,setShareButtonOnPosts:n}=g();return t(ee,{value:o,onChange:r=>{n(r),e(Je(r),!0)}})}function Ze(){const{websiteName:e}=g();return e?.trim()||we}function zt(){const e=Ze();return t(pe,{content:S("{name} — renamed in the Console: {place}.",{name:e,place:S("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:t("span",{className:"sf-panel-site",children:e})})}function De({themeFromDocument:e=!1,tokenRef:o,siteId:n,onNotify:s,tab:r,onTabChange:u,initialTab:a,revealPageGroup:i=!1,onPageGroupRevealed:p}){const{persist:c}=_e({themeFromDocument:e,tokenRef:o,siteId:n,onResult:b=>{const y=Ce(b);y&&s?.(y.msg,y.tone)}}),[h,f]=G(a??E[0].id),m=r!==void 0,d=m?r:h,C=m?u??(()=>{}):f,T=E.find(b=>b.id===d)??E[0];return w(ue,{children:[t(ot,{activeId:T.id,onSelect:C}),w("div",{id:fe(v,T.id),className:Ie,role:"tabpanel","aria-labelledby":he(v,T.id),children:[d===A&&w(x,{children:[t(We,{themeFromDocument:e,persist:c}),!e&&t(Ke,{persist:c}),!e&&t(Ye,{persist:c}),!e&&t(Ve,{persist:c}),!e&&t(Qe,{persist:c}),t(et,{reveal:i,onRevealed:p})]}),d==="theme"&&t(Oe,{themeFromDocument:e,persist:c}),d==="text"&&t(Fe,{themeFromDocument:e,persist:c})]})]})}function et({reveal:e,onRevealed:o}){const[n,s]=G(!0),r=q(o);return r.current=o,X(()=>{if(!e)return;s(!0);const u=requestAnimationFrame(()=>{document.getElementById(B)?.scrollIntoView({block:"start"}),r.current?.()});return()=>cancelAnimationFrame(u)},[e]),t(j,{title:S("This page"),open:n,onToggle:s,id:B,children:t(tt,{})})}function tt(){const{fields:e,values:o,readOnly:n,onChange:s}=H(),r=Object.fromEntries(Te.filter(u=>u in e).map(u=>[u,e[u]]));return Object.keys(r).length===0?t(ce,{variant:"none",icon:!1,message:S("This page has no look of its own to set.")}):t(Y,{fields:r,values:o,onChange:s,readOnly:n,tabs:!1,idPrefix:"this-page",ariaLabel:S("This page")})}function ot({activeId:e,onSelect:o}){return t("div",{className:"es-insp-tabs",children:t(de,{variant:"underline",block:!0,labelsFit:!0,"aria-label":S("Styles"),idPrefix:v,value:e,onChange:o,items:E.map(n=>{const s=S(n.label);return{id:n.id,icon:n.icon,label:s}})})})}export{He as BlockGapRootField,Ke as CardLookFields,Ye as PageGroupFields,Ve as PhotographyGroupFields,A as SITE_STYLES_BASICS_TAB,v as SITE_STYLES_ID_PREFIX,E as SITE_STYLES_TABS,Wt as SITE_STYLES_TEXT_TAB,Qe as ShareButtonRootField,Ue as SideSpaceRootField,ot as SiteStylesTabStrip,Ie as TABPANEL_CLASS,B as THIS_PAGE_GROUP_ID,zt as WebsiteNameReadonly,je as cardShadowPatch,De as default,qe as hoverEffectPatch,Me as photographyPatch,Xe as shadowColourPatch,Je as shareButtonPatch,Ze as useWebsiteName};
1
+ "use client";import{jsx as t,Fragment as C,jsxs as x}from"react/jsx-runtime";import{useEasel as I,useRootFields as H}from"efficient-easel/easel";import{Inspector as Y}from"efficient-easel/fields";import{SettingsGroup as j}from"efficient-easel/panel";import{useEffect as X,useRef as q,useState as G}from"react";import K from"./ThemeField.js";import M from"./CornersField.js";import $ from"./CardShadowField.js";import V from"./ShadowColourField.js";import J,{blockGapRow as Q}from"./BlockGapField.js";import Z from"./HoverEffectField.js";import D from"./PhotographyField.js";import ee from"./ShareButtonField.js";import{usePreviewDevice as O}from"efficient-easel/draw/client";import te,{sideSpaceRow as oe}from"./SideSpaceField.js";import{BackgroundWidthRow as ne,ContentWidthRow as re,SITE_BACKGROUND_HINT as ie,SITE_CONTENT_HINT as se}from"./SectionWidthRows.js";import ae from"./SiteAccentField.js";import le from"./SiteTextStylesField.js";import{usePreviewHeader as g}from"../../render/components/PreviewHeaderContext.js";import{useSiteLengthRow as P}from"./useSiteLengthRow.js";import{siteLengthRowAt as F}from"../lib/content/site-length-rows.js";import{EmptyState as ce,SliderGroup as ue,Tabs as de,Tooltip as pe,tabButtonId as he,tabPanelId as fe}from"efficient-shell/ui";import{ContrastIcon as ge,SettingsIcon as me,TypeIcon as Se}from"efficient-easel/icons";import{useThemeRowPersist as _e}from"../lib/theme-row-persist.js";import{themeSaveNotice as we}from"../../format/lib/theme-save-message.js";import{say as S}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as xe}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as R}from"../../format/lib/content/page-width.js";import{storedUnit as Ce}from"../../format/lib/content/css-length.js";import{PAGE_STYLE_FIELDS as Te}from"../lib/document/page-root-fields.js";import{previewFrame as ye}from"efficient-easel/screen/lib/document/preview-dom";import{siteTextColourNameOf as be,siteTextColours as Pe}from"../../format/lib/text-styles/site-text-colours.js";import{useSiteTextStylesWriter as Re}from"../lib/site-text-styles-writer.js";import{ownEntry as Ee}from"../../format/lib/own-entry.js";import{CORNER_STYLE_TO_PX as Ge,normalizeCornerRadius as Oe,normalizeCornerStyle as ke}from"../../format/lib/theme.js";import{pictureShadowColor as ve}from"efficient-easel/screen/lib/document/shadow-values";const k="sf-site-styles",Ie="sf-site-styles-tabpanel",Ht="text",A="basics",B="this-page-group",E=[{id:A,label:"Basics",icon:t(me,{})},{id:"theme",label:"Theme",icon:t(ge,{})},{id:"text",label:"Text",icon:t(Se,{})}];function Fe({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=I(l=>l),{theme:r,setTheme:c}=g(),a=n.data,i=a.root?.props??{},p=l=>{if(e){const h={...i,theme:l};s({type:"replaceRoot",root:{...a.root,props:h},recordHistory:!0})}else c(l);o({selected_preset:l.selected,theme_presets:l.themes})};return t(K,{value:e?i.theme:r,onChange:p})}function Ae({themeFromDocument:e,persist:o}){const[n,s]=G(null),{theme:r,setFonts:c,setSizes:a,setHeadingTypography:i}=g(),p=Re({themeFromDocument:e,persist:o}),{old:l,saved:h,writeRoot:f}=p,m=p.fonts,u=p.sizes,w=p.typography,T=Ne,y=d=>p.write(d),b=Pe(r),L=be(r),N=d=>{const _={...m,accent:d};e?f({fonts:_}):c(_),o({accent_font:d})},W=d=>{a({...u,accent:d}),o({accent_size_px:d})},z=d=>{const _={...w,weightStrong:d};e?f({headingTypography:_}):i(_),o({heading_weight_strong:d})},U=d=>{const _={...w,italicStrong:d};e?f({headingTypography:_}):i(_),o({accent_italic:d})};return x(C,{children:[t(le,{saved:h,old:l,colours:b,colourNameOf:L,sizeOf:T,onChange:y,openId:n===v?null:n,onOpenChange:s,withoutSize:e}),t(ae,{font:m.accent,size:u.accent,weight:w.weightStrong,italic:w.italicStrong,headingWeight:w.weight,open:n===v,onOpenChange:d=>s(d?v:null),onChange:d=>{d.key==="font"?N(d.value):d.key==="size"?W(d.value):d.key==="weight"?z(d.value):U(d.value)},withoutSize:e})]})}const v="accent",Be={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},Le={heading:32,body:14};function Ne(e){return e.values.size??ze(Ee(Be,e.id)??"body")??Le[e.kind]}const We={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function ze(e){if(typeof document>"u")return null;const n=(ye()?.contentDocument??document).querySelector(We[e]);if(!n)return null;const s=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(s)?s:null}function Ue({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=I(u=>u),{cornerRadiusPx:r,setCornerRadiusPx:c}=g(),a=n.data,i=a.root?.props??{},p=i.cornerRadiusPx===void 0?Ge[ke(i.cornerStyle)]:Oe(i.cornerRadiusPx),l=e?p:r,h=P("cornerRadius",r,c,o),f=u=>s({type:"replaceRoot",root:{...a.root,props:{...i,...u}},recordHistory:!0});return t(M,{value:l,onChange:u=>{e?(f({cornerRadiusPx:u}),o({corner_radius_px:u})):h.write(u)},...e?{}:{length:h.length}})}function He({persist:e}){const{siteWidth:o,setSiteWidth:n,sectionBackgroundWidth:s,setSectionBackgroundWidth:r,sectionContentWidth:c,setSectionContentWidth:a}=g(),i=O(),p=P("siteWidth",o??null,n,e);if(i!=="desktop")return null;const l=typeof o=="number"?o:p.shown(R.default),h=p.write,f=u=>{r(u),e({section_background_width:u},!0)},m=u=>{a(u),e({section_content_width:u},!0)};return x(C,{children:[t(ne,{value:s??"full",changed:s!==null,detail:S("Full width"),onChange:f,onReset:()=>f(null),hint:ie}),t(re,{mode:c??"content",px:l,min:R.min,max:R.max,changed:typeof o=="number"||c!==null,detail:`${S("Content width")} ${R.default}px`,onMode:m,onPx:u=>h(u),onReset:()=>{m(null),h(null)},hint:se,length:p.length})]})}function Ye({persist:e}){const{siteGutter:o,siteGutterPhone:n,setSiteGutter:s,setSiteGutterPhone:r,siteLengthUnits:c}=g(),a=oe(O(),{gutter:o,phone:n,gutterUnit:c.siteGutterUnit}),i=a?.key==="site_gutter_phone",p=P(F("siteGutter",i?"mobile":"desktop"),a?.value??null,i?r:s,e);return a?t(te,{value:a.value,onChange:p.write,unsetPx:a.unsetPx,restsOn:p.shown(a.unsetPx),bounds:a.bounds,length:p.length}):null}function je({persist:e}){const{blockGap:o,blockGapPhone:n,setBlockGap:s,setBlockGapPhone:r,siteLengthUnits:c}=g(),a=Q(O(),{gap:o,phone:n}),i=a?.key==="block_gap_phone",p=a?.followsPx==null?null:{figure:a.followsPx,unit:Ce(c.blockGapUnit)},l=P(F("blockGap",i?"mobile":"desktop"),a?.value??null,i?r:s,e,p);return a?t(J,{value:a.value,onChange:l.write,followsPx:l.rest,followsUnit:l.length.unit,length:l.length}):null}function Xe({persist:e}){return x(C,{children:[t(He,{persist:e}),t(Ye,{persist:e}),t(je,{persist:e})]})}function qe(e){return{card_shadow:e}}function Ke(e){return e===null?{shadow_color:null}:{shadow_color:ve(e)}}function Me(e){return{hover_effect:e}}function $e({persist:e}){const{cardShadow:o,setCardShadow:n,shadowColor:s,setShadowColor:r,hoverEffect:c,setHoverEffect:a}=g();return x(C,{children:[t($,{value:o,onChange:i=>{n(i),e(qe(i),!0)}}),t(V,{value:s,onChange:i=>{r(i),e(Ke(i),i===null)}}),t(Z,{value:c,onChange:i=>{a(i),e(Me(i),!0)}})]})}function Ve(e){return{photography_grayscale:e}}function Je({persist:e}){const{photographyGrayscale:o,setPhotographyGrayscale:n}=g();return t(D,{value:o,onChange:r=>{n(r),e(Ve(r),!0)}})}function Qe({persist:e}){return t(C,{children:t(Je,{persist:e})})}function Ze(e){return{share_button_on_posts:e}}function De({persist:e}){const{shareButtonOnPosts:o,setShareButtonOnPosts:n}=g();return t(ee,{value:o,onChange:r=>{n(r),e(Ze(r),!0)}})}function et(){const{websiteName:e}=g();return e?.trim()||xe}function Yt(){const e=et();return t(pe,{content:S("{name} — renamed in the Console: {place}.",{name:e,place:S("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:t("span",{className:"sf-panel-site",children:e})})}function tt({themeFromDocument:e=!1,tokenRef:o,siteId:n,onNotify:s,tab:r,onTabChange:c,initialTab:a,revealPageGroup:i=!1,onPageGroupRevealed:p}){const{persist:l}=_e({themeFromDocument:e,tokenRef:o,siteId:n,onResult:y=>{const b=we(y);b&&s?.(b.msg,b.tone)}}),[h,f]=G(a??E[0].id),m=r!==void 0,u=m?r:h,w=m?c??(()=>{}):f,T=E.find(y=>y.id===u)??E[0];return x(ue,{children:[t(rt,{activeId:T.id,onSelect:w}),x("div",{id:fe(k,T.id),className:Ie,role:"tabpanel","aria-labelledby":he(k,T.id),children:[u===A&&x(C,{children:[t(Ue,{themeFromDocument:e,persist:l}),!e&&t($e,{persist:l}),!e&&t(Xe,{persist:l}),!e&&t(Qe,{persist:l}),!e&&t(De,{persist:l}),t(ot,{reveal:i,onRevealed:p})]}),u==="theme"&&t(Fe,{themeFromDocument:e,persist:l}),u==="text"&&t(Ae,{themeFromDocument:e,persist:l})]})]})}function ot({reveal:e,onRevealed:o}){const[n,s]=G(!0),r=q(o);return r.current=o,X(()=>{if(!e)return;s(!0);const c=requestAnimationFrame(()=>{document.getElementById(B)?.scrollIntoView({block:"start"}),r.current?.()});return()=>cancelAnimationFrame(c)},[e]),t(j,{title:S("This page"),open:n,onToggle:s,id:B,children:t(nt,{})})}function nt(){const{fields:e,values:o,readOnly:n,onChange:s}=H(),r=Object.fromEntries(Te.filter(c=>c in e).map(c=>[c,e[c]]));return Object.keys(r).length===0?t(ce,{variant:"none",icon:!1,message:S("This page has no look of its own to set.")}):t(Y,{fields:r,values:o,onChange:s,readOnly:n,tabs:!1,idPrefix:"this-page",ariaLabel:S("This page")})}function rt({activeId:e,onSelect:o}){return t("div",{className:"es-insp-tabs",children:t(de,{variant:"underline",block:!0,labelsFit:!0,"aria-label":S("Styles"),idPrefix:k,value:e,onChange:o,items:E.map(n=>{const s=S(n.label);return{id:n.id,icon:n.icon,label:s}})})})}export{je as BlockGapRootField,$e as CardLookFields,Xe as PageGroupFields,Qe as PhotographyGroupFields,A as SITE_STYLES_BASICS_TAB,k as SITE_STYLES_ID_PREFIX,E as SITE_STYLES_TABS,Ht as SITE_STYLES_TEXT_TAB,De as ShareButtonRootField,Ye as SideSpaceRootField,rt as SiteStylesTabStrip,Ie as TABPANEL_CLASS,B as THIS_PAGE_GROUP_ID,Yt as WebsiteNameReadonly,qe as cardShadowPatch,tt as default,Me as hoverEffectPatch,Ve as photographyPatch,Ke as shadowColourPatch,Ze as shareButtonPatch,Ne as siteTextStyleSizeOf,et as useWebsiteName};
@@ -4108,3 +4108,114 @@ input.sf-list-marking {
4108
4108
  .sf-anchor-link-hash {
4109
4109
  flex: none;
4110
4110
  }
4111
+
4112
+ /* The Custom HTML code window (components/CustomHtmlCodeWindow): Site styles,
4113
+ preview and code side by side in a full-size shell Dialog. The left column
4114
+ is the settings panel's width; the preview takes three parts, the code two. */
4115
+ .sf-code-window {
4116
+ display: grid;
4117
+ grid-template-columns: var(--es-right-w, 280px) minmax(0, 3fr) minmax(0, 2fr);
4118
+ gap: var(--space-16);
4119
+ height: 100%;
4120
+ min-height: 0;
4121
+ padding: var(--space-16);
4122
+ box-sizing: border-box;
4123
+ }
4124
+ .sf-code-window-styles {
4125
+ display: block;
4126
+ min-height: 0;
4127
+ overflow: auto;
4128
+ }
4129
+ .sf-code-window-group {
4130
+ display: flex;
4131
+ flex-direction: column;
4132
+ gap: var(--space-16);
4133
+ }
4134
+ .sf-code-window-list {
4135
+ display: flex;
4136
+ flex-direction: column;
4137
+ gap: var(--space-4);
4138
+ }
4139
+ /* One row form for every pick: a 24px mark, the name (main), the value (dim)
4140
+ at the end, the link under the name. The whole row is the shell Button. */
4141
+ .sf-code-window-row.sf-code-window-row {
4142
+ display: grid;
4143
+ grid-template-columns: var(--space-24) minmax(0, 1fr) auto;
4144
+ column-gap: var(--space-12);
4145
+ row-gap: var(--space-4);
4146
+ align-items: center;
4147
+ height: auto;
4148
+ padding-block: var(--space-4);
4149
+ text-align: left;
4150
+ }
4151
+ .sf-code-window-row-sub {
4152
+ grid-row: 2;
4153
+ grid-column: 2 / -1;
4154
+ display: flex;
4155
+ }
4156
+ .sf-code-window-row-icon {
4157
+ display: flex;
4158
+ align-items: center;
4159
+ justify-content: center;
4160
+ width: var(--space-24);
4161
+ height: var(--space-24);
4162
+ }
4163
+ .sf-code-window-column {
4164
+ display: flex;
4165
+ flex-direction: column;
4166
+ gap: var(--space-8);
4167
+ min-height: 0;
4168
+ min-width: 0;
4169
+ }
4170
+ .sf-code-window-bar {
4171
+ display: flex;
4172
+ align-items: center;
4173
+ justify-content: space-between;
4174
+ min-height: var(--space-32);
4175
+ flex: none;
4176
+ }
4177
+ .sf-code-window-actions {
4178
+ display: flex;
4179
+ gap: var(--space-8);
4180
+ }
4181
+ .sf-code-window-added {
4182
+ display: flex;
4183
+ align-items: baseline;
4184
+ gap: var(--space-8);
4185
+ min-width: 0;
4186
+ white-space: nowrap;
4187
+ }
4188
+ .sf-code-window-fill {
4189
+ flex: 1;
4190
+ min-height: 0;
4191
+ display: flex;
4192
+ flex-direction: column;
4193
+ }
4194
+ .sf-code-window-fill > * {
4195
+ flex: 1;
4196
+ min-height: 0;
4197
+ display: flex;
4198
+ flex-direction: column;
4199
+ }
4200
+ .sf-code-window-stage {
4201
+ flex: 1;
4202
+ min-width: 0;
4203
+ height: 100%;
4204
+ }
4205
+ .sf-code-window-stage > .sf-frame > iframe {
4206
+ display: block;
4207
+ flex: none;
4208
+ border: 0;
4209
+ }
4210
+ .sf-code-window-editor {
4211
+ flex: 1;
4212
+ min-height: 0;
4213
+ overflow: hidden;
4214
+ display: flex;
4215
+ }
4216
+ .sf-code-window-editor > * {
4217
+ flex: 1;
4218
+ min-height: 0;
4219
+ min-width: 0;
4220
+ width: 100%;
4221
+ }
@@ -0,0 +1,6 @@
1
+ import type { BlockFields } from "../../../../../../format/lib/document/blocks/block-types.js";
2
+ export declare function CustomHtmlCodeField({ value, onChange }: {
3
+ value: string | undefined;
4
+ onChange: (next: string) => void;
5
+ }): import("react").JSX.Element;
6
+ export declare const CustomHTMLFields: BlockFields;
@@ -0,0 +1 @@
1
+ import{jsx as o,jsxs as l}from"react/jsx-runtime";import{Suspense as i,lazy as m,useState as a}from"react";import{Button as p}from"efficient-shell/ui";import{CodeIcon as c}from"efficient-shell/icons/efficient";import{SettingsField as d}from"efficient-easel/panel";import{iconOf as f}from"efficient-easel/screen/lib/document/box-fields";import{say as r}from"../../../../../../format/lib/editor-words.js";const u=m(()=>import("../../../../../components/CustomHtmlCodeWindow.js"));function C({value:e,onChange:t}){const[s,n]=a(!1);return l(d,{label:r("HTML"),icon:f(o(c,{})),children:[o(p,{variant:"secondary",onClick:()=>n(!0),children:r("Edit code")}),s?o(i,{fallback:null,children:o(u,{open:!0,onClose:()=>n(!1),value:typeof e=="string"?e:"",onChange:t})}):null]})}const F={fields:{html:{type:"custom",label:"HTML",render:({value:e,onChange:t})=>o(C,{value:e,onChange:t})}}};export{F as CustomHTMLFields,C as CustomHtmlCodeField};
@@ -1 +1 @@
1
- import{assembleBlocks as o}from"../../../../../format/lib/document/blocks/block-types.js";import{registerGeneralSectionRows as r}from"../../../../../render/lib/document/blocks/general/section-to-box-rows.js";import{BannerFields as e}from"./Banner/fields.js";import{BreadcrumbFields as i}from"./Breadcrumb/fields.js";import{ButtonBlockFields as t}from"./ButtonBlock/fields.js";import{CardsFields as m}from"./Cards/fields.js";import{CategoryBarFields as s}from"./CategoryBar/fields.js";import{ChartFields as d}from"./Chart/fields.js";import{ContactLocationsFields as a}from"./ContactLocations/fields.js";import{CountdownFields as l}from"./Countdown/fields.js";import{CustomHTMLFields as p}from"../../../../../format/lib/document/blocks/general/CustomHTML/fields.js";import{DividerFields as F}from"./Divider/fields.js";import{ContentsFields as f}from"./Contents/fields.js";import{ListSearchFields as n}from"./ListSearch/fields.js";import{DocBodyFields as c}from"./DocBody/fields.js";import{DocMastheadFields as S}from"./DocMasthead/fields.js";import{DocMetaCardsFields as B}from"./DocMetaCards/fields.js";import{DocTabsFields as g}from"./DocTabs/fields.js";import{EyebrowFields as C}from"./Eyebrow/fields.js";import{FAQFields as u}from"./FAQ/fields.js";import{FeaturedCoverFields as L}from"./FeaturedCover/fields.js";import{FlexFields as T}from"./Flex/fields.js";import{FootprintFields as H}from"./Footprint/fields.js";import{GridFields as k}from"./Grid/fields.js";import{HeadingFields as h}from"./Heading/fields.js";import{HeroFields as M}from"./Hero/fields.js";import{HeroGroupFields as P}from"./HeroGroup/fields.js";import{HeroSingleFields as y}from"./HeroSingle/fields.js";import{HeroSlideFields as D}from"./HeroSlide/fields.js";import{ImageBlockFields as E}from"./ImageBlock/fields.js";import{IntegrationsFields as b}from"./Integrations/fields.js";import{IntroBleedFields as G}from"./IntroBleed/fields.js";import{KeyFeaturesFields as I}from"./KeyFeatures/fields.js";import{LocationMapFields as R}from"./LocationMap/fields.js";import{LogoBlockFields as x}from"./LogoBlock/fields.js";import{LogosFields as A}from"./Logos/fields.js";import{LongReadFields as w}from"./LongRead/fields.js";import{ManifestoFields as v}from"./Manifesto/fields.js";import{MastheadFields as N}from"./Masthead/fields.js";import{MockupFields as K}from"./Mockup/fields.js";import{OrderSummaryFields as O}from"./OrderSummary/fields.js";import{CardListFields as Q}from"./CardList/fields.js";import{HostPartFields as W}from"./HostPart/fields.js";import{ParagraphsAFields as _}from"./ParagraphsA/fields.js";import{PaymentBadgesFields as j}from"./PaymentBadges/fields.js";import{PostCardFields as q}from"./PostCard/fields.js";import{ProcessStepsFields as z}from"./ProcessSteps/fields.js";import{ProseFields as J}from"./Prose/fields.js";import{SectionHeaderFields as U}from"./SectionHeader/fields.js";import{SeriesFields as V}from"./Series/fields.js";import{SpacerFields as X}from"../../../../../format/lib/document/blocks/general/Spacer/fields.js";import{SpecStripFields as Y}from"./SpecStrip/fields.js";import{SplitFields as Z}from"./Split/fields.js";import{StatsFields as $}from"./Stats/fields.js";import{StatsParagraphFields as oo}from"./StatsParagraph/fields.js";import{TestimonialsFields as ro}from"./Testimonials/fields.js";import{TextFields as eo}from"./Text/fields.js";import{TickerFields as io}from"./Ticker/fields.js";import{TimelineFields as to}from"./Timeline/fields.js";import{TimelineTrackFields as mo}from"./TimelineTrack/fields.js";import{TitleWithButtonsFields as so}from"./TitleWithButtons/fields.js";import{GENERAL_RENDERS as ao}from"../../../../../render/lib/document/blocks/general/renders.js";const lo={Banner:e,Breadcrumb:i,ButtonBlock:t,Cards:m,CategoryBar:s,Chart:d,ContactLocations:a,Countdown:l,CustomHTML:p,Divider:F,Contents:f,ListSearch:n,DocBody:c,DocMasthead:S,DocMetaCards:B,DocTabs:g,Eyebrow:C,FAQ:u,FeaturedCover:L,Flex:T,Footprint:H,Grid:k,Heading:h,Hero:M,HeroGroup:P,HeroSingle:y,HeroSlide:D,ImageBlock:E,Integrations:b,IntroBleed:G,KeyFeatures:I,LocationMap:R,LogoBlock:x,Logos:A,LongRead:w,Manifesto:v,Masthead:N,Mockup:K,OrderSummary:O,CardList:Q,HostPart:W,ParagraphsA:_,PaymentBadges:j,PostCard:q,ProcessSteps:z,Prose:J,SectionHeader:U,Series:V,Spacer:X,SpecStrip:Y,Split:Z,Stats:$,StatsParagraph:oo,Testimonials:ro,Text:eo,Ticker:io,Timeline:to,TimelineTrack:mo,TitleWithButtons:so},po=()=>(r(),o(ao,lo)),ur=po();export{po as assembleGeneralBlocks,ur as generalBlocks};
1
+ import{assembleBlocks as o}from"../../../../../format/lib/document/blocks/block-types.js";import{registerGeneralSectionRows as r}from"../../../../../render/lib/document/blocks/general/section-to-box-rows.js";import{BannerFields as e}from"./Banner/fields.js";import{BreadcrumbFields as i}from"./Breadcrumb/fields.js";import{ButtonBlockFields as t}from"./ButtonBlock/fields.js";import{CardsFields as m}from"./Cards/fields.js";import{CategoryBarFields as s}from"./CategoryBar/fields.js";import{ChartFields as d}from"./Chart/fields.js";import{ContactLocationsFields as a}from"./ContactLocations/fields.js";import{CountdownFields as l}from"./Countdown/fields.js";import{CustomHTMLFields as p}from"./CustomHTML/fields.js";import{DividerFields as F}from"./Divider/fields.js";import{ContentsFields as f}from"./Contents/fields.js";import{ListSearchFields as n}from"./ListSearch/fields.js";import{DocBodyFields as c}from"./DocBody/fields.js";import{DocMastheadFields as S}from"./DocMasthead/fields.js";import{DocMetaCardsFields as B}from"./DocMetaCards/fields.js";import{DocTabsFields as g}from"./DocTabs/fields.js";import{EyebrowFields as C}from"./Eyebrow/fields.js";import{FAQFields as u}from"./FAQ/fields.js";import{FeaturedCoverFields as L}from"./FeaturedCover/fields.js";import{FlexFields as T}from"./Flex/fields.js";import{FootprintFields as H}from"./Footprint/fields.js";import{GridFields as k}from"./Grid/fields.js";import{HeadingFields as h}from"./Heading/fields.js";import{HeroFields as M}from"./Hero/fields.js";import{HeroGroupFields as P}from"./HeroGroup/fields.js";import{HeroSingleFields as y}from"./HeroSingle/fields.js";import{HeroSlideFields as D}from"./HeroSlide/fields.js";import{ImageBlockFields as E}from"./ImageBlock/fields.js";import{IntegrationsFields as b}from"./Integrations/fields.js";import{IntroBleedFields as G}from"./IntroBleed/fields.js";import{KeyFeaturesFields as I}from"./KeyFeatures/fields.js";import{LocationMapFields as R}from"./LocationMap/fields.js";import{LogoBlockFields as x}from"./LogoBlock/fields.js";import{LogosFields as A}from"./Logos/fields.js";import{LongReadFields as w}from"./LongRead/fields.js";import{ManifestoFields as v}from"./Manifesto/fields.js";import{MastheadFields as N}from"./Masthead/fields.js";import{MockupFields as K}from"./Mockup/fields.js";import{OrderSummaryFields as O}from"./OrderSummary/fields.js";import{CardListFields as Q}from"./CardList/fields.js";import{HostPartFields as W}from"./HostPart/fields.js";import{ParagraphsAFields as _}from"./ParagraphsA/fields.js";import{PaymentBadgesFields as j}from"./PaymentBadges/fields.js";import{PostCardFields as q}from"./PostCard/fields.js";import{ProcessStepsFields as z}from"./ProcessSteps/fields.js";import{ProseFields as J}from"./Prose/fields.js";import{SectionHeaderFields as U}from"./SectionHeader/fields.js";import{SeriesFields as V}from"./Series/fields.js";import{SpacerFields as X}from"../../../../../format/lib/document/blocks/general/Spacer/fields.js";import{SpecStripFields as Y}from"./SpecStrip/fields.js";import{SplitFields as Z}from"./Split/fields.js";import{StatsFields as $}from"./Stats/fields.js";import{StatsParagraphFields as oo}from"./StatsParagraph/fields.js";import{TestimonialsFields as ro}from"./Testimonials/fields.js";import{TextFields as eo}from"./Text/fields.js";import{TickerFields as io}from"./Ticker/fields.js";import{TimelineFields as to}from"./Timeline/fields.js";import{TimelineTrackFields as mo}from"./TimelineTrack/fields.js";import{TitleWithButtonsFields as so}from"./TitleWithButtons/fields.js";import{GENERAL_RENDERS as ao}from"../../../../../render/lib/document/blocks/general/renders.js";const lo={Banner:e,Breadcrumb:i,ButtonBlock:t,Cards:m,CategoryBar:s,Chart:d,ContactLocations:a,Countdown:l,CustomHTML:p,Divider:F,Contents:f,ListSearch:n,DocBody:c,DocMasthead:S,DocMetaCards:B,DocTabs:g,Eyebrow:C,FAQ:u,FeaturedCover:L,Flex:T,Footprint:H,Grid:k,Heading:h,Hero:M,HeroGroup:P,HeroSingle:y,HeroSlide:D,ImageBlock:E,Integrations:b,IntroBleed:G,KeyFeatures:I,LocationMap:R,LogoBlock:x,Logos:A,LongRead:w,Manifesto:v,Masthead:N,Mockup:K,OrderSummary:O,CardList:Q,HostPart:W,ParagraphsA:_,PaymentBadges:j,PostCard:q,ProcessSteps:z,Prose:J,SectionHeader:U,Series:V,Spacer:X,SpecStrip:Y,Split:Z,Stats:$,StatsParagraph:oo,Testimonials:ro,Text:eo,Ticker:io,Timeline:to,TimelineTrack:mo,TitleWithButtons:so},po=()=>(r(),o(ao,lo)),ur=po();export{po as assembleGeneralBlocks,ur as generalBlocks};
@@ -8,6 +8,7 @@ import { readHidable, hidableText, type HidableValue } from "efficient-easel/dra
8
8
  import { FOLD_FIELD_MARKER, LINK_FIELD_MARKER, MEDIA_FIELD_MARKER, SCAFFOLD_FIELD_MARKER, TEXT_FIELD_MARKER, foldMetaOf, textFieldIdentifier, type EdgeCell, type FoldFieldMeta, type TextFieldMeta, type TextListRendering } from "efficient-easel/draw";
9
9
  import { type ShowWhenRule } from "../../../render/lib/document/show-when.js";
10
10
  import { CARD_IMAGE_RADIUS_ROW } from "../../../format/lib/content/card-image-shape.js";
11
+ import type { PhonePlace } from "../../../render/components/PhoneMenuTools.js";
11
12
  import { FOCAL_DEFAULT, type UnitChoice as ShellUnitChoice } from "efficient-shell/ui";
12
13
  import { type ColourChoice } from "./ColourControl.js";
13
14
  import { type DeviceTier } from "efficient-easel/screen/lib/document/device-fields";
@@ -216,6 +217,7 @@ export declare function cardCornersField(): CustomField<number | null>;
216
217
  export declare function cardShapeFields(): Record<string, unknown>;
217
218
  export declare function boxShareField(): CustomField<unknown>;
218
219
  export declare function boxBlockSpacingField(): SelectField;
220
+ export declare function phonePlaceField(fallback: PhonePlace): SelectField;
219
221
  export declare function boxSharePhoneField(): {
220
222
  options: {
221
223
  showWhen?: ShowWhenRule | undefined;