efficient-web-builder 22.0.0 → 22.1.1
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 +74 -0
- package/dist/components/PartSettingsPanel.d.ts +2 -1
- package/dist/components/PartSettingsPanel.js +1 -1
- package/dist/components/PinnedChromeLoadNotice.d.ts +12 -2
- package/dist/components/PinnedChromeLoadNotice.js +1 -1
- package/dist/components/PreviewHeaderContext.d.ts +4 -1
- package/dist/components/PreviewHeaderContext.js +1 -1
- package/dist/components/SectionEditor.js +1 -1
- package/dist/components/StorefrontEditor.js +1 -1
- package/dist/components/usePinnedChromeState.d.ts +3 -0
- package/dist/components/usePinnedChromeState.js +1 -0
- package/dist/components/useWebsiteMainAction.js +1 -1
- package/dist/lib/editor-words-catalogue.d.ts +5 -0
- package/dist/lib/editor-words-catalogue.js +3 -3
- package/dist/lib/page-live-state.d.ts +2 -1
- package/dist/lib/page-live-state.js +1 -1
- package/dist/lib/puck/blocks/general/text-part-shapes.json +2162 -0
- package/dist/lib/puck/header-clearance.d.ts +1 -1
- package/dist/lib/puck/header-clearance.js +1 -1
- package/dist/lib/puck/media-manifest.json +7 -2
- package/dist/lib/puck/page-root.js +2 -2
- package/dist/lib/puck/passes/clickable-parts.js +1 -1
- package/dist/lib/puck/passes/inspector.js +1 -1
- package/dist/lib/puck/passes/section-width.js +1 -1
- package/dist/lib/puck/passes/types.d.ts +3 -1
- package/dist/lib/puck/registry.d.ts +1 -1
- package/dist/lib/puck/registry.js +1 -1
- package/dist/lib/puck/render-registry.d.ts +3 -0
- package/dist/lib/puck/render-registry.js +1 -0
- package/dist/lib/puck/source-bound-parts.d.ts +2 -0
- package/dist/lib/puck/source-bound-parts.js +1 -1
- package/dist/lib/puck/text-part-shape.d.ts +18 -0
- package/dist/lib/puck/text-part-shape.js +2 -0
- package/dist/lib/source-rules/support/registry-source.d.ts +1 -1
- package/dist/lib/source-rules/support/registry-source.js +3 -3
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 22.1.1 - 2026-10-19
|
|
4
|
+
|
|
5
|
+
A patch of 22.1.0, from `release/22.1.x`: two fixes from main (#183 and #184), without the 23.0.0 major that main holds. No stored value moves.
|
|
6
|
+
|
|
7
|
+
**The editor draws a Highlight word in the site's Highlight style** (#183; inovit.com, 2026-10-19: a `@@` word on a Collection Card drew dark grey in the editor and light gold Fraunces italic on the live site).
|
|
8
|
+
|
|
9
|
+
### Fixed for merchants
|
|
10
|
+
|
|
11
|
+
- **The canvas publishes the site's word styles** (Highlight, Bold, Quiet), as the live page does. Before, the editor never read them. A `@@` word drew the built-in look in the editor only: the sentence's own face, no italic, and the accent of its section. In a section on a dark-accent preset that is dark grey. Every section had this fault in the editor, not only a photo card (Hero, Banner and the other on-photo copy too). The live site was correct.
|
|
12
|
+
- **The Header panel's logo-to-menu gap starts at the 32px the header draws** (#184; spacing scale, Lewis 2026-10-12). It showed **28** at rest, while the header draws **32** since efficient-storefront-blocks #89 put the header's gaps on the spacing scale (`gap-7` → `gap-8`). A header that never set the gap still writes no gap of its own; only the number the panel shows moves.
|
|
13
|
+
|
|
14
|
+
### Changed for hosts
|
|
15
|
+
|
|
16
|
+
- `PreviewHeaderProvider` takes `wordStyles` (read-only, from the theme row's `word_styles`). `StorefrontEditor` passes it. A host that mounts its own provider and passes nothing keeps today's canvas.
|
|
17
|
+
- `lib/puck/header-clearance`: `HEADER_MENU_GAP_PX.default` is 32 (was 28).
|
|
18
|
+
|
|
19
|
+
## 22.1.0 - 2026-10-19
|
|
20
|
+
|
|
21
|
+
**A template no longer carries a picture's focus point, on any picture or in either view** (phone focus plan, step 7; Lewis 2026-10-19: "one picture, one dot"). A patch: no stored value moves.
|
|
22
|
+
|
|
23
|
+
### Fixed for merchants
|
|
24
|
+
|
|
25
|
+
- Save as template cleared only the single Hero's first focus point (`imageFocal`). The second picture's (`imageFocal2`), the Image block's (`focal`) and the phone points 22.0.0 added (`imageFocalPhone`, `imageFocal2Phone`, `focalPhone`) went into the template, so a site made from it opened with another merchant's points on its own pictures.
|
|
26
|
+
|
|
27
|
+
### Changed for hosts
|
|
28
|
+
|
|
29
|
+
- `lib/puck/media-manifest.json`: `technicalStateKeys` lists all six, and `contentHash` moves (`d674ba52a1cf8456` → `bff238ceb7836a0a`). The backend sanitizer refuses a template write whose hash differs from its copy, so the backend's vendored manifest moves with this release. The storefront's `scripts/gen-media-manifest.ts` writes the list and checks each key against the config.
|
|
30
|
+
|
|
31
|
+
**Publish counts the header and footer, the canvas says when they are not saved, and the menu note says only what is synced** (hartesmetal.com.au, 2026-10-19: a footer edit stayed off the live site while the bar said "Published", and a footer column's typed heading was labelled "Synced from the site menu"). A patch: no stored value moves.
|
|
32
|
+
|
|
33
|
+
### Fixed for merchants
|
|
34
|
+
|
|
35
|
+
- **The bar's Publish reads the header and footer too.** They are edited in place on every page but stored in their own document (the site-footer page). A footer-only change used to leave the page live, and the bar said "Published · Everything is live" over a change that was not live. Now the bar shows **Publish** with **"Header and footer not live yet"** until that document is live. The press already published both.
|
|
36
|
+
- **The canvas says when the header and footer are not saved**, in the same notice place as "could not load", one sentence at a time:
|
|
37
|
+
- "{name} is editing the header and footer. Nothing you change in them here is saved." (somebody else holds them; "Somebody else" when the name is unknown)
|
|
38
|
+
- "The header and footer were changed somewhere else. Nothing you change in them here is saved. Reload to get the latest."
|
|
39
|
+
- "The header and footer did not save. They are sent again with your next change."
|
|
40
|
+
Before, the edit showed on the canvas and was never stored, with nothing on screen to say so.
|
|
41
|
+
- **"Synced from the site menu." only where the words are synced.** A Footer menu column's own Heading is typed, and it wins over the menu's name. The part panel said "Synced from the site menu. Open" over it, because it chose the note by block type, so the heading looked as if it came from Storefront › Menus. The note now shows only for a prop that holds hydrated words. The column's block panel still says it, for the links.
|
|
42
|
+
- **Open goes to that menu.** Open on a menu column's note sends the column's menu id with `storefront-editor:open-menus`, so the console opens that menu, not only the Menus list (the admin already reads `menuId`, as for the Header panel's "Edit menu"). With no linked menu, it opens the list, as before.
|
|
43
|
+
|
|
44
|
+
### For hosts
|
|
45
|
+
|
|
46
|
+
- `mainActionFor` takes `pinnedUnpublished` (optional, default false: the page alone, as before).
|
|
47
|
+
- New `components/usePinnedChromeState`: the one reader of `PinnedChromeReport`, used by the bar and by the notice.
|
|
48
|
+
- `PinnedChromeLoadNotice` keeps its name and its load notice; `PINNED_CHROME_NOTES` holds its four sentences.
|
|
49
|
+
- `lib/puck/source-bound-parts`: new `partSourceNoteFor(nodeType, propKey)` (the note for one prop) and `sourceMenuIdOf(props)`. `PartSourceNote` takes an optional `menuId`.
|
|
50
|
+
- `storefront-editor:open-menus` from the source note now carries `{ menuId }` (a string, or null).
|
|
51
|
+
|
|
52
|
+
### Keep editor code off shopper pages
|
|
53
|
+
|
|
54
|
+
- **A registry that is only drawn can be finished without the settings panel**
|
|
55
|
+
(keep editor code off shopper pages, W1, 2026-10-19). New
|
|
56
|
+
`lib/puck/render-registry`: `finishRenderRegistry(config)` runs every pass's
|
|
57
|
+
draw half over the blocks and imports none of the panel's builders.
|
|
58
|
+
`finishRegistry` is now that same loop handed the inspector, so the editor
|
|
59
|
+
and a shopper's page are wrapped by one list of passes. The Image width
|
|
60
|
+
slider's icon is handed in on the inspector (`PassInspector.WidthIcon`)
|
|
61
|
+
instead of imported by `passes/section-width`, so the passes folder imports
|
|
62
|
+
no icon set. Nothing a merchant sees changes.
|
|
63
|
+
|
|
64
|
+
- **A block that is only drawn can carry its text parts without its fields**
|
|
65
|
+
(keep editor code off shopper pages, W2a, 2026-10-19). New
|
|
66
|
+
`lib/puck/text-part-shape`: `textPartShape(fields)` cuts a field list down to
|
|
67
|
+
what the part walk (`partNeedles`) reads, as plain data, and
|
|
68
|
+
`textPartShapesText(blocks)` writes a set of them as JSON. The general
|
|
69
|
+
blocks' file is `lib/puck/blocks/general/text-part-shapes.json`, written by
|
|
70
|
+
`pnpm run text-parts`. The part-style wrapper (`passes/clickable-parts`)
|
|
71
|
+
reads a block's `textParts` before its `fields` (a render half's `fields`
|
|
72
|
+
are its slots alone), so a published page can draw a merchant's part styles
|
|
73
|
+
without loading the settings panel. An editor's block has no `textParts`.
|
|
74
|
+
Nothing a merchant sees changes. For hosts: run the same function over your
|
|
75
|
+
own blocks to write your file.
|
|
76
|
+
|
|
3
77
|
## 22.0.0 - 2026-10-19
|
|
4
78
|
|
|
5
79
|
**A site text style's phone size** (Lewis 2026-10-19: the Hartes hero's Heading 1 draws 106px on a 390px phone; the site's style gets a phone size first, one place for every page; a single heading keeps its own phone Font size in the part text panel, which already exists).
|
|
@@ -36,9 +36,10 @@ export declare function PartPanelBody({ sectionName, onBack, textEditor, styleRo
|
|
|
36
36
|
styleRow?: ReactNode;
|
|
37
37
|
children?: ReactNode;
|
|
38
38
|
}): import("react").JSX.Element;
|
|
39
|
-
export declare function PartSourceNote({ source, slug }: {
|
|
39
|
+
export declare function PartSourceNote({ source, slug, menuId }: {
|
|
40
40
|
source: PartSource;
|
|
41
41
|
slug?: string;
|
|
42
|
+
menuId?: string;
|
|
42
43
|
}): import("react").JSX.Element;
|
|
43
44
|
export default function PartSettingsPanel({ nodeId, propKey, onBack, onEditStyle, }: {
|
|
44
45
|
nodeId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as ne,jsxs as h}from"react/jsx-runtime";import{useContext as Xe,useEffect as oe,useRef as Ye,useState as ke}from"react";import{PartResetDot as qe}from"./PartResetDot.js";import{FieldSelect as Je,InspectorField as Qe}from"efficient-easel/fields";import{SettingsField as Ze}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as et,TypeIcon as tt}from"efficient-easel/icons";import{useEasel as nt}from"efficient-easel/easel";import{TextPartPanel as ot}from"efficient-easel/copy";import{Tooltip as st}from"efficient-shell/ui";import{PartTextBox as lt,partTextCells as rt}from"./PartTextBox.js";import Re from"./UiIcon.js";import{usePreviewHeader as it}from"./PreviewHeaderContext.js";import{UpdateStyleDialog as at}from"./UpdateStyleDialog.js";import{StorefrontDocumentContext as ct}from"./StorefrontDocumentContext.js";import{hasStyleChange as dt,partStyleToTextStyleValues as ut,pushIntoStyle as ft,resolveTextStyles as pt,styleIdOfRole as Oe}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as mt}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as ht}from"../lib/theme-row-persist.js";import{usePreviewDevice as yt}from"./PreviewDeviceContext.js";import{usePartStyle as gt}from"./PreviewPartStyleContext.js";import{say as s}from"../lib/editor-words.js";import{readHidable as U,textFieldOffPage as bt,textFieldPanelOnly as St}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as xt}from"../lib/puck/field-markers.js";import{useSectionOps as Pt}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as wt,FONT_ROLES as se,FONT_ROLE_LABELS as le,fontOption as re}from"../lib/fonts.js";import{isMultilineKind as Tt,partPlaceholder as vt,typeInPlaceKind as Ct}from"../lib/puck/part-text.js";import{partRowField as Nt}from"../lib/puck/part-row-field.js";import{decodePartKey as kt,partPropsWithRowValue as Rt,partRowValue as Ot}from"../lib/puck/part-rows.js";import{PART_WIDTH_MAX as Et,propsWithPartStyleValue as B,propsWithoutPartStyle as It,readPartStyle as Ee}from"../lib/puck/part-styles.js";import{partThemeColors as Ft}from"../lib/puck/part-inks.js";import{styleKeyForPart as _t}from"../lib/sections/section-text-kinds.js";import{commitPartText as zt}from"../lib/puck/part-typing.js";import{keysOnCanvas as At,useCanvasTypingPart as Vt}from"../lib/puck/canvas-typing.js";import{useEditorHost as Lt}from"../lib/editor-host.js";import{SOURCE_LINES as Kt,SOURCE_ACTIONS as Ut,SOURCE_ACTION_LABEL as Bt,partSourceOf as Dt,sourceSlugOf as Ie}from"../lib/puck/source-bound-parts.js";import{encodePartId as Wt,holdsAuthoredText as jt}from"../lib/puck/text-parts.js";import{regionsForSection as Gt}from"../lib/sections/section-text-regions.js";import{textRegionOfPartKey as Mt}from"../lib/sections/text-regions.js";function ie(n){return n?s(n):null}function Fe(n){return n.kind==="role"?le[n.role]:n.kind==="custom"?"Custom":null}function Ht(n){const o=n.role;return o&&se.includes(o)?{kind:"role",role:o}:null}function $t(n,o){if(!n)return{kind:"unread"};const{faceRole:l,base:r}=n;if(o[l]===r.fontKey)return{kind:"role",role:l};const c=Object.keys(o).filter(i=>o[i]===r.fontKey);return c.length===1?{kind:"role",role:c[0]}:{kind:"custom"}}function ae(n,o,l,r){return Ht(Ee(n,o))??$t(l,r)}function Xt(n,o){if(!n.length)return null;const l=o(n[0]);return n.every(r=>o(r)===l)?l:null}const D="";function Yt({face:n,base:o,onPick:l}){const r=n.kind==="role"?n.role:D,c=[{label:s("No style"),value:D},...se.map(i=>({label:s(le[i]),value:i}))];return t(Je,{ariaLabel:s("Style"),value:r,options:c,inline:!0,onChange:i=>l(i===D?null:i),renderOption:i=>i.value===D?h(ne,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:i.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:s("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${i.value})`},children:i.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${re(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:ie(Fe(n))}),valueText:i=>ie(Fe(n))??i?.label??""})}function qt({sectionName:n,onBack:o,textEditor:l,styleRow:r,children:c}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:s(n),onSelect:o}),l,r,c]})}function _e({source:n,slug:o}){const l=Lt(),r=Ut[n],c=!r.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[s(Kt[n]),c?h(ne,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{r.type==="storefront-editor:open-menus"?l.send(r.type):o&&l.send(r.type,{slug:o})},children:s(Bt)})]}):null]})})}const ze=4,Jt=120;function Qt({region:n,sizePx:o,face:l,base:r,onFollowStyle:c,source:i,slug:W,onBack:P}){const I=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s(n.label)})}),t("p",{children:o?s("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:s(I),px:Math.round(o)}):s("Its size follows Site styles ▸ {follows}.",{follows:s(I)})}),c?t(ne,{children:t(Ze,{label:s("Style"),icon:t(et,{}),hint:s("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:s(n.label).toLowerCase()}),children:t(Yt,{face:l,base:r,onPick:c})})}):t("p",{className:"es-field-hint sf-hint-keep",children:s("Only the size follows a site style. This section sets its own font, weight and letter case.")}),i?t(_e,{source:i,slug:W}):null,t(K,{inline:!0,name:s("Page"),onSelect:P})]})}function Zt({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part is no longer here.")})}),t("p",{children:s("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function en({onBack:n,partId:o,why:l}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part's settings did not open.")})}),t("p",{children:s("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",l]})}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function tn({nodeId:n,propKey:o,onBack:l,onEditStyle:r}){const{getItemById:c,getSelectorForId:i,config:W}=nt(e=>e),P=Pt(),I=Vt(),{partStyle:F}=gt(),{fonts:_,textStyles:Ae}=it(),j=Xe(ct),ce=!j?.capabilities?.hasSiteTheme,{persist:Ve}=ht({themeFromDocument:ce,tokenRef:j?.tokenRef,siteId:j?.siteId??null}),R=mt({themeFromDocument:ce,persist:Ve}),[Le,G]=ke(!1),Ke=yt()==="mobile",de=Ye(null),d=c(n),p=i(n),ue=d?W.components[d.type]:void 0,{key:S,row:g}=kt(o),fe=ue?.fields?.[S],y=g?Nt(fe,g):fe,w=Wt(n,o),m=d?.props??{},b=Ct(y),pe=bt(y),me=jt(y),M=d?Dt(d.type):null,H=g?Ot(m[S],g):m[S],he=!!g&&!(Array.isArray(m[S])&&g.index<m[S].length);oe(()=>{if(At(document))return;de.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[w]);const[$,ye]=ke(0);oe(()=>ye(0),[w]);const X=!!d&&!he&&(!p||!y);oe(()=>{if(!X||$>=ze)return;const e=setTimeout(()=>ye(a=>a+1),Jt);return()=>clearTimeout(e)},[X,$]);const Ue=X&&$<ze;if(!d||he)return t(Zt,{onBack:l});const z=Gt(d.type),ge=z?Mt(z,o):null;if(z&&ge){const e=F?.partId===w?F:null,a=z[ge],f=a.writable===!0&&!!p,E=te=>{p&&P.replaceComponent(p.zone,p.index,{...d,props:B(m,o,"role",te)})};return t(Qt,{region:a,sizePx:e?.base.sizePx??null,face:ae(m,o,e,_),base:e?.base??null,onFollowStyle:f?E:void 0,source:M,slug:Ie(m),onBack:l})}if(!p||!y)return Ue?t("div",{className:"sf-note","aria-busy":"true"}):t(en,{onBack:l,partId:w,why:p?"no field":"no selector"});const be=e=>{P.replaceComponent(p.zone,p.index,{...d,props:e})},Y=e=>{if(U(e).hidden!==U(H).hidden||!b){const f=g?Rt(m,S,g,e):{...m,[S]:e};f&&be(f);return}zt({node:d,propKey:o,kind:b,zone:p.zone,index:p.index},U(e).text,P.replaceComponent)},Be=H,T=F?.partId===w?F:null,v=T?.styleOwner,A=v?c(v.owner):null,q=v&&A?i(v.owner):null,J=!!(v&&A&&q),C=J?A.props??{}:m,Q=J?e=>P.replaceComponent(q.zone,q.index,{...A,props:e}):be,V=J?v.kind:_t(d?.type,o),N=Ee(C,V),u=[{partKey:V,face:ae(C,V,T,_),sizeGroup:T?.sizeGroup??null,base:T?.base??on,style:N}],De=Xt(u,e=>e.sizeGroup),We=Ft(T?.inks),O=(e,a)=>{let f=C;for(const E of u)f=B(f,E.partKey,e,a);Q(f)},je=e=>O("role",e),Se=e=>{let a=C;for(const f of u)for(const[E,te]of Object.entries(e))a=B(a,f.partKey,E,te??null);Q(a)},Z=b==="text"||b==="textarea",{text:xe,hidden:k}=U(H),L=y?.[xt]?.label??o,Pe=k?s("Show {label} on the slide",{label:s(L)}):s("Hide {label} on the slide",{label:s(L)}),we=h("div",{className:"sf-field-head",children:[t(tt,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:s(L)}),Z&&t(st,{content:Pe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":k,"aria-label":Pe,onClick:()=>Y({text:xe,hidden:!k}),children:k?t(Re,{name:"eye-off",size:14}):t(Re,{name:"eye",size:14})})})]}),Te=!pe&&me,Ge=!!b&&(St(y)||pe||k||!me),ve=ae(C,V,T,_),ee=ve.kind==="role"?ve.role:null,Ce=Object.entries(N).filter(([e,a])=>e!=="role"&&a!==void 0).length,Ne=()=>{let e=C;for(const a of u){const f=a.style.role;e=It(e,a.partKey),f&&(e=B(e,a.partKey,"role",f))}Q(e)},x=Oe(ee),Me=dt(u[0].style),He=x?pt(R.saved,R.old).find(e=>e.id===x)?.name??x:"",$e=()=>{G(!1),x&&(R.write(ft({saved:R.saved,old:R.old,styleId:x,values:ut(u[0].style)}),!0),Ne())};return h(qt,{sectionName:ue?.label??d.type,onBack:l,textEditor:t("div",{ref:de,className:"sf-part-text",children:Ge?t(lt,{text:xe,onTextChange:e=>Y(Z?{text:e,hidden:k}:e),multiline:Tt(b),markup:b!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:Se,colors:We,placeholder:ie(vt(y))??void 0,ariaLabel:s(L),head:we,typedOnCanvas:I===w}):b?Z?we:null:t(Qe,{field:y,name:o,value:Be,onChange:Y,id:`sf-part-${n}-${o}`})}),children:[M&&t(_e,{source:M,slug:Ie(m)}),Te&&t(ot,{style:{value:ee??"",options:[{value:"",label:s("No style"),description:s("Section’s own")},...se.map(e=>({value:e,label:s(le[e]),description:re(_[e])?.label}))],onChange:e=>je(e||null),changed:Ce>0,onClearChanges:Ce>0?Ne:void 0,onEditStyles:r,onUpdateStyle:x&&Me?()=>G(!0):void 0},font:{value:N.font??"",styleValue:re(u[0].base.fontKey)?.label,options:wt.map(e=>({label:e.label,value:e.key})),onChange:e=>O("font",e||null)},italic:{value:N.italic,styleValue:nn(Ae,ee),onChange:e=>O("italic",e??null)},cells:rt(u[0].style,u[0].base,Se,{phone:Ke}),align:{value:N.align??"",styleValue:u[0].base.align,onChange:e=>O("align",e||null)},letterCase:{value:N.case??"",styleValue:u[0].base.case,onChange:e=>O("case",e||null)}}),Le&&x&&t(at,{styleName:He,onCancel:()=>G(!1),onConfirm:$e}),Te&&De===null&&t("p",{className:"es-field-hint sf-hint-keep",children:s("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function nn(n,o){const l=Oe(o);return!l||!Array.isArray(n)?!1:n.find(c=>c?.id===l)?.values?.italic===!0}const on={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:Et};export{qt as PartPanelBody,qe as PartResetDot,_e as PartSourceNote,Yt as PartStyleSelect,tn as default,ae as partFace};
|
|
1
|
+
"use client";import{jsx as t,Fragment as te,jsxs as h}from"react/jsx-runtime";import{useContext as Ye,useEffect as ne,useRef as qe,useState as ke}from"react";import{PartResetDot as Je}from"./PartResetDot.js";import{FieldSelect as Qe,InspectorField as Ze}from"efficient-easel/fields";import{SettingsField as et}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as tt,TypeIcon as nt}from"efficient-easel/icons";import{useEasel as ot}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as lt}from"efficient-shell/ui";import{PartTextBox as rt,partTextCells as it}from"./PartTextBox.js";import Oe from"./UiIcon.js";import{usePreviewHeader as at}from"./PreviewHeaderContext.js";import{UpdateStyleDialog as ct}from"./UpdateStyleDialog.js";import{StorefrontDocumentContext as dt}from"./StorefrontDocumentContext.js";import{hasStyleChange as ut,partStyleToTextStyleValues as ft,pushIntoStyle as pt,resolveTextStyles as mt,styleIdOfRole as Re}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as ht}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as yt}from"../lib/theme-row-persist.js";import{usePreviewDevice as gt}from"./PreviewDeviceContext.js";import{usePartStyle as St}from"./PreviewPartStyleContext.js";import{say as s}from"../lib/editor-words.js";import{readHidable as U,textFieldOffPage as bt,textFieldPanelOnly as xt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as Pt}from"../lib/puck/field-markers.js";import{useSectionOps as wt}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as Tt,FONT_ROLES as oe,FONT_ROLE_LABELS as se,fontOption as le}from"../lib/fonts.js";import{isMultilineKind as vt,partPlaceholder as Nt,typeInPlaceKind as Ct}from"../lib/puck/part-text.js";import{partRowField as kt}from"../lib/puck/part-row-field.js";import{decodePartKey as Ot,partPropsWithRowValue as Rt,partRowValue as It}from"../lib/puck/part-rows.js";import{PART_WIDTH_MAX as Et,propsWithPartStyleValue as B,propsWithoutPartStyle as Ft,readPartStyle as Ie}from"../lib/puck/part-styles.js";import{partThemeColors as _t}from"../lib/puck/part-inks.js";import{styleKeyForPart as zt}from"../lib/sections/section-text-kinds.js";import{commitPartText as At}from"../lib/puck/part-typing.js";import{keysOnCanvas as Vt,useCanvasTypingPart as Lt}from"../lib/puck/canvas-typing.js";import{useEditorHost as Kt}from"../lib/editor-host.js";import{SOURCE_LINES as Ut,SOURCE_ACTIONS as Bt,SOURCE_ACTION_LABEL as Dt,partSourceNoteFor as Wt,partSourceOf as Mt,sourceMenuIdOf as jt,sourceSlugOf as Ee}from"../lib/puck/source-bound-parts.js";import{encodePartId as Gt,holdsAuthoredText as Ht}from"../lib/puck/text-parts.js";import{regionsForSection as $t}from"../lib/sections/section-text-regions.js";import{textRegionOfPartKey as Xt}from"../lib/sections/text-regions.js";function re(n){return n?s(n):null}function Fe(n){return n.kind==="role"?se[n.role]:n.kind==="custom"?"Custom":null}function Yt(n){const o=n.role;return o&&oe.includes(o)?{kind:"role",role:o}:null}function qt(n,o){if(!n)return{kind:"unread"};const{faceRole:l,base:a}=n;if(o[l]===a.fontKey)return{kind:"role",role:l};const i=Object.keys(o).filter(r=>o[r]===a.fontKey);return i.length===1?{kind:"role",role:i[0]}:{kind:"custom"}}function ie(n,o,l,a){return Yt(Ie(n,o))??qt(l,a)}function Jt(n,o){if(!n.length)return null;const l=o(n[0]);return n.every(a=>o(a)===l)?l:null}const D="";function Qt({face:n,base:o,onPick:l}){const a=n.kind==="role"?n.role:D,i=[{label:s("No style"),value:D},...oe.map(r=>({label:s(se[r]),value:r}))];return t(Qe,{ariaLabel:s("Style"),value:a,options:i,inline:!0,onChange:r=>l(r===D?null:r),renderOption:r=>r.value===D?h(te,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:s("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:re(Fe(n))}),valueText:r=>re(Fe(n))??r?.label??""})}function Zt({sectionName:n,onBack:o,textEditor:l,styleRow:a,children:i}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:s(n),onSelect:o}),l,a,i]})}function _e({source:n,slug:o,menuId:l}){const a=Kt(),i=Bt[n],r=!i.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[s(Ut[n]),r?h(te,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{i.type==="storefront-editor:open-menus"?a.send(i.type,{menuId:l??null}):o&&a.send(i.type,{slug:o})},children:s(Dt)})]}):null]})})}const ze=4,en=120;function tn({region:n,sizePx:o,face:l,base:a,onFollowStyle:i,source:r,slug:W,onBack:P}){const E=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s(n.label)})}),t("p",{children:o?s("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:s(E),px:Math.round(o)}):s("Its size follows Site styles ▸ {follows}.",{follows:s(E)})}),i?t(te,{children:t(et,{label:s("Style"),icon:t(tt,{}),hint:s("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:s(n.label).toLowerCase()}),children:t(Qt,{face:l,base:a,onPick:i})})}):t("p",{className:"es-field-hint sf-hint-keep",children:s("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(_e,{source:r,slug:W}):null,t(K,{inline:!0,name:s("Page"),onSelect:P})]})}function nn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part is no longer here.")})}),t("p",{children:s("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function on({onBack:n,partId:o,why:l}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part's settings did not open.")})}),t("p",{children:s("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",l]})}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function sn({nodeId:n,propKey:o,onBack:l,onEditStyle:a}){const{getItemById:i,getSelectorForId:r,config:W}=ot(e=>e),P=wt(),E=Lt(),{partStyle:F}=St(),{fonts:_,textStyles:Ae}=at(),M=Ye(dt),ae=!M?.capabilities?.hasSiteTheme,{persist:Ve}=yt({themeFromDocument:ae,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),O=ht({themeFromDocument:ae,persist:Ve}),[Le,j]=ke(!1),Ke=gt()==="mobile",ce=qe(null),d=i(n),m=r(n),de=d?W.components[d.type]:void 0,{key:g,row:S}=Ot(o),ue=de?.fields?.[g],y=S?kt(ue,S):ue,w=Gt(n,o),p=d?.props??{},b=Ct(y),fe=bt(y),pe=Ht(y),Ue=d?Mt(d.type):null,me=d?Wt(d.type,g):null,G=S?It(p[g],S):p[g],he=!!S&&!(Array.isArray(p[g])&&S.index<p[g].length);ne(()=>{if(Vt(document))return;ce.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[w]);const[H,ye]=ke(0);ne(()=>ye(0),[w]);const $=!!d&&!he&&(!m||!y);ne(()=>{if(!$||H>=ze)return;const e=setTimeout(()=>ye(c=>c+1),en);return()=>clearTimeout(e)},[$,H]);const Be=$&&H<ze;if(!d||he)return t(nn,{onBack:l});const z=$t(d.type),ge=z?Xt(z,o):null;if(z&&ge){const e=F?.partId===w?F:null,c=z[ge],f=c.writable===!0&&!!m,I=ee=>{m&&P.replaceComponent(m.zone,m.index,{...d,props:B(p,o,"role",ee)})};return t(tn,{region:c,sizePx:e?.base.sizePx??null,face:ie(p,o,e,_),base:e?.base??null,onFollowStyle:f?I:void 0,source:Ue,slug:Ee(p),onBack:l})}if(!m||!y)return Be?t("div",{className:"sf-note","aria-busy":"true"}):t(on,{onBack:l,partId:w,why:m?"no field":"no selector"});const Se=e=>{P.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!b){const f=S?Rt(p,g,S,e):{...p,[g]:e};f&&Se(f);return}At({node:d,propKey:o,kind:b,zone:m.zone,index:m.index},U(e).text,P.replaceComponent)},De=G,T=F?.partId===w?F:null,v=T?.styleOwner,A=v?i(v.owner):null,Y=v&&A?r(v.owner):null,q=!!(v&&A&&Y),N=q?A.props??{}:p,J=q?e=>P.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?v.kind:zt(d?.type,o),C=Ie(N,V),u=[{partKey:V,face:ie(N,V,T,_),sizeGroup:T?.sizeGroup??null,base:T?.base??rn,style:C}],We=Jt(u,e=>e.sizeGroup),Me=_t(T?.inks),R=(e,c)=>{let f=N;for(const I of u)f=B(f,I.partKey,e,c);J(f)},je=e=>R("role",e),be=e=>{let c=N;for(const f of u)for(const[I,ee]of Object.entries(e))c=B(c,f.partKey,I,ee??null);J(c)},Q=b==="text"||b==="textarea",{text:xe,hidden:k}=U(G),L=y?.[Pt]?.label??o,Pe=k?s("Show {label} on the slide",{label:s(L)}):s("Hide {label} on the slide",{label:s(L)}),we=h("div",{className:"sf-field-head",children:[t(nt,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:s(L)}),Q&&t(lt,{content:Pe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":k,"aria-label":Pe,onClick:()=>X({text:xe,hidden:!k}),children:k?t(Oe,{name:"eye-off",size:14}):t(Oe,{name:"eye",size:14})})})]}),Te=!fe&&pe,Ge=!!b&&(xt(y)||fe||k||!pe),ve=ie(N,V,T,_),Z=ve.kind==="role"?ve.role:null,Ne=Object.entries(C).filter(([e,c])=>e!=="role"&&c!==void 0).length,Ce=()=>{let e=N;for(const c of u){const f=c.style.role;e=Ft(e,c.partKey),f&&(e=B(e,c.partKey,"role",f))}J(e)},x=Re(Z),He=ut(u[0].style),$e=x?mt(O.saved,O.old).find(e=>e.id===x)?.name??x:"",Xe=()=>{j(!1),x&&(O.write(pt({saved:O.saved,old:O.old,styleId:x,values:ft(u[0].style)}),!0),Ce())};return h(Zt,{sectionName:de?.label??d.type,onBack:l,textEditor:t("div",{ref:ce,className:"sf-part-text",children:Ge?t(rt,{text:xe,onTextChange:e=>X(Q?{text:e,hidden:k}:e),multiline:vt(b),markup:b!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:be,colors:Me,placeholder:re(Nt(y))??void 0,ariaLabel:s(L),head:we,typedOnCanvas:E===w}):b?Q?we:null:t(Ze,{field:y,name:o,value:De,onChange:X,id:`sf-part-${n}-${o}`})}),children:[me&&t(_e,{source:me,slug:Ee(p),menuId:jt(p)}),Te&&t(st,{style:{value:Z??"",options:[{value:"",label:s("No style"),description:s("Section’s own")},...oe.map(e=>({value:e,label:s(se[e]),description:le(_[e])?.label}))],onChange:e=>je(e||null),changed:Ne>0,onClearChanges:Ne>0?Ce:void 0,onEditStyles:a,onUpdateStyle:x&&He?()=>j(!0):void 0},font:{value:C.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Tt.map(e=>({label:e.label,value:e.key})),onChange:e=>R("font",e||null)},italic:{value:C.italic,styleValue:ln(Ae,Z),onChange:e=>R("italic",e??null)},cells:it(u[0].style,u[0].base,be,{phone:Ke}),align:{value:C.align??"",styleValue:u[0].base.align,onChange:e=>R("align",e||null)},letterCase:{value:C.case??"",styleValue:u[0].base.case,onChange:e=>R("case",e||null)}}),Le&&x&&t(ct,{styleName:$e,onCancel:()=>j(!1),onConfirm:Xe}),Te&&We===null&&t("p",{className:"es-field-hint sf-hint-keep",children:s("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function ln(n,o){const l=Re(o);return!l||!Array.isArray(n)?!1:n.find(i=>i?.id===l)?.values?.italic===!0}const rn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:Et};export{Zt as PartPanelBody,Je as PartResetDot,_e as PartSourceNote,Qt as PartStyleSelect,sn as default,ie as partFace};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import type { PinnedChromeReport } from "../lib/editor-document-adapter.js";
|
|
2
|
-
export declare const
|
|
1
|
+
import type { PinnedChromeReport, PinnedChromeState } from "../lib/editor-document-adapter.js";
|
|
2
|
+
export declare const PINNED_CHROME_NOTES: {
|
|
3
|
+
readonly load: "The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.";
|
|
4
|
+
readonly lock: "{name} is editing the header and footer. Nothing you change in them here is saved.";
|
|
5
|
+
readonly conflict: "The header and footer were changed somewhere else. Nothing you change in them here is saved. Reload to get the latest.";
|
|
6
|
+
readonly save: "The header and footer did not save. They are sent again with your next change.";
|
|
7
|
+
};
|
|
8
|
+
export declare const PINNED_CHROME_LOAD_NOTICE: "The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.";
|
|
9
|
+
export declare const PINNED_CHROME_LOCK_NOTICE: "{name} is editing the header and footer. Nothing you change in them here is saved.";
|
|
10
|
+
export declare const PINNED_CHROME_CONFLICT_NOTICE: "The header and footer were changed somewhere else. Nothing you change in them here is saved. Reload to get the latest.";
|
|
11
|
+
export declare const PINNED_CHROME_SAVE_NOTICE: "The header and footer did not save. They are sent again with your next change.";
|
|
12
|
+
export declare function pinnedChromeNoticeWords(state: PinnedChromeState | null): string | null;
|
|
3
13
|
export declare function PinnedChromeLoadNotice({ report }: {
|
|
4
14
|
report: PinnedChromeReport | undefined;
|
|
5
15
|
}): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{useEffect as d,useState as s}from"react";import{Banner as c}from"efficient-shell/ui";import{useOpenPinnedChromeReport as l,usePinnedChromeState as h}from"./usePinnedChromeState.js";import{say as n}from"../lib/editor-words.js";const r={load:"The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.",lock:"{name} is editing the header and footer. Nothing you change in them here is saved.",conflict:"The header and footer were changed somewhere else. Nothing you change in them here is saved. Reload to get the latest.",save:"The header and footer did not save. They are sent again with your next change."},u=r.load,f=r.lock,m=r.conflict,N=r.save;function p(e){return e?e.loadFailed?n(u):e.lockHolder?n(f,{name:e.lockHolder.name||n("Somebody else")}):e.conflict?n(m):e.saveFailed?n(N):null:null}function C({report:e}){const o=p(h(e)),[a,i]=s(null);return d(()=>{o||i(null)},[o]),!o||a===o?null:t("aside",{className:"sf-canvas-notice",children:t(c,{tone:"warning",onDismiss:()=>i(o),children:o})})}function T(){return t(C,{report:l()})}export{T as OpenDocumentChromeLoadNotice,m as PINNED_CHROME_CONFLICT_NOTICE,u as PINNED_CHROME_LOAD_NOTICE,f as PINNED_CHROME_LOCK_NOTICE,r as PINNED_CHROME_NOTES,N as PINNED_CHROME_SAVE_NOTICE,C as PinnedChromeLoadNotice,p as pinnedChromeNoticeWords};
|
|
@@ -2,6 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import { type CardGap, type CardShadow, type HoverEffect, type HeadingCompression, type ResolvedHeadingTypography, type SizesValue, type ThemeMode, type ThemeValue } from "../lib/theme.js";
|
|
3
3
|
import { type FontsValue } from "../lib/fonts.js";
|
|
4
4
|
import type { PreviewHeaderSettings } from "../lib/preview-header-settings.js";
|
|
5
|
+
import type { ResolvedWordStyle, WordStyleName } from "../lib/word-styles.js";
|
|
5
6
|
export type { PreviewHeaderSettings };
|
|
6
7
|
type Ctx = {
|
|
7
8
|
settings: PreviewHeaderSettings | null;
|
|
@@ -37,6 +38,7 @@ type Ctx = {
|
|
|
37
38
|
setHeadingTypography: (v: ResolvedHeadingTypography) => void;
|
|
38
39
|
textStyles: unknown;
|
|
39
40
|
setTextStyles: (v: unknown) => void;
|
|
41
|
+
wordStyles: Record<WordStyleName, ResolvedWordStyle> | null;
|
|
40
42
|
siteWidth: number | null;
|
|
41
43
|
setSiteWidth: (v: number | null) => void;
|
|
42
44
|
siteGutter: number | null;
|
|
@@ -56,7 +58,7 @@ type Ctx = {
|
|
|
56
58
|
setSelectHandler: (fn: () => void) => void;
|
|
57
59
|
};
|
|
58
60
|
export declare const PreviewHeaderContext: import("react").Context<Ctx>;
|
|
59
|
-
export declare function PreviewHeaderProvider({ children, websiteName, templateChrome, templateName, chromePlaceholder, themeMode, onThemeModeChange, themeSwitchShown, onThemeSwitchShownChange, theme, onThemeChange, fonts, onFontsChange, sizes, onSizesChange, cornerRadiusPx, onCornerRadiusPxChange, cardShadow, onCardShadowChange, shadowColor, onShadowColorChange, cardGap, onCardGapChange, hoverEffect, onHoverEffectChange, headingCompression, onHeadingCompressionChange, siteWidth, onSiteWidthChange, siteGutter, blockGap, onSiteGutterChange, onBlockGapChange, headingTypography, onHeadingTypographyChange, textStyles, onTextStylesChange, heroBackgroundFollowsWidth, onHeroBackgroundFollowsWidthChange, photographyGrayscale, onPhotographyGrayscaleChange, shareButtonOnPosts, onShareButtonOnPostsChange, themeFromDocument, }: {
|
|
61
|
+
export declare function PreviewHeaderProvider({ children, websiteName, templateChrome, templateName, chromePlaceholder, themeMode, onThemeModeChange, themeSwitchShown, onThemeSwitchShownChange, theme, onThemeChange, fonts, onFontsChange, sizes, onSizesChange, cornerRadiusPx, onCornerRadiusPxChange, cardShadow, onCardShadowChange, shadowColor, onShadowColorChange, cardGap, onCardGapChange, hoverEffect, onHoverEffectChange, headingCompression, onHeadingCompressionChange, siteWidth, onSiteWidthChange, siteGutter, blockGap, onSiteGutterChange, onBlockGapChange, headingTypography, onHeadingTypographyChange, textStyles, onTextStylesChange, wordStyles, heroBackgroundFollowsWidth, onHeroBackgroundFollowsWidthChange, photographyGrayscale, onPhotographyGrayscaleChange, shareButtonOnPosts, onShareButtonOnPostsChange, themeFromDocument, }: {
|
|
60
62
|
children: ReactNode;
|
|
61
63
|
websiteName?: string | null;
|
|
62
64
|
templateChrome?: boolean;
|
|
@@ -92,6 +94,7 @@ export declare function PreviewHeaderProvider({ children, websiteName, templateC
|
|
|
92
94
|
onSiteWidthChange?: (v: number | null) => void;
|
|
93
95
|
textStyles?: unknown;
|
|
94
96
|
onTextStylesChange?: (v: unknown) => void;
|
|
97
|
+
wordStyles?: Record<WordStyleName, ResolvedWordStyle> | null;
|
|
95
98
|
headingTypography?: ResolvedHeadingTypography;
|
|
96
99
|
onHeadingTypographyChange?: (v: ResolvedHeadingTypography) => void;
|
|
97
100
|
heroBackgroundFollowsWidth?: boolean | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as k}from"react/jsx-runtime";import{createContext as Mt,useCallback as e,useContext as Rt,useMemo as Wt,useState as L}from"react";import{EditorSiteLogoContext as Bt}from"./SiteLogoContext.js";import{useSelectHandler as Nt}from"../lib/puck/preview-selection-context.js";import{IDENTITY_CARD_GAP as U,DEFAULT_HEADING_COMPRESSION as O,DEFAULT_HEADING_TYPOGRAPHY as g,DEFAULT_SIZES as M,DEFAULT_SWITCH_SHOWN as R,DEFAULT_THEME_MODE as W,DEFAULT_THEME_VALUE as B}from"../lib/theme.js";import{DEFAULT_FONTS as N}from"../lib/fonts.js";const Y=Mt({settings:null,setSettings:()=>{},primeSettings:()=>{},websiteName:null,templateChrome:!1,templateName:null,chromePlaceholder:!1,themeMode:W,setThemeMode:()=>{},themeSwitchShown:R,setThemeSwitchShown:()=>{},theme:B,setTheme:()=>{},fonts:N,setFonts:()=>{},sizes:M,setSizes:()=>{},cornerRadiusPx:null,setCornerRadiusPx:()=>{},cardShadow:null,setCardShadow:()=>{},shadowColor:null,setShadowColor:()=>{},cardGap:U,setCardGap:()=>{},hoverEffect:null,setHoverEffect:()=>{},headingCompression:O,setHeadingCompression:()=>{},siteWidth:null,setSiteWidth:()=>{},siteGutter:null,blockGap:null,setSiteGutter:()=>{},setBlockGap:()=>{},headingTypography:g,setHeadingTypography:()=>{},textStyles:null,setTextStyles:()=>{},wordStyles:null,heroBackgroundFollowsWidth:null,setHeroBackgroundFollowsWidth:()=>{},photographyGrayscale:null,setPhotographyGrayscale:()=>{},shareButtonOnPosts:null,setShareButtonOnPosts:()=>{},themeFromDocument:!1,selected:!1,setSelected:()=>{},select:()=>{},setSelectHandler:()=>{}});function qt({children:j,websiteName:o=null,templateChrome:l=!1,templateName:r=null,chromePlaceholder:n=!1,themeMode:z=W,onThemeModeChange:c,themeSwitchShown:b=R,onThemeSwitchShownChange:u,theme:V=B,onThemeChange:i,fonts:Z=N,onFontsChange:d,sizes:q=M,onSizesChange:S,cornerRadiusPx:J=null,onCornerRadiusPxChange:a,cardShadow:K=null,onCardShadowChange:p,shadowColor:Q=null,onShadowColorChange:E,cardGap:X=U,onCardGapChange:f,hoverEffect:$=null,onHoverEffectChange:T,headingCompression:C=O,onHeadingCompressionChange:m,siteWidth:tt=null,onSiteWidthChange:H,siteGutter:et=null,blockGap:st=null,onSiteGutterChange:D,onBlockGapChange:_,headingTypography:lt=g,onHeadingTypographyChange:w,textStyles:ot=null,onTextStylesChange:P,wordStyles:rt=null,heroBackgroundFollowsWidth:nt=null,onHeroBackgroundFollowsWidthChange:x,photographyGrayscale:ct=null,onPhotographyGrayscaleChange:A,shareButtonOnPosts:ut=null,onShareButtonOnPostsChange:h,themeFromDocument:it=!1}){const[s,v]=L(null),dt=e(t=>v(gt=>gt??t),[]),[St,at]=L(!1),pt=e(t=>c?.(t),[c]),Et=e(t=>u?.(t),[u]),ft=e(t=>i?.(t),[i]),Tt=e(t=>d?.(t),[d]),mt=e(t=>S?.(t),[S]),Ht=e(t=>H?.(t),[H]),Dt=e(t=>D?.(t),[D]),_t=e(t=>_?.(t),[_]),wt=e(t=>x?.(t),[x]),Pt=e(t=>A?.(t),[A]),xt=e(t=>h?.(t),[h]),At=e(t=>a?.(t),[a]),ht=e(t=>p?.(t),[p]),vt=e(t=>E?.(t),[E]),Ft=e(t=>f?.(t),[f]),Gt=e(t=>T?.(t),[T]),yt=e(t=>m?.(t),[m]),It=e(t=>w?.(t),[w]),kt=e(t=>P?.(t),[P]),{select:Lt,setSelectHandler:Ut}=Nt(),F=s?.logoUrl,G=s?.logoReversed,y=s?.logoInkIsDark,I=s!==null,Ot=Wt(()=>({logo:I?{logoUrl:F,logoReversed:G,logoInkIsDark:y}:null,placeholder:l||n,wordmark:l?r:o}),[I,F,G,y,l,n,r,o]);return k(Bt.Provider,{value:Ot,children:k(Y.Provider,{value:{settings:s,setSettings:v,primeSettings:dt,websiteName:o,templateChrome:l,templateName:r,chromePlaceholder:n,themeMode:z,setThemeMode:pt,themeSwitchShown:b,setThemeSwitchShown:Et,theme:V,setTheme:ft,fonts:Z,setFonts:Tt,sizes:q,setSizes:mt,cornerRadiusPx:J,setCornerRadiusPx:At,cardShadow:K,setCardShadow:ht,shadowColor:Q,setShadowColor:vt,cardGap:X,setCardGap:Ft,hoverEffect:$,setHoverEffect:Gt,headingCompression:C,setHeadingCompression:yt,siteWidth:tt,setSiteWidth:Ht,siteGutter:et,blockGap:st,setSiteGutter:Dt,setBlockGap:_t,headingTypography:lt,setHeadingTypography:It,textStyles:ot,setTextStyles:kt,wordStyles:rt,heroBackgroundFollowsWidth:nt,setHeroBackgroundFollowsWidth:wt,photographyGrayscale:ct,setPhotographyGrayscale:Pt,shareButtonOnPosts:ut,setShareButtonOnPosts:xt,themeFromDocument:it,selected:St,setSelected:at,select:Lt,setSelectHandler:Ut},children:j})})}const Jt=()=>Rt(Y);export{Y as PreviewHeaderContext,qt as PreviewHeaderProvider,Jt as usePreviewHeader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as h,Fragment as P}from"react/jsx-runtime";import{useState as ce}from"react";import{useEasel as de}from"efficient-easel/easel";import{headWords as D,InspectorHead as pe,InspectorIconButton as C}from"efficient-easel/chrome";import{DuplicateIcon as me,TrashIcon as fe}from"efficient-easel/icons";import{panelFieldsOf as ue}from"../lib/puck/panel-fields.js";import{TICKER_PART_LABEL as F}from"./PreviewTickerContext.js";import he from"./SectionIcon.js";import{PanelHideButton as x}from"./SidePanelHead.js";import{useEditorSession as be}from"../lib/editor-session-context.js";import{say as o}from"../lib/editor-words.js";import Se,{HintsToggle as we,SHOW_HINTS_DEFAULT as ge}from"./WebsiteSettingsPanel.js";import ke from"./ChatSettingsPanel.js";import Pe from"./SocialLinksPanel.js";import ve from"./TickerSettingsPanel.js";import
|
|
1
|
+
"use client";import{jsx as n,jsxs as h,Fragment as P}from"react/jsx-runtime";import{useState as ce}from"react";import{useEasel as de}from"efficient-easel/easel";import{headWords as D,InspectorHead as pe,InspectorIconButton as C}from"efficient-easel/chrome";import{DuplicateIcon as me,TrashIcon as fe}from"efficient-easel/icons";import{panelFieldsOf as ue}from"../lib/puck/panel-fields.js";import{TICKER_PART_LABEL as F}from"./PreviewTickerContext.js";import he from"./SectionIcon.js";import{PanelHideButton as x}from"./SidePanelHead.js";import{useEditorSession as be}from"../lib/editor-session-context.js";import{say as o}from"../lib/editor-words.js";import Se,{HintsToggle as we,SHOW_HINTS_DEFAULT as ge}from"./WebsiteSettingsPanel.js";import ke from"./ChatSettingsPanel.js";import Pe from"./SocialLinksPanel.js";import ve from"./TickerSettingsPanel.js";import Ie,{PartSourceNote as Ee}from"./PartSettingsPanel.js";import ye from"./DuplicateToPageMenu.js";import{useStorefrontDocument as Le}from"./StorefrontDocumentContext.js";import{usePreviewHeader as Oe}from"./PreviewHeaderContext.js";import{useSectionOps as Ne}from"../lib/puck/use-section-ops.js";import{SELECTION_MODE as Te}from"../lib/editor-screen.js";import{usePreviewParts as He}from"./PreviewPartsContext.js";import{entryPartsOf as _e,SectionTextEntries as Ae}from"./SectionTextEntries.js";import{SectionTextSuppressProvider as Re}from"../lib/puck/section-text-suppress.js";import{HEADER_TYPE as De,ROOT_ZONE as B}from"../lib/puck/content-tree.js";import{websiteDuplicateBlocked as Ce}from"../lib/puck/every-page.js";import{FOOTER_TYPE as v}from"../lib/puck/footer-blocks.js";import Fe from"./SwitchToBoxFooter.js";import{SiteFields as M}from"./SiteFields.js";import xe from"./HeroPartPanel.js";import{HERO_MEDIA_PART_LABELS as Be,HERO_PART_MODE as Me,heroPartLabel as ze}from"../lib/puck/hero-media-parts.js";import{SettingsSwitch as Ke}from"efficient-easel/panel";import{foldTopTier as We}from"../lib/puck/field-groups.js";import{FoldHeadingScope as je}from"../lib/puck/panel-heading-scope.js";import{partRowField as Ue}from"../lib/puck/part-row-field.js";import{decodePartKey as Ye,partRowHeadLabel as Ze}from"../lib/puck/part-rows.js";import{encodePartId as $e,partHeadLabel as qe,partLabel as Ge,sectionTextParts as Je}from"../lib/puck/text-parts.js";import{partSourceOf as Qe,sourceMenuIdOf as Ve,sourceSlugOf as Xe}from"../lib/puck/source-bound-parts.js";const Zt=Te,$t={kind:"header"},qt={kind:"website"},Gt={kind:"chat"},Jt={kind:"social"},S="Part";function et(e){return o("Part of {name}",{name:o(e)})}function tt(e,i,r){const a=e.describeNode(i);return{name:r,kindLabel:a?et(a.label):o(S)}}function nt(e){switch(e){case"Header":return{title:o("Header settings belong to a website."),own:o("Each website created from this template sets its own header afterwards.")};case"Appearance":return{title:o("Appearance settings belong to a website."),own:o("Each website created from this template sets its own appearance afterwards.")};case"Live chat":return{title:o("Live chat settings belong to a website."),own:o("Each website created from this template sets its own live chat afterwards.")};case"Social link":return{title:o("Social link settings belong to a website."),own:o("Each website created from this template sets its own social link afterwards.")};default:return{title:o("{what} settings belong to a website.",{what:e}),own:o("Each website created from this template sets its own {what} afterwards.",{what:e.toLowerCase()})}}}function z({what:e}){const i=nt(e);return h("div",{className:"sf-note",children:[n("p",{children:n("strong",{children:i.title})}),h("p",{children:[o("A template is a blueprint — it has no website of its own, so there is nothing here to change.")," ",i.own]})]})}function I(e){const i=Me[e];return{name:Be[e],kindLabel:S,icon:i,head:(r,a)=>{if(r.kind!==i)return null;const c=a.describeNode(r.nodeId);if(!c)return null;const m=D({name:o(ze(e,c.props)),tier:"part",of:o(c.label)},{partOf:({name:d})=>o("Part of {name}",{name:d})});return{name:m.name,kindLabel:m.kind}},render:(r,a)=>r.kind===i?n(xe,{nodeId:r.nodeId,part:e,sectionName:a.describeNode(r.nodeId)?.label??"Hero",onUpToSection:()=>a.onSelectNode(r.nodeId)}):null}}const ot={header:{name:"Header",kindLabel:"Site settings",icon:"header",render:(e,i)=>{const r=i.hostPanels?.header;return r?n(r,{placeholderMode:i.capabilities.placeholderFrames,tokenRef:i.tokenRef,siteId:i.siteId,websiteName:i.websiteName,onOpenWebsiteSettings:i.onOpenWebsiteSettings,onAuthExpired:()=>i.notifyParent("storefront-editor:auth-expired")}):null}},website:{name:"Appearance",kindLabel:"Site settings",icon:"website",render:(e,i)=>n(Se,{themeFromDocument:!i.capabilities.hasSiteTheme,tokenRef:i.tokenRef,siteId:i.siteId,onNotify:i.onNotify})},chat:{name:"Live chat",kindLabel:"Site settings",icon:"chat",render:()=>n(ke,{})},social:{name:"Social links",kindLabel:"Site settings",icon:"social",render:()=>n(Pe,{unavailable:n(z,{what:"Social link"})})},ticker:{name:F,kindLabel:S,icon:"ticker",head:(e,i)=>e.kind==="ticker"?tt(i,e.heroId,o(F)):null,render:e=>n(ve,{heroId:e.kind==="ticker"?e.heroId:""})},heroMedia:I("media"),heroImage:I("image"),heroImage2:I("image2"),part:{name:S,kindLabel:S,icon:"Text",head:(e,i)=>{if(e.kind!=="part")return null;const r=i.describeNode(e.nodeId);if(!r)return null;const{key:a,row:c}=Ye(e.propKey),m=c?Ue(r.fields[a],c):r.fields[a],d=Ze(o(qe(Ge(m??{},a))),c),f=D({name:d,tier:"part",of:o(r.label)},{partOf:({name:w})=>o("Part of {name}",{name:w})});return{name:f.name,kindLabel:f.kind}},render:(e,i)=>e.kind==="part"?n(Ie,{nodeId:e.nodeId,propKey:e.propKey,onBack:()=>i.onSelectNode(e.nodeId),onEditStyle:i.onOpenSiteStyles}):null}},it=new Set(["header","website","chat"]);function rt(e,i){if(e==="puck")return null;const r=ot[e];return it.has(e)&&!i.hasSiteSettings?{...r,kindLabel:"Not part of a template",render:()=>n(z,{what:r.name})}:r}function st({mode:e,onOpenWebsiteSettings:i,onOpenSiteStyles:r,onSelectNode:a,hideNodeActions:c=!1,onNotify:m,onHidePanel:d}){const{capabilities:f,tokenRef:w,notifyParent:K,currentSlug:W,siteId:E,runAuthed:j,readOnly:U}=Le(),{websiteName:Y}=Oe(),g=Ne({readOnly:U}),{select:Z}=He(),{selectedItem:t,getItemById:$,getSelectorForId:q,config:u,appState:G}=de(p=>p),J=ue(u,t?{type:t.type,props:t.props}:null),y=t?Je(J??u.components[t.type]?.fields,t.props):[],Q=p=>u.components[p]?.label??p,s=t?q(t.props.id):void 0,l=rt(e.kind,f),V=be(),L={capabilities:f,tokenRef:w,hostPanels:V.chrome?.panels,describeNode:p=>{const b=$(p);if(!b)return null;const R=u.components[b.type];return{type:b.type,label:R?.label??b.type,fields:R?.fields??{},props:b.props??{}}},siteId:E,websiteName:Y??null,notifyParent:K,onNotify:m,onOpenWebsiteSettings:i,onOpenSiteStyles:r,onSelectNode:a},O=l?.head?.(e,L)??null,X=O?.name??(l?o(l.name):t?o(Q(t.type)):o("Page settings")),ee=O?.kindLabel??(l?o(l.kindLabel):t?s&&s.zone!==B?o("Block"):o("Section"):o("Page")),te=l?l.icon:t?t.type:"page",N=l?null:t?u.components[t.type]?.fields??null:u.root?.fields??null,ne=N?We(N):2,T=e.kind==="puck"&&t?Qe(t.type):null,oe=!!t&&!!s&&s.zone===B&&t.type!==v&&t.type!==De,k=Ce(G?.data,t),ie=()=>{k||s&&g.duplicateComponent(s.zone,s.index)},re=()=>{s&&(g.removeComponent(s.zone,s.index),g.select(null))},se=t?u.components[t.type]?.defaultProps?.previewHover:void 0,H=e.kind==="puck"&&!!t&&!!s&&se!==void 0,_=H&&t.props.previewHover===!0,ae=()=>{!t||!s||g.replaceComponent(s.zone,s.index,{...t,props:{...t.props,previewHover:!_}})},[A,le]=ce(ge);return h("div",{className:`es-sidepanel es-sidepanel--right sf-panel sf-panel--right${A||!(!l&&!!t)?"":" sf-hints-folded"}`,children:[n(pe,{icon:n(he,{type:te,size:15}),name:X,kind:ee,actions:!c&&e.kind==="puck"&&t&&t.type!==v?h(P,{children:[n(C,{label:o("Duplicate section"),title:k??void 0,disabled:k!==null,onClick:ie,children:n(me,{size:15})}),oe&&f.hasSiteSettings&&n(ye,{node:t,currentSlug:W,siteId:E??void 0,tokenRef:w,runAuthed:j,onNotify:m}),n(C,{label:o("Remove section"),danger:!0,onClick:re,children:n(fe,{size:15})}),d?n(x,{side:"right",onHide:d,divider:!0}):null]}):d?n(x,{side:"right",onHide:d}):void 0}),H&&h("div",{className:"sf-preview-pin",children:[h("div",{className:"sf-preview-pin-text",children:[n("span",{className:"sf-preview-pin-label",children:o("Preview hover state")}),n("span",{className:"sf-preview-pin-hint",children:o("not shown live")})]}),n(Ke,{checked:_,onChange:ae,ariaLabel:o("Preview hover state")})]}),n(je,{tier:ne,children:n("div",{className:"sf-insp-body es-insp-body sf-scroll",children:l?l.render(e,L):t?h(P,{children:[t.type===v&&f.hasSiteSettings&&n(Fe,{}),n(Re,{children:n(M,{entries:n(Ae,{parts:y,heading:!1,onOpen:p=>Z($e(t.props.id,p))}),entryCount:_e(y).length})}),T&&n(Ee,{source:T,slug:Xe(t?.props),menuId:Ve(t?.props)}),n(we,{shown:A,onChange:le})]}):n(P,{children:n(M,{})})})})]})}export{Gt as CHAT_MODE,$t as HEADER_MODE,Zt as PUCK_MODE,Jt as SOCIAL_MODE,qt as WEBSITE_MODE,st as default,rt as resolvePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as c,jsxs as ct}from"react/jsx-runtime";import{useCallback as a,useEffect as p,useMemo as M,useRef as S,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as dt}from"../lib/puck/build-config.js";import{ChromeWrap as ut}from"../lib/editor-chrome.js";import{sessionRegistry as ht}from"../lib/editor-session.js";import{backendOf as R,blocksOf as lt}from"../lib/website-session.js";import{useEditorSession as mt}from"../lib/editor-session-context.js";import{withSiteBlockGapFields as pt}from"../lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as St}from"../lib/puck/templateFields.js";import{setEditorPage as de}from"../lib/puck/editor-page-context.js";import{resolveSiteName as ft}from"../lib/content/site-name.js";import{normalizeSiteGutter as gt,normalizeSiteWidth as wt}from"../lib/content/page-width.js";import{normalizeSiteBlockGap as Ct}from"../lib/content/container-gap.js";import Tt,{DocumentScreen as _t}from"./EditorScreenMount.js";import{useStorefrontDocument as Et}from"./StorefrontDocumentContext.js";import{PreviewHeaderProvider as yt}from"./PreviewHeaderContext.js";import{PreviewFooterProvider as Pt}from"./PreviewFooterContext.js";import{PreviewChatProvider as vt,DEFAULT_CHAT_PREVIEW as Ht}from"./PreviewChatContext.js";import{PreviewSocialProvider as It}from"./PreviewSocialContext.js";import{useSocialSettings as Mt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Rt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Gt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Ft}from"./PreviewTickerContext.js";import{PreviewHeroPartProvider as Wt}from"./PreviewHeroPartContext.js";import{PreviewPartsProvider as kt}from"./PreviewPartsContext.js";import{PreviewLocationPartProvider as At}from"./PreviewLocationPartContext.js";import{PreviewPartStyleProvider as Dt}from"./PreviewPartStyleContext.js";import{SiteMapsProvider as xt,readSiteMapsKey as Bt,writeSiteMapsKey as ue,readSiteMapId as Nt,writeSiteMapId as Ot}from"../lib/maps-config.js";import{CORNER_STYLE_TO_PX as bt,DEFAULT_HEADING_COMPRESSION as zt,DEFAULT_HEADING_TYPOGRAPHY as Kt,DEFAULT_SWITCH_SHOWN as G,DEFAULT_SIZES as Lt,DEFAULT_THEME_MODE as C,normalizeCornerRadius as Yt,normalizeCornerStyle as Ut,normalizeCardShadow as jt,normalizeCardGap as Vt,normalizeHoverEffect as Xt,normalizeShadowColor as Zt,IDENTITY_CARD_GAP as he,IDENTITY_CARD_SHADOW as qt,IDENTITY_HOVER_EFFECT as Jt,THEME_MODE_KEY as le,THEME_STORAGE_KEY as Qt,THEME_SWITCH_HIDE as me,THEME_SWITCH_KEY as F}from"../lib/theme.js";import{DEFAULT_FONTS as $t}from"../lib/fonts.js";import{WEBSITE_SCREEN as er}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as tr}from"../lib/website-host-inbound.js";import{siteTextFromRow as rr}from"../lib/site-text-styles.js";import{wordStylesFromRow as or}from"../lib/word-styles.js";import{chatPreviewFrom as nr}from"./PreviewChatContext.js";const ar=()=>{if(typeof window>"u")return C;try{const i=window.localStorage.getItem(le);return i==="light"||i==="dark"||i==="auto"?i:C}catch{return C}},pe=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(le,i)}catch{}},ir=()=>{if(typeof window>"u")return G;try{return window.localStorage.getItem(F)!==me}catch{return G}},sr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(Qt)}catch{}},Se=i=>{if(!(typeof window>"u"))try{i?window.localStorage.removeItem(F):window.localStorage.setItem(F,me)}catch{}};function cr(){const{adapter:i,capabilities:d,templateId:W,ready:f,token:l,siteId:s,currentSlug:k,currentKind:A}=Et();p(()=>(de(k,A),()=>de(null,null)),[k,A]);const T=d.placeholderFrames,[fe,D]=r(null),[ge,x]=r("");p(()=>{const e=i.templateName;if(!f||!W||!e){x("");return}let o=!1;return e().then(u=>!o&&x(u??"")).catch(()=>{}),()=>{o=!0}},[f,l,W,i]);const[we,_]=r(C),[Ce,E]=r(G),[Te,B]=r({selected:0,themes:[]}),[_e,N]=r($t),[Ee,O]=r(Lt),[ye,b]=r(null),[Pe,z]=r(zt),[ve,K]=r(null),[He,L]=r(null),[Ie,Y]=r(he),[Me,U]=r(null),[Re,j]=r(null),[Ge,V]=r(null),[y,X]=r(null),h=mt(),Z=M(()=>dt(ht(h),lt(h)),[h]),Fe=M(()=>pt(St(Z,T),y),[Z,T,y]),[We,q]=r(Kt),[ke,J]=r(null),[Ae,Q]=r(null),[De,$]=r(null),ee=S(null),n=S(!1);p(()=>{_(ar()),E(ir())},[]);const xe=a(e=>{n.current=!0,sr(),pe(e),_(e)},[]),Be=a(e=>{n.current=!0,Se(e),E(e)},[]),Ne=a(e=>{n.current=!0,B(e)},[]),Oe=a(e=>{n.current=!0,N(e)},[]),be=a(e=>{n.current=!0,O(e)},[]),ze=a(e=>{n.current=!0,b(e)},[]),Ke=a(e=>{n.current=!0,z(e)},[]),Le=a(e=>{n.current=!0,K(e)},[]),Ye=a(e=>{n.current=!0,L(e)},[]),Ue=a(e=>{n.current=!0,Y(e)},[]),je=a(e=>{n.current=!0,U(e)},[]),Ve=a(e=>{n.current=!0,q(e)},[]),[Xe,te]=r(null),[Ze,qe]=r(null),Je=a(e=>{n.current=!0,te(e)},[]),Qe=a(e=>{n.current=!0,j(e)},[]),$e=a(e=>{n.current=!0,V(e)},[]),et=a(e=>{n.current=!0,X(e)},[]),tt=a(e=>{n.current=!0,J(e)},[]),rt=a(e=>{n.current=!0,Q(e)},[]),ot=a(e=>{n.current=!0,$(e)},[]);p(()=>{const e=R(h).theme;if(!l||!d.hasSiteTheme||!e)return;const o=s??"";ee.current!==o&&(ee.current=o,n.current=!1);let u=!1;return e.get(s?{siteId:s}:void 0).then(t=>{if(u||n.current)return;pe(t.default_mode),Se(t.show_theme_switch),_(t.default_mode),E(t.show_theme_switch),B({selected:t.selected_preset,themes:t.theme_presets});const m=rr(t);N(m.fonts),O(m.sizes),b(t.corner_radius_px===void 0?bt[Ut(t.corner_style)]:Yt(t.corner_radius_px)),z(m.compression),K(t.card_shadow==null?qt:jt(t.card_shadow)),Y(t.card_gap==null?he:Vt(t.card_gap)),U(t.hover_effect==null?Jt:Xt(t.hover_effect)),L(Zt(t.shadow_color)),j(wt(t.site_width)),V(gt(t.site_gutter)),X(Ct(t.block_gap)),q(m.typography),te(m.textStyles),qe(or(t)),J(t.hero_background_follows_width===!0),Q(t.photography_grayscale===!0),$(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[l,s,d.hasSiteTheme,h]);const nt=Mt({token:l,siteId:s,enabled:d.hasSiteSettings}),[at,re]=r(Ht),oe=S(null),P=S(!1),v=S(null),g=S({}),it=a(e=>{P.current=!0,re(o=>({...o,...e})),!(!d.hasSiteSettings||!l)&&(g.current={...g.current,...e},v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{const o=g.current;g.current={},R(h).chat?.update(o,s?{siteId:s}:void 0).catch(()=>{})},500))},[d.hasSiteSettings,l,s,h]);p(()=>{if(!l||!d.hasSiteSettings)return;const e=s??"";oe.current!==e&&(oe.current=e,P.current=!1);let o=!1;const u=R(h).chat;if(u)return u.get(s?{siteId:s}:void 0).then(t=>{o||P.current||re(nr(t))}).catch(()=>{}),()=>{o=!0}},[l,s,d.hasSiteSettings,h]);const[w,H]=r(""),ne=S(null),I=S(!1);p(()=>H(Bt()),[]);const ae=a(e=>{const o=e.trim();if(o===w)return;I.current=!0,ue(o),H(o);const u=i.updateSite;!d.canEditSiteRecord||!f||!u||u({mapsApiKey:o}).catch(()=>{})},[w,d.canEditSiteRecord,f,i]),[ie,se]=r("");p(()=>se(Nt()),[]),p(()=>{const e=i.site;if(!f||!d.hasSiteRecord||!e){D(null);return}const o=s??"";ne.current!==o&&(ne.current=o,I.current=!1);let u=!1;return e().then(t=>{if(u||(D(ft(t.name)),I.current))return;const m=t.mapsApiKey??"";ue(m),H(m);const ce=t.mapsMapId??"";Ot(ce),se(ce)}).catch(()=>{}),()=>{u=!0}},[f,l,d.hasSiteRecord,s,i]);const st=M(()=>({apiKey:w,setApiKey:ae,mapId:ie}),[w,ae,ie]);return c(_t,{config:Fe,parts:er,wrap:(e,o)=>c(yt,{websiteName:fe,templateChrome:T,templateName:ge||null,themeMode:we,onThemeModeChange:xe,themeSwitchShown:Ce,onThemeSwitchShownChange:Be,theme:Te,onThemeChange:Ne,fonts:_e,onFontsChange:Oe,cornerRadiusPx:ye,onCornerRadiusPxChange:ze,cardShadow:ve,onCardShadowChange:Le,shadowColor:He,onShadowColorChange:Ye,cardGap:Ie,onCardGapChange:Ue,hoverEffect:Me,onHoverEffectChange:je,headingCompression:Pe,onHeadingCompressionChange:Ke,headingTypography:We,onHeadingTypographyChange:Ve,textStyles:Xe,onTextStylesChange:Je,wordStyles:Ze,sizes:Ee,onSizesChange:be,siteWidth:Re,onSiteWidthChange:Qe,siteGutter:Ge,onSiteGutterChange:$e,blockGap:y,onBlockGapChange:et,heroBackgroundFollowsWidth:ke,onHeroBackgroundFollowsWidthChange:tt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:rt,shareButtonOnPosts:De,onShareButtonOnPostsChange:ot,themeFromDocument:!d.hasSiteTheme,children:c(Pt,{children:c(ut,{wrap:h.chrome?.wrap,surface:"page",children:c(Ft,{children:c(Wt,{children:c(kt,{children:c(At,{children:c(Dt,{children:ct(xt,{value:st,children:[c(vt,{chat:at,onChatChange:it,children:c(It,{value:nt,children:c(Rt,{children:e})})}),o]})})})})})})})})})})}function dr({target:i}){return c(Tt,{target:i,addressing:Gt,onHostMessage:tr,children:c(cr,{})})}export{dr as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { PinnedChromeReport, PinnedChromeState } from "../lib/editor-document-adapter.js";
|
|
2
|
+
export declare function usePinnedChromeState(report: PinnedChromeReport | undefined): PinnedChromeState | null;
|
|
3
|
+
export declare function useOpenPinnedChromeReport(): PinnedChromeReport | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useSyncExternalStore as t}from"react";import{useStorefrontDocument as o}from"./StorefrontDocumentContext.js";const s=()=>()=>{},n=()=>null;function c(e){return t(e?e.subscribe:s,e?e.state:n,e?e.state:n)}function i(){const{adapter:e}=o();return e?.pinnedChrome}export{i as useOpenPinnedChromeReport,c as usePinnedChromeState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as m,useEffect as
|
|
1
|
+
"use client";import{useCallback as m,useEffect as p,useRef as u,useState as b}from"react";import{useStorefrontDocument as h}from"./StorefrontDocumentContext.js";import{useOpenPinnedChromeReport as v,usePinnedChromeState as P}from"./usePinnedChromeState.js";import{effectiveLive as S,mainActionFor as y,usePageLiveState as C}from"../lib/page-live-state.js";function U(n){const{docId:i,capabilities:o,hasUnsavedEdits:c,onPublish:t}=h(),f=S(C(i??null),c),a=P(v()),[l,s]=b(!1),r=u(n);r.current=n;const e=u(!0);p(()=>(e.current=!0,()=>{e.current=!1}),[]);const d=m(()=>{s(!0),t(r.current).finally(()=>{e.current&&s(!1)})},[t]);if(o.canPublish)return y({live:f,onPress:d,busy:l,pinnedUnpublished:a?.unpublished??!1})}export{U as useWebsiteMainAction};
|
|
@@ -504,6 +504,7 @@ export declare const WEB_BUILDER_WORDS: {
|
|
|
504
504
|
readonly "Hand-picked products in a tidy grid.": "Hand-picked products in a tidy grid.";
|
|
505
505
|
readonly "Hard to read": "Hard to read";
|
|
506
506
|
readonly Header: "Header";
|
|
507
|
+
readonly "Header and footer not live yet": "Header and footer not live yet";
|
|
507
508
|
readonly "Header badge": "Header badge";
|
|
508
509
|
readonly "Header settings belong to a website.": "Header settings belong to a website.";
|
|
509
510
|
readonly "Header \u00B7 on every page": "Header · on every page";
|
|
@@ -936,6 +937,7 @@ export declare const WEB_BUILDER_WORDS: {
|
|
|
936
937
|
readonly "Social links": "Social links";
|
|
937
938
|
readonly Soft: "Soft";
|
|
938
939
|
readonly Solid: "Solid";
|
|
940
|
+
readonly "Somebody else": "Somebody else";
|
|
939
941
|
readonly Source: "Source";
|
|
940
942
|
readonly "Space above and below": "Space above and below";
|
|
941
943
|
readonly "Space between": "Space between";
|
|
@@ -1036,6 +1038,8 @@ export declare const WEB_BUILDER_WORDS: {
|
|
|
1036
1038
|
readonly "The footer cannot take another one of these": "The footer cannot take another one of these";
|
|
1037
1039
|
readonly "The footer holds at most 6 sections": "The footer holds at most 6 sections";
|
|
1038
1040
|
readonly "The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.": "The header and footer could not load. They are hidden for now and nothing in them is saved. Reload to try again.";
|
|
1041
|
+
readonly "The header and footer did not save. They are sent again with your next change.": "The header and footer did not save. They are sent again with your next change.";
|
|
1042
|
+
readonly "The header and footer were changed somewhere else. Nothing you change in them here is saved. Reload to get the latest.": "The header and footer were changed somewhere else. Nothing you change in them here is saved. Reload to get the latest.";
|
|
1039
1043
|
readonly "The header cannot take another one of these": "The header cannot take another one of these";
|
|
1040
1044
|
readonly "The header holds at most 3 sections": "The header holds at most 3 sections";
|
|
1041
1045
|
readonly "The room left at the left and right edge of every page.": "The room left at the left and right edge of every page.";
|
|
@@ -1192,6 +1196,7 @@ export declare const WEB_BUILDER_WORDS: {
|
|
|
1192
1196
|
readonly "{label} \u2014 row {n}": "{label} — row {n}";
|
|
1193
1197
|
readonly "{letter} \u00B7 Step": "{letter} · Step";
|
|
1194
1198
|
readonly "{name} (unavailable)": "{name} (unavailable)";
|
|
1199
|
+
readonly "{name} is editing the header and footer. Nothing you change in them here is saved.": "{name} is editing the header and footer. Nothing you change in them here is saved.";
|
|
1195
1200
|
readonly "{name} is on this section": "{name} is on this section";
|
|
1196
1201
|
readonly "{name} \u2014 renamed in the Console: {place}.": "{name} — renamed in the Console: {place}.";
|
|
1197
1202
|
readonly "{n} cities": "{n} cities";
|