efficient-web-builder 33.0.0 → 35.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 (71) hide show
  1. package/CHANGELOG.md +71 -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/lib/puck/blocks/general/Cards/fields.js +1 -1
  12. package/dist/editor/lib/puck/blocks/general/Timeline/fields.js +1 -1
  13. package/dist/editor/lib/puck/blocks/general/index.d.ts +2 -2
  14. package/dist/editor/lib/puck/controls.d.ts +2 -1
  15. package/dist/editor/lib/puck/part-anchors.d.ts +4 -2
  16. package/dist/editor/lib/puck/part-anchors.js +1 -1
  17. package/dist/editor/lib/site-text-styles.d.ts +3 -2
  18. package/dist/editor/lib/site-text-styles.js +2 -2
  19. package/dist/format/lib/content/contact.d.ts +0 -2
  20. package/dist/format/lib/content/contact.js +2 -2
  21. package/dist/format/lib/content/footprint.d.ts +3 -3
  22. package/dist/format/lib/content/footprint.js +1 -1
  23. package/dist/format/lib/editor-words-catalogue.d.ts +4 -0
  24. package/dist/format/lib/editor-words-catalogue.js +2 -2
  25. package/dist/format/lib/map-styles.d.ts +1 -27
  26. package/dist/format/lib/map-styles.js +1 -1
  27. package/dist/format/lib/media-value.d.ts +9 -0
  28. package/dist/format/lib/media-value.js +1 -0
  29. package/dist/format/lib/puck/passes/media-values.d.ts +3 -0
  30. package/dist/format/lib/puck/passes/media-values.js +1 -0
  31. package/dist/format/lib/puck/section-catalog.js +7 -1
  32. package/dist/format/lib/puck/templateFields.js +1 -1
  33. package/dist/format/lib/text-style-face.d.ts +3 -0
  34. package/dist/format/lib/text-style-face.js +1 -0
  35. package/dist/render/components/ContactLocations.d.ts +1 -3
  36. package/dist/render/components/ContactLocations.js +6 -26
  37. package/dist/render/components/DealerFinder.d.ts +1 -1
  38. package/dist/render/components/DealerFinder.js +1 -1
  39. package/dist/render/components/Footprint.d.ts +2 -4
  40. package/dist/render/components/Footprint.js +1 -27
  41. package/dist/render/components/Heading.d.ts +7 -1
  42. package/dist/render/components/Heading.js +1 -1
  43. package/dist/render/components/PartStyledKind.js +1 -1
  44. package/dist/render/components/PartStyledText.js +1 -1
  45. package/dist/render/components/PublishedPartStylesContext.js +1 -1
  46. package/dist/render/components/SiteMap.d.ts +19 -0
  47. package/dist/render/components/SiteMap.js +1 -0
  48. package/dist/render/components/Text.d.ts +2 -1
  49. package/dist/render/components/Text.js +1 -1
  50. package/dist/render/components/useCountUp.js +1 -1
  51. package/dist/render/lib/puck/blocks/general/Cards/render.d.ts +1 -0
  52. package/dist/render/lib/puck/blocks/general/Cards/render.js +1 -1
  53. package/dist/render/lib/puck/blocks/general/ContactLocations/render.js +1 -1
  54. package/dist/render/lib/puck/blocks/general/Footprint/render.js +2 -2
  55. package/dist/render/lib/puck/blocks/general/KeyFeatures/render.d.ts +2 -0
  56. package/dist/render/lib/puck/blocks/general/KeyFeatures/render.js +1 -1
  57. package/dist/render/lib/puck/blocks/general/Text/render.js +1 -1
  58. package/dist/render/lib/puck/blocks/general/Timeline/render.d.ts +2 -0
  59. package/dist/render/lib/puck/blocks/general/Timeline/render.js +2 -2
  60. package/dist/render/lib/puck/blocks/general/TimelineTrack/render.d.ts +2 -0
  61. package/dist/render/lib/puck/blocks/general/TimelineTrack/render.js +1 -1
  62. package/dist/render/lib/puck/part-styles.d.ts +13 -3
  63. package/dist/render/lib/puck/part-styles.js +2 -2
  64. package/dist/render/lib/puck/passes/index.js +1 -1
  65. package/dist/render/lib/puck/text-parts.d.ts +1 -0
  66. package/dist/render/lib/puck/text-parts.js +1 -1
  67. package/package.json +3 -4
  68. package/dist/format/lib/maps-loader.d.ts +0 -8
  69. package/dist/format/lib/maps-loader.js +0 -1
  70. package/dist/render/lib/maps-config.d.ts +0 -16
  71. package/dist/render/lib/maps-config.js +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,77 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 35.0.0 - 2026-10-22
6
+
7
+ ### Added
8
+
9
+ - **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.
10
+ - `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).
11
+ - 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.
12
+ - The template canvas blanks a picture that names its file to `""`, as it blanks a URL (`lib/puck/templateFields`, now on `mapAtMediaPath`).
13
+ - The picture row (`components/MediaUploadField`, used by `upload()` and the Locations photo) takes a `MediaValue` and shows its `src`. `upload()` is a `CustomField<MediaValue>`.
14
+ - **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.
15
+ - **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.
16
+ - **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.
17
+ - 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.
18
+ - **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.
19
+ - 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.
20
+ - 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.
21
+ - 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.
22
+ - 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`).
23
+
24
+ ### Changed
25
+
26
+ - **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.
27
+ - **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:
28
+ - a section WITH slots: the first click picks the section, the next its heading (before: the heading at once, whatever was selected);
29
+ - 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);
30
+ - Escape leaves a part and keeps its block (before: stuck on the part);
31
+ - an outer section never claims an inner block's words (the old listener had no owner check).
32
+ - `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.
33
+ - 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`.
34
+ - **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).
35
+ - **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).
36
+
37
+ ### Guards
38
+
39
+ - `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.
40
+ - `test-publish-main-action`, `test-two-ways-to-add`: the easel range is ^17.
41
+ - New `scripts/test-media-values.tsx` (red first: ImageBlock drew differently when its picture named its file).
42
+ - `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.
43
+ - `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.
44
+ - 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.
45
+
46
+ ## 34.0.0 - 2026-10-22
47
+
48
+ ### Changed
49
+
50
+ - **One map for every website section** (SSOT batch 7; owner 2026-10-17: one map system). The Locations Map's typed offices and every Contact / Locations card now draw efficient-shell's map in its site look (MapLibre over OpenFreeMap tiles, no key), the same map the Locations Map's dealers mode already drew. Google Maps is gone from the builder.
51
+ - New `components/SiteMap`: the ONE map part. It holds the site look (`--rosh-map-*` from the site's tokens), the "Map theme" (light or dark tiles, "Auto" follows the page) and starts the map only near the screen. DealerFinder, Footprint and ContactLocations draw through it.
52
+ - Footprint: one pin per office with a real coordinate (`footprintPins` in `lib/content/footprint`); the head office's pin carries an "HQ" tag (the old map drew it larger). The Google popup is the shell map's card beside the pin: role, city, country and a close button. The legend and the map still select each other.
53
+ - ContactLocations: each card's map is the site map with its one pin, at zoom 13 as before. The name and "Get Directions" stand over it as before.
54
+ - What a shopper sees changes: the map tiles (OpenFreeMap light / dark in place of the styled Google map), the pins (the site's accent colour in place of the gold disc), and the popup (the shell map's card). The merchant's panels do not change. No stored value changes.
55
+ - **BREAKING: `lib/maps-loader` (format) and `lib/maps-config` (render) are deleted**, with `SiteMapsProvider`, `useSiteMapsKey`, `useSiteMapId`, `resolveMapsKey`, `resolveMapId`, `loadGoogleMaps`, `watchMapLoad`, `GOOGLE_MAPS_API_KEY` and the editor's maps-key bridge. A host stops mounting a maps provider: efficient-storefront-blocks (`LiveSiteMapsProvider`, `scripts/test-maps-key.tsx`) and efficient-storefront (`app/layout.tsx`, its Google map scripts) move in their own pull requests.
56
+ - **BREAKING: `lib/map-styles` keeps only `MapThemeMode`, `mapModeIsLight`, `watchMapTheme` and `hasMapCoords`** (moved here from `lib/maps-loader`). The Google style arrays and palettes are gone.
57
+ - **BREAKING: `FootprintProps` and `ContactLocationsProps` lose `apiKey` and `mapId`**, and `FOOTPRINT_DEFAULTS` / `CONTACT_LOCATIONS_DEFAULTS` lose them too. They had no settings row; a stored value is left as it is and read by nothing.
58
+ - `@types/google.maps` leaves the dev dependencies.
59
+
60
+ ### Fixed
61
+
62
+ - **A count-up figure shows its real number on the first paint** (GG's missed-work check, 2026-10-22). `useCountUp` started at 0, so the server render and the first paint printed "0": a page with no script showed 0 for good, and a slow page showed 0 until it hydrated. Now `value` starts at the target, so the server and the first client render agree. Used by `AnimatedStat`, `CountUpText` (the Stats figures) and `StatsParagraph`.
63
+ - The published page still counts (Lewis, 2026-09-10: 「数字要跳的」). After mount, a figure already in view counts up from 0 at once, as before. A figure off screen drops to 0 out of sight and counts up when it enters. Scrolling out and back in replays it, as before; `replay: false` counts once.
64
+ - A second in-view callback (a threshold crossed) no longer restarts a count that already ran.
65
+ - No observer in the browser: the real number stays. Reduced motion: the real number, as before.
66
+ - No stored value or setting changes.
67
+
68
+ ### Guards
69
+
70
+ - `scripts/test-one-site-map.tsx` (red first): no file under `src/` loads the Google Maps SDK and the two Google modules are gone; only `components/SiteMap` imports efficient-shell's map drawing, and the three map sections draw through it; the typed offices and a Contact card draw the site map on a published page with no key; the offices' pins; the map follows the site's Labels font and accent (the rule efficient-storefront's `test-map-font-roles` held over the Google map's chrome, card 8824.i).
71
+ - `scripts/test-map-load-failure.ts` is deleted with `lib/maps-loader` (the shell map shows its own failure).
72
+ - `scripts/test-footprint-dealers.tsx`: the dealers map is the site map's box. `scripts/test-every-button-follows-the-button-colour.ts`: 18 accent fills stay (the card's "HQ" tag).
73
+ - New `scripts/test-count-up-first-paint.tsx` (red first): the server render of the three sections prints the figure, and the hook (real hooks, a fake observer, frame and clock) counts an in-view figure up from 0 after mount, sets 0 off screen and counts up on entry, replays, honours `replay: false` and reduced motion.
74
+ - `scripts/test-stats-count-up.tsx` §2: the published first paint is the real figure. Its three old checks rested on the page starting at 0 (page reads "0+", page is not "20+", page markup differs from the canvas) and are gone; the count-up is proven in the new guard.
75
+
5
76
  ## 33.0.0 - 2026-10-22
6
77
 
7
78
  ### Added
@@ -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 ft}from"react/jsx-runtime";import{useCallback as o,useEffect as m,useMemo as I,useRef as S,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 gt}from"../lib/puck/build-config.js";import{ChromeWrap as wt}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as Ct}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as _t}from"../lib/site-live-state.js";import{holdSiteWrites as Tt}from"../../format/lib/site-writes.js";import{backendOf as M,blocksOf as yt}from"../lib/website-session.js";import{useEaselSession as Et}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Pt}from"../../format/lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/puck/templateFields.js";import{setEditorPage as le}from"../../format/lib/puck/editor-page-context.js";import{resolveSiteName as Wt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Ht,normalizeSiteWidth as kt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as me}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as It}from"../../format/lib/content/container-gap.js";import Mt,{DocumentScreen as Rt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Gt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Bt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Ft}from"./PreviewFooterContext.js";import{PreviewChatProvider as Dt,DEFAULT_CHAT_PREVIEW as At}from"./PreviewChatContext.js";import{PreviewSocialProvider as xt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Nt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Ot}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as bt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as Kt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Lt}from"efficient-easel/draw/client";import{PreviewLocationPartProvider as Yt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as Ut}from"./PreviewPartStyleContext.js";import{SiteMapsProvider as jt,readSiteMapsKey as Vt,writeSiteMapsKey as pe,readSiteMapId as Xt,writeSiteMapId as Zt}from"../../render/lib/maps-config.js";import{CORNER_STYLE_TO_PX as qt,DEFAULT_HEADING_COMPRESSION as Jt,DEFAULT_HEADING_TYPOGRAPHY as Qt,DEFAULT_SWITCH_SHOWN as R,DEFAULT_SIZES as $t,DEFAULT_THEME_MODE as T,normalizeCornerRadius as er,normalizeCornerStyle as tr,normalizeCardShadow as rr,normalizeCardGap as or,normalizeHoverEffect as nr,normalizeShadowColor as ar,IDENTITY_CARD_GAP as Se,IDENTITY_CARD_SHADOW as ir,IDENTITY_HOVER_EFFECT as cr,THEME_MODE_KEY as fe,THEME_STORAGE_KEY as sr,THEME_SWITCH_HIDE as ge,THEME_SWITCH_KEY as G}from"../../format/lib/theme.js";import{DEFAULT_FONTS as dr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as ur}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as hr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as lr}from"../lib/site-text-styles.js";import{wordStylesFromRow as mr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as pr}from"./PreviewChatContext.js";const Sr=()=>{if(typeof window>"u")return T;try{const i=window.localStorage.getItem(fe);return i==="light"||i==="dark"||i==="auto"?i:T}catch{return T}},we=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(fe,i)}catch{}},fr=()=>{if(typeof window>"u")return R;try{return window.localStorage.getItem(G)!==ge}catch{return R}},gr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(sr)}catch{}},Ce=i=>{if(!(typeof window>"u"))try{i?window.localStorage.removeItem(G):window.localStorage.setItem(G,ge)}catch{}};function wr(){const{adapter:i,capabilities:d,templateId:B,ready:w,token:l,siteId:c,currentSlug:F,currentKind:D}=Gt();m(()=>(le(F,D),()=>le(null,null)),[F,D]);const y=d.placeholderFrames,[_e,A]=r(null),[Te,x]=r("");m(()=>{const e=i.templateName;if(!w||!B||!e){x("");return}let a=!1;return e().then(u=>!a&&x(u??"")).catch(()=>{}),()=>{a=!0}},[w,l,B,i]);const[ye,E]=r(T),[Ee,P]=r(R),[Pe,N]=r({selected:0,themes:[]}),[ve,O]=r(dr),[We,b]=r($t),[He,z]=r(null),[ke,K]=r(Jt),[Ie,L]=r(null),[Me,Y]=r(null),[Re,U]=r(Se),[Ge,j]=r(null),[Be,V]=r(null),[Fe,X]=r(null),[v,Z]=r(null),h=Et(),q=I(()=>gt(Ct(h),yt(h)),[h]),De=I(()=>Pt(vt(q,y),v),[q,y,v]),[Ae,J]=r(Qt),[xe,Q]=r(null),[Ne,$]=r(null),[Oe,ee]=r(null),[be,te]=r(null),[ze,re]=r(null),oe=S(null),n=S(!1);m(()=>{E(Sr()),P(fr())},[]);const Ke=o(e=>{n.current=!0,gr(),we(e),E(e)},[]),Le=o(e=>{n.current=!0,Ce(e),P(e)},[]),Ye=o(e=>{n.current=!0,N(e)},[]),Ue=o(e=>{n.current=!0,O(e)},[]),je=o(e=>{n.current=!0,b(e)},[]),Ve=o(e=>{n.current=!0,z(e)},[]),Xe=o(e=>{n.current=!0,K(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,Y(e)},[]),Je=o(e=>{n.current=!0,U(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,J(e)},[]),[et,ne]=r(null),[tt,rt]=r(null),ot=o(e=>{n.current=!0,ne(e)},[]),nt=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),it=o(e=>{n.current=!0,Z(e)},[]),ct=o(e=>{n.current=!0,Q(e)},[]),st=o(e=>{n.current=!0,$(e)},[]),dt=o(e=>{n.current=!0,ee(e)},[]),ut=o(e=>{n.current=!0,te(e)},[]),ht=o(e=>{n.current=!0,re(e)},[]);m(()=>{const e=M(h).theme;if(!l||!d.hasSiteTheme||!e)return;const a=c??"";oe.current!==a&&(oe.current=a,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;we(t.default_mode),Ce(t.show_theme_switch),E(t.default_mode),P(t.show_theme_switch),N({selected:t.selected_preset,themes:t.theme_presets});const p=lr(t);O(p.fonts),b(p.sizes),z(t.corner_radius_px===void 0?qt[tr(t.corner_style)]:er(t.corner_radius_px)),K(p.compression),L(t.card_shadow==null?ir:rr(t.card_shadow)),U(t.card_gap==null?Se:or(t.card_gap)),j(t.hover_effect==null?cr:nr(t.hover_effect)),Y(ar(t.shadow_color)),V(kt(t.site_width)),X(Ht(t.site_gutter)),Z(It(t.block_gap)),J(p.typography),ne(p.textStyles),rt(mr(t)),Q(t.hero_background_follows_width===!0),$(me(t.section_background_width)),ee(me(t.section_content_width)),te(t.photography_grayscale===!0),re(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[l,c,d.hasSiteTheme,h]);const lt=Nt({token:l,siteId:c,enabled:d.hasSiteSettings}),[mt,ae]=r(At),ie=S(null),W=S(!1),f=S(null),g=S({}),C=o(async()=>{f.current&&clearTimeout(f.current),f.current=null;const e=g.current;g.current={};try{await M(h).chat?.update(e,c?{siteId:c}:void 0),_t()}catch(a){throw g.current={...e,...g.current},a}},[h,c]);m(()=>Tt(()=>f.current||Object.keys(g.current).length>0?C():void 0),[C]);const pt=o(e=>{W.current=!0,ae(a=>({...a,...e})),!(!d.hasSiteSettings||!l)&&(g.current={...g.current,...e},f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,l,C]);m(()=>{if(!l||!d.hasSiteSettings)return;const e=c??"";ie.current!==e&&(ie.current=e,W.current=!1);let a=!1;const u=M(h).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{a||W.current||ae(pr(t))}).catch(()=>{}),()=>{a=!0}},[l,c,d.hasSiteSettings,h]);const[_,H]=r(""),ce=S(null),k=S(!1);m(()=>H(Vt()),[]);const se=o(e=>{const a=e.trim();if(a===_)return;k.current=!0,pe(a),H(a);const u=i.updateSite;!d.canEditSiteRecord||!w||!u||u({mapsApiKey:a}).catch(()=>{})},[_,d.canEditSiteRecord,w,i]),[de,ue]=r("");m(()=>ue(Xt()),[]),m(()=>{const e=i.site;if(!w||!d.hasSiteRecord||!e){A(null);return}const a=c??"";ce.current!==a&&(ce.current=a,k.current=!1);let u=!1;return e().then(t=>{if(u||(A(Wt(t.name)),k.current))return;const p=t.mapsApiKey??"";pe(p),H(p);const he=t.mapsMapId??"";Zt(he),ue(he)}).catch(()=>{}),()=>{u=!0}},[w,l,d.hasSiteRecord,c,i]);const St=I(()=>({apiKey:_,setApiKey:se,mapId:de}),[_,se,de]);return s(Rt,{config:De,parts:ur,wrap:(e,a)=>s(Bt,{websiteName:_e,templateChrome:y,templateName:Te||null,themeMode:ye,onThemeModeChange:Ke,themeSwitchShown:Ee,onThemeSwitchShownChange:Le,theme:Pe,onThemeChange:Ye,fonts:ve,onFontsChange:Ue,cornerRadiusPx:He,onCornerRadiusPxChange:Ve,cardShadow:Ie,onCardShadowChange:Ze,shadowColor:Me,onShadowColorChange:qe,cardGap:Re,onCardGapChange:Je,hoverEffect:Ge,onHoverEffectChange:Qe,headingCompression:ke,onHeadingCompressionChange:Xe,headingTypography:Ae,onHeadingTypographyChange:$e,textStyles:et,onTextStylesChange:ot,wordStyles:tt,sizes:We,onSizesChange:je,siteWidth:Be,onSiteWidthChange:nt,siteGutter:Fe,onSiteGutterChange:at,blockGap:v,onBlockGapChange:it,heroBackgroundFollowsWidth:xe,onHeroBackgroundFollowsWidthChange:ct,sectionBackgroundWidth:Ne,onSectionBackgroundWidthChange:st,sectionContentWidth:Oe,onSectionContentWidthChange:dt,photographyGrayscale:be,onPhotographyGrayscaleChange:ut,shareButtonOnPosts:ze,onShareButtonOnPostsChange:ht,themeFromDocument:!d.hasSiteTheme,children:s(Ft,{children:s(wt,{wrap:h.chrome?.wrap,surface:"page",children:s(zt,{children:s(Kt,{children:s(Lt,{children:s(Yt,{children:s(Ut,{children:ft(jt,{value:St,children:[s(Dt,{chat:mt,onChatChange:pt,children:s(xt,{value:lt,children:s(Ot,{children:e})})}),a]})})})})})})})})})})}function Cr({target:i}){return s(Mt,{target:i,addressing:bt,onHostMessage:hr,children:s(wr,{})})}export{Cr 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
- 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;
@@ -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;
@@ -1,2 +1,2 @@
1
- import{textStyleCaseCss as D}from"efficient-easel/draw";import{FONT_OPTIONS as J,normalizeFonts as F}from"../../format/lib/fonts.js";import{PART_PHONE_MAX_CSS as B,partSpacingOf as G}from"../../render/lib/puck/part-styles.js";import{compressionMetrics as U,headingTypographyFromRow as W,normalizeHeadingCompression as C,normalizeSizes as I}from"../../format/lib/theme.js";const H=e=>e==="sentence"?"none":void 0,h=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,_=e=>typeof e=="string"&&e?e:void 0,M=["font","color","size","sizePhone","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function p(e){const i={};for(const n of M)e[n]!==void 0&&(i[n]=e[n]);return i}function O(e,i){const{auto:n,...t}=e,a=new Set(i??[]),s=M.filter(o=>a.has(o)&&e.values[o]===void 0);return s.length?{...t,auto:s}:t}function w(e){const i=e.fonts,n=e.sizes,t=e.typography,a=U(e.compression),s=(l,r)=>({id:`heading-${l}`,kind:"heading",name:`Heading ${l}`,values:p(r)}),o=(l,r={})=>({id:`body-${l}`,kind:"body",name:`Body ${l}`,values:p(r)});return[s(1,{font:_(i.heading),size:h(n.headingLarge),weight:h(t.weight),lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,letterCase:H(t.case),largestSize:h(t.maxPx)}),s(2,{font:_(i.heading2),size:h(n.headingMedium),weight:h(t.weight2),lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,letterCase:H(t.case2)}),s(3,{font:_(i.heading3),size:h(n.headingSmall),weight:h(t.weight3),lineHeight:a.lineHeight,letterSpacing:a.letterSpacing,letterCase:H(t.case3)}),o(1,{font:_(i.body),size:h(n.body)}),o(2),o(3),o(4),o(5,{font:_(i.label),size:h(n.label)})]}function $(e){return Array.isArray(e)&&e.every(n=>n&&typeof n=="object"&&typeof n.id=="string"&&(n.kind==="heading"||n.kind==="body")&&typeof n.name=="string")?e.map(n=>O({...n,values:p(n.values??{})},Array.isArray(n.auto)?n.auto:void 0)):null}function ae(e){return $(e)??[]}function T(e,i){const n=w(i),t=$(e);return t?t.map(a=>{const s={...P(n,a.id)};for(const o of a.auto??[])delete s[o];return{...a,values:p({...s,...a.values})}}):n}const P=(e,i)=>e.find(n=>n.id===i)?.values??{},E=["heading-1","heading-2","heading-3"];function oe({saved:e,old:i,cur:n,next:t,sizeOf:a}){const s=w(i),o=$(e)??s.map(d=>({...d,values:{}})),l=T(o,i),r=[],y=t.map(d=>{const g=n.find(u=>u.id===d.id),S=o.find(u=>u.id===d.id);if(!g||!S)return X([d],a)[0];const c={...S.values},z=new Set(S.auto??[]),v=d.values,N=g.values,A=[...new Set([...Object.keys(v),...Object.keys(N)])].filter(u=>JSON.stringify(v[u])!==JSON.stringify(N[u]));A.sort((u,m)=>+(u==="letterSpacing")-+(m==="letterSpacing"));for(const u of A){const m=u==="lineSpacing"?"lineHeight":u,k=v[u];if(k===void 0){delete c[m],P(s,d.id)[m]!==void 0&&(r.push([d.id,m]),z.add(m));continue}if(z.delete(m),u==="lineSpacing")c.lineHeight=x(k/100,3);else if(u==="letterSpacing"){const R=l.find(V=>V.id===d.id),j=a({...d,values:p({...R?.values??{},...c})});c.letterSpacing=j?x(k/j,4):0}else c[m]=k}return O({id:d.id,kind:d.kind,name:d.name,values:p(c)},z)});let f=i.compression;if(r.some(([d,g])=>(g==="lineHeight"||g==="letterSpacing")&&E.includes(d))&&C(f)!=="normal"){for(const d of E){const g=y.find(c=>c.id===d);if(!g)continue;const S={...g.values};for(const c of["lineHeight","letterSpacing"])r.some(([z,v])=>z===d&&v===c)||S[c]===void 0&&!(g.auto??[]).includes(c)&&(S[c]=P(s,d)[c]);g.values=p(S)}f="normal"}return{saved:y,old:{...i,compression:f}}}function se(e,i){const n={text_styles:e.saved};return e.old.compression!==i.compression&&(n.heading_compression=C(e.old.compression)),n}const x=(e,i)=>Number(e.toFixed(i));function re(e,i){return e.map(n=>{const{lineHeight:t,letterSpacing:a,...s}=n.values,o={...s};return t!==void 0&&(o.lineSpacing=x(t*100,1)),a!==void 0&&(o.letterSpacing=x(a*i(n),2)),{id:n.id,kind:n.kind,name:n.name,values:o}})}function X(e,i){return e.map(n=>{const{lineSpacing:t,letterSpacing:a,...s}=n.values,o={id:n.id,kind:n.kind,name:n.name,values:p({...s})},l={...o.values};if(t!==void 0&&(l.lineHeight=x(t/100,3)),a!==void 0){const r=i({...o,values:{...o.values}});l.letterSpacing=r?x(a/r,4):0}return{...o,values:p(l)}})}function de(e){const i={fonts:F({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:I({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:C(e.heading_compression),typography:W(e)},n=e.text_styles??null,t=Array.isArray(n)?L(T(n,i),i):i;return{fonts:F(t.fonts),sizes:I(t.sizes),compression:C(t.compression),typography:t.typography,textStyles:n}}function L(e,i){const n=d=>e.find(g=>g.id===d)?.values??{},t=n("heading-1"),a=n("heading-2"),s=n("heading-3"),o=n("body-1"),l=n("body-5"),r=i.fonts,y=i.sizes,f=i.typography,b=d=>d==="none"?"sentence":"authored";return{fonts:{...r,heading:t.font??r.heading,heading2:a.font??t.font??r.heading2,heading3:s.font??t.font??r.heading3,body:o.font??r.body,label:l.font??r.label},sizes:{...y,headingLarge:t.size??null,headingMedium:a.size??null,headingSmall:s.size??null,body:o.size??null,label:l.size??null},compression:i.compression,typography:{...f,case:b(t.letterCase),weight:t.weight??null,maxPx:t.largestSize??null,weight2:a.weight??null,weight3:s.weight??null,case2:b(a.letterCase),case3:b(s.letterCase)}}}function le(e){const i=$(e.textStyles);if(!i||i.every(a=>Object.keys(a.values).length===0&&!a.auto))return e;const n={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},t=L(T(i,n),n);return{...e,fonts:t.fonts,sizes:t.sizes,headingCompression:t.compression,headingTypography:t.typography}}function Z(e){switch(e.id){case"heading-1":return"font-display";case"heading-2":return"font-heading2";case"heading-3":return"font-heading3";case"body-1":return"font-body";case"body-5":return"font-mono";default:return`font-${e.id}`}}function q(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":/^#[0-9a-f]{6}$/i.test(e)?e:null}function K(e){const i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:first-child) { margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:last-child) { margin-bottom: var(--sf-part-para) }`]}function ce(e){const i=[];for(const n of e){const t=n.values,a=`.${Z(n)}`,s=[],o=t.font!==void 0?J.find(f=>f.key===t.font)?.cssVar:void 0;if(o&&s.push(`font-family: var(${o})`),t.size!==void 0){const f=t.largestSize!==void 0?Math.min(t.size,t.largestSize):t.size;s.push(`font-size: ${f}px`)}const l=t.color!==void 0?q(t.color):null;l&&s.push(`color: ${l}`),t.italic===!0&&s.push("font-style: italic"),t.weight!==void 0&&s.push(`font-weight: ${t.weight}`);const r=[];t.lineHeight!==void 0&&r.push(`line-height: ${t.lineHeight}`),t.letterSpacing!==void 0&&r.push(`letter-spacing: ${t.letterSpacing}em`),n.kind==="body"&&s.push(...r);const y=D(t.letterCase);if(y&&s.push(`text-transform: ${y}`),t.paragraphSpacing&&s.push(`--sf-part-para: ${t.paragraphSpacing}px`),s.length&&i.push(`${a} { ${s.join("; ")} }`),n.kind==="heading"&&r.length&&i.push(`${a}, ${a}:is(h1, h2, h3, h4) { ${r.join("; ")} }`),t.paragraphSpacing&&i.push(...K(a)),t.sizePhone!==void 0){const f=Q[n.id],b=[`${a} { font-size: ${t.sizePhone}px }`];f&&b.push(`.sf-themed-content { --size-${f}: ${t.sizePhone}px !important }`),i.push(`@media ${B} { ${b.join(" ")} }`)}}return i.join(`
2
- `)}const Q={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function ue(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function fe(e){switch(e){case"heading":return"heading-1";case"heading2":return"heading-2";case"heading3":return"heading-3";case"body":return"body-1";case"label":return"body-5";default:return}}function Y(e){const i=G(e);return p({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function ge(e){return Object.keys(Y(e)).length>0}function pe({saved:e,old:i,styleId:n,values:t}){return{saved:($(e)??w(i).map(o=>({...o,values:{}}))).map(o=>o.id===n?O({...o,values:p({...o.values,...t})},o.auto):o),old:i}}function he(e){const i=e.filter(n=>n.kind==="body").map(n=>Number(/^body-(\d+)$/.exec(n.id)?.[1])).filter(n=>Number.isInteger(n)&&n>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{ue as accentItalicCss,oe as applyListChange,he as eyebrowStyleId,Z as faceClassOf,X as fromPanelStyles,ge as hasStyleChange,se as listChangePatch,Y as partStyleToTextStyleValues,pe as pushIntoStyle,T as resolveTextStyles,de as siteTextFromRow,ae as storedTextStyles,fe as styleIdOfRole,ce as textStylesCss,w as textStylesFromOld,L as textStylesToOld,le as themeWithTextStyles,re as toPanelStyles};
1
+ import{defaultTextStyles as J}from"efficient-easel/text-styles";import{textStyleCaseCss as X}from"efficient-easel/draw";import{FONT_OPTIONS as Y,normalizeFonts as F}from"../../format/lib/fonts.js";import{PART_PHONE_MAX_CSS as G,STYLE_ID_OF_ROLE as U,TEXT_STYLE_ATTR as W,partSpacingOf as Z}from"../../render/lib/puck/part-styles.js";import{faceClassOf as I}from"../../format/lib/text-style-face.js";import{compressionMetrics as q,headingTypographyFromRow as B,normalizeHeadingCompression as C,normalizeSizes as L}from"../../format/lib/theme.js";const T=e=>e==="sentence"?"none":void 0,h=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,_=e=>typeof e=="string"&&e?e:void 0,j=["font","color","size","sizePhone","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function p(e){const i={};for(const n of j)e[n]!==void 0&&(i[n]=e[n]);return i}function H(e,i){const{auto:n,...t}=e,s=new Set(i??[]),r=j.filter(o=>s.has(o)&&e.values[o]===void 0);return r.length?{...t,auto:r}:t}function O(e){const i=e.fonts,n=e.sizes,t=e.typography,s=q(e.compression),r={"heading-1":{font:_(i.heading),size:h(n.headingLarge),weight:h(t.weight),lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,letterCase:T(t.case),largestSize:h(t.maxPx)},"heading-2":{font:_(i.heading2),size:h(n.headingMedium),weight:h(t.weight2),lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,letterCase:T(t.case2)},"heading-3":{font:_(i.heading3),size:h(n.headingSmall),weight:h(t.weight3),lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,letterCase:T(t.case3)},"body-1":{font:_(i.body),size:h(n.body)},"body-5":{font:_(i.label),size:h(n.label)}};return J().map(({id:o,kind:l,name:d})=>({id:o,kind:l,name:d,values:p(r[o]??{})}))}function $(e){return Array.isArray(e)&&e.every(n=>n&&typeof n=="object"&&typeof n.id=="string"&&(n.kind==="heading"||n.kind==="body")&&typeof n.name=="string")?e.map(n=>H({...n,values:p(n.values??{})},Array.isArray(n.auto)?n.auto:void 0)):null}function de(e){return $(e)??[]}function w(e,i){const n=O(i),t=$(e);return t?t.map(s=>{const r={...P(n,s.id)};for(const o of s.auto??[])delete r[o];return{...s,values:p({...r,...s.values})}}):n}const P=(e,i)=>e.find(n=>n.id===i)?.values??{},R=["heading-1","heading-2","heading-3"];function ce({saved:e,old:i,cur:n,next:t,sizeOf:s}){const r=O(i),o=$(e)??r.map(a=>({...a,values:{}})),l=w(o,i),d=[],y=t.map(a=>{const c=n.find(f=>f.id===a.id),b=o.find(f=>f.id===a.id);if(!c||!b)return K([a],s)[0];const u={...b.values},z=new Set(b.auto??[]),v=a.values,A=c.values,N=[...new Set([...Object.keys(v),...Object.keys(A)])].filter(f=>JSON.stringify(v[f])!==JSON.stringify(A[f]));N.sort((f,m)=>+(f==="letterSpacing")-+(m==="letterSpacing"));for(const f of N){const m=f==="lineSpacing"?"lineHeight":f,k=v[f];if(k===void 0){delete u[m],P(r,a.id)[m]!==void 0&&(d.push([a.id,m]),z.add(m));continue}if(z.delete(m),f==="lineSpacing")u.lineHeight=x(k/100,3);else if(f==="letterSpacing"){const V=l.find(D=>D.id===a.id),E=s({...a,values:p({...V?.values??{},...u})});u.letterSpacing=E?x(k/E,4):0}else u[m]=k}return H({id:a.id,kind:a.kind,name:a.name,values:p(u)},z)});let g=i.compression;if(d.some(([a,c])=>(c==="lineHeight"||c==="letterSpacing")&&R.includes(a))&&C(g)!=="normal"){for(const a of R){const c=y.find(u=>u.id===a);if(!c)continue;const b={...c.values};for(const u of["lineHeight","letterSpacing"])d.some(([z,v])=>z===a&&v===u)||b[u]===void 0&&!(c.auto??[]).includes(u)&&(b[u]=P(r,a)[u]);c.values=p(b)}g="normal"}return{saved:y,old:{...i,compression:g}}}function ue(e,i){const n={text_styles:e.saved};return e.old.compression!==i.compression&&(n.heading_compression=C(e.old.compression)),n}const x=(e,i)=>Number(e.toFixed(i));function fe(e,i){return e.map(n=>{const{lineHeight:t,letterSpacing:s,...r}=n.values,o={...r};return t!==void 0&&(o.lineSpacing=x(t*100,1)),s!==void 0&&(o.letterSpacing=x(s*i(n),2)),{id:n.id,kind:n.kind,name:n.name,values:o}})}function K(e,i){return e.map(n=>{const{lineSpacing:t,letterSpacing:s,...r}=n.values,o={id:n.id,kind:n.kind,name:n.name,values:p({...r})},l={...o.values};if(t!==void 0&&(l.lineHeight=x(t/100,3)),s!==void 0){const d=i({...o,values:{...o.values}});l.letterSpacing=d?x(s/d,4):0}return{...o,values:p(l)}})}function ge(e){const i={fonts:F({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:L({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:C(e.heading_compression),typography:B(e)},n=e.text_styles??null,t=Array.isArray(n)?M(w(n,i),i):i;return{fonts:F(t.fonts),sizes:L(t.sizes),compression:C(t.compression),typography:t.typography,textStyles:n}}function M(e,i){const n=a=>e.find(c=>c.id===a)?.values??{},t=n("heading-1"),s=n("heading-2"),r=n("heading-3"),o=n("body-1"),l=n("body-5"),d=i.fonts,y=i.sizes,g=i.typography,S=a=>a==="none"?"sentence":"authored";return{fonts:{...d,heading:t.font??d.heading,heading2:s.font??t.font??d.heading2,heading3:r.font??t.font??d.heading3,body:o.font??d.body,label:l.font??d.label},sizes:{...y,headingLarge:t.size??null,headingMedium:s.size??null,headingSmall:r.size??null,body:o.size??null,label:l.size??null},compression:i.compression,typography:{...g,case:S(t.letterCase),weight:t.weight??null,maxPx:t.largestSize??null,weight2:s.weight??null,weight3:r.weight??null,case2:S(s.letterCase),case3:S(r.letterCase)}}}function pe(e){const i=$(e.textStyles);if(!i||i.every(s=>Object.keys(s.values).length===0&&!s.auto))return e;const n={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},t=M(w(i,n),n);return{...e,fonts:t.fonts,sizes:t.sizes,headingCompression:t.compression,headingTypography:t.typography}}function Q(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":/^#[0-9a-f]{6}$/i.test(e)?e:null}function ee(e){const i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:first-child) { margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:last-child) { margin-bottom: var(--sf-part-para) }`]}function he(e){const i=[];for(const n of e){const t=n.values,s=`.${I(n)}`,r=`[${W}="${n.id}"]`,o=`${s}, ${r}`,l=[],d=t.font!==void 0?Y.find(a=>a.key===t.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),t.size!==void 0){const a=t.largestSize!==void 0?Math.min(t.size,t.largestSize):t.size;l.push(`font-size: ${a}px`)}const y=t.color!==void 0?Q(t.color):null;y&&l.push(`color: ${y}`),t.italic===!0&&l.push("font-style: italic"),t.weight!==void 0&&l.push(`font-weight: ${t.weight}`);const g=[];t.lineHeight!==void 0&&g.push(`line-height: ${t.lineHeight}`),t.letterSpacing!==void 0&&g.push(`letter-spacing: ${t.letterSpacing}em`),n.kind==="body"&&l.push(...g);const S=X(t.letterCase);if(S&&l.push(`text-transform: ${S}`),t.paragraphSpacing&&l.push(`--sf-part-para: ${t.paragraphSpacing}px`),l.length&&i.push(`${o} { ${l.join("; ")} }`),n.kind==="heading"&&g.length&&i.push(`${o}, ${s}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${g.join("; ")} }`),t.paragraphSpacing&&i.push(...ee(`:is(${o})`)),t.sizePhone!==void 0){const a=ne[n.id],c=[`${o} { font-size: ${t.sizePhone}px }`];a&&c.push(`.sf-themed-content { --size-${a}: ${t.sizePhone}px !important }`),i.push(`@media ${G} { ${c.join(" ")} }`)}}return i.join(`
2
+ `)}const ne={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function me(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function ye(e){return e?U[e]:void 0}function te(e){const i=Z(e);return p({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Se(e){return Object.keys(te(e)).length>0}function be({saved:e,old:i,styleId:n,values:t}){return{saved:($(e)??O(i).map(o=>({...o,values:{}}))).map(o=>o.id===n?H({...o,values:p({...o.values,...t})},o.auto):o),old:i}}function xe(e){const i=e.filter(n=>n.kind==="body").map(n=>Number(/^body-(\d+)$/.exec(n.id)?.[1])).filter(n=>Number.isInteger(n)&&n>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{me as accentItalicCss,ce as applyListChange,xe as eyebrowStyleId,I as faceClassOf,K as fromPanelStyles,Se as hasStyleChange,ue as listChangePatch,te as partStyleToTextStyleValues,be as pushIntoStyle,w as resolveTextStyles,ge as siteTextFromRow,de as storedTextStyles,ye as styleIdOfRole,he as textStylesCss,O as textStylesFromOld,M as textStylesToOld,pe as themeWithTextStyles,fe as toPanelStyles};
@@ -5,8 +5,6 @@ export interface ContactLocationsContent {
5
5
  tagline: string;
6
6
  galleryKicker: string;
7
7
  galleryHint: string;
8
- apiKey: string;
9
- mapId: string;
10
8
  mapTheme: MapThemeMode;
11
9
  }
12
10
  export declare const LOCATION_TILE_SHAPES: readonly ["tall", "square", "wide"];