efficient-web-builder 37.0.0 → 37.2.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 +56 -0
- package/dist/editor/components/AnchorField.d.ts +8 -0
- package/dist/editor/components/AnchorField.js +1 -0
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/SiteTextStylesField.d.ts +1 -1
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/StylesPanel.js +1 -1
- package/dist/editor/components/ThemeCard.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
- package/dist/editor/components/storefront-editor.css +31 -7
- package/dist/editor/lib/puck/blocks/general/Footprint/fields.d.ts +1 -0
- package/dist/editor/lib/puck/blocks/general/Footprint/fields.js +1 -1
- package/dist/editor/lib/puck/controls.d.ts +0 -1
- package/dist/editor/lib/puck/controls.js +1 -1
- package/dist/editor/lib/puck/page-root.js +1 -1
- package/dist/editor/lib/puck/section-width-fields.js +1 -1
- package/dist/editor/lib/site-text-styles-writer.d.ts +1 -1
- package/dist/editor/lib/site-text-styles-writer.js +1 -1
- package/dist/editor/lib/site-text-styles.d.ts +1 -83
- package/dist/editor/lib/site-text-styles.js +1 -2
- package/dist/format/lib/content/footprint.d.ts +3 -0
- package/dist/format/lib/content/footprint.js +1 -1
- package/dist/format/lib/content/subscribe.d.ts +2 -18
- package/dist/format/lib/content/subscribe.js +2 -2
- package/dist/format/lib/editor-words-catalogue.d.ts +13 -10
- package/dist/format/lib/editor-words-catalogue.js +4 -4
- package/dist/format/lib/popup/behavior.d.ts +43 -0
- package/dist/format/lib/popup/behavior.js +1 -0
- package/dist/format/lib/popup/look.d.ts +28 -0
- package/dist/format/lib/popup/look.js +1 -0
- package/dist/format/lib/popup/rules.d.ts +35 -0
- package/dist/format/lib/popup/rules.js +1 -0
- package/dist/format/lib/source-rules/panel-no-divider-lines.js +1 -1
- package/dist/format/lib/web-backend.d.ts +3 -0
- package/dist/render/components/Footprint.js +1 -1
- package/dist/render/lib/puck/blocks/general/Footprint/render.js +2 -2
- package/dist/render/lib/text-styles/site-text-styles.d.ts +83 -0
- package/dist/render/lib/text-styles/site-text-styles.js +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,62 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 37.2.0 - 2026-10-23
|
|
6
|
+
|
|
7
|
+
A MINOR: the group office list on the Locations Map (#254), a full-bleed group band lane (#256), Styles naming and the anchor switch (#258), guard moves (#255, #259) and per-popup rules (#261). `ANCHOR_HINT` is removed; no host imported it.
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **The Locations Map reads the group's office list** (Hartes office list, option A, Lewis 2026-10-23). A host that declares a block source for the `Footprint` (the EFFICIENT backend's `group-offices`) adds it to the section's own **Source** row, after "Typed in" and "Dealers": one row, no second row for where the offices come from. The pick is kept in `dataSource` (`resolveData`), where the backend reads it, and "Typed in" or "Dealers" clears it. A published section draws the rows it was served, in the backend's order (the website's own country first); the editor draws two sample offices. **A section never goes blank because the list is empty** (GG 2026-10-23): a source that sends no office (a branch that has not imported the brand yet) leaves the section's own typed offices on the page. A host that declares no source sees the Source row it always saw, and a typed section draws byte for byte what it drew.
|
|
12
|
+
- **An office can link to its country's website.** `FootprintOffice.href` / `linkLabel`, filled only from a served row (`footprintOfficeOfRow`, `lib/content/footprint`; a link that is not an http(s) address is dropped). The tile draws one line "→ Visit the Australia site" in the contact page's accent link style, as a real link laid over the tile's foot, not inside its button. An office with no link draws nothing for it: no "This site", no "No site yet".
|
|
13
|
+
- **Popup rules, one set per popup** (merchant-designed popups, design final 2026-10-23; plan PR 4). `format/lib/popup/behavior`: `resolvePopupBehavior(rootProps)` reads one popup's behaviour from its page's root props, with the stored keys the site popup already uses, and four new ones: `devices` (`all` · `desktop` · `phone`), `afterSubmit` (`stop` · `continue`), `startDate` / `endDate` (`YYYY-MM-DD`). Two answers join existing lists: `showOn: "except"` (Excluded pages) and `hideAfter: "once"` (Once). The default is Every X days, 7, and Stop after a sent form. `format/lib/popup/rules`: `mayAutoOpen`, `pickAutoPopup` (at most ONE popup opens by itself on a page: the first in the list), `markPopupClosed`, `markPopupSent`, the page / device / schedule rules, and per-popup browser keys (`popupStorageKeys`), so closing one popup never hides another. The site popup keeps the keys its visitors already have. Pure, no React. `format/lib/popup/look`: `resolvePopupLook(rootProps)` reads a popup page's frame (`placement`, the Hero's nine anchors; `fullWidth`; `width`; `height` `auto` · `full`; `tintColor` / `tintOpacity`; `outsideClick`; `closeButton` `inside` · `outside` · `none`), and `POPUP_PAGE_KIND = "popup"` marks a popup page a merchant added.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- **The settings body's end inset is named `--es-insp-pad-end`** (was `--sf-insp-pad-end`; same value: the panel inset less the scrollbar lane). efficient-easel's group band (Lewis 2026-10-14 and 2026-10-23: square, edge to edge) reads this name to reach the panel's right edge without running into the lane. No change on screen until the easel release that reads it; with it, the band stops at the lane, 8px from the right edge, and never makes the body scroll sideways.
|
|
18
|
+
- **The left rail's "Site styles" is now "Styles"** (Lewis 2026-10-13, decisions.md A2c). The rail item, the panel's title and every sentence that points a merchant to it (`Follows Styles ▸ Basics ▸ Corners…`, `from Styles`, `the Text style in Styles`) say one word. Hosts that translate the editor: the catalogue keys with "Site styles" in them are renamed (`Site styles` → `Styles`, and six sentences).
|
|
19
|
+
- **A section's anchor is a switch, a name and a link** (Lewis 2026-10-09, settings item 12). The Anchor band holds `Add an anchor` (a switch); while it is on, a `Name` box and, under it, the section's live link (the site's address, the page, `#name`) on the shell's `Snippet` with its copy button. The always-on sentence under the old `Anchor name` box is gone: the link says what the name is for. Stored data does not change: the switch is on when `anchor` holds a name, and turning it off clears the name. `components/AnchorField`. A template draws no link (it has no page address).
|
|
20
|
+
- `lib/content/subscribe` reads its behaviour through `resolvePopupBehavior`: one reader for every popup. Its `POPUP_TRIGGERS`, `POPUP_SHOW_ON`, `POPUP_HIDE_AFTER` and the ranges are re-exported from `lib/popup/behavior`, so every importer keeps its path. `POPUP_SHOW_ON` gains `except` and `POPUP_HIDE_AFTER` gains `once`; a stored value reads as before.
|
|
21
|
+
|
|
22
|
+
### Removed
|
|
23
|
+
|
|
24
|
+
- `ANCHOR_HINT` (`lib/puck/controls`): no row draws the sentence now. Nothing outside this package imported it.
|
|
25
|
+
|
|
26
|
+
### Guards
|
|
27
|
+
|
|
28
|
+
- **`scripts/test-panel-strip-width-stable.ts` no longer reads efficient-easel's tab tiers** (SSOT follow-up to efficient-easel#327, which deletes `SettingsTabs` and its `@container` tiers from `panel.css`). The guard read those tiers to decide which widths change the tabs; with none left it would fail ("declares no `@container` query") as soon as this repo takes that easel release. The strips here are efficient-shell's `Tabs` (`labelsFit` measures the room in the browser), so there is no step width in a sheet to read. The guard now holds the invariant itself: at every saved panel width from 220 to 560px the strip is one width whether the bucket scrolls or not, and the same sweep is red at every width with `scrollbar-gutter: stable` taken out (checked by hand on the real sheet: 2 of 9 tests fail). Removed with the tiers: `readTierThresholds`, `tierOf`, `divergences`, the five sampled band widths and the test that the padding moves those bands. No CSS, no page and no panel changes.
|
|
29
|
+
- New `scripts/test-styles-name-and-anchor.tsx` (red first on main: the rail and panel said `Site styles`, the catalogue held seven `Site styles` phrases, and the anchor was one `Anchor name` box with its hint).
|
|
30
|
+
- New `scripts/test-footprint-group-offices.tsx` (red first: `footprintOfficeOfRow` did not exist on 37.1.0).
|
|
31
|
+
- New `scripts/test-card-style-settings.tsx`: the builder's half of efficient-storefront's guard of the same name, which tested builder code through the compiled package. It holds the card look the builder owns: no round control wears `sf-card`, Corners never publishes `--radius-full`, an untouched site publishes no card attribute or shadow token, each card-look row patches its snake_case key (the shadow colour normalised), the three rows in order with their glyphs and the shadow row's swatch, a 24px corner's card radius, the blog card (`PostCard`) wears `sf-card`, `sf-card-fill` and names `--card-bg`, and six builder card sections wear the surface but not the fill modifier. No source changes. Red check: `sf-card-fill` taken off `PostCard` fails §8b.
|
|
32
|
+
- New `scripts/test-popup-rules.ts`, 19 tests on a fake clock and memory stores (red first: `lib/popup/behavior` did not exist).
|
|
33
|
+
|
|
34
|
+
## 37.1.0 - 2026-10-23
|
|
35
|
+
|
|
36
|
+
A MINOR: the website backend carries its shared sections (#251), the site text styles move to the render side (#252), and a Site styles theme card opens and closes with one arrow (#230). Nothing is removed.
|
|
37
|
+
|
|
38
|
+
The efficient-easel peer range stays `^18.1.0`: every 18.x from 18.1.0 exports `text-styles/model`. Only the dev pin moves, to `^18.2.0`: the easel release that puts `text-styles/model` in its render group.
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- **The website backend carries its shared sections** (Shared section design v4, approved by Lewis 2026-10-21; card [DESIGN] Shared Sections Used By Many Pages, build plan PR 6). `WebsiteBackend.sharedSections?: WebsiteSharedSections`, which is efficient-easel's `SharedSectionStore` (list, create, remove), the one type. easel's session reads it from the backend it is handed, so a backend (EFFICIENT's, in efficient-storefront-blocks) hands its store without a cast. Optional: a backend without it offers no shared sections. A MINOR.
|
|
43
|
+
- **`render/lib/text-styles/site-text-styles`: the site's text styles on the render side.** The module writes every published page's text-style stylesheet (`textStylesCss`, `storedTextStyles`, `themeWithTextStyles`), so a shopper's page imports it; it was on the editor side only because it read `efficient-easel/text-styles`, the editor's list. It now reads the model with no React, `efficient-easel/text-styles/model` (the defaults and the case CSS), and is a render root in `scripts/entry-sides.mjs`. The module moved; its code did not change.
|
|
44
|
+
|
|
45
|
+
### Deprecated
|
|
46
|
+
|
|
47
|
+
- `editor/lib/site-text-styles`: kept, as a re-export of the render module, for hosts that still name it (storefront `lib/theme-settings`). Nothing in this package imports it. A later major can delete it.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- **The Site styles theme card opens and closes with one arrow** (ruling A4f, Lewis 2026-10-13: "2. B"; the closed state is his direct yes, "Use the icon"). The text button "Edit" / "Done" in the card's foot is now the shell's ghost `IconButton` in the shell's `Tooltip`: closed, it draws `chevron-down` and the tooltip says "Edit colors"; open, it draws `chevron-up` and the tooltip says "Collapse". It is one button whose arrow flips. Its name still says which theme ("Edit colors for Theme 1", "Collapse Theme 1"), and it keeps `aria-expanded` / `aria-controls`.
|
|
52
|
+
- Not changed: the "Edit" in the section's Theme menu card (it opens a sheet somewhere else, so it discloses nothing on the card) and the "Edit" on the closed section Theme trigger (`ThemeCardTrigger`). Both stay the shell's text `Button`.
|
|
53
|
+
- Editor words: added "Collapse", "Collapse {name}", "Edit colors", "Edit colors for {name}"; removed "Done {name}" (nothing says it now). A host that translated "Done {name}" drops that line.
|
|
54
|
+
|
|
55
|
+
### Guards
|
|
56
|
+
|
|
57
|
+
- New `scripts/test-backend-shared-sections.ts` (red first: the scripts typecheck refused it on 37.0.0).
|
|
58
|
+
- `scripts/test-two-ways-to-add.ts` §1 checks the easel peer range (`^18.1.0`) and the dev range (`^18.2.0`) apart.
|
|
59
|
+
- `scripts/test-theme-card-chevron.tsx` (red first): closed and open, the foot's control is the shell's ghost `IconButton` at the `sm` rung with the shell's `chevron-down` / `chevron-up` glyph and no words; the shell's Tooltip says "Edit colors" / "Collapse"; in the real `ThemeField` one press opens and a second press on the same button closes; each card's name names its theme; no "Edit" or "Done" text button is left on a Site styles card.
|
|
60
|
+
|
|
5
61
|
## 37.0.0 - 2026-10-23
|
|
6
62
|
|
|
7
63
|
**MAJOR for hosts:** the efficient-easel peer range is `^18.1.0` (was `^18.0.0`; dev the same). A shared section somebody else holds is locked by its node, which easel 18.1.0 hands the lock rule; on 18.0.0 the lock would never hold and an edit could be lost. A host moves the pin; nothing else to change.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HidableValue } from "efficient-easel/draw";
|
|
2
|
+
type Props = {
|
|
3
|
+
value: HidableValue;
|
|
4
|
+
onChange: (v: HidableValue) => void;
|
|
5
|
+
nameBox: (value: HidableValue, onChange: (v: HidableValue) => void) => React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export default function AnchorField({ value, onChange, nameBox }: Props): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as n,Fragment as f,jsxs as m}from"react/jsx-runtime";import{useContext as p,useEffect as u,useId as g,useState as h}from"react";import{SettingsField as x,SettingsSwitch as S}from"efficient-easel/panel";import{AnchorIcon as k}from"efficient-easel/icons";import{ScreenDocumentContext as b}from"efficient-easel/screen/components/ScreenDocumentContext";import{Snippet as I}from"efficient-shell/ui";import{say as d}from"../../format/lib/editor-words.js";import{anchorPath as A,slugifyAnchor as j}from"../../format/lib/links/page-link-rules.js";import{shopRouteBase as w}from"../../format/lib/web-runtime.js";import{readHidable as F}from"efficient-easel/draw";function N({value:i,onChange:o,nameBox:c}){const s=F(i).text,[l,a]=h(!1),e=l||s.trim()!=="",t=g();return m(f,{children:[n(x,{label:d("Add an anchor"),labelId:t,icon:n(k,{}),action:n(S,{checked:e,ariaLabelledBy:t,onChange:r=>{a(r),!r&&s!==""&&o("")}})}),e&&c(i,o),e&&n(y,{name:s})]})}function y({name:i}){const o=p(b),c=o?.templateId?"":o?.currentSlug??"",[s,l]=h("");u(()=>l(w()||window.location.origin),[]);const a=j(i);if(!a||!c)return null;const e=`${s}${A(c,a)}`,t=e.replace(/^https?:\/\//,""),r=t.lastIndexOf("#");return n("div",{className:"sf-anchor-link",children:n(I,{value:e,label:d("link"),size:"sm",children:m("span",{className:"sf-anchor-link-text",children:[n("span",{className:"sf-anchor-link-path",children:t.slice(0,r)}),n("span",{className:"sf-anchor-link-hash",children:t.slice(r)})]})})})}export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as ne,jsxs as h}from"react/jsx-runtime";import{useContext as qe,useEffect as oe,useRef as Je,useState as Te}from"react";import{PartResetDot as Qe}from"./PartResetDot.js";import{FieldSelect as Ze,InspectorField as et}from"efficient-easel/fields";import{SettingsField as tt}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as nt,TypeIcon as ot}from"efficient-easel/icons";import{useEasel as lt}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as rt}from"efficient-shell/ui";import{PartTextBox as it,partTextCells as at}from"./PartTextBox.js";import{UiIcon as Ne}from"efficient-easel/draw/client";import{usePreviewHeader as ct}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as dt}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as ut}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as ft,partStyleToTextStyleValues as pt,pushIntoStyle as mt,resolveTextStyles as ht,styleIdOfRole as yt}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as St}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as gt}from"../lib/theme-row-persist.js";import{usePreviewDevice as xt}from"efficient-easel/draw/client";import{usePartStyle as bt}from"./PreviewPartStyleContext.js";import{say as l}from"../../format/lib/editor-words.js";import{readHidable as U,textFieldOffPage as Pt,textFieldPanelOnly as wt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as vt}from"efficient-easel/draw";import{useSectionOps as Tt}from"efficient-easel/screen/lib/puck/use-section-ops";import{FONT_OPTIONS as Nt,FONT_ROLES as Ce,FONT_ROLE_LABELS as ke,fontOption as le}from"../../format/lib/fonts.js";import{isMultilineKind as Ct,partPlaceholder as kt,typeInPlaceKind as Ot}from"../../render/lib/puck/part-text.js";import{partRowField as Rt}from"../lib/puck/part-row-field.js";import{decodePartKey as It,partPropsWithRowValue as Et,partRowValue as Ft}from"../../render/lib/puck/part-rows.js";import{PART_WIDTH_MAX as _t,followedStyleOf as zt,propsWithPartStyleValue as E,propsWithoutPartStyle as At,readPartStyle as Oe}from"../../render/lib/puck/part-styles.js";import{partThemeColors as Vt}from"../../format/lib/puck/part-inks.js";import{styleKeyForPart as Lt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as Kt}from"../lib/puck/part-typing.js";import{keysOnCanvas as Ut,useCanvasTypingPart as Bt}from"../lib/puck/canvas-typing.js";import{useEaselHost as Dt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as Wt,SOURCE_ACTIONS as Mt,SOURCE_ACTION_LABEL as jt,partSourceNoteFor as Gt,partSourceOf as Ht,sourceMenuIdOf as $t,sourceSlugOf as Re}from"../../format/lib/puck/source-bound-parts.js";import{encodePartId as Xt,holdsAuthoredText as Yt}from"../../render/lib/puck/text-parts.js";import{regionsForSection as qt}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as Jt}from"../../format/lib/sections/text-regions.js";function se(n){return n?l(n):null}function Ie(n){return n.kind==="role"?ke[n.role]:n.kind==="custom"?"Custom":null}function Qt(n){const o=n.role;return o&&Ce.includes(o)?{kind:"role",role:o}:null}function Zt(n,o){if(!n)return{kind:"unread"};const{faceRole:s,base:i}=n;if(o[s]===i.fontKey)return{kind:"role",role:s};const c=Object.keys(o).filter(r=>o[r]===i.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function re(n,o,s,i){return Qt(Oe(n,o))??Zt(s,i)}function en(n,o){if(!n.length)return null;const s=o(n[0]);return n.every(i=>o(i)===s)?s:null}const B="";function tn({face:n,base:o,onPick:s}){const i=n.kind==="role"?n.role:B,c=[{label:l("No style"),value:B},...Ce.map(r=>({label:l(ke[r]),value:r}))];return t(Ze,{ariaLabel:l("Style"),value:i,options:c,inline:!0,onChange:r=>s(r===B?null:r),renderOption:r=>r.value===B?h(ne,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:se(Ie(n))}),valueText:r=>se(Ie(n))??r?.label??""})}function nn({sectionName:n,onBack:o,textEditor:s,styleRow:i,children:c}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:l(n),onSelect:o}),s,i,c]})}function Ee({source:n,slug:o,menuId:s}){const i=Dt(),c=Mt[n],r=!c.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[l(Wt[n]),r?h(ne,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{c.type==="storefront-editor:open-menus"?i.send(c.type,{menuId:s??null}):o&&i.send(c.type,{slug:o})},children:l(jt)})]}):null]})})}const Fe=4,on=120;function ln({region:n,sizePx:o,face:s,base:i,onFollowStyle:c,source:r,slug:D,onBack:v}){const F=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l(n.label)})}),t("p",{children:o?l("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:l(F),px:Math.round(o)}):l("Its size follows Site styles ▸ {follows}.",{follows:l(F)})}),c?t(ne,{children:t(tt,{label:l("Style"),icon:t(nt,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(n.label).toLowerCase()}),children:t(tn,{face:s,base:i,onPick:c})})}):t("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(Ee,{source:r,slug:D}):null,t(K,{inline:!0,name:l("Page"),onSelect:v})]})}function sn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part is no longer here.")})}),t("p",{children:l("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:l("Page"),onSelect:n})]})}function rn({onBack:n,partId:o,why:s}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part's settings did not open.")})}),t("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",s]})}),t(K,{inline:!0,name:l("Page"),onSelect:n})]})}function an({nodeId:n,propKey:o,onBack:s,onEditStyle:i}){const{getItemById:c,getSelectorForId:r,config:D}=lt(e=>e),v=Tt(),F=Bt(),{partStyle:_}=bt(),{fonts:W,textStyles:_e}=ct(),M=qe(ut),ie=!M?.capabilities?.hasSiteTheme,{persist:ze}=gt({themeFromDocument:ie,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),R=St({themeFromDocument:ie,persist:ze}),[Ae,j]=Te(!1),Ve=xt()==="mobile",ae=Je(null),d=c(n),m=r(n),ce=d?D.components[d.type]:void 0,{key:S,row:g}=It(o),de=ce?.fields?.[S],y=g?Rt(de,g):de,T=Xt(n,o),p=d?.props??{},x=Ot(y),ue=Pt(y),fe=Yt(y),Le=d?Ht(d.type):null,pe=d?Gt(d.type,S):null,G=g?Ft(p[S],g):p[S],me=!!g&&!(Array.isArray(p[S])&&g.index<p[S].length);oe(()=>{if(Ut(document))return;ae.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[T]);const[H,he]=Te(0);oe(()=>he(0),[T]);const $=!!d&&!me&&(!m||!y);oe(()=>{if(!$||H>=Fe)return;const e=setTimeout(()=>he(a=>a+1),on);return()=>clearTimeout(e)},[$,H]);const Ke=$&&H<Fe;if(!d||me)return t(sn,{onBack:s});const z=qt(d.type),ye=z?Jt(z,o):null;if(z&&ye){const e=_?.partId===T?_:null,a=z[ye],f=a.writable===!0&&!!m,b=te=>{m&&v.replaceComponent(m.zone,m.index,{...d,props:E(p,o,"role",te)})};return t(ln,{region:a,sizePx:e?.base.sizePx??null,face:re(p,o,e,W),base:e?.base??null,onFollowStyle:f?b:void 0,source:Le,slug:Re(p),onBack:s})}if(!m||!y)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(rn,{onBack:s,partId:T,why:m?"no field":"no selector"});const Se=e=>{v.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!x){const f=g?Et(p,S,g,e):{...p,[S]:e};f&&Se(f);return}Kt({node:d,propKey:o,kind:x,zone:m.zone,index:m.index},U(e).text,v.replaceComponent)},Ue=G,N=_?.partId===T?_:null,C=N?.styleOwner,A=C?c(C.owner):null,Y=C&&A?r(C.owner):null,q=!!(C&&A&&Y),k=q?A.props??{}:p,J=q?e=>v.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?C.kind:Lt(d?.type,o),P=Oe(k,V),u=[{partKey:V,face:re(k,V,N,W),sizeGroup:N?.sizeGroup??null,base:N?.base??dn,style:P}],Be=en(u,e=>e.sizeGroup),De=Vt(N?.inks),I=(e,a)=>{let f=k;for(const b of u)f=E(f,b.partKey,e,a);J(f)},We=e=>e?I("textStyle",e):Q({textStyle:null,role:null}),Q=e=>{let a=k;for(const f of u)for(const[b,te]of Object.entries(e))a=E(a,f.partKey,b,te??null);J(a)},Z=x==="text"||x==="textarea",{text:ge,hidden:O}=U(G),L=y?.[vt]?.label??o,xe=O?l("Show {label} on the slide",{label:l(L)}):l("Hide {label} on the slide",{label:l(L)}),be=h("div",{className:"sf-field-head",children:[t(ot,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:l(L)}),Z&&t(rt,{content:xe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":O,"aria-label":xe,onClick:()=>X({text:ge,hidden:!O}),children:O?t(Ne,{name:"eye-off",size:14}):t(Ne,{name:"eye",size:14})})})]}),Pe=!ue&&fe,Me=!!x&&(wt(y)||ue||O||!fe),we=re(k,V,N,W),je=we.kind==="role"?we.role:null,ee=zt(P)??yt(je),ve=ht(R.saved,R.old),Ge=Object.entries(P).filter(([e,a])=>e!=="role"&&e!=="textStyle"&&a!==void 0).length,He=()=>{let e=k;for(const a of u){const{role:f,textStyle:b}=a.style;e=At(e,a.partKey),f&&(e=E(e,a.partKey,"role",f)),b&&(e=E(e,a.partKey,"textStyle",b))}J(e)},w=ee,$e=ft(u[0].style),Xe=w?ve.find(e=>e.id===w)?.name??w:"",Ye=()=>{j(!1),w&&(R.write(mt({saved:R.saved,old:R.old,styleId:w,values:pt(u[0].style)}),!0),He())};return h(nn,{sectionName:ce?.label??d.type,onBack:s,textEditor:t("div",{ref:ae,className:"sf-part-text",children:Me?t(it,{text:ge,onTextChange:e=>X(Z?{text:e,hidden:O}:e),multiline:Ct(x),markup:x!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:Q,colors:De,placeholder:se(kt(y))??void 0,ariaLabel:l(L),head:be,typedOnCanvas:F===T}):x?Z?be:null:t(et,{field:y,name:o,value:Ue,onChange:X,id:`sf-part-${n}-${o}`})}),children:[pe&&t(Ee,{source:pe,slug:Re(p),menuId:$t(p)}),Pe&&t(st,{style:{value:ee??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...ve.map(e=>({value:e.id,label:e.name,description:e.values.font?le(e.values.font)?.label:void 0}))],onChange:e=>We(e||null),changed:Ge>0,onEditStyles:i,onUpdateStyle:w&&$e?()=>j(!0):void 0},font:{value:P.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Nt.map(e=>({label:e.label,value:e.key})),onChange:e=>I("font",e||null)},italic:{value:P.italic,styleValue:cn(_e,ee),onChange:e=>I("italic",e??null)},cells:at(u[0].style,u[0].base,Q,{phone:Ve}),align:{value:P.align??"",styleValue:u[0].base.align,onChange:e=>I("align",e||null)},letterCase:{value:P.case??"",styleValue:u[0].base.case,onChange:e=>I("case",e||null)}}),Ae&&w&&t(dt,{styleName:Xe,onCancel:()=>j(!1),onConfirm:Ye}),Pe&&Be===null&&t("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function cn(n,o){return!o||!Array.isArray(n)?!1:n.find(i=>i?.id===o)?.values?.italic===!0}const dn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:_t};export{nn as PartPanelBody,Qe as PartResetDot,Ee as PartSourceNote,tn as PartStyleSelect,an as default,re as partFace};
|
|
1
|
+
"use client";import{jsx as t,Fragment as ne,jsxs as h}from"react/jsx-runtime";import{useContext as qe,useEffect as oe,useRef as Je,useState as Te}from"react";import{PartResetDot as Qe}from"./PartResetDot.js";import{FieldSelect as Ze,InspectorField as et}from"efficient-easel/fields";import{SettingsField as tt}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as nt,TypeIcon as ot}from"efficient-easel/icons";import{useEasel as lt}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as rt}from"efficient-shell/ui";import{PartTextBox as it,partTextCells as at}from"./PartTextBox.js";import{UiIcon as Ne}from"efficient-easel/draw/client";import{usePreviewHeader as ct}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as dt}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as ut}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as ft,partStyleToTextStyleValues as pt,pushIntoStyle as mt,resolveTextStyles as ht,styleIdOfRole as yt}from"../../render/lib/text-styles/site-text-styles.js";import{useSiteTextStylesWriter as St}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as gt}from"../lib/theme-row-persist.js";import{usePreviewDevice as xt}from"efficient-easel/draw/client";import{usePartStyle as bt}from"./PreviewPartStyleContext.js";import{say as l}from"../../format/lib/editor-words.js";import{readHidable as U,textFieldOffPage as Pt,textFieldPanelOnly as wt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as vt}from"efficient-easel/draw";import{useSectionOps as Tt}from"efficient-easel/screen/lib/puck/use-section-ops";import{FONT_OPTIONS as Nt,FONT_ROLES as Ce,FONT_ROLE_LABELS as ke,fontOption as le}from"../../format/lib/fonts.js";import{isMultilineKind as Ct,partPlaceholder as kt,typeInPlaceKind as Ot}from"../../render/lib/puck/part-text.js";import{partRowField as Rt}from"../lib/puck/part-row-field.js";import{decodePartKey as It,partPropsWithRowValue as Et,partRowValue as Ft}from"../../render/lib/puck/part-rows.js";import{PART_WIDTH_MAX as _t,followedStyleOf as zt,propsWithPartStyleValue as E,propsWithoutPartStyle as At,readPartStyle as Oe}from"../../render/lib/puck/part-styles.js";import{partThemeColors as Vt}from"../../format/lib/puck/part-inks.js";import{styleKeyForPart as Lt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as Kt}from"../lib/puck/part-typing.js";import{keysOnCanvas as Ut,useCanvasTypingPart as Bt}from"../lib/puck/canvas-typing.js";import{useEaselHost as Dt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as Wt,SOURCE_ACTIONS as Mt,SOURCE_ACTION_LABEL as jt,partSourceNoteFor as Gt,partSourceOf as Ht,sourceMenuIdOf as $t,sourceSlugOf as Re}from"../../format/lib/puck/source-bound-parts.js";import{encodePartId as Xt,holdsAuthoredText as Yt}from"../../render/lib/puck/text-parts.js";import{regionsForSection as qt}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as Jt}from"../../format/lib/sections/text-regions.js";function se(n){return n?l(n):null}function Ie(n){return n.kind==="role"?ke[n.role]:n.kind==="custom"?"Custom":null}function Qt(n){const o=n.role;return o&&Ce.includes(o)?{kind:"role",role:o}:null}function Zt(n,o){if(!n)return{kind:"unread"};const{faceRole:s,base:i}=n;if(o[s]===i.fontKey)return{kind:"role",role:s};const c=Object.keys(o).filter(r=>o[r]===i.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function re(n,o,s,i){return Qt(Oe(n,o))??Zt(s,i)}function en(n,o){if(!n.length)return null;const s=o(n[0]);return n.every(i=>o(i)===s)?s:null}const B="";function tn({face:n,base:o,onPick:s}){const i=n.kind==="role"?n.role:B,c=[{label:l("No style"),value:B},...Ce.map(r=>({label:l(ke[r]),value:r}))];return t(Ze,{ariaLabel:l("Style"),value:i,options:c,inline:!0,onChange:r=>s(r===B?null:r),renderOption:r=>r.value===B?h(ne,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:l("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:se(Ie(n))}),valueText:r=>se(Ie(n))??r?.label??""})}function nn({sectionName:n,onBack:o,textEditor:s,styleRow:i,children:c}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:l(n),onSelect:o}),s,i,c]})}function Ee({source:n,slug:o,menuId:s}){const i=Dt(),c=Mt[n],r=!c.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[l(Wt[n]),r?h(ne,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{c.type==="storefront-editor:open-menus"?i.send(c.type,{menuId:s??null}):o&&i.send(c.type,{slug:o})},children:l(jt)})]}):null]})})}const Fe=4,on=120;function ln({region:n,sizePx:o,face:s,base:i,onFollowStyle:c,source:r,slug:D,onBack:v}){const F=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l(n.label)})}),t("p",{children:o?l("Its size follows Styles ▸ {follows} — {px}px right now.",{follows:l(F),px:Math.round(o)}):l("Its size follows Styles ▸ {follows}.",{follows:l(F)})}),c?t(ne,{children:t(tt,{label:l("Style"),icon:t(nt,{}),hint:l("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:l(n.label).toLowerCase()}),children:t(tn,{face:s,base:i,onPick:c})})}):t("p",{className:"es-field-hint sf-hint-keep",children:l("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(Ee,{source:r,slug:D}):null,t(K,{inline:!0,name:l("Page"),onSelect:v})]})}function sn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part is no longer here.")})}),t("p",{children:l("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:l("Page"),onSelect:n})]})}function rn({onBack:n,partId:o,why:s}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:l("This part's settings did not open.")})}),t("p",{children:l("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",s]})}),t(K,{inline:!0,name:l("Page"),onSelect:n})]})}function an({nodeId:n,propKey:o,onBack:s,onEditStyle:i}){const{getItemById:c,getSelectorForId:r,config:D}=lt(e=>e),v=Tt(),F=Bt(),{partStyle:_}=bt(),{fonts:W,textStyles:_e}=ct(),M=qe(ut),ie=!M?.capabilities?.hasSiteTheme,{persist:ze}=gt({themeFromDocument:ie,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),R=St({themeFromDocument:ie,persist:ze}),[Ae,j]=Te(!1),Ve=xt()==="mobile",ae=Je(null),d=c(n),m=r(n),ce=d?D.components[d.type]:void 0,{key:S,row:g}=It(o),de=ce?.fields?.[S],y=g?Rt(de,g):de,T=Xt(n,o),p=d?.props??{},x=Ot(y),ue=Pt(y),fe=Yt(y),Le=d?Ht(d.type):null,pe=d?Gt(d.type,S):null,G=g?Ft(p[S],g):p[S],me=!!g&&!(Array.isArray(p[S])&&g.index<p[S].length);oe(()=>{if(Ut(document))return;ae.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[T]);const[H,he]=Te(0);oe(()=>he(0),[T]);const $=!!d&&!me&&(!m||!y);oe(()=>{if(!$||H>=Fe)return;const e=setTimeout(()=>he(a=>a+1),on);return()=>clearTimeout(e)},[$,H]);const Ke=$&&H<Fe;if(!d||me)return t(sn,{onBack:s});const z=qt(d.type),ye=z?Jt(z,o):null;if(z&&ye){const e=_?.partId===T?_:null,a=z[ye],f=a.writable===!0&&!!m,b=te=>{m&&v.replaceComponent(m.zone,m.index,{...d,props:E(p,o,"role",te)})};return t(ln,{region:a,sizePx:e?.base.sizePx??null,face:re(p,o,e,W),base:e?.base??null,onFollowStyle:f?b:void 0,source:Le,slug:Re(p),onBack:s})}if(!m||!y)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(rn,{onBack:s,partId:T,why:m?"no field":"no selector"});const Se=e=>{v.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!x){const f=g?Et(p,S,g,e):{...p,[S]:e};f&&Se(f);return}Kt({node:d,propKey:o,kind:x,zone:m.zone,index:m.index},U(e).text,v.replaceComponent)},Ue=G,N=_?.partId===T?_:null,C=N?.styleOwner,A=C?c(C.owner):null,Y=C&&A?r(C.owner):null,q=!!(C&&A&&Y),k=q?A.props??{}:p,J=q?e=>v.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?C.kind:Lt(d?.type,o),P=Oe(k,V),u=[{partKey:V,face:re(k,V,N,W),sizeGroup:N?.sizeGroup??null,base:N?.base??dn,style:P}],Be=en(u,e=>e.sizeGroup),De=Vt(N?.inks),I=(e,a)=>{let f=k;for(const b of u)f=E(f,b.partKey,e,a);J(f)},We=e=>e?I("textStyle",e):Q({textStyle:null,role:null}),Q=e=>{let a=k;for(const f of u)for(const[b,te]of Object.entries(e))a=E(a,f.partKey,b,te??null);J(a)},Z=x==="text"||x==="textarea",{text:ge,hidden:O}=U(G),L=y?.[vt]?.label??o,xe=O?l("Show {label} on the slide",{label:l(L)}):l("Hide {label} on the slide",{label:l(L)}),be=h("div",{className:"sf-field-head",children:[t(ot,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:l(L)}),Z&&t(rt,{content:xe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":O,"aria-label":xe,onClick:()=>X({text:ge,hidden:!O}),children:O?t(Ne,{name:"eye-off",size:14}):t(Ne,{name:"eye",size:14})})})]}),Pe=!ue&&fe,Me=!!x&&(wt(y)||ue||O||!fe),we=re(k,V,N,W),je=we.kind==="role"?we.role:null,ee=zt(P)??yt(je),ve=ht(R.saved,R.old),Ge=Object.entries(P).filter(([e,a])=>e!=="role"&&e!=="textStyle"&&a!==void 0).length,He=()=>{let e=k;for(const a of u){const{role:f,textStyle:b}=a.style;e=At(e,a.partKey),f&&(e=E(e,a.partKey,"role",f)),b&&(e=E(e,a.partKey,"textStyle",b))}J(e)},w=ee,$e=ft(u[0].style),Xe=w?ve.find(e=>e.id===w)?.name??w:"",Ye=()=>{j(!1),w&&(R.write(mt({saved:R.saved,old:R.old,styleId:w,values:pt(u[0].style)}),!0),He())};return h(nn,{sectionName:ce?.label??d.type,onBack:s,textEditor:t("div",{ref:ae,className:"sf-part-text",children:Me?t(it,{text:ge,onTextChange:e=>X(Z?{text:e,hidden:O}:e),multiline:Ct(x),markup:x!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:Q,colors:De,placeholder:se(kt(y))??void 0,ariaLabel:l(L),head:be,typedOnCanvas:F===T}):x?Z?be:null:t(et,{field:y,name:o,value:Ue,onChange:X,id:`sf-part-${n}-${o}`})}),children:[pe&&t(Ee,{source:pe,slug:Re(p),menuId:$t(p)}),Pe&&t(st,{style:{value:ee??"",options:[{value:"",label:l("No style"),description:l("Section’s own")},...ve.map(e=>({value:e.id,label:e.name,description:e.values.font?le(e.values.font)?.label:void 0}))],onChange:e=>We(e||null),changed:Ge>0,onEditStyles:i,onUpdateStyle:w&&$e?()=>j(!0):void 0},font:{value:P.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Nt.map(e=>({label:e.label,value:e.key})),onChange:e=>I("font",e||null)},italic:{value:P.italic,styleValue:cn(_e,ee),onChange:e=>I("italic",e??null)},cells:at(u[0].style,u[0].base,Q,{phone:Ve}),align:{value:P.align??"",styleValue:u[0].base.align,onChange:e=>I("align",e||null)},letterCase:{value:P.case??"",styleValue:u[0].base.case,onChange:e=>I("case",e||null)}}),Ae&&w&&t(dt,{styleName:Xe,onCancel:()=>j(!1),onConfirm:Ye}),Pe&&Be===null&&t("p",{className:"es-field-hint sf-hint-keep",children:l("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function cn(n,o){return!o||!Array.isArray(n)?!1:n.find(i=>i?.id===o)?.values?.italic===!0}const dn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:_t};export{nn as PartPanelBody,Qe as PartResetDot,Ee as PartSourceNote,tn as PartStyleSelect,an as default,re as partFace};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TextStyleColour, type TextStyleFont } from "efficient-easel/text-styles";
|
|
2
|
-
import { type OldSiteText, type StoredTextStyle } from "
|
|
2
|
+
import { type OldSiteText, type StoredTextStyle } from "../../render/lib/text-styles/site-text-styles.js";
|
|
3
3
|
export declare const SITE_FONTS: TextStyleFont[];
|
|
4
4
|
export default function SiteTextStylesField({ saved, old, colours, sizeOf, onChange, openId, onOpenChange, readOnly, withoutSize, }: {
|
|
5
5
|
saved: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as y}from"react/jsx-runtime";import{useState as O}from"react";import{TextStylesList as v}from"efficient-easel/text-styles";import{FONT_OPTIONS as x}from"../../format/lib/fonts.js";import{usePreviewDevice as I}from"efficient-easel/draw/client";import{applyListChange as _,resolveTextStyles as C,toPanelStyles as E}from"
|
|
1
|
+
"use client";import{jsx as y}from"react/jsx-runtime";import{useState as O}from"react";import{TextStylesList as v}from"efficient-easel/text-styles";import{FONT_OPTIONS as x}from"../../format/lib/fonts.js";import{usePreviewDevice as I}from"efficient-easel/draw/client";import{applyListChange as _,resolveTextStyles as C,toPanelStyles as E}from"../../render/lib/text-styles/site-text-styles.js";const c=["font","color","size","weight","emphasis","lineSpacing","letterSpacing","paragraphSpacing","letterCase","largestSize"],b=["size","lineSpacing","letterSpacing","letterCase"],k=500,w=x.map(e=>({value:e.key,label:e.label,family:`var(${e.cssVar})`,italic:e.italicLoaded}));function L({saved:e,old:s,colours:p,sizeOf:o,onChange:f,openId:a,onOpenChange:S,readOnly:d=!1,withoutSize:g=!1}){const[m,u]=O(null),T=I()==="mobile",l=C(e,s),r=E(l,o);return y(v,{styles:r,onChange:t=>f(_({saved:e,old:s,cur:r,next:t,sizeOf:o})),fonts:w,colours:p,settings:g?c.filter(t=>t!=="size"):c,auto:b,openId:a===void 0?m:a,onOpenChange:S??u,readOnly:d,device:T?"phone":"desktop",fallback:t=>{const n=l.find(h=>h.id===(t.kind==="heading"?"heading-1":"body-1")),i={};return n?.values.font&&t.id!==n.id&&(i.font=n.values.font),t.kind==="heading"&&(i.weight=k),i}})}export{w as SITE_FONTS,L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as c,jsxs as it}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as oe,useRef as f,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as ct}from"../lib/puck/build-config.js";import{ChromeWrap as st}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as dt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as ut}from"../lib/site-live-state.js";import{holdSiteWrites as ht}from"../../format/lib/site-writes.js";import{backendOf as W,blocksOf as lt}from"../lib/website-session.js";import{useEaselSession as mt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as pt}from"../../format/lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as St}from"../../format/lib/puck/templateFields.js";import{setEditorPage as ne}from"../../format/lib/puck/editor-page-context.js";import{resolveSiteName as ft}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as gt,normalizeSiteWidth as wt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as ae}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as Ct}from"../../format/lib/content/container-gap.js";import _t,{DocumentScreen as Tt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Et}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as yt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Pt}from"./PreviewFooterContext.js";import{PreviewChatProvider as vt,DEFAULT_CHAT_PREVIEW as Wt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Ht}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Gt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Bt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Rt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as It}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Ft}from"efficient-easel/draw/client";import{CanvasPartsBridge as Dt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as Mt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as xt}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as Nt,DEFAULT_HEADING_COMPRESSION as Ot,DEFAULT_HEADING_TYPOGRAPHY as bt,DEFAULT_SWITCH_SHOWN as H,DEFAULT_SIZES as At,DEFAULT_THEME_MODE as _,normalizeCornerRadius as zt,normalizeCornerStyle as Lt,normalizeCardShadow as Yt,normalizeCardGap as Ut,normalizeHoverEffect as jt,normalizeShadowColor as Kt,IDENTITY_CARD_GAP as ie,IDENTITY_CARD_SHADOW as Vt,IDENTITY_HOVER_EFFECT as Xt,THEME_MODE_KEY as ce,THEME_STORAGE_KEY as Zt,THEME_SWITCH_HIDE as se,THEME_SWITCH_KEY as k}from"../../format/lib/theme.js";import{DEFAULT_FONTS as qt}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Jt}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as Qt}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as $t}from"
|
|
1
|
+
"use client";import{jsx as c,jsxs as it}from"react/jsx-runtime";import{useCallback as n,useEffect as S,useMemo as oe,useRef as f,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as ct}from"../lib/puck/build-config.js";import{ChromeWrap as st}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as dt}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as ut}from"../lib/site-live-state.js";import{holdSiteWrites as ht}from"../../format/lib/site-writes.js";import{backendOf as W,blocksOf as lt}from"../lib/website-session.js";import{useEaselSession as mt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as pt}from"../../format/lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as St}from"../../format/lib/puck/templateFields.js";import{setEditorPage as ne}from"../../format/lib/puck/editor-page-context.js";import{resolveSiteName as ft}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as gt,normalizeSiteWidth as wt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as ae}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as Ct}from"../../format/lib/content/container-gap.js";import _t,{DocumentScreen as Tt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Et}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as yt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Pt}from"./PreviewFooterContext.js";import{PreviewChatProvider as vt,DEFAULT_CHAT_PREVIEW as Wt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Ht}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Gt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Bt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Rt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as It}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Ft}from"efficient-easel/draw/client";import{CanvasPartsBridge as Dt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as Mt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as xt}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as Nt,DEFAULT_HEADING_COMPRESSION as Ot,DEFAULT_HEADING_TYPOGRAPHY as bt,DEFAULT_SWITCH_SHOWN as H,DEFAULT_SIZES as At,DEFAULT_THEME_MODE as _,normalizeCornerRadius as zt,normalizeCornerStyle as Lt,normalizeCardShadow as Yt,normalizeCardGap as Ut,normalizeHoverEffect as jt,normalizeShadowColor as Kt,IDENTITY_CARD_GAP as ie,IDENTITY_CARD_SHADOW as Vt,IDENTITY_HOVER_EFFECT as Xt,THEME_MODE_KEY as ce,THEME_STORAGE_KEY as Zt,THEME_SWITCH_HIDE as se,THEME_SWITCH_KEY as k}from"../../format/lib/theme.js";import{DEFAULT_FONTS as qt}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Jt}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as Qt}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as $t}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as er}from"../../format/lib/word-styles.js";import{chatPreviewFrom as tr}from"./PreviewChatContext.js";const rr=()=>{if(typeof window>"u")return _;try{const i=window.localStorage.getItem(ce);return i==="light"||i==="dark"||i==="auto"?i:_}catch{return _}},de=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ce,i)}catch{}},or=()=>{if(typeof window>"u")return H;try{return window.localStorage.getItem(k)!==se}catch{return H}},nr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Zt)}catch{}},ue=i=>{if(!(typeof window>"u"))try{i?window.localStorage.removeItem(k):window.localStorage.setItem(k,se)}catch{}};function ar(){const{adapter:i,capabilities:d,templateId:G,ready:w,token:h,siteId:s,currentSlug:B,currentKind:R}=Et();S(()=>(ne(B,R),()=>ne(null,null)),[B,R]);const T=d.placeholderFrames,[he,I]=r(null),[le,F]=r("");S(()=>{const e=i.templateName;if(!w||!G||!e){F("");return}let a=!1;return e().then(l=>!a&&F(l??"")).catch(()=>{}),()=>{a=!0}},[w,h,G,i]);const[me,E]=r(_),[pe,y]=r(H),[Se,D]=r({selected:0,themes:[]}),[fe,M]=r(qt),[ge,x]=r(At),[we,N]=r(null),[Ce,O]=r(Ot),[_e,b]=r(null),[Te,A]=r(null),[Ee,z]=r(ie),[ye,L]=r(null),[Pe,Y]=r(null),[ve,U]=r(null),[P,j]=r(null),u=mt(),K=oe(()=>ct(dt(u),lt(u)),[u]),We=oe(()=>pt(St(K,T),P),[K,T,P]),[He,V]=r(bt),[ke,X]=r(null),[Ge,Z]=r(null),[Be,q]=r(null),[Re,J]=r(null),[Ie,Q]=r(null),$=f(null),o=f(!1);S(()=>{E(rr()),y(or())},[]);const Fe=n(e=>{o.current=!0,nr(),de(e),E(e)},[]),De=n(e=>{o.current=!0,ue(e),y(e)},[]),Me=n(e=>{o.current=!0,D(e)},[]),xe=n(e=>{o.current=!0,M(e)},[]),Ne=n(e=>{o.current=!0,x(e)},[]),Oe=n(e=>{o.current=!0,N(e)},[]),be=n(e=>{o.current=!0,O(e)},[]),Ae=n(e=>{o.current=!0,b(e)},[]),ze=n(e=>{o.current=!0,A(e)},[]),Le=n(e=>{o.current=!0,z(e)},[]),Ye=n(e=>{o.current=!0,L(e)},[]),Ue=n(e=>{o.current=!0,V(e)},[]),[je,ee]=r(null),[Ke,Ve]=r(null),Xe=n(e=>{o.current=!0,ee(e)},[]),Ze=n(e=>{o.current=!0,Y(e)},[]),qe=n(e=>{o.current=!0,U(e)},[]),Je=n(e=>{o.current=!0,j(e)},[]),Qe=n(e=>{o.current=!0,X(e)},[]),$e=n(e=>{o.current=!0,Z(e)},[]),et=n(e=>{o.current=!0,q(e)},[]),tt=n(e=>{o.current=!0,J(e)},[]),rt=n(e=>{o.current=!0,Q(e)},[]);S(()=>{const e=W(u).theme;if(!h||!d.hasSiteTheme||!e)return;const a=s??"";$.current!==a&&($.current=a,o.current=!1);let l=!1;return e.get(s?{siteId:s}:void 0).then(t=>{if(l||o.current)return;de(t.default_mode),ue(t.show_theme_switch),E(t.default_mode),y(t.show_theme_switch),D({selected:t.selected_preset,themes:t.theme_presets});const g=$t(t);M(g.fonts),x(g.sizes),N(t.corner_radius_px===void 0?Nt[Lt(t.corner_style)]:zt(t.corner_radius_px)),O(g.compression),b(t.card_shadow==null?Vt:Yt(t.card_shadow)),z(t.card_gap==null?ie:Ut(t.card_gap)),L(t.hover_effect==null?Xt:jt(t.hover_effect)),A(Kt(t.shadow_color)),Y(wt(t.site_width)),U(gt(t.site_gutter)),j(Ct(t.block_gap)),V(g.typography),ee(g.textStyles),Ve(er(t)),X(t.hero_background_follows_width===!0),Z(ae(t.section_background_width)),q(ae(t.section_content_width)),J(t.photography_grayscale===!0),Q(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{l=!0}},[h,s,d.hasSiteTheme,u]);const ot=kt({token:h,siteId:s,enabled:d.hasSiteSettings}),[nt,te]=r(Wt),re=f(null),v=f(!1),m=f(null),p=f({}),C=n(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await W(u).chat?.update(e,s?{siteId:s}:void 0),ut()}catch(a){throw p.current={...e,...p.current},a}},[u,s]);S(()=>ht(()=>m.current||Object.keys(p.current).length>0?C():void 0),[C]);const at=n(e=>{v.current=!0,te(a=>({...a,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,h,C]);return S(()=>{if(!h||!d.hasSiteSettings)return;const e=s??"";re.current!==e&&(re.current=e,v.current=!1);let a=!1;const l=W(u).chat;if(l)return l.get(s?{siteId:s}:void 0).then(t=>{a||v.current||te(tr(t))}).catch(()=>{}),()=>{a=!0}},[h,s,d.hasSiteSettings,u]),S(()=>{const e=i.site;if(!w||!d.hasSiteRecord||!e){I(null);return}let a=!1;return e().then(l=>{a||I(ft(l.name))}).catch(()=>{}),()=>{a=!0}},[w,h,d.hasSiteRecord,s,i]),c(Tt,{config:We,parts:Jt,wrap:(e,a)=>c(yt,{websiteName:he,templateChrome:T,templateName:le||null,themeMode:me,onThemeModeChange:Fe,themeSwitchShown:pe,onThemeSwitchShownChange:De,theme:Se,onThemeChange:Me,fonts:fe,onFontsChange:xe,cornerRadiusPx:we,onCornerRadiusPxChange:Oe,cardShadow:_e,onCardShadowChange:Ae,shadowColor:Te,onShadowColorChange:ze,cardGap:Ee,onCardGapChange:Le,hoverEffect:ye,onHoverEffectChange:Ye,headingCompression:Ce,onHeadingCompressionChange:be,headingTypography:He,onHeadingTypographyChange:Ue,textStyles:je,onTextStylesChange:Xe,wordStyles:Ke,sizes:ge,onSizesChange:Ne,siteWidth:Pe,onSiteWidthChange:Ze,siteGutter:ve,onSiteGutterChange:qe,blockGap:P,onBlockGapChange:Je,heroBackgroundFollowsWidth:ke,onHeroBackgroundFollowsWidthChange:Qe,sectionBackgroundWidth:Ge,onSectionBackgroundWidthChange:$e,sectionContentWidth:Be,onSectionContentWidthChange:et,photographyGrayscale:Re,onPhotographyGrayscaleChange:tt,shareButtonOnPosts:Ie,onShareButtonOnPostsChange:rt,themeFromDocument:!d.hasSiteTheme,children:c(Pt,{children:c(st,{wrap:u.chrome?.wrap,surface:"page",children:c(Rt,{children:c(It,{children:c(Ft,{children:c(Dt,{children:c(Mt,{children:it(xt,{children:[c(vt,{chat:nt,onChatChange:at,children:c(Ht,{value:ot,children:c(Gt,{children:e})})}),a]})})})})})})})})})})}function ir({target:i}){return c(_t,{target:i,addressing:Bt,onHostMessage:Qt,children:c(ar,{})})}export{ir as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import c,{useWebsiteName as f}from"./WebsiteSettingsPanel.js";import d from"efficient-easel/screen/components/SidePanelHead";import{say as s}from"../../format/lib/editor-words.js";import{StylesIcon as p}from"efficient-easel/rail";import{Tooltip as y}from"efficient-shell/ui";function S({tokenRef:n,siteId:o,onClose:i,onNotify:a,tab:l,onTabChange:m}){const t=f();return r("div",{className:"sf-styles",children:[e(d,{icon:e(p,{}),title:s("
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import c,{useWebsiteName as f}from"./WebsiteSettingsPanel.js";import d from"efficient-easel/screen/components/SidePanelHead";import{say as s}from"../../format/lib/editor-words.js";import{StylesIcon as p}from"efficient-easel/rail";import{Tooltip as y}from"efficient-shell/ui";function S({tokenRef:n,siteId:o,onClose:i,onNotify:a,tab:l,onTabChange:m}){const t=f();return r("div",{className:"sf-styles",children:[e(d,{icon:e(p,{}),title:s("Styles"),context:e(y,{content:s("{name} — renamed in the Console: {place}.",{name:t,place:s("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:e("span",{className:"sf-name-text",children:t})}),onHide:i}),e("div",{className:"sf-insp-body es-insp-body sf-scroll",children:e(c,{tokenRef:n,siteId:o,onNotify:a,tab:l,onTabChange:m})})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as d,Fragment as _}from"react/jsx-runtime";import{SettingsField as b,SettingsGroupSub as z}from"efficient-easel/panel";import{Button as p,IconButton as L,Tooltip as O}from"efficient-shell/ui";import A from"./ThemeColourField.js";import{say as o}from"../../format/lib/editor-words.js";import{ColourControl as k}from"../lib/puck/ColourControl.js";import{ButtonIcon as j,ChevronDownIcon as w,ChevronUpIcon as D,GroundIcon as P,LayoutIcon as G,SquareIcon as H,TextSmallIcon as M,TypeIcon as x}from"efficient-easel/icons";import{DEFAULT_THEMES as I,GRADE_LABEL as v,contrastRatio as T,gradeContrast as E,normalizeThemeColors as g,resolvedButtonInk as R,themeButtonColour as S,themeButtonInk as U}from"../../format/lib/theme.js";const J=t=>o("Theme {n}",{n:t+1});function $({colors:t}){const n=g(t),r=S(t)??n.accent;return d("span",{className:"sf-theme-page",style:{background:n.background,color:n.text},"aria-hidden":!0,children:[e("span",{className:"sf-theme-eyebrow",style:{color:n.muted},children:o("label")}),d("span",{className:"sf-theme-headline",children:[o("Heading")," ",e("span",{style:{color:n.accent},children:o("accent")})]}),e("span",{className:"sf-theme-body",children:o("body text")}),d("span",{className:"sf-theme-row",children:[e("span",{className:"sf-theme-btn",style:{background:r,color:R(t,n.accent)},children:o("button")}),e("span",{className:"sf-theme-mini",style:{background:n.surface,borderColor:n.line},children:o("card")})]})]})}const N={"Text color":e(x,{}),"Label color":e(M,{}),Background:e(P,{}),"Panels & cards":e(G,{}),Borders:e(H,{}),"Button color":e(j,{}),"Button text color":e(x,{})};function W({label:t,colorKey:n,value:r,onChange:c,idPrefix:a="sf-theme-ink"}){const s=`${a}-${n}`;return e(b,{label:o(t),icon:N[t],htmlFor:s,action:e(k,{id:s,label:o(t),value:r,onChange:l=>c(n,l)})})}function q({value:t,accent:n,onChange:r,idPrefix:c="sf-theme-ink"}){const a=`${c}-button`,s=/^#[0-9a-fA-F]{6}$/.test(t??""),l=s?t:n;return e(b,{label:o("Button color"),icon:N["Button color"],htmlFor:a,action:e(k,{id:a,label:o("Button color"),value:l,caption:s?l:o("Main"),onChange:r})})}function K({colors:t,accent:n,onChange:r,idPrefix:c="sf-theme-ink"}){const a=`${c}-button-ink`,s=U(t),l=R(t,n),i=S(t)??n,u=E(T(l,i)??0);return e(b,{label:o("Button text color"),icon:N["Button text color"],hint:s&&u!=="good"?o("{grade} on the button",{grade:o(v[u])}):void 0,htmlFor:a,action:e(k,{id:a,label:o("Button text color"),value:l,caption:s?l:o("Auto"),onChange:r})})}const Q=[{colour:!0},{label:"Text color",key:"text"},{label:"Label color",key:"muted"},{button:!0},{buttonInk:!0},{group:"Surfaces"},{label:"Background",key:"background"},{label:"Panels & cards",key:"surface"},{label:"Borders",key:"line"}];function V({colors:t,onChange:n,idPrefix:r}){const c=g(t);return e(_,{children:Q.map(a=>"colour"in a?e(A,{value:t,onChange:n},"colour"):"group"in a?e(z,{title:o(a.group)},a.group):"button"in a?e(q,{value:t.button,accent:c.accent,onChange:s=>n({...t,button:s}),idPrefix:r},"button"):"buttonInk"in a?e(K,{colors:t,accent:c.accent,onChange:s=>n({...t,buttonInk:s}),idPrefix:r},"buttonInk"):e(W,{label:a.label,colorKey:a.key,value:c[a.key],onChange:(s,l)=>n({...t,[s]:l}),idPrefix:r},a.key))})}function se({index:t,colors:n,selected:r,role:c="radio",open:a,editable:s=!0,onPick:l,onEdit:i,onChangeColors:u}){const h=g(n),m=J(t),f=t<I.length&&!n.brandInk?I[t]:null,y=E(T(h.text,h.background)??0),C=f?JSON.stringify(n)!==JSON.stringify(f):!1,B=a!==void 0;return d("div",{className:`sf-theme-card${r?" is-selected":""}`,children:[e("button",{type:"button",role:c,"aria-checked":c==="radio"?r:void 0,"aria-selected":c==="option"?r:void 0,"aria-label":m,className:"sf-theme-pick",onClick:l,children:e($,{colors:n})}),d("div",{className:"sf-theme-foot",children:[e("span",{className:"sf-theme-name",children:m}),y!=="good"&&e("span",{className:"sf-theme-warn",children:o(v[y])}),s&&i&&B&&e("span",{className:"sf-theme-edit",children:e(O,{content:a?o("Collapse"):o("Edit colors"),children:e(L,{size:"sm","aria-expanded":a,"aria-controls":`sf-theme-colours-${t}`,"aria-label":a?o("Collapse {name}",{name:m}):o("Edit colors for {name}",{name:m}),onClick:i,children:a?e(D,{size:14}):e(w,{size:14})})})}),s&&i&&!B&&e(p,{variant:"secondary",size:"sm",className:"sf-theme-edit","aria-label":o("Edit {name}",{name:m}),onClick:i,children:o("Edit")})]}),a&&d("div",{id:`sf-theme-colours-${t}`,className:"sf-theme-colours",children:[e(V,{colors:n,onChange:F=>u?.(F)}),f&&e(p,{variant:"link",size:"sm",className:"sf-theme-reset",disabled:!C,onClick:()=>u?.({...f}),children:C?o("Reset {name} to the preset",{name:m}):o("Not changed")})]})]})}function re({colors:t,name:n,nameId:r,open:c,menuId:a,labelId:s,buttonRef:l,onClick:i,onKeyDown:u,onEdit:h}){return d("div",{className:"sf-secttheme-btn",children:[e("button",{ref:l,type:"button",className:"sf-theme-pick","aria-expanded":c,"aria-controls":a,"aria-labelledby":`${s} ${r}`,onClick:i,onKeyDown:u,children:t?e($,{colors:t}):e("span",{className:"sf-secttheme-nopreview","aria-hidden":"true"})}),d("div",{className:"sf-theme-foot",children:[e("span",{id:r,className:"sf-theme-name",children:n}),h&&e(p,{variant:"secondary",size:"sm",className:"sf-theme-edit","aria-label":o("Edit {name}",{name:n}),onClick:h,children:o("Edit")}),e("button",{type:"button",className:"sf-secttheme-caret","aria-hidden":"true",tabIndex:-1,onClick:i,children:e("span",{className:"sf-multi-caret",children:"▾"})})]})]})}export{se as ThemeCard,re as ThemeCardTrigger,W as ThemeColourRow,V as ThemeColourRows,$ as ThemePreview,J as themeName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,Fragment as B,jsxs as _}from"react/jsx-runtime";import{useCallback as C,useEffect as P,useRef as oe,useState as re}from"react";import{Button as ne,Tooltip as ie}from"efficient-shell/ui";import{SettingsSwitch as se}from"efficient-easel/panel";import{PagesIcon as ae,StylesIcon as ce}from"efficient-easel/rail";import{PaletteIcon as de}from"efficient-shell/icons/efficient";import{TemplateIcon as le}from"efficient-easel/icons";import{Subtree as pe,TreeRow as y}from"efficient-easel/tree";import{useEasel as H}from"efficient-easel/easel";import{useEaselStrings as N}from"efficient-easel/strings";import{LocationsTreeContext as me}from"./LocationsTreeContext.js";import fe from"./PagesPanel.js";import{usePreviewChat as ue}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as Se}from"./preview-devices.js";import{PreviewDeviceContext as he}from"efficient-easel/draw/client";import{usePreviewHeader as Ee}from"../../render/components/PreviewHeaderContext.js";import{usePreviewSocial as we}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as Te}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as Pe,usePreviewTicker as be}from"../../render/components/PreviewTickerContext.js";import{usePreviewHeroPart as ge}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Ie,HERO_PART_MODE as D,heroMediaRows as ve,heroPartId as W,readHeroPartId as ke}from"../../render/lib/puck/hero-media-parts.js";import _e,{CHAT_MODE as Ce,HEADER_MODE as V,SOCIAL_MODE as Re,WEBSITE_MODE as M}from"./SectionEditor.js";import R from"./SectionIcon.js";import Le from"./SectionThumbnail.js";import{useScreenDocument as L}from"efficient-easel/screen/components/ScreenDocumentContext";import Oe from"./StylesPanel.js";import{LOCATIONS_TYPE as Ae,useLocationsTree as Be}from"./useLocationsTree.js";import{usePinnedChromeSeed as ye}from"./usePinnedChromeSeed.js";import{usePreviewHref as He}from"./usePreviewHref.js";import{WebsitePreviewButton as Ne}from"./WebsitePreviewButton.js";import{SITE_STYLES_TABS as De,SITE_STYLES_TEXT_TAB as We,useWebsiteName as Ve}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Me}from"./useWebsiteMainAction.js";import{VersionHistory as xe}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Ye}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Fe,heroGroupNestDepth as Ge}from"../../format/lib/hero-group-placement.js";import{stripMarkup as ze}from"../../format/lib/markup.js";import{categoryShortLabel as Ke,PINNED_SECTION_TYPE as je}from"../lib/puck/add-palette.js";import{canAddTo as Ue}from"../lib/puck/add-target.js";import{blockIsOffered as Ze}from"../lib/puck/block-offer.js";import{sectionIdOfBoxZone as qe,setBookingPreview as Xe}from"../../render/lib/puck/booking-preview.js";import{footerBlockRowName as Je}from"../../format/lib/puck/footer-block-row-name.js";import{FOOTER_TYPE as Qe,HEADER_TYPE as Y}from"../lib/puck/footer-blocks.js";import{leftViewForSelection as $e,readLeftView as et,resolveLeftView as tt,writeLeftView as ot}from"../../format/lib/puck/left-view.js";import{websiteIsLockedBlock as rt}from"../lib/puck/locked-blocks.js";import{everyPageNotice as nt,noOwnTab as it,pinnedReach as F,websiteDuplicateBlocked as st}from"../lib/puck/every-page.js";import{sharedSectionReach as at,WEBSITE_SHARED_SECTIONS as ct}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as G}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as dt}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as lt,scrollPreviewToTop as z}from"efficient-easel/screen/lib/puck/preview-dom";import{SiteCanvas as pt}from"../lib/puck/overrides.js";import{labelAtLevel as mt}from"../../format/lib/puck/section-catalog.js";import{editorWords as ft,say as p}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as ut}from"../../format/lib/puck/section-descriptions.js";import{groupAccepts as St,isSectionGroupType as ht,sectionGroupZone as Et,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as wt}from"../../format/lib/puck/section-groups.js";import{resolveSaveAsTemplateAction as Tt,SAVE_AS_TEMPLATE_EVENT as Pt}from"../../format/lib/save-as-template-action.js";import{newSectionNode as bt}from"../lib/sections/new-section-node.js";import{useHostProducts as gt}from"../lib/use-host-products.js";import{backendOf as It}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=be(),c=N().tree,d=e,n=d.kind==="ticker"?d.heroId:null,a=C(s=>{if(!s)return;t({kind:"ticker",heroId:s}),lt(s)},[t]);return P(()=>{o(n)},[n,o]),P(()=>{r(a)},[r,a]),{partRows:(s,{rowClick:u})=>{const m=String(s.props.id);return s.type==="Hero"&&i(y,{icon:i(R,{type:"ticker",size:13}),name:p(Pe),onSelect:()=>a(m),selected:n===m,rowProps:{onClick:u(()=>a(m))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=ge(),c=N().tree,{appState:d}=H(f=>f),n=d.data.content??[],a=oe(n);a.current=n;const s=e,u=Ie.find(f=>D[f]===s.kind),m=u&&"nodeId"in s?W(String(s.nodeId),u):null,E=C(f=>{const l=ke(f);if(!l)return;const w=a.current.findIndex(S=>String(S.props.id)===l.nodeId);if(w<0)return;const b={kind:D[l.part],nodeId:l.nodeId};t({index:w},b)},[t]);return P(()=>{o(m)},[m,o]),P(()=>{r(E)},[r,E]),{partRows:(f,{rowClick:l})=>{const w=String(f.props.id),b=ve(f);if(b.length===0)return null;const S=I=>{const g=W(w,I.part);return i(y,{icon:i(R,{type:I.part==="media"?"heroMedia":"heroImage",size:13}),name:p(I.label),onSelect:()=>E(g),selected:m===g,rowProps:{onClick:l(()=>E(g))},words:c},g)},[h,...T]=b;return _(B,{children:[S(h),T.length>0&&i(pe,{children:T.map(S)})]})}}}function Z(e,t){return{partRows:(o,r)=>_(B,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function vt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:d,hasUnsavedEdits:n,bridgeCapabilities:a,notifyParent:s,token:u}=L(),{hasPreviewLink:m}=o,E=It(x()).preview?.draftLink,f=Me(e.data),l=Tt({hasTrustedConsole:!!u,canCreatePlatformTemplate:a.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),w=C(()=>{!c||!r||s(Pt,{siteId:c,slug:r})},[s,c,r]),b=He({pageSlug:r,siteId:c,token:u}),S=t.previewHref?.(r)??b;return{barLead:()=>l.visible&&i(ie,{side:"bottom",content:l.enabled?p("Save this website as a platform template"):p(l.disabledReason),children:i("span",{className:"sf-tip-disabled",tabIndex:l.enabled?void 0:0,children:i(ne,{variant:"secondary",disabled:!l.enabled,onClick:w,rightIcon:i(le,{size:15}),children:p("Save as Template")})})}),barTrail:()=>m&&r&&i(Ne,{liveHref:S,pageId:d??null,draftLink:E}),mainAction:f}}function kt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:d,navigate:n}=L(),{hasSiteTheme:a,explainsSiteSettings:s}=o,u=h=>t.setView(h),[m,E]=re(De[0].id),{surface:f,setSurface:l}=Te(),w=()=>{if(a){u("styles"),t.reveal(),z();return}e.show(M),e.reveal(),z()},b={id:"pages",label:p("Pages"),icon:i(ae,{}),panel:({onHide:h})=>i(fe,{activeSurface:f,onPreviewSurface:l,onNavigate:T=>{l(null),n(r?{kind:"template",id:r,pageSlug:T}:{kind:"page",slug:T,siteId:c??void 0})},onClose:h})},S=[];return!a&&s&&S.push({id:"appearance",label:p("Appearance"),icon:i(de,{}),active:e.kind==="website",onSelect:w}),a&&S.push({id:"styles",label:p("Site styles"),icon:i(ce,{}),panel:({onHide:h,notify:T})=>i(Oe,{tokenRef:d,siteId:c??void 0,onClose:h,onNotify:T,tab:m,onTabChange:E})}),{railLead:[b],railTrail:S,resolveLeftView:(h,T)=>tt(h,a,T),openSettings:w,openStyles:()=>{E(We),u("styles")}}}function _t(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=L(),c=H(n=>n.config),d=x();P(()=>(G({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>G(null)),[e,t,o,c]),P(()=>{const n=O();if(!n||!r)return;let a=!1;return dt(d).list().then(s=>{a||n.learn(s)}).catch(()=>{}),()=>{a=!0}},[r,d])}function Ct(e,t,o,r){const{kind:c,open:d}=e,{selected:n,zoneOf:a}=t;P(()=>{Xe(n?.type==="BookingBox"&&n.props.region==="confirm"?qe(a(String(n.props.id))):null)},[n?.props.id]);const s=Be(e,t),{capabilities:{hasSiteSettings:u}}=L();_t();const{setSelected:m,setSelectHandler:E}=Ee(),{chat:f,setChat:l,setSelected:w,setSelectHandler:b}=ue(),S=c==="header";P(()=>{m(S)},[S,m]),P(()=>{E(()=>d(V))},[E,d]);const h=C(()=>d(Ce),[d]),T=c==="chat";P(()=>{w(T)},[T,w]),P(()=>{b(h)},[b,h]);const{setOpenHandler:I}=we(),g=C(()=>d(Re),[d]);P(()=>{I(g)},[I,g]);const J=Z(j(e),U(e)),Q=vt(t),$=kt(e,r),ee=o.device;return{...J,...Q,...$,hasOwnRows:k=>k.type===Ae,ownRows:s.renderLocationTree,sectionPressed:s.sectionPressed,wrap:k=>i(me.Provider,{value:!0,children:_(he.Provider,{value:ee,children:[k,i(xe,{})]})}),addPanelRow:k=>u?_("div",{className:"sf-addside-sitewide",children:[i("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:i(R,{type:"chat",size:16})}),_("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),h()},children:[p("Live chat"),i("span",{className:"sf-addside-sitewide-desc",children:p("A chat bubble on every page")})]}),i(se,{checked:f.enabled,onChange:te=>l({enabled:te}),ariaLabel:p("Show the chat bubble on the whole site")})]}):void 0}}let q=null,A=new WeakMap;function Rt(e){const t=ft();if(!e||!t)return e;q!==t&&(q=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:p(r.label)})):null,spec:e.spec?{...e.spec,addLabel:p(e.spec.addLabel)}:null},A.set(e,o)),o}const Lt={isLockedBlock:(e,t)=>rt(e)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:st,nestDepth:(e,t,o)=>t===Fe?Ge(e,o):0,newSectionNode:bt,canAddTo:(e,t)=>Rt(Ue(e,t)),blockIsOffered:Ze},Ot=new Proxy(ut,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?p(o):o}}),At={labelAtLevel:(e,t,o)=>p(mt(e,t,o)),descriptions:Ot,categoryLabel:e=>{const t=Ke(e);return t===void 0?void 0:p(t)},firstSection:je,blockRowName:Je,plainText:ze,Icon:R,Thumbnail:Le,useProducts:gt},Bt={desktop:2e3,tablet:800,mobile:390},X="desktop",yt={options:Se,initial:X,fluid:X,widths:Bt},Ht={read:et,write:e=>ot(e),forSelection:(e,t)=>$e(e,t)},Nt={first:Y,last:Qe,firstGroup:wt,lastGroup:K,isSectionGroup:ht,sectionGroupZone:Et,panelOf:e=>e===Y?V:null,get sharedReach(){return v()?Wt:void 0},get shared(){return O()?ct:void 0},get groupTab(){return v()?it:void 0},get groupBadge(){return v()?F({type:K})??void 0:void 0},get changeNotice(){return v()?nt():void 0},get band(){return v()?Dt:void 0},get groupAccepts(){return v()?St:void 0}},Dt={foldable:!0},Wt=e=>F(e)??at(e);function Vt(e){return{...Z(j(e),U(e)),openSettings:()=>e.show(M)}}const jo={useOwnerName:Ve,useDocumentLabel:Ye,useBridges:Ct,useStandaloneBridges:Vt,useDocumentPass:ye,blockRules:Lt,blockLook:At,devices:yt,leftView:Ht,pinned:Nt,Canvas:pt,Inspector:_e};export{jo as WEBSITE_SCREEN};
|
|
1
|
+
"use client";import{jsx as i,Fragment as B,jsxs as _}from"react/jsx-runtime";import{useCallback as C,useEffect as P,useRef as oe,useState as re}from"react";import{Button as ne,Tooltip as ie}from"efficient-shell/ui";import{SettingsSwitch as se}from"efficient-easel/panel";import{PagesIcon as ae,StylesIcon as ce}from"efficient-easel/rail";import{PaletteIcon as de}from"efficient-shell/icons/efficient";import{TemplateIcon as le}from"efficient-easel/icons";import{Subtree as pe,TreeRow as y}from"efficient-easel/tree";import{useEasel as H}from"efficient-easel/easel";import{useEaselStrings as N}from"efficient-easel/strings";import{LocationsTreeContext as me}from"./LocationsTreeContext.js";import fe from"./PagesPanel.js";import{usePreviewChat as ue}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as Se}from"./preview-devices.js";import{PreviewDeviceContext as he}from"efficient-easel/draw/client";import{usePreviewHeader as Ee}from"../../render/components/PreviewHeaderContext.js";import{usePreviewSocial as we}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as Te}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as Pe,usePreviewTicker as be}from"../../render/components/PreviewTickerContext.js";import{usePreviewHeroPart as ge}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Ie,HERO_PART_MODE as D,heroMediaRows as ve,heroPartId as W,readHeroPartId as ke}from"../../render/lib/puck/hero-media-parts.js";import _e,{CHAT_MODE as Ce,HEADER_MODE as V,SOCIAL_MODE as Re,WEBSITE_MODE as M}from"./SectionEditor.js";import R from"./SectionIcon.js";import Le from"./SectionThumbnail.js";import{useScreenDocument as L}from"efficient-easel/screen/components/ScreenDocumentContext";import Oe from"./StylesPanel.js";import{LOCATIONS_TYPE as Ae,useLocationsTree as Be}from"./useLocationsTree.js";import{usePinnedChromeSeed as ye}from"./usePinnedChromeSeed.js";import{usePreviewHref as He}from"./usePreviewHref.js";import{WebsitePreviewButton as Ne}from"./WebsitePreviewButton.js";import{SITE_STYLES_TABS as De,SITE_STYLES_TEXT_TAB as We,useWebsiteName as Ve}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Me}from"./useWebsiteMainAction.js";import{VersionHistory as xe}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Ye}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Fe,heroGroupNestDepth as Ge}from"../../format/lib/hero-group-placement.js";import{stripMarkup as ze}from"../../format/lib/markup.js";import{categoryShortLabel as Ke,PINNED_SECTION_TYPE as je}from"../lib/puck/add-palette.js";import{canAddTo as Ue}from"../lib/puck/add-target.js";import{blockIsOffered as Ze}from"../lib/puck/block-offer.js";import{sectionIdOfBoxZone as qe,setBookingPreview as Xe}from"../../render/lib/puck/booking-preview.js";import{footerBlockRowName as Je}from"../../format/lib/puck/footer-block-row-name.js";import{FOOTER_TYPE as Qe,HEADER_TYPE as Y}from"../lib/puck/footer-blocks.js";import{leftViewForSelection as $e,readLeftView as et,resolveLeftView as tt,writeLeftView as ot}from"../../format/lib/puck/left-view.js";import{websiteIsLockedBlock as rt}from"../lib/puck/locked-blocks.js";import{everyPageNotice as nt,noOwnTab as it,pinnedReach as F,websiteDuplicateBlocked as st}from"../lib/puck/every-page.js";import{sharedSectionReach as at,WEBSITE_SHARED_SECTIONS as ct}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as G}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as dt}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as v}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as lt,scrollPreviewToTop as z}from"efficient-easel/screen/lib/puck/preview-dom";import{SiteCanvas as pt}from"../lib/puck/overrides.js";import{labelAtLevel as mt}from"../../format/lib/puck/section-catalog.js";import{editorWords as ft,say as p}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as ut}from"../../format/lib/puck/section-descriptions.js";import{groupAccepts as St,isSectionGroupType as ht,sectionGroupZone as Et,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as wt}from"../../format/lib/puck/section-groups.js";import{resolveSaveAsTemplateAction as Tt,SAVE_AS_TEMPLATE_EVENT as Pt}from"../../format/lib/save-as-template-action.js";import{newSectionNode as bt}from"../lib/sections/new-section-node.js";import{useHostProducts as gt}from"../lib/use-host-products.js";import{backendOf as It}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=be(),c=N().tree,d=e,n=d.kind==="ticker"?d.heroId:null,a=C(s=>{if(!s)return;t({kind:"ticker",heroId:s}),lt(s)},[t]);return P(()=>{o(n)},[n,o]),P(()=>{r(a)},[r,a]),{partRows:(s,{rowClick:u})=>{const m=String(s.props.id);return s.type==="Hero"&&i(y,{icon:i(R,{type:"ticker",size:13}),name:p(Pe),onSelect:()=>a(m),selected:n===m,rowProps:{onClick:u(()=>a(m))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=ge(),c=N().tree,{appState:d}=H(f=>f),n=d.data.content??[],a=oe(n);a.current=n;const s=e,u=Ie.find(f=>D[f]===s.kind),m=u&&"nodeId"in s?W(String(s.nodeId),u):null,E=C(f=>{const l=ke(f);if(!l)return;const w=a.current.findIndex(S=>String(S.props.id)===l.nodeId);if(w<0)return;const b={kind:D[l.part],nodeId:l.nodeId};t({index:w},b)},[t]);return P(()=>{o(m)},[m,o]),P(()=>{r(E)},[r,E]),{partRows:(f,{rowClick:l})=>{const w=String(f.props.id),b=ve(f);if(b.length===0)return null;const S=I=>{const g=W(w,I.part);return i(y,{icon:i(R,{type:I.part==="media"?"heroMedia":"heroImage",size:13}),name:p(I.label),onSelect:()=>E(g),selected:m===g,rowProps:{onClick:l(()=>E(g))},words:c},g)},[h,...T]=b;return _(B,{children:[S(h),T.length>0&&i(pe,{children:T.map(S)})]})}}}function Z(e,t){return{partRows:(o,r)=>_(B,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function vt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:d,hasUnsavedEdits:n,bridgeCapabilities:a,notifyParent:s,token:u}=L(),{hasPreviewLink:m}=o,E=It(x()).preview?.draftLink,f=Me(e.data),l=Tt({hasTrustedConsole:!!u,canCreatePlatformTemplate:a.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),w=C(()=>{!c||!r||s(Pt,{siteId:c,slug:r})},[s,c,r]),b=He({pageSlug:r,siteId:c,token:u}),S=t.previewHref?.(r)??b;return{barLead:()=>l.visible&&i(ie,{side:"bottom",content:l.enabled?p("Save this website as a platform template"):p(l.disabledReason),children:i("span",{className:"sf-tip-disabled",tabIndex:l.enabled?void 0:0,children:i(ne,{variant:"secondary",disabled:!l.enabled,onClick:w,rightIcon:i(le,{size:15}),children:p("Save as Template")})})}),barTrail:()=>m&&r&&i(Ne,{liveHref:S,pageId:d??null,draftLink:E}),mainAction:f}}function kt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:d,navigate:n}=L(),{hasSiteTheme:a,explainsSiteSettings:s}=o,u=h=>t.setView(h),[m,E]=re(De[0].id),{surface:f,setSurface:l}=Te(),w=()=>{if(a){u("styles"),t.reveal(),z();return}e.show(M),e.reveal(),z()},b={id:"pages",label:p("Pages"),icon:i(ae,{}),panel:({onHide:h})=>i(fe,{activeSurface:f,onPreviewSurface:l,onNavigate:T=>{l(null),n(r?{kind:"template",id:r,pageSlug:T}:{kind:"page",slug:T,siteId:c??void 0})},onClose:h})},S=[];return!a&&s&&S.push({id:"appearance",label:p("Appearance"),icon:i(de,{}),active:e.kind==="website",onSelect:w}),a&&S.push({id:"styles",label:p("Styles"),icon:i(ce,{}),panel:({onHide:h,notify:T})=>i(Oe,{tokenRef:d,siteId:c??void 0,onClose:h,onNotify:T,tab:m,onTabChange:E})}),{railLead:[b],railTrail:S,resolveLeftView:(h,T)=>tt(h,a,T),openSettings:w,openStyles:()=>{E(We),u("styles")}}}function _t(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=L(),c=H(n=>n.config),d=x();P(()=>(G({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>G(null)),[e,t,o,c]),P(()=>{const n=O();if(!n||!r)return;let a=!1;return dt(d).list().then(s=>{a||n.learn(s)}).catch(()=>{}),()=>{a=!0}},[r,d])}function Ct(e,t,o,r){const{kind:c,open:d}=e,{selected:n,zoneOf:a}=t;P(()=>{Xe(n?.type==="BookingBox"&&n.props.region==="confirm"?qe(a(String(n.props.id))):null)},[n?.props.id]);const s=Be(e,t),{capabilities:{hasSiteSettings:u}}=L();_t();const{setSelected:m,setSelectHandler:E}=Ee(),{chat:f,setChat:l,setSelected:w,setSelectHandler:b}=ue(),S=c==="header";P(()=>{m(S)},[S,m]),P(()=>{E(()=>d(V))},[E,d]);const h=C(()=>d(Ce),[d]),T=c==="chat";P(()=>{w(T)},[T,w]),P(()=>{b(h)},[b,h]);const{setOpenHandler:I}=we(),g=C(()=>d(Re),[d]);P(()=>{I(g)},[I,g]);const J=Z(j(e),U(e)),Q=vt(t),$=kt(e,r),ee=o.device;return{...J,...Q,...$,hasOwnRows:k=>k.type===Ae,ownRows:s.renderLocationTree,sectionPressed:s.sectionPressed,wrap:k=>i(me.Provider,{value:!0,children:_(he.Provider,{value:ee,children:[k,i(xe,{})]})}),addPanelRow:k=>u?_("div",{className:"sf-addside-sitewide",children:[i("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:i(R,{type:"chat",size:16})}),_("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),h()},children:[p("Live chat"),i("span",{className:"sf-addside-sitewide-desc",children:p("A chat bubble on every page")})]}),i(se,{checked:f.enabled,onChange:te=>l({enabled:te}),ariaLabel:p("Show the chat bubble on the whole site")})]}):void 0}}let q=null,A=new WeakMap;function Rt(e){const t=ft();if(!e||!t)return e;q!==t&&(q=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:p(r.label)})):null,spec:e.spec?{...e.spec,addLabel:p(e.spec.addLabel)}:null},A.set(e,o)),o}const Lt={isLockedBlock:(e,t)=>rt(e)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:st,nestDepth:(e,t,o)=>t===Fe?Ge(e,o):0,newSectionNode:bt,canAddTo:(e,t)=>Rt(Ue(e,t)),blockIsOffered:Ze},Ot=new Proxy(ut,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?p(o):o}}),At={labelAtLevel:(e,t,o)=>p(mt(e,t,o)),descriptions:Ot,categoryLabel:e=>{const t=Ke(e);return t===void 0?void 0:p(t)},firstSection:je,blockRowName:Je,plainText:ze,Icon:R,Thumbnail:Le,useProducts:gt},Bt={desktop:2e3,tablet:800,mobile:390},X="desktop",yt={options:Se,initial:X,fluid:X,widths:Bt},Ht={read:et,write:e=>ot(e),forSelection:(e,t)=>$e(e,t)},Nt={first:Y,last:Qe,firstGroup:wt,lastGroup:K,isSectionGroup:ht,sectionGroupZone:Et,panelOf:e=>e===Y?V:null,get sharedReach(){return v()?Wt:void 0},get shared(){return O()?ct:void 0},get groupTab(){return v()?it:void 0},get groupBadge(){return v()?F({type:K})??void 0:void 0},get changeNotice(){return v()?nt():void 0},get band(){return v()?Dt:void 0},get groupAccepts(){return v()?St:void 0}},Dt={foldable:!0},Wt=e=>F(e)??at(e);function Vt(e){return{...Z(j(e),U(e)),openSettings:()=>e.show(M)}}const jo={useOwnerName:Ve,useDocumentLabel:Ye,useBridges:Ct,useStandaloneBridges:Vt,useDocumentPass:ye,blockRules:Lt,blockLook:At,devices:yt,leftView:Ht,pinned:Nt,Canvas:pt,Inspector:_e};export{jo as WEBSITE_SCREEN};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as _,Fragment as w}from"react/jsx-runtime";import{useEasel as N}from"efficient-easel/easel";import{useState as R}from"react";import k from"./ThemeField.js";import L from"./CornersField.js";import O from"./CardShadowField.js";import G from"./ShadowColourField.js";import v from"./BlockGapField.js";import z from"./HoverEffectField.js";import Y from"./PhotographyField.js";import j from"./ShareButtonField.js";import U from"./SideSpaceField.js";import{BackgroundWidthRow as X,ContentWidthRow as $,SITE_BACKGROUND_HINT as K,SITE_CONTENT_HINT as M,WIDTH_GROUP_LABEL as q}from"./SectionWidthRows.js";import J from"./SiteAccentField.js";import Q from"./SiteTextStylesField.js";import{usePreviewHeader as S}from"../../render/components/PreviewHeaderContext.js";import{Tabs as V,Tooltip as Z,tabButtonId as D,tabPanelId as ee}from"efficient-shell/ui";import{ContrastIcon as te,NoteIcon as ne,SettingsIcon as oe,TypeIcon as ie}from"efficient-easel/icons";import{useThemeRowPersist as re}from"../lib/theme-row-persist.js";import{themeSaveNotice as se}from"../../format/lib/theme-save-message.js";import{say as g}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as ae}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as b}from"../../format/lib/content/page-width.js";import{SettingsGroupSub as ce}from"efficient-easel/panel";import{previewFrame as le}from"efficient-easel/screen/lib/puck/preview-dom";import{useSiteTextStylesWriter as de}from"../lib/site-text-styles-writer.js";import{CORNER_STYLE_TO_PX as ue,normalizeCornerRadius as he,normalizeCornerStyle as pe,normalizeShadowColor as fe,selectedThemeColors as ge}from"../../format/lib/theme.js";const E="sf-site-styles",me="sf-site-styles-tabpanel",Se=!1,Ce="Show hints";function _e({shown:e,onChange:t}){return n("div",{className:"sf-hints",children:_("button",{type:"button","aria-pressed":e,onClick:()=>t(!e),className:`sf-rung sf-hints-toggle${e?" is-active":""}`,children:[n(ne,{size:13}),g(Ce)]})})}const xt="text",P=[{id:"basics",label:"Basics",icon:n(oe,{})},{id:"theme",label:"Theme",icon:n(te,{})},{id:"text",label:"Text",icon:n(ie,{})}];function xe({themeFromDocument:e,persist:t}){const{appState:o,dispatch:s}=N(h=>h),{theme:d,setTheme:a}=S(),c=o.data,p=c.root?.props??{},r=h=>{if(e){const f={...p,theme:h};s({type:"replaceRoot",root:{...c.root,props:f},recordHistory:!0})}else a(h);t({selected_preset:h.selected,theme_presets:h.themes})};return n(k,{value:e?p.theme:d,onChange:r})}function we({themeFromDocument:e,persist:t}){const[o,s]=R(null),{theme:d,setFonts:a,setSizes:c,setHeadingTypography:p}=S(),r=de({themeFromDocument:e,persist:t}),{old:h,saved:f,writeRoot:m}=r,l=r.fonts,u=r.sizes,x=r.typography,y=i=>i.values.size??Re(Te[i.id]??"body")??be[i.kind],T=i=>r.write(i),F=ye(d),I=i=>{const C={...l,accent:i};e?m({fonts:C}):a(C),t({accent_font:i})},B=i=>{c({...u,accent:i}),t({accent_size_px:i})},A=i=>{const C={...x,weightStrong:i};e?m({headingTypography:C}):p(C),t({heading_weight_strong:i})},W=i=>{const C={...x,italicStrong:i};e?m({headingTypography:C}):p(C),t({accent_italic:i})};return _(w,{children:[n(Q,{saved:f,old:h,colours:F,sizeOf:y,onChange:T,openId:o===H?null:o,onOpenChange:s,withoutSize:e}),n(J,{font:l.accent,size:u.accent,weight:x.weightStrong,italic:x.italicStrong,headingWeight:x.weight,open:o===H,onOpenChange:i=>s(i?H:null),onChange:i=>{i.key==="font"?I(i.value):i.key==="size"?B(i.value):i.key==="weight"?A(i.value):W(i.value)},withoutSize:e})]})}const H="accent";function ye(e){const t=ge(e);return[{key:"accent",name:g("Accent"),value:t.accent},{key:"text",name:g("Text"),value:t.text},{key:"labels",name:g("Labels"),value:t.muted??t.text}]}const Te={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},be={heading:32,body:14},Pe={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 Re(e){if(typeof document>"u")return null;const o=(le()?.contentDocument??document).querySelector(Pe[e]);if(!o)return null;const s=parseFloat(getComputedStyle(o).fontSize);return Number.isFinite(s)?s:null}function Ee({themeFromDocument:e,persist:t,showHint:o}){const{appState:s,dispatch:d}=N(u=>u),{cornerRadiusPx:a,setCornerRadiusPx:c}=S(),p=s.data,r=p.root?.props??{},h=r.cornerRadiusPx===void 0?ue[pe(r.cornerStyle)]:he(r.cornerRadiusPx),f=e?h:a,m=u=>d({type:"replaceRoot",root:{...p.root,props:{...r,...u}},recordHistory:!0});return n(L,{value:f,onChange:u=>{e?m({cornerRadiusPx:u}):c(u),t({corner_radius_px:u})},showHint:o})}function He(e){return{site_width:e}}function Ne({persist:e,showHint:t}){const{siteWidth:o,setSiteWidth:s,sectionBackgroundWidth:d,setSectionBackgroundWidth:a,sectionContentWidth:c,setSectionContentWidth:p}=S(),r=typeof o=="number"?o:b.default,h=l=>{s(l),e(He(l),l===null)},f=l=>{a(l),e({section_background_width:l},!0)},m=l=>{p(l),e({section_content_width:l},!0)};return _(w,{children:[n(ce,{title:g(q),level:4}),n(X,{value:d??"full",changed:d!==null,detail:g("Full width"),onChange:f,onReset:()=>f(null),hint:t?K:void 0}),n($,{mode:c??"content",px:r,min:b.min,max:b.max,changed:typeof o=="number"||c!==null,detail:`${g("Content width")} ${b.default}px`,onMode:m,onPx:l=>h(l),onReset:()=>{m(null),h(null)},hint:t?M:void 0})]})}function Fe(e){return{block_gap:e}}function Ie(e){return{site_gutter:e}}function Be({persist:e,showHint:t}){const{siteGutter:o,setSiteGutter:s}=S();return n(U,{value:o,onChange:a=>{s(a),e(Ie(a),a===null)},showHint:t})}function Ae({persist:e,showHint:t}){const{blockGap:o,setBlockGap:s}=S();return n(v,{value:o,onChange:a=>{s(a),e(Fe(a),a===null)},showHint:t})}function We({persist:e,showHint:t=!0}){return _(w,{children:[n(Ne,{persist:e,showHint:t}),n(Be,{persist:e,showHint:t}),n(Ae,{persist:e,showHint:t})]})}function ke(e){return{card_shadow:e}}function Le(e){return e===null?{shadow_color:null}:{shadow_color:fe(e)}}function Oe(e){return{hover_effect:e}}function Ge({persist:e,showHint:t=!0}){const{cardShadow:o,setCardShadow:s,shadowColor:d,setShadowColor:a,hoverEffect:c,setHoverEffect:p}=S();return _(w,{children:[n(O,{value:o,onChange:r=>{s(r),e(ke(r),!0)},showHint:t}),n(G,{value:d,onChange:r=>{a(r),e(Le(r),r===null)},showHint:t}),n(z,{value:c,onChange:r=>{p(r),e(Oe(r),!0)},showHint:t})]})}function ve(e){return{photography_grayscale:e}}function ze({persist:e,showHint:t}){const{photographyGrayscale:o,setPhotographyGrayscale:s}=S();return n(Y,{value:o,onChange:a=>{s(a),e(ve(a),!0)},showHint:t})}function Ye({persist:e,showHint:t=!0}){return n(w,{children:n(ze,{persist:e,showHint:t})})}function je(e){return{share_button_on_posts:e}}function Ue({persist:e,showHint:t=!0}){const{shareButtonOnPosts:o,setShareButtonOnPosts:s}=S();return n(j,{value:o,onChange:a=>{s(a),e(je(a),!0)},showHint:t})}function Xe(){const{websiteName:e}=S();return e?.trim()||ae}function wt(){const e=Xe();return n(Z,{content:g("{name} — renamed in the Console: {place}.",{name:e,place:g("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:n("span",{className:"sf-panel-site",children:e})})}function $e({themeFromDocument:e=!1,tokenRef:t,siteId:o,onNotify:s,tab:d,onTabChange:a}){const{persist:c}=re({themeFromDocument:e,tokenRef:t,siteId:o,onResult:y=>{const T=se(y);T&&s?.(T.msg,T.tone)}}),[p,r]=R(P[0].id),h=d!==void 0,f=h?d:p,m=h?a??(()=>{}):r,l=P.find(y=>y.id===f)??P[0],[u,x]=R(Se);return _(w,{children:[n(Ke,{activeId:l.id,onSelect:m}),_("div",{id:ee(E,l.id),className:me,role:"tabpanel","aria-labelledby":D(E,l.id),children:[f==="basics"&&_(w,{children:[n(Ee,{themeFromDocument:e,persist:c,showHint:u}),!e&&n(Ge,{persist:c,showHint:u}),!e&&n(We,{persist:c,showHint:u}),!e&&n(Ye,{persist:c,showHint:u}),!e&&n(Ue,{persist:c,showHint:u}),n(_e,{shown:u,onChange:x})]}),f==="theme"&&n(xe,{themeFromDocument:e,persist:c}),f==="text"&&n(we,{themeFromDocument:e,persist:c})]})]})}function Ke({activeId:e,onSelect:t}){return n("div",{className:"es-insp-tabs",children:n(V,{variant:"underline",block:!0,labelsFit:!0,"aria-label":g("
|
|
1
|
+
"use client";import{jsx as n,jsxs as _,Fragment as w}from"react/jsx-runtime";import{useEasel as N}from"efficient-easel/easel";import{useState as R}from"react";import k from"./ThemeField.js";import L from"./CornersField.js";import O from"./CardShadowField.js";import G from"./ShadowColourField.js";import v from"./BlockGapField.js";import z from"./HoverEffectField.js";import Y from"./PhotographyField.js";import j from"./ShareButtonField.js";import U from"./SideSpaceField.js";import{BackgroundWidthRow as X,ContentWidthRow as $,SITE_BACKGROUND_HINT as K,SITE_CONTENT_HINT as M,WIDTH_GROUP_LABEL as q}from"./SectionWidthRows.js";import J from"./SiteAccentField.js";import Q from"./SiteTextStylesField.js";import{usePreviewHeader as S}from"../../render/components/PreviewHeaderContext.js";import{Tabs as V,Tooltip as Z,tabButtonId as D,tabPanelId as ee}from"efficient-shell/ui";import{ContrastIcon as te,NoteIcon as ne,SettingsIcon as oe,TypeIcon as ie}from"efficient-easel/icons";import{useThemeRowPersist as re}from"../lib/theme-row-persist.js";import{themeSaveNotice as se}from"../../format/lib/theme-save-message.js";import{say as g}from"../../format/lib/editor-words.js";import{NEUTRAL_SITE_NAME as ae}from"../../format/lib/content/site-name.js";import{PAGE_WIDTH as b}from"../../format/lib/content/page-width.js";import{SettingsGroupSub as ce}from"efficient-easel/panel";import{previewFrame as le}from"efficient-easel/screen/lib/puck/preview-dom";import{useSiteTextStylesWriter as de}from"../lib/site-text-styles-writer.js";import{CORNER_STYLE_TO_PX as ue,normalizeCornerRadius as he,normalizeCornerStyle as pe,normalizeShadowColor as fe,selectedThemeColors as ge}from"../../format/lib/theme.js";const E="sf-site-styles",me="sf-site-styles-tabpanel",Se=!1,Ce="Show hints";function _e({shown:e,onChange:t}){return n("div",{className:"sf-hints",children:_("button",{type:"button","aria-pressed":e,onClick:()=>t(!e),className:`sf-rung sf-hints-toggle${e?" is-active":""}`,children:[n(ne,{size:13}),g(Ce)]})})}const xt="text",P=[{id:"basics",label:"Basics",icon:n(oe,{})},{id:"theme",label:"Theme",icon:n(te,{})},{id:"text",label:"Text",icon:n(ie,{})}];function xe({themeFromDocument:e,persist:t}){const{appState:o,dispatch:s}=N(h=>h),{theme:d,setTheme:a}=S(),c=o.data,p=c.root?.props??{},r=h=>{if(e){const f={...p,theme:h};s({type:"replaceRoot",root:{...c.root,props:f},recordHistory:!0})}else a(h);t({selected_preset:h.selected,theme_presets:h.themes})};return n(k,{value:e?p.theme:d,onChange:r})}function we({themeFromDocument:e,persist:t}){const[o,s]=R(null),{theme:d,setFonts:a,setSizes:c,setHeadingTypography:p}=S(),r=de({themeFromDocument:e,persist:t}),{old:h,saved:f,writeRoot:m}=r,l=r.fonts,u=r.sizes,x=r.typography,y=i=>i.values.size??Re(Te[i.id]??"body")??be[i.kind],T=i=>r.write(i),F=ye(d),I=i=>{const C={...l,accent:i};e?m({fonts:C}):a(C),t({accent_font:i})},B=i=>{c({...u,accent:i}),t({accent_size_px:i})},A=i=>{const C={...x,weightStrong:i};e?m({headingTypography:C}):p(C),t({heading_weight_strong:i})},W=i=>{const C={...x,italicStrong:i};e?m({headingTypography:C}):p(C),t({accent_italic:i})};return _(w,{children:[n(Q,{saved:f,old:h,colours:F,sizeOf:y,onChange:T,openId:o===H?null:o,onOpenChange:s,withoutSize:e}),n(J,{font:l.accent,size:u.accent,weight:x.weightStrong,italic:x.italicStrong,headingWeight:x.weight,open:o===H,onOpenChange:i=>s(i?H:null),onChange:i=>{i.key==="font"?I(i.value):i.key==="size"?B(i.value):i.key==="weight"?A(i.value):W(i.value)},withoutSize:e})]})}const H="accent";function ye(e){const t=ge(e);return[{key:"accent",name:g("Accent"),value:t.accent},{key:"text",name:g("Text"),value:t.text},{key:"labels",name:g("Labels"),value:t.muted??t.text}]}const Te={"heading-1":"heading","heading-2":"heading2","heading-3":"heading3","body-1":"body","body-5":"label"},be={heading:32,body:14},Pe={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 Re(e){if(typeof document>"u")return null;const o=(le()?.contentDocument??document).querySelector(Pe[e]);if(!o)return null;const s=parseFloat(getComputedStyle(o).fontSize);return Number.isFinite(s)?s:null}function Ee({themeFromDocument:e,persist:t,showHint:o}){const{appState:s,dispatch:d}=N(u=>u),{cornerRadiusPx:a,setCornerRadiusPx:c}=S(),p=s.data,r=p.root?.props??{},h=r.cornerRadiusPx===void 0?ue[pe(r.cornerStyle)]:he(r.cornerRadiusPx),f=e?h:a,m=u=>d({type:"replaceRoot",root:{...p.root,props:{...r,...u}},recordHistory:!0});return n(L,{value:f,onChange:u=>{e?m({cornerRadiusPx:u}):c(u),t({corner_radius_px:u})},showHint:o})}function He(e){return{site_width:e}}function Ne({persist:e,showHint:t}){const{siteWidth:o,setSiteWidth:s,sectionBackgroundWidth:d,setSectionBackgroundWidth:a,sectionContentWidth:c,setSectionContentWidth:p}=S(),r=typeof o=="number"?o:b.default,h=l=>{s(l),e(He(l),l===null)},f=l=>{a(l),e({section_background_width:l},!0)},m=l=>{p(l),e({section_content_width:l},!0)};return _(w,{children:[n(ce,{title:g(q),level:4}),n(X,{value:d??"full",changed:d!==null,detail:g("Full width"),onChange:f,onReset:()=>f(null),hint:t?K:void 0}),n($,{mode:c??"content",px:r,min:b.min,max:b.max,changed:typeof o=="number"||c!==null,detail:`${g("Content width")} ${b.default}px`,onMode:m,onPx:l=>h(l),onReset:()=>{m(null),h(null)},hint:t?M:void 0})]})}function Fe(e){return{block_gap:e}}function Ie(e){return{site_gutter:e}}function Be({persist:e,showHint:t}){const{siteGutter:o,setSiteGutter:s}=S();return n(U,{value:o,onChange:a=>{s(a),e(Ie(a),a===null)},showHint:t})}function Ae({persist:e,showHint:t}){const{blockGap:o,setBlockGap:s}=S();return n(v,{value:o,onChange:a=>{s(a),e(Fe(a),a===null)},showHint:t})}function We({persist:e,showHint:t=!0}){return _(w,{children:[n(Ne,{persist:e,showHint:t}),n(Be,{persist:e,showHint:t}),n(Ae,{persist:e,showHint:t})]})}function ke(e){return{card_shadow:e}}function Le(e){return e===null?{shadow_color:null}:{shadow_color:fe(e)}}function Oe(e){return{hover_effect:e}}function Ge({persist:e,showHint:t=!0}){const{cardShadow:o,setCardShadow:s,shadowColor:d,setShadowColor:a,hoverEffect:c,setHoverEffect:p}=S();return _(w,{children:[n(O,{value:o,onChange:r=>{s(r),e(ke(r),!0)},showHint:t}),n(G,{value:d,onChange:r=>{a(r),e(Le(r),r===null)},showHint:t}),n(z,{value:c,onChange:r=>{p(r),e(Oe(r),!0)},showHint:t})]})}function ve(e){return{photography_grayscale:e}}function ze({persist:e,showHint:t}){const{photographyGrayscale:o,setPhotographyGrayscale:s}=S();return n(Y,{value:o,onChange:a=>{s(a),e(ve(a),!0)},showHint:t})}function Ye({persist:e,showHint:t=!0}){return n(w,{children:n(ze,{persist:e,showHint:t})})}function je(e){return{share_button_on_posts:e}}function Ue({persist:e,showHint:t=!0}){const{shareButtonOnPosts:o,setShareButtonOnPosts:s}=S();return n(j,{value:o,onChange:a=>{s(a),e(je(a),!0)},showHint:t})}function Xe(){const{websiteName:e}=S();return e?.trim()||ae}function wt(){const e=Xe();return n(Z,{content:g("{name} — renamed in the Console: {place}.",{name:e,place:g("Storefront ▸ Sites ▸ Settings")}),className:"sf-name-tip",children:n("span",{className:"sf-panel-site",children:e})})}function $e({themeFromDocument:e=!1,tokenRef:t,siteId:o,onNotify:s,tab:d,onTabChange:a}){const{persist:c}=re({themeFromDocument:e,tokenRef:t,siteId:o,onResult:y=>{const T=se(y);T&&s?.(T.msg,T.tone)}}),[p,r]=R(P[0].id),h=d!==void 0,f=h?d:p,m=h?a??(()=>{}):r,l=P.find(y=>y.id===f)??P[0],[u,x]=R(Se);return _(w,{children:[n(Ke,{activeId:l.id,onSelect:m}),_("div",{id:ee(E,l.id),className:me,role:"tabpanel","aria-labelledby":D(E,l.id),children:[f==="basics"&&_(w,{children:[n(Ee,{themeFromDocument:e,persist:c,showHint:u}),!e&&n(Ge,{persist:c,showHint:u}),!e&&n(We,{persist:c,showHint:u}),!e&&n(Ye,{persist:c,showHint:u}),!e&&n(Ue,{persist:c,showHint:u}),n(_e,{shown:u,onChange:x})]}),f==="theme"&&n(xe,{themeFromDocument:e,persist:c}),f==="text"&&n(we,{themeFromDocument:e,persist:c})]})]})}function Ke({activeId:e,onSelect:t}){return n("div",{className:"es-insp-tabs",children:n(V,{variant:"underline",block:!0,labelsFit:!0,"aria-label":g("Styles"),idPrefix:E,value:e,onChange:t,items:P.map(o=>{const s=g(o.label);return{id:o.id,icon:o.icon,label:s}})})})}export{Ge as CardLookFields,_e as HintsToggle,We as PageGroupFields,Ye as PhotographyGroupFields,Se as SHOW_HINTS_DEFAULT,E as SITE_STYLES_ID_PREFIX,P as SITE_STYLES_TABS,xt as SITE_STYLES_TEXT_TAB,Ue as ShareButtonRootField,Ke as SiteStylesTabStrip,me as TABPANEL_CLASS,wt as WebsiteNameReadonly,Fe as blockGapPatch,ke as cardShadowPatch,$e as default,Oe as hoverEffectPatch,ve as photographyPatch,Le as shadowColourPatch,je as shareButtonPatch,Ie as siteGutterPatch,He as siteWidthPatch,Xe as useWebsiteName};
|
|
@@ -904,8 +904,8 @@
|
|
|
904
904
|
inset must hold all of it (`@supports` below). A browser that draws its
|
|
905
905
|
own scrollbar (Firefox) keeps a 0px lane here and the full inset. */
|
|
906
906
|
--sf-insp-bar-w: 0px;
|
|
907
|
-
--
|
|
908
|
-
padding-inline-end: var(--
|
|
907
|
+
--es-insp-pad-end: calc(var(--es-insp-pad-x) - var(--sf-insp-bar-w));
|
|
908
|
+
padding-inline-end: var(--es-insp-pad-end);
|
|
909
909
|
|
|
910
910
|
/* THE DROPDOWN ARROW, WRITTEN ONCE — card 66399.c.
|
|
911
911
|
Read by `.sf-insp-body select` at rest AND by the hover rule beside it. The
|
|
@@ -1801,9 +1801,9 @@
|
|
|
1801
1801
|
6px OUTSIDE the panel at every width under 280, where card 66212 narrows
|
|
1802
1802
|
the padding to 8 — measured at 260 and at 220 before this was a `var()`. */
|
|
1803
1803
|
margin-left: calc(var(--es-insp-pad-x) * -1);
|
|
1804
|
-
margin-right: calc(var(--
|
|
1804
|
+
margin-right: calc(var(--es-insp-pad-end) * -1);
|
|
1805
1805
|
padding-left: var(--es-insp-pad-x);
|
|
1806
|
-
padding-right: var(--
|
|
1806
|
+
padding-right: var(--es-insp-pad-end);
|
|
1807
1807
|
}
|
|
1808
1808
|
/* The heading's own top margin is the wrapper's job now. */
|
|
1809
1809
|
.sf-insp-body .es-insp-row:has(.es-group-sub) .es-group-sub {
|
|
@@ -2791,9 +2791,10 @@
|
|
|
2791
2791
|
/* With no warning beside it the Edit still sits hard right. */
|
|
2792
2792
|
.sf-theme-name { margin-right: auto; }
|
|
2793
2793
|
|
|
2794
|
-
/* The
|
|
2795
|
-
|
|
2796
|
-
|
|
2794
|
+
/* The open/close control is efficient-shell's ghost `IconButton` in its
|
|
2795
|
+
`Tooltip` (chevron-down folded, chevron-up open; ruling A4f); in the
|
|
2796
|
+
section's Theme menu it is the shell's `Button` "Edit". Either way the look
|
|
2797
|
+
is the shell's. This class only keeps it from shrinking in the foot. */
|
|
2797
2798
|
.sf-theme-edit {
|
|
2798
2799
|
flex: none;
|
|
2799
2800
|
}
|
|
@@ -4145,3 +4146,26 @@ input.sf-list-marking {
|
|
|
4145
4146
|
font-size: var(--text-xs);
|
|
4146
4147
|
color: var(--sf-muted);
|
|
4147
4148
|
}
|
|
4149
|
+
|
|
4150
|
+
/* The anchor's live link (components/AnchorField, the Wix anchor row): the
|
|
4151
|
+
shell's Snippet under the Name box, the label-to-box gap above it, the full
|
|
4152
|
+
row wide. The page path gives way to the ellipsis; the `#name` never does,
|
|
4153
|
+
because the hash is the part the merchant just typed. */
|
|
4154
|
+
.sf-anchor-link {
|
|
4155
|
+
margin-top: var(--space-4);
|
|
4156
|
+
}
|
|
4157
|
+
.sf-anchor-link > * {
|
|
4158
|
+
width: 100%;
|
|
4159
|
+
}
|
|
4160
|
+
.sf-anchor-link-text {
|
|
4161
|
+
display: flex;
|
|
4162
|
+
min-width: 0;
|
|
4163
|
+
}
|
|
4164
|
+
.sf-anchor-link-path {
|
|
4165
|
+
min-width: 0;
|
|
4166
|
+
overflow: hidden;
|
|
4167
|
+
text-overflow: ellipsis;
|
|
4168
|
+
}
|
|
4169
|
+
.sf-anchor-link-hash {
|
|
4170
|
+
flex: none;
|
|
4171
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{FOOTPRINT_DEFAULTS as _}from"../../../../../../format/lib/content/footprint.js";import{HeadquartersIcon as L,LayoutIcon as E,LocationIcon as I,SearchIcon as P,StoreIcon as k,ThemeIcon as C}from"efficient-easel/icons";import{CoordsField as D,copyText as x,group as l,plainText as a,section as N,segmented as u,sourceField as A,text as f,textarea as S,toggle as d}from"../../../controls.js";import{withShowWhen as n}from"../../../../../../render/lib/puck/show-when.js";import{needsGeocodeWork as H,resolveGeocodeRows as W}from"../../../geocode-resolve.js";import{SPLITTABLE_SECTIONS as B,headFieldsForPlacement as M,widthFieldsForParent as U}from"../../../../../../format/lib/sections/section-head-placement.js";import{innerSpacingFields as j,WIDTH_ROW_KEYS as q}from"../../shared-fields.js";import{BLOCK_SOURCE_PROP as g,blockSources as z,blockSourcesRevision as w}from"../../../../../../format/lib/content/block-sources.js";import{FOOTPRINT_PH as m}from"../../../../../../render/lib/puck/blocks/general/Footprint/render.js";const G={field:"source",is:"typed",default:"typed"},c={field:"source",is:"dealers",default:"typed"},b={all:[c,{field:"search",is:!0,default:!1}]},y=[{label:"Typed in",value:"typed"},{label:"Dealers",value:"dealers"}],K=new Set(y.map(e=>e.value)),R=e=>u("Source",i(k,{}),e,"typed");function v(e){const t=typeof e=="string"?e.trim():"";return t&&!K.has(t)&&/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(t)?t:""}const h=new Map;let F=-1;function Y(e){const t=z("Footprint"),o=e&&!t.some(s=>s.key===e)?e:"";if(!t.length&&!o)return null;F!==w()&&(F=w(),h.clear());let r=h.get(o);return r||(r=R([...y,...t.map(s=>({label:s.label,value:s.key})),...o?[{label:o,value:o}]:[]]),h.set(o,r)),r}const T=new WeakMap;function Q(e,t){const o=Y(t);if(!o)return e;let r=T.get(e);r||T.set(e,r=new Map);let s=r.get(o);return s||(s={...e,source:o},r.set(o,s)),s}const ie={fields:{_gContent:l("Section"),sectionNumber:f("Section number",m.sectionNumber),heading:S("Heading",m.heading),tagline:S("Body",m.tagline),_gOffices:l("Offices"),source:R(y),offices:n({type:"array",label:"Offices",arrayFields:{role:a("Role"),city:a("City"),country:a("Region · country"),address:x("Address"),group:a("Group"),hq:d("HQ",!1,i(L,{})),geocode:A(D,{label:"Coordinates"})},defaultItemProps:{role:"Sales & Distribution",city:"City",country:"Country",address:"",group:"",hq:!1,lat:0,lng:0},getItemSummary:e=>e?.city||"Office"},G),mapTheme:u("Map theme",i(C,{}),[{label:"Auto",value:"auto"},{label:"Dark",value:"dark"},{label:"Light",value:"light"}],_.mapTheme),_gSearch:l("Search"),search:n(d("Show",!1,i(P,{})),c),searchHint:n(f("Hint","Type a postcode or address"),b),noMatchText:n(f("No match","No place found. Try another postcode."),b),_gList:l("List"),listPosition:n(u("Position",i(E,{}),[{label:"Left",value:"left"},{label:"Right",value:"right"},{label:"Below",value:"below"}],"below"),c),showDistance:n(d("Distance",!0,i(I,{})),c),_dLayout:N("Layout"),...j("Footprint")},resolveData:async e=>{const t=v(e.props.source);(e.props[g]??"")!==t&&(e={...e,props:{...e.props,[g]:t}});const o=e.props,r=o.offices??[];if(!H(r))return e;const s=await W(r,p=>[p.address,p.city,p.country].map(O=>String(O??"").replace(/\*/g,"").trim()).filter(Boolean).join(", "));return{...e,props:{...o,offices:s}}},resolveFields:(e,{fields:t,parent:o})=>M(U(Q(t,v(e.props.source)),o,q),e.props.headPlacement,B.Footprint.headRows)};export{ie as FootprintFields,v as footprintBlockSource};
|
|
@@ -92,7 +92,6 @@ export declare const BOUND_TO_POST_NOTE = "Everything else on this block comes f
|
|
|
92
92
|
export declare const BOUND_TO_POST: ShowWhenRule;
|
|
93
93
|
export declare const NOT_BOUND_TO_POST: ShowWhenRule;
|
|
94
94
|
export declare const HIGHLIGHT_HINT = "Select a word, then press the highlighter.";
|
|
95
|
-
export declare const ANCHOR_HINT = "A short name so a link can jump straight to this section, like yoursite.com/page#about.";
|
|
96
95
|
export declare const hintIsWhileTyping: (hint: string) => boolean;
|
|
97
96
|
export declare function text(label: string, placeholder?: string, hint?: string): CustomField<HidableValue>;
|
|
98
97
|
export declare function textarea(label: string, placeholder?: string, hint?: string): CustomField<HidableValue>;
|