efficient-web-builder 30.1.2 → 31.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/editor/components/ApplyCornersToSiblings.js +1 -1
- package/dist/editor/components/BlogPostSource.js +1 -1
- package/dist/editor/components/DuplicateToPageMenu.js +1 -1
- package/dist/editor/components/LocationsGroupedField.js +1 -1
- package/dist/editor/components/MediaUploadField.js +1 -1
- package/dist/editor/components/PagesPanel.js +1 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/SectionEditor.d.ts +3 -3
- package/dist/editor/components/SectionEditor.js +1 -1
- package/dist/editor/components/SectionThemePicker.js +1 -1
- package/dist/editor/components/SiteEditorProvider.d.ts +1 -1
- package/dist/editor/components/SiteEditorProvider.js +1 -1
- package/dist/editor/components/SlotChildRows.d.ts +1 -1
- package/dist/editor/components/SlotChildRows.js +1 -1
- package/dist/editor/components/StandaloneSectionEditor.js +1 -1
- package/dist/editor/components/StorefrontEditor.d.ts +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/StorefrontLinkField.js +1 -1
- package/dist/editor/components/StylesPanel.js +1 -1
- package/dist/editor/components/SwitchToBoxFooter.js +1 -1
- package/dist/editor/components/TemplateFieldRow.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.d.ts +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
- package/dist/editor/components/useLocationsTree.d.ts +1 -1
- package/dist/editor/components/usePinnedChromeSeed.d.ts +1 -1
- package/dist/editor/components/usePinnedChromeSeed.js +1 -1
- package/dist/editor/components/usePinnedChromeState.js +1 -1
- package/dist/editor/components/useSocialSettings.js +1 -1
- package/dist/editor/components/useWebsiteMainAction.d.ts +1 -1
- package/dist/editor/components/useWebsiteMainAction.js +1 -1
- package/dist/editor/lib/editor-blocks.d.ts +1 -1
- package/dist/editor/lib/editor-blocks.js +1 -1
- package/dist/editor/lib/editor-document-adapter.d.ts +1 -1
- package/dist/editor/lib/editor-document-adapter.js +1 -1
- package/dist/editor/lib/geocode.js +1 -1
- package/dist/editor/lib/page-live-state.d.ts +1 -1
- package/dist/editor/lib/page-rows.js +1 -1
- package/dist/editor/lib/puck/add-palette.d.ts +2 -2
- package/dist/editor/lib/puck/add-palette.js +1 -1
- package/dist/editor/lib/puck/add-target.d.ts +2 -2
- package/dist/editor/lib/puck/block-offer.d.ts +1 -1
- package/dist/editor/lib/puck/block-offer.js +1 -1
- package/dist/editor/lib/puck/blocks/general/ButtonBlock/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/general/Hero/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/general/HeroSingle/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/general/IntroBleed/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/shared-fields.js +1 -1
- package/dist/editor/lib/puck/controls.js +1 -1
- package/dist/editor/lib/puck/field-groups.d.ts +1 -1
- package/dist/editor/lib/puck/field-groups.js +1 -1
- package/dist/editor/lib/puck/footer-blocks.d.ts +2 -2
- package/dist/editor/lib/puck/footer-blocks.js +1 -1
- package/dist/editor/lib/puck/overrides.js +1 -1
- package/dist/editor/lib/puck/panel-drop-empty-headings.js +1 -1
- package/dist/editor/lib/puck/pinned-seed-gate.d.ts +2 -2
- package/dist/editor/lib/puck/pinned-seed-gate.js +1 -1
- package/dist/editor/lib/puck/section-text-suppress.js +1 -1
- package/dist/editor/lib/puck/section-width-fields.js +1 -1
- package/dist/editor/lib/sections/new-section-node.d.ts +1 -1
- package/dist/editor/lib/source-rules/part-slider-fills-row.js +1 -1
- package/dist/editor/lib/theme-row-persist.d.ts +1 -1
- package/dist/editor/lib/theme-row-persist.js +1 -1
- package/dist/editor/lib/use-host-products.d.ts +1 -1
- package/dist/editor/lib/use-host-products.js +1 -1
- package/dist/editor/lib/web-backend.d.ts +5 -5
- package/dist/editor/lib/web-backend.js +1 -1
- package/dist/editor/lib/website-document-addressing.d.ts +1 -1
- package/dist/editor/lib/website-session.d.ts +1 -1
- package/dist/editor/lib/website-session.js +1 -1
- package/dist/format/lib/editor-form-window.d.ts +1 -1
- package/dist/format/lib/links/link-picker-setup.d.ts +1 -1
- package/dist/render/lib/editor-auth.js +1 -1
- package/dist/render/lib/editor-session-loader.js +1 -1
- package/dist/render/lib/editor-site.js +1 -1
- package/dist/render/lib/logo/analyze-logo-client.js +1 -1
- package/dist/render/lib/media.js +1 -1
- package/dist/render/lib/puck/slot-specs.d.ts +2 -2
- package/package.json +1 -1
- package/dist/editor/components/AddBlockRow.d.ts +0 -1
- package/dist/editor/components/AddBlockRow.js +0 -1
- package/dist/editor/components/AddChildRow.d.ts +0 -1
- package/dist/editor/components/AddChildRow.js +0 -1
- package/dist/editor/components/AddSidePanel.d.ts +0 -2
- package/dist/editor/components/AddSidePanel.js +0 -1
- package/dist/editor/components/EditorScreenMount.d.ts +0 -1
- package/dist/editor/components/EditorScreenMount.js +0 -1
- package/dist/editor/components/EditorStoreProvider.d.ts +0 -1
- package/dist/editor/components/EditorStoreProvider.js +0 -1
- package/dist/editor/components/MediaSidePanel.d.ts +0 -1
- package/dist/editor/components/MediaSidePanel.js +0 -1
- package/dist/editor/components/NodeContextMenu.d.ts +0 -2
- package/dist/editor/components/NodeContextMenu.js +0 -1
- package/dist/editor/components/PageEditGuardNotices.d.ts +0 -1
- package/dist/editor/components/PageEditGuardNotices.js +0 -1
- package/dist/editor/components/PanelToggleIcon.d.ts +0 -1
- package/dist/editor/components/PanelToggleIcon.js +0 -1
- package/dist/editor/components/PreviewPartsContext.d.ts +0 -1
- package/dist/editor/components/PreviewPartsContext.js +0 -1
- package/dist/editor/components/SectionEditorShell.d.ts +0 -1
- package/dist/editor/components/SectionEditorShell.js +0 -1
- package/dist/editor/components/SidePanelHead.d.ts +0 -1
- package/dist/editor/components/SidePanelHead.js +0 -1
- package/dist/editor/components/SlotChildActionsContext.d.ts +0 -2
- package/dist/editor/components/SlotChildActionsContext.js +0 -1
- package/dist/editor/components/StorefrontDocumentContext.d.ts +0 -2
- package/dist/editor/components/StorefrontDocumentContext.js +0 -1
- package/dist/editor/components/StorefrontEditorChrome.d.ts +0 -1
- package/dist/editor/components/StorefrontEditorChrome.js +0 -1
- package/dist/editor/components/panel-widths.d.ts +0 -2
- package/dist/editor/components/panel-widths.js +0 -1
- package/dist/editor/components/usePartBridge.d.ts +0 -1
- package/dist/editor/components/usePartBridge.js +0 -1
- package/dist/editor/lib/client-only.d.ts +0 -1
- package/dist/editor/lib/client-only.js +0 -1
- package/dist/editor/lib/editor-admin-bridge.d.ts +0 -2
- package/dist/editor/lib/editor-admin-bridge.js +0 -1
- package/dist/editor/lib/editor-backend-error.d.ts +0 -2
- package/dist/editor/lib/editor-backend-error.js +0 -1
- package/dist/editor/lib/editor-chrome.d.ts +0 -2
- package/dist/editor/lib/editor-chrome.js +0 -1
- package/dist/editor/lib/editor-document-addressing.d.ts +0 -2
- package/dist/editor/lib/editor-document-addressing.js +0 -1
- package/dist/editor/lib/editor-document-switch.d.ts +0 -2
- package/dist/editor/lib/editor-document-switch.js +0 -1
- package/dist/editor/lib/editor-failure.d.ts +0 -1
- package/dist/editor/lib/editor-failure.js +0 -1
- package/dist/editor/lib/editor-host-inbound.d.ts +0 -1
- package/dist/editor/lib/editor-host-inbound.js +0 -1
- package/dist/editor/lib/editor-host.d.ts +0 -2
- package/dist/editor/lib/editor-host.js +0 -1
- package/dist/editor/lib/editor-key-scope.d.ts +0 -1
- package/dist/editor/lib/editor-key-scope.js +0 -1
- package/dist/editor/lib/editor-load-error.d.ts +0 -1
- package/dist/editor/lib/editor-load-error.js +0 -1
- package/dist/editor/lib/editor-media-panel.d.ts +0 -2
- package/dist/editor/lib/editor-media-panel.js +0 -1
- package/dist/editor/lib/editor-media-picker.d.ts +0 -2
- package/dist/editor/lib/editor-media-picker.js +0 -1
- package/dist/editor/lib/editor-page-lock.d.ts +0 -1
- package/dist/editor/lib/editor-page-lock.js +0 -1
- package/dist/editor/lib/editor-screen.d.ts +0 -2
- package/dist/editor/lib/editor-screen.js +0 -1
- package/dist/editor/lib/editor-section-templates.d.ts +0 -1
- package/dist/editor/lib/editor-section-templates.js +0 -1
- package/dist/editor/lib/editor-session-context.d.ts +0 -1
- package/dist/editor/lib/editor-session-context.js +0 -1
- package/dist/editor/lib/editor-theme.d.ts +0 -1
- package/dist/editor/lib/editor-theme.js +0 -1
- package/dist/editor/lib/puck/block-choice.d.ts +0 -2
- package/dist/editor/lib/puck/block-choice.js +0 -1
- package/dist/editor/lib/puck/block-types-in.d.ts +0 -1
- package/dist/editor/lib/puck/block-types-in.js +0 -1
- package/dist/editor/lib/puck/device-fields.d.ts +0 -2
- package/dist/editor/lib/puck/device-fields.js +0 -1
- package/dist/editor/lib/puck/field-buckets.d.ts +0 -2
- package/dist/editor/lib/puck/field-buckets.js +0 -1
- package/dist/editor/lib/puck/field-markers.d.ts +0 -2
- package/dist/editor/lib/puck/field-markers.js +0 -1
- package/dist/editor/lib/puck/palette-sections.d.ts +0 -2
- package/dist/editor/lib/puck/palette-sections.js +0 -1
- package/dist/editor/lib/puck/panel-fields.d.ts +0 -2
- package/dist/editor/lib/puck/panel-fields.js +0 -1
- package/dist/editor/lib/puck/panel-no-control-mark.d.ts +0 -2
- package/dist/editor/lib/puck/panel-no-control-mark.js +0 -1
- package/dist/editor/lib/puck/preview-click.d.ts +0 -1
- package/dist/editor/lib/puck/preview-click.js +0 -1
- package/dist/editor/lib/puck/preview-dom.d.ts +0 -1
- package/dist/editor/lib/puck/preview-dom.js +0 -1
- package/dist/editor/lib/puck/section-doc.d.ts +0 -1
- package/dist/editor/lib/puck/section-doc.js +0 -1
- package/dist/editor/lib/puck/slot-heal.d.ts +0 -1
- package/dist/editor/lib/puck/slot-heal.js +0 -1
- package/dist/editor/lib/puck/style-clipboard.d.ts +0 -1
- package/dist/editor/lib/puck/style-clipboard.js +0 -1
- package/dist/editor/lib/puck/tree-reveal.d.ts +0 -1
- package/dist/editor/lib/puck/tree-reveal.js +0 -1
- package/dist/editor/lib/puck/use-section-ops.d.ts +0 -2
- package/dist/editor/lib/puck/use-section-ops.js +0 -1
- package/dist/format/lib/editor-document-contract.d.ts +0 -1
- package/dist/format/lib/editor-document-contract.js +0 -0
- package/dist/format/lib/editor-document-hooks.d.ts +0 -1
- package/dist/format/lib/editor-document-hooks.js +0 -0
- package/dist/format/lib/links/link-filters.d.ts +0 -1
- package/dist/format/lib/links/link-filters.js +0 -0
- package/dist/format/lib/puck/add-target-types.d.ts +0 -1
- package/dist/format/lib/puck/add-target-types.js +0 -0
- package/dist/format/lib/puck/slot-section-spec.d.ts +0 -1
- package/dist/format/lib/puck/slot-section-spec.js +0 -0
- package/dist/format/lib/section-template-types.d.ts +0 -1
- package/dist/format/lib/section-template-types.js +0 -0
- package/dist/render/components/PreviewDeviceContext.d.ts +0 -2
- package/dist/render/components/PreviewDeviceContext.js +0 -1
- package/dist/render/components/UiIcon.d.ts +0 -2
- package/dist/render/components/UiIcon.js +0 -1
- package/dist/render/lib/content/view-tiers.d.ts +0 -2
- package/dist/render/lib/content/view-tiers.js +0 -1
- package/dist/render/lib/editor-session.d.ts +0 -2
- package/dist/render/lib/editor-session.js +0 -1
- package/dist/render/lib/puck/content-tree.d.ts +0 -2
- package/dist/render/lib/puck/content-tree.js +0 -1
- package/dist/render/lib/puck/hidable.d.ts +0 -2
- package/dist/render/lib/puck/hidable.js +0 -1
- package/dist/render/lib/puck/slot-child-name.d.ts +0 -2
- package/dist/render/lib/puck/slot-child-name.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 31.0.0 - 2026-10-21
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **BREAKING: the 63 easel re-export modules are deleted** (SSOT, harness DUP-1). From 23.0.0 each module that moved into `efficient-easel/screen` kept its old path here (`editor/lib/editor-host`, `render/components/PreviewDeviceContext`, `render/lib/content/view-tiers`, …) as a re-export of its easel subpath. Those paths are gone from every side (`editor/`, `render/`, `format/`). A host imports each name from its easel subpath; the list of old path to easel subpath is `MOVED` in `scripts/test-screen-in-easel.mjs`. Every known host moved first: efficient-storefront-blocks (#129, #136), efficient-storefront (#1714) and this repository. No admin, portal, easel, shell or CLI file named one. No stored value, page, setting or pixel changes: only import paths go.
|
|
10
|
+
- The builder's own files import easel directly too (105 files).
|
|
11
|
+
- Six modules still pass an `efficient-easel/screen` name through beside their own code, because hosts import those names from here: `lib/web-backend` (`WebsiteBackendError` and the host failure names), `lib/puck/slot-specs`, `lib/puck/add-palette`, `lib/puck/add-target`, `lib/puck/footer-blocks` and `lib/puck/pinned-seed-gate`. They stay in this release.
|
|
12
|
+
|
|
13
|
+
### Guards
|
|
14
|
+
|
|
15
|
+
- `scripts/test-screen-in-easel.mjs` (red first): none of the 63 paths has a file; no file in `src/` holds only re-exports of efficient-easel; a screen name passes through only where its `PASS_THROUGH` list says (exact, it only shrinks). It failed on main with the 63 files named.
|
|
16
|
+
- `scripts/test-draw-imports.ts` read the names taken through a shim; with no shim left it reads the direct `efficient-easel/screen/…` imports: a name the `draw` entries export comes from `efficient-easel/draw`. It has a check that it can fail.
|
|
17
|
+
- `scripts/test-panel-colour-tokens.ts` no longer skips the shims, and `scripts/test-one-editable-list.tsx` reads at least 290 `.tsx` files (296 are left).
|
|
18
|
+
- The guards that load easel at run time take it with `require`, not `import()`: a guard is CommonJS, and an `import()` of easel loads its second (ESM) copy, whose React contexts are not the builder's.
|
|
19
|
+
|
|
5
20
|
## 30.1.2 - 2026-10-21
|
|
6
21
|
|
|
7
22
|
### Fixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as l}from"react/jsx-runtime";import{useCallback as u,useEffect as a,useRef as m,useState as f}from"react";import{useEasel as C}from"efficient-easel/easel";import{SettingsAction as d}from"efficient-easel/panel";import{say as y}from"../../format/lib/editor-words.js";import{applyCorners as A,applyCornersDoneLabel as S,applyCornersNote as b,planApplyCorners as _}from"../lib/puck/apply-card-corners.js";import{useSectionOps as x}from"
|
|
1
|
+
"use client";import{jsx as l}from"react/jsx-runtime";import{useCallback as u,useEffect as a,useRef as m,useState as f}from"react";import{useEasel as C}from"efficient-easel/easel";import{SettingsAction as d}from"efficient-easel/panel";import{say as y}from"../../format/lib/editor-words.js";import{applyCorners as A,applyCornersDoneLabel as S,applyCornersNote as b,planApplyCorners as _}from"../lib/puck/apply-card-corners.js";import{useSectionOps as x}from"efficient-easel/screen/lib/puck/use-section-ops";const E=2200,L="apply-corners-to-siblings",P="Apply to all cards";function N({plan:e,doneCount:n,onPress:r}){return l(d,{id:L,label:y(P),note:b(e),disabled:!e.can,done:n!==null,doneLabel:S(n??0),onPress:r})}function O(){const{appState:e,config:n}=C(i=>i),r=x(),[p,s]=f(null),o=m(null);a(()=>()=>{o.current&&clearTimeout(o.current)},[]);const t=_(n,e.data.content??[],e.ui.itemSelector),c=u(()=>{A(t,r.replaceComponent),t.can&&(s(t.others),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(null),E))},[t,r]);return l(N,{plan:t,doneCount:p,onPress:c})}export{E as APPLY_CORNERS_DONE_MS,P as APPLY_CORNERS_LABEL,N as ApplyCornersButton,O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,Fragment as i,jsxs as B}from"react/jsx-runtime";import{useContext as P}from"react";import{SettingsField as
|
|
1
|
+
"use client";import{jsx as o,Fragment as i,jsxs as B}from"react/jsx-runtime";import{useContext as P}from"react";import{SettingsField as d}from"efficient-easel/panel";import{FieldSelect as g}from"efficient-easel/fields";import{BlogPostIcon as f}from"efficient-easel/icons";import{ScreenDocumentContext as L}from"efficient-easel/screen/components/ScreenDocumentContext";import{loadStorefrontBlogPosts as N}from"./useStorefrontBlogPosts.js";import{useSnapshotSource as C}from"./useSnapshotSource.js";import D from"./SourceStatus.js";import{say as t}from"../../format/lib/editor-words.js";function F(e){if(!e)return"";const n=new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleDateString("en-US",{year:"numeric",month:"short",day:"2-digit"})}function h(e){return{slug:e.slug,image:e.coverImage,title:e.title,dek:e.excerpt,date:F(e.publishedAt),href:e.href}}function T({value:e,onChange:n}){const r=P(L);return r&&!r.capabilities.hasBlog?e?.slug?o(j,{value:e,onChange:n}):o(i,{}):o(w,{value:e,onChange:n})}function j({value:e,onChange:n}){return o("div",{children:o(d,{label:t("Blog post source"),icon:o(f,{}),hint:o(i,{children:t("Linked to a blog post. This editor has no blog to pick another from; choose “None (manual)” to author the section yourself.")}),children:o(g,{value:e.slug,ariaLabel:t("Blog post source"),onChange:r=>r?void 0:n(null),options:[{label:t("None (manual)"),value:""},{label:e.title||e.slug,value:e.slug}]})})})}function w({value:e,onChange:n}){const{rows:r,loading:p,refreshing:a,errored:m,refresh:b}=C({load:N,resolve:(s,l)=>s.find(c=>c.slug===l.slug),snapshot:h,value:e,onChange:n}),S=s=>{if(!s){n(null);return}const l=(r??[]).find(c=>c.slug===s);l&&n(h(l))},k=e?.slug&&!(r??[]).some(s=>s.slug===e.slug),y=m?"error":a?"loading":"idle",u=t("Storefront → Blog"),x=m?t("Couldn’t reach {place}.",{place:u}):a?t("Syncing from {place}…",{place:u}):t("Linked to “{name}”",{name:e?.title||e?.slug||""});return B("div",{children:[o(d,{label:t("Blog post source"),icon:o(f,{}),hint:e?.slug?void 0:o(i,{children:t("Pick a post from {place} to auto-fill this section, or keep “None (manual)” to author it yourself below.",{place:u})}),children:o(g,{value:e?.slug??"",ariaLabel:t("Blog post source"),onChange:S,readOnly:p,options:[{label:t("None (manual)"),value:""},...k?[{label:t("{name} (unavailable)",{name:e.title||e.slug}),value:e.slug}]:[],...(r??[]).map(s=>({label:s.title,value:s.slug}))]})}),e?.slug?o(D,{status:y,statusText:x,onRefresh:b,busy:a,hint:o(i,{children:t("Auto-fills the cover image, headline, dek, date and link from this post each time you open the editor. Those fields are hidden while a post is linked; the remaining fields stay yours to set.")})}):null]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as g,Fragment as A}from"react/jsx-runtime";import{useCallback as L,useRef as z,useState as s}from"react";import{InspectorIconButton as W}from"efficient-easel/chrome";import{PopupMenu as H,PopupMenuItem as Y,PopupMenuLabel as a}from"efficient-shell/ui";import{CopyToPageIcon as $}from"efficient-easel/icons";import{backendOf as M}from"../lib/website-session.js";import{
|
|
1
|
+
"use client";import{jsx as t,jsxs as g,Fragment as A}from"react/jsx-runtime";import{useCallback as L,useRef as z,useState as s}from"react";import{InspectorIconButton as W}from"efficient-easel/chrome";import{PopupMenu as H,PopupMenuItem as Y,PopupMenuLabel as a}from"efficient-shell/ui";import{CopyToPageIcon as $}from"efficient-easel/icons";import{backendOf as M}from"../lib/website-session.js";import{useEaselSession as q}from"efficient-easel/screen/lib/session-context";import{say as n}from"../../format/lib/editor-words.js";import{cloneNodeWithFreshIds as G}from"efficient-easel/screen/lib/puck/section-doc";import{FOOTER_TYPE as J}from"efficient-easel/draw";function K({node:N,currentSlug:T,siteId:i,tokenRef:h,runAuthed:D,onNotify:I}){const[c,r]=s(!1),[y,x]=s(null),o=q(),[S,u]=s(!1),[d,b]=s(null),P=z(null),[p,j]=s(null),B=L(async()=>{if(o.usesBridgedToken&&!h.current){u(!0);return}try{x(await M(o).pages.list(i?{siteId:i}:void 0))}catch{u(!0)}},[h,i,o]),F=()=>{if(c){r(!1);return}const e=P.current?.getBoundingClientRect();e&&j({top:e.bottom+6,right:Math.max(8,window.innerWidth-e.right)}),x(null),u(!1),B(),r(!0)},k=(y??[]).filter(e=>e.slug!==T),O=async e=>{if(d)return;b(e.slug);const w=G(N),R=o.documentHooks?.storedNode?.(w)??w,C=M(o).pages,E=await D(async()=>{const m=await C.load({id:e.id});if(!m)throw new Error(`Page "${e.slug}" no longer exists.`);const f=m.layout??{},l=Array.isArray(f.content)?[...f.content]:[],v=l.findIndex(_=>_?.type===J);l.splice(v===-1?l.length:v,0,R),await C.save(e.id,{layout:{root:{},zones:{},...f,content:l}},{version:m.version,clientId:""})});b(null),r(!1),I?.(E?n("Duplicated to “{name}”",{name:e.label}):n("Couldn’t duplicate the section — please retry"),E?"success":"error")};return g(A,{children:[t("span",{"data-menu-toggle":!0,style:{display:"contents"},children:t(W,{buttonRef:P,label:n("Duplicate to another page"),hasPopup:"menu",expanded:c,onClick:F,children:t($,{size:15})})}),c&&p&&t(H,{portal:!0,style:{top:p.top,right:p.right},onClose:()=>r(!1),children:g("div",{role:"menu","aria-label":n("Duplicate to page"),children:[t(a,{children:n("Duplicate to page")}),S?t(a,{children:n("Couldn’t load pages")}):y===null?t(a,{children:n("Loading…")}):k.length===0?t(a,{children:n("No other pages")}):k.map(e=>g(Y,{role:"menuitem",disabled:d!==null,onClick:()=>{O(e)},children:[t("span",{className:"min-w-0 flex-1 truncate",children:e.label}),d===e.slug?t("span",{className:"shrink-0 text-xs",children:n("Copying…")}):e.draft&&t("span",{className:"shrink-0 text-xs",children:n("draft")})]},e.id))]})})]})}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as O,jsxs as f}from"react/jsx-runtime";import{useId as $,useState as V}from"react";import{InspectorUpLevel as I}from"efficient-easel/chrome";import{useEasel as Y}from"efficient-easel/easel";import{ListField as E}from"efficient-easel/fields";import{SettingsField as F}from"efficient-easel/panel";import{ClockIcon as G,ContrastIcon as Z,GlobeIcon as J,LinkIcon as Q,LocationIcon as X,PhoneIcon as K,SquareIcon as ee,TypeIcon as A}from"efficient-easel/icons";import ne from"./MediaUploadField.js";import{useLocationsHasTree as te}from"./LocationsTreeContext.js";import{say as n,sayCount as H}from"../../format/lib/editor-words.js";import{CoordsField as oe}from"../lib/puck/controls.js";import{useLocationsFocus as ie,setLocationsFocus as v}from"../lib/puck/locations-focus.js";import{groupKeyOf as k,groupLabelOf as re,NEW_CITY as W,writeGroupCities as le,writeGroupOrder as ae}from"../../format/lib/puck/locations-tree.js";import{useSectionOps as se}from"
|
|
1
|
+
"use client";import{jsx as e,Fragment as O,jsxs as f}from"react/jsx-runtime";import{useId as $,useState as V}from"react";import{InspectorUpLevel as I}from"efficient-easel/chrome";import{useEasel as Y}from"efficient-easel/easel";import{ListField as E}from"efficient-easel/fields";import{SettingsField as F}from"efficient-easel/panel";import{ClockIcon as G,ContrastIcon as Z,GlobeIcon as J,LinkIcon as Q,LocationIcon as X,PhoneIcon as K,SquareIcon as ee,TypeIcon as A}from"efficient-easel/icons";import ne from"./MediaUploadField.js";import{useLocationsHasTree as te}from"./LocationsTreeContext.js";import{say as n,sayCount as H}from"../../format/lib/editor-words.js";import{CoordsField as oe}from"../lib/puck/controls.js";import{useLocationsFocus as ie,setLocationsFocus as v}from"../lib/puck/locations-focus.js";import{groupKeyOf as k,groupLabelOf as re,NEW_CITY as W,writeGroupCities as le,writeGroupOrder as ae}from"../../format/lib/puck/locations-tree.js";import{useSectionOps as se}from"efficient-easel/screen/lib/puck/use-section-ops";import{ROOT_ZONE as ce}from"efficient-easel/draw";import{CONTACT_LOCATIONS_DEFAULTS as _,parseLocationTileShape as de}from"../../format/lib/content/contact.js";const D=(a,t)=>t||a?re(a,t):n("Ungrouped");function pe(a){const t=[];return a.forEach((c,r)=>{const m=k(c);let s=t.find(i=>i.key===m);s||(s={key:m,name:String(c?.groupName??""),indices:[]},t.push(s)),s.indices.push(r)}),t}function z({children:a}){return e("div",{style:{fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--fg-dim, #999)",margin:"14px 0 6px"},children:a})}const R={width:"100%",height:32,textAlign:"left",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,padding:"0 12px",fontSize:12,border:"1px solid var(--border-strong, #d0d0d0)",borderRadius:6,background:"transparent",color:"inherit",cursor:"inherit"},ue={padding:0,border:"none",background:"none",font:"inherit",fontSize:12,color:"var(--sf-accent, #2563eb)",cursor:"pointer"},B={...ue,color:"#d85a30"};function b({label:a,value:t,placeholder:c,textarea:r,icon:m,onChange:s,onBlur:i,onKeyDown:h}){const x=$();return e(F,{label:a,icon:m??e(A,{}),htmlFor:x,children:r?e("textarea",{id:x,value:t,placeholder:c,onChange:g=>s(g.target.value)}):e("input",{id:x,type:"text",value:t,placeholder:c,onChange:g=>s(g.target.value),onBlur:i,onKeyDown:h})})}const me=[{label:"Auto",value:"auto"},{label:"Dark",value:"dark"},{label:"Light",value:"light"}],he=[{label:"Tall (3:4)",value:"tall"},{label:"Square",value:"square"},{label:"Wide (2:1)",value:"wide"}];function M({label:a,icon:t,options:c,value:r,onChange:m}){return e(F,{label:a,icon:t,children:e("div",{role:"group","aria-label":a,style:{display:"flex",gap:4,flex:1},children:c.map(s=>{const i=r===s.value;return e("button",{type:"button","aria-pressed":i,onClick:()=>m(s.value),style:{flex:1,padding:"6px 8px",fontSize:12,borderRadius:6,cursor:"pointer",border:`1px solid ${i?"var(--sf-accent, #2563eb)":"var(--border-strong, #d0d0d0)"}`,background:i?"var(--sf-accent, #2563eb)":"transparent",color:i?"#fff":"inherit",fontWeight:i?500:400},children:n(s.label)},s.value)})})})}function P({props:a,setSection:t,headOnly:c}){const r=i=>String(a[i]??""),m=a.mapTheme||_.mapTheme,s=_;return f(O,{children:[!c&&e(z,{children:n("Section")}),e(b,{label:n("Section number"),value:r("sectionNumber"),placeholder:s.sectionNumber,onChange:i=>t({sectionNumber:i})}),e(b,{label:n("Heading"),textarea:!0,value:r("heading"),placeholder:s.heading,onChange:i=>t({heading:i})}),e(b,{label:n("Body"),textarea:!0,value:r("tagline"),placeholder:s.tagline,onChange:i=>t({tagline:i})}),c?null:f(O,{children:[e(z,{children:n("City strip")}),e(b,{label:n("Eyebrow"),value:r("galleryKicker"),placeholder:s.galleryKicker,onChange:i=>t({galleryKicker:i})}),e(b,{label:n("Hint"),value:r("galleryHint"),placeholder:s.galleryHint,onChange:i=>t({galleryHint:i})}),e(M,{label:n("Shape"),icon:e(ee,{}),options:he,value:de(a.imageShape),onChange:i=>t({imageShape:i})}),e(z,{children:n("Map & Theme")}),e(M,{label:n("Map theme"),icon:e(Z,{}),options:me,value:m,onChange:i=>t({mapTheme:i})})]})]})}function ge({cards:a,groupKey:t,onChange:c,onBack:r,onOpenCity:m,onNavigate:s}){const i=a.map((l,u)=>k(l)===t?u:-1).filter(l=>l>=0),h=String(a[i[0]]?.groupName??""),x=new Set(a.map(k).filter(l=>l!==t)),[g,w]=V(t),C=l=>c(a.map(u=>k(u)===t?{...u,...l}:u)),L=()=>{const l=g;if(l!==t){if(x.has(l)){w(t);return}c(a.map(u=>k(u)===t?{...u,group:l}:u)),s(l)}};return f("div",{className:"sf-locations-view",children:[e(I,{inline:!0,name:n("Section"),onSelect:r}),e("div",{style:{fontSize:14,fontWeight:500,margin:"6px 0 10px"},children:D(t,h)}),e(b,{label:n("Group heading"),value:g,placeholder:n("e.g. Americas"),onChange:w,onBlur:L,onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur()}}),x.has(g)&&g!==t&&e("p",{className:"sf-note sf-note--error",role:"alert",children:n("Another group already uses this heading — pick a different one.")}),e(b,{label:n("Group name"),value:h,placeholder:n("Shown beside the heading"),onChange:l=>C({groupName:l})}),e(E,{label:n("Cities in this group"),noun:n("city"),items:i.map(l=>a[l]),onChange:l=>c(le(a,t,l)),newItem:()=>({...W,group:t,groupName:h}),open:null,onOpen:()=>{},renderItem:()=>null,removeOnRow:!1,canDuplicate:()=>!1,renderRow:(l,u)=>f("button",{type:"button",style:R,onClick:()=>m(i[u]),children:[e("span",{children:l?.name||n("City")}),e("span",{"aria-hidden":"true",children:"›"})]})}),e("div",{style:{marginTop:12},children:e("button",{type:"button",style:B,onClick:()=>{c(a.filter(l=>k(l)!==t)),r()},children:H("Delete group ({n} city)","Delete group ({n} cities)",i.length)})})]})}function fe({value:a,onChange:t}){const c=Array.isArray(a)?a:[],r=ie(),m=te(),s=pe(c),{appState:i,selectedItem:h}=Y(o=>o),x=se(),g=h?.props??{},w=o=>{if(!h)return;const p=(i.data.content??[]).findIndex(y=>y.props.id===h.props.id);p<0||x.replaceComponent(ce,p,{type:h.type,props:{...h.props,...o}})},C=(o,d)=>t(c.map((p,y)=>y===o?{...p,...d}:p)),L=()=>{const o=new Set(s.map(y=>y.key));let d=s.length+1,p=`Group ${d}`;for(;o.has(p);)p=`Group ${++d}`;return p};if(r.level==="texts")return f("div",{className:"sf-locations-view",children:[e(I,{inline:!0,name:n("Locations"),onSelect:()=>v({level:"groups"})}),e("div",{style:{fontSize:14,fontWeight:500,margin:"6px 0 10px"},children:n("Texts")}),e(P,{props:g,setSection:w,headOnly:!0})]});if(r.level==="image"){const o=c[r.index];return o?f("div",{className:"sf-locations-view",children:[e(I,{inline:!0,name:String(o.name??"")||n("City"),onSelect:()=>v({level:"city",index:r.index})}),e("div",{style:{fontSize:14,fontWeight:500,margin:"6px 0 10px"},children:n("Image")}),e(ne,{value:o.photo||"",onChange:d=>C(r.index,{photo:d}),label:"Image",accept:"image/*"})]}):l()}if(r.level==="map"){const o=c[r.index];return o?f("div",{className:"sf-locations-view",children:[e(I,{inline:!0,name:String(o.name??"")||n("City"),onSelect:()=>v({level:"city",index:r.index})}),e("div",{style:{fontSize:14,fontWeight:500,margin:"6px 0 10px"},children:n("Map")}),e(oe,{value:o.geocode,onChange:d=>C(r.index,{geocode:d}),label:"Coordinates"}),e(b,{label:n("Directions link"),icon:e(Q,{}),value:String(o.mapsUrl??""),onChange:d=>C(r.index,{mapsUrl:d})})]}):l()}if(r.level==="city"){const o=r.index,d=c[o];if(!d)return l();const p=k(d),y=(T,N)=>C(o,{[T]:N}),S=(T,N,U,j=!1)=>e(b,{label:N,icon:U,textarea:j,value:String(d[T]??""),onChange:q=>y(T,q)});return f("div",{className:"sf-locations-view",children:[e(I,{inline:!0,name:D(p,String(d.groupName??"")),onSelect:()=>v({level:"group",key:p})}),e("div",{style:{fontSize:14,fontWeight:500,margin:"6px 0 10px"},children:d.name||n("City")}),S("name",n("Location name"),e(A,{})),S("state",n("State / Province"),e(A,{})),S("country",n("Country"),e(J,{})),S("address",n("Address"),e(X,{}),!0),S("phone",n("Phone"),e(K,{})),S("hours",n("Opening hours"),e(G,{})),S("timezone",n("Timezone chip"),e(G,{})),e("div",{style:{marginTop:12},children:e("button",{type:"button",style:B,onClick:()=>{t(c.filter((T,N)=>N!==o)),v({level:"group",key:p})},children:n("Delete city")})})]})}if(r.level==="group")return s.some(o=>o.key===r.key)?e(ge,{cards:c,groupKey:r.key,onChange:t,onBack:()=>v({level:"groups"}),onOpenCity:o=>v({level:"city",index:o}),onNavigate:o=>v({level:"group",key:o})},r.key):l();function l(){return f("div",{className:"sf-locations-view",children:[e(P,{props:g,setSection:w}),!m&&e(O,{children:u()})]})}function u(){return e(E,{label:n("Locations"),noun:n("group"),items:s,onChange:o=>{const d=o.find(p=>!s.some(y=>y.key===p.key));t(ae(c,o.map(p=>p.key),p=>[{...W,group:p,groupName:""}])),d&&v({level:"group",key:d.key})},newItem:()=>({key:L(),name:"",indices:[]}),open:null,onOpen:()=>{},renderItem:()=>null,removeOnRow:!1,canDuplicate:()=>!1,above:s.length===0?e("div",{style:{fontSize:12,color:"var(--fg-dim, #999)",padding:"4px 0"},children:n("No locations yet.")}):void 0,renderRow:o=>f("button",{type:"button",style:R,onClick:()=>v({level:"group",key:o.key}),children:[e("span",{style:{fontWeight:500},children:D(o.key,o.name)}),f("span",{style:{color:"var(--fg-dim, #999)"},children:[H("{n} city","{n} cities",o.indices.length)," ›"]})]})})}return l()}export{fe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{SettingsDefaultReset as x,SettingsField as v}from"efficient-easel/panel";import{useSelectedFields as F}from"efficient-easel/easel";import{FOCAL_DEFAULT as b}from"efficient-shell/format";import{ImageIcon as g,PlayIcon as w}from"efficient-easel/icons";import{MediaUploadField as C}from"efficient-shell/ui";import{useContext as y}from"react";import{ScreenDocumentContext as D}from"efficient-easel/screen/components/ScreenDocumentContext";import{editorEaselWords as P,say as l}from"../../format/lib/editor-words.js";import{PHONE_CLEAR as U,phoneKey as I}from"../../format/lib/puck/phone-override.js";import{usePreviewDevice as M}from"efficient-easel/draw/client";import{requestMediaPick as A}from"efficient-easel/screen/lib/media-picker";import{useEaselHost as B}from"efficient-easel/screen/lib/host";import{backendOf as H}from"../lib/website-session.js";import{useEaselSession as L}from"efficient-easel/screen/lib/session-context";function O(o,d){let e=null;try{e=F()}catch{e=null}const n=M()==="mobile";if(!o||!e||d&&!d(e.values??{}))return null;const a=typeof e.values?.[o]=="string"&&e.values[o]?String(e.values[o]):b,i=I(o),c=typeof e.values?.[i]=="string"&&e.values[i]?String(e.values[i]):void 0,m=e.onChange;return{phone:n,desktop:a,own:c,focus:n?c??a:a,set:u=>m(n?i:o,u),clear:()=>m(i,U)}}function R({value:o,onChange:d,label:e,accept:n,placeholder:a,focusKey:i,focusWhen:c}){const m=B(),u=L(),p=l(e),r=n.startsWith("video"),s=O(r?void 0:i,c),f=y(D),E=h=>A(m,{accept:n,title:p,...h?{file:h}:{}}).then(k=>k?.url??null);if(f&&!f.capabilities.mediaEditing)return t(v,{label:p,icon:r?t(w,{}):t(g,{}),children:t("div",{className:"sf-image-slot-inert",children:r?l("Templates don’t store videos — this slot stays a placeholder. Each website picks its own after it’s created."):l("Templates don’t store images — this slot stays a placeholder. Each website picks its own after it’s created.")})});const S=s?.phone&&o?t(x,{words:P()?.panel,label:l("Image focus"),changed:!!s.own,detail:l("{value} on desktop",{value:s.desktop}),onReset:s.clear}):void 0;return t(v,{label:p,icon:r?t(w,{}):t(g,{}),action:S,children:t("div",{style:{flex:"1 1 auto",minWidth:0},children:t(C,{value:o,onChange:d,onPick:E,accept:r?"video/*":"image/*",kind:r?"video":"image",placeholder:a===void 0?void 0:l(a),maxSizeBytes:H(u).media.maxUploadBytes,...s?{focus:s.focus,onFocusChange:s.set}:{}})})})}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as K,jsxs as C}from"react/jsx-runtime";import{Fragment as ge,useEffect as fe,useId as he,useMemo as Y,useState as u}from"react";import{
|
|
1
|
+
"use client";import{jsx as n,Fragment as K,jsxs as C}from"react/jsx-runtime";import{Fragment as ge,useEffect as fe,useId as he,useMemo as Y,useState as u}from"react";import{useScreenDocument as be}from"efficient-easel/screen/components/ScreenDocumentContext";import{UiIcon as I}from"efficient-easel/draw/client";import ye from"efficient-easel/screen/components/SidePanelHead";import{useWebsiteName as we}from"./WebsiteSettingsPanel.js";import{InspectorIconButton as Pe}from"efficient-easel/chrome";import{Button as J,Dialog as Se,FormField as ke,Input as Q,toast as V}from"efficient-shell/ui";import{LayersTree as Ce,TreeGroupLabel as Ie,TreeRow as X,TreeRowAction as F}from"efficient-easel/tree";import{AddIcon as Ae,PageIcon as Re}from"efficient-easel/icons";import{PagesIcon as Ne}from"efficient-easel/rail";import{useEaselHost as xe}from"efficient-easel/screen/lib/host";import{bucketEditorPageRows as Ee,DYNAMIC_PAGES_GROUP_KEY as ve,isDynamicPageRow as De,MAIN_PAGES_GROUP as Le}from"../../format/lib/editor-page-rows.js";import{useEaselSession as Fe}from"efficient-easel/screen/lib/session-context";import{holdPageRow as O,usePageRows as Oe}from"../lib/page-rows.js";import{say as t}from"../../format/lib/editor-words.js";const Z="sf-editor-pages-collapsed-groups",_e=r=>r.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),ee=(r,b)=>{const d=_e(r)||"page";if(!b.has(d))return d;let m=2;for(;b.has(`${d}-${m}`);)m+=1;return`${d}-${m}`};function ze({onNavigate:r,onClose:b,activeSurface:d,onPreviewSurface:m}){const y=Fe().chrome?.pageRows,_=xe(),{adapter:A,capabilities:p,ready:z,currentSlug:G}=be(),te=we(),{rows:c,reload:ne,setRows:B,getRows:se}=Oe(),[R,ae]=u(""),[g,H]=u(!1),[w,P]=u(null),[M,S]=u(!1),[f,N]=u(""),T=he(),[x,oe]=u(()=>{if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(Z);return new Set(e?JSON.parse(e):[])}catch{return new Set}});fe(()=>{try{window.localStorage.setItem(Z,JSON.stringify([...x]))}catch{}},[x]);const le=e=>oe(a=>{const s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s}),re=Y(()=>Ee(c??[]),[c]),E=R.trim().toLowerCase(),U=e=>!E||e.toLowerCase().includes(E),ie=e=>E?!0:!x.has(e),W=Y(()=>new Set((c??[]).map(e=>e.slug)),[c]),de=()=>{if(p.pageCreationInAdminForm){_.send("storefront-editor:new-page");return}N(""),P(null),S(!0)},$=async()=>{const e=f.trim();if(!(!e||!z||g||!A.createPage)){H(!0),P(null);try{const a=await A.createPage({slug:ee(e,W),title:e,layout:{}});await ne(),S(!1),N(""),r(a.slug)}catch{P(t("Couldn’t add the page — please retry."))}finally{H(!1)}}},ce=e=>{const a=c??[],s=A.deletePage;if(!z||g||!s||a.length<=1)return;const l=a.findIndex(o=>o.id===e.id),i=a.filter(o=>o.id!==e.id),h=e.slug===G;O(e.id,!0),B(i),P(null),h&&i[0]&&r(i[0].slug);const k=()=>{O(e.id,!1);const o=se()??[];if(o.some(pe=>pe.id===e.id))return;const L=[...o];L.splice(Math.max(0,Math.min(l,L.length)),0,e),B(L)};V.undoable(t("Deleted “{name}”",{name:e.label}),{actionLabel:t("Undo"),commit:async o=>{await s(e.id,o),O(e.id,!1)},undo:()=>{k(),h&&r(e.slug)},onFail:()=>{k(),V.error(t("Couldn’t delete the page — please retry."))}})},ue=e=>_.send("storefront-editor:open-page",{slug:e}),me=e=>{if(!U(e.label))return null;const a=!d&&e.slug===G,s=p.canDeletePagesInline&&(c??[]).length>1,l=De(e),i=e.kind==="lightbox",h=[...l?[{label:t("Dynamic"),tone:"info"}]:[],...i?[{label:t("Lightbox"),tone:"success"}]:[],...e.draft?[{label:t("draft"),tone:"draft"}]:[]],k=h.length>0?h:void 0,o=p.pageCreationInAdminForm||s?C(K,{children:[p.pageCreationInAdminForm&&n(F,{kind:"plain",label:t("Edit “{name}” in {place}",{name:e.label,place:t("the admin")}),onClick:()=>ue(e.slug),children:n(I,{name:"pencil",size:13,strokeWidth:1.7,rounded:!0})}),s&&n(F,{kind:"delete",label:t("Delete “{name}”",{name:e.label}),disabled:g,onClick:()=>ce(e),children:n(I,{name:"trash",size:13,strokeWidth:1.7,rounded:!0})})]}):void 0;return n(X,{icon:n(Re,{size:14}),name:e.label,selected:a,onSelect:()=>r(e.slug),badge:k,actions:o,rowProps:{"data-page-slug":e.slug}},e.id)},v=(e,a,s)=>{const l=s.filter(Boolean);if(l.length===0)return null;const i=ie(e);return C(ge,{children:[n(Ie,{count:l.length,expanded:i,onToggle:()=>le(e),children:a}),i&&l]},e)},j=(y?.rows??[]).filter(e=>U(e.label)).map(e=>{const a=d===e.key;return n(X,{icon:e.icon,name:e.label,selected:a,onSelect:()=>m(e.key),badge:{label:t("Preview"),tone:"warning"},actions:n(F,{kind:"plain",label:t("Open the {name} in a new tab",{name:e.label}),onClick:()=>window.open(e.href,"_blank","noopener,noreferrer"),children:n(I,{name:"external-link",size:13,strokeWidth:1.7,rounded:!0})}),rowProps:{"data-shop-surface":e.key}},e.key)}),q=p.hasSiteSettings&&!!y,D=(()=>{if(c===null)return null;const e=[];let a=!1;for(const s of re){q&&!a&&s.key.startsWith("system:")&&(e.push(v("shop",y.title,j)),a=!0);const l=s.key===ve||s.label===Le?t(s.label):s.label;e.push(v(s.key,l,s.rows.map(me)))}return q&&!a&&e.push(v("shop",y.title,j)),e})();return C("div",{className:"sf-pages",children:[n(ye,{icon:n(Ne,{}),title:t("Pages"),context:te,actions:n(Pe,{label:t("New page"),onClick:de,children:n(Ae,{size:15})}),onHide:b}),n("div",{className:"sf-pages-find",children:n(Q,{type:"search",leftIcon:n(I,{name:"search",size:14,rounded:!0}),placeholder:t("Search all pages…"),value:R,onChange:e=>ae(e.target.value),"aria-label":t("Search all pages")})}),w&&!M&&n("div",{className:"sf-note sf-note--error",role:"alert",children:w}),D===null?n("div",{className:"sf-note",children:t("Loading…")}):D.some(Boolean)?n(Ce,{ariaLabel:t("Pages"),className:"sf-scroll",children:D}):n("div",{className:"sf-note",children:R.trim()?t("No pages match your search"):t("No pages yet. Add one with + above.")}),n(Se,{open:M,onClose:()=>S(!1),size:"sm",title:t("Add a page"),description:t("Give the new template page a name. It starts blank — add sections once it opens."),footer:C(K,{children:[n(J,{variant:"secondary",onClick:()=>S(!1),children:t("Cancel")}),n(J,{onClick:()=>{$()},disabled:g||!f.trim(),loading:g,children:t("Add page")})]}),children:n(ke,{label:t("Page name"),htmlFor:T,hint:f.trim()?t("URL: /{slug}",{slug:ee(f,W)}):void 0,error:w??void 0,children:n(Q,{id:T,value:f,invalid:!!w,onChange:e=>N(e.target.value),onKeyDown:e=>{e.key==="Enter"&&$()},placeholder:t("e.g. About")})})})]})}export{ze as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as te,jsxs as h}from"react/jsx-runtime";import{useContext as Ye,useEffect as ne,useRef as qe,useState as Ne}from"react";import{PartResetDot as Je}from"./PartResetDot.js";import{FieldSelect as Qe,InspectorField as Ze}from"efficient-easel/fields";import{SettingsField as et}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as tt,TypeIcon as nt}from"efficient-easel/icons";import{useEasel as ot}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as lt}from"efficient-shell/ui";import{PartTextBox as rt,partTextCells as it}from"./PartTextBox.js";import{UiIcon as ke}from"efficient-easel/draw/client";import{usePreviewHeader as at}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as ct}from"./UpdateStyleDialog.js";import{StorefrontDocumentContext as dt}from"./StorefrontDocumentContext.js";import{hasStyleChange as ut,partStyleToTextStyleValues as ft,pushIntoStyle as pt,resolveTextStyles as mt,styleIdOfRole as Ce}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as ht}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as yt}from"../lib/theme-row-persist.js";import{usePreviewDevice as gt}from"efficient-easel/draw/client";import{usePartStyle as St}from"./PreviewPartStyleContext.js";import{say as s}from"../../format/lib/editor-words.js";import{readHidable as U,textFieldOffPage as bt,textFieldPanelOnly as xt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as Pt}from"efficient-easel/draw";import{useSectionOps as wt}from"../lib/puck/use-section-ops.js";import{FONT_OPTIONS as Tt,FONT_ROLES as oe,FONT_ROLE_LABELS as se,fontOption as le}from"../../format/lib/fonts.js";import{isMultilineKind as vt,partPlaceholder as Nt,typeInPlaceKind as kt}from"../../render/lib/puck/part-text.js";import{partRowField as Ct}from"../lib/puck/part-row-field.js";import{decodePartKey as Ot,partPropsWithRowValue as Rt,partRowValue as It}from"../../render/lib/puck/part-rows.js";import{PART_WIDTH_MAX as Et,propsWithPartStyleValue as B,propsWithoutPartStyle as Ft,readPartStyle as Oe}from"../../render/lib/puck/part-styles.js";import{partThemeColors as _t}from"../../format/lib/puck/part-inks.js";import{styleKeyForPart as zt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as At}from"../lib/puck/part-typing.js";import{keysOnCanvas as Vt,useCanvasTypingPart as Lt}from"../lib/puck/canvas-typing.js";import{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 Re}from"../../format/lib/puck/source-bound-parts.js";import{encodePartId as Gt,holdsAuthoredText as Ht}from"../../render/lib/puck/text-parts.js";import{regionsForSection as $t}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as Xt}from"../../format/lib/sections/text-regions.js";function re(n){return n?s(n):null}function Ie(n){return n.kind==="role"?se[n.role]:n.kind==="custom"?"Custom":null}function Yt(n){const o=n.role;return o&&oe.includes(o)?{kind:"role",role:o}:null}function qt(n,o){if(!n)return{kind:"unread"};const{faceRole:l,base:a}=n;if(o[l]===a.fontKey)return{kind:"role",role:l};const i=Object.keys(o).filter(r=>o[r]===a.fontKey);return i.length===1?{kind:"role",role:i[0]}:{kind:"custom"}}function ie(n,o,l,a){return Yt(Oe(n,o))??qt(l,a)}function Jt(n,o){if(!n.length)return null;const l=o(n[0]);return n.every(a=>o(a)===l)?l:null}const D="";function Qt({face:n,base:o,onPick:l}){const a=n.kind==="role"?n.role:D,i=[{label:s("No style"),value:D},...oe.map(r=>({label:s(se[r]),value:r}))];return t(Qe,{ariaLabel:s("Style"),value:a,options:i,inline:!0,onChange:r=>l(r===D?null:r),renderOption:r=>r.value===D?h(te,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:s("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:re(Ie(n))}),valueText:r=>re(Ie(n))??r?.label??""})}function Zt({sectionName:n,onBack:o,textEditor:l,styleRow:a,children:i}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:s(n),onSelect:o}),l,a,i]})}function Ee({source:n,slug:o,menuId:l}){const a=Kt(),i=Bt[n],r=!i.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[s(Ut[n]),r?h(te,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{i.type==="storefront-editor:open-menus"?a.send(i.type,{menuId:l??null}):o&&a.send(i.type,{slug:o})},children:s(Dt)})]}):null]})})}const Fe=4,en=120;function tn({region:n,sizePx:o,face:l,base:a,onFollowStyle:i,source:r,slug:W,onBack:P}){const E=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s(n.label)})}),t("p",{children:o?s("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:s(E),px:Math.round(o)}):s("Its size follows Site styles ▸ {follows}.",{follows:s(E)})}),i?t(te,{children:t(et,{label:s("Style"),icon:t(tt,{}),hint:s("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:s(n.label).toLowerCase()}),children:t(Qt,{face:l,base:a,onPick:i})})}):t("p",{className:"es-field-hint sf-hint-keep",children:s("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(Ee,{source:r,slug:W}):null,t(K,{inline:!0,name:s("Page"),onSelect:P})]})}function nn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part is no longer here.")})}),t("p",{children:s("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function on({onBack:n,partId:o,why:l}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part's settings did not open.")})}),t("p",{children:s("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",l]})}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function sn({nodeId:n,propKey:o,onBack:l,onEditStyle:a}){const{getItemById:i,getSelectorForId:r,config:W}=ot(e=>e),P=wt(),E=Lt(),{partStyle:F}=St(),{fonts:_,textStyles:_e}=at(),M=Ye(dt),ae=!M?.capabilities?.hasSiteTheme,{persist:ze}=yt({themeFromDocument:ae,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),O=ht({themeFromDocument:ae,persist:ze}),[Ae,j]=Ne(!1),Ve=gt()==="mobile",ce=qe(null),d=i(n),m=r(n),de=d?W.components[d.type]:void 0,{key:g,row:S}=Ot(o),ue=de?.fields?.[g],y=S?Ct(ue,S):ue,w=Gt(n,o),p=d?.props??{},b=kt(y),fe=bt(y),pe=Ht(y),Le=d?Mt(d.type):null,me=d?Wt(d.type,g):null,G=S?It(p[g],S):p[g],he=!!S&&!(Array.isArray(p[g])&&S.index<p[g].length);ne(()=>{if(Vt(document))return;ce.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[w]);const[H,ye]=Ne(0);ne(()=>ye(0),[w]);const $=!!d&&!he&&(!m||!y);ne(()=>{if(!$||H>=Fe)return;const e=setTimeout(()=>ye(c=>c+1),en);return()=>clearTimeout(e)},[$,H]);const Ke=$&&H<Fe;if(!d||he)return t(nn,{onBack:l});const z=$t(d.type),ge=z?Xt(z,o):null;if(z&&ge){const e=F?.partId===w?F:null,c=z[ge],f=c.writable===!0&&!!m,I=ee=>{m&&P.replaceComponent(m.zone,m.index,{...d,props:B(p,o,"role",ee)})};return t(tn,{region:c,sizePx:e?.base.sizePx??null,face:ie(p,o,e,_),base:e?.base??null,onFollowStyle:f?I:void 0,source:Le,slug:Re(p),onBack:l})}if(!m||!y)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(on,{onBack:l,partId:w,why:m?"no field":"no selector"});const Se=e=>{P.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!b){const f=S?Rt(p,g,S,e):{...p,[g]:e};f&&Se(f);return}At({node:d,propKey:o,kind:b,zone:m.zone,index:m.index},U(e).text,P.replaceComponent)},Ue=G,T=F?.partId===w?F:null,v=T?.styleOwner,A=v?i(v.owner):null,Y=v&&A?r(v.owner):null,q=!!(v&&A&&Y),N=q?A.props??{}:p,J=q?e=>P.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?v.kind:zt(d?.type,o),k=Oe(N,V),u=[{partKey:V,face:ie(N,V,T,_),sizeGroup:T?.sizeGroup??null,base:T?.base??rn,style:k}],Be=Jt(u,e=>e.sizeGroup),De=_t(T?.inks),R=(e,c)=>{let f=N;for(const I of u)f=B(f,I.partKey,e,c);J(f)},We=e=>R("role",e),be=e=>{let c=N;for(const f of u)for(const[I,ee]of Object.entries(e))c=B(c,f.partKey,I,ee??null);J(c)},Q=b==="text"||b==="textarea",{text:xe,hidden:C}=U(G),L=y?.[Pt]?.label??o,Pe=C?s("Show {label} on the slide",{label:s(L)}):s("Hide {label} on the slide",{label:s(L)}),we=h("div",{className:"sf-field-head",children:[t(nt,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:s(L)}),Q&&t(lt,{content:Pe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":C,"aria-label":Pe,onClick:()=>X({text:xe,hidden:!C}),children:C?t(ke,{name:"eye-off",size:14}):t(ke,{name:"eye",size:14})})})]}),Te=!fe&&pe,Me=!!b&&(xt(y)||fe||C||!pe),ve=ie(N,V,T,_),Z=ve.kind==="role"?ve.role:null,je=Object.entries(k).filter(([e,c])=>e!=="role"&&c!==void 0).length,Ge=()=>{let e=N;for(const c of u){const f=c.style.role;e=Ft(e,c.partKey),f&&(e=B(e,c.partKey,"role",f))}J(e)},x=Ce(Z),He=ut(u[0].style),$e=x?mt(O.saved,O.old).find(e=>e.id===x)?.name??x:"",Xe=()=>{j(!1),x&&(O.write(pt({saved:O.saved,old:O.old,styleId:x,values:ft(u[0].style)}),!0),Ge())};return h(Zt,{sectionName:de?.label??d.type,onBack:l,textEditor:t("div",{ref:ce,className:"sf-part-text",children:Me?t(rt,{text:xe,onTextChange:e=>X(Q?{text:e,hidden:C}:e),multiline:vt(b),markup:b!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:be,colors:De,placeholder:re(Nt(y))??void 0,ariaLabel:s(L),head:we,typedOnCanvas:E===w}):b?Q?we:null:t(Ze,{field:y,name:o,value:Ue,onChange:X,id:`sf-part-${n}-${o}`})}),children:[me&&t(Ee,{source:me,slug:Re(p),menuId:jt(p)}),Te&&t(st,{style:{value:Z??"",options:[{value:"",label:s("No style"),description:s("Section’s own")},...oe.map(e=>({value:e,label:s(se[e]),description:le(_[e])?.label}))],onChange:e=>We(e||null),changed:je>0,onEditStyles:a,onUpdateStyle:x&&He?()=>j(!0):void 0},font:{value:k.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Tt.map(e=>({label:e.label,value:e.key})),onChange:e=>R("font",e||null)},italic:{value:k.italic,styleValue:ln(_e,Z),onChange:e=>R("italic",e??null)},cells:it(u[0].style,u[0].base,be,{phone:Ve}),align:{value:k.align??"",styleValue:u[0].base.align,onChange:e=>R("align",e||null)},letterCase:{value:k.case??"",styleValue:u[0].base.case,onChange:e=>R("case",e||null)}}),Ae&&x&&t(ct,{styleName:$e,onCancel:()=>j(!1),onConfirm:Xe}),Te&&Be===null&&t("p",{className:"es-field-hint sf-hint-keep",children:s("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function ln(n,o){const l=Ce(o);return!l||!Array.isArray(n)?!1:n.find(i=>i?.id===l)?.values?.italic===!0}const rn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:Et};export{Zt as PartPanelBody,Je as PartResetDot,Ee as PartSourceNote,Qt as PartStyleSelect,sn as default,ie as partFace};
|
|
1
|
+
"use client";import{jsx as t,Fragment as te,jsxs as h}from"react/jsx-runtime";import{useContext as Ye,useEffect as ne,useRef as qe,useState as Ne}from"react";import{PartResetDot as Je}from"./PartResetDot.js";import{FieldSelect as Qe,InspectorField as Ze}from"efficient-easel/fields";import{SettingsField as et}from"efficient-easel/panel";import{InspectorUpLevel as K}from"efficient-easel/chrome";import{StylesIcon as tt,TypeIcon as nt}from"efficient-easel/icons";import{useEasel as ot}from"efficient-easel/easel";import{TextPartPanel as st}from"efficient-easel/copy";import{Tooltip as lt}from"efficient-shell/ui";import{PartTextBox as rt,partTextCells as it}from"./PartTextBox.js";import{UiIcon as ke}from"efficient-easel/draw/client";import{usePreviewHeader as at}from"../../render/components/PreviewHeaderContext.js";import{UpdateStyleDialog as ct}from"./UpdateStyleDialog.js";import{ScreenDocumentContext as dt}from"efficient-easel/screen/components/ScreenDocumentContext";import{hasStyleChange as ut,partStyleToTextStyleValues as ft,pushIntoStyle as pt,resolveTextStyles as mt,styleIdOfRole as Ce}from"../lib/site-text-styles.js";import{useSiteTextStylesWriter as ht}from"../lib/site-text-styles-writer.js";import{useThemeRowPersist as yt}from"../lib/theme-row-persist.js";import{usePreviewDevice as gt}from"efficient-easel/draw/client";import{usePartStyle as St}from"./PreviewPartStyleContext.js";import{say as s}from"../../format/lib/editor-words.js";import{readHidable as U,textFieldOffPage as bt,textFieldPanelOnly as xt}from"../lib/puck/controls.js";import{TEXT_FIELD_MARKER as Pt}from"efficient-easel/draw";import{useSectionOps as wt}from"efficient-easel/screen/lib/puck/use-section-ops";import{FONT_OPTIONS as Tt,FONT_ROLES as oe,FONT_ROLE_LABELS as se,fontOption as le}from"../../format/lib/fonts.js";import{isMultilineKind as vt,partPlaceholder as Nt,typeInPlaceKind as kt}from"../../render/lib/puck/part-text.js";import{partRowField as Ct}from"../lib/puck/part-row-field.js";import{decodePartKey as Ot,partPropsWithRowValue as Rt,partRowValue as It}from"../../render/lib/puck/part-rows.js";import{PART_WIDTH_MAX as Et,propsWithPartStyleValue as B,propsWithoutPartStyle as Ft,readPartStyle as Oe}from"../../render/lib/puck/part-styles.js";import{partThemeColors as _t}from"../../format/lib/puck/part-inks.js";import{styleKeyForPart as zt}from"../../format/lib/sections/section-text-kinds.js";import{commitPartText as At}from"../lib/puck/part-typing.js";import{keysOnCanvas as Vt,useCanvasTypingPart as Lt}from"../lib/puck/canvas-typing.js";import{useEaselHost as Kt}from"efficient-easel/screen/lib/host";import{SOURCE_LINES as Ut,SOURCE_ACTIONS as Bt,SOURCE_ACTION_LABEL as Dt,partSourceNoteFor as Wt,partSourceOf as Mt,sourceMenuIdOf as jt,sourceSlugOf as Re}from"../../format/lib/puck/source-bound-parts.js";import{encodePartId as Gt,holdsAuthoredText as Ht}from"../../render/lib/puck/text-parts.js";import{regionsForSection as $t}from"../../format/lib/sections/section-text-regions.js";import{textRegionOfPartKey as Xt}from"../../format/lib/sections/text-regions.js";function re(n){return n?s(n):null}function Ie(n){return n.kind==="role"?se[n.role]:n.kind==="custom"?"Custom":null}function Yt(n){const o=n.role;return o&&oe.includes(o)?{kind:"role",role:o}:null}function qt(n,o){if(!n)return{kind:"unread"};const{faceRole:l,base:a}=n;if(o[l]===a.fontKey)return{kind:"role",role:l};const i=Object.keys(o).filter(r=>o[r]===a.fontKey);return i.length===1?{kind:"role",role:i[0]}:{kind:"custom"}}function ie(n,o,l,a){return Yt(Oe(n,o))??qt(l,a)}function Jt(n,o){if(!n.length)return null;const l=o(n[0]);return n.every(a=>o(a)===l)?l:null}const D="";function Qt({face:n,base:o,onPick:l}){const a=n.kind==="role"?n.role:D,i=[{label:s("No style"),value:D},...oe.map(r=>({label:s(se[r]),value:r}))];return t(Qe,{ariaLabel:s("Style"),value:a,options:i,inline:!0,onChange:r=>l(r===D?null:r),renderOption:r=>r.value===D?h(te,{children:[t("span",{className:"es-fsel-label sf-part-style-keep",children:r.label}),t("span",{className:"sf-part-style-aside","aria-hidden":"true",children:s("Section’s own")})]}):t("span",{className:"es-fsel-label",style:{fontFamily:`var(--font-role-${r.value})`},children:r.label}),renderValue:()=>t("span",{style:{fontFamily:o?.fontKey?`var(${le(o.fontKey)?.cssVar})`:void 0,fontWeight:o?.weight},children:re(Ie(n))}),valueText:r=>re(Ie(n))??r?.label??""})}function Zt({sectionName:n,onBack:o,textEditor:l,styleRow:a,children:i}){return h("div",{className:"sf-part-panel",children:[t(K,{inline:!0,name:s(n),onSelect:o}),l,a,i]})}function Ee({source:n,slug:o,menuId:l}){const a=Kt(),i=Bt[n],r=!i.needsSlug||!!o;return t("div",{className:"sf-note sf-note--source",children:h("p",{className:"es-field-hint sf-hint-keep",children:[s(Ut[n]),r?h(te,{children:[" ",t("button",{type:"button",className:"sf-source-open",onClick:()=>{i.type==="storefront-editor:open-menus"?a.send(i.type,{menuId:l??null}):o&&a.send(i.type,{slug:o})},children:s(Dt)})]}):null]})})}const Fe=4,en=120;function tn({region:n,sizePx:o,face:l,base:a,onFollowStyle:i,source:r,slug:W,onBack:P}){const E=n.follows;return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s(n.label)})}),t("p",{children:o?s("Its size follows Site styles ▸ {follows} — {px}px right now.",{follows:s(E),px:Math.round(o)}):s("Its size follows Site styles ▸ {follows}.",{follows:s(E)})}),i?t(te,{children:t(et,{label:s("Style"),icon:t(tt,{}),hint:s("Every {part} in this section follows it. The face and the size change; the letter case is the section’s own and stays as it is.",{part:s(n.label).toLowerCase()}),children:t(Qt,{face:l,base:a,onPick:i})})}):t("p",{className:"es-field-hint sf-hint-keep",children:s("Only the size follows a site style. This section sets its own font, weight and letter case.")}),r?t(Ee,{source:r,slug:W}):null,t(K,{inline:!0,name:s("Page"),onSelect:P})]})}function nn({onBack:n}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part is no longer here.")})}),t("p",{children:s("The section it belonged to has been changed or removed.")}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function on({onBack:n,partId:o,why:l}){return h("div",{className:"sf-note",children:[t("p",{children:t("strong",{children:s("This part's settings did not open.")})}),t("p",{children:s("The words are still on your page and nothing has been lost. The editor could not work out which control belongs to them, which is a fault on our side. Go back and click the section to open its settings instead.")}),t("p",{className:"sf-note-detail",children:h("code",{children:[o," — ",l]})}),t(K,{inline:!0,name:s("Page"),onSelect:n})]})}function sn({nodeId:n,propKey:o,onBack:l,onEditStyle:a}){const{getItemById:i,getSelectorForId:r,config:W}=ot(e=>e),P=wt(),E=Lt(),{partStyle:F}=St(),{fonts:_,textStyles:_e}=at(),M=Ye(dt),ae=!M?.capabilities?.hasSiteTheme,{persist:ze}=yt({themeFromDocument:ae,tokenRef:M?.tokenRef,siteId:M?.siteId??null}),O=ht({themeFromDocument:ae,persist:ze}),[Ae,j]=Ne(!1),Ve=gt()==="mobile",ce=qe(null),d=i(n),m=r(n),de=d?W.components[d.type]:void 0,{key:g,row:S}=Ot(o),ue=de?.fields?.[g],y=S?Ct(ue,S):ue,w=Gt(n,o),p=d?.props??{},b=kt(y),fe=bt(y),pe=Ht(y),Le=d?Mt(d.type):null,me=d?Wt(d.type,g):null,G=S?It(p[g],S):p[g],he=!!S&&!(Array.isArray(p[g])&&S.index<p[g].length);ne(()=>{if(Vt(document))return;ce.current?.querySelector(".es-copy [contenteditable='true'], .es-copy textarea, .sf-copybox textarea, .sf-copybox input")?.focus()},[w]);const[H,ye]=Ne(0);ne(()=>ye(0),[w]);const $=!!d&&!he&&(!m||!y);ne(()=>{if(!$||H>=Fe)return;const e=setTimeout(()=>ye(c=>c+1),en);return()=>clearTimeout(e)},[$,H]);const Ke=$&&H<Fe;if(!d||he)return t(nn,{onBack:l});const z=$t(d.type),ge=z?Xt(z,o):null;if(z&&ge){const e=F?.partId===w?F:null,c=z[ge],f=c.writable===!0&&!!m,I=ee=>{m&&P.replaceComponent(m.zone,m.index,{...d,props:B(p,o,"role",ee)})};return t(tn,{region:c,sizePx:e?.base.sizePx??null,face:ie(p,o,e,_),base:e?.base??null,onFollowStyle:f?I:void 0,source:Le,slug:Re(p),onBack:l})}if(!m||!y)return Ke?t("div",{className:"sf-note","aria-busy":"true"}):t(on,{onBack:l,partId:w,why:m?"no field":"no selector"});const Se=e=>{P.replaceComponent(m.zone,m.index,{...d,props:e})},X=e=>{if(U(e).hidden!==U(G).hidden||!b){const f=S?Rt(p,g,S,e):{...p,[g]:e};f&&Se(f);return}At({node:d,propKey:o,kind:b,zone:m.zone,index:m.index},U(e).text,P.replaceComponent)},Ue=G,T=F?.partId===w?F:null,v=T?.styleOwner,A=v?i(v.owner):null,Y=v&&A?r(v.owner):null,q=!!(v&&A&&Y),N=q?A.props??{}:p,J=q?e=>P.replaceComponent(Y.zone,Y.index,{...A,props:e}):Se,V=q?v.kind:zt(d?.type,o),k=Oe(N,V),u=[{partKey:V,face:ie(N,V,T,_),sizeGroup:T?.sizeGroup??null,base:T?.base??rn,style:k}],Be=Jt(u,e=>e.sizeGroup),De=_t(T?.inks),R=(e,c)=>{let f=N;for(const I of u)f=B(f,I.partKey,e,c);J(f)},We=e=>R("role",e),be=e=>{let c=N;for(const f of u)for(const[I,ee]of Object.entries(e))c=B(c,f.partKey,I,ee??null);J(c)},Q=b==="text"||b==="textarea",{text:xe,hidden:C}=U(G),L=y?.[Pt]?.label??o,Pe=C?s("Show {label} on the slide",{label:s(L)}):s("Hide {label} on the slide",{label:s(L)}),we=h("div",{className:"sf-field-head",children:[t(nt,{}),t("span",{className:"sf-field-label sf-field-label--inline",children:s(L)}),Q&&t(lt,{content:Pe,children:t("button",{type:"button",className:"sf-field-eye","aria-pressed":C,"aria-label":Pe,onClick:()=>X({text:xe,hidden:!C}),children:C?t(ke,{name:"eye-off",size:14}):t(ke,{name:"eye",size:14})})})]}),Te=!fe&&pe,Me=!!b&&(xt(y)||fe||C||!pe),ve=ie(N,V,T,_),Z=ve.kind==="role"?ve.role:null,je=Object.entries(k).filter(([e,c])=>e!=="role"&&c!==void 0).length,Ge=()=>{let e=N;for(const c of u){const f=c.style.role;e=Ft(e,c.partKey),f&&(e=B(e,c.partKey,"role",f))}J(e)},x=Ce(Z),He=ut(u[0].style),$e=x?mt(O.saved,O.old).find(e=>e.id===x)?.name??x:"",Xe=()=>{j(!1),x&&(O.write(pt({saved:O.saved,old:O.old,styleId:x,values:ft(u[0].style)}),!0),Ge())};return h(Zt,{sectionName:de?.label??d.type,onBack:l,textEditor:t("div",{ref:ce,className:"sf-part-text",children:Me?t(rt,{text:xe,onTextChange:e=>X(Q?{text:e,hidden:C}:e),multiline:vt(b),markup:b!=="plainText",styled:!1,style:u[0].style,base:u[0].base,setValue:be,colors:De,placeholder:re(Nt(y))??void 0,ariaLabel:s(L),head:we,typedOnCanvas:E===w}):b?Q?we:null:t(Ze,{field:y,name:o,value:Ue,onChange:X,id:`sf-part-${n}-${o}`})}),children:[me&&t(Ee,{source:me,slug:Re(p),menuId:jt(p)}),Te&&t(st,{style:{value:Z??"",options:[{value:"",label:s("No style"),description:s("Section’s own")},...oe.map(e=>({value:e,label:s(se[e]),description:le(_[e])?.label}))],onChange:e=>We(e||null),changed:je>0,onEditStyles:a,onUpdateStyle:x&&He?()=>j(!0):void 0},font:{value:k.font??"",styleValue:le(u[0].base.fontKey)?.label,options:Tt.map(e=>({label:e.label,value:e.key})),onChange:e=>R("font",e||null)},italic:{value:k.italic,styleValue:ln(_e,Z),onChange:e=>R("italic",e??null)},cells:it(u[0].style,u[0].base,be,{phone:Ve}),align:{value:k.align??"",styleValue:u[0].base.align,onChange:e=>R("align",e||null)},letterCase:{value:k.case??"",styleValue:u[0].base.case,onChange:e=>R("case",e||null)}}),Ae&&x&&t(ct,{styleName:$e,onCancel:()=>j(!1),onConfirm:Xe}),Te&&Be===null&&t("p",{className:"es-field-hint sf-hint-keep",children:s("Fixed size — the site’s Text setting doesn’t resize this.")})]})}function ln(n,o){const l=Ce(o);return!l||!Array.isArray(n)?!1:n.find(i=>i?.id===l)?.values?.italic===!0}const rn={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:Et};export{Zt as PartPanelBody,Je as PartResetDot,Ee as PartSourceNote,Qt as PartStyleSelect,sn as default,ie as partFace};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { SendToHost } from "
|
|
1
|
+
import type { SendToHost } from "efficient-easel/screen/lib/host";
|
|
2
2
|
import type { ReactNode, RefObject } from "react";
|
|
3
|
-
import type { EditorChrome } from "
|
|
3
|
+
import type { EaselChrome as EditorChrome } from "efficient-easel/screen/lib/host-chrome";
|
|
4
4
|
import type { EditorCapabilities } from "../lib/editor-document-adapter.js";
|
|
5
|
-
import { type ScreenPartMode } from "
|
|
5
|
+
import { type ScreenPartMode } from "efficient-easel/screen/lib/screen-parts";
|
|
6
6
|
export type InspectorMode = {
|
|
7
7
|
kind: "puck";
|
|
8
8
|
} | {
|
|
@@ -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
|
|
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 R,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"efficient-easel/screen/lib/puck/panel-fields";import{TICKER_PART_LABEL as F}from"../../render/components/PreviewTickerContext.js";import he from"./SectionIcon.js";import{PanelHideButton as x}from"efficient-easel/screen/components/SidePanelHead";import{useEaselSession as Se}from"efficient-easel/screen/lib/session-context";import{say as o}from"../../format/lib/editor-words.js";import be,{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 Ee,{PartSourceNote as Ie}from"./PartSettingsPanel.js";import ye from"./DuplicateToPageMenu.js";import{useScreenDocument as Le}from"efficient-easel/screen/components/ScreenDocumentContext";import{usePreviewHeader as Oe}from"../../render/components/PreviewHeaderContext.js";import{useSectionOps as Ne}from"efficient-easel/screen/lib/puck/use-section-ops";import{SELECTION_MODE as Te}from"efficient-easel/screen/lib/screen-parts";import{usePreviewParts as He}from"efficient-easel/draw/client";import{entryPartsOf as _e,SectionTextEntries as Ae}from"./SectionTextEntries.js";import{SectionTextSuppressProvider as De}from"../lib/puck/section-text-suppress.js";import{HEADER_TYPE as Re,ROOT_ZONE as B}from"efficient-easel/draw";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"../../render/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"../../render/lib/puck/part-rows.js";import{encodePartId as $e,partHeadLabel as qe,partLabel as Ge,sectionTextParts as Je}from"../../render/lib/puck/text-parts.js";import{partSourceOf as Qe,sourceMenuIdOf as Ve,sourceSlugOf as Xe}from"../../format/lib/puck/source-bound-parts.js";const Zt=Te,$t={kind:"header"},qt={kind:"website"},Gt={kind:"chat"},Jt={kind:"social"},b="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(b)}}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 E(e){const i=Me[e];return{name:Be[e],kindLabel:b,icon:i,head:(r,a)=>{if(r.kind!==i)return null;const c=a.describeNode(r.nodeId);if(!c)return null;const m=R({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(be,{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:b,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:E("media"),heroImage:E("image"),heroImage2:E("image2"),part:{name:b,kindLabel:b,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=R({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(Ee,{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:I,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=Se(),L={capabilities:f,tokenRef:w,hostPanels:V.chrome?.panels,describeNode:p=>{const S=$(p);if(!S)return null;const D=u.components[S.type];return{type:S.type,label:D?.label??S.type,fields:D?.fields??{},props:S.props??{}}},siteId:I,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!==Re,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:I??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(De,{children:n(M,{entries:n(Ae,{parts:y,heading:!1,onOpen:p=>Z($e(t.props.id,p))}),entryCount:_e(y).length})}),T&&n(Ie,{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 e,jsxs as i,Fragment as z}from"react/jsx-runtime";import{useCallback as B,useContext as K,useEffect as W,useId as
|
|
1
|
+
"use client";import{jsx as e,jsxs as i,Fragment as z}from"react/jsx-runtime";import{useCallback as B,useContext as K,useEffect as W,useId as D,useRef as S,useState as y}from"react";import{ThemeIcon as V}from"efficient-easel/icons";import{SettingsField as q}from"efficient-easel/panel";import{usePreviewHeader as G}from"../../render/components/PreviewHeaderContext.js";import{ScreenDocumentContext as J}from"efficient-easel/screen/components/ScreenDocumentContext";import{ThemeCard as Q,ThemeCardTrigger as U,ThemeColourRows as X,themeName as v}from"./ThemeCard.js";import{useThemeRowPersist as Y}from"../lib/theme-row-persist.js";import{say as u}from"../../format/lib/editor-words.js";import{normalizeTheme as L,normalizeThemeColors as Z,selectedThemeColors as ee}from"../../format/lib/theme.js";import{SECTION_ACCENT_INHERIT as te,resolveSectionAccent as ne}from"../../format/lib/content/section-surface.js";const se="Follow the page",Ne="Follow the slideshow",oe=s=>u("Editing {name} changes it everywhere.",{name:s});function ce({colors:s}){if(!s)return e("span",{className:"sf-secttheme-chip sf-secttheme-chip--none","aria-hidden":"true"});const n=Z(s);return i("span",{className:"sf-secttheme-chip","aria-hidden":"true",children:[e("i",{style:{background:n.background}}),e("i",{className:"sf-secttheme-chip-accent",style:{background:n.accent}})]})}function re({themes:s,value:n,onPick:r,onEdit:f,menuId:l,followLabel:m}){return i("div",{className:"sf-multi-menu sf-secttheme-menu",id:l,role:"listbox",children:[m!==void 0&&i(z,{children:[i("button",{type:"button",role:"option","aria-selected":n===null,className:`sf-secttheme-item${n===null?" is-active":""}`,onClick:()=>r(te),children:[e(ce,{}),e("span",{className:"sf-secttheme-name",children:u(m)})]}),e("div",{className:"sf-secttheme-sep",role:"presentation"})]}),n!==null&&s[n]&&e("p",{className:"sf-secttheme-oncard",role:"presentation",children:u("{name} is on this section",{name:v(n)})}),s.map((x,c)=>c===n?null:e(Q,{role:"option",index:c,colors:x,selected:!1,onPick:()=>r(c),onEdit:()=>f(c)},c))]})}function ie({index:s,colors:n,onChange:r,onDone:f}){const l=v(s),m=D();return i("div",{className:"sf-secttheme-sheet",children:[i("div",{className:"sf-secttheme-sheet-head",children:[e("span",{children:l}),e("button",{type:"button",className:"sf-secttheme-done",onClick:f,children:u("Done")})]}),e("div",{className:"sf-secttheme-rows",children:e(X,{colors:n,onChange:r,idPrefix:m})}),e("p",{className:"sf-secttheme-warn",children:oe(l)})]})}function le({value:s,onChange:n,followLabel:r,hint:f}){const{theme:l,setTheme:m}=G(),x=L(l),c=K(J),R=c?.tokenRef,F=c?.siteId??null,O=!c?.capabilities?.hasSiteTheme,{persist:P,flush:N}=Y({themeFromDocument:O,tokenRef:R,siteId:F}),g=L(x),a=g.themes,d=ne(s),_=d!==null?a[d]:void 0,j=_??(a.length?ee(g):void 0),[p,E]=y(!1),[o,C]=y(null),b=S(null),w=S(null),T=D(),h=B(()=>{E(!1),C(null)},[]);W(()=>{if(!p&&o===null)return;const t=I=>{b.current&&!b.current.contains(I.target)&&(N(),h())};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[p,o,h,N]);const A=t=>{n(t),h()},H=t=>{if(o===null)return;const I=a.map((M,$)=>$===o?t:M),k={...g,themes:I};m(k),P({selected_preset:k.selected,theme_presets:k.themes})};return i("div",{className:"sf-secttheme",ref:b,children:[e(q,{label:u("Theme"),icon:e(V,{}),labelId:`${T}-label`,hint:f,children:e(U,{colors:j,onEdit:d!==null?()=>{C(d),E(!1)}:void 0,name:_?v(d):u(r??se),nameId:`${T}-value`,labelId:`${T}-label`,open:p,menuId:T,buttonRef:w,onClick:()=>{C(null),E(t=>!t)},onKeyDown:t=>{t.key==="Escape"&&(p||o!==null)&&(t.preventDefault(),h())}})}),p&&o===null&&e("div",{onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),h(),w.current?.focus())},children:e(re,{themes:a,value:d,onPick:A,onEdit:t=>{C(t),E(!1)},menuId:T,followLabel:r})}),o!==null&&a[o]&&e(ie,{index:o,colors:a[o],onChange:H,onDone:()=>{N(),h(),w.current?.focus()}})]})}export{Ne as BLOCK_THEME_FOLLOW_LABEL,se as SECTION_THEME_FOLLOW_LABEL,ie as SectionThemeEditor,re as SectionThemeMenu,le as default,oe as sectionThemeEditWarning};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ComponentProps } from "react";
|
|
2
|
-
import EditorStoreProvider from "
|
|
2
|
+
import EditorStoreProvider from "efficient-easel/screen/components/ScreenStoreProvider";
|
|
3
3
|
export default function SiteEditorProvider(props: Omit<ComponentProps<typeof EditorStoreProvider>, "parts">): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o}from"react/jsx-runtime";import t from"
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import t from"efficient-easel/screen/components/ScreenStoreProvider";import{WEBSITE_SCREEN as i}from"./WebsiteScreenParts.js";function e(r){return o(t,{...r,parts:i})}export{e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SlotChildActions } from "
|
|
1
|
+
import { type SlotChildActions } from "efficient-easel/screen/components/SlotChildActionsContext";
|
|
2
2
|
import type { TreeItem } from "efficient-easel/draw";
|
|
3
3
|
export declare function SlotChildRows({ parent, parentType, label, rowName, onSelectChild, onAddChild, nestDepth, }: {
|
|
4
4
|
parent: TreeItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,Fragment as C,jsxs as R}from"react/jsx-runtime";import{useEasel as x}from"efficient-easel/easel";import{LayersIcon as b}from"efficient-easel/icons";import{SettingsDrill as F,SettingsField as k}from"efficient-easel/panel";import _ from"
|
|
1
|
+
"use client";import{jsx as s,Fragment as C,jsxs as R}from"react/jsx-runtime";import{useEasel as x}from"efficient-easel/easel";import{LayersIcon as b}from"efficient-easel/icons";import{SettingsDrill as F,SettingsField as k}from"efficient-easel/panel";import _ from"efficient-easel/screen/components/AddChildRow";import{useSlotChildActions as j}from"efficient-easel/screen/components/SlotChildActionsContext";import{HERO_GROUP_TYPE as D,heroGroupNestDepth as I}from"../../format/lib/hero-group-placement.js";import{canAddTo as p}from"../lib/puck/add-target.js";import{say as O}from"../../format/lib/editor-words.js";function $({parent:o,parentType:t,label:r,rowName:n,onSelectChild:e,onAddChild:l,nestDepth:a=0}){const u=p(t,a);if(!u)return null;const{slot:d,choices:A,spec:i}=u,f=String(o.props.id),h=`${f}:${d}`,c=Array.isArray(o.props[d])?o.props[d]:[],w=i?.addBlocked?.(c)??null,S=i?.notice?.(c)??null,g=R(C,{children:[S?s("p",{className:"sf-note",children:S}):null,c.map((m,N)=>s(F,{name:n(m),onOpen:()=>e(h,N,String(m.props.id),t)},String(m.props.id??`${h}-${N}`))),A||i.fixed?null:s(_,{label:i.addLabel,blocked:w,onAdd:()=>l(f,d,i.childType,c.length,t)})]});return s("div",{className:"sf-slot-rows",children:r?s(k,{label:O(r),icon:s(b,{}),value:String(c.length),children:g}):g})}function y(o,t){return p(o)?.spec?.notice?.(t)??null}function J({parentType:o}){const{selectedItem:t}=x(l=>l);if(!t||t.type!==o)return null;const r=p(o)?.slot,n=r&&Array.isArray(t.props[r])?t.props[r]:[],e=y(o,n);return e?s("p",{className:"sf-note",children:e}):null}function E(o,t){return p(t)?.source==="footer"?o.blockRowName:o.childRowName}function v({parentType:o,label:t}){const{appState:r,selectedItem:n}=x(a=>a),e=j();if(!e||!n||n.type!==o)return null;const l=o===D?I(r?.data,String(n.props.id)):0;return s($,{parent:n,parentType:o,label:t,rowName:E(e,o),onSelectChild:e.selectChild,onAddChild:e.addChild,nestDepth:l})}export{$ as SlotChildRows,J as SlotNoticeField,v as default,E as rowNamerFor,y as slotNoticeOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as H,useEffect as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{useCallback as H,useEffect as S,useMemo as l,useRef as V,useState as u}from"react";import x from"next/dynamic";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as X}from"../lib/puck/build-config.js";import{withTemplateMediaPlaceholders as Z}from"../../format/lib/puck/templateFields.js";import{setEditorPageSlug as R}from"../../format/lib/puck/editor-page-context.js";import{ScreenDocumentContext as $}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as ee}from"../../render/components/PreviewHeaderContext.js";import{PreviewTickerProvider as te}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as re}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as oe}from"efficient-easel/draw/client";import{PreviewLocationPartProvider as ie}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as ne}from"./PreviewPartStyleContext.js";import{sectionTemplates as O}from"efficient-easel/screen/lib/section-templates";import{nodeToDoc as se,docToNode as B}from"efficient-easel/screen/lib/puck/section-doc";import{newNodeId as de}from"efficient-easel/draw";import{migrateRenamedProps as ae}from"../../format/lib/puck/renamed-props.js";import{buildSlotSeedChildren as ce}from"../../render/lib/puck/slot-specs.js";import{FOOTER_TYPE as me,buildDefaultFooterBlocks as le}from"../lib/puck/footer-blocks.js";import{NO_BRIDGED_CAPABILITIES as ue,useAdminBridge as fe}from"efficient-easel/screen/lib/admin-bridge";import{useEaselHost as pe}from"efficient-easel/screen/lib/host";import{ChromeWrap as ve}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as ge}from"efficient-easel/screen/lib/session";import{useEaselSession as he}from"efficient-easel/screen/lib/session-context";import{say as F}from"../../format/lib/editor-words.js";import{retargetWhenSaved as Se}from"../../format/lib/section-retarget.js";import{routeSharedHostMessage as Pe}from"efficient-easel/screen/lib/host-inbound";import{routeWebsiteHostMessage as Ee}from"../../format/lib/website-host-inbound.js";import{DEFAULT_THEME_MODE as P,THEME_MODE_KEY as ye}from"../../format/lib/theme.js";import{makeSitePageAdapter as L}from"../lib/editor-document-adapter.js";import{documentPermissions as Te}from"efficient-easel/edit-lock";import{useAutosave as we}from"efficient-easel/autosave";import{saveStatusOf as Ne}from"../lib/puck/pinned-seed-gate.js";import{blocksOf as ke}from"../lib/website-session.js";const Ce=x(()=>import("./SiteEditorProvider.js"),{ssr:!1}),Ae=x(()=>import("efficient-easel/screen/components/SectionScreenShell"),{ssr:!1}),U="HeroSingle",W="Untitled section";function Ie(i,E){const d=E.components,r=d[i]?i:U,y=d[r]?.defaultProps??{},n=ce(r,f=>d[f]?.defaultProps??{}),s=r===me?{blocks:le()}:null;return{type:r,props:{id:de(r),...y,...n?{[n.slot]:n.children}:null,...s}}}function Oe(){if(typeof window>"u")return P;try{const i=window.localStorage.getItem(ye);return i==="light"||i==="dark"||i==="auto"?i:P}catch{return P}}function be({id:i,initialType:E,initialName:d=W}){const[r,y]=u(i),n=V(r);S(()=>{n.current=r},[r]);const s=pe(),[f,Y]=u(E),[b,j]=u(d),[a,T]=u(void 0),[K,G]=u(P),{token:w,tokenRef:M}=fe({onMessage:e=>{if(Ee(e)||Pe(e))return;const t=e;if(t?.type==="storefront-editor:navigate"&&t.target?.kind==="section"&&t.target.id){const I=t.target.id;if(I===n.current)return;const J=t.target.type,Q=t.target.name;Se(k,()=>{Y(J),j(Q||W),y(I),s.address.show({kind:"section",id:I})},()=>s.send("storefront-editor:save-failed"))}}}),N=we({save:e=>O.update(e.id,e.node).then(()=>{}),onFailure:(e,t)=>{t===0&&s.send("storefront-editor:save-failed")}}),{state:p,push:D,flush:k}=N;S(()=>G(Oe()),[]);const c=he(),v=c.usesBridgedToken?!!w:!0,g=l(()=>X(ge(c),ke(c)),[c]);S(()=>{if(!v)return;let e=!1;return T(void 0),O.ensure(r,b,Ie(f??U,g)).then(t=>!e&&T(t.node)).catch(()=>!e&&T(null)),()=>{e=!0}},[r,f,b,v,g]);const C=H(e=>{s.send("storefront-editor:dirty");const t=B(e);t&&D({id:n.current,node:t})},[D,s]),h=s.send,_=H(async e=>{try{return await e(M.current??""),!0}catch{return h("storefront-editor:save-failed"),!1}},[h]),q=l(()=>Z(g,!0),[g]);S(()=>(R(null),()=>R(null)),[]);const m=l(()=>a?ae(se(a)):null,[a]),A=l(()=>({target:{kind:"page",slug:""},adapter:L(void 0),capabilities:L(void 0).capabilities,templateId:null,currentSlug:"",currentKind:null,siteId:null,ready:v,token:w,tokenRef:M,notifyParent:h,runAuthed:_,docId:r,data:m,getLiveData:()=>m,footerOriginSlug:null,error:null,redirecting:!1,saveStatus:Ne(p),saveState:p,autoSaveEnabled:!0,autoSaveStoppedByConflict:!1,hasUnsavedEdits:p.pending,toggleAutoSave:()=>{},retrySave:()=>{N.retryNow()},onChange:C,flushSave:k,onPublish:async e=>{const t=B(e);t&&await O.update(n.current,t)},bridgeCapabilities:ue,access:{kind:"editing"},readOnly:!1,takeOverEditing:()=>{},viewReadOnly:()=>{},saveConflict:null,reloadFromServer:()=>{},navigate:()=>{},pendingNav:null,cancelPendingNav:()=>{},discardAndNavigate:()=>{},saveAndNavigate:async()=>{}}),[r,v,w,h,_,m,p,C,k,N.retryNow]),z=l(()=>Te(!A.readOnly),[A.readOnly]);return a===void 0?o("div",{className:"sf-msg",children:F("Loading…")}):a===null||!m?o("div",{className:"sf-msg sf-msg--error",children:F("Couldn’t open this section.")}):o($.Provider,{value:A,children:o(ee,{themeMode:K,chromePlaceholder:!0,children:o(ve,{wrap:c.chrome?.wrap,surface:"section",children:o(te,{children:o(re,{children:o(oe,{children:o(ie,{children:o(ne,{children:o(Ce,{config:q,data:m,onChange:C,permissions:z,children:o(Ae,{})},r)})})})})})})})})}export{be as default};
|
|
@@ -13,7 +13,7 @@ import "efficient-easel/tree.css";
|
|
|
13
13
|
import "efficient-easel/drag.css";
|
|
14
14
|
import "efficient-easel/screen.css";
|
|
15
15
|
import "./storefront-editor.css";
|
|
16
|
-
import { type EditorTarget } from "
|
|
16
|
+
import { type ScreenTarget as EditorTarget } from "efficient-easel/screen/components/ScreenDocumentContext";
|
|
17
17
|
export default function StorefrontEditor({ target }: {
|
|
18
18
|
target: EditorTarget;
|
|
19
19
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as ft}from"react/jsx-runtime";import{useCallback as o,useEffect as m,useMemo as I,useRef as S,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as gt}from"../lib/puck/build-config.js";import{ChromeWrap as wt}from"
|
|
1
|
+
"use client";import{jsx as s,jsxs as ft}from"react/jsx-runtime";import{useCallback as o,useEffect as m,useMemo as I,useRef as S,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{buildConfig as gt}from"../lib/puck/build-config.js";import{ChromeWrap as wt}from"efficient-easel/screen/lib/host-chrome";import{sessionRegistry as Ct}from"efficient-easel/screen/lib/session";import{refreshSiteLiveState as _t}from"../lib/site-live-state.js";import{holdSiteWrites as Tt}from"../../format/lib/site-writes.js";import{backendOf as M,blocksOf as yt}from"../lib/website-session.js";import{useEaselSession as Et}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Pt}from"../../format/lib/puck/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/puck/templateFields.js";import{setEditorPage as le}from"../../format/lib/puck/editor-page-context.js";import{resolveSiteName as Wt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Ht,normalizeSiteWidth as kt}from"../../format/lib/content/page-width.js";import{normalizeSiteBackground as me}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as It}from"../../format/lib/content/container-gap.js";import Mt,{DocumentScreen as Rt}from"efficient-easel/screen/components/ScreenMount";import{useScreenDocument as Gt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Bt}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Ft}from"./PreviewFooterContext.js";import{PreviewChatProvider as Dt,DEFAULT_CHAT_PREVIEW as At}from"./PreviewChatContext.js";import{PreviewSocialProvider as xt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Nt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Ot}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as bt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as Kt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Lt}from"efficient-easel/draw/client";import{PreviewLocationPartProvider as Yt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as Ut}from"./PreviewPartStyleContext.js";import{SiteMapsProvider as jt,readSiteMapsKey as Vt,writeSiteMapsKey as pe,readSiteMapId as Xt,writeSiteMapId as Zt}from"../../render/lib/maps-config.js";import{CORNER_STYLE_TO_PX as qt,DEFAULT_HEADING_COMPRESSION as Jt,DEFAULT_HEADING_TYPOGRAPHY as Qt,DEFAULT_SWITCH_SHOWN as R,DEFAULT_SIZES as $t,DEFAULT_THEME_MODE as T,normalizeCornerRadius as er,normalizeCornerStyle as tr,normalizeCardShadow as rr,normalizeCardGap as or,normalizeHoverEffect as nr,normalizeShadowColor as ar,IDENTITY_CARD_GAP as Se,IDENTITY_CARD_SHADOW as ir,IDENTITY_HOVER_EFFECT as cr,THEME_MODE_KEY as fe,THEME_STORAGE_KEY as sr,THEME_SWITCH_HIDE as ge,THEME_SWITCH_KEY as G}from"../../format/lib/theme.js";import{DEFAULT_FONTS as dr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as ur}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as hr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as lr}from"../lib/site-text-styles.js";import{wordStylesFromRow as mr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as pr}from"./PreviewChatContext.js";const Sr=()=>{if(typeof window>"u")return T;try{const i=window.localStorage.getItem(fe);return i==="light"||i==="dark"||i==="auto"?i:T}catch{return T}},we=i=>{if(!(typeof window>"u"))try{window.localStorage.setItem(fe,i)}catch{}},fr=()=>{if(typeof window>"u")return R;try{return window.localStorage.getItem(G)!==ge}catch{return R}},gr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(sr)}catch{}},Ce=i=>{if(!(typeof window>"u"))try{i?window.localStorage.removeItem(G):window.localStorage.setItem(G,ge)}catch{}};function wr(){const{adapter:i,capabilities:d,templateId:B,ready:w,token:l,siteId:c,currentSlug:F,currentKind:D}=Gt();m(()=>(le(F,D),()=>le(null,null)),[F,D]);const y=d.placeholderFrames,[_e,A]=r(null),[Te,x]=r("");m(()=>{const e=i.templateName;if(!w||!B||!e){x("");return}let a=!1;return e().then(u=>!a&&x(u??"")).catch(()=>{}),()=>{a=!0}},[w,l,B,i]);const[ye,E]=r(T),[Ee,P]=r(R),[Pe,N]=r({selected:0,themes:[]}),[ve,O]=r(dr),[We,b]=r($t),[He,z]=r(null),[ke,K]=r(Jt),[Ie,L]=r(null),[Me,Y]=r(null),[Re,U]=r(Se),[Ge,j]=r(null),[Be,V]=r(null),[Fe,X]=r(null),[v,Z]=r(null),h=Et(),q=I(()=>gt(Ct(h),yt(h)),[h]),De=I(()=>Pt(vt(q,y),v),[q,y,v]),[Ae,J]=r(Qt),[xe,Q]=r(null),[Ne,$]=r(null),[Oe,ee]=r(null),[be,te]=r(null),[ze,re]=r(null),oe=S(null),n=S(!1);m(()=>{E(Sr()),P(fr())},[]);const Ke=o(e=>{n.current=!0,gr(),we(e),E(e)},[]),Le=o(e=>{n.current=!0,Ce(e),P(e)},[]),Ye=o(e=>{n.current=!0,N(e)},[]),Ue=o(e=>{n.current=!0,O(e)},[]),je=o(e=>{n.current=!0,b(e)},[]),Ve=o(e=>{n.current=!0,z(e)},[]),Xe=o(e=>{n.current=!0,K(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,Y(e)},[]),Je=o(e=>{n.current=!0,U(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,J(e)},[]),[et,ne]=r(null),[tt,rt]=r(null),ot=o(e=>{n.current=!0,ne(e)},[]),nt=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),it=o(e=>{n.current=!0,Z(e)},[]),ct=o(e=>{n.current=!0,Q(e)},[]),st=o(e=>{n.current=!0,$(e)},[]),dt=o(e=>{n.current=!0,ee(e)},[]),ut=o(e=>{n.current=!0,te(e)},[]),ht=o(e=>{n.current=!0,re(e)},[]);m(()=>{const e=M(h).theme;if(!l||!d.hasSiteTheme||!e)return;const a=c??"";oe.current!==a&&(oe.current=a,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;we(t.default_mode),Ce(t.show_theme_switch),E(t.default_mode),P(t.show_theme_switch),N({selected:t.selected_preset,themes:t.theme_presets});const p=lr(t);O(p.fonts),b(p.sizes),z(t.corner_radius_px===void 0?qt[tr(t.corner_style)]:er(t.corner_radius_px)),K(p.compression),L(t.card_shadow==null?ir:rr(t.card_shadow)),U(t.card_gap==null?Se:or(t.card_gap)),j(t.hover_effect==null?cr:nr(t.hover_effect)),Y(ar(t.shadow_color)),V(kt(t.site_width)),X(Ht(t.site_gutter)),Z(It(t.block_gap)),J(p.typography),ne(p.textStyles),rt(mr(t)),Q(t.hero_background_follows_width===!0),$(me(t.section_background_width)),ee(me(t.section_content_width)),te(t.photography_grayscale===!0),re(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[l,c,d.hasSiteTheme,h]);const lt=Nt({token:l,siteId:c,enabled:d.hasSiteSettings}),[mt,ae]=r(At),ie=S(null),W=S(!1),f=S(null),g=S({}),C=o(async()=>{f.current&&clearTimeout(f.current),f.current=null;const e=g.current;g.current={};try{await M(h).chat?.update(e,c?{siteId:c}:void 0),_t()}catch(a){throw g.current={...e,...g.current},a}},[h,c]);m(()=>Tt(()=>f.current||Object.keys(g.current).length>0?C():void 0),[C]);const pt=o(e=>{W.current=!0,ae(a=>({...a,...e})),!(!d.hasSiteSettings||!l)&&(g.current={...g.current,...e},f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{C().catch(()=>{})},500))},[d.hasSiteSettings,l,C]);m(()=>{if(!l||!d.hasSiteSettings)return;const e=c??"";ie.current!==e&&(ie.current=e,W.current=!1);let a=!1;const u=M(h).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{a||W.current||ae(pr(t))}).catch(()=>{}),()=>{a=!0}},[l,c,d.hasSiteSettings,h]);const[_,H]=r(""),ce=S(null),k=S(!1);m(()=>H(Vt()),[]);const se=o(e=>{const a=e.trim();if(a===_)return;k.current=!0,pe(a),H(a);const u=i.updateSite;!d.canEditSiteRecord||!w||!u||u({mapsApiKey:a}).catch(()=>{})},[_,d.canEditSiteRecord,w,i]),[de,ue]=r("");m(()=>ue(Xt()),[]),m(()=>{const e=i.site;if(!w||!d.hasSiteRecord||!e){A(null);return}const a=c??"";ce.current!==a&&(ce.current=a,k.current=!1);let u=!1;return e().then(t=>{if(u||(A(Wt(t.name)),k.current))return;const p=t.mapsApiKey??"";pe(p),H(p);const he=t.mapsMapId??"";Zt(he),ue(he)}).catch(()=>{}),()=>{u=!0}},[w,l,d.hasSiteRecord,c,i]);const St=I(()=>({apiKey:_,setApiKey:se,mapId:de}),[_,se,de]);return s(Rt,{config:De,parts:ur,wrap:(e,a)=>s(Bt,{websiteName:_e,templateChrome:y,templateName:Te||null,themeMode:ye,onThemeModeChange:Ke,themeSwitchShown:Ee,onThemeSwitchShownChange:Le,theme:Pe,onThemeChange:Ye,fonts:ve,onFontsChange:Ue,cornerRadiusPx:He,onCornerRadiusPxChange:Ve,cardShadow:Ie,onCardShadowChange:Ze,shadowColor:Me,onShadowColorChange:qe,cardGap:Re,onCardGapChange:Je,hoverEffect:Ge,onHoverEffectChange:Qe,headingCompression:ke,onHeadingCompressionChange:Xe,headingTypography:Ae,onHeadingTypographyChange:$e,textStyles:et,onTextStylesChange:ot,wordStyles:tt,sizes:We,onSizesChange:je,siteWidth:Be,onSiteWidthChange:nt,siteGutter:Fe,onSiteGutterChange:at,blockGap:v,onBlockGapChange:it,heroBackgroundFollowsWidth:xe,onHeroBackgroundFollowsWidthChange:ct,sectionBackgroundWidth:Ne,onSectionBackgroundWidthChange:st,sectionContentWidth:Oe,onSectionContentWidthChange:dt,photographyGrayscale:be,onPhotographyGrayscaleChange:ut,shareButtonOnPosts:ze,onShareButtonOnPostsChange:ht,themeFromDocument:!d.hasSiteTheme,children:s(Ft,{children:s(wt,{wrap:h.chrome?.wrap,surface:"page",children:s(zt,{children:s(Kt,{children:s(Lt,{children:s(Yt,{children:s(Ut,{children:ft(jt,{value:St,children:[s(Dt,{chat:mt,onChatChange:pt,children:s(xt,{value:lt,children:s(Ot,{children:e})})}),a]})})})})})})})})})})}function Cr({target:i}){return s(Mt,{target:i,addressing:bt,onHostMessage:hr,children:s(wr,{})})}export{Cr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as m,jsxs as w}from"react/jsx-runtime";import{SettingsField as F}from"efficient-easel/panel";import{LinkIcon as _}from"efficient-easel/icons";import{LinkPicker as B,TextLinkField as D}from"efficient-shell/ui";import{useEffect as b,useMemo as h,useRef as H,useState as S}from"react";import{getEditorToken as M}from"../../render/lib/editor-auth.js";import{say as v}from"../../format/lib/editor-words.js";import{currentEaselSession as O}from"efficient-easel/screen/lib/session";import{backendOf as T}from"../lib/website-session.js";import{useScreenDocument as q}from"efficient-easel/screen/components/ScreenDocumentContext";import{pagePath as z}from"../../format/lib/links/page-link-rules.js";import{linkPickerSetup as C}from"../../format/lib/links/link-picker-setup.js";import{useEaselSession as A}from"efficient-easel/screen/lib/session-context";import{isSystemPageSlug as G}from"../../format/lib/content/subscribe.js";function E(r){const n=new Map;return(t="")=>{const e=M(),s=n.get(t);if(!s||s.token===null&&e!==null){const i=e||!O().usesBridgedToken?r(e??"",t).catch(()=>[]):Promise.resolve([]);return n.set(t,{promise:i,token:e}),i}return s.promise}}const I=E(async(r,n)=>{const t=n?{siteId:n}:void 0,{pages:e}=T();return e.linkTargets?e.linkTargets(t):(await e.list(t)).map(s=>({id:s.id,slug:s.slug,label:s.label,layout:null}))}),J=E(async(r,n)=>await T().blog?.posts(n?{siteId:n}:void 0)??[]);function K({value:r,onChange:n,label:t="Link",data:e,filters:s}){const i=h(()=>C(e,s),[e,s]),l=v(t);return m(F,{label:l,icon:m(_,{}),children:m(B,{value:r,onChange:a=>n(a),kinds:i.kinds,rules:i.rules,filtersFor:i.filtersFor,label:l})})}function R(){const{siteId:r,capabilities:n}=q(),{offersCommerce:t,hasBlog:e}=n,[s,i]=S([]),[l,a]=S([]),[u,d]=S([]),[c,g]=S(null),L=A().chrome,P=L?.products?.list,k=L?.linkFilters,y=k?void 0:L?.linkRow,p=H(!0);b(()=>(p.current=!0,()=>{p.current=!1}),[]),b(()=>{let o=!0;return I(r??void 0).then(f=>o&&p.current&&i(f)),e&&J(r??void 0).then(f=>o&&p.current&&a(f)),t&&P?.().then(f=>o&&p.current&&d(f)),t&&k?k.load(r).catch(()=>null).then(f=>o&&p.current&&g(()=>f)):g(null),()=>{o=!1}},[r,t,e,P,k]);const x=h(()=>({pages:s.filter(o=>!G(o.slug)).map(o=>({slug:o.slug,title:o.label,docs:[o.layout]})),posts:e?l.map(o=>({slug:o.slug,title:o.title})):[],products:t?u.map(o=>({href:o.href,name:o.name})):[],offers:{offersCommerce:t,offersService:e}}),[s,l,u,t,e]),j=h(()=>c?c(x.pages):null,[c,x]);return{data:x,filters:j,pages:s,offersCommerce:t,HostLinkRow:y}}function ie({label:r,icon:n,text:t,onTextChange:e,link:s,onLinkChange:i}){const{data:l,filters:a}=R(),u=h(()=>C(l,a),[l,a]),d=v(r);return m(F,{label:d,icon:n,children:m(D,{label:d,text:t,onTextChange:e,link:s,onLinkChange:c=>i(c),kinds:u.kinds,rules:u.rules,filtersFor:u.filtersFor})})}function N({value:r,onChange:n,label:t="Link"}){const e=typeof r=="string"?r:"",{data:s,filters:i,pages:l,offersCommerce:a,HostLinkRow:u}=R(),d=s.pages.map(g=>z(g.slug)),c=a&&u&&(e==="/"||d.includes(e))?u:void 0;return w("div",{children:[m(K,{value:e,onChange:n,label:t,data:s,filters:i}),c&&m(c,{value:e,onChange:n,pages:l})]})}export{K as StorefrontLinkPicker,ie as StorefrontTextLinkField,N as default,I as loadPages,J as loadPosts};
|
|
@@ -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"
|
|
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("Site 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
|
|
1
|
+
"use client";import{jsx as n,Fragment as g,jsxs as y}from"react/jsx-runtime";import{useState as k}from"react";import{createNode as w,newId as x}from"efficient-easel/data";import{useEasel as S}from"efficient-easel/easel";import{Banner as F,Button as s}from"efficient-shell/ui";import{useScreenDocument as T}from"efficient-easel/screen/components/ScreenDocumentContext";import{boxFooterFromFooter as B}from"../../format/lib/puck/box-footer.js";import{FOOTER_TYPE as E}from"../lib/puck/footer-blocks.js";import{SITE_FOOTER_TYPE as a,withSectionGroup as _}from"../../format/lib/puck/section-groups.js";import{say as t}from"../../format/lib/editor-words.js";function O(){const{appState:c,dispatch:m,config:l}=S(o=>o),{readOnly:f}=T(),[u,r]=k(!1),i=c.data.content;if(f||i.some(o=>o.type===a))return null;const p=i.find(o=>o.type===E)??null,d=(o,e)=>w(l,o,e),h=()=>{const o=B(p,d,x(a));m({type:"setData",data:e=>({...e,content:[..._(e.content,o)]}),recordHistory:!0}),r(!1)};return n(F,{tone:"info",title:t("This footer uses the old layout"),action:u?y(g,{children:[n(s,{variant:"primary",size:"sm",onClick:h,children:t("Switch now")}),n(s,{variant:"secondary",size:"sm",onClick:()=>r(!1),children:t("Cancel")})]}):n(s,{variant:"secondary",size:"sm",onClick:()=>r(!0),children:t("Switch to Box footer")}),children:t("Build this footer out of Boxes and blocks, like a page: the same menus, signup, social links and logo, with the copyright as a Legal Line. Your current footer is kept.")})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEasel as c}from"efficient-easel/easel";import{planTemplateRow as p,templateWrite as u}from"../lib/puck/template-field.js";import{useSectionOps as r}from"
|
|
1
|
+
"use client";import{useEasel as c}from"efficient-easel/easel";import{planTemplateRow as p,templateWrite as u}from"../lib/puck/template-field.js";import{useSectionOps as r}from"efficient-easel/screen/lib/puck/use-section-ops";function s({render:a,props:t}){const{appState:l,config:m}=c(o=>o),i=r(),e=t.name,n=e?p(m,l.data.content??[],l.ui.itemSelector,e):null;return a(!n||!e?t:{...t,value:n.value,onChange:o=>u(n,e,o,i.replaceComponent)})}export{s as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { EditorScreenParts } from "
|
|
1
|
+
import type { ScreenParts as EditorScreenParts } from "efficient-easel/screen/lib/screen-parts";
|
|
2
2
|
export declare const WEBSITE_SCREEN: EditorScreenParts;
|