efficient-web-builder 34.0.0 → 36.0.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 (53) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/editor/components/CanvasPartsBridge.d.ts +4 -0
  3. package/dist/editor/components/CanvasPartsBridge.js +1 -0
  4. package/dist/editor/components/MediaUploadField.d.ts +2 -1
  5. package/dist/editor/components/MediaUploadField.js +1 -1
  6. package/dist/editor/components/PartSettingsPanel.js +1 -1
  7. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  8. package/dist/editor/components/SectionTextPartBridge.js +1 -1
  9. package/dist/editor/components/StandaloneSectionEditor.js +1 -1
  10. package/dist/editor/components/StorefrontEditor.js +1 -1
  11. package/dist/editor/components/WebsiteScreenParts.js +1 -1
  12. package/dist/editor/lib/puck/blocks/general/Cards/fields.js +1 -1
  13. package/dist/editor/lib/puck/blocks/general/Timeline/fields.js +1 -1
  14. package/dist/editor/lib/puck/blocks/general/index.d.ts +2 -2
  15. package/dist/editor/lib/puck/controls.d.ts +2 -1
  16. package/dist/editor/lib/puck/every-page.d.ts +2 -2
  17. package/dist/editor/lib/puck/every-page.js +1 -1
  18. package/dist/editor/lib/puck/part-anchors.d.ts +4 -2
  19. package/dist/editor/lib/puck/part-anchors.js +1 -1
  20. package/dist/editor/lib/site-text-styles.d.ts +3 -2
  21. package/dist/editor/lib/site-text-styles.js +2 -2
  22. package/dist/format/lib/editor-words-catalogue.d.ts +5 -5
  23. package/dist/format/lib/editor-words-catalogue.js +3 -3
  24. package/dist/format/lib/media-value.d.ts +9 -0
  25. package/dist/format/lib/media-value.js +1 -0
  26. package/dist/format/lib/puck/passes/media-values.d.ts +3 -0
  27. package/dist/format/lib/puck/passes/media-values.js +1 -0
  28. package/dist/format/lib/puck/section-catalog.js +7 -1
  29. package/dist/format/lib/puck/templateFields.js +1 -1
  30. package/dist/format/lib/text-style-face.d.ts +3 -0
  31. package/dist/format/lib/text-style-face.js +1 -0
  32. package/dist/render/components/Heading.d.ts +7 -1
  33. package/dist/render/components/Heading.js +1 -1
  34. package/dist/render/components/PartStyledKind.js +1 -1
  35. package/dist/render/components/PartStyledText.js +1 -1
  36. package/dist/render/components/PublishedPartStylesContext.js +1 -1
  37. package/dist/render/components/Text.d.ts +2 -1
  38. package/dist/render/components/Text.js +1 -1
  39. package/dist/render/lib/puck/blocks/general/Cards/render.d.ts +1 -0
  40. package/dist/render/lib/puck/blocks/general/Cards/render.js +1 -1
  41. package/dist/render/lib/puck/blocks/general/KeyFeatures/render.d.ts +2 -0
  42. package/dist/render/lib/puck/blocks/general/KeyFeatures/render.js +1 -1
  43. package/dist/render/lib/puck/blocks/general/Text/render.js +1 -1
  44. package/dist/render/lib/puck/blocks/general/Timeline/render.d.ts +2 -0
  45. package/dist/render/lib/puck/blocks/general/Timeline/render.js +2 -2
  46. package/dist/render/lib/puck/blocks/general/TimelineTrack/render.d.ts +2 -0
  47. package/dist/render/lib/puck/blocks/general/TimelineTrack/render.js +1 -1
  48. package/dist/render/lib/puck/part-styles.d.ts +13 -3
  49. package/dist/render/lib/puck/part-styles.js +2 -2
  50. package/dist/render/lib/puck/passes/index.js +1 -1
  51. package/dist/render/lib/puck/text-parts.d.ts +1 -0
  52. package/dist/render/lib/puck/text-parts.js +1 -1
  53. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -2,6 +2,62 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 36.0.0 - 2026-10-22
6
+
7
+ **MAJOR for hosts:** the efficient-easel peer range is `^18.0.0` (was `^17.0.0`) and the efficient-shell peer range `^8.20.0` (was `^8.18.0`); dev the same. easel 18 needs shell 8.20.0 (`TreeRow` `tone`, the `shared` glyph). A host moves both pins with this release; nothing else to change.
8
+
9
+ ### Changed
10
+
11
+ - **The header and footer are drawn as SHARED nodes** (Shared section design v4, approved by Lewis 2026-10-21; card [DESIGN] Shared Sections Used By Many Pages, PR 5a of the build plan). On a page that edits them in place, the website hands the screen `sharedReach` (`lib/puck/every-page` `pinnedReach`): "On every page", and "On every page · old style" on the old Header and the old Footer. The screen (efficient-easel 18) draws their Layers rows green with the shared mark at the end and "On every page" in its Tooltip, in place of the "Every page" badge; their canvas tab is the green badge with the mark and the row's name, "On every page" in its Tooltip, in place of "Header · on every page"; and their outline is green.
12
+ - `groupTab` is now `noOwnTab` (no words: it only takes a header or footer group out of the canvas's click chain), and `groupBadge` only switches the in-place tree (its word is never drawn).
13
+ - Words: "On every page" and "On every page · old style" are new; "Every page" and the four "Header / Footer · on every page" tab phrases are gone.
14
+
15
+ ### Guards
16
+
17
+ - `scripts/test-every-page-words.ts` (red first): how far each pinned node reaches, the catalogue holds the new words and not the old ones, and the website hands `sharedReach` and the two switches on an in-place page only.
18
+ - `test-two-ways-to-add`: the easel range is ^18.0.0. `test-shell-peer-range`: the shell range is ^8.20.0, and why.
19
+
20
+ ## 35.0.0 - 2026-10-22
21
+
22
+ ### Added
23
+
24
+ - **A picture can name its file, and every block still draws its URL** (card [DESIGN] Upgrade The Media Library, step E1, the READER half; image-storage plan A step 6). A MINOR: no saved value changes and no field writes the new shape yet.
25
+ - `lib/media-value` (format side): `MediaValue` (a URL, or `{ src, assetId?, designImageId? }`), `isMediaValueObject`, `mediaValueSrc` (the one reader) and `mapAtMediaPath` (one walker over the media manifest's paths).
26
+ - The `mediaValues` pass (`lib/puck/passes/media-values`), draw half only and first in the order: a block's render is handed every value at its media paths (`lib/puck/media-manifest.json`) as its `src`. Every block, a host's included, keeps reading a URL.
27
+ - The template canvas blanks a picture that names its file to `""`, as it blanks a URL (`lib/puck/templateFields`, now on `mapAtMediaPath`).
28
+ - The picture row (`components/MediaUploadField`, used by `upload()` and the Locations photo) takes a `MediaValue` and shows its `src`. `upload()` is a `CustomField<MediaValue>`.
29
+ - **Story Timeline: a fourth Display, "Track (year rail)"** (Lewis 2026-10-09/10, decisions ND; card [MERGE] One Text Block And Click Through Parts). Under Track the section draws the Milestone Timeline's own component (`components/TimelineTrack`), so for the same words it draws the same bytes: the band colour (`Background color`, the rail's built-in, Design group, Track only), the padding, the CTA and each entry's `Upcoming` switch (on each entry under Track only, added by the section's new `resolveFields`). An entry's `Body` is the rail's blurb. Track hides the picture rows (`imageSrc`, `imageCaption`, `imageMeta`); a hidden row keeps its value.
30
+ - **Cards: a "Card style" row, Cards or "Label only"** (Lewis 2026-10-10, section-merges group 4; card [MERGE] One Text Block And Click Through Parts). Label only draws Key Features' own component (`components/KeyFeatures`), so for the same words it draws the same bytes: the pill eyebrow when no look is stored, the columns, each cell's link. A cell's words are the card's `title` (row "Feature label"), its link the card's `href` (row "Link"); both rows, and Key Features' eyebrow default, come from the section's `resolveFields` under Label only.
31
+ - **A text follows ONE site text style, all of it** (card [MERGE] One Text Block And Click Through Parts, T2a2; Lewis 2026-10-02/06 one style list; GG 2026-10-22). The part's Style row lists the site's own Heading 1-7 and Body 1-7 (Heading 1-3 and Body 1-5 by default), named as Site styles names them, and "No style". Accent is not a style.
32
+ - A part stores its choice as `textStyle` (a style id; `lib/puck/part-styles` `isTextStyleId`, `followedStyleOf`). It and the old `role` exclude each other; an old `role` is READ as its style id (`STYLE_ID_OF_ROLE`: Heading → Heading 1, Labels → Body 5), and an old Accent as no style. No stored value is rewritten.
33
+ - **A Text block at Heading 1-3 draws the old Heading block at that level**, class for class (`components/Heading` `headingLook`, one source for both), in the style's own face class (`font-heading2` for Heading 2: the same face until a site sets one). Heading 4-7 take the level 4-6 look. The tag stays the HTML tag row's.
34
+ - A Text block at Body 1-7 adds the style's face class; Body 5 draws the label face and size (the old Labels). A Text block with no style, or with an old `role`, draws the bytes it drew before.
35
+ - Every other part follows the same choice through the old role tokens it drew (Heading 1-3, Body 1, Body 5), and carries `data-sf-text-style` (`TEXT_STYLE_ATTR`) on the canvas and on the published page.
36
+ - Site styles reach a text that follows the style: each rule of `textStylesCss` names the face class AND `[data-sf-text-style="<id>"]`. A site that set nothing writes nothing.
37
+ - The website's list is built from easel's ONE list (`efficient-easel/text-styles` `defaultTextStyles`), not a second copy. `faceClassOf` moved to the render-safe `lib/text-style-face` (still exported from `lib/site-text-styles`).
38
+
39
+ ### Changed
40
+
41
+ - **BREAKING: the efficient-easel peer range is `^17.0.0`** (was `^16.1.0`; dev the same). easel 17 removes the footer focus's seams, so `StandaloneSectionEditor` no longer hands `footerOriginSlug` (easel#314). A host moves to easel 17 with this release.
42
+ - **The website's parts join the canvas's ONE click chain** (click-through W0, plan 2026-10-12; card [MERGE] One Text Block And Click Through Parts). `PreviewPartAnchors` and `SectionTextPartBridge` no longer catch a click in the capture phase and stop it. The new `components/CanvasPartsBridge` (mounted inside `PreviewPartsProvider` by both editors) hands the canvas easel 17's `CanvasPartsContext`: which part of the INNERMOST block is under the pointer (`partOfBlockAt`: a field part or a section's text region, the owner checked), the open part, and a select that opens a part or goes back to its block. So:
43
+ - a section WITH slots: the first click picks the section, the next its heading (before: the heading at once, whatever was selected);
44
+ - a block with no lists (a Text block, a slotless section): picked with its words at once, as before (GG 2026-10-22, answer B);
45
+ - Escape leaves a part and keeps its block (before: stuck on the part);
46
+ - an outer section never claims an inner block's words (the old listener had no owner check).
47
+ - `lib/puck/part-anchors`: `partOfBlockAt` replaces `partIdForClick` and `isPartClick` (their one caller is gone). `lib/puck/text-parts`: `REGION_PART_ATTR`, the part id a text region carries for the canvas.
48
+ - Stale words fixed: the picture row asks the editor's media panel, not an admin "media-picker window"; `upload()` lost its orphaned first doc comment and the note about easel's deleted `ImageBox`.
49
+ - **The Milestone Timeline (`TimelineTrack`) leaves the Add menu** (`RETIRED_SECTIONS`, with what replaces it and what a NEW rail loses: the head in its own box, one text kind for year and title, the rail's Width family). The type key and the component stay: every page holding one draws and edits it as before, and no document is rewritten. `timelineTrackScaffoldEntries` is exported (the Story Timeline's scaffold under Track).
50
+ - **Key Features leaves the Add menu** (`RETIRED_SECTIONS`, with what replaces it). The type key and the component stay: every page holding one draws and edits it as before, and no document is rewritten. `keyFeaturesScaffoldItems` is exported (the Cards scaffold under Label only).
51
+
52
+ ### Guards
53
+
54
+ - `scripts/test-parts-join-the-click-chain.tsx` (red first): neither wrapper listens for or stops a click; `partOfBlockAt` and its owner check; the bridge's three answers; both editors mount it.
55
+ - `test-publish-main-action`, `test-two-ways-to-add`: the easel range is ^17.
56
+ - New `scripts/test-media-values.tsx` (red first: ImageBlock drew differently when its picture named its file).
57
+ - `scripts/test-timeline-track-display.tsx` (red first): the Display options; Track draws the Milestone Timeline's bytes (4 cases); the three old displays and an old Milestone Timeline draw what they drew on main d44ea73 (`scripts/fixtures/timeline-bytes.json`); the panel under Track and Split; retired from the Add menu, still registered.
58
+ - `scripts/test-cards-label-only.tsx` (red first): the Card style options; Label only draws the Key Features bytes (4 cases); Cards and an old Key Features draw what they drew on main d44ea73 (`scripts/fixtures/cards-key-features-bytes.json`); the panel under each style; retired from the Add menu, still registered.
59
+ - New `scripts/test-text-follows-one-style.tsx` (red first): one list; the stored choice; Heading 1-3 on a Text block = the old Heading block; Body 1 / Body 5 / no style; every other part; Site styles reach it. `test-site-text-styles-paint`, `test-part-follows-style` and `test-part-update-style` read the new rule shape and the Style row's ids.
60
+
5
61
  ## 34.0.0 - 2026-10-22
6
62
 
7
63
  ### Changed
@@ -0,0 +1,4 @@
1
+ import { type ReactNode } from "react";
2
+ export declare function CanvasPartsBridge({ children }: {
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as a}from"react/jsx-runtime";import{useMemo as i,useRef as u}from"react";import{CanvasPartsContext as m}from"efficient-easel/easel";import{usePreviewParts as d}from"efficient-easel/draw/client";import{partOfBlockAt as l}from"../lib/puck/part-anchors.js";import{decodePartId as f,encodePartId as p}from"../../render/lib/puck/text-parts.js";function w({children:s}){const{selectedPartId:t,select:e}=d(),r=u(t);r.current=t;const c=i(()=>({partAt:l,selected:()=>r.current,select:o=>{if(o){e(o);return}const n=r.current?f(r.current)?.nodeId:null;n&&e(p(n,null))}}),[e]);return a(m.Provider,{value:c,children:s})}export{w as CanvasPartsBridge};
@@ -1,5 +1,6 @@
1
+ import { type MediaValue } from "../../format/lib/media-value.js";
1
2
  interface Props {
2
- value: string;
3
+ value: MediaValue;
3
4
  onChange: (v: string) => void;
4
5
  label: string;
5
6
  accept: string;
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as x,SettingsField as v}from"efficient-easel/panel";import{useSelectedFields as F}from"efficient-easel/easel";import{FOCAL_DEFAULT as b}from"efficient-shell/format";import{ImageIcon as g,PlayIcon as w}from"efficient-easel/icons";import{MediaUploadField as C}from"efficient-shell/ui";import{useContext as y}from"react";import{ScreenDocumentContext as D}from"efficient-easel/screen/components/ScreenDocumentContext";import{editorEaselWords as P,say as l}from"../../format/lib/editor-words.js";import{PHONE_CLEAR as U,phoneKey as I}from"../../format/lib/puck/phone-override.js";import{usePreviewDevice as M}from"efficient-easel/draw/client";import{requestMediaPick as A}from"efficient-easel/screen/lib/media-picker";import{useEaselHost as B}from"efficient-easel/screen/lib/host";import{backendOf as H}from"../lib/website-session.js";import{useEaselSession as L}from"efficient-easel/screen/lib/session-context";function O(o,d){let e=null;try{e=F()}catch{e=null}const n=M()==="mobile";if(!o||!e||d&&!d(e.values??{}))return null;const a=typeof e.values?.[o]=="string"&&e.values[o]?String(e.values[o]):b,i=I(o),c=typeof e.values?.[i]=="string"&&e.values[i]?String(e.values[i]):void 0,m=e.onChange;return{phone:n,desktop:a,own:c,focus:n?c??a:a,set:u=>m(n?i:o,u),clear:()=>m(i,U)}}function R({value:o,onChange:d,label:e,accept:n,placeholder:a,focusKey:i,focusWhen:c}){const m=B(),u=L(),p=l(e),r=n.startsWith("video"),s=O(r?void 0:i,c),f=y(D),E=h=>A(m,{accept:n,title:p,...h?{file:h}:{}}).then(k=>k?.url??null);if(f&&!f.capabilities.mediaEditing)return t(v,{label:p,icon:r?t(w,{}):t(g,{}),children:t("div",{className:"sf-image-slot-inert",children:r?l("Templates don’t store videos — this slot stays a placeholder. Each website picks its own after it’s created."):l("Templates don’t store images — this slot stays a placeholder. Each website picks its own after it’s created.")})});const S=s?.phone&&o?t(x,{words:P()?.panel,label:l("Image focus"),changed:!!s.own,detail:l("{value} on desktop",{value:s.desktop}),onReset:s.clear}):void 0;return t(v,{label:p,icon:r?t(w,{}):t(g,{}),action:S,children:t("div",{style:{flex:"1 1 auto",minWidth:0},children:t(C,{value:o,onChange:d,onPick:E,accept:r?"video/*":"image/*",kind:r?"video":"image",placeholder:a===void 0?void 0:l(a),maxSizeBytes:H(u).media.maxUploadBytes,...s?{focus:s.focus,onFocusChange:s.set}:{}})})})}export{R as default};
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as F,SettingsField as g}from"efficient-easel/panel";import{useSelectedFields as b}from"efficient-easel/easel";import{FOCAL_DEFAULT as C}from"efficient-shell/format";import{ImageIcon as w,PlayIcon as S}from"efficient-easel/icons";import{MediaUploadField as y}from"efficient-shell/ui";import{useContext as D}from"react";import{ScreenDocumentContext as P}from"efficient-easel/screen/components/ScreenDocumentContext";import{editorEaselWords as U,say as l}from"../../format/lib/editor-words.js";import{PHONE_CLEAR as I,phoneKey as M}from"../../format/lib/puck/phone-override.js";import{usePreviewDevice as A}from"efficient-easel/draw/client";import{requestMediaPick as B}from"efficient-easel/screen/lib/media-picker";import{useEaselHost as H}from"efficient-easel/screen/lib/host";import{mediaValueSrc as L}from"../../format/lib/media-value.js";import{backendOf as O}from"../lib/website-session.js";import{useEaselSession as R}from"efficient-easel/screen/lib/session-context";function T(o,d){let e=null;try{e=b()}catch{e=null}const n=A()==="mobile";if(!o||!e||d&&!d(e.values??{}))return null;const a=typeof e.values?.[o]=="string"&&e.values[o]?String(e.values[o]):C,i=M(o),c=typeof e.values?.[i]=="string"&&e.values[i]?String(e.values[i]):void 0,m=e.onChange;return{phone:n,desktop:a,own:c,focus:n?c??a:a,set:u=>m(n?i:o,u),clear:()=>m(i,I)}}function V({value:o,onChange:d,label:e,accept:n,placeholder:a,focusKey:i,focusWhen:c}){const m=H(),u=R(),p=l(e),r=n.startsWith("video"),s=T(r?void 0:i,c),f=D(P),E=v=>B(m,{accept:n,title:p,...v?{file:v}:{}}).then(x=>x?.url??null);if(f&&!f.capabilities.mediaEditing)return t(g,{label:p,icon:r?t(S,{}):t(w,{}),children:t("div",{className:"sf-image-slot-inert",children:r?l("Templates don’t store videos — this slot stays a placeholder. Each website picks its own after it’s created."):l("Templates don’t store images — this slot stays a placeholder. Each website picks its own after it’s created.")})});const h=L(o),k=s?.phone&&h?t(F,{words:U()?.panel,label:l("Image focus"),changed:!!s.own,detail:l("{value} on desktop",{value:s.desktop}),onReset:s.clear}):void 0;return t(g,{label:p,icon:r?t(S,{}):t(w,{}),action:k,children:t("div",{style:{flex:"1 1 auto",minWidth:0},children:t(y,{value:h,onChange:d,onPick:E,accept:r?"video/*":"image/*",kind:r?"video":"image",placeholder:a===void 0?void 0:l(a),maxSizeBytes:O(u).media.maxUploadBytes,...s?{focus:s.focus,onFocusChange:s.set}:{}})})})}export{V as default};
@@ -1 +1 @@
1
- "use client";import{jsx as t,Fragment as te,jsxs as h}from"react/jsx-runtime";import{useContext as Ye,useEffect as ne,useRef as qe,useState as Ne}from"react";import{PartResetDot as Je}from"./PartResetDot.js";import{FieldSelect as Qe,InspectorField as Ze}from"efficient-easel/fields";import{SettingsField as et}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as tt,TypeIcon as nt}from"efficient-easel/icons";import{useEasel as ot}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as lt}from"efficient-shell/ui";import{PartTextBox as rt,partTextCells as it}from"./PartTextBox.js";import{UiIcon as ke}from"efficient-easel/draw/client";import{usePreviewHeader as at}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as ct}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as dt}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as ut,partStyleToTextStyleValues as ft,pushIntoStyle as pt,resolveTextStyles as mt,styleIdOfRole as Ce}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as ht}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as yt}from"../lib/theme-row-persist.js";import{usePreviewDevice as gt}from"efficient-easel/draw/client";import{usePartStyle as St}from"./PreviewPartStyleContext.js";import{say as s}from"../../format/lib/editor-words.js";import{readHidable as U,textFieldOffPage as bt,textFieldPanelOnly as xt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as Pt}from"efficient-easel/draw";import{useSectionOps as wt}from"efficient-easel/screen/lib/puck/use-section-ops";import{FONT_OPTIONS as Tt,FONT_ROLES as oe,FONT_ROLE_LABELS as se,fontOption as le}from"../../format/lib/fonts.js";import{isMultilineKind as vt,partPlaceholder as Nt,typeInPlaceKind as kt}from"../../render/lib/puck/part-text.js";import{partRowField as Ct}from"../lib/puck/part-row-field.js";import{decodePartKey as Ot,partPropsWithRowValue as Rt,partRowValue as It}from"../../render/lib/puck/part-rows.js";import{PART_WIDTH_MAX as Et,propsWithPartStyleValue as B,propsWithoutPartStyle as Ft,readPartStyle as Oe}from"../../render/lib/puck/part-styles.js";import{partThemeColors as _t}from"../../format/lib/puck/part-inks.js";import{styleKeyForPart as zt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as At}from"../lib/puck/part-typing.js";import{keysOnCanvas as Vt,useCanvasTypingPart as Lt}from"../lib/puck/canvas-typing.js";import{useEaselHost as Kt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as Ut,SOURCE_ACTIONS as Bt,SOURCE_ACTION_LABEL as Dt,partSourceNoteFor as Wt,partSourceOf as Mt,sourceMenuIdOf as jt,sourceSlugOf as Re}from"../../format/lib/puck/source-bound-parts.js";import{encodePartId as Gt,holdsAuthoredText as Ht}from"../../render/lib/puck/text-parts.js";import{regionsForSection as $t}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as Xt}from"../../format/lib/sections/text-regions.js";function re(n){return n?s(n):null}function Ie(n){return n.kind==="role"?se[n.role]:n.kind==="custom"?"Custom":null}function Yt(n){const o=n.role;return o&&oe.includes(o)?{kind:"role",role:o}:null}function qt(n,o){if(!n)return{kind:"unread"};const{faceRole:l,base:a}=n;if(o[l]===a.fontKey)return{kind:"role",role:l};const i=Object.keys(o).filter(r=>o[r]===a.fontKey);return i.length===1?{kind:"role",role:i[0]}:{kind:"custom"}}function ie(n,o,l,a){return Yt(Oe(n,o))??qt(l,a)}function Jt(n,o){if(!n.length)return null;const l=o(n[0]);return n.every(a=>o(a)===l)?l:null}const D="";function Qt({face:n,base:o,onPick:l}){const a=n.kind==="role"?n.role:D,i=[{label:s("No style"),value:D},...oe.map(r=>({label:s(se[r]),value:r}))];return t(Qe,{ariaLabel:s("Style"),value:a,options:i,inline:!0,onChange:r=>l(r===D?null:r),renderOption:r=>r.value===D?h(te,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:s("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:re(Ie(n))}),valueText:r=>re(Ie(n))??r?.label??""})}function Zt({sectionName:n,onBack:o,textEditor:l,styleRow:a,children:i}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:s(n),onSelect:o}),l,a,i]})}function Ee({source:n,slug:o,menuId:l}){const a=Kt(),i=Bt[n],r=!i.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[s(Ut[n]),r?h(te,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{i.type==="storefront-editor:open-menus"?a.send(i.type,{menuId:l??null}):o&&a.send(i.type,{slug:o})},children:s(Dt)})]}):null]})})}const Fe=4,en=120;function tn({region:n,sizePx:o,face:l,base:a,onFollowStyle:i,source:r,slug:W,onBack:P}){const E=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s(n.label)})}),t("p",{children:o?s("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:s(E),px:Math.round(o)}):s("Its size follows Site styles ▸ {follows}.",{follows:s(E)})}),i?t(te,{children:t(et,{label:s("Style"),icon:t(tt,{}),hint:s("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:s(n.label).toLowerCase()}),children:t(Qt,{face:l,base:a,onPick:i})})}):t("p",{className:"es-field-hint sf-hint-keep",children:s("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(Ee,{source:r,slug:W}):null,t(K,{inline:!0,name:s("Page"),onSelect:P})]})}function nn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part is no longer here.")})}),t("p",{children:s("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function on({onBack:n,partId:o,why:l}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part's settings did not open.")})}),t("p",{children:s("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",l]})}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function sn({nodeId:n,propKey:o,onBack:l,onEditStyle:a}){const{getItemById:i,getSelectorForId:r,config:W}=ot(e=>e),P=wt(),E=Lt(),{partStyle:F}=St(),{fonts:_,textStyles:_e}=at(),M=Ye(dt),ae=!M?.capabilities?.hasSiteTheme,{persist:ze}=yt({themeFromDocument:ae,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),O=ht({themeFromDocument:ae,persist:ze}),[Ae,j]=Ne(!1),Ve=gt()==="mobile",ce=qe(null),d=i(n),m=r(n),de=d?W.components[d.type]:void 0,{key:g,row:S}=Ot(o),ue=de?.fields?.[g],y=S?Ct(ue,S):ue,w=Gt(n,o),p=d?.props??{},b=kt(y),fe=bt(y),pe=Ht(y),Le=d?Mt(d.type):null,me=d?Wt(d.type,g):null,G=S?It(p[g],S):p[g],he=!!S&&!(Array.isArray(p[g])&&S.index<p[g].length);ne(()=>{if(Vt(document))return;ce.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[w]);const[H,ye]=Ne(0);ne(()=>ye(0),[w]);const $=!!d&&!he&&(!m||!y);ne(()=>{if(!$||H>=Fe)return;const e=setTimeout(()=>ye(c=>c+1),en);return()=>clearTimeout(e)},[$,H]);const Ke=$&&H<Fe;if(!d||he)return t(nn,{onBack:l});const z=$t(d.type),ge=z?Xt(z,o):null;if(z&&ge){const e=F?.partId===w?F:null,c=z[ge],f=c.writable===!0&&!!m,I=ee=>{m&&P.replaceComponent(m.zone,m.index,{...d,props:B(p,o,"role",ee)})};return t(tn,{region:c,sizePx:e?.base.sizePx??null,face:ie(p,o,e,_),base:e?.base??null,onFollowStyle:f?I:void 0,source:Le,slug:Re(p),onBack:l})}if(!m||!y)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(on,{onBack:l,partId:w,why:m?"no field":"no selector"});const Se=e=>{P.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!b){const f=S?Rt(p,g,S,e):{...p,[g]:e};f&&Se(f);return}At({node:d,propKey:o,kind:b,zone:m.zone,index:m.index},U(e).text,P.replaceComponent)},Ue=G,T=F?.partId===w?F:null,v=T?.styleOwner,A=v?i(v.owner):null,Y=v&&A?r(v.owner):null,q=!!(v&&A&&Y),N=q?A.props??{}:p,J=q?e=>P.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?v.kind:zt(d?.type,o),k=Oe(N,V),u=[{partKey:V,face:ie(N,V,T,_),sizeGroup:T?.sizeGroup??null,base:T?.base??rn,style:k}],Be=Jt(u,e=>e.sizeGroup),De=_t(T?.inks),R=(e,c)=>{let f=N;for(const I of u)f=B(f,I.partKey,e,c);J(f)},We=e=>R("role",e),be=e=>{let c=N;for(const f of u)for(const[I,ee]of Object.entries(e))c=B(c,f.partKey,I,ee??null);J(c)},Q=b==="text"||b==="textarea",{text:xe,hidden:C}=U(G),L=y?.[Pt]?.label??o,Pe=C?s("Show {label} on the slide",{label:s(L)}):s("Hide {label} on the slide",{label:s(L)}),we=h("div",{className:"sf-field-head",children:[t(nt,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:s(L)}),Q&&t(lt,{content:Pe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":C,"aria-label":Pe,onClick:()=>X({text:xe,hidden:!C}),children:C?t(ke,{name:"eye-off",size:14}):t(ke,{name:"eye",size:14})})})]}),Te=!fe&&pe,Me=!!b&&(xt(y)||fe||C||!pe),ve=ie(N,V,T,_),Z=ve.kind==="role"?ve.role:null,je=Object.entries(k).filter(([e,c])=>e!=="role"&&c!==void 0).length,Ge=()=>{let e=N;for(const c of u){const f=c.style.role;e=Ft(e,c.partKey),f&&(e=B(e,c.partKey,"role",f))}J(e)},x=Ce(Z),He=ut(u[0].style),$e=x?mt(O.saved,O.old).find(e=>e.id===x)?.name??x:"",Xe=()=>{j(!1),x&&(O.write(pt({saved:O.saved,old:O.old,styleId:x,values:ft(u[0].style)}),!0),Ge())};return h(Zt,{sectionName:de?.label??d.type,onBack:l,textEditor:t("div",{ref:ce,className:"sf-part-text",children:Me?t(rt,{text:xe,onTextChange:e=>X(Q?{text:e,hidden:C}:e),multiline:vt(b),markup:b!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:be,colors:De,placeholder:re(Nt(y))??void 0,ariaLabel:s(L),head:we,typedOnCanvas:E===w}):b?Q?we:null:t(Ze,{field:y,name:o,value:Ue,onChange:X,id:`sf-part-${n}-${o}`})}),children:[me&&t(Ee,{source:me,slug:Re(p),menuId:jt(p)}),Te&&t(st,{style:{value:Z??"",options:[{value:"",label:s("No style"),description:s("Section’s own")},...oe.map(e=>({value:e,label:s(se[e]),description:le(_[e])?.label}))],onChange:e=>We(e||null),changed:je>0,onEditStyles:a,onUpdateStyle:x&&He?()=>j(!0):void 0},font:{value:k.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Tt.map(e=>({label:e.label,value:e.key})),onChange:e=>R("font",e||null)},italic:{value:k.italic,styleValue:ln(_e,Z),onChange:e=>R("italic",e??null)},cells:it(u[0].style,u[0].base,be,{phone:Ve}),align:{value:k.align??"",styleValue:u[0].base.align,onChange:e=>R("align",e||null)},letterCase:{value:k.case??"",styleValue:u[0].base.case,onChange:e=>R("case",e||null)}}),Ae&&x&&t(ct,{styleName:$e,onCancel:()=>j(!1),onConfirm:Xe}),Te&&Be===null&&t("p",{className:"es-field-hint sf-hint-keep",children:s("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function ln(n,o){const l=Ce(o);return!l||!Array.isArray(n)?!1:n.find(i=>i?.id===l)?.values?.italic===!0}const rn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:Et};export{Zt as PartPanelBody,Je as PartResetDot,Ee as PartSourceNote,Qt as PartStyleSelect,sn as default,ie as partFace};
1
+ "use client";import{jsx as t,Fragment as ne,jsxs as h}from"react/jsx-runtime";import{useContext as qe,useEffect as oe,useRef as Je,useState as Te}from"react";import{PartResetDot as Qe}from"./PartResetDot.js";import{FieldSelect as Ze,InspectorField as et}from"efficient-easel/fields";import{SettingsField as tt}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as nt,TypeIcon as ot}from"efficient-easel/icons";import{useEasel as lt}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as rt}from"efficient-shell/ui";import{PartTextBox as it,partTextCells as at}from"./PartTextBox.js";import{UiIcon as Ne}from"efficient-easel/draw/client";import{usePreviewHeader as ct}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as dt}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as ut}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as ft,partStyleToTextStyleValues as pt,pushIntoStyle as mt,resolveTextStyles as ht,styleIdOfRole as yt}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as St}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as gt}from"../lib/theme-row-persist.js";import{usePreviewDevice as xt}from"efficient-easel/draw/client";import{usePartStyle as bt}from"./PreviewPartStyleContext.js";import{say as l}from"../../format/lib/editor-words.js";import{readHidable as U,textFieldOffPage as Pt,textFieldPanelOnly as wt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as vt}from"efficient-easel/draw";import{useSectionOps as Tt}from"efficient-easel/screen/lib/puck/use-section-ops";import{FONT_OPTIONS as Nt,FONT_ROLES as Ce,FONT_ROLE_LABELS as ke,fontOption as le}from"../../format/lib/fonts.js";import{isMultilineKind as Ct,partPlaceholder as kt,typeInPlaceKind as Ot}from"../../render/lib/puck/part-text.js";import{partRowField as Rt}from"../lib/puck/part-row-field.js";import{decodePartKey as It,partPropsWithRowValue as Et,partRowValue as Ft}from"../../render/lib/puck/part-rows.js";import{PART_WIDTH_MAX as _t,followedStyleOf as zt,propsWithPartStyleValue as E,propsWithoutPartStyle as At,readPartStyle as Oe}from"../../render/lib/puck/part-styles.js";import{partThemeColors as Vt}from"../../format/lib/puck/part-inks.js";import{styleKeyForPart as Lt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as Kt}from"../lib/puck/part-typing.js";import{keysOnCanvas as Ut,useCanvasTypingPart as Bt}from"../lib/puck/canvas-typing.js";import{useEaselHost as Dt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as Wt,SOURCE_ACTIONS as Mt,SOURCE_ACTION_LABEL as jt,partSourceNoteFor as Gt,partSourceOf as Ht,sourceMenuIdOf as $t,sourceSlugOf as Re}from"../../format/lib/puck/source-bound-parts.js";import{encodePartId as Xt,holdsAuthoredText as Yt}from"../../render/lib/puck/text-parts.js";import{regionsForSection as qt}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as Jt}from"../../format/lib/sections/text-regions.js";function se(n){return n?l(n):null}function Ie(n){return n.kind==="role"?ke[n.role]:n.kind==="custom"?"Custom":null}function Qt(n){const o=n.role;return o&&Ce.includes(o)?{kind:"role",role:o}:null}function Zt(n,o){if(!n)return{kind:"unread"};const{faceRole:s,base:i}=n;if(o[s]===i.fontKey)return{kind:"role",role:s};const c=Object.keys(o).filter(r=>o[r]===i.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function re(n,o,s,i){return Qt(Oe(n,o))??Zt(s,i)}function en(n,o){if(!n.length)return null;const s=o(n[0]);return n.every(i=>o(i)===s)?s:null}const B="";function tn({face:n,base:o,onPick:s}){const i=n.kind==="role"?n.role:B,c=[{label:l("No style"),value:B},...Ce.map(r=>({label:l(ke[r]),value:r}))];return t(Ze,{ariaLabel:l("Style"),value:i,options:c,inline:!0,onChange:r=>s(r===B?null:r),renderOption:r=>r.value===B?h(ne,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:se(Ie(n))}),valueText:r=>se(Ie(n))??r?.label??""})}function nn({sectionName:n,onBack:o,textEditor:s,styleRow:i,children:c}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:l(n),onSelect:o}),s,i,c]})}function Ee({source:n,slug:o,menuId:s}){const i=Dt(),c=Mt[n],r=!c.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[l(Wt[n]),r?h(ne,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{c.type==="storefront-editor:open-menus"?i.send(c.type,{menuId:s??null}):o&&i.send(c.type,{slug:o})},children:l(jt)})]}):null]})})}const Fe=4,on=120;function ln({region:n,sizePx:o,face:s,base:i,onFollowStyle:c,source:r,slug:D,onBack:v}){const F=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l(n.label)})}),t("p",{children:o?l("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:l(F),px:Math.round(o)}):l("Its size follows Site styles ▸ {follows}.",{follows:l(F)})}),c?t(ne,{children:t(tt,{label:l("Style"),icon:t(nt,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(n.label).toLowerCase()}),children:t(tn,{face:s,base:i,onPick:c})})}):t("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(Ee,{source:r,slug:D}):null,t(K,{inline:!0,name:l("Page"),onSelect:v})]})}function sn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part is no longer here.")})}),t("p",{children:l("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:l("Page"),onSelect:n})]})}function rn({onBack:n,partId:o,why:s}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part's settings did not open.")})}),t("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",s]})}),t(K,{inline:!0,name:l("Page"),onSelect:n})]})}function an({nodeId:n,propKey:o,onBack:s,onEditStyle:i}){const{getItemById:c,getSelectorForId:r,config:D}=lt(e=>e),v=Tt(),F=Bt(),{partStyle:_}=bt(),{fonts:W,textStyles:_e}=ct(),M=qe(ut),ie=!M?.capabilities?.hasSiteTheme,{persist:ze}=gt({themeFromDocument:ie,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),R=St({themeFromDocument:ie,persist:ze}),[Ae,j]=Te(!1),Ve=xt()==="mobile",ae=Je(null),d=c(n),m=r(n),ce=d?D.components[d.type]:void 0,{key:S,row:g}=It(o),de=ce?.fields?.[S],y=g?Rt(de,g):de,T=Xt(n,o),p=d?.props??{},x=Ot(y),ue=Pt(y),fe=Yt(y),Le=d?Ht(d.type):null,pe=d?Gt(d.type,S):null,G=g?Ft(p[S],g):p[S],me=!!g&&!(Array.isArray(p[S])&&g.index<p[S].length);oe(()=>{if(Ut(document))return;ae.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[T]);const[H,he]=Te(0);oe(()=>he(0),[T]);const $=!!d&&!me&&(!m||!y);oe(()=>{if(!$||H>=Fe)return;const e=setTimeout(()=>he(a=>a+1),on);return()=>clearTimeout(e)},[$,H]);const Ke=$&&H<Fe;if(!d||me)return t(sn,{onBack:s});const z=qt(d.type),ye=z?Jt(z,o):null;if(z&&ye){const e=_?.partId===T?_:null,a=z[ye],f=a.writable===!0&&!!m,b=te=>{m&&v.replaceComponent(m.zone,m.index,{...d,props:E(p,o,"role",te)})};return t(ln,{region:a,sizePx:e?.base.sizePx??null,face:re(p,o,e,W),base:e?.base??null,onFollowStyle:f?b:void 0,source:Le,slug:Re(p),onBack:s})}if(!m||!y)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(rn,{onBack:s,partId:T,why:m?"no field":"no selector"});const Se=e=>{v.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!x){const f=g?Et(p,S,g,e):{...p,[S]:e};f&&Se(f);return}Kt({node:d,propKey:o,kind:x,zone:m.zone,index:m.index},U(e).text,v.replaceComponent)},Ue=G,N=_?.partId===T?_:null,C=N?.styleOwner,A=C?c(C.owner):null,Y=C&&A?r(C.owner):null,q=!!(C&&A&&Y),k=q?A.props??{}:p,J=q?e=>v.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?C.kind:Lt(d?.type,o),P=Oe(k,V),u=[{partKey:V,face:re(k,V,N,W),sizeGroup:N?.sizeGroup??null,base:N?.base??dn,style:P}],Be=en(u,e=>e.sizeGroup),De=Vt(N?.inks),I=(e,a)=>{let f=k;for(const b of u)f=E(f,b.partKey,e,a);J(f)},We=e=>e?I("textStyle",e):Q({textStyle:null,role:null}),Q=e=>{let a=k;for(const f of u)for(const[b,te]of Object.entries(e))a=E(a,f.partKey,b,te??null);J(a)},Z=x==="text"||x==="textarea",{text:ge,hidden:O}=U(G),L=y?.[vt]?.label??o,xe=O?l("Show {label} on the slide",{label:l(L)}):l("Hide {label} on the slide",{label:l(L)}),be=h("div",{className:"sf-field-head",children:[t(ot,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:l(L)}),Z&&t(rt,{content:xe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":O,"aria-label":xe,onClick:()=>X({text:ge,hidden:!O}),children:O?t(Ne,{name:"eye-off",size:14}):t(Ne,{name:"eye",size:14})})})]}),Pe=!ue&&fe,Me=!!x&&(wt(y)||ue||O||!fe),we=re(k,V,N,W),je=we.kind==="role"?we.role:null,ee=zt(P)??yt(je),ve=ht(R.saved,R.old),Ge=Object.entries(P).filter(([e,a])=>e!=="role"&&e!=="textStyle"&&a!==void 0).length,He=()=>{let e=k;for(const a of u){const{role:f,textStyle:b}=a.style;e=At(e,a.partKey),f&&(e=E(e,a.partKey,"role",f)),b&&(e=E(e,a.partKey,"textStyle",b))}J(e)},w=ee,$e=ft(u[0].style),Xe=w?ve.find(e=>e.id===w)?.name??w:"",Ye=()=>{j(!1),w&&(R.write(mt({saved:R.saved,old:R.old,styleId:w,values:pt(u[0].style)}),!0),He())};return h(nn,{sectionName:ce?.label??d.type,onBack:s,textEditor:t("div",{ref:ae,className:"sf-part-text",children:Me?t(it,{text:ge,onTextChange:e=>X(Z?{text:e,hidden:O}:e),multiline:Ct(x),markup:x!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:Q,colors:De,placeholder:se(kt(y))??void 0,ariaLabel:l(L),head:be,typedOnCanvas:F===T}):x?Z?be:null:t(et,{field:y,name:o,value:Ue,onChange:X,id:`sf-part-${n}-${o}`})}),children:[pe&&t(Ee,{source:pe,slug:Re(p),menuId:$t(p)}),Pe&&t(st,{style:{value:ee??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...ve.map(e=>({value:e.id,label:e.name,description:e.values.font?le(e.values.font)?.label:void 0}))],onChange:e=>We(e||null),changed:Ge>0,onEditStyles:i,onUpdateStyle:w&&$e?()=>j(!0):void 0},font:{value:P.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Nt.map(e=>({label:e.label,value:e.key})),onChange:e=>I("font",e||null)},italic:{value:P.italic,styleValue:cn(_e,ee),onChange:e=>I("italic",e??null)},cells:at(u[0].style,u[0].base,Q,{phone:Ve}),align:{value:P.align??"",styleValue:u[0].base.align,onChange:e=>I("align",e||null)},letterCase:{value:P.case??"",styleValue:u[0].base.case,onChange:e=>I("case",e||null)}}),Ae&&w&&t(dt,{styleName:Xe,onCancel:()=>j(!1),onConfirm:Ye}),Pe&&Be===null&&t("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function cn(n,o){return!o||!Array.isArray(n)?!1:n.find(i=>i?.id===o)?.values?.italic===!0}const dn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:_t};export{nn as PartPanelBody,Qe as PartResetDot,Ee as PartSourceNote,tn as PartStyleSelect,an as default,re as partFace};
@@ -1 +1 @@
1
- "use client";import{jsx as J}from"react/jsx-runtime";import{readInks as z}from"../../format/lib/puck/part-inks.js";import{useEffect as M,useRef as Y}from"react";import{markOverlayPortal as $}from"../../format/lib/puck/overlay-portal.js";import{usePreviewParts as j}from"efficient-easel/draw/client";import{usePartStyle as B}from"./PreviewPartStyleContext.js";import{usePreviewDevice as G}from"efficient-easel/draw/client";import{encodePartId as H}from"efficient-easel/draw";import{PUCK_COMPONENT_ATTR as q,engagePartAnchors as U,isPartClick as V,partIdForClick as Q}from"../lib/puck/part-anchors.js";import{PART_ATTR as _,PART_SELECTED_ATTR as w,PART_STYLE_KIND_ATTR as C,PART_STYLE_OWNER_ATTR as X,partStyleOwnerOf as x}from"../../render/lib/puck/text-parts.js";import{PART_STYLE_PROPERTIES as N,applyPartStyles as k,partFontKeyOf as Z,partStyleBase as tt,partStyleSource as et}from"../../render/lib/puck/part-styles.js";import{fontRoleOfClassName as rt,styleRoleOfClassName as ot}from"../../format/lib/fonts.js";import{typeScaleGroupOfClassName as D}from"../../format/lib/theme.js";import{styleKeyForPart as st}from"../../format/lib/sections/section-text-kinds.js";function nt(a){let n=null,l=null;for(let e=a;e&&(n===null||l===null);e=e.parentElement){const c=e.getAttribute("class");n??=ot(c),l??=D(c)}return{faceRole:n??"body",sizeGroup:l}}function L(a){const n=a.style,l={};for(const r of N)l[r]=n[r]??"",n[r]="";const e=getComputedStyle(a),c=getComputedStyle(a.ownerDocument.documentElement),p=tt({fontSize:e.fontSize,fontWeight:e.fontWeight,lineHeight:e.lineHeight,letterSpacing:e.letterSpacing,textAlign:e.textAlign,textTransform:e.textTransform,paddingTop:e.paddingTop,maxWidth:e.maxWidth},Z(e.fontFamily,r=>c.getPropertyValue(r)));for(const r of N)n[r]=l[r];return p}function it({needles:a,styles:n,type:l,children:e}){const c=Y(null),{selectedPartId:p,select:r}=j(),{setPartStyle:y}=B(),d=G()==="mobile",S=JSON.stringify(a),g=JSON.stringify(n);return M(()=>{const f=c.current;if(!f)return;const T=[],P=()=>f.parentElement,W=i=>{const o=P();if(!o)return null;const m=new MutationObserver(i);return m.observe(o,{attributes:!0,attributeFilter:[q]}),()=>m.disconnect()},I=i=>{const o=new MutationObserver(i);return o.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>o.disconnect()};let u=[];T.push(()=>{for(const i of u)i();u=[]});const K=JSON.parse(S),h=JSON.parse(g),F=U(f,K,P,W,(i,o,m)=>{for(const t of u)t();u=[];const A=[];for(const t of m){const s=t,v=$(s);v&&u.push(v),s.getAttribute(_)===p?(s.setAttribute(w,""),A.push(s)):s.removeAttribute(w)}const b=et(o,p,A,t=>rt(t)!==null||D(t)!==null);if(b&&p){const t=b;y({partId:p,...nt(t),base:L(t),inks:z(t),...(()=>{const s=x(t);return s?{styleOwner:s}:{}})()})}k(m.filter(t=>!x(t)).map(t=>({element:t,partId:t.getAttribute(_)??""})),h,t=>L(t),t=>st(l,t),void 0,d);const E=[...f.querySelectorAll(`[${X}="${CSS.escape(o)}"][${C}]`)];E.length&&k(E.map(t=>({element:t,partId:H(o,t.getAttribute(C)??"")})),h,void 0,t=>t,void 0,d);const O=t=>{const s=Q(t.target,o);V(s,o)&&(t.stopPropagation(),t.preventDefault()),r(s)},R=i;R.addEventListener("click",O,{capture:!0}),u.push(()=>R.removeEventListener("click",O,{capture:!0}))},I);return()=>{F();for(const i of T)i()}},[S,g,p,r,y,d]),J("div",{ref:c,style:{display:"contents"},children:e})}export{it as default,L as measureStyleBase,nt as styleTagsOf};
1
+ "use client";import{jsx as k}from"react/jsx-runtime";import{readInks as L}from"../../format/lib/puck/part-inks.js";import{useEffect as F,useRef as J}from"react";import{markOverlayPortal as z}from"../../format/lib/puck/overlay-portal.js";import{usePreviewParts as M}from"efficient-easel/draw/client";import{usePartStyle as Y}from"./PreviewPartStyleContext.js";import{usePreviewDevice as $}from"efficient-easel/draw/client";import{encodePartId as j}from"efficient-easel/draw";import{PUCK_COMPONENT_ATTR as B,engagePartAnchors as G}from"../lib/puck/part-anchors.js";import{PART_ATTR as R,PART_SELECTED_ATTR as E,PART_STYLE_KIND_ATTR as w,PART_STYLE_OWNER_ATTR as H,partStyleOwnerOf as _}from"../../render/lib/puck/text-parts.js";import{PART_STYLE_PROPERTIES as v,applyPartStyles as x,blockDrawsTextStyle as q,partFontKeyOf as U,partStyleBase as V,partStyleSource as Q}from"../../render/lib/puck/part-styles.js";import{fontRoleOfClassName as X,styleRoleOfClassName as Z}from"../../format/lib/fonts.js";import{typeScaleGroupOfClassName as N}from"../../format/lib/theme.js";import{styleKeyForPart as ee}from"../../format/lib/sections/section-text-kinds.js";function te(a){let o=null,s=null;for(let t=a;t&&(o===null||s===null);t=t.parentElement){const c=t.getAttribute("class");o??=Z(c),s??=N(c)}return{faceRole:o??"body",sizeGroup:s}}function C(a){const o=a.style,s={};for(const r of v)s[r]=o[r]??"",o[r]="";const t=getComputedStyle(a),c=getComputedStyle(a.ownerDocument.documentElement),p=V({fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,textAlign:t.textAlign,textTransform:t.textTransform,paddingTop:t.paddingTop,maxWidth:t.maxWidth},U(t.fontFamily,r=>c.getPropertyValue(r)));for(const r of v)o[r]=s[r];return p}function re({needles:a,styles:o,type:s,children:t}){const c=J(null),{selectedPartId:p}=M(),{setPartStyle:r}=Y(),d=$()==="mobile",y=JSON.stringify(a),S=JSON.stringify(o);return F(()=>{const f=c.current;if(!f)return;const g=[],T=()=>f.parentElement,D=l=>{const n=T();if(!n)return null;const m=new MutationObserver(l);return m.observe(n,{attributes:!0,attributeFilter:[B]}),()=>m.disconnect()},W=l=>{const n=new MutationObserver(l);return n.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>n.disconnect()};let u=[];g.push(()=>{for(const l of u)l();u=[]});const I=JSON.parse(y),P=JSON.parse(S),K=G(f,I,T,D,(l,n,m)=>{for(const e of u)e();u=[];const h=[];for(const e of m){const i=e,O=z(i);O&&u.push(O),i.getAttribute(R)===p?(i.setAttribute(E,""),h.push(i)):i.removeAttribute(E)}const b=Q(n,p,h,e=>X(e)!==null||N(e)!==null);if(b&&p){const e=b;r({partId:p,...te(e),base:C(e),inks:L(e),...(()=>{const i=_(e);return i?{styleOwner:i}:{}})()})}x(m.filter(e=>!_(e)).map(e=>({element:e,partId:e.getAttribute(R)??""})),P,e=>C(e),e=>ee(s,e),void 0,d,e=>q(s,e));const A=[...f.querySelectorAll(`[${H}="${CSS.escape(n)}"][${w}]`)];A.length&&x(A.map(e=>({element:e,partId:j(n,e.getAttribute(w)??"")})),P,void 0,e=>e,void 0,d)},W);return()=>{K();for(const l of g)l()}},[y,S,p,r,d]),k("div",{ref:c,style:{display:"contents"},children:t})}export{re as default,C as measureStyleBase,te as styleTagsOf};
@@ -1 +1 @@
1
- "use client";import{jsx as R}from"react/jsx-runtime";import{useEffect as T,useRef as v}from"react";import{markOverlayPortal as x}from"../../format/lib/puck/overlay-portal.js";import{measureStyleBase as S,styleTagsOf as b}from"./PreviewPartAnchors.js";import{usePreviewParts as h}from"efficient-easel/draw/client";import{usePartStyle as k}from"./PreviewPartStyleContext.js";import{PART_SELECTED_ATTR as n,encodePartId as A}from"../../render/lib/puck/text-parts.js";import{TEXT_REGION_ATTR as d,textRegionForClick as _,textRegionOfAttr as O,textRegionPartKey as y}from"../../format/lib/sections/text-regions.js";import{regionsForSection as C}from"../../format/lib/sections/section-text-regions.js";function L({nodeId:r,sectionType:c,children:E}){const f=v(null),{selectedPartId:l,select:u}=h(),{setPartStyle:a}=k();return T(()=>{const o=f.current,s=C(c);if(!o||!r||!s)return;const i=[],m=Array.from(o.querySelectorAll(`[${d}]`));for(const t of m){const e=O(s,t.getAttribute(d));if(!e)continue;const g=x(t);g&&i.push(g);const P=A(r,y(e));P===l?(t.setAttribute(n,""),a({partId:P,...b(t),base:S(t)})):t.removeAttribute(n)}const p=t=>{const e=_(s,t.target);e&&(t.stopPropagation(),t.preventDefault(),u(A(r,y(e))))};return o.addEventListener("click",p,{capture:!0}),i.push(()=>o.removeEventListener("click",p,{capture:!0})),()=>{for(const t of i)t();for(const t of m)t.removeAttribute(n)}},[r,c,l,u,a]),R("div",{ref:f,style:{display:"contents"},children:E})}export{L as default};
1
+ "use client";import{jsx as R}from"react/jsx-runtime";import{useEffect as d,useRef as g}from"react";import{markOverlayPortal as y}from"../../format/lib/puck/overlay-portal.js";import{measureStyleBase as E,styleTagsOf as b}from"./PreviewPartAnchors.js";import{usePreviewParts as S}from"efficient-easel/draw/client";import{usePartStyle as _}from"./PreviewPartStyleContext.js";import{PART_SELECTED_ATTR as o,REGION_PART_ATTR as A,encodePartId as v}from"../../render/lib/puck/text-parts.js";import{TEXT_REGION_ATTR as T,textRegionOfAttr as x,textRegionPartKey as O}from"../../format/lib/sections/text-regions.js";import{regionsForSection as h}from"../../format/lib/sections/section-text-regions.js";function I({nodeId:e,sectionType:s,children:P}){const i=g(null),{selectedPartId:n}=S(),{setPartStyle:f}=_();return d(()=>{const m=i.current,c=h(s);if(!m||!e||!c)return;const u=[],l=Array.from(m.querySelectorAll(`[${T}]`));for(const t of l){const a=x(c,t.getAttribute(T));if(!a)continue;const p=y(t);p&&u.push(p);const r=v(e,O(a));t.setAttribute(A,r),r===n?(t.setAttribute(o,""),f({partId:r,...b(t),base:E(t)})):t.removeAttribute(o)}return()=>{for(const t of u)t();for(const t of l)t.removeAttribute(o),t.removeAttribute(A)}},[e,s,n,f]),R("div",{ref:i,style:{display:"contents"},children:P})}export{I as default};
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as H,useEffect as S,useMemo as l,useRef as V,useState as u}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 X}from"../lib/puck/build-config.js";import{withTemplateMediaPlaceholders as Z}from"../../format/lib/puck/templateFields.js";import{setEditorPageSlug as R}from"../../format/lib/puck/editor-page-context.js";import{ScreenDocumentContext as $}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as ee}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as te}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as re}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as oe}from"efficient-easel/draw/client";import{PreviewLocationPartProvider as ie}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as ne}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"efficient-easel/screen/lib/section-templates";import{nodeToDoc as se,docToNode as B}from"efficient-easel/screen/lib/puck/section-doc";import{newNodeId as de}from"efficient-easel/draw";import{migrateRenamedProps as ae}from"../../format/lib/puck/renamed-props.js";import{buildSlotSeedChildren as ce}from"../../render/lib/puck/slot-specs.js";import{FOOTER_TYPE as me,buildDefaultFooterBlocks as le}from"../lib/puck/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as ue,useAdminBridge as fe}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as pe}from"efficient-easel/screen/lib/host";import{ChromeWrap as ve}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as ge}from"efficient-easel/screen/lib/session";import{useEaselSession as he}from"efficient-easel/screen/lib/session-context";import{say as F}from"../../format/lib/editor-words.js";import{retargetWhenSaved as Se}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as Pe}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as Ee}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as P,THEME_MODE_KEY as ye}from"../../format/lib/theme.js";import{makeSitePageAdapter as L}from"../lib/editor-document-adapter.js";import{documentPermissions as Te}from"efficient-easel/edit-lock";import{useAutosave as we}from"efficient-easel/autosave";import{saveStatusOf as Ne}from"efficient-easel/screen/lib/document-switch";import{blocksOf as ke}from"../lib/website-session.js";const Ce=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),Ae=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),U="HeroSingle",W="Untitled section";function Ie(i,E){const d=E.components,r=d[i]?i:U,y=d[r]?.defaultProps??{},n=ce(r,f=>d[f]?.defaultProps??{}),s=r===me?{blocks:le()}:null;return{type:r,props:{id:de(r),...y,...n?{[n.slot]:n.children}:null,...s}}}function Oe(){if(typeof window>"u")return P;try{const i=window.localStorage.getItem(ye);return i==="light"||i==="dark"||i==="auto"?i:P}catch{return P}}function be({id:i,initialType:E,initialName:d=W}){const[r,y]=u(i),n=V(r);S(()=>{n.current=r},[r]);const s=pe(),[f,Y]=u(E),[b,j]=u(d),[a,T]=u(void 0),[K,G]=u(P),{token:w,tokenRef:M}=fe({onMessage:e=>{if(Ee(e)||Pe(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const I=t.target.id;if(I===n.current)return;const J=t.target.type,Q=t.target.name;Se(k,()=>{Y(J),j(Q||W),y(I),s.address.show({kind:"section",id:I})},()=>s.send("storefront-editor:save-failed"))}}}),N=we({save:e=>O.update(e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&s.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:k}=N;S(()=>G(Oe()),[]);const c=he(),v=c.usesBridgedToken?!!w:!0,g=l(()=>X(ge(c),ke(c)),[c]);S(()=>{if(!v)return;let e=!1;return T(void 0),O.ensure(r,b,Ie(f??U,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,f,b,v,g]);const C=H(e=>{s.send("storefront-editor:dirty");const t=B(e);t&&D({id:n.current,node:t})},[D,s]),h=s.send,_=H(async e=>{try{return await e(M.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),q=l(()=>Z(g,!0),[g]);S(()=>(R(null),()=>R(null)),[]);const m=l(()=>a?ae(se(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:L(void 0),capabilities:L(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:M,notifyParent:h,runAuthed:_,docId:r,data:m,getLiveData:()=>m,footerOriginSlug:null,error:null,redirecting:!1,saveStatus:Ne(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:C,flushSave:k,onPublish:async e=>{const t=B(e);t&&await O.update(n.current,t)},bridgeCapabilities:ue,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,m,p,C,k,N.retryNow]),z=l(()=>Te(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:F("Loading…")}):a===null||!m?o("div",{className:"sf-msg sf-msg--error",children:F("Couldn’t open this section.")}):o($.Provider,{value:A,children:o(ee,{themeMode:K,chromePlaceholder:!0,children:o(ve,{wrap:c.chrome?.wrap,surface:"section",children:o(te,{children:o(re,{children:o(oe,{children:o(ie,{children:o(ne,{children:o(Ce,{config:q,data:m,onChange:C,permissions:z,children:o(Ae,{})},r)})})})})})})})})}export{be as default};
1
+ "use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as H,useEffect as P,useMemo as l,useRef as V,useState as u}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 X}from"../lib/puck/build-config.js";import{withTemplateMediaPlaceholders as Z}from"../../format/lib/puck/templateFields.js";import{setEditorPageSlug as B}from"../../format/lib/puck/editor-page-context.js";import{ScreenDocumentContext as $}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as ee}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as te}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as re}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as oe}from"efficient-easel/draw/client";import{CanvasPartsBridge as ie}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as ne}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as se}from"./PreviewPartStyleContext.js";import{sectionTemplates as b}from"efficient-easel/screen/lib/section-templates";import{nodeToDoc as de,docToNode as R}from"efficient-easel/screen/lib/puck/section-doc";import{newNodeId as ae}from"efficient-easel/draw";import{migrateRenamedProps as ce}from"../../format/lib/puck/renamed-props.js";import{buildSlotSeedChildren as me}from"../../render/lib/puck/slot-specs.js";import{FOOTER_TYPE as le,buildDefaultFooterBlocks as ue}from"../lib/puck/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as fe,useAdminBridge as pe}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as ve}from"efficient-easel/screen/lib/host";import{ChromeWrap as ge}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as he}from"efficient-easel/screen/lib/session";import{useEaselSession as Pe}from"efficient-easel/screen/lib/session-context";import{say as F}from"../../format/lib/editor-words.js";import{retargetWhenSaved as Se}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as Ee}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as ye}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as S,THEME_MODE_KEY as Te}from"../../format/lib/theme.js";import{makeSitePageAdapter as L}from"../lib/editor-document-adapter.js";import{documentPermissions as we}from"efficient-easel/edit-lock";import{useAutosave as Ne}from"efficient-easel/autosave";import{saveStatusOf as Ce}from"efficient-easel/screen/lib/document-switch";import{blocksOf as ke}from"../lib/website-session.js";const Ae=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),Ie=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),U="HeroSingle",W="Untitled section";function be(i,E){const d=E.components,r=d[i]?i:U,y=d[r]?.defaultProps??{},n=me(r,f=>d[f]?.defaultProps??{}),s=r===le?{blocks:ue()}:null;return{type:r,props:{id:ae(r),...y,...n?{[n.slot]:n.children}:null,...s}}}function Me(){if(typeof window>"u")return S;try{const i=window.localStorage.getItem(Te);return i==="light"||i==="dark"||i==="auto"?i:S}catch{return S}}function Oe({id:i,initialType:E,initialName:d=W}){const[r,y]=u(i),n=V(r);P(()=>{n.current=r},[r]);const s=ve(),[f,Y]=u(E),[M,j]=u(d),[a,T]=u(void 0),[K,G]=u(S),{token:w,tokenRef:O}=pe({onMessage:e=>{if(ye(e)||Ee(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const I=t.target.id;if(I===n.current)return;const J=t.target.type,Q=t.target.name;Se(C,()=>{Y(J),j(Q||W),y(I),s.address.show({kind:"section",id:I})},()=>s.send("storefront-editor:save-failed"))}}}),N=Ne({save:e=>b.update(e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&s.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:C}=N;P(()=>G(Me()),[]);const c=Pe(),v=c.usesBridgedToken?!!w:!0,g=l(()=>X(he(c),ke(c)),[c]);P(()=>{if(!v)return;let e=!1;return T(void 0),b.ensure(r,M,be(f??U,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,f,M,v,g]);const k=H(e=>{s.send("storefront-editor:dirty");const t=R(e);t&&D({id:n.current,node:t})},[D,s]),h=s.send,_=H(async e=>{try{return await e(O.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),q=l(()=>Z(g,!0),[g]);P(()=>(B(null),()=>B(null)),[]);const m=l(()=>a?ce(de(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:L(void 0),capabilities:L(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:O,notifyParent:h,runAuthed:_,docId:r,data:m,getLiveData:()=>m,error:null,redirecting:!1,saveStatus:Ce(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:k,flushSave:C,onPublish:async e=>{const t=R(e);t&&await b.update(n.current,t)},bridgeCapabilities:fe,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,m,p,k,C,N.retryNow]),z=l(()=>we(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:F("Loading…")}):a===null||!m?o("div",{className:"sf-msg sf-msg--error",children:F("Couldn’t open this section.")}):o($.Provider,{value:A,children:o(ee,{themeMode:K,chromePlaceholder:!0,children:o(ge,{wrap:c.chrome?.wrap,surface:"section",children:o(te,{children:o(re,{children:o(oe,{children:o(ie,{children:o(ne,{children:o(se,{children:o(Ae,{config:q,data:m,onChange:k,permissions:z,children:o(Ie,{})},r)})})})})})})})})})}export{Oe as default};
@@ -1 +1 @@
1
- "use client";import{jsx as s,jsxs as it}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as oe,useRef as f,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{buildConfig as ct}from"../lib/puck/build-config.js";import{ChromeWrap as st}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as dt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as ut}from"../lib/site-live-state.js";import{holdSiteWrites as ht}from"../../format/lib/site-writes.js";import{backendOf as W,blocksOf as lt}from"../lib/website-session.js";import{useEaselSession as mt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as pt}from"../../format/lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as St}from"../../format/lib/puck/templateFields.js";import{setEditorPage as ne}from"../../format/lib/puck/editor-page-context.js";import{resolveSiteName as ft}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as gt,normalizeSiteWidth as wt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as ae}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as Ct}from"../../format/lib/content/container-gap.js";import _t,{DocumentScreen as Tt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Et}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as yt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Pt}from"./PreviewFooterContext.js";import{PreviewChatProvider as vt,DEFAULT_CHAT_PREVIEW as Wt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Ht}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Gt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Rt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Bt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as It}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Ft}from"efficient-easel/draw/client";import{PreviewLocationPartProvider as Dt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as Mt}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as xt,DEFAULT_HEADING_COMPRESSION as Nt,DEFAULT_HEADING_TYPOGRAPHY as Ot,DEFAULT_SWITCH_SHOWN as H,DEFAULT_SIZES as bt,DEFAULT_THEME_MODE as _,normalizeCornerRadius as At,normalizeCornerStyle as zt,normalizeCardShadow as Lt,normalizeCardGap as Yt,normalizeHoverEffect as Ut,normalizeShadowColor as jt,IDENTITY_CARD_GAP as ie,IDENTITY_CARD_SHADOW as Kt,IDENTITY_HOVER_EFFECT as Vt,THEME_MODE_KEY as ce,THEME_STORAGE_KEY as Xt,THEME_SWITCH_HIDE as se,THEME_SWITCH_KEY as k}from"../../format/lib/theme.js";import{DEFAULT_FONTS as Zt}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as qt}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as Jt}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as Qt}from"../lib/site-text-styles.js";import{wordStylesFromRow as $t}from"../../format/lib/word-styles.js";import{chatPreviewFrom as er}from"./PreviewChatContext.js";const tr=()=>{if(typeof window>"u")return _;try{const i=window.localStorage.getItem(ce);return i==="light"||i==="dark"||i==="auto"?i:_}catch{return _}},de=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ce,i)}catch{}},rr=()=>{if(typeof window>"u")return H;try{return window.localStorage.getItem(k)!==se}catch{return H}},or=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Xt)}catch{}},ue=i=>{if(!(typeof window>"u"))try{i?window.localStorage.removeItem(k):window.localStorage.setItem(k,se)}catch{}};function nr(){const{adapter:i,capabilities:d,templateId:G,ready:w,token:h,siteId:c,currentSlug:R,currentKind:B}=Et();S(()=>(ne(R,B),()=>ne(null,null)),[R,B]);const T=d.placeholderFrames,[he,I]=r(null),[le,F]=r("");S(()=>{const e=i.templateName;if(!w||!G||!e){F("");return}let a=!1;return e().then(l=>!a&&F(l??"")).catch(()=>{}),()=>{a=!0}},[w,h,G,i]);const[me,E]=r(_),[pe,y]=r(H),[Se,D]=r({selected:0,themes:[]}),[fe,M]=r(Zt),[ge,x]=r(bt),[we,N]=r(null),[Ce,O]=r(Nt),[_e,b]=r(null),[Te,A]=r(null),[Ee,z]=r(ie),[ye,L]=r(null),[Pe,Y]=r(null),[ve,U]=r(null),[P,j]=r(null),u=mt(),K=oe(()=>ct(dt(u),lt(u)),[u]),We=oe(()=>pt(St(K,T),P),[K,T,P]),[He,V]=r(Ot),[ke,X]=r(null),[Ge,Z]=r(null),[Re,q]=r(null),[Be,J]=r(null),[Ie,Q]=r(null),$=f(null),o=f(!1);S(()=>{E(tr()),y(rr())},[]);const Fe=n(e=>{o.current=!0,or(),de(e),E(e)},[]),De=n(e=>{o.current=!0,ue(e),y(e)},[]),Me=n(e=>{o.current=!0,D(e)},[]),xe=n(e=>{o.current=!0,M(e)},[]),Ne=n(e=>{o.current=!0,x(e)},[]),Oe=n(e=>{o.current=!0,N(e)},[]),be=n(e=>{o.current=!0,O(e)},[]),Ae=n(e=>{o.current=!0,b(e)},[]),ze=n(e=>{o.current=!0,A(e)},[]),Le=n(e=>{o.current=!0,z(e)},[]),Ye=n(e=>{o.current=!0,L(e)},[]),Ue=n(e=>{o.current=!0,V(e)},[]),[je,ee]=r(null),[Ke,Ve]=r(null),Xe=n(e=>{o.current=!0,ee(e)},[]),Ze=n(e=>{o.current=!0,Y(e)},[]),qe=n(e=>{o.current=!0,U(e)},[]),Je=n(e=>{o.current=!0,j(e)},[]),Qe=n(e=>{o.current=!0,X(e)},[]),$e=n(e=>{o.current=!0,Z(e)},[]),et=n(e=>{o.current=!0,q(e)},[]),tt=n(e=>{o.current=!0,J(e)},[]),rt=n(e=>{o.current=!0,Q(e)},[]);S(()=>{const e=W(u).theme;if(!h||!d.hasSiteTheme||!e)return;const a=c??"";$.current!==a&&($.current=a,o.current=!1);let l=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(l||o.current)return;de(t.default_mode),ue(t.show_theme_switch),E(t.default_mode),y(t.show_theme_switch),D({selected:t.selected_preset,themes:t.theme_presets});const g=Qt(t);M(g.fonts),x(g.sizes),N(t.corner_radius_px===void 0?xt[zt(t.corner_style)]:At(t.corner_radius_px)),O(g.compression),b(t.card_shadow==null?Kt:Lt(t.card_shadow)),z(t.card_gap==null?ie:Yt(t.card_gap)),L(t.hover_effect==null?Vt:Ut(t.hover_effect)),A(jt(t.shadow_color)),Y(wt(t.site_width)),U(gt(t.site_gutter)),j(Ct(t.block_gap)),V(g.typography),ee(g.textStyles),Ve($t(t)),X(t.hero_background_follows_width===!0),Z(ae(t.section_background_width)),q(ae(t.section_content_width)),J(t.photography_grayscale===!0),Q(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{l=!0}},[h,c,d.hasSiteTheme,u]);const ot=kt({token:h,siteId:c,enabled:d.hasSiteSettings}),[nt,te]=r(Wt),re=f(null),v=f(!1),m=f(null),p=f({}),C=n(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await W(u).chat?.update(e,c?{siteId:c}:void 0),ut()}catch(a){throw p.current={...e,...p.current},a}},[u,c]);S(()=>ht(()=>m.current||Object.keys(p.current).length>0?C():void 0),[C]);const at=n(e=>{v.current=!0,te(a=>({...a,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,h,C]);return S(()=>{if(!h||!d.hasSiteSettings)return;const e=c??"";re.current!==e&&(re.current=e,v.current=!1);let a=!1;const l=W(u).chat;if(l)return l.get(c?{siteId:c}:void 0).then(t=>{a||v.current||te(er(t))}).catch(()=>{}),()=>{a=!0}},[h,c,d.hasSiteSettings,u]),S(()=>{const e=i.site;if(!w||!d.hasSiteRecord||!e){I(null);return}let a=!1;return e().then(l=>{a||I(ft(l.name))}).catch(()=>{}),()=>{a=!0}},[w,h,d.hasSiteRecord,c,i]),s(Tt,{config:We,parts:qt,wrap:(e,a)=>s(yt,{websiteName:he,templateChrome:T,templateName:le||null,themeMode:me,onThemeModeChange:Fe,themeSwitchShown:pe,onThemeSwitchShownChange:De,theme:Se,onThemeChange:Me,fonts:fe,onFontsChange:xe,cornerRadiusPx:we,onCornerRadiusPxChange:Oe,cardShadow:_e,onCardShadowChange:Ae,shadowColor:Te,onShadowColorChange:ze,cardGap:Ee,onCardGapChange:Le,hoverEffect:ye,onHoverEffectChange:Ye,headingCompression:Ce,onHeadingCompressionChange:be,headingTypography:He,onHeadingTypographyChange:Ue,textStyles:je,onTextStylesChange:Xe,wordStyles:Ke,sizes:ge,onSizesChange:Ne,siteWidth:Pe,onSiteWidthChange:Ze,siteGutter:ve,onSiteGutterChange:qe,blockGap:P,onBlockGapChange:Je,heroBackgroundFollowsWidth:ke,onHeroBackgroundFollowsWidthChange:Qe,sectionBackgroundWidth:Ge,onSectionBackgroundWidthChange:$e,sectionContentWidth:Re,onSectionContentWidthChange:et,photographyGrayscale:Be,onPhotographyGrayscaleChange:tt,shareButtonOnPosts:Ie,onShareButtonOnPostsChange:rt,themeFromDocument:!d.hasSiteTheme,children:s(Pt,{children:s(st,{wrap:u.chrome?.wrap,surface:"page",children:s(Bt,{children:s(It,{children:s(Ft,{children:s(Dt,{children:it(Mt,{children:[s(vt,{chat:nt,onChatChange:at,children:s(Ht,{value:ot,children:s(Gt,{children:e})})}),a]})})})})})})})})})}function ar({target:i}){return s(_t,{target:i,addressing:Rt,onHostMessage:Jt,children:s(nr,{})})}export{ar as default};
1
+ "use client";import{jsx as c,jsxs as it}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as oe,useRef as f,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{buildConfig as ct}from"../lib/puck/build-config.js";import{ChromeWrap as st}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as dt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as ut}from"../lib/site-live-state.js";import{holdSiteWrites as ht}from"../../format/lib/site-writes.js";import{backendOf as W,blocksOf as lt}from"../lib/website-session.js";import{useEaselSession as mt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as pt}from"../../format/lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as St}from"../../format/lib/puck/templateFields.js";import{setEditorPage as ne}from"../../format/lib/puck/editor-page-context.js";import{resolveSiteName as ft}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as gt,normalizeSiteWidth as wt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as ae}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as Ct}from"../../format/lib/content/container-gap.js";import _t,{DocumentScreen as Tt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Et}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as yt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Pt}from"./PreviewFooterContext.js";import{PreviewChatProvider as vt,DEFAULT_CHAT_PREVIEW as Wt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Ht}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Gt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Bt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Rt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as It}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Ft}from"efficient-easel/draw/client";import{CanvasPartsBridge as Dt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as Mt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as xt}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as Nt,DEFAULT_HEADING_COMPRESSION as Ot,DEFAULT_HEADING_TYPOGRAPHY as bt,DEFAULT_SWITCH_SHOWN as H,DEFAULT_SIZES as At,DEFAULT_THEME_MODE as _,normalizeCornerRadius as zt,normalizeCornerStyle as Lt,normalizeCardShadow as Yt,normalizeCardGap as Ut,normalizeHoverEffect as jt,normalizeShadowColor as Kt,IDENTITY_CARD_GAP as ie,IDENTITY_CARD_SHADOW as Vt,IDENTITY_HOVER_EFFECT as Xt,THEME_MODE_KEY as ce,THEME_STORAGE_KEY as Zt,THEME_SWITCH_HIDE as se,THEME_SWITCH_KEY as k}from"../../format/lib/theme.js";import{DEFAULT_FONTS as qt}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Jt}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as Qt}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as $t}from"../lib/site-text-styles.js";import{wordStylesFromRow as er}from"../../format/lib/word-styles.js";import{chatPreviewFrom as tr}from"./PreviewChatContext.js";const rr=()=>{if(typeof window>"u")return _;try{const i=window.localStorage.getItem(ce);return i==="light"||i==="dark"||i==="auto"?i:_}catch{return _}},de=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ce,i)}catch{}},or=()=>{if(typeof window>"u")return H;try{return window.localStorage.getItem(k)!==se}catch{return H}},nr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Zt)}catch{}},ue=i=>{if(!(typeof window>"u"))try{i?window.localStorage.removeItem(k):window.localStorage.setItem(k,se)}catch{}};function ar(){const{adapter:i,capabilities:d,templateId:G,ready:w,token:h,siteId:s,currentSlug:B,currentKind:R}=Et();S(()=>(ne(B,R),()=>ne(null,null)),[B,R]);const T=d.placeholderFrames,[he,I]=r(null),[le,F]=r("");S(()=>{const e=i.templateName;if(!w||!G||!e){F("");return}let a=!1;return e().then(l=>!a&&F(l??"")).catch(()=>{}),()=>{a=!0}},[w,h,G,i]);const[me,E]=r(_),[pe,y]=r(H),[Se,D]=r({selected:0,themes:[]}),[fe,M]=r(qt),[ge,x]=r(At),[we,N]=r(null),[Ce,O]=r(Ot),[_e,b]=r(null),[Te,A]=r(null),[Ee,z]=r(ie),[ye,L]=r(null),[Pe,Y]=r(null),[ve,U]=r(null),[P,j]=r(null),u=mt(),K=oe(()=>ct(dt(u),lt(u)),[u]),We=oe(()=>pt(St(K,T),P),[K,T,P]),[He,V]=r(bt),[ke,X]=r(null),[Ge,Z]=r(null),[Be,q]=r(null),[Re,J]=r(null),[Ie,Q]=r(null),$=f(null),o=f(!1);S(()=>{E(rr()),y(or())},[]);const Fe=n(e=>{o.current=!0,nr(),de(e),E(e)},[]),De=n(e=>{o.current=!0,ue(e),y(e)},[]),Me=n(e=>{o.current=!0,D(e)},[]),xe=n(e=>{o.current=!0,M(e)},[]),Ne=n(e=>{o.current=!0,x(e)},[]),Oe=n(e=>{o.current=!0,N(e)},[]),be=n(e=>{o.current=!0,O(e)},[]),Ae=n(e=>{o.current=!0,b(e)},[]),ze=n(e=>{o.current=!0,A(e)},[]),Le=n(e=>{o.current=!0,z(e)},[]),Ye=n(e=>{o.current=!0,L(e)},[]),Ue=n(e=>{o.current=!0,V(e)},[]),[je,ee]=r(null),[Ke,Ve]=r(null),Xe=n(e=>{o.current=!0,ee(e)},[]),Ze=n(e=>{o.current=!0,Y(e)},[]),qe=n(e=>{o.current=!0,U(e)},[]),Je=n(e=>{o.current=!0,j(e)},[]),Qe=n(e=>{o.current=!0,X(e)},[]),$e=n(e=>{o.current=!0,Z(e)},[]),et=n(e=>{o.current=!0,q(e)},[]),tt=n(e=>{o.current=!0,J(e)},[]),rt=n(e=>{o.current=!0,Q(e)},[]);S(()=>{const e=W(u).theme;if(!h||!d.hasSiteTheme||!e)return;const a=s??"";$.current!==a&&($.current=a,o.current=!1);let l=!1;return e.get(s?{siteId:s}:void 0).then(t=>{if(l||o.current)return;de(t.default_mode),ue(t.show_theme_switch),E(t.default_mode),y(t.show_theme_switch),D({selected:t.selected_preset,themes:t.theme_presets});const g=$t(t);M(g.fonts),x(g.sizes),N(t.corner_radius_px===void 0?Nt[Lt(t.corner_style)]:zt(t.corner_radius_px)),O(g.compression),b(t.card_shadow==null?Vt:Yt(t.card_shadow)),z(t.card_gap==null?ie:Ut(t.card_gap)),L(t.hover_effect==null?Xt:jt(t.hover_effect)),A(Kt(t.shadow_color)),Y(wt(t.site_width)),U(gt(t.site_gutter)),j(Ct(t.block_gap)),V(g.typography),ee(g.textStyles),Ve(er(t)),X(t.hero_background_follows_width===!0),Z(ae(t.section_background_width)),q(ae(t.section_content_width)),J(t.photography_grayscale===!0),Q(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{l=!0}},[h,s,d.hasSiteTheme,u]);const ot=kt({token:h,siteId:s,enabled:d.hasSiteSettings}),[nt,te]=r(Wt),re=f(null),v=f(!1),m=f(null),p=f({}),C=n(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await W(u).chat?.update(e,s?{siteId:s}:void 0),ut()}catch(a){throw p.current={...e,...p.current},a}},[u,s]);S(()=>ht(()=>m.current||Object.keys(p.current).length>0?C():void 0),[C]);const at=n(e=>{v.current=!0,te(a=>({...a,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,h,C]);return S(()=>{if(!h||!d.hasSiteSettings)return;const e=s??"";re.current!==e&&(re.current=e,v.current=!1);let a=!1;const l=W(u).chat;if(l)return l.get(s?{siteId:s}:void 0).then(t=>{a||v.current||te(tr(t))}).catch(()=>{}),()=>{a=!0}},[h,s,d.hasSiteSettings,u]),S(()=>{const e=i.site;if(!w||!d.hasSiteRecord||!e){I(null);return}let a=!1;return e().then(l=>{a||I(ft(l.name))}).catch(()=>{}),()=>{a=!0}},[w,h,d.hasSiteRecord,s,i]),c(Tt,{config:We,parts:Jt,wrap:(e,a)=>c(yt,{websiteName:he,templateChrome:T,templateName:le||null,themeMode:me,onThemeModeChange:Fe,themeSwitchShown:pe,onThemeSwitchShownChange:De,theme:Se,onThemeChange:Me,fonts:fe,onFontsChange:xe,cornerRadiusPx:we,onCornerRadiusPxChange:Oe,cardShadow:_e,onCardShadowChange:Ae,shadowColor:Te,onShadowColorChange:ze,cardGap:Ee,onCardGapChange:Le,hoverEffect:ye,onHoverEffectChange:Ye,headingCompression:Ce,onHeadingCompressionChange:be,headingTypography:He,onHeadingTypographyChange:Ue,textStyles:je,onTextStylesChange:Xe,wordStyles:Ke,sizes:ge,onSizesChange:Ne,siteWidth:Pe,onSiteWidthChange:Ze,siteGutter:ve,onSiteGutterChange:qe,blockGap:P,onBlockGapChange:Je,heroBackgroundFollowsWidth:ke,onHeroBackgroundFollowsWidthChange:Qe,sectionBackgroundWidth:Ge,onSectionBackgroundWidthChange:$e,sectionContentWidth:Be,onSectionContentWidthChange:et,photographyGrayscale:Re,onPhotographyGrayscaleChange:tt,shareButtonOnPosts:Ie,onShareButtonOnPostsChange:rt,themeFromDocument:!d.hasSiteTheme,children:c(Pt,{children:c(st,{wrap:u.chrome?.wrap,surface:"page",children:c(Rt,{children:c(It,{children:c(Ft,{children:c(Dt,{children:c(Mt,{children:it(xt,{children:[c(vt,{chat:nt,onChatChange:at,children:c(Ht,{value:ot,children:c(Gt,{children:e})})}),a]})})})})})})})})})})}function ir({target:i}){return c(_t,{target:i,addressing:Bt,onHostMessage:Qt,children:c(ar,{})})}export{ir as default};
@@ -1 +1 @@
1
- "use client";import{jsx as n,Fragment as A,jsxs as k}from"react/jsx-runtime";import{useCallback as _,useEffect as h,useRef as X,useState as J}from"react";import{Button as Q,Tooltip as $}from"efficient-shell/ui";import{SettingsSwitch as ee}from"efficient-easel/panel";import{PagesIcon as te,StylesIcon as oe}from"efficient-easel/rail";import{PaletteIcon as re}from"efficient-shell/icons/efficient";import{TemplateIcon as ne}from"efficient-easel/icons";import{Subtree as ie,TreeRow as B}from"efficient-easel/tree";import{useEasel as se}from"efficient-easel/easel";import{useEaselStrings as y}from"efficient-easel/strings";import{LocationsTreeContext as ae}from"./LocationsTreeContext.js";import ce from"./PagesPanel.js";import{usePreviewChat as de}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as le}from"./preview-devices.js";import{PreviewDeviceContext as pe}from"efficient-easel/draw/client";import{usePreviewHeader as me}from"../../render/components/PreviewHeaderContext.js";import{usePreviewSocial as fe}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as ue}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as Se,usePreviewTicker as Ee}from"../../render/components/PreviewTickerContext.js";import{usePreviewHeroPart as we}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Pe,HERO_PART_MODE as H,heroMediaRows as Te,heroPartId as N,readHeroPartId as be}from"../../render/lib/puck/hero-media-parts.js";import he,{CHAT_MODE as ge,HEADER_MODE as D,SOCIAL_MODE as Ie,WEBSITE_MODE as W}from"./SectionEditor.js";import L from"./SectionIcon.js";import ve from"./SectionThumbnail.js";import{useScreenDocument as R}from"efficient-easel/screen/components/ScreenDocumentContext";import ke from"./StylesPanel.js";import{LOCATIONS_TYPE as _e,useLocationsTree as Ce}from"./useLocationsTree.js";import{usePinnedChromeSeed as Le}from"./usePinnedChromeSeed.js";import{usePreviewHref as Re}from"./usePreviewHref.js";import{WebsitePreviewButton as Oe}from"./WebsitePreviewButton.js";import{SITE_STYLES_TABS as Ae,SITE_STYLES_TEXT_TAB as Be,useWebsiteName as ye}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as He}from"./useWebsiteMainAction.js";import{VersionHistory as Ne}from"./VersionHistoryDrawer.js";import{useEaselSession as De}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as We}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ve,heroGroupNestDepth as Me}from"../../format/lib/hero-group-placement.js";import{stripMarkup as xe}from"../../format/lib/markup.js";import{categoryShortLabel as Ye,PINNED_SECTION_TYPE as Ge}from"../lib/puck/add-palette.js";import{canAddTo as Fe}from"../lib/puck/add-target.js";import{blockIsOffered as ze}from"../lib/puck/block-offer.js";import{sectionIdOfBoxZone as Ke,setBookingPreview as je}from"../../render/lib/puck/booking-preview.js";import{footerBlockRowName as Ue}from"../../format/lib/puck/footer-block-row-name.js";import{FOOTER_TYPE as Ze,HEADER_TYPE as V}from"../lib/puck/footer-blocks.js";import{leftViewForSelection as qe,readLeftView as Xe,resolveLeftView as Je,writeLeftView as Qe}from"../../format/lib/puck/left-view.js";import{websiteIsLockedBlock as $e}from"../lib/puck/locked-blocks.js";import{everyPageBadge as et,everyPageNotice as tt,pinnedGroupTab as ot,websiteDuplicateBlocked as rt}from"../lib/puck/every-page.js";import{pinnedChromeInPlace as C}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as nt,scrollPreviewToTop as M}from"efficient-easel/screen/lib/puck/preview-dom";import{SiteCanvas as it}from"../lib/puck/overrides.js";import{labelAtLevel as st}from"../../format/lib/puck/section-catalog.js";import{editorWords as at,say as c}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as ct}from"../../format/lib/puck/section-descriptions.js";import{groupAccepts as dt,isSectionGroupType as lt,sectionGroupZone as pt,SITE_FOOTER_TYPE as mt,SITE_HEADER_TYPE as ft}from"../../format/lib/puck/section-groups.js";import{resolveSaveAsTemplateAction as ut,SAVE_AS_TEMPLATE_EVENT as St}from"../../format/lib/save-as-template-action.js";import{newSectionNode as Et}from"../lib/sections/new-section-node.js";import{useHostProducts as wt}from"../lib/use-host-products.js";import{backendOf as Pt}from"../lib/website-session.js";function x({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Ee(),d=y().tree,l=e,p=l.kind==="ticker"?l.heroId:null,a=_(i=>{if(!i)return;t({kind:"ticker",heroId:i}),nt(i)},[t]);return h(()=>{o(p)},[p,o]),h(()=>{r(a)},[r,a]),{partRows:(i,{rowClick:u})=>{const m=String(i.props.id);return i.type==="Hero"&&n(B,{icon:n(L,{type:"ticker",size:13}),name:c(Se),onSelect:()=>a(m),selected:p===m,rowProps:{onClick:u(()=>a(m))},words:d})}}}function Y({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=we(),d=y().tree,{appState:l}=se(f=>f),p=l.data.content??[],a=X(p);a.current=p;const i=e,u=Pe.find(f=>H[f]===i.kind),m=u&&"nodeId"in i?N(String(i.nodeId),u):null,w=_(f=>{const s=be(f);if(!s)return;const P=a.current.findIndex(S=>String(S.props.id)===s.nodeId);if(P<0)return;const b={kind:H[s.part],nodeId:s.nodeId};t({index:P},b)},[t]);return h(()=>{o(m)},[m,o]),h(()=>{r(w)},[r,w]),{partRows:(f,{rowClick:s})=>{const P=String(f.props.id),b=Te(f);if(b.length===0)return null;const S=I=>{const g=N(P,I.part);return n(B,{icon:n(L,{type:I.part==="media"?"heroMedia":"heroImage",size:13}),name:c(I.label),onSelect:()=>w(g),selected:m===g,rowProps:{onClick:s(()=>w(g))},words:d},g)},[E,...T]=b;return k(A,{children:[S(E),T.length>0&&n(ie,{children:T.map(S)})]})}}}function G(e,t){return{partRows:(o,r)=>k(A,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function Tt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:d,docId:l,hasUnsavedEdits:p,bridgeCapabilities:a,notifyParent:i,token:u}=R(),{hasPreviewLink:m}=o,w=Pt(De()).preview?.draftLink,f=He(e.data),s=ut({hasTrustedConsole:!!u,canCreatePlatformTemplate:a.canCreatePlatformTemplate,capabilities:o,siteId:d,hasUnsavedEdits:p}),P=_(()=>{!d||!r||i(St,{siteId:d,slug:r})},[i,d,r]),b=Re({pageSlug:r,siteId:d,token:u}),S=t.previewHref?.(r)??b;return{barLead:()=>s.visible&&n($,{side:"bottom",content:s.enabled?c("Save this website as a platform template"):c(s.disabledReason),children:n("span",{className:"sf-tip-disabled",tabIndex:s.enabled?void 0:0,children:n(Q,{variant:"secondary",disabled:!s.enabled,onClick:P,rightIcon:n(ne,{size:15}),children:c("Save as Template")})})}),barTrail:()=>m&&r&&n(Oe,{liveHref:S,pageId:l??null,draftLink:w}),mainAction:f}}function bt(e,t){const{capabilities:o,templateId:r,siteId:d,tokenRef:l,navigate:p}=R(),{hasSiteTheme:a,explainsSiteSettings:i}=o,u=E=>t.setView(E),[m,w]=J(Ae[0].id),{surface:f,setSurface:s}=ue(),P=()=>{if(a){u("styles"),t.reveal(),M();return}e.show(W),e.reveal(),M()},b={id:"pages",label:c("Pages"),icon:n(te,{}),panel:({onHide:E})=>n(ce,{activeSurface:f,onPreviewSurface:s,onNavigate:T=>{s(null),p(r?{kind:"template",id:r,pageSlug:T}:{kind:"page",slug:T,siteId:d??void 0})},onClose:E})},S=[];return!a&&i&&S.push({id:"appearance",label:c("Appearance"),icon:n(re,{}),active:e.kind==="website",onSelect:P}),a&&S.push({id:"styles",label:c("Site styles"),icon:n(oe,{}),panel:({onHide:E,notify:T})=>n(ke,{tokenRef:l,siteId:d??void 0,onClose:E,onNotify:T,tab:m,onTabChange:w})}),{railLead:[b],railTrail:S,resolveLeftView:(E,T)=>Je(E,a,T),openSettings:P,openStyles:()=>{w(Be),u("styles")}}}function ht(e,t,o,r){const{kind:d,open:l}=e,{selected:p,zoneOf:a}=t;h(()=>{je(p?.type==="BookingBox"&&p.props.region==="confirm"?Ke(a(String(p.props.id))):null)},[p?.props.id]);const i=Ce(e,t),{capabilities:{hasSiteSettings:u}}=R(),{setSelected:m,setSelectHandler:w}=me(),{chat:f,setChat:s,setSelected:P,setSelectHandler:b}=de(),S=d==="header";h(()=>{m(S)},[S,m]),h(()=>{w(()=>l(D))},[w,l]);const E=_(()=>l(ge),[l]),T=d==="chat";h(()=>{P(T)},[T,P]),h(()=>{b(E)},[b,E]);const{setOpenHandler:I}=fe(),g=_(()=>l(Ie),[l]);h(()=>{I(g)},[I,g]);const K=G(x(e),Y(e)),j=Tt(t),U=bt(e,r),Z=o.device;return{...K,...j,...U,hasOwnRows:v=>v.type===_e,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,wrap:v=>n(ae.Provider,{value:!0,children:k(pe.Provider,{value:Z,children:[v,n(Ne,{})]})}),addPanelRow:v=>u?k("div",{className:"sf-addside-sitewide",children:[n("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:n(L,{type:"chat",size:16})}),k("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{v(),E()},children:[c("Live chat"),n("span",{className:"sf-addside-sitewide-desc",children:c("A chat bubble on every page")})]}),n(ee,{checked:f.enabled,onChange:q=>s({enabled:q}),ariaLabel:c("Show the chat bubble on the whole site")})]}):void 0}}let F=null,O=new WeakMap;function gt(e){const t=at();if(!e||!t)return e;F!==t&&(F=t,O=new WeakMap);let o=O.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:c(r.label)})):null,spec:e.spec?{...e.spec,addLabel:c(e.spec.addLabel)}:null},O.set(e,o)),o}const It={isLockedBlock:$e,duplicateBlocked:rt,nestDepth:(e,t,o)=>t===Ve?Me(e,o):0,newSectionNode:Et,canAddTo:(e,t)=>gt(Fe(e,t)),blockIsOffered:ze},vt=new Proxy(ct,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?c(o):o}}),kt={labelAtLevel:(e,t,o)=>c(st(e,t,o)),descriptions:vt,categoryLabel:e=>{const t=Ye(e);return t===void 0?void 0:c(t)},firstSection:Ge,blockRowName:Ue,plainText:xe,Icon:L,Thumbnail:ve,useProducts:wt},_t={desktop:2e3,tablet:800,mobile:390},z="desktop",Ct={options:le,initial:z,fluid:z,widths:_t},Lt={read:Xe,write:e=>Qe(e),forSelection:(e,t)=>qe(e,t)},Rt={first:V,last:Ze,firstGroup:ft,lastGroup:mt,isSectionGroup:lt,sectionGroupZone:pt,panelOf:e=>e===V?D:null,get groupTab(){return C()?ot:void 0},get groupBadge(){return C()?et():void 0},get changeNotice(){return C()?tt():void 0},get band(){return C()?Ot:void 0},get groupAccepts(){return C()?dt:void 0}},Ot={foldable:!0};function At(e){return{...G(x(e),Y(e)),openSettings:()=>e.show(W)}}const Do={useOwnerName:ye,useDocumentLabel:We,useBridges:ht,useStandaloneBridges:At,useDocumentPass:Le,blockRules:It,blockLook:kt,devices:Ct,leftView:Lt,pinned:Rt,Canvas:it,Inspector:he};export{Do as WEBSITE_SCREEN};
1
+ "use client";import{jsx as n,Fragment as A,jsxs as _}from"react/jsx-runtime";import{useCallback as C,useEffect as b,useRef as Q,useState as $}from"react";import{Button as ee,Tooltip as te}from"efficient-shell/ui";import{SettingsSwitch as oe}from"efficient-easel/panel";import{PagesIcon as re,StylesIcon as ne}from"efficient-easel/rail";import{PaletteIcon as ie}from"efficient-shell/icons/efficient";import{TemplateIcon as se}from"efficient-easel/icons";import{Subtree as ae,TreeRow as y}from"efficient-easel/tree";import{useEasel as ce}from"efficient-easel/easel";import{useEaselStrings as B}from"efficient-easel/strings";import{LocationsTreeContext as de}from"./LocationsTreeContext.js";import le from"./PagesPanel.js";import{usePreviewChat as pe}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as me}from"./preview-devices.js";import{PreviewDeviceContext as fe}from"efficient-easel/draw/client";import{usePreviewHeader as ue}from"../../render/components/PreviewHeaderContext.js";import{usePreviewSocial as Se}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as we}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as Ee,usePreviewTicker as Pe}from"../../render/components/PreviewTickerContext.js";import{usePreviewHeroPart as Te}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as he,HERO_PART_MODE as H,heroMediaRows as be,heroPartId as N,readHeroPartId as Ie}from"../../render/lib/puck/hero-media-parts.js";import ge,{CHAT_MODE as ve,HEADER_MODE as D,SOCIAL_MODE as ke,WEBSITE_MODE as W}from"./SectionEditor.js";import L from"./SectionIcon.js";import _e from"./SectionThumbnail.js";import{useScreenDocument as R}from"efficient-easel/screen/components/ScreenDocumentContext";import Ce from"./StylesPanel.js";import{LOCATIONS_TYPE as Le,useLocationsTree as Re}from"./useLocationsTree.js";import{usePinnedChromeSeed as Oe}from"./usePinnedChromeSeed.js";import{usePreviewHref as Ae}from"./usePreviewHref.js";import{WebsitePreviewButton as ye}from"./WebsitePreviewButton.js";import{SITE_STYLES_TABS as Be,SITE_STYLES_TEXT_TAB as He,useWebsiteName as Ne}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as De}from"./useWebsiteMainAction.js";import{VersionHistory as We}from"./VersionHistoryDrawer.js";import{useEaselSession as Ve}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Me}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as xe,heroGroupNestDepth as Ye}from"../../format/lib/hero-group-placement.js";import{stripMarkup as Fe}from"../../format/lib/markup.js";import{categoryShortLabel as Ge,PINNED_SECTION_TYPE as ze}from"../lib/puck/add-palette.js";import{canAddTo as Ke}from"../lib/puck/add-target.js";import{blockIsOffered as je}from"../lib/puck/block-offer.js";import{sectionIdOfBoxZone as Ue,setBookingPreview as Ze}from"../../render/lib/puck/booking-preview.js";import{footerBlockRowName as qe}from"../../format/lib/puck/footer-block-row-name.js";import{FOOTER_TYPE as Xe,HEADER_TYPE as V}from"../lib/puck/footer-blocks.js";import{leftViewForSelection as Je,readLeftView as Qe,resolveLeftView as $e,writeLeftView as et}from"../../format/lib/puck/left-view.js";import{websiteIsLockedBlock as tt}from"../lib/puck/locked-blocks.js";import{everyPageNotice as ot,noOwnTab as rt,pinnedReach as M,websiteDuplicateBlocked as nt}from"../lib/puck/every-page.js";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as it,scrollPreviewToTop as x}from"efficient-easel/screen/lib/puck/preview-dom";import{SiteCanvas as st}from"../lib/puck/overrides.js";import{labelAtLevel as at}from"../../format/lib/puck/section-catalog.js";import{editorWords as ct,say as c}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as dt}from"../../format/lib/puck/section-descriptions.js";import{groupAccepts as lt,isSectionGroupType as pt,sectionGroupZone as mt,SITE_FOOTER_TYPE as Y,SITE_HEADER_TYPE as ft}from"../../format/lib/puck/section-groups.js";import{resolveSaveAsTemplateAction as ut,SAVE_AS_TEMPLATE_EVENT as St}from"../../format/lib/save-as-template-action.js";import{newSectionNode as wt}from"../lib/sections/new-section-node.js";import{useHostProducts as Et}from"../lib/use-host-products.js";import{backendOf as Pt}from"../lib/website-session.js";function F({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Pe(),d=B().tree,l=e,p=l.kind==="ticker"?l.heroId:null,a=C(i=>{if(!i)return;t({kind:"ticker",heroId:i}),it(i)},[t]);return b(()=>{o(p)},[p,o]),b(()=>{r(a)},[r,a]),{partRows:(i,{rowClick:u})=>{const m=String(i.props.id);return i.type==="Hero"&&n(y,{icon:n(L,{type:"ticker",size:13}),name:c(Ee),onSelect:()=>a(m),selected:p===m,rowProps:{onClick:u(()=>a(m))},words:d})}}}function G({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=Te(),d=B().tree,{appState:l}=ce(f=>f),p=l.data.content??[],a=Q(p);a.current=p;const i=e,u=he.find(f=>H[f]===i.kind),m=u&&"nodeId"in i?N(String(i.nodeId),u):null,E=C(f=>{const s=Ie(f);if(!s)return;const P=a.current.findIndex(S=>String(S.props.id)===s.nodeId);if(P<0)return;const h={kind:H[s.part],nodeId:s.nodeId};t({index:P},h)},[t]);return b(()=>{o(m)},[m,o]),b(()=>{r(E)},[r,E]),{partRows:(f,{rowClick:s})=>{const P=String(f.props.id),h=be(f);if(h.length===0)return null;const S=g=>{const I=N(P,g.part);return n(y,{icon:n(L,{type:g.part==="media"?"heroMedia":"heroImage",size:13}),name:c(g.label),onSelect:()=>E(I),selected:m===I,rowProps:{onClick:s(()=>E(I))},words:d},I)},[w,...T]=h;return _(A,{children:[S(w),T.length>0&&n(ae,{children:T.map(S)})]})}}}function z(e,t){return{partRows:(o,r)=>_(A,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function Tt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:d,docId:l,hasUnsavedEdits:p,bridgeCapabilities:a,notifyParent:i,token:u}=R(),{hasPreviewLink:m}=o,E=Pt(Ve()).preview?.draftLink,f=De(e.data),s=ut({hasTrustedConsole:!!u,canCreatePlatformTemplate:a.canCreatePlatformTemplate,capabilities:o,siteId:d,hasUnsavedEdits:p}),P=C(()=>{!d||!r||i(St,{siteId:d,slug:r})},[i,d,r]),h=Ae({pageSlug:r,siteId:d,token:u}),S=t.previewHref?.(r)??h;return{barLead:()=>s.visible&&n(te,{side:"bottom",content:s.enabled?c("Save this website as a platform template"):c(s.disabledReason),children:n("span",{className:"sf-tip-disabled",tabIndex:s.enabled?void 0:0,children:n(ee,{variant:"secondary",disabled:!s.enabled,onClick:P,rightIcon:n(se,{size:15}),children:c("Save as Template")})})}),barTrail:()=>m&&r&&n(ye,{liveHref:S,pageId:l??null,draftLink:E}),mainAction:f}}function ht(e,t){const{capabilities:o,templateId:r,siteId:d,tokenRef:l,navigate:p}=R(),{hasSiteTheme:a,explainsSiteSettings:i}=o,u=w=>t.setView(w),[m,E]=$(Be[0].id),{surface:f,setSurface:s}=we(),P=()=>{if(a){u("styles"),t.reveal(),x();return}e.show(W),e.reveal(),x()},h={id:"pages",label:c("Pages"),icon:n(re,{}),panel:({onHide:w})=>n(le,{activeSurface:f,onPreviewSurface:s,onNavigate:T=>{s(null),p(r?{kind:"template",id:r,pageSlug:T}:{kind:"page",slug:T,siteId:d??void 0})},onClose:w})},S=[];return!a&&i&&S.push({id:"appearance",label:c("Appearance"),icon:n(ie,{}),active:e.kind==="website",onSelect:P}),a&&S.push({id:"styles",label:c("Site styles"),icon:n(ne,{}),panel:({onHide:w,notify:T})=>n(Ce,{tokenRef:l,siteId:d??void 0,onClose:w,onNotify:T,tab:m,onTabChange:E})}),{railLead:[h],railTrail:S,resolveLeftView:(w,T)=>$e(w,a,T),openSettings:P,openStyles:()=>{E(He),u("styles")}}}function bt(e,t,o,r){const{kind:d,open:l}=e,{selected:p,zoneOf:a}=t;b(()=>{Ze(p?.type==="BookingBox"&&p.props.region==="confirm"?Ue(a(String(p.props.id))):null)},[p?.props.id]);const i=Re(e,t),{capabilities:{hasSiteSettings:u}}=R(),{setSelected:m,setSelectHandler:E}=ue(),{chat:f,setChat:s,setSelected:P,setSelectHandler:h}=pe(),S=d==="header";b(()=>{m(S)},[S,m]),b(()=>{E(()=>l(D))},[E,l]);const w=C(()=>l(ve),[l]),T=d==="chat";b(()=>{P(T)},[T,P]),b(()=>{h(w)},[h,w]);const{setOpenHandler:g}=Se(),I=C(()=>l(ke),[l]);b(()=>{g(I)},[g,I]);const U=z(F(e),G(e)),Z=Tt(t),q=ht(e,r),X=o.device;return{...U,...Z,...q,hasOwnRows:k=>k.type===Le,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,wrap:k=>n(de.Provider,{value:!0,children:_(fe.Provider,{value:X,children:[k,n(We,{})]})}),addPanelRow:k=>u?_("div",{className:"sf-addside-sitewide",children:[n("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:n(L,{type:"chat",size:16})}),_("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),w()},children:[c("Live chat"),n("span",{className:"sf-addside-sitewide-desc",children:c("A chat bubble on every page")})]}),n(oe,{checked:f.enabled,onChange:J=>s({enabled:J}),ariaLabel:c("Show the chat bubble on the whole site")})]}):void 0}}let K=null,O=new WeakMap;function It(e){const t=ct();if(!e||!t)return e;K!==t&&(K=t,O=new WeakMap);let o=O.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:c(r.label)})):null,spec:e.spec?{...e.spec,addLabel:c(e.spec.addLabel)}:null},O.set(e,o)),o}const gt={isLockedBlock:tt,duplicateBlocked:nt,nestDepth:(e,t,o)=>t===xe?Ye(e,o):0,newSectionNode:wt,canAddTo:(e,t)=>It(Ke(e,t)),blockIsOffered:je},vt=new Proxy(dt,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?c(o):o}}),kt={labelAtLevel:(e,t,o)=>c(at(e,t,o)),descriptions:vt,categoryLabel:e=>{const t=Ge(e);return t===void 0?void 0:c(t)},firstSection:ze,blockRowName:qe,plainText:Fe,Icon:L,Thumbnail:_e,useProducts:Et},_t={desktop:2e3,tablet:800,mobile:390},j="desktop",Ct={options:me,initial:j,fluid:j,widths:_t},Lt={read:Qe,write:e=>et(e),forSelection:(e,t)=>Je(e,t)},Rt={first:V,last:Xe,firstGroup:ft,lastGroup:Y,isSectionGroup:pt,sectionGroupZone:mt,panelOf:e=>e===V?D:null,get sharedReach(){return v()?M:void 0},get groupTab(){return v()?rt:void 0},get groupBadge(){return v()?M({type:Y})??void 0:void 0},get changeNotice(){return v()?ot():void 0},get band(){return v()?Ot:void 0},get groupAccepts(){return v()?lt:void 0}},Ot={foldable:!0};function At(e){return{...z(F(e),G(e)),openSettings:()=>e.show(W)}}const Do={useOwnerName:Ne,useDocumentLabel:Me,useBridges:bt,useStandaloneBridges:At,useDocumentPass:Oe,blockRules:gt,blockLook:kt,devices:Ct,leftView:Lt,pinned:Rt,Canvas:st,Inspector:ge};export{Do as WEBSITE_SCREEN};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{ColumnsIcon as s,StylesIcon as d}from"efficient-easel/icons";import{copyText as i,group as t,plainTextarea as m,select as y,slider as n,text as p,textarea as C}from"../../../controls.js";import{SPLITTABLE_SECTIONS as b,headFieldsForPlacement as S,widthFieldsForParent as f}from"../../../../../../format/lib/sections/section-head-placement.js";import{SECTION_EYEBROW_LOOK_OPTIONS as _,eyebrowLookFor as I}from"../../../../../../format/lib/sections/section-eyebrow-look.js";import{WIDTH_ROW_KEYS as c}from"../../shared-fields.js";import{CARDS_PH as r}from"../../../../../../render/lib/puck/blocks/general/Cards/render.js";const u={fields:{_gContent:t("Content"),eyebrow:p("Eyebrow",r.eyebrow),eyebrowLook:y("Eyebrow style",o(d,{}),[..._],I("Cards")),title:C("Heading",r.title),items:{type:"array",label:"Cards",arrayFields:{title:i("Card title"),body:m("Card body")},defaultItemProps:{title:"",body:""},getItemSummary:e=>e?.title||e?.body||"Card"},_gStyle:t("Style"),columns:n("Columns",o(s,{}),2,4,1,3)},resolveFields:(e,{fields:l,parent:a})=>S(f(l,a,c),e.props.headPlacement,b.Cards.headRows)};export{u as CardsFields};
1
+ import{jsx as o}from"react/jsx-runtime";import{ColumnsIcon as p,StylesIcon as a}from"efficient-easel/icons";import{copyText as s,group as i,plainText as c,plainTextarea as f,select as d,slider as C,text as S,textarea as u,withOffPage as w}from"../../../controls.js";import{SPLITTABLE_SECTIONS as F,headFieldsForPlacement as L,widthFieldsForParent as _}from"../../../../../../format/lib/sections/section-head-placement.js";import{SECTION_EYEBROW_LOOK_OPTIONS as I,eyebrowLookFor as y}from"../../../../../../format/lib/sections/section-eyebrow-look.js";import{WIDTH_ROW_KEYS as O}from"../../shared-fields.js";import{CARDS_PH as m}from"../../../../../../render/lib/puck/blocks/general/Cards/render.js";const R={fields:{_gContent:i("Content"),eyebrow:S("Eyebrow",m.eyebrow),eyebrowLook:d("Eyebrow style",o(a,{}),[...I],y("Cards")),title:u("Heading",m.title),items:{type:"array",label:"Cards",arrayFields:{title:s("Card title"),body:f("Card body")},defaultItemProps:{title:"",body:""},getItemSummary:e=>e?.title||e?.body||"Card"},_gStyle:i("Style"),cardStyle:d("Card style",o(a,{}),[{label:"Cards",value:"cards"},{label:"Label only",value:"label-only"}],"cards"),columns:C("Columns",o(p,{}),2,4,1,3)},resolveFields:(e,{fields:n,parent:b})=>{const r=L(_(n,b,O),e.props.headPlacement,F.Cards.headRows);if(e.props.cardStyle!=="label-only")return r;const t=r.items,l=r.eyebrowLook;return{...r,...t?{items:{...t,arrayFields:{title:s("Feature label"),href:w(c("Link"))}}}:{},...l?{eyebrowLook:{...l,fallback:y("KeyFeatures")}}:{}}}};export{R as CardsFields};
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{EyeIcon as m}from"efficient-easel/icons";import{copyText as s,group as l,plainTextarea as r,section as t,select as p,text as i,textarea as o,upload as g}from"../../../controls.js";import{ctaField as d,innerSpacingFields as y}from"../../shared-fields.js";import{TIMELINE_PH as e}from"../../../../../../render/lib/puck/blocks/general/Timeline/render.js";const x={fields:{_dLayout:t("Layout"),layout:p("Display",n(m,{}),[{label:"Split (editorial aside)",value:"split"},{label:"Spine (single rail)",value:"spine"},{label:"Alternating (zig-zag)",value:"alternating"}],"split"),...y("Timeline"),_sHeader:t("Header"),_gContent:l("Content"),eyebrow:i("Eyebrow",e.eyebrow),title:o("Heading",e.title),intro:o("Intro",e.intro),imageSrc:g("Image","image/*"),imageCaption:i("Image caption",e.imageCaption),imageMeta:i("Image meta",e.imageMeta),_gButton:l("Button"),...d,_sEntries:t("Timeline entries"),entries:{type:"array",label:"Entries",arrayFields:{date:s("Sub-title"),title:r("Title"),body:r("Body")},defaultItemProps:{date:"",title:"",body:""},getItemSummary:a=>a?.date||a?.title||"Entry"}}};export{x as TimelineFields};
1
+ import{jsx as l}from"react/jsx-runtime";import{ClockIcon as p,EyeIcon as d}from"efficient-easel/icons";import{backgroundField as c,copyText as u,group as n,plainTextarea as s,section as a,select as y,text as r,textarea as m,toggle as T,upload as b}from"../../../controls.js";import{ctaField as I,innerSpacingFields as _}from"../../shared-fields.js";import{SECTION_BG_BUILT_IN as f}from"../../../../../../format/lib/puck/blocks/general/section-bg-built-in.js";import{withRowRules as k}from"../../../../../../render/lib/puck/show-when.js";import{TIMELINE_PH as e}from"../../../../../../render/lib/puck/blocks/general/Timeline/render.js";const g={field:"layout",is:"track"},C={not:g},H={fields:k({_dLayout:a("Layout"),layout:y("Display",l(d,{}),[{label:"Split (editorial aside)",value:"split"},{label:"Spine (single rail)",value:"spine"},{label:"Alternating (zig-zag)",value:"alternating"},{label:"Track (year rail)",value:"track"}],"split"),..._("Timeline"),_dDesign:a("Design"),background:c("Background color",f.TimelineTrack),_sHeader:a("Header"),_gContent:n("Content"),eyebrow:r("Eyebrow",e.eyebrow),title:m("Heading",e.title),intro:m("Intro",e.intro),imageSrc:b("Image","image/*"),imageCaption:r("Image caption",e.imageCaption),imageMeta:r("Image meta",e.imageMeta),_gButton:n("Button"),...I,_sEntries:a("Timeline entries"),entries:{type:"array",label:"Entries",arrayFields:{date:u("Sub-title"),title:s("Title"),body:s("Body")},defaultItemProps:{date:"",title:"",body:""},getItemSummary:t=>t?.date||t?.title||"Entry"}},[[["imageSrc","imageCaption","imageMeta"],C],[["background"],g]]),resolveFields:(t,{fields:i})=>{if(t.props.layout!=="track")return i;const o=i.entries;return{...i,entries:{...o,arrayFields:{...o?.arrayFields,future:T("Upcoming",!1,l(p,{}))}}}}};export{H as TimelineFields};
@@ -1,2 +1,2 @@
1
- export declare const generalBlocks: Record<"Grid" | "Flex" | "HeroGroup" | "Ticker" | "Prose" | "Logos" | "Divider" | "LogoBlock" | "Text" | "Hero" | "HeroSingle" | "IntroBleed" | "SpecStrip" | "ProcessSteps" | "OrderSummary" | "PaymentBadges" | "Manifesto" | "Timeline" | "TimelineTrack" | "Footprint" | "ParagraphsA" | "Split" | "Cards" | "KeyFeatures" | "Stats" | "StatsParagraph" | "Chart" | "Mockup" | "Testimonials" | "Banner" | "TitleWithButtons" | "Countdown" | "Masthead" | "FeaturedCover" | "LongRead" | "Series" | "Breadcrumb" | "CategoryBar" | "DocTabs" | "DocMasthead" | "DocBody" | "DocMetaCards" | "FAQ" | "ContactLocations" | "SectionHeader" | "Spacer" | "CustomHTML" | "Heading" | "Eyebrow" | "ImageBlock" | "ButtonBlock" | "PostCard" | "HeroSlide" | "Integrations", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
2
- export declare const assembleGeneralBlocks: () => Record<"Grid" | "Flex" | "HeroGroup" | "Ticker" | "Prose" | "Logos" | "Divider" | "LogoBlock" | "Text" | "Hero" | "HeroSingle" | "IntroBleed" | "SpecStrip" | "ProcessSteps" | "OrderSummary" | "PaymentBadges" | "Manifesto" | "Timeline" | "TimelineTrack" | "Footprint" | "ParagraphsA" | "Split" | "Cards" | "KeyFeatures" | "Stats" | "StatsParagraph" | "Chart" | "Mockup" | "Testimonials" | "Banner" | "TitleWithButtons" | "Countdown" | "Masthead" | "FeaturedCover" | "LongRead" | "Series" | "Breadcrumb" | "CategoryBar" | "DocTabs" | "DocMasthead" | "DocBody" | "DocMetaCards" | "FAQ" | "ContactLocations" | "SectionHeader" | "Spacer" | "CustomHTML" | "Heading" | "Eyebrow" | "ImageBlock" | "ButtonBlock" | "PostCard" | "HeroSlide" | "Integrations", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
1
+ export declare const generalBlocks: Record<"Grid" | "Flex" | "HeroGroup" | "Ticker" | "Prose" | "Logos" | "Divider" | "LogoBlock" | "Text" | "Hero" | "HeroSingle" | "IntroBleed" | "SpecStrip" | "ProcessSteps" | "OrderSummary" | "PaymentBadges" | "Manifesto" | "Timeline" | "Footprint" | "ParagraphsA" | "Split" | "Cards" | "Stats" | "StatsParagraph" | "Chart" | "Mockup" | "Testimonials" | "Banner" | "TitleWithButtons" | "Countdown" | "Masthead" | "FeaturedCover" | "LongRead" | "Series" | "Breadcrumb" | "CategoryBar" | "DocTabs" | "DocMasthead" | "DocBody" | "DocMetaCards" | "FAQ" | "ContactLocations" | "SectionHeader" | "Spacer" | "CustomHTML" | "TimelineTrack" | "KeyFeatures" | "Heading" | "Eyebrow" | "ImageBlock" | "ButtonBlock" | "PostCard" | "HeroSlide" | "Integrations", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
2
+ export declare const assembleGeneralBlocks: () => Record<"Grid" | "Flex" | "HeroGroup" | "Ticker" | "Prose" | "Logos" | "Divider" | "LogoBlock" | "Text" | "Hero" | "HeroSingle" | "IntroBleed" | "SpecStrip" | "ProcessSteps" | "OrderSummary" | "PaymentBadges" | "Manifesto" | "Timeline" | "Footprint" | "ParagraphsA" | "Split" | "Cards" | "Stats" | "StatsParagraph" | "Chart" | "Mockup" | "Testimonials" | "Banner" | "TitleWithButtons" | "Countdown" | "Masthead" | "FeaturedCover" | "LongRead" | "Series" | "Breadcrumb" | "CategoryBar" | "DocTabs" | "DocMasthead" | "DocBody" | "DocMetaCards" | "FAQ" | "ContactLocations" | "SectionHeader" | "Spacer" | "CustomHTML" | "TimelineTrack" | "KeyFeatures" | "Heading" | "Eyebrow" | "ImageBlock" | "ButtonBlock" | "PostCard" | "HeroSlide" | "Integrations", import("efficient-easel/blocks").ComponentConfig<any, any, Omit<import("efficient-easel/blocks").ComponentData<any, string, Record<string, import("efficient-easel/blocks").DefaultComponentProps>>, "type">>>;
@@ -1,4 +1,5 @@
1
1
  import { type ReactElement, type ReactNode } from "react";
2
+ import type { MediaValue } from "../../../format/lib/media-value.js";
2
3
  import { readHidable, hidableText, type HidableValue } from "efficient-easel/draw";
3
4
  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";
4
5
  import type { ShowWhenRule } from "../../../render/lib/puck/show-when.js";
@@ -375,7 +376,7 @@ export declare function segmented<V>(label: string, icon: ReactElement, options:
375
376
  export declare function upload(label: string, accept: string, placeholder?: string, opts?: {
376
377
  focus?: string;
377
378
  focusWhen?: (props: Record<string, unknown>) => boolean;
378
- }): CustomField<string>;
379
+ }): CustomField<MediaValue>;
379
380
  export declare const CUSTOM_FIELD_MEDIA: Record<string, string[]>;
380
381
  export declare function CoordsField({ value, onChange, label, }: {
381
382
  value: GeocodeState | undefined;
@@ -1,7 +1,7 @@
1
- export declare function pinnedGroupTab(node: {
1
+ export declare function pinnedReach(node: {
2
2
  type?: string;
3
3
  }): string | null;
4
- export declare const everyPageBadge: () => string;
4
+ export declare const noOwnTab: () => string | null;
5
5
  export declare const everyPageNotice: () => string;
6
6
  export declare function websiteDuplicateBlocked(data: unknown, item: unknown): string | null;
7
7
  export declare const EVERY_PAGE_PHRASES: readonly string[];
@@ -1 +1 @@
1
- import{say as e}from"../../../format/lib/editor-words.js";import{FOOTER_TYPE as p,HEADER_TYPE as h}from"./footer-blocks.js";import{duplicateBlocked as c}from"../../../format/lib/hero-group-placement.js";import{groupDuplicateRefusal as d,SITE_FOOTER_TYPE as l,SITE_HEADER_TYPE as s}from"../../../format/lib/puck/section-groups.js";function i(o){switch(o?.type){case s:return e("Header · on every page");case l:return e("Footer · on every page");case h:return e("Header · on every page · old style");case p:return e("Footer · on every page · old style");default:return null}}const E=()=>e("Every page"),T=()=>e("Changed on every page");function v(o,r){const n=c(o,r);if(n)return n;const t=d(o,r);if(!t)return null;const a=t.group===s;return t.why==="type"?a?e("The header cannot take another one of these"):e("The footer cannot take another one of these"):a?e("The header holds at most 3 sections"):e("The footer holds at most 6 sections")}const m=["Header · on every page","Footer · on every page","Header · on every page · old style","Footer · on every page · old style","Every page","Changed on every page","The header cannot take another one of these","The footer cannot take another one of these","The header holds at most 3 sections","The footer holds at most 6 sections"];export{m as EVERY_PAGE_PHRASES,E as everyPageBadge,T as everyPageNotice,i as pinnedGroupTab,v as websiteDuplicateBlocked};
1
+ import{say as e}from"../../../format/lib/editor-words.js";import{FOOTER_TYPE as h,HEADER_TYPE as c}from"./footer-blocks.js";import{duplicateBlocked as p}from"../../../format/lib/hero-group-placement.js";import{groupDuplicateRefusal as l,SITE_FOOTER_TYPE as f,SITE_HEADER_TYPE as s}from"../../../format/lib/puck/section-groups.js";function E(o){switch(o?.type){case s:case f:return e("On every page");case c:case h:return e("On every page · old style");default:return null}}const y=()=>null,g=()=>e("Changed on every page");function m(o,n){const r=p(o,n);if(r)return r;const t=l(o,n);if(!t)return null;const a=t.group===s;return t.why==="type"?a?e("The header cannot take another one of these"):e("The footer cannot take another one of these"):a?e("The header holds at most 3 sections"):e("The footer holds at most 6 sections")}const O=["On every page","On every page · old style","Changed on every page","The header cannot take another one of these","The footer cannot take another one of these","The header holds at most 3 sections","The footer holds at most 6 sections"];export{O as EVERY_PAGE_PHRASES,g as everyPageNotice,y as noOwnTab,E as pinnedReach,m as websiteDuplicateBlocked};
@@ -19,5 +19,7 @@ export declare function resolvePartStamps(host: PartHost, nodeId: string, needle
19
19
  export declare function applyPartStamps(host: PartHost, nodeId: string, stamps: readonly PartStamp[]): PartEl[];
20
20
  export type PartAnchorHost = PartHost;
21
21
  export declare function engagePartAnchors(host: PartAnchorHost, needles: readonly PartNeedle[], ownWrapper: () => PartEl | null, watchWrapperStamp: (onStamp: () => void) => (() => void) | null, onEngage: (wrapper: PartEl, nodeId: string, stamped: PartEl[]) => void, watchSubtree?: (onChange: () => void) => (() => void) | null): () => void;
22
- export declare function partIdForClick(target: PartEl | null | undefined, nodeId: string): string;
23
- export declare function isPartClick(partId: string, nodeId: string): boolean;
22
+ export declare function partOfBlockAt(target: Element | null | undefined, ownerId: string): {
23
+ id: string;
24
+ element: Element;
25
+ } | null;
@@ -1 +1 @@
1
- import{encodePartKey as C}from"../../../format/lib/puck/part-key.js";import{PART_ATTR as S,PART_KIND_ATTR as _,encodePartId as T,normalizePartText as $}from"../../../render/lib/puck/text-parts.js";const K="data-puck-component";function I(r,n){return r.closest(`[${K}]`)?.getAttribute(K)===n}function R(r,n,m){const u=r.querySelectorAll("*"),h=[],a=new Set;for(let t=0;t<u.length;t+=1){const e=u[t];if(!I(e,n))continue;const o=e.getAttribute(_);o&&(h.push({element:e,partId:T(n,o)}),a.add(e))}const l=[];for(let t=0;t<u.length;t+=1){const e=u[t];if(!I(e,n)||a.has(e))continue;const o=$(e.textContent??"");o&&l.push({element:e,text:o})}const f=new Map,y=[],k=t=>t.row?`${t.key}.${t.row.rowKey}`:null,d=new Map;for(const t of m){const e=k(t);if(!e)continue;const o=d.get(e);o?o.push(t):d.set(e,[t])}const p=new Set;for(const[t,e]of d){if(e.length<2)continue;const o=e.flatMap(i=>i.texts);if(new Set(o).size===o.length)continue;const s=l.filter(i=>o.includes(i.text));if(s.length!==e.length)continue;const g=[...e].sort((i,A)=>(i.row?.index??0)-(A.row?.index??0));for(let i=0;i<g.length;i+=1){const A=g[i],c=s[i].element,x={key:A.key,partKey:C(A.key,A.row),exact:!0},P=f.get(c);P?P.push(x):(f.set(c,[x]),y.push(c))}p.add(t)}for(const t of m){if(p.has(k(t)??""))continue;const e=C(t.key,t.row);for(const o of t.texts){const s=[];let g=null;for(const c of l)c.text===o?s.push(c.element):!s.length&&c.text.includes(o)&&(!g||c.text.length<=g.length)&&(g={element:c.element,length:c.text.length});const i=s.length?s:g?[g.element]:[],A=i.filter(c=>!i.some(x=>x!==c&&c.contains(x)));for(const c of A){const x={key:t.key,partKey:e,exact:s.length>0},P=f.get(c);P?P.push(x):(f.set(c,[x]),y.push(c))}}}const w=[...h];for(const t of y){const e=f.get(t)??[],o=e.some(s=>s.exact)?e.filter(s=>s.exact):e;if(new Set(o.map(s=>s.partKey)).size===1){w.push({element:t,partId:T(n,o[0].partKey)});continue}new Set(o.map(s=>s.key)).size===1&&w.push({element:t,partId:T(n,o[0].key)})}return w}function b(r,n,m){const u=r.querySelectorAll(`[${S}]`);for(let a=0;a<u.length;a+=1){const l=u[a];I(l,n)&&l.removeAttribute(S)}const h=[];for(const{element:a,partId:l}of m)a.setAttribute(S,l),h.push(a);return h}function v(r,n,m,u,h,a=()=>null){let l=null,f=null,y=null;const k=()=>{const d=m(),p=d?.getAttribute(K)??null;if(!d||!p)return!1;l=p;let w=R(r,p,n);return h(d,p,b(r,p,w)),y=a(()=>{const t=R(r,p,n);z(w,t)||(w=t,h(d,p,b(r,p,t)))}),!0};return k()||(f=u(()=>{(l||k())&&(f?.(),f=null)})),()=>{f?.(),f=null,y?.(),y=null,l&&b(r,l,[])}}function z(r,n){return r.length===n.length&&r.every((m,u)=>m.element===n[u].element&&m.partId===n[u].partId)}function O(r,n){return r?.closest(`[${S}]`)?.getAttribute(S)??T(n,null)}function q(r,n){return r!==T(n,null)}export{K as PUCK_COMPONENT_ATTR,b as applyPartStamps,v as engagePartAnchors,q as isPartClick,O as partIdForClick,R as resolvePartStamps};
1
+ import{encodePartKey as b}from"../../../format/lib/puck/part-key.js";import{PART_ATTR as P,PART_KIND_ATTR as N,REGION_PART_ATTR as _,decodePartId as O,encodePartId as S,normalizePartText as z}from"../../../render/lib/puck/text-parts.js";const I="data-puck-component";function K(c,o){return c.closest(`[${I}]`)?.getAttribute(I)===o}function $(c,o,i){const r=c.querySelectorAll("*"),f=[],p=new Set;for(let t=0;t<r.length;t+=1){const e=r[t];if(!K(e,o))continue;const n=e.getAttribute(N);n&&(f.push({element:e,partId:S(o,n)}),p.add(e))}const u=[];for(let t=0;t<r.length;t+=1){const e=r[t];if(!K(e,o)||p.has(e))continue;const n=z(e.textContent??"");n&&u.push({element:e,text:n})}const m=new Map,y=[],T=t=>t.row?`${t.key}.${t.row.rowKey}`:null,g=new Map;for(const t of i){const e=T(t);if(!e)continue;const n=g.get(e);n?n.push(t):g.set(e,[t])}const d=new Set;for(const[t,e]of g){if(e.length<2)continue;const n=e.flatMap(a=>a.texts);if(new Set(n).size===n.length)continue;const l=u.filter(a=>n.includes(a.text));if(l.length!==e.length)continue;const h=[...e].sort((a,w)=>(a.row?.index??0)-(w.row?.index??0));for(let a=0;a<h.length;a+=1){const w=h[a],s=l[a].element,x={key:w.key,partKey:b(w.key,w.row),exact:!0},k=m.get(s);k?k.push(x):(m.set(s,[x]),y.push(s))}d.add(t)}for(const t of i){if(d.has(T(t)??""))continue;const e=b(t.key,t.row);for(const n of t.texts){const l=[];let h=null;for(const s of u)s.text===n?l.push(s.element):!l.length&&s.text.includes(n)&&(!h||s.text.length<=h.length)&&(h={element:s.element,length:s.text.length});const a=l.length?l:h?[h.element]:[],w=a.filter(s=>!a.some(x=>x!==s&&s.contains(x)));for(const s of w){const x={key:t.key,partKey:e,exact:l.length>0},k=m.get(s);k?k.push(x):(m.set(s,[x]),y.push(s))}}}const A=[...f];for(const t of y){const e=m.get(t)??[],n=e.some(l=>l.exact)?e.filter(l=>l.exact):e;if(new Set(n.map(l=>l.partKey)).size===1){A.push({element:t,partId:S(o,n[0].partKey)});continue}new Set(n.map(l=>l.key)).size===1&&A.push({element:t,partId:S(o,n[0].key)})}return A}function R(c,o,i){const r=c.querySelectorAll(`[${P}]`);for(let p=0;p<r.length;p+=1){const u=r[p];K(u,o)&&u.removeAttribute(P)}const f=[];for(const{element:p,partId:u}of i)p.setAttribute(P,u),f.push(p);return f}function q(c,o,i,r,f,p=()=>null){let u=null,m=null,y=null;const T=()=>{const g=i(),d=g?.getAttribute(I)??null;if(!g||!d)return!1;u=d;let A=$(c,d,o);return f(g,d,R(c,d,A)),y=p(()=>{const t=$(c,d,o);C(A,t)||(A=t,f(g,d,R(c,d,t)))}),!0};return T()||(m=r(()=>{(u||T())&&(m?.(),m=null)})),()=>{m?.(),m=null,y?.(),y=null,u&&R(c,u,[])}}function C(c,o){return c.length===o.length&&c.every((i,r)=>i.element===o[r].element&&i.partId===o[r].partId)}function B(c,o){const i=c?.closest?.(`[${P}],[${_}]`),r=i?.getAttribute(P)??i?.getAttribute(_),f=r?O(r):null;return i&&r&&f?.nodeId===o&&f.propKey?{id:r,element:i}:null}export{I as PUCK_COMPONENT_ATTR,R as applyPartStamps,q as engagePartAnchors,B as partOfBlockAt,$ as resolvePartStamps};
@@ -1,6 +1,8 @@
1
- import type { TextStyle, TextStyleCase } from "efficient-easel/text-styles";
1
+ import { type TextStyle, type TextStyleCase } from "efficient-easel/text-styles";
2
2
  import { type FontRole, type FontsValue } from "../../format/lib/fonts.js";
3
3
  import { type PartStyle } from "../../render/lib/puck/part-styles.js";
4
+ import { faceClassOf } from "../../format/lib/text-style-face.js";
5
+ export { faceClassOf };
4
6
  import type { SiteThemeRow, SiteThemeRowPatch } from "../../format/lib/site-theme-row.js";
5
7
  import { type HeadingCompression, type ResolvedHeadingTypography, type SizesValue } from "../../format/lib/theme.js";
6
8
  export type StoredTextStyleValues = {
@@ -64,7 +66,6 @@ export declare function themeWithTextStyles<T extends {
64
66
  headingTypography?: unknown;
65
67
  textStyles?: unknown;
66
68
  }>(theme: T): T;
67
- export declare function faceClassOf(style: Pick<StoredTextStyle, "id">): string;
68
69
  export declare function textStylesCss(list: readonly StoredTextStyle[]): string;
69
70
  export declare function accentItalicCss(italic: boolean | null | undefined): string;
70
71
  export declare function styleIdOfRole(role: FontRole | null | undefined): string | undefined;