efficient-web-builder 73.1.0 → 74.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.
- package/CHANGELOG.md +60 -0
- package/dist/editor/components/CustomHtmlCodeWindow.d.ts +11 -0
- package/dist/editor/components/CustomHtmlCodeWindow.js +20 -0
- package/dist/editor/components/SectionThemePicker.d.ts +3 -2
- package/dist/editor/components/SectionThemePicker.js +1 -1
- package/dist/editor/components/SiteTextStylesField.d.ts +2 -1
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/components/SlotChildRows.js +1 -1
- package/dist/editor/components/StandaloneSectionEditor.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/TickerSettingsPanel.js +1 -1
- package/dist/editor/components/WebsiteSettingsPanel.d.ts +2 -0
- package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
- package/dist/editor/components/storefront-editor.css +111 -0
- package/dist/editor/components/useHostDocumentBridge.js +1 -1
- package/dist/editor/lib/document/blocks/general/CustomHTML/fields.d.ts +6 -0
- package/dist/editor/lib/document/blocks/general/CustomHTML/fields.js +1 -0
- package/dist/editor/lib/document/blocks/general/Footprint/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroSingle/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.js +1 -1
- package/dist/editor/lib/document/blocks/hero-shared-fields.d.ts +5 -0
- package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/custom-html-preview.d.ts +12 -0
- package/dist/editor/lib/document/custom-html-preview.js +1 -0
- package/dist/editor/lib/document/footer-blocks.js +1 -1
- package/dist/editor/lib/document/own-pad-fields.d.ts +5 -0
- package/dist/editor/lib/document/own-pad-fields.js +1 -0
- package/dist/editor/lib/document/passes/inspector.js +1 -1
- package/dist/editor/lib/editor-document-adapter.js +1 -1
- package/dist/format/lib/animation/hover.js +1 -1
- package/dist/format/lib/animation/loop.js +1 -1
- package/dist/format/lib/content/accordion-row-style.d.ts +3 -1
- package/dist/format/lib/content/accordion-row-style.js +1 -1
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-shape.d.ts +1 -1
- package/dist/format/lib/content/button-icon.d.ts +3 -1
- package/dist/format/lib/content/button-icon.js +1 -1
- package/dist/format/lib/content/card-place.d.ts +3 -1
- package/dist/format/lib/content/card-place.js +1 -1
- package/dist/format/lib/content/chat-launcher.js +1 -1
- package/dist/format/lib/content/container-direction.js +1 -1
- package/dist/format/lib/content/footprint.d.ts +22 -0
- package/dist/format/lib/content/footprint.js +1 -1
- package/dist/format/lib/content/image-fit.js +1 -1
- package/dist/format/lib/content/image-text-rows.d.ts +5 -2
- package/dist/format/lib/content/image-text-rows.js +1 -1
- package/dist/format/lib/content/list-number.js +1 -1
- package/dist/format/lib/content/list-position.js +1 -1
- package/dist/format/lib/content/text-tag.js +1 -1
- package/dist/format/lib/document/blocks/general/Footprint/card-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/text-part-shapes.json +0 -6
- package/dist/format/lib/document/box-footer.js +1 -1
- package/dist/format/lib/document/custom-html-place.d.ts +19 -0
- package/dist/format/lib/document/custom-html-place.js +7 -0
- package/dist/format/lib/document/left-view.js +1 -1
- package/dist/format/lib/document/mockup-variant-fields.js +1 -1
- package/dist/format/lib/document/part-inks.d.ts +1 -0
- package/dist/format/lib/document/part-inks.js +1 -1
- package/dist/format/lib/document/passes/types.d.ts +1 -0
- package/dist/format/lib/document/section-groups.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +28 -0
- package/dist/format/lib/editor-words-catalogue.js +5 -5
- package/dist/format/lib/hero-arrows.js +1 -1
- package/dist/format/lib/hero-group-placement.js +1 -1
- package/dist/format/lib/hero-media-layout.js +1 -1
- package/dist/format/lib/hero-phone-stack.d.ts +12 -0
- package/dist/format/lib/hero-phone-stack.js +1 -1
- package/dist/format/lib/hero-video.js +1 -1
- package/dist/format/lib/reel.js +1 -1
- package/dist/format/lib/sections/divider-style.js +1 -1
- package/dist/format/lib/sections/hero-overlay.js +1 -1
- package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
- package/dist/format/lib/sections/intro-bleed-layout.js +1 -1
- package/dist/format/lib/sections/logo-look.js +1 -1
- package/dist/format/lib/sections/product-card-style.js +1 -1
- package/dist/format/lib/sections/section-eyebrow-look.js +1 -1
- package/dist/format/lib/sections/section-head-placement.d.ts +3 -1
- package/dist/format/lib/sections/section-head-placement.js +1 -1
- package/dist/format/lib/sections/section-head-style.js +1 -1
- package/dist/format/lib/sections/section-number-style.js +1 -1
- package/dist/format/lib/sections/ticker-style.js +1 -1
- package/dist/format/lib/text-style-face.d.ts +6 -0
- package/dist/format/lib/text-style-face.js +2 -1
- package/dist/format/lib/theme.d.ts +2 -1
- package/dist/format/lib/theme.js +4 -4
- package/dist/render/components/BoxTabPaneContext.d.ts +2 -3
- package/dist/render/components/BoxTabs.js +1 -1
- package/dist/render/components/ButtonBlock.d.ts +2 -0
- package/dist/render/components/ButtonBlock.js +1 -1
- package/dist/render/components/DealerFinder.d.ts +7 -1
- package/dist/render/components/DealerFinder.js +1 -1
- package/dist/render/components/Footprint.d.ts +6 -2
- package/dist/render/components/Footprint.js +1 -1
- package/dist/render/components/Heading.d.ts +1 -1
- package/dist/render/components/Heading.js +1 -1
- package/dist/render/components/HeroSection.d.ts +4 -1
- package/dist/render/components/HeroSection.js +1 -1
- package/dist/render/components/HeroSingle.d.ts +4 -1
- package/dist/render/components/HeroSingle.js +1 -1
- package/dist/render/components/HeroSlide.d.ts +3 -0
- package/dist/render/components/HeroSlide.js +1 -1
- package/dist/render/components/SideListLayout.d.ts +8 -2
- package/dist/render/components/SideListLayout.js +1 -1
- package/dist/render/components/SiteGutterFrame.js +1 -1
- package/dist/render/components/Text.d.ts +1 -1
- package/dist/render/components/Text.js +1 -1
- package/dist/render/lib/content/section-padding.d.ts +36 -2
- package/dist/render/lib/content/section-padding.js +1 -1
- package/dist/render/lib/document/blocks/general/ButtonBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/CustomHTML/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Footprint/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroSingle/render.js +1 -1
- package/dist/render/lib/document/blocks/general/LocationMap/render.js +1 -1
- package/dist/render/lib/document/blocks/general/LogoBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-rows-editorial.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-logos.js +1 -1
- package/dist/render/lib/document/custom-css.d.ts +8 -2
- package/dist/render/lib/document/custom-css.js +3 -2
- package/dist/render/lib/document/header-clearance.js +1 -1
- package/dist/render/lib/document/header-ink.js +1 -1
- package/dist/render/lib/document/passes/section-padding.d.ts +4 -0
- package/dist/render/lib/document/passes/section-padding.js +1 -1
- package/dist/render/lib/document/sanitize.d.ts +4 -1
- package/dist/render/lib/document/sanitize.js +1 -1
- package/dist/render/lib/text-styles/site-text-styles.js +2 -2
- package/dist/routine-index.json +1 -0
- package/dist/value-index.json +1 -0
- package/package.json +29 -7
- package/dist/format/lib/document/blocks/general/CustomHTML/fields.d.ts +0 -2
- package/dist/format/lib/document/blocks/general/CustomHTML/fields.js +0 -1
- package/dist/format/lib/parse-option.d.ts +0 -3
- package/dist/format/lib/parse-option.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 74.0.0 - 2026-11-19
|
|
4
|
+
|
|
5
|
+
From main at `80ccf42a`: #817, #818, #820, #823.
|
|
6
|
+
|
|
7
|
+
A major: the Custom HTML block gets a code window (Site styles, live preview, Format code), and `parseOption` now comes only from `efficient-shell/format`. The `efficient-shell` and `efficient-easel` peers narrow, nine code-editor peers are new, and two `format/` paths are removed. No stored key or value moves.
|
|
8
|
+
|
|
9
|
+
**Breaking:**
|
|
10
|
+
- `efficient-shell` peer `^13.24.1 || ^14.0.0` -> `^14.5.1` (`CodeEditor.place()`/`format()` and `efficient-shell/code/format`; Shift+Option+F on a Mac). (#820, #818)
|
|
11
|
+
- `efficient-easel` peer `^37.1.0` -> `^37.3.0` (`TextStylesList onPick`, `.sf-editor-tokens`). (#820)
|
|
12
|
+
- New peers: `@codemirror/commands` ^6.11.1, `@codemirror/lang-css` ^6.3.1, `@codemirror/language` ^6.13.1, `@codemirror/state` ^6.7.6, `@codemirror/view` ^6.43.15, `@lezer/common` ^1.5.5, `@lezer/highlight` ^1.2.5, `@lezer/html` ^1.3.13 (required), and `prettier` ^3.0.0 (optional: with none, there is no Format code button). (#820)
|
|
13
|
+
- Removed: `efficient-web-builder/format/lib/parse-option` (use `efficient-shell/format`) and `format/lib/source-rules/one-option-parser` (use the shell ui-check kind `option-read`). (#818)
|
|
14
|
+
- Moved: `lib/document/blocks/general/CustomHTML/fields` from `format/` to `editor/`. No host imports the old path. (#820)
|
|
15
|
+
|
|
16
|
+
**For hosts** (storefront-blocks, admin-portal, storefront), each in its web-builder 74 bump PR:
|
|
17
|
+
1. Install `efficient-shell` ^14.5.1 and `efficient-easel` ^37.3.0.
|
|
18
|
+
2. Add all 9 packages explicitly (do not rely on auto-install-peers): `@codemirror/commands@6.11.1 @codemirror/lang-css@6.3.1 @codemirror/language@6.13.1 @codemirror/state@6.7.6 @codemirror/view@6.43.15 @lezer/common@1.5.5 @lezer/highlight@1.2.5 @lezer/html@1.3.13 prettier@3.9.5`.
|
|
19
|
+
3. Replace every `efficient-web-builder/format/lib/parse-option` import with `efficient-shell/format`. storefront-blocks has 24 src files and 3 scripts that import it; the storefront has 5 hits, all in its vendored blocks copy (they follow the blocks re-vendor). Admin-portal and easel have none.
|
|
20
|
+
4. storefront-blocks only: rebuild, because it bundles the editor's general blocks and `storefront-editor.css`. The other hosts see the new Custom HTML row only after they install that rebuilt storefront-blocks.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **Custom HTML code window.** The block's HTML row is one "Edit code" button. It opens a full-size shell `Dialog` with three columns: Styles (pick only: themes, the six palette colours, text styles, block gap; a click places a link in the code at the cursor in one undo step, through `CodeEditor.place()`), a desktop/phone preview in a sandboxed `iframe` drawn by `customHtmlDrawn` (the same function the block render uses), and the shell `CodeEditor` with Format code. A banner names what the sanitiser removes. (#820)
|
|
25
|
+
- **Pick-only Site styles parts.** `SectionThemePicker` takes `canEdit` (default `true`); `SectionThemeMenu` `onEdit` is optional; `SiteTextStylesField` takes `onPick` (easel's picker). Every current host is unchanged by default. (#817)
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- **`parseOption` has one home, `efficient-shell/format`.** 44 files import it from there. `src/lib/parse-option.ts`, the `one-option-parser` rule and their tests are deleted; the shell ui-check kind `option-read` replaces the rule, with 13 allow entries, each with its reason. (#818)
|
|
30
|
+
|
|
31
|
+
### Guards
|
|
32
|
+
|
|
33
|
+
- **The removal list names every deleted module.** `verify-published-entries` names the two `one-option-parser` files #818 deleted, and a new guard fails when a module the major deletes is missing from the list. (#823)
|
|
34
|
+
|
|
35
|
+
## 73.2.0 - 2026-11-19
|
|
36
|
+
|
|
37
|
+
From main at `99f31fec`: #808, #810, #811, #812, #813, #814, #816, #819, #821.
|
|
38
|
+
|
|
39
|
+
A minor: one rule for reading a stored option, three phone-only space rows on the hero, Text, Heading and Button own their top and bottom room, new Footprint settings, and a Custom HTML section can open and close a part on a click with no script. New exports; new optional props. No stored key or value moves. Every stored node draws the same bytes as before, except a Custom HTML section: it now keeps its ids (with the section prefix), buttons, popovers and `<details>`, and a link to an anchor outside the section stays as written (#816, #821). The `efficient-shell` peer widens to `^13.24.1 || ^14.0.0` (#813); the floor does not move.
|
|
40
|
+
|
|
41
|
+
**For hosts:**
|
|
42
|
+
- A host on efficient-shell 14 installs `efficient-easel` 37.2.0 or later. A host on shell 13.24.1 or later needs no change.
|
|
43
|
+
- storefront-blocks: its hero stylesheet reads `--sf-hero-phone-words-top`, `--sf-hero-phone-words-bottom` and `--sf-hero-phone-box-gap` with today's 100px / 90px / 28px fallbacks (storefront-blocks #629).
|
|
44
|
+
- storefront-blocks, admin email and easel: turn on the efficient-shell ui-check kind `option-read` (14.2.0). Do not import `oneOptionParser`; web-builder keeps it for its own tree only, and it is removed at the next web-builder major.
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
|
|
48
|
+
- **Phone words space on the hero.** Three phone-only rows, Words space top, Words space bottom and Space between boxes, on Hero (in its "On a phone" group) and on HeroSingle (a new "On a phone" heading). One value per Hero, 0-200 px; an empty row stores nothing. `lib/hero-phone-stack` exports the three CSS properties and `heroPhoneWordsStyle()`, which writes a property only for a stored number. HeroSingle -> Hero carries the keys. (#811)
|
|
49
|
+
- **Text, Heading and Button own their top and bottom room.** A top or bottom value set in the panel is now the total room the block draws; before, the block's fixed frame (16 px for Text and Button, 24 px for Heading) was always added. A new marker `padTotal` is written only on a panel edit; a node without it draws stored value + frame, as before. One reader, `ownPadOf` (`src/lib/content/section-padding.ts`); the frames are named once, `TEXT_PAD_FRAME` and `HEADING_PAD_FRAME`. The Button's new row is "Outer padding". No data move. (#812)
|
|
50
|
+
- **Footprint: Shows, Columns, Map height and the head in the list column.** Shows: Map and list (default) / Map only / List only. Columns (desktop list band): Auto (default) / 1-4; tablet at most 2, phone 1. Map height (list Left/Right): Fixed (default) / Full height. The section head can sit in the list column (`list-column`). Each reader goes through `parseOption` in `lib/content/footprint.ts`. No key is in `defaultProps`; a stored Footprint draws the same bytes. (#814)
|
|
51
|
+
- **Custom HTML opens a part on a click, with no script.** In a Custom HTML section, `<button popovertarget>` with a `popover`, and `<details>`/`<summary>`, are kept. `sanitizeHtml(html, { idPrefix })` allows `button`, `details`, `summary` and the id, popover and aria attributes; event handlers and `script` stay forbidden. Every `id` takes the section's prefix (`<block id>-`). A `#link`, `popovertarget` or `aria-*` value, and a CSS `#x`, take the prefix only when they name an id that the section itself draws; a link to an anchor outside the section (for example `#contact`) stays as written. With no prefix (an article body), nothing changes. (#816, #821)
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- **The builder takes document addressing from easel.** The Ticker root zone, slot and section-group zone keys, and new node ids come from `efficient-easel` (`ROOT_ZONE`, `zoneKey`, `newId`), not from local copies. The values are the same as before. A new guard fails on a hand-written root zone, zone key or `crypto.randomUUID` node id in `src/`. (#808)
|
|
56
|
+
- **A ratio hero keeps a bottom Box at the bottom in the editor.** In ratio mode the slide root is `flex flex-col` and the words layer `w-full flex-1`, so the layer fills the slide inside the editor's block wrapper too. The no-ratio classes do not change. (#819)
|
|
57
|
+
|
|
58
|
+
### Guards
|
|
59
|
+
|
|
60
|
+
- **The package ships its copy index.** The build writes the efficient-shell checker's index into `dist` last (one `--entry` per side: render, format, editor); `verify-dist` checks it is there, for this package and version, and that no exported side is empty. Checker `efficient-shell` 14.1.1 (dev only). (#813)
|
|
61
|
+
- **One option parser rule.** `oneOptionParser` (`src/lib/source-rules/one-option-parser.ts`) finds a stored option read by a hand-written conditional; every such read in `src/` now goes through `parseOption`. Each read returns the same answer for every stored value. `THEME_MODES` is exported from `lib/theme.ts`. (#810)
|
|
62
|
+
|
|
3
63
|
## 73.1.0 - 2026-11-19
|
|
4
64
|
|
|
5
65
|
From main at `1d788e30`: #806, #807.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CodeFormatter } from "efficient-shell/code";
|
|
2
|
+
export type CodeFormatterLoader = () => Promise<CodeFormatter | null>;
|
|
3
|
+
export declare const loadShellFormatter: CodeFormatterLoader;
|
|
4
|
+
export interface CustomHtmlCodeWindowProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (next: string) => void;
|
|
9
|
+
loadFormatter?: CodeFormatterLoader;
|
|
10
|
+
}
|
|
11
|
+
export default function CustomHtmlCodeWindow({ open, onClose, value, onChange, loadFormatter }: CustomHtmlCodeWindowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as i,Fragment as te}from"react/jsx-runtime";import{Suspense as oe,useContext as se,useEffect as B,useMemo as x,useRef as M,useState as h}from"react";import{AccordionHeading as k,Banner as ne,Button as C,Card as ie,Dialog as re,DropdownMenu as de,Segmented as ae,Text as r,buttonClasses as le,colorFill as ce,colorSwatchClasses as me,fitFrameStyle as he,fitScale as fe}from"efficient-shell/ui";import{CodeEditor as ue}from"efficient-shell/code";import{ChevronDownIcon as pe}from"efficient-shell/icons/efficient";import{AlignSeparateIcon as we}from"efficient-easel/icons";import{ScreenDocumentContext as ye}from"efficient-easel/screen/components/ScreenDocumentContext";import{usePreviewHeader as be}from"../../render/components/PreviewHeaderContext.js";import ve from"./SectionThemePicker.js";import ge from"./SiteTextStylesField.js";import{siteTextStyleSizeOf as xe}from"./WebsiteSettingsPanel.js";import{useSiteTextStylesWriter as ke}from"../lib/site-text-styles-writer.js";import{siteTextColourNameOf as Ce,siteTextColours as Se}from"../../format/lib/text-styles/site-text-colours.js";import{faceClassOf as Ne,storedTextStyles as Te,textStylesCss as $e}from"../../render/lib/text-styles/site-text-styles.js";import{normalizeTheme as Ae,themePresetAccentVars as ze}from"../../format/lib/theme.js";import{fontRoleStyle as Ee}from"../../format/lib/fonts.js";import{SECTION_PALETTE as W}from"../../format/lib/content/ink.js";import{CONTAINER_GAP_BUILT_IN as Oe,SITE_BLOCK_GAP_VAR as O,siteBlockGapTokens as _e}from"../../format/lib/content/container-gap.js";import{PHONE_EDGE as De}from"../../format/lib/content/view-lines.js";import{placeInsert as Pe}from"../../format/lib/document/custom-html-place.js";import{toHex as Ie}from"../../format/lib/document/part-inks.js";import{CUSTOM_HTML_PREVIEW_SANDBOX as Le,customHtmlPreviewDoc as Re,customHtmlRemoved as He,hostStylesheets as Fe}from"../lib/document/custom-html-preview.js";import{say as o}from"../../format/lib/editor-words.js";const Ge={bg:"Background",fg:"Text",surface:"Card","surface-2":"Card 2",line:"Line",muted:"Soft text"},U=`${Oe.Flex}px`,_=`var(${O}, ${U})`,Be=[{key:"heading",label:"Heading and text",code:`<h2 class="font-heading2">Title</h2>
|
|
2
|
+
<p class="font-body" style="color: var(--fg-dim)">Text</p>
|
|
3
|
+
`},{key:"columns",label:"Two columns",code:`<div style="display: grid; grid-template-columns: 1fr 1fr; gap: ${_}">
|
|
4
|
+
<div><h3 class="font-heading3">Left</h3><p class="font-body">Text</p></div>
|
|
5
|
+
<div><h3 class="font-heading3">Right</h3><p class="font-body">Text</p></div>
|
|
6
|
+
</div>
|
|
7
|
+
`},{key:"table",label:"Table",code:`<table style="width: 100%; border-collapse: collapse">
|
|
8
|
+
<tr><th class="font-mono">Name</th><th class="font-mono">Value</th></tr>
|
|
9
|
+
<tr><td class="font-body">A</td><td class="font-body">1</td></tr>
|
|
10
|
+
</table>
|
|
11
|
+
`},{key:"popup",label:"Icon with popup",code:`<button type="button" popovertarget="more" aria-label="More">ⓘ</button>
|
|
12
|
+
<div popover id="more">
|
|
13
|
+
<h3 class="font-heading3">Title</h3>
|
|
14
|
+
<p class="font-body">Text</p>
|
|
15
|
+
</div>
|
|
16
|
+
`},{key:"faq",label:"Question and answer",code:`<details>
|
|
17
|
+
<summary class="font-heading3">Question</summary>
|
|
18
|
+
<p class="font-body">Answer</p>
|
|
19
|
+
</details>
|
|
20
|
+
`}],Me=()=>import("efficient-shell/code/format").then(n=>n.prettierFormatter,()=>null);function We(n){if(typeof document>"u"||!n)return n;const d=document.createElement("span");if(d.style.color=n,!d.style.color)return n;document.body.appendChild(d);const a=getComputedStyle(d).color;d.remove();const c=document.createElement("canvas").getContext("2d");if(!c)return n;c.fillStyle=a,c.fillRect(0,0,1,1);const[f,S,u]=c.getImageData(0,0,1,1).data;return(Ie(`rgb(${f}, ${S}, ${u})`)??n).toUpperCase()}function Ue({open:n,onClose:d,value:a,onChange:c,loadFormatter:f=Me}){const{theme:S,fonts:u,blockGap:D,siteLengthUnits:P}=be(),m=Ae(S),I=!se(ye)?.capabilities?.hasSiteTheme,p=ke({themeFromDocument:I,persist:()=>{}}),[w,j]=h(m.selected),[N,V]=h("desktop"),[K,Q]=h(void 0),[T,L]=h(null),[R,q]=h(null),$=M(null);B(()=>{if(!n)return;let t=!0;return f().then(s=>{t&&q(s?{format:s.format}:null)}),()=>{t=!1}},[n,f]);const A=x(()=>{const t=ze(m),s=t[`--theme-preset-${w}-bg`]?w:m.selected,l={"--accent":t[`--theme-preset-${s}-accent`]??""};for(const g of W)l[g.token]=t[`--theme-preset-${s}-${g.role}`]??"";return l},[m,w]),H=_e(I?void 0:D,P.blockGapUnit),X=H[O]??U,F=x(()=>{const t=Object.fromEntries(Object.entries(Ee(u)).filter(([s])=>s.startsWith("--")));return{head:typeof document>"u"?"":Fe(document),htmlClass:typeof document>"u"?"":document.documentElement.className,bodyClass:typeof document>"u"?"":document.body.className,vars:{...A,...t,...H},css:$e(Te(p.saved))}},[A,u,D,P.blockGapUnit,p.saved,n]),J=x(()=>Re(a,F),[a,F]),z=x(()=>typeof DOMParser>"u"?[]:He(a),[a]),G=M(null),[E,Y]=h(0);B(()=>{const t=G.current;if(!t||typeof ResizeObserver>"u")return;const s=new ResizeObserver(()=>Y(t.clientWidth));return s.observe(t),()=>s.disconnect()},[n]);const y=N==="phone"?390:E>0?Math.max(E,De):1280,b=N==="phone"?1:fe(E,y),v=async t=>{const s=await $.current?.place((l,g,ee)=>Pe(l,g,ee,t));s&&L(s)},Z=async()=>{await $.current?.format()==="formatted"&&L(null)};return e(re,{open:n,onClose:d,size:"full",title:o("Custom HTML"),description:o("Build this section in HTML and CSS. The CSS changes this section only. Scripts do not run."),footer:e(C,{variant:"primary",onClick:d,children:o("Done")}),children:i("div",{className:"sf-code-window","data-code-window":"body",children:[i("aside",{className:"sf-code-window-styles","data-code-window":"styles",children:[e(k,{title:o("Styles"),level:2}),i("div",{className:"es-group-body sf-code-window-group",children:[e(r,{size:"xs",tone:"secondary",as:"p",children:o("Click a colour, text style or spacing to put a link to it in your code, at the cursor. If you change Styles later, this section changes with it.")}),e("div",{className:"es-editor sf-editor-tokens","data-code-window":"theme",children:e(ve,{value:w,onChange:j,hint:o("Shows the preview in this Theme. It adds no code. The section uses the Theme in its own settings."),canEdit:!1})})]}),e(k,{title:o("Colours"),level:2}),e("div",{className:"es-group-body",children:e("div",{className:"sf-code-window-list",role:"list",children:W.map(t=>{const s=o(Ge[t.role]??t.role),l=We(A[t.token]??"");return e("div",{role:"listitem",children:i(C,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${s}: ${o("add")} var(${t.token})`,onClick:()=>{Q(t.token),v({kind:"value",value:`var(${t.token})`,property:"color"})},children:[e("span",{className:me({size:"sm",selected:K===t.token}),"aria-hidden":"true",children:e("span",{className:"absolute inset-0",style:ce(l)})}),e(r,{size:"sm",weight:"medium",children:s}),e(r,{size:"2xs",tone:"tertiary",mono:!0,children:l}),e("span",{className:"sf-code-window-row-sub",children:e(r,{size:"2xs",tone:"secondary",mono:!0,children:t.token})})]})},t.token)})})}),e(k,{title:o("Text styles"),level:2}),e("div",{className:"es-group-body",children:e(ge,{saved:p.saved,old:p.old,colours:Se(m),colourNameOf:Ce(m),sizeOf:xe,onChange:()=>{},onPick:t=>{v({kind:"class",className:Ne(t)})}})}),e(k,{title:o("Spacing"),level:2}),e("div",{className:"es-group-body",children:i(C,{variant:"ghost",block:!0,className:"sf-code-window-row","aria-label":`${o("Gap between blocks")}: ${o("add")} ${_}`,onClick:()=>{v({kind:"value",value:_,property:"padding"})},children:[e("span",{className:"sf-code-window-row-icon","aria-hidden":"true",children:e(r,{tone:"secondary",children:e(we,{})})}),e(r,{size:"sm",weight:"medium",children:o("Gap between blocks")}),e(r,{size:"2xs",tone:"tertiary",children:X.replace(/(\d)px$/,"$1 px")}),e("span",{className:"sf-code-window-row-sub",children:e(r,{size:"2xs",tone:"secondary",mono:!0,children:O})})]})})]}),i("div",{className:"sf-code-window-column","data-code-window":"preview-column",children:[i("div",{className:"sf-code-window-bar",children:[e(ae,{size:"sm",value:N,onChange:V,options:[{value:"desktop",label:o("Desktop")},{value:"phone",label:o("Phone")}]}),e(r,{size:"xs",tone:"secondary",children:`${y} px · ${Math.round(b*100)}%`})]}),e(ie,{padding:"sm",className:"sf-code-window-fill",children:e("div",{className:"sf-code-window-fill",children:e("div",{ref:G,className:"sf-code-window-stage es-editor sf-editor-tokens sf-center",children:e("div",{className:"sf-frame",style:{width:y*b,flex:"none"},children:e("iframe",{title:o("Preview"),sandbox:Le,srcDoc:J,"data-code-window":"preview",style:{...he(y,b),height:`${100/b}%`}})})})})}),e("div",{role:"status","data-code-window":"status",children:e(ne,{tone:z.length?"warning":"success",emphasis:"subtle",children:z.length?`${o("Not published")}: ${z.join(", ")}. ${o("Scripts and event attributes are removed for safety.")}`:o("Everything here is published as written.")})})]}),i("div",{className:"sf-code-window-column","data-code-window":"code",children:[i("div",{className:"sf-code-window-bar",children:[e(r,{size:"xs",weight:"semibold",children:o("Code")}),i("div",{className:"sf-code-window-actions",children:[R?e(C,{variant:"secondary",onClick:()=>{Z()},children:o("Format code")}):null,e(de,{"aria-label":o("Add a ready-made part"),triggerClassName:le({variant:"secondary"}),align:"end",trigger:i(te,{children:[o("Add part")," ",e(pe,{size:12})]}),items:Be.map(t=>({key:t.key,label:o(t.label),onSelect:()=>{v({kind:"block",code:t.code})}}))})]})]}),T?i("div",{className:"sf-code-window-added","data-code-window":"added",children:[e(r,{size:"xs",tone:"secondary",children:`${o("Added on line")} ${T.line}:`}),e(r,{size:"2xs",mono:!0,truncate:!0,children:T.text})]}):null,e("div",{className:"sf-code-window-editor",children:e(oe,{fallback:null,children:e(ue,{ref:$,value:a,onChange:c,label:o("Section code"),lineWrap:!0,formatter:R??void 0})})})]})]})})}export{Ue as default,Me as loadShellFormatter};
|
|
@@ -7,7 +7,7 @@ export declare function SectionThemeMenu({ themes, value, onPick, onEdit, menuId
|
|
|
7
7
|
themes: ThemeColors[];
|
|
8
8
|
value: number | null;
|
|
9
9
|
onPick: (next: number) => void;
|
|
10
|
-
onEdit
|
|
10
|
+
onEdit?: (index: number) => void;
|
|
11
11
|
menuId?: string;
|
|
12
12
|
followLabel?: string;
|
|
13
13
|
}): import("react").JSX.Element;
|
|
@@ -17,9 +17,10 @@ export declare function SectionThemeEditor({ index, colors, onChange, onDone, }:
|
|
|
17
17
|
onChange: (next: ThemeColors) => void;
|
|
18
18
|
onDone: () => void;
|
|
19
19
|
}): import("react").JSX.Element;
|
|
20
|
-
export default function SectionThemePicker({ value, onChange, followLabel, hint, }: {
|
|
20
|
+
export default function SectionThemePicker({ value, onChange, followLabel, hint, canEdit, }: {
|
|
21
21
|
value: unknown;
|
|
22
22
|
onChange: (next: number) => void;
|
|
23
|
+
canEdit?: boolean;
|
|
23
24
|
followLabel?: string;
|
|
24
25
|
hint?: ReactNode;
|
|
25
26
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as l,Fragment as W}from"react/jsx-runtime";import{useCallback as S,useContext as V,useId as y,useRef as O,useState as D}from"react";import{ThemeIcon as q}from"efficient-easel/icons";import{Button as G,useClickOutside as J}from"efficient-shell/ui";import{SettingsField as Q}from"efficient-easel/panel";import{usePreviewHeader as U}from"../../render/components/PreviewHeaderContext.js";import{ScreenDocumentContext as X}from"efficient-easel/screen/components/ScreenDocumentContext";import{ThemeCard as Y,ThemeCardTrigger as Z,ThemeColourRows as ee,themeName as v}from"./ThemeCard.js";import{useThemeRowPersist as te}from"../lib/theme-row-persist.js";import{say as f}from"../../format/lib/editor-words.js";import{normalizeTheme as R,normalizeThemeColors as ne,selectedThemeColors as se}from"../../format/lib/theme.js";import{SECTION_ACCENT_INHERIT as oe,resolveSectionAccent as ce}from"../../format/lib/content/section-surface.js";const re="Follow the page",be="Follow the slideshow",ie=s=>f("Editing {name} changes it everywhere.",{name:s});function le({colors:s}){if(!s)return e("span",{className:"sf-secttheme-chip sf-secttheme-chip--none","aria-hidden":"true"});const t=ne(s);return l("span",{className:"sf-secttheme-chip","aria-hidden":"true",children:[e("i",{style:{background:t.background}}),e("i",{className:"sf-secttheme-chip-accent",style:{background:t.accent}})]})}function me({themes:s,value:t,onPick:r,onEdit:m,menuId:c,followLabel:a}){return l("div",{className:"sf-multi-menu sf-secttheme-menu",id:c,role:"listbox",children:[a!==void 0&&l(W,{children:[l("button",{type:"button",role:"option","aria-selected":t===null,className:`sf-secttheme-item${t===null?" is-active":""}`,onClick:()=>r(oe),children:[e(le,{}),e("span",{className:"sf-secttheme-name",children:f(a)})]}),e("div",{className:"sf-secttheme-sep",role:"presentation"})]}),t!==null&&s[t]&&e("p",{className:"sf-secttheme-oncard",role:"presentation",children:f("{name} is on this section",{name:v(t)})}),s.map((N,i)=>i===t?null:e(Y,{role:"option",index:i,colors:N,selected:!1,onPick:()=>r(i),onEdit:m?()=>m(i):void 0},i))]})}function ae({index:s,colors:t,onChange:r,onDone:m}){const c=v(s),a=y();return l("div",{className:"sf-secttheme-sheet",children:[l("div",{className:"sf-secttheme-sheet-head",children:[e("span",{children:c}),e(G,{variant:"secondary",className:"sf-secttheme-done",onClick:m,children:f("Done")})]}),e("div",{className:"sf-secttheme-rows",children:e(ee,{colors:t,onChange:r,idPrefix:a})}),e("p",{className:"sf-secttheme-warn",children:ie(c)})]})}function de({value:s,onChange:t,followLabel:r,hint:m,canEdit:c=!0}){const{theme:a,setTheme:N}=U(),i=R(a),g=V(X),F=g?.tokenRef,L=g?.siteId??null,P=!g?.capabilities?.hasSiteTheme,{persist:j,flush:k}=te({themeFromDocument:P,tokenRef:F,siteId:L}),E=R(i),d=E.themes,h=ce(s),w=h!==null?d[h]:void 0,A=w??(d.length?se(E):void 0),[p,C]=D(!1),[o,x]=D(null),_=O(null),I=O(null),T=y(),u=S(()=>{C(!1),x(null)},[]),B=S(()=>{!p&&o===null||(k(),u())},[p,o,u,k]);J(_,B);const H=n=>{t(n),u()},$=n=>{if(o===null)return;const z=d.map((K,M)=>M===o?n:K),b={...E,themes:z};N(b),j({selected_preset:b.selected,theme_presets:b.themes})};return l("div",{className:"sf-secttheme",ref:_,children:[e(Q,{label:f("Theme"),icon:e(q,{}),labelId:`${T}-label`,hint:m,children:e(Z,{colors:A,onEdit:c&&h!==null?()=>{x(h),C(!1)}:void 0,name:w?v(h):f(r??re),nameId:`${T}-value`,labelId:`${T}-label`,open:p,menuId:T,buttonRef:I,onClick:()=>{x(null),C(n=>!n)},onKeyDown:n=>{n.key==="Escape"&&(p||o!==null)&&(n.preventDefault(),u())}})}),p&&o===null&&e("div",{onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),u(),I.current?.focus())},children:e(me,{themes:d,value:h,onPick:H,onEdit:c?n=>{x(n),C(!1)}:void 0,menuId:T,followLabel:r})}),c&&o!==null&&d[o]&&e(ae,{index:o,colors:d[o],onChange:$,onDone:()=>{k(),u(),I.current?.focus()}})]})}export{be as BLOCK_THEME_FOLLOW_LABEL,re as SECTION_THEME_FOLLOW_LABEL,ae as SectionThemeEditor,me as SectionThemeMenu,de as default,ie as sectionThemeEditWarning};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TextStyleColour, type TextStyleColourNameOf, type TextStyleFont } from "efficient-easel/text-styles";
|
|
2
2
|
import { type OldSiteText, type StoredTextStyle } from "../../render/lib/text-styles/site-text-styles.js";
|
|
3
3
|
export declare const SITE_FONTS: TextStyleFont[];
|
|
4
|
-
export default function SiteTextStylesField({ saved, old, colours, colourNameOf, sizeOf, onChange, openId, onOpenChange, readOnly, withoutSize, }: {
|
|
4
|
+
export default function SiteTextStylesField({ saved, old, colours, colourNameOf, sizeOf, onChange, openId, onOpenChange, readOnly, withoutSize, onPick, }: {
|
|
5
5
|
saved: unknown;
|
|
6
6
|
old: OldSiteText;
|
|
7
7
|
colours: readonly TextStyleColour[];
|
|
@@ -15,4 +15,5 @@ export default function SiteTextStylesField({ saved, old, colours, colourNameOf,
|
|
|
15
15
|
onOpenChange?: (id: string | null) => void;
|
|
16
16
|
readOnly?: boolean;
|
|
17
17
|
withoutSize?: boolean;
|
|
18
|
+
onPick?: (style: StoredTextStyle) => void;
|
|
18
19
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as w}from"react/jsx-runtime";import{useState as x}from"react";import{TextStylesList as I}from"efficient-easel/text-styles";import{FONT_OPTIONS as _}from"../../format/lib/fonts.js";import{viewOfTier as C}from"../../format/lib/content/view-tier.js";import{usePreviewDevice as E}from"efficient-easel/draw/client";import{applyListChange as N,resolveTextStyles as L,toPanelStyles as b}from"../../render/lib/text-styles/site-text-styles.js";const p=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],k=["size","lineSpacing","letterSpacing","letterCase"],A=500,F=_.map(t=>({value:t.key,label:t.label,family:`var(${t.cssVar})`,italic:t.italicLoaded}));function z({saved:t,old:a,colours:d,colourNameOf:S,sizeOf:l,onChange:m,openId:r,onOpenChange:u,readOnly:g=!1,withoutSize:T=!1,onPick:c}){const O=E(),[h,v]=x(null),s=L(t,a),o=C(O),f=b(s,l,o);return w(I,{styles:f,onChange:e=>m(N({saved:t,old:a,cur:f,next:e,sizeOf:l,panelView:o})),fonts:F,colours:d,colourNameOf:S,settings:T?p.filter(e=>e!=="size"):p,auto:k,openId:r===void 0?h:r,onOpenChange:u??v,readOnly:g,device:o,onPick:c?e=>{const i=s.find(n=>n.id===e.id);i&&c(i)}:void 0,fallback:e=>{const i=s.find(y=>y.id===(e.kind==="heading"?"heading-1":"body-1")),n={};return i?.values.font&&e.id!==i.id&&(n.font=i.values.font),e.kind==="heading"&&(n.weight=A),n}})}export{F as SITE_FONTS,z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,Fragment as C,jsxs as R}from"react/jsx-runtime";import{useEasel as x}from"efficient-easel/easel";import{
|
|
1
|
+
"use client";import{jsx as s,Fragment as C,jsxs as R}from"react/jsx-runtime";import{useEasel as x}from"efficient-easel/easel";import{zoneKey as b}from"efficient-easel/data";import{LayersIcon as F}from"efficient-easel/icons";import{SettingsDrill as k,SettingsField as _}from"efficient-easel/panel";import j from"efficient-easel/screen/components/AddChildRow";import{useSlotChildActions as y}from"efficient-easel/screen/components/SlotChildActionsContext";import{HERO_GROUP_TYPE as D,heroGroupNestDepth as I}from"../../format/lib/hero-group-placement.js";import{canAddTo as p}from"../lib/document/add-target.js";import{say as O}from"../../format/lib/editor-words.js";function E({parent:o,parentType:t,label:r,rowName:n,onSelectChild:e,onAddChild:l,nestDepth:m=0}){const u=p(t,m);if(!u)return null;const{slot:d,choices:A,spec:i}=u,f=String(o.props.id),h=b({parentId:f,slot:d}),c=Array.isArray(o.props[d])?o.props[d]:[],w=i?.addBlocked?.(c)??null,S=i?.notice?.(c)??null,g=R(C,{children:[S?s("p",{className:"sf-note",children:S}):null,c.map((a,N)=>s(k,{name:n(a),onOpen:()=>e(h,N,String(a.props.id),t)},String(a.props.id??`${h}-${N}`))),A||i.fixed?null:s(j,{label:i.addLabel,blocked:w,onAdd:()=>l(f,d,i.childType,c.length,t)})]});return s("div",{className:"sf-slot-rows",children:r?s(_,{label:O(r),icon:s(F,{}),value:String(c.length),children:g}):g})}function v(o,t){return p(o)?.spec?.notice?.(t)??null}function M({parentType:o}){const{selectedItem:t}=x(l=>l);if(!t||t.type!==o)return null;const r=p(o)?.slot,n=r&&Array.isArray(t.props[r])?t.props[r]:[],e=v(o,n);return e?s("p",{className:"sf-note",children:e}):null}function z(o,t){return p(t)?.source==="footer"?o.blockRowName:o.childRowName}function G({parentType:o,label:t}){const{appState:r,selectedItem:n}=x(m=>m),e=y();if(!e||!n||n.type!==o)return null;const l=o===D?I(r?.data,String(n.props.id)):0;return s(E,{parent:n,parentType:o,label:t,rowName:z(e,o),onSelectChild:e.selectChild,onAddChild:e.addChild,nestDepth:l})}export{E as SlotChildRows,M as SlotNoticeField,G as default,z as rowNamerFor,v as slotNoticeOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o}from"react/jsx-runtime";import X from"./WebsiteHintsProvider.js";import{useCallback as H,useEffect as P,useMemo as l,useRef as Z,useState as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import X from"./WebsiteHintsProvider.js";import{useCallback as H,useEffect as P,useMemo as l,useRef as Z,useState as f}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as $}from"../lib/document/build-config.js";import{withTemplateMediaPlaceholders as ee}from"../../format/lib/document/templateFields.js";import{setEditorPageSlug as B}from"../../format/lib/document/editor-page-context.js";import{ScreenDocumentContext as te}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as re}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as oe}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as ie}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as ne}from"efficient-easel/draw/client";import{CanvasPartsBridge as se}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as de}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as ae}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"efficient-easel/screen/lib/section-templates";import{saveSectionTemplate as R}from"../lib/editor-document-adapter.js";import{nodeToDoc as me,docToNode as F}from"efficient-easel/screen/lib/document/section-doc";import{newNodeId as ce}from"efficient-easel/draw";import{migrateRenamedProps as le}from"../../format/lib/document/renamed-props.js";import{buildSlotSeedChildren as fe}from"../../render/lib/document/slot-specs.js";import{FOOTER_TYPE as ue,buildDefaultFooterBlocks as pe}from"../lib/document/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as ve,useAdminBridge as ge}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as he}from"efficient-easel/screen/lib/host";import{ChromeWrap as Pe}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as Ee}from"efficient-easel/screen/lib/session";import{useEaselSession as Se}from"efficient-easel/screen/lib/session-context";import{say as L}from"../../format/lib/editor-words.js";import{retargetWhenSaved as ye}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as Te}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as we}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as E,THEME_MODE_KEY as Ne}from"../../format/lib/theme.js";import{makeSitePageAdapter as U}from"../lib/editor-document-adapter.js";import{documentPermissions as Ce}from"efficient-easel/edit-lock";import{useAutosave as ke}from"efficient-easel/autosave";import{saveStatusOf as Ae}from"efficient-easel/screen/lib/document-switch";import{blocksOf as Me}from"../lib/website-session.js";import{parseOption as Oe}from"efficient-shell/format";import{THEME_MODES as be}from"../../format/lib/theme.js";const Ie=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),De=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),W="Hero",Y="Untitled section";function _e(s,S){const d=S.components,r=d[s]?s:W,y=d[r]?.defaultProps??{},i=fe(r,u=>d[u]?.defaultProps??{}),n=r===ue?{blocks:pe()}:null;return{type:r,props:{id:ce(r),...y,...i?{[i.slot]:i.children}:null,...n}}}function He(){if(typeof window>"u")return E;try{const s=window.localStorage.getItem(Ne);return Oe(be,E,s)}catch{return E}}function xe({id:s,initialType:S,initialName:d=Y}){const[r,y]=f(s),i=Z(r);P(()=>{i.current=r},[r]);const n=he(),[u,j]=f(S),[b,K]=f(d),[a,T]=f(void 0),[G,q]=f(E),{token:w,tokenRef:I}=ge({onMessage:e=>{if(we(e)||Te(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const M=t.target.id;if(M===i.current)return;const Q=t.target.type,V=t.target.name;ye(C,()=>{j(Q),K(V||Y),y(M),n.address.show({kind:"section",id:M})},()=>n.send("storefront-editor:save-failed"))}}}),N=ke({save:e=>R(O,e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&n.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:C}=N;P(()=>q(He()),[]);const m=Se(),v=m.usesBridgedToken?!!w:!0,g=l(()=>$(Ee(m),Me(m)),[m]);P(()=>{if(!v)return;let e=!1;return T(void 0),O.ensure(r,b,_e(u??W,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,u,b,v,g]);const k=H(e=>{n.send("storefront-editor:dirty");const t=F(e);t&&D({id:i.current,node:t})},[D,n]),h=n.send,_=H(async e=>{try{return await e(I.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),z=l(()=>ee(g,!0),[g]);P(()=>(B(null),()=>B(null)),[]);const c=l(()=>a?le(me(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:U(void 0),capabilities:U(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:I,notifyParent:h,runAuthed:_,docId:r,data:c,getLiveData:()=>c,error:null,redirecting:!1,saveStatus:Ae(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:k,flushSave:C,onPublish:async e=>{const t=F(e);t&&await R(O,i.current,t)},bridgeCapabilities:ve,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,c,p,k,C,N.retryNow]),J=l(()=>Ce(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:L("Loading…")}):a===null||!c?o("div",{className:"sf-msg sf-msg--error",children:L("Couldn’t open this section.")}):o(te.Provider,{value:A,children:o(X,{children:o(re,{themeMode:G,chromePlaceholder:!0,children:o(Pe,{wrap:m.chrome?.wrap,surface:"section",children:o(oe,{children:o(ie,{children:o(ne,{children:o(de,{children:o(se,{children:o(ae,{children:o(Ie,{config:z,data:c,onChange:k,permissions:J,children:o(De,{})},r)})})})})})})})})})})}export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as wt}from"react/jsx-runtime";import{useCallback as o,useEffect as f,useMemo as Ct,useRef as g,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{useHostConfig as _t}from"../lib/document/host-config.js";import{ChromeWrap as Pt}from"efficient-easel/screen/lib/host-chrome";import{refreshSiteLiveState as Tt}from"../lib/site-live-state.js";import{holdSiteWrites as Et}from"../../format/lib/site-writes.js";import{backendOf as W}from"../lib/website-session.js";import{useEaselSession as yt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Gt}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/document/templateFields.js";import{setEditorPage as he}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as kt}from"./EditorPagePathProvider.js";import{AddPageOnOpen as Ht}from"./AddPageOnOpen.js";import{resolveSiteName as Wt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Bt,normalizeSiteGutterPhone as Rt,normalizeSiteWidth as Ft}from"../../format/lib/content/page-width.js";import{siteLengthNumber as w,siteLengthUnitsOfRow as It}from"../../format/lib/content/css-length.js";import{normalizeSiteBackground as ue}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as le}from"../../format/lib/content/container-gap.js";import Dt,{DocumentScreen as bt}from"efficient-easel/screen/components/ScreenMount";import Ot from"./WebsiteHintsProvider.js";import{useScreenDocument as Mt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Nt,siteThemeRow as xt,themeEdited as Ut,themeSeeded as At}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Lt}from"./PreviewFooterContext.js";import{PreviewChatProvider as zt,DEFAULT_CHAT_PREVIEW as Yt}from"./PreviewChatContext.js";import{PreviewSocialProvider as jt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Vt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Xt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as qt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Jt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Qt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as $t}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as er}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as tr,DEFAULT_HEADING_COMPRESSION as rr,DEFAULT_HEADING_TYPOGRAPHY as or,DEFAULT_SWITCH_SHOWN as B,DEFAULT_SIZES as nr,DEFAULT_THEME_MODE as T,normalizeCornerRadius as ir,normalizeCornerStyle as ar,normalizeCardShadow as cr,normalizeCardGap as sr,normalizeHoverEffect as dr,IDENTITY_CARD_GAP as me,IDENTITY_CARD_SHADOW as hr,IDENTITY_HOVER_EFFECT as ur,THEME_MODE_KEY as pe,THEME_STORAGE_KEY as lr,THEME_SWITCH_HIDE as Se,THEME_SWITCH_KEY as R}from"../../format/lib/theme.js";import{pictureShadowColor as mr}from"efficient-easel/screen/lib/document/shadow-values";import{DEFAULT_FONTS as pr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Sr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as fr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as gr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as wr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as Cr}from"./PreviewChatContext.js";const _r=()=>{if(typeof window>"u")return T;try{const s=window.localStorage.getItem(pe);return s==="light"||s==="dark"||s==="auto"?s:T}catch{return T}},fe=s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pe,s)}catch{}},Pr=()=>{if(typeof window>"u")return B;try{return window.localStorage.getItem(R)!==Se}catch{return B}},Tr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(lr)}catch{}},ge=s=>{if(!(typeof window>"u"))try{s?window.localStorage.removeItem(R):window.localStorage.setItem(R,Se)}catch{}};function Er(){const{adapter:s,capabilities:d,templateId:F,ready:_,token:h,siteId:c,currentSlug:I,currentKind:D}=Mt();f(()=>(he(I,D),()=>he(null,null)),[I,D]);const E=d.placeholderFrames,[we,b]=r(null),[Ce,O]=r("");f(()=>{const e=s.templateName;if(!_||!F||!e){O("");return}let i=!1;return e().then(u=>!i&&O(u??"")).catch(()=>{}),()=>{i=!0}},[_,h,F,s]);const[_e,y]=r(T),[Pe,G]=r(B),[M,N]=r({value:{selected:0,themes:[]},readFor:null}),Te=M.value,[Ee,x]=r(pr),[ye,U]=r(nr),[Ge,A]=r(null),[ve,L]=r(rr),[ke,z]=r(null),[He,Y]=r(null),[We,j]=r(me),[Be,K]=r(null),[Re,V]=r(null),[Fe,X]=r(null),[Ie,Z]=r(null),[v,q]=r(null),[k,J]=r(null),[De,Q]=r({}),be=o(e=>Q(i=>({...i,...e})),[]),l=yt(),$=_t(),Oe=Ct(()=>Gt(vt($,E),v,k),[$,E,v,k]),[Me,ee]=r(or),[Ne,te]=r(null),[xe,re]=r(null),[Ue,oe]=r(null),[Ae,ne]=r(null),[Le,ie]=r(null),ae=g(null),n=g(!1);f(()=>{y(_r()),G(Pr())},[]);const ze=o(e=>{n.current=!0,Tr(),fe(e),y(e)},[]),Ye=o(e=>{n.current=!0,ge(e),G(e)},[]),je=o(e=>{n.current=!0,N(i=>Ut(i,e,c??""))},[c]),Ke=o(e=>{n.current=!0,x(e)},[]),Ve=o(e=>{n.current=!0,U(e)},[]),Xe=o(e=>{n.current=!0,A(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,z(e)},[]),Je=o(e=>{n.current=!0,Y(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,K(e)},[]),et=o(e=>{n.current=!0,ee(e)},[]),[tt,ce]=r(null),[rt,ot]=r(null),nt=o(e=>{n.current=!0,ce(e)},[]),it=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),ct=o(e=>{n.current=!0,Z(e)},[]),st=o(e=>{n.current=!0,q(e)},[]),dt=o(e=>{n.current=!0,J(e)},[]),ht=o(e=>{n.current=!0,te(e)},[]),ut=o(e=>{n.current=!0,re(e)},[]),lt=o(e=>{n.current=!0,oe(e)},[]),mt=o(e=>{n.current=!0,ne(e)},[]),pt=o(e=>{n.current=!0,ie(e)},[]);f(()=>{const e=W(l).theme;if(!h||!d.hasSiteTheme||!e)return;const i=c??"";ae.current!==i&&(ae.current=i,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;fe(t.default_mode),ge(t.show_theme_switch),y(t.default_mode),G(t.show_theme_switch),N(At({selected:t.selected_preset,themes:t.theme_presets},i));const C=gr(t);x(C.fonts),U(C.sizes);const S=It(t);Q(S),A(t.corner_radius_px===void 0?tr[ar(t.corner_style)]:w(t.corner_radius_px,S.cornerRadiusUnit,ir)),L(C.compression),z(t.card_shadow==null?hr:cr(t.card_shadow)),j(t.card_gap==null?me:sr(t.card_gap)),K(t.hover_effect==null?ur:dr(t.hover_effect)),Y(mr(t.shadow_color)),V(w(t.site_width,S.siteWidthUnit,Ft)),X(w(t.site_gutter,S.siteGutterUnit,Bt)),Z(w(t.site_gutter_phone,S.siteGutterPhoneUnit,Rt)),q(w(t.block_gap,S.blockGapUnit,le)),J(w(t.block_gap_phone,S.blockGapPhoneUnit,le)),ee(C.typography),ce(C.textStyles),ot(wr(t)),te(t.hero_background_follows_width===!0),re(ue(t.section_background_width)),oe(ue(t.section_content_width)),ne(t.photography_grayscale===!0),ie(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[h,c,d.hasSiteTheme,l]);const St=Kt({token:h,siteId:c,enabled:d.hasSiteSettings}),[ft,se]=r(Yt),de=g(null),H=g(!1),m=g(null),p=g({}),P=o(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await W(l).chat?.update(e,c?{siteId:c}:void 0),Tt()}catch(i){throw p.current={...e,...p.current},i}},[l,c]);f(()=>Et(()=>m.current||Object.keys(p.current).length>0?P():void 0),[P]);const gt=o(e=>{H.current=!0,se(i=>({...i,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{P().catch(()=>{})},500))},[d.hasSiteSettings,h,P]);return f(()=>{if(!h||!d.hasSiteSettings)return;const e=c??"";de.current!==e&&(de.current=e,H.current=!1);let i=!1;const u=W(l).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{i||H.current||se(Cr(t))}).catch(()=>{}),()=>{i=!0}},[h,c,d.hasSiteSettings,l]),f(()=>{const e=s.site;if(!_||!d.hasSiteRecord||!e){b(null);return}let i=!1;return e().then(u=>{i||b(Wt(u.name))}).catch(()=>{}),()=>{i=!0}},[_,h,d.hasSiteRecord,c,s]),a(bt,{config:Oe,parts:Sr,wrap:(e,i)=>a(Nt,{websiteName:we,templateChrome:E,templateName:Ce||null,themeMode:_e,onThemeModeChange:ze,themeSwitchShown:Pe,onThemeSwitchShownChange:Ye,theme:Te,themeRow:xt(d.hasSiteTheme,M.readFor,c??""),onThemeChange:je,fonts:Ee,onFontsChange:Ke,cornerRadiusPx:Ge,onCornerRadiusPxChange:Xe,cardShadow:ke,onCardShadowChange:qe,shadowColor:He,onShadowColorChange:Je,cardGap:We,onCardGapChange:Qe,hoverEffect:Be,onHoverEffectChange:$e,headingCompression:ve,onHeadingCompressionChange:Ze,headingTypography:Me,onHeadingTypographyChange:et,textStyles:tt,onTextStylesChange:nt,wordStyles:rt,sizes:ye,onSizesChange:Ve,siteWidth:Re,onSiteWidthChange:it,siteGutter:Fe,onSiteGutterChange:at,siteGutterPhone:Ie,onSiteGutterPhoneChange:ct,blockGap:v,onBlockGapChange:st,blockGapPhone:k,onBlockGapPhoneChange:dt,siteLengthUnits:De,onSiteLengthUnitsChange:be,heroBackgroundFollowsWidth:Ne,onHeroBackgroundFollowsWidthChange:ht,sectionBackgroundWidth:xe,onSectionBackgroundWidthChange:ut,sectionContentWidth:Ue,onSectionContentWidthChange:lt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:mt,shareButtonOnPosts:Le,onShareButtonOnPostsChange:pt,themeFromDocument:!d.hasSiteTheme,children:a(Lt,{children:a(Pt,{wrap:l.chrome?.wrap,surface:"page",children:a(Zt,{children:a(qt,{children:a(Jt,{children:a($t,{children:a(Qt,{children:wt(er,{children:[a(zt,{chat:ft,onChatChange:gt,children:a(jt,{value:St,children:a(Vt,{children:a(kt,{children:a(Ot,{children:e})})})})}),i]})})})})})})})})})})}function yr({target:s,openAddPage:d}){return a(Ht,{open:d,children:a(Dt,{target:s,addressing:Xt,onHostMessage:fr,children:a(Er,{})})})}export{yr as default};
|
|
1
|
+
"use client";import{jsx as a,jsxs as wt}from"react/jsx-runtime";import{useCallback as o,useEffect as f,useMemo as Ct,useRef as g,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{useHostConfig as _t}from"../lib/document/host-config.js";import{ChromeWrap as Pt}from"efficient-easel/screen/lib/host-chrome";import{refreshSiteLiveState as Tt}from"../lib/site-live-state.js";import{holdSiteWrites as Et}from"../../format/lib/site-writes.js";import{backendOf as k}from"../lib/website-session.js";import{useEaselSession as yt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Gt}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/document/templateFields.js";import{setEditorPage as he}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as Ht}from"./EditorPagePathProvider.js";import{AddPageOnOpen as Wt}from"./AddPageOnOpen.js";import{resolveSiteName as kt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Bt,normalizeSiteGutterPhone as Rt,normalizeSiteWidth as Ft}from"../../format/lib/content/page-width.js";import{siteLengthNumber as w,siteLengthUnitsOfRow as It}from"../../format/lib/content/css-length.js";import{normalizeSiteBackground as ue}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as le}from"../../format/lib/content/container-gap.js";import Dt,{DocumentScreen as Ot}from"efficient-easel/screen/components/ScreenMount";import Mt from"./WebsiteHintsProvider.js";import{useScreenDocument as bt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Nt,siteThemeRow as xt,themeEdited as Ut,themeSeeded as At}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Lt}from"./PreviewFooterContext.js";import{PreviewChatProvider as zt,DEFAULT_CHAT_PREVIEW as Yt}from"./PreviewChatContext.js";import{PreviewSocialProvider as jt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Vt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Xt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as qt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Jt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Qt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as $t}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as er}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as tr,DEFAULT_HEADING_COMPRESSION as rr,DEFAULT_HEADING_TYPOGRAPHY as or,DEFAULT_SWITCH_SHOWN as B,DEFAULT_SIZES as nr,DEFAULT_THEME_MODE as T,normalizeCornerRadius as ir,normalizeCornerStyle as ar,normalizeCardShadow as cr,normalizeCardGap as sr,normalizeHoverEffect as dr,IDENTITY_CARD_GAP as me,IDENTITY_CARD_SHADOW as hr,IDENTITY_HOVER_EFFECT as ur,THEME_MODE_KEY as pe,THEME_STORAGE_KEY as lr,THEME_SWITCH_HIDE as Se,THEME_SWITCH_KEY as R}from"../../format/lib/theme.js";import{pictureShadowColor as mr}from"efficient-easel/screen/lib/document/shadow-values";import{DEFAULT_FONTS as pr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Sr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as fr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as gr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as wr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as Cr}from"./PreviewChatContext.js";import{parseOption as _r}from"efficient-shell/format";import{THEME_MODES as Pr}from"../../format/lib/theme.js";const Tr=()=>{if(typeof window>"u")return T;try{const d=window.localStorage.getItem(pe);return _r(Pr,T,d)}catch{return T}},fe=d=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pe,d)}catch{}},Er=()=>{if(typeof window>"u")return B;try{return window.localStorage.getItem(R)!==Se}catch{return B}},yr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(lr)}catch{}},ge=d=>{if(!(typeof window>"u"))try{d?window.localStorage.removeItem(R):window.localStorage.setItem(R,Se)}catch{}};function Gr(){const{adapter:d,capabilities:s,templateId:F,ready:_,token:h,siteId:c,currentSlug:I,currentKind:D}=bt();f(()=>(he(I,D),()=>he(null,null)),[I,D]);const E=s.placeholderFrames,[we,O]=r(null),[Ce,M]=r("");f(()=>{const e=d.templateName;if(!_||!F||!e){M("");return}let i=!1;return e().then(u=>!i&&M(u??"")).catch(()=>{}),()=>{i=!0}},[_,h,F,d]);const[_e,y]=r(T),[Pe,G]=r(B),[b,N]=r({value:{selected:0,themes:[]},readFor:null}),Te=b.value,[Ee,x]=r(pr),[ye,U]=r(nr),[Ge,A]=r(null),[ve,L]=r(rr),[He,z]=r(null),[We,Y]=r(null),[ke,j]=r(me),[Be,K]=r(null),[Re,V]=r(null),[Fe,X]=r(null),[Ie,Z]=r(null),[v,q]=r(null),[H,J]=r(null),[De,Q]=r({}),Oe=o(e=>Q(i=>({...i,...e})),[]),l=yt(),$=_t(),Me=Ct(()=>Gt(vt($,E),v,H),[$,E,v,H]),[be,ee]=r(or),[Ne,te]=r(null),[xe,re]=r(null),[Ue,oe]=r(null),[Ae,ne]=r(null),[Le,ie]=r(null),ae=g(null),n=g(!1);f(()=>{y(Tr()),G(Er())},[]);const ze=o(e=>{n.current=!0,yr(),fe(e),y(e)},[]),Ye=o(e=>{n.current=!0,ge(e),G(e)},[]),je=o(e=>{n.current=!0,N(i=>Ut(i,e,c??""))},[c]),Ke=o(e=>{n.current=!0,x(e)},[]),Ve=o(e=>{n.current=!0,U(e)},[]),Xe=o(e=>{n.current=!0,A(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,z(e)},[]),Je=o(e=>{n.current=!0,Y(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,K(e)},[]),et=o(e=>{n.current=!0,ee(e)},[]),[tt,ce]=r(null),[rt,ot]=r(null),nt=o(e=>{n.current=!0,ce(e)},[]),it=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),ct=o(e=>{n.current=!0,Z(e)},[]),st=o(e=>{n.current=!0,q(e)},[]),dt=o(e=>{n.current=!0,J(e)},[]),ht=o(e=>{n.current=!0,te(e)},[]),ut=o(e=>{n.current=!0,re(e)},[]),lt=o(e=>{n.current=!0,oe(e)},[]),mt=o(e=>{n.current=!0,ne(e)},[]),pt=o(e=>{n.current=!0,ie(e)},[]);f(()=>{const e=k(l).theme;if(!h||!s.hasSiteTheme||!e)return;const i=c??"";ae.current!==i&&(ae.current=i,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;fe(t.default_mode),ge(t.show_theme_switch),y(t.default_mode),G(t.show_theme_switch),N(At({selected:t.selected_preset,themes:t.theme_presets},i));const C=gr(t);x(C.fonts),U(C.sizes);const S=It(t);Q(S),A(t.corner_radius_px===void 0?tr[ar(t.corner_style)]:w(t.corner_radius_px,S.cornerRadiusUnit,ir)),L(C.compression),z(t.card_shadow==null?hr:cr(t.card_shadow)),j(t.card_gap==null?me:sr(t.card_gap)),K(t.hover_effect==null?ur:dr(t.hover_effect)),Y(mr(t.shadow_color)),V(w(t.site_width,S.siteWidthUnit,Ft)),X(w(t.site_gutter,S.siteGutterUnit,Bt)),Z(w(t.site_gutter_phone,S.siteGutterPhoneUnit,Rt)),q(w(t.block_gap,S.blockGapUnit,le)),J(w(t.block_gap_phone,S.blockGapPhoneUnit,le)),ee(C.typography),ce(C.textStyles),ot(wr(t)),te(t.hero_background_follows_width===!0),re(ue(t.section_background_width)),oe(ue(t.section_content_width)),ne(t.photography_grayscale===!0),ie(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[h,c,s.hasSiteTheme,l]);const St=Kt({token:h,siteId:c,enabled:s.hasSiteSettings}),[ft,se]=r(Yt),de=g(null),W=g(!1),m=g(null),p=g({}),P=o(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await k(l).chat?.update(e,c?{siteId:c}:void 0),Tt()}catch(i){throw p.current={...e,...p.current},i}},[l,c]);f(()=>Et(()=>m.current||Object.keys(p.current).length>0?P():void 0),[P]);const gt=o(e=>{W.current=!0,se(i=>({...i,...e})),!(!s.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{P().catch(()=>{})},500))},[s.hasSiteSettings,h,P]);return f(()=>{if(!h||!s.hasSiteSettings)return;const e=c??"";de.current!==e&&(de.current=e,W.current=!1);let i=!1;const u=k(l).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{i||W.current||se(Cr(t))}).catch(()=>{}),()=>{i=!0}},[h,c,s.hasSiteSettings,l]),f(()=>{const e=d.site;if(!_||!s.hasSiteRecord||!e){O(null);return}let i=!1;return e().then(u=>{i||O(kt(u.name))}).catch(()=>{}),()=>{i=!0}},[_,h,s.hasSiteRecord,c,d]),a(Ot,{config:Me,parts:Sr,wrap:(e,i)=>a(Nt,{websiteName:we,templateChrome:E,templateName:Ce||null,themeMode:_e,onThemeModeChange:ze,themeSwitchShown:Pe,onThemeSwitchShownChange:Ye,theme:Te,themeRow:xt(s.hasSiteTheme,b.readFor,c??""),onThemeChange:je,fonts:Ee,onFontsChange:Ke,cornerRadiusPx:Ge,onCornerRadiusPxChange:Xe,cardShadow:He,onCardShadowChange:qe,shadowColor:We,onShadowColorChange:Je,cardGap:ke,onCardGapChange:Qe,hoverEffect:Be,onHoverEffectChange:$e,headingCompression:ve,onHeadingCompressionChange:Ze,headingTypography:be,onHeadingTypographyChange:et,textStyles:tt,onTextStylesChange:nt,wordStyles:rt,sizes:ye,onSizesChange:Ve,siteWidth:Re,onSiteWidthChange:it,siteGutter:Fe,onSiteGutterChange:at,siteGutterPhone:Ie,onSiteGutterPhoneChange:ct,blockGap:v,onBlockGapChange:st,blockGapPhone:H,onBlockGapPhoneChange:dt,siteLengthUnits:De,onSiteLengthUnitsChange:Oe,heroBackgroundFollowsWidth:Ne,onHeroBackgroundFollowsWidthChange:ht,sectionBackgroundWidth:xe,onSectionBackgroundWidthChange:ut,sectionContentWidth:Ue,onSectionContentWidthChange:lt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:mt,shareButtonOnPosts:Le,onShareButtonOnPostsChange:pt,themeFromDocument:!s.hasSiteTheme,children:a(Lt,{children:a(Pt,{wrap:l.chrome?.wrap,surface:"page",children:a(Zt,{children:a(qt,{children:a(Jt,{children:a($t,{children:a(Qt,{children:wt(er,{children:[a(zt,{chat:ft,onChatChange:gt,children:a(jt,{value:St,children:a(Vt,{children:a(Ht,{children:a(Mt,{children:e})})})})}),i]})})})})})})})})})})}function vr({target:d,openAddPage:s}){return a(Wt,{open:s,children:a(Dt,{target:d,addressing:Xt,onHostMessage:fr,children:a(Gr,{})})})}export{vr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as w,jsxs as k}from"react/jsx-runtime";import{useId as E,useMemo as S}from"react";import{useEasel as _}from"efficient-easel/easel";import{SettingsField as g,SettingsSwitch as x}from"efficient-easel/panel";import{EyeIcon as b}from"efficient-easel/icons";import{fieldShownInView as y}from"efficient-easel/fields";import{usePreviewDevice as R}from"efficient-easel/draw/client";import{
|
|
1
|
+
"use client";import{jsx as t,Fragment as w,jsxs as k}from"react/jsx-runtime";import{useId as E,useMemo as S}from"react";import{useEasel as _}from"efficient-easel/easel";import{SettingsField as g,SettingsSwitch as x}from"efficient-easel/panel";import{EyeIcon as b}from"efficient-easel/icons";import{fieldShownInView as y}from"efficient-easel/fields";import{usePreviewDevice as R}from"efficient-easel/draw/client";import{ROOT_ZONE as O}from"efficient-easel/draw";import{DEFAULT_TICKER_ITEMS as C}from"../../format/lib/hero-ticker.js";import{TextListField as F,TICKER_ITEMS_ROW as a}from"../lib/document/controls.js";import{say as p}from"../../format/lib/editor-words.js";import{SiteFields as A}from"./SiteFields.js";import{usePartMotion as L}from"./usePartMotion.js";import{TICKER_MOTION_PART as M}from"../../format/lib/hero-ticker.js";import{TICKER_PANEL_ROWS as N}from"../lib/document/part-panel-rows.js";import{SameInEveryViewNote as P}from"./SameInEveryViewNote.js";function j({heroId:s}){const{appState:l,dispatch:d}=_(e=>e),n=l.data.content??[],i=n.findIndex(e=>e.props.id===s),o=i>=0?n[i]:null,f=o?o.props.showTicker??!0:!0,h=S(()=>{const e=o?.props.tickerItems;return Array.isArray(e)?e:C.map(I=>({text:I}))},[o]),m=E(),T=R(),r=e=>y(N[e],T),u=L(s,M,"block");if(!o)return t("p",{className:"sf-note",children:p("This ticker’s hero is no longer on the page.")});const c=e=>d({type:"replace",destinationZone:O,destinationIndex:i,data:{...o,props:{...o.props,...e}}});return t(A,{motion:u,body:k(w,{children:[!r("showTicker")&&!r("items")&&t(P,{}),r("showTicker")&&t(g,{label:p("Show ticker"),labelId:m,icon:t(b,{}),action:t(x,{checked:f,onChange:e=>c({showTicker:e}),ariaLabelledBy:m})}),r("items")&&t(F,{label:a.label,icon:a.icon,items:h,placeholder:"item",onChange:e=>c({tickerItems:e}),markup:!0})]})})}export{j as default};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ReactNode, type RefObject } from "react";
|
|
2
2
|
import type { SiteThemeRowPatch } from "../../format/lib/site-theme-row.js";
|
|
3
|
+
import type { StoredTextStyle } from "../../render/lib/text-styles/site-text-styles.js";
|
|
3
4
|
import { type CardShadow, type HoverEffect } from "../../format/lib/theme.js";
|
|
4
5
|
export declare const SITE_STYLES_ID_PREFIX = "sf-site-styles";
|
|
5
6
|
export declare const TABPANEL_CLASS = "sf-site-styles-tabpanel";
|
|
@@ -12,6 +13,7 @@ export type SiteStylesTabItem = {
|
|
|
12
13
|
icon?: ReactNode;
|
|
13
14
|
};
|
|
14
15
|
export declare const SITE_STYLES_TABS: SiteStylesTabItem[];
|
|
16
|
+
export declare function siteTextStyleSizeOf(style: StoredTextStyle): number;
|
|
15
17
|
export declare function SideSpaceRootField({ persist, }: {
|
|
16
18
|
persist: (p: SiteThemeRowPatch, immediate?: boolean) => void;
|
|
17
19
|
}): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as x,jsxs as w}from"react/jsx-runtime";import{useEasel as O,useRootFields as H}from"efficient-easel/easel";import{Inspector as Y}from"efficient-easel/fields";import{SettingsGroup as j}from"efficient-easel/panel";import{useEffect as X,useRef as q,useState as G}from"react";import K from"./ThemeField.js";import M from"./CornersField.js";import $ from"./CardShadowField.js";import V from"./ShadowColourField.js";import J,{blockGapRow as Q}from"./BlockGapField.js";import Z from"./HoverEffectField.js";import D from"./PhotographyField.js";import ee from"./ShareButtonField.js";import{usePreviewDevice as k}from"efficient-easel/draw/client";import te,{sideSpaceRow as oe}from"./SideSpaceField.js";import{BackgroundWidthRow as ne,ContentWidthRow as re,SITE_BACKGROUND_HINT as ie,SITE_CONTENT_HINT as se}from"./SectionWidthRows.js";import ae from"./SiteAccentField.js";import le from"./SiteTextStylesField.js";import{usePreviewHeader as g}from"../../render/components/PreviewHeaderContext.js";import{useSiteLengthRow as P}from"./useSiteLengthRow.js";import{siteLengthRowAt as F}from"../lib/content/site-length-rows.js";import{EmptyState as ce,SliderGroup as ue,Tabs as de,Tooltip as pe,tabButtonId as he,tabPanelId as fe}from"efficient-shell/ui";import{ContrastIcon as ge,SettingsIcon as me,TypeIcon as Se}from"efficient-easel/icons";import{useThemeRowPersist as _e}from"../lib/theme-row-persist.js";import{themeSaveNotice as Ce}from"../../format/lib/theme-save-message.js";import{say as S}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as we}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as R}from"../../format/lib/content/page-width.js";import{storedUnit as xe}from"../../format/lib/content/css-length.js";import{PAGE_STYLE_FIELDS as Te}from"../lib/document/page-root-fields.js";import{previewFrame as be}from"efficient-easel/screen/lib/document/preview-dom";import{siteTextColourNameOf as ye,siteTextColours as Pe}from"../../format/lib/text-styles/site-text-colours.js";import{useSiteTextStylesWriter as Re}from"../lib/site-text-styles-writer.js";import{CORNER_STYLE_TO_PX as Ee,normalizeCornerRadius as Ge,normalizeCornerStyle as ke}from"../../format/lib/theme.js";import{pictureShadowColor as ve}from"efficient-easel/screen/lib/document/shadow-values";const v="sf-site-styles",Ie="sf-site-styles-tabpanel",Wt="text",A="basics",B="this-page-group",E=[{id:A,label:"Basics",icon:t(me,{})},{id:"theme",label:"Theme",icon:t(ge,{})},{id:"text",label:"Text",icon:t(Se,{})}];function Oe({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=O(c=>c),{theme:r,setTheme:u}=g(),a=n.data,i=a.root?.props??{},p=c=>{if(e){const h={...i,theme:c};s({type:"replaceRoot",root:{...a.root,props:h},recordHistory:!0})}else u(c);o({selected_preset:c.selected,theme_presets:c.themes})};return t(K,{value:e?i.theme:r,onChange:p})}function Fe({themeFromDocument:e,persist:o}){const[n,s]=G(null),{theme:r,setFonts:u,setSizes:a,setHeadingTypography:i}=g(),p=Re({themeFromDocument:e,persist:o}),{old:c,saved:h,writeRoot:f}=p,m=p.fonts,d=p.sizes,C=p.typography,T=l=>l.values.size??Ne(Ae[l.id]??"body")??Be[l.kind],b=l=>p.write(l),y=Pe(r),L=ye(r),N=l=>{const _={...m,accent:l};e?f({fonts:_}):u(_),o({accent_font:l})},W=l=>{a({...d,accent:l}),o({accent_size_px:l})},z=l=>{const _={...C,weightStrong:l};e?f({headingTypography:_}):i(_),o({heading_weight_strong:l})},U=l=>{const _={...C,italicStrong:l};e?f({headingTypography:_}):i(_),o({accent_italic:l})};return w(x,{children:[t(le,{saved:h,old:c,colours:y,colourNameOf:L,sizeOf:T,onChange:b,openId:n===I?null:n,onOpenChange:s,withoutSize:e}),t(ae,{font:m.accent,size:d.accent,weight:C.weightStrong,italic:C.italicStrong,headingWeight:C.weight,open:n===I,onOpenChange:l=>s(l?I:null),onChange:l=>{l.key==="font"?N(l.value):l.key==="size"?W(l.value):l.key==="weight"?z(l.value):U(l.value)},withoutSize:e})]})}const I="accent",Ae={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},Be={heading:32,body:14},Le={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function Ne(e){if(typeof document>"u")return null;const n=(be()?.contentDocument??document).querySelector(Le[e]);if(!n)return null;const s=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(s)?s:null}function We({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=O(d=>d),{cornerRadiusPx:r,setCornerRadiusPx:u}=g(),a=n.data,i=a.root?.props??{},p=i.cornerRadiusPx===void 0?Ee[ke(i.cornerStyle)]:Ge(i.cornerRadiusPx),c=e?p:r,h=P("cornerRadius",r,u,o),f=d=>s({type:"replaceRoot",root:{...a.root,props:{...i,...d}},recordHistory:!0});return t(M,{value:c,onChange:d=>{e?(f({cornerRadiusPx:d}),o({corner_radius_px:d})):h.write(d)},...e?{}:{length:h.length}})}function ze({persist:e}){const{siteWidth:o,setSiteWidth:n,sectionBackgroundWidth:s,setSectionBackgroundWidth:r,sectionContentWidth:u,setSectionContentWidth:a}=g(),i=k(),p=P("siteWidth",o??null,n,e);if(i!=="desktop")return null;const c=typeof o=="number"?o:p.shown(R.default),h=p.write,f=d=>{r(d),e({section_background_width:d},!0)},m=d=>{a(d),e({section_content_width:d},!0)};return w(x,{children:[t(ne,{value:s??"full",changed:s!==null,detail:S("Full width"),onChange:f,onReset:()=>f(null),hint:ie}),t(re,{mode:u??"content",px:c,min:R.min,max:R.max,changed:typeof o=="number"||u!==null,detail:`${S("Content width")} ${R.default}px`,onMode:m,onPx:d=>h(d),onReset:()=>{m(null),h(null)},hint:se,length:p.length})]})}function Ue({persist:e}){const{siteGutter:o,siteGutterPhone:n,setSiteGutter:s,setSiteGutterPhone:r,siteLengthUnits:u}=g(),a=oe(k(),{gutter:o,phone:n,gutterUnit:u.siteGutterUnit}),i=a?.key==="site_gutter_phone",p=P(F("siteGutter",i?"mobile":"desktop"),a?.value??null,i?r:s,e);return a?t(te,{value:a.value,onChange:p.write,unsetPx:a.unsetPx,restsOn:p.shown(a.unsetPx),bounds:a.bounds,length:p.length}):null}function He({persist:e}){const{blockGap:o,blockGapPhone:n,setBlockGap:s,setBlockGapPhone:r,siteLengthUnits:u}=g(),a=Q(k(),{gap:o,phone:n}),i=a?.key==="block_gap_phone",p=a?.followsPx==null?null:{figure:a.followsPx,unit:xe(u.blockGapUnit)},c=P(F("blockGap",i?"mobile":"desktop"),a?.value??null,i?r:s,e,p);return a?t(J,{value:a.value,onChange:c.write,followsPx:c.rest,followsUnit:c.length.unit,length:c.length}):null}function Ye({persist:e}){return w(x,{children:[t(ze,{persist:e}),t(Ue,{persist:e}),t(He,{persist:e})]})}function je(e){return{card_shadow:e}}function Xe(e){return e===null?{shadow_color:null}:{shadow_color:ve(e)}}function qe(e){return{hover_effect:e}}function Ke({persist:e}){const{cardShadow:o,setCardShadow:n,shadowColor:s,setShadowColor:r,hoverEffect:u,setHoverEffect:a}=g();return w(x,{children:[t($,{value:o,onChange:i=>{n(i),e(je(i),!0)}}),t(V,{value:s,onChange:i=>{r(i),e(Xe(i),i===null)}}),t(Z,{value:u,onChange:i=>{a(i),e(qe(i),!0)}})]})}function Me(e){return{photography_grayscale:e}}function $e({persist:e}){const{photographyGrayscale:o,setPhotographyGrayscale:n}=g();return t(D,{value:o,onChange:r=>{n(r),e(Me(r),!0)}})}function Ve({persist:e}){return t(x,{children:t($e,{persist:e})})}function Je(e){return{share_button_on_posts:e}}function Qe({persist:e}){const{shareButtonOnPosts:o,setShareButtonOnPosts:n}=g();return t(ee,{value:o,onChange:r=>{n(r),e(Je(r),!0)}})}function Ze(){const{websiteName:e}=g();return e?.trim()||we}function zt(){const e=Ze();return t(pe,{content:S("{name} — renamed in the Console: {place}.",{name:e,place:S("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:t("span",{className:"sf-panel-site",children:e})})}function De({themeFromDocument:e=!1,tokenRef:o,siteId:n,onNotify:s,tab:r,onTabChange:u,initialTab:a,revealPageGroup:i=!1,onPageGroupRevealed:p}){const{persist:c}=_e({themeFromDocument:e,tokenRef:o,siteId:n,onResult:b=>{const y=Ce(b);y&&s?.(y.msg,y.tone)}}),[h,f]=G(a??E[0].id),m=r!==void 0,d=m?r:h,C=m?u??(()=>{}):f,T=E.find(b=>b.id===d)??E[0];return w(ue,{children:[t(ot,{activeId:T.id,onSelect:C}),w("div",{id:fe(v,T.id),className:Ie,role:"tabpanel","aria-labelledby":he(v,T.id),children:[d===A&&w(x,{children:[t(We,{themeFromDocument:e,persist:c}),!e&&t(Ke,{persist:c}),!e&&t(Ye,{persist:c}),!e&&t(Ve,{persist:c}),!e&&t(Qe,{persist:c}),t(et,{reveal:i,onRevealed:p})]}),d==="theme"&&t(Oe,{themeFromDocument:e,persist:c}),d==="text"&&t(Fe,{themeFromDocument:e,persist:c})]})]})}function et({reveal:e,onRevealed:o}){const[n,s]=G(!0),r=q(o);return r.current=o,X(()=>{if(!e)return;s(!0);const u=requestAnimationFrame(()=>{document.getElementById(B)?.scrollIntoView({block:"start"}),r.current?.()});return()=>cancelAnimationFrame(u)},[e]),t(j,{title:S("This page"),open:n,onToggle:s,id:B,children:t(tt,{})})}function tt(){const{fields:e,values:o,readOnly:n,onChange:s}=H(),r=Object.fromEntries(Te.filter(u=>u in e).map(u=>[u,e[u]]));return Object.keys(r).length===0?t(ce,{variant:"none",icon:!1,message:S("This page has no look of its own to set.")}):t(Y,{fields:r,values:o,onChange:s,readOnly:n,tabs:!1,idPrefix:"this-page",ariaLabel:S("This page")})}function ot({activeId:e,onSelect:o}){return t("div",{className:"es-insp-tabs",children:t(de,{variant:"underline",block:!0,labelsFit:!0,"aria-label":S("Styles"),idPrefix:v,value:e,onChange:o,items:E.map(n=>{const s=S(n.label);return{id:n.id,icon:n.icon,label:s}})})})}export{He as BlockGapRootField,Ke as CardLookFields,Ye as PageGroupFields,Ve as PhotographyGroupFields,A as SITE_STYLES_BASICS_TAB,v as SITE_STYLES_ID_PREFIX,E as SITE_STYLES_TABS,Wt as SITE_STYLES_TEXT_TAB,Qe as ShareButtonRootField,Ue as SideSpaceRootField,ot as SiteStylesTabStrip,Ie as TABPANEL_CLASS,B as THIS_PAGE_GROUP_ID,zt as WebsiteNameReadonly,je as cardShadowPatch,De as default,qe as hoverEffectPatch,Me as photographyPatch,Xe as shadowColourPatch,Je as shareButtonPatch,Ze as useWebsiteName};
|
|
1
|
+
"use client";import{jsx as t,Fragment as C,jsxs as x}from"react/jsx-runtime";import{useEasel as I,useRootFields as H}from"efficient-easel/easel";import{Inspector as Y}from"efficient-easel/fields";import{SettingsGroup as j}from"efficient-easel/panel";import{useEffect as X,useRef as q,useState as G}from"react";import K from"./ThemeField.js";import M from"./CornersField.js";import $ from"./CardShadowField.js";import V from"./ShadowColourField.js";import J,{blockGapRow as Q}from"./BlockGapField.js";import Z from"./HoverEffectField.js";import D from"./PhotographyField.js";import ee from"./ShareButtonField.js";import{usePreviewDevice as O}from"efficient-easel/draw/client";import te,{sideSpaceRow as oe}from"./SideSpaceField.js";import{BackgroundWidthRow as ne,ContentWidthRow as re,SITE_BACKGROUND_HINT as ie,SITE_CONTENT_HINT as se}from"./SectionWidthRows.js";import ae from"./SiteAccentField.js";import le from"./SiteTextStylesField.js";import{usePreviewHeader as g}from"../../render/components/PreviewHeaderContext.js";import{useSiteLengthRow as P}from"./useSiteLengthRow.js";import{siteLengthRowAt as F}from"../lib/content/site-length-rows.js";import{EmptyState as ce,SliderGroup as ue,Tabs as de,Tooltip as pe,tabButtonId as he,tabPanelId as fe}from"efficient-shell/ui";import{ContrastIcon as ge,SettingsIcon as me,TypeIcon as Se}from"efficient-easel/icons";import{useThemeRowPersist as _e}from"../lib/theme-row-persist.js";import{themeSaveNotice as we}from"../../format/lib/theme-save-message.js";import{say as S}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as xe}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as R}from"../../format/lib/content/page-width.js";import{storedUnit as Ce}from"../../format/lib/content/css-length.js";import{PAGE_STYLE_FIELDS as Te}from"../lib/document/page-root-fields.js";import{previewFrame as ye}from"efficient-easel/screen/lib/document/preview-dom";import{siteTextColourNameOf as be,siteTextColours as Pe}from"../../format/lib/text-styles/site-text-colours.js";import{useSiteTextStylesWriter as Re}from"../lib/site-text-styles-writer.js";import{ownEntry as Ee}from"../../format/lib/own-entry.js";import{CORNER_STYLE_TO_PX as Ge,normalizeCornerRadius as Oe,normalizeCornerStyle as ke}from"../../format/lib/theme.js";import{pictureShadowColor as ve}from"efficient-easel/screen/lib/document/shadow-values";const k="sf-site-styles",Ie="sf-site-styles-tabpanel",Ht="text",A="basics",B="this-page-group",E=[{id:A,label:"Basics",icon:t(me,{})},{id:"theme",label:"Theme",icon:t(ge,{})},{id:"text",label:"Text",icon:t(Se,{})}];function Fe({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=I(l=>l),{theme:r,setTheme:c}=g(),a=n.data,i=a.root?.props??{},p=l=>{if(e){const h={...i,theme:l};s({type:"replaceRoot",root:{...a.root,props:h},recordHistory:!0})}else c(l);o({selected_preset:l.selected,theme_presets:l.themes})};return t(K,{value:e?i.theme:r,onChange:p})}function Ae({themeFromDocument:e,persist:o}){const[n,s]=G(null),{theme:r,setFonts:c,setSizes:a,setHeadingTypography:i}=g(),p=Re({themeFromDocument:e,persist:o}),{old:l,saved:h,writeRoot:f}=p,m=p.fonts,u=p.sizes,w=p.typography,T=Ne,y=d=>p.write(d),b=Pe(r),L=be(r),N=d=>{const _={...m,accent:d};e?f({fonts:_}):c(_),o({accent_font:d})},W=d=>{a({...u,accent:d}),o({accent_size_px:d})},z=d=>{const _={...w,weightStrong:d};e?f({headingTypography:_}):i(_),o({heading_weight_strong:d})},U=d=>{const _={...w,italicStrong:d};e?f({headingTypography:_}):i(_),o({accent_italic:d})};return x(C,{children:[t(le,{saved:h,old:l,colours:b,colourNameOf:L,sizeOf:T,onChange:y,openId:n===v?null:n,onOpenChange:s,withoutSize:e}),t(ae,{font:m.accent,size:u.accent,weight:w.weightStrong,italic:w.italicStrong,headingWeight:w.weight,open:n===v,onOpenChange:d=>s(d?v:null),onChange:d=>{d.key==="font"?N(d.value):d.key==="size"?W(d.value):d.key==="weight"?z(d.value):U(d.value)},withoutSize:e})]})}const v="accent",Be={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},Le={heading:32,body:14};function Ne(e){return e.values.size??ze(Ee(Be,e.id)??"body")??Le[e.kind]}const We={heading:"main h1, main h2",heading2:"main h1, main h2",heading3:"main h1, main h2",accent:"main h1 em, main h2 em",body:"main p",label:"main .mono-eyebrow"};function ze(e){if(typeof document>"u")return null;const n=(ye()?.contentDocument??document).querySelector(We[e]);if(!n)return null;const s=parseFloat(getComputedStyle(n).fontSize);return Number.isFinite(s)?s:null}function Ue({themeFromDocument:e,persist:o}){const{appState:n,dispatch:s}=I(u=>u),{cornerRadiusPx:r,setCornerRadiusPx:c}=g(),a=n.data,i=a.root?.props??{},p=i.cornerRadiusPx===void 0?Ge[ke(i.cornerStyle)]:Oe(i.cornerRadiusPx),l=e?p:r,h=P("cornerRadius",r,c,o),f=u=>s({type:"replaceRoot",root:{...a.root,props:{...i,...u}},recordHistory:!0});return t(M,{value:l,onChange:u=>{e?(f({cornerRadiusPx:u}),o({corner_radius_px:u})):h.write(u)},...e?{}:{length:h.length}})}function He({persist:e}){const{siteWidth:o,setSiteWidth:n,sectionBackgroundWidth:s,setSectionBackgroundWidth:r,sectionContentWidth:c,setSectionContentWidth:a}=g(),i=O(),p=P("siteWidth",o??null,n,e);if(i!=="desktop")return null;const l=typeof o=="number"?o:p.shown(R.default),h=p.write,f=u=>{r(u),e({section_background_width:u},!0)},m=u=>{a(u),e({section_content_width:u},!0)};return x(C,{children:[t(ne,{value:s??"full",changed:s!==null,detail:S("Full width"),onChange:f,onReset:()=>f(null),hint:ie}),t(re,{mode:c??"content",px:l,min:R.min,max:R.max,changed:typeof o=="number"||c!==null,detail:`${S("Content width")} ${R.default}px`,onMode:m,onPx:u=>h(u),onReset:()=>{m(null),h(null)},hint:se,length:p.length})]})}function Ye({persist:e}){const{siteGutter:o,siteGutterPhone:n,setSiteGutter:s,setSiteGutterPhone:r,siteLengthUnits:c}=g(),a=oe(O(),{gutter:o,phone:n,gutterUnit:c.siteGutterUnit}),i=a?.key==="site_gutter_phone",p=P(F("siteGutter",i?"mobile":"desktop"),a?.value??null,i?r:s,e);return a?t(te,{value:a.value,onChange:p.write,unsetPx:a.unsetPx,restsOn:p.shown(a.unsetPx),bounds:a.bounds,length:p.length}):null}function je({persist:e}){const{blockGap:o,blockGapPhone:n,setBlockGap:s,setBlockGapPhone:r,siteLengthUnits:c}=g(),a=Q(O(),{gap:o,phone:n}),i=a?.key==="block_gap_phone",p=a?.followsPx==null?null:{figure:a.followsPx,unit:Ce(c.blockGapUnit)},l=P(F("blockGap",i?"mobile":"desktop"),a?.value??null,i?r:s,e,p);return a?t(J,{value:a.value,onChange:l.write,followsPx:l.rest,followsUnit:l.length.unit,length:l.length}):null}function Xe({persist:e}){return x(C,{children:[t(He,{persist:e}),t(Ye,{persist:e}),t(je,{persist:e})]})}function qe(e){return{card_shadow:e}}function Ke(e){return e===null?{shadow_color:null}:{shadow_color:ve(e)}}function Me(e){return{hover_effect:e}}function $e({persist:e}){const{cardShadow:o,setCardShadow:n,shadowColor:s,setShadowColor:r,hoverEffect:c,setHoverEffect:a}=g();return x(C,{children:[t($,{value:o,onChange:i=>{n(i),e(qe(i),!0)}}),t(V,{value:s,onChange:i=>{r(i),e(Ke(i),i===null)}}),t(Z,{value:c,onChange:i=>{a(i),e(Me(i),!0)}})]})}function Ve(e){return{photography_grayscale:e}}function Je({persist:e}){const{photographyGrayscale:o,setPhotographyGrayscale:n}=g();return t(D,{value:o,onChange:r=>{n(r),e(Ve(r),!0)}})}function Qe({persist:e}){return t(C,{children:t(Je,{persist:e})})}function Ze(e){return{share_button_on_posts:e}}function De({persist:e}){const{shareButtonOnPosts:o,setShareButtonOnPosts:n}=g();return t(ee,{value:o,onChange:r=>{n(r),e(Ze(r),!0)}})}function et(){const{websiteName:e}=g();return e?.trim()||xe}function Yt(){const e=et();return t(pe,{content:S("{name} — renamed in the Console: {place}.",{name:e,place:S("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:t("span",{className:"sf-panel-site",children:e})})}function tt({themeFromDocument:e=!1,tokenRef:o,siteId:n,onNotify:s,tab:r,onTabChange:c,initialTab:a,revealPageGroup:i=!1,onPageGroupRevealed:p}){const{persist:l}=_e({themeFromDocument:e,tokenRef:o,siteId:n,onResult:y=>{const b=we(y);b&&s?.(b.msg,b.tone)}}),[h,f]=G(a??E[0].id),m=r!==void 0,u=m?r:h,w=m?c??(()=>{}):f,T=E.find(y=>y.id===u)??E[0];return x(ue,{children:[t(rt,{activeId:T.id,onSelect:w}),x("div",{id:fe(k,T.id),className:Ie,role:"tabpanel","aria-labelledby":he(k,T.id),children:[u===A&&x(C,{children:[t(Ue,{themeFromDocument:e,persist:l}),!e&&t($e,{persist:l}),!e&&t(Xe,{persist:l}),!e&&t(Qe,{persist:l}),!e&&t(De,{persist:l}),t(ot,{reveal:i,onRevealed:p})]}),u==="theme"&&t(Fe,{themeFromDocument:e,persist:l}),u==="text"&&t(Ae,{themeFromDocument:e,persist:l})]})]})}function ot({reveal:e,onRevealed:o}){const[n,s]=G(!0),r=q(o);return r.current=o,X(()=>{if(!e)return;s(!0);const c=requestAnimationFrame(()=>{document.getElementById(B)?.scrollIntoView({block:"start"}),r.current?.()});return()=>cancelAnimationFrame(c)},[e]),t(j,{title:S("This page"),open:n,onToggle:s,id:B,children:t(nt,{})})}function nt(){const{fields:e,values:o,readOnly:n,onChange:s}=H(),r=Object.fromEntries(Te.filter(c=>c in e).map(c=>[c,e[c]]));return Object.keys(r).length===0?t(ce,{variant:"none",icon:!1,message:S("This page has no look of its own to set.")}):t(Y,{fields:r,values:o,onChange:s,readOnly:n,tabs:!1,idPrefix:"this-page",ariaLabel:S("This page")})}function rt({activeId:e,onSelect:o}){return t("div",{className:"es-insp-tabs",children:t(de,{variant:"underline",block:!0,labelsFit:!0,"aria-label":S("Styles"),idPrefix:k,value:e,onChange:o,items:E.map(n=>{const s=S(n.label);return{id:n.id,icon:n.icon,label:s}})})})}export{je as BlockGapRootField,$e as CardLookFields,Xe as PageGroupFields,Qe as PhotographyGroupFields,A as SITE_STYLES_BASICS_TAB,k as SITE_STYLES_ID_PREFIX,E as SITE_STYLES_TABS,Ht as SITE_STYLES_TEXT_TAB,De as ShareButtonRootField,Ye as SideSpaceRootField,rt as SiteStylesTabStrip,Ie as TABPANEL_CLASS,B as THIS_PAGE_GROUP_ID,Yt as WebsiteNameReadonly,qe as cardShadowPatch,tt as default,Me as hoverEffectPatch,Ve as photographyPatch,Ke as shadowColourPatch,Ze as shareButtonPatch,Ne as siteTextStyleSizeOf,et as useWebsiteName};
|
|
@@ -4108,3 +4108,114 @@ input.sf-list-marking {
|
|
|
4108
4108
|
.sf-anchor-link-hash {
|
|
4109
4109
|
flex: none;
|
|
4110
4110
|
}
|
|
4111
|
+
|
|
4112
|
+
/* The Custom HTML code window (components/CustomHtmlCodeWindow): Site styles,
|
|
4113
|
+
preview and code side by side in a full-size shell Dialog. The left column
|
|
4114
|
+
is the settings panel's width; the preview takes three parts, the code two. */
|
|
4115
|
+
.sf-code-window {
|
|
4116
|
+
display: grid;
|
|
4117
|
+
grid-template-columns: var(--es-right-w, 280px) minmax(0, 3fr) minmax(0, 2fr);
|
|
4118
|
+
gap: var(--space-16);
|
|
4119
|
+
height: 100%;
|
|
4120
|
+
min-height: 0;
|
|
4121
|
+
padding: var(--space-16);
|
|
4122
|
+
box-sizing: border-box;
|
|
4123
|
+
}
|
|
4124
|
+
.sf-code-window-styles {
|
|
4125
|
+
display: block;
|
|
4126
|
+
min-height: 0;
|
|
4127
|
+
overflow: auto;
|
|
4128
|
+
}
|
|
4129
|
+
.sf-code-window-group {
|
|
4130
|
+
display: flex;
|
|
4131
|
+
flex-direction: column;
|
|
4132
|
+
gap: var(--space-16);
|
|
4133
|
+
}
|
|
4134
|
+
.sf-code-window-list {
|
|
4135
|
+
display: flex;
|
|
4136
|
+
flex-direction: column;
|
|
4137
|
+
gap: var(--space-4);
|
|
4138
|
+
}
|
|
4139
|
+
/* One row form for every pick: a 24px mark, the name (main), the value (dim)
|
|
4140
|
+
at the end, the link under the name. The whole row is the shell Button. */
|
|
4141
|
+
.sf-code-window-row.sf-code-window-row {
|
|
4142
|
+
display: grid;
|
|
4143
|
+
grid-template-columns: var(--space-24) minmax(0, 1fr) auto;
|
|
4144
|
+
column-gap: var(--space-12);
|
|
4145
|
+
row-gap: var(--space-4);
|
|
4146
|
+
align-items: center;
|
|
4147
|
+
height: auto;
|
|
4148
|
+
padding-block: var(--space-4);
|
|
4149
|
+
text-align: left;
|
|
4150
|
+
}
|
|
4151
|
+
.sf-code-window-row-sub {
|
|
4152
|
+
grid-row: 2;
|
|
4153
|
+
grid-column: 2 / -1;
|
|
4154
|
+
display: flex;
|
|
4155
|
+
}
|
|
4156
|
+
.sf-code-window-row-icon {
|
|
4157
|
+
display: flex;
|
|
4158
|
+
align-items: center;
|
|
4159
|
+
justify-content: center;
|
|
4160
|
+
width: var(--space-24);
|
|
4161
|
+
height: var(--space-24);
|
|
4162
|
+
}
|
|
4163
|
+
.sf-code-window-column {
|
|
4164
|
+
display: flex;
|
|
4165
|
+
flex-direction: column;
|
|
4166
|
+
gap: var(--space-8);
|
|
4167
|
+
min-height: 0;
|
|
4168
|
+
min-width: 0;
|
|
4169
|
+
}
|
|
4170
|
+
.sf-code-window-bar {
|
|
4171
|
+
display: flex;
|
|
4172
|
+
align-items: center;
|
|
4173
|
+
justify-content: space-between;
|
|
4174
|
+
min-height: var(--space-32);
|
|
4175
|
+
flex: none;
|
|
4176
|
+
}
|
|
4177
|
+
.sf-code-window-actions {
|
|
4178
|
+
display: flex;
|
|
4179
|
+
gap: var(--space-8);
|
|
4180
|
+
}
|
|
4181
|
+
.sf-code-window-added {
|
|
4182
|
+
display: flex;
|
|
4183
|
+
align-items: baseline;
|
|
4184
|
+
gap: var(--space-8);
|
|
4185
|
+
min-width: 0;
|
|
4186
|
+
white-space: nowrap;
|
|
4187
|
+
}
|
|
4188
|
+
.sf-code-window-fill {
|
|
4189
|
+
flex: 1;
|
|
4190
|
+
min-height: 0;
|
|
4191
|
+
display: flex;
|
|
4192
|
+
flex-direction: column;
|
|
4193
|
+
}
|
|
4194
|
+
.sf-code-window-fill > * {
|
|
4195
|
+
flex: 1;
|
|
4196
|
+
min-height: 0;
|
|
4197
|
+
display: flex;
|
|
4198
|
+
flex-direction: column;
|
|
4199
|
+
}
|
|
4200
|
+
.sf-code-window-stage {
|
|
4201
|
+
flex: 1;
|
|
4202
|
+
min-width: 0;
|
|
4203
|
+
height: 100%;
|
|
4204
|
+
}
|
|
4205
|
+
.sf-code-window-stage > .sf-frame > iframe {
|
|
4206
|
+
display: block;
|
|
4207
|
+
flex: none;
|
|
4208
|
+
border: 0;
|
|
4209
|
+
}
|
|
4210
|
+
.sf-code-window-editor {
|
|
4211
|
+
flex: 1;
|
|
4212
|
+
min-height: 0;
|
|
4213
|
+
overflow: hidden;
|
|
4214
|
+
display: flex;
|
|
4215
|
+
}
|
|
4216
|
+
.sf-code-window-editor > * {
|
|
4217
|
+
flex: 1;
|
|
4218
|
+
min-height: 0;
|
|
4219
|
+
min-width: 0;
|
|
4220
|
+
width: 100%;
|
|
4221
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as b,useMemo as w,useRef as k}from"react";import{useEasel as
|
|
1
|
+
"use client";import{useEffect as b,useMemo as w,useRef as k}from"react";import{useEasel as E}from"efficient-easel/easel";import{newId as O}from"efficient-easel/data";import{useEaselHost as P}from"efficient-easel/screen/lib/host";import{applyPageEdits as B,describeBlocks as C,describeSelection as H}from"../lib/host-document-bridge.js";import{nonEmptyString as J}from"../../format/lib/non-empty-string.js";import{activePressContext as N}from"../../format/lib/sections/active-press-context.js";const p=t=>J(t.requestId)??null;function U(){const t=P(),{appState:n,selectedItem:I,dispatch:l,history:f,config:S}=E(s=>s),i=S,g=k({appState:n,dispatch:l,history:f,blockConfig:i});g.current={appState:n,dispatch:l,history:f,blockConfig:i};const c=k(new Map),h=I?.props?.id,a=w(()=>H(i,n.data,h),[i,n.data,h]),q=a?JSON.stringify(a):"";b(()=>{t.connected&&t.send("storefront-editor:selection",{selection:a})},[t,q]),b(()=>t.subscribe(s=>{const{appState:d,dispatch:m,history:u,blockConfig:y}=g.current;switch(s.type){case"storefront-editor:request-document":{const e=p(s);if(!e)return;t.send("storefront-editor:document",{requestId:e,document:d.data,blocks:C(y)});return}case"storefront-editor:apply-page-edits":{const e=p(s);if(!e)return;const r=Array.isArray(s.ops)?s.ops:[],o=r.length?B(y,d.data,r,O,N()):{ok:!1,reason:"no changes"};o.ok&&(m({type:"setData",data:o.document,recordHistory:!0}),c.current.set(e,JSON.stringify(o.document.content??[]))),t.send("storefront-editor:page-edits-result",{requestId:e,applied:o.ok,reason:o.ok?null:o.reason});return}case"storefront-editor:undo-page-edits":{const e=p(s);if(!e)return;const r=c.current.get(e),o=r!==void 0&&r===JSON.stringify(d.data.content??[]);o&&u.hasPast&&(u.back(),c.current.delete(e)),t.send("storefront-editor:page-edits-result",{requestId:e,applied:o&&u.hasPast,reason:o?null:"the page has changed since"});return}case"storefront-editor:set-right-panel":typeof s.shown=="boolean"&&m({type:"setUi",ui:{rightSideBarVisible:s.shown}});return;default:return}}),[t])}export{U as useHostDocumentBridge};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BlockFields } from "../../../../../../format/lib/document/blocks/block-types.js";
|
|
2
|
+
export declare function CustomHtmlCodeField({ value, onChange }: {
|
|
3
|
+
value: string | undefined;
|
|
4
|
+
onChange: (next: string) => void;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
export declare const CustomHTMLFields: BlockFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as l}from"react/jsx-runtime";import{Suspense as i,lazy as m,useState as a}from"react";import{Button as p}from"efficient-shell/ui";import{CodeIcon as c}from"efficient-shell/icons/efficient";import{SettingsField as d}from"efficient-easel/panel";import{iconOf as f}from"efficient-easel/screen/lib/document/box-fields";import{say as r}from"../../../../../../format/lib/editor-words.js";const u=m(()=>import("../../../../../components/CustomHtmlCodeWindow.js"));function C({value:e,onChange:t}){const[s,n]=a(!1);return l(d,{label:r("HTML"),icon:f(o(c,{})),children:[o(p,{variant:"secondary",onClick:()=>n(!0),children:r("Edit code")}),s?o(i,{fallback:null,children:o(u,{open:!0,onClose:()=>n(!1),value:typeof e=="string"?e:"",onChange:t})}):null]})}const F={fields:{html:{type:"custom",label:"HTML",render:({value:e,onChange:t})=>o(C,{value:e,onChange:t})}}};export{F as CustomHTMLFields,C as CustomHtmlCodeField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{FOOTPRINT_DEFAULTS as A,FOOTPRINT_LIST_COLUMNS as C,FOOTPRINT_LIST_COLUMNS_DEFAULT as g,FOOTPRINT_MAP_HEIGHT_DEFAULT as F,FOOTPRINT_MAP_HEIGHT_FULL as v,FOOTPRINT_MAP_HEIGHT_KEY as N,FOOTPRINT_SHOWS_DEFAULT as i,FOOTPRINT_SHOWS_KEY as r}from"../../../../../../format/lib/content/footprint.js";import{ColumnsIcon as w,HeadquartersIcon as D,HeightIcon as M,LayoutIcon as k,LocationIcon as x,MapIcon as B,SearchIcon as U,ThemeIcon as G}from"efficient-easel/icons";import{CoordsField as W,copyText as K,plainText as a,sourceField as j,text as f,textarea as I,toggle as d,withPanelOnly as L}from"../../../controls.js";import{group as u}from"efficient-easel/screen/lib/document/box-fields";import{segmented as n}from"../../../box-fields.js";import{withShowWhen as t}from"../../../../../../render/lib/document/show-when.js";import{needsGeocodeWork as q,resolveGeocodeRows as Y}from"../../../geocode-resolve.js";import{deviceField as s}from"efficient-easel/screen/lib/document/device-fields";import{SPLITTABLE_SECTIONS as Q,headFieldsForPlacement as z}from"../../../../../../format/lib/sections/section-head-placement.js";import{BLOCK_SOURCE_PROP as m,DEALERS_SOURCE as J,registerBlockSources as V}from"../../../../../../format/lib/content/block-sources.js";import{blockSourceField as X,blockSourceFields as Z}from"../../../block-source-fields.js";import{DEALERS_BLOCK_SOURCE as $}from"../../../../../../render/lib/dealer-source.js";import{FOOTPRINT_PH as S,FootprintSlots as ee}from"../../../../../../format/lib/document/blocks/general/Footprint/meta.js";import{withFootprintListTemplate as oe}from"../../../../../../format/lib/document/blocks/general/Footprint/card-seed.js";const P={field:m,is:J,default:""},h={field:r,is:i,default:i},te={field:r,is:"list",default:i},le={field:r,is:"map",default:i},b={all:[h,{field:"listPosition",in:["left","right"],default:"below"}]},y={any:[{all:[P,{not:le}]},b]},ie={any:[{all:[h,{field:"listPosition",is:"below",default:"below"}]},te]},E={all:[y,{field:"search",is:!0,default:!1}]};V([$]);const ge={fields:{_gContent:u("Section"),sectionNumber:f("Section number",S.sectionNumber),heading:I("Heading",S.heading),tagline:I("Body",S.tagline),_gOffices:u("Offices"),[m]:X("Office content","Manual"),offices:{type:"array",label:"Offices",arrayFields:{role:a("Role"),city:a("City"),country:a("Region · country"),address:K("Address"),phone:a("Phone"),group:a("Group"),hq:d("HQ",!1,o(D,{})),geocode:j(W,{label:"Coordinates"})},defaultItemProps:{role:"Sales & Distribution",city:"City",country:"Country",address:"",phone:"",group:"",hq:!1,lat:0,lng:0},getItemSummary:e=>e?.city||"Office"},...ee,[r]:n("Shows",o(B,{}),[{label:"Map and list",value:i},{label:"Map only",value:"map"},{label:"List only",value:"list"}],i),mapTheme:n("Map theme",o(G,{}),[{label:"Auto",value:"auto"},{label:"Dark",value:"dark"},{label:"Light",value:"light"}],A.mapTheme),_gList:u("List"),listPosition:s("desktop",t(n("Position",o(k,{}),[{label:"Left",value:"left"},{label:"Right",value:"right"},{label:"Below",value:"below"}],"below"),h)),listColumns:s("desktop",t(n("Columns",o(w,{}),[{label:"Auto",value:g},...C.map(e=>({label:String(e),value:String(e)}))],g),ie)),[N]:s("desktop",t(n("Map height",o(M,{}),[{label:"Fixed",value:F},{label:"Full height",value:v}],F),b)),search:s("desktop",t(d("Search",!1,o(U,{})),y)),searchHint:s("desktop",t(L(f("Hint","Type a postcode or address")),E)),noMatchText:s("desktop",t(L(f("No match","No place found. Try another postcode.")),E)),showDistance:t(d("Distance",!0,o(x,{})),P)},resolveData:async(e,c)=>{const p=c?.changed,T=e.props;if(p?.listPosition===!0||p?.[r]===!0||p?.[m]===!0){const l=oe(T);l!==T&&(e={...e,props:l})}const O=e.props,_=O.offices??[];if(!q(_))return e;const R=await Y(_,l=>[l.address,l.city,l.country].map(H=>String(H??"").replace(/\*/g,"").trim()).filter(Boolean).join(", "));return{...e,props:{...O,offices:R}}},resolveFields:(e,{fields:c})=>z(Z("Footprint",c,e.props,{hides:["offices"]}),e.props.headPlacement,Q.Footprint.headRows)};export{ge as FootprintFields};
|