efficient-web-builder 6.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/dist/components/DuplicateToPageMenu.js +1 -1
- package/dist/components/PagesPanel.js +1 -1
- package/dist/components/WebsiteScreenParts.js +1 -1
- package/dist/components/storefront-editor.css +83 -119
- package/dist/lib/editor-words-catalogue.d.ts +1 -7
- package/dist/lib/editor-words-catalogue.js +3 -3
- package/dist/lib/page-rows.d.ts +8 -0
- package/dist/lib/page-rows.js +1 -0
- package/package.json +2 -2
- package/dist/components/HeadingAudit.d.ts +0 -1
- package/dist/components/HeadingAudit.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.1.1 - 2026-10-14
|
|
4
|
+
|
|
5
|
+
- **"Duplicate to page" has no trailing dots** (owner ruling, 2026-10-14:
|
|
6
|
+
"…" means only that words were cut, so no button, link or menu label ends in
|
|
7
|
+
it). The menu heading now says the phrase the menu already names itself by,
|
|
8
|
+
so the editor's catalogue has one phrase fewer: `"Duplicate to page…"` is
|
|
9
|
+
gone. No host has a word for it (searched efficient-storefront,
|
|
10
|
+
efficient-admin-portal, efficient-storefront-blocks and efficient-easel).
|
|
11
|
+
- **`efficient-shell-ui-check` counts it now.** The dev shell is 7.19.0 and
|
|
12
|
+
`ui-kit.config.json` names `ellipsis-label`, which reads the phrase handed to
|
|
13
|
+
`say()`. Peer ranges are unchanged.
|
|
14
|
+
|
|
15
|
+
## 7.1.0 - 2026-10-14
|
|
16
|
+
|
|
17
|
+
- **The Layers head names the open page** ("About us", not "/about"; owner,
|
|
18
|
+
2026-10-14, editor audit item 10). The Pages head's second line names the
|
|
19
|
+
website, so the Layers head's names the page: each says what its panel is
|
|
20
|
+
about. The website hands the screen `useDocumentLabel`; the address stays
|
|
21
|
+
as the fallback while the list loads.
|
|
22
|
+
- **The page list is held once** (`lib/page-rows`): the Pages panel and the
|
|
23
|
+
Layers head read the same rows from one `listPages()` per site, instead of
|
|
24
|
+
the panel keeping its own copy.
|
|
25
|
+
|
|
26
|
+
## 7.0.1 - 2026-10-14
|
|
27
|
+
|
|
28
|
+
- **The Pages panel has one way to add a page** (Lewis, 2026-10-14). The bottom
|
|
29
|
+
"+ New page" button and its `.sf-pages-new` rules are gone. The panel head's
|
|
30
|
+
New page icon button already did the same thing. An empty list now says
|
|
31
|
+
"No pages yet. Add one with + above." and points at that head button. A host
|
|
32
|
+
that translated "No pages yet" gives the new sentence instead.
|
|
33
|
+
- **Pages list rows keep a 4px gap** (`.sf-pgroup-body`, `var(--space-4)`), the
|
|
34
|
+
shell Tree's own row gap. A hovered row next to the selected one is now two
|
|
35
|
+
rounded shapes, not one block.
|
|
36
|
+
- **The add dialog's busy button keeps saying "Add page"** and shows the shell
|
|
37
|
+
Button's spinner (`loading`). The "Adding…" label is gone (no trailing dots on
|
|
38
|
+
a button). The words catalogue is rewritten: 1,176 phrases.
|
|
39
|
+
- The new guard `scripts/test-pages-panel-one-add.ts` holds all three.
|
|
40
|
+
|
|
41
|
+
## 7.0.0 - 2026-10-14
|
|
42
|
+
|
|
43
|
+
- **The Layers panel no longer shows the heading outline** (owner,
|
|
44
|
+
2026-10-14, editor audit). The box under the tree — the heading count,
|
|
45
|
+
"No H1 — add one for SEO." and the list of headings by level — is removed,
|
|
46
|
+
not moved: it is not a layer, "H1" and "SEO" are not a merchant's words, and
|
|
47
|
+
on an empty page it read as an error. The website hands the screen no
|
|
48
|
+
`treeFoot` any more.
|
|
49
|
+
- **Breaking: `components/HeadingAudit` is deleted** (it was reachable through
|
|
50
|
+
the package's `./*` export). No host imports it. Its four words are out of
|
|
51
|
+
the editor's catalogue, and the `.sf-tree-tool` rule is gone with it.
|
|
52
|
+
- `lib/puck/heading-outline` stays: the one-H1 rule's join and the
|
|
53
|
+
storefront's guards still read it.
|
|
54
|
+
|
|
55
|
+
## 6.1.1 - 2026-10-14
|
|
56
|
+
|
|
57
|
+
- **The editor's stylesheet reads the shell's tokens instead of restating
|
|
58
|
+
them** (the duplicate scan of 2026-10-13, GG for Lewis). Every text size
|
|
59
|
+
reads a shell step token, as the shell's own `ui.css` does:
|
|
60
|
+
`var(--text-sm)` for 14, `--text-xs` for 12, `--text-2xs` for 11, and so on
|
|
61
|
+
(80 rules). The settings panel's side padding reads `var(--space-16)`, and
|
|
62
|
+
`var(--space-8)` in the narrow step. Same pixels; one place each. The theme
|
|
63
|
+
card's preview keeps its own px (a drawing).
|
|
64
|
+
- **Two rules no markup draws are deleted**: `.sf-addempty-sub` and
|
|
65
|
+
`.sf-readability-head`. Neither class appears in any repository's source
|
|
66
|
+
(web-builder, easel, storefront, storefront-blocks, admin and the portals);
|
|
67
|
+
the only hits were old CSS copies inlined in storefront's
|
|
68
|
+
`scripts/harness/*.html` snapshots.
|
|
69
|
+
- The padding guards' reader (`scripts/panel-body-padding.ts`) resolves the
|
|
70
|
+
shell's `--space-*` scale from the installed shell's `ui.css`, in px.
|
|
71
|
+
|
|
3
72
|
## 6.1.0 - 2026-10-14
|
|
4
73
|
|
|
5
74
|
**The editor speaks its host's language.** A host that runs in another
|
|
@@ -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{useEditorSession as q}from"../lib/editor-session-context.js";import{say as n}from"../lib/editor-words.js";import{cloneNodeWithFreshIds as G}from"../lib/puck/section-doc.js";import{FOOTER_TYPE as J}from"../lib/puck/content-tree.js";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(),[j,u]=s(!1),[d,b]=s(null),P=z(null),[p,B]=s(null),F=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]),O=()=>{if(c){r(!1);return}const e=P.current?.getBoundingClientRect();e&&B({top:e.bottom+6,right:Math.max(8,window.innerWidth-e.right)}),x(null),u(!1),F(),r(!0)},k=(y??[]).filter(e=>e.slug!==T),R=async e=>{if(d)return;b(e.slug);const w=G(N),S=o.documentHooks?.storedNode?.(w)??w,C=M(o).pages,v=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]:[],E=l.findIndex(_=>_?.type===J);l.splice(E===-1?l.length:E,0,S),await C.save(e.id,{layout:{root:{},zones:{},...f,content:l}},{version:m.version,clientId:""})});b(null),r(!1),I?.(v?n("Duplicated to “{name}”",{name:e.label}):n("Couldn’t duplicate the section — please retry"),v?"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:O,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
|
|
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{useEditorSession as q}from"../lib/editor-session-context.js";import{say as n}from"../lib/editor-words.js";import{cloneNodeWithFreshIds as G}from"../lib/puck/section-doc.js";import{FOOTER_TYPE as J}from"../lib/puck/content-tree.js";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(),[j,u]=s(!1),[d,b]=s(null),P=z(null),[p,B]=s(null),F=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]),O=()=>{if(c){r(!1);return}const e=P.current?.getBoundingClientRect();e&&B({top:e.bottom+6,right:Math.max(8,window.innerWidth-e.right)}),x(null),u(!1),F(),r(!0)},k=(y??[]).filter(e=>e.slug!==T),R=async e=>{if(d)return;b(e.slug);const w=G(N),S=o.documentHooks?.storedNode?.(w)??w,C=M(o).pages,v=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]:[],E=l.findIndex(_=>_?.type===J);l.splice(E===-1?l.length:E,0,S),await C.save(e.id,{layout:{root:{},zones:{},...f,content:l}},{version:m.version,clientId:""})});b(null),r(!1),I?.(v?n("Duplicated to “{name}”",{name:e.label}):n("Couldn’t duplicate the section — please retry"),v?"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:O,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")}),j?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:()=>{R(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 t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as r,Fragment as ne}from"react/jsx-runtime";import{useEffect as se,useId as oe,useMemo as j,useState as d}from"react";import{useStorefrontDocument as re}from"./StorefrontDocumentContext.js";import g from"./UiIcon.js";import le from"./SidePanelHead.js";import{useWebsiteName as ie}from"./WebsiteSettingsPanel.js";import{InspectorIconButton as ce}from"efficient-easel/chrome";import{Button as H,Dialog as de,FormField as pe,Input as me,Tooltip as R}from"efficient-shell/ui";import{AddIcon as ue}from"efficient-easel/icons";import{PagesIcon as he}from"efficient-easel/rail";import{useEditorHost as ge}from"../lib/editor-host.js";import{bucketEditorPageRows as fe,DYNAMIC_PAGES_GROUP_KEY as be,isDynamicPageRow as we,MAIN_PAGES_GROUP as ye}from"../lib/editor-page-rows.js";import{useEditorSession as Ne}from"../lib/editor-session-context.js";import{usePageRows as ke}from"../lib/page-rows.js";import{say as a}from"../lib/editor-words.js";const M="sf-editor-pages-collapsed-groups",ve=i=>i.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),U=(i,f)=>{const c=ve(i)||"page";if(!f.has(c))return c;let p=2;for(;f.has(`${c}-${p}`);)p+=1;return`${c}-${p}`};function Pe({onNavigate:i,onClose:f,activeSurface:c,onPreviewSurface:p}){const b=Ne().chrome?.pageRows,D=ge(),{adapter:w,capabilities:y,ready:L,currentSlug:O}=re(),q=ie(),{rows:l,reload:K,setRows:Y}=ke(),[P,J]=d(""),[m,N]=d(!1),[k,u]=d(null),[_,v]=d(!1),[h,C]=d(""),z=oe(),[S,Q]=d(()=>{if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(M);return new Set(e?JSON.parse(e):[])}catch{return new Set}});se(()=>{try{window.localStorage.setItem(M,JSON.stringify([...S]))}catch{}},[S]);const T=e=>Q(s=>{const n=new Set(s);return n.has(e)?n.delete(e):n.add(e),n}),V=j(()=>fe(l??[]),[l]),I=P.trim().toLowerCase(),F=e=>!I||e.toLowerCase().includes(I),X=e=>I?!0:!S.has(e),G=j(()=>new Set((l??[]).map(e=>e.slug)),[l]),Z=()=>{if(y.pageCreationInAdminForm){D.send("storefront-editor:new-page");return}C(""),u(null),v(!0)},W=async()=>{const e=h.trim();if(!(!e||!L||m||!w.createPage)){N(!0),u(null);try{const s=await w.createPage({slug:U(e,G),title:e,layout:{}});await K(),v(!1),C(""),i(s.slug)}catch{u(a("Couldn’t add the page — please retry."))}finally{N(!1)}}},ee=async e=>{if(!(!L||m||!w.deletePage||(l??[]).length<=1)){N(!0);try{await w.deletePage(e.id);const s=(l??[]).filter(n=>n.id!==e.id);Y(s),u(null),e.slug===O&&s[0]&&i(s[0].slug)}catch{u(a("Couldn’t delete the page — please retry."))}finally{N(!1)}}},te=e=>D.send("storefront-editor:open-page",{slug:e}),ae=e=>{if(!F(e.label))return null;const s=!c&&e.slug===O,n=y.canDeletePagesInline&&(l??[]).length>1;return r("div",{className:`sf-row sf-prow ${s?"is-selected":""}`,onClick:()=>i(e.slug),children:[t("span",{className:"sf-chip",children:t(Ce,{})}),t("span",{className:"sf-row-name",children:e.label}),we(e)&&t("span",{className:"sf-badge-dynamic",children:a("Dynamic")}),e.kind==="lightbox"&&t("span",{className:"sf-badge-lightbox",children:a("Lightbox")}),e.draft&&t("span",{className:"sf-page-draft",children:a("draft")}),y.pageCreationInAdminForm&&t(R,{content:a("Edit “{name}” in {place}",{name:e.label,place:a("the admin")}),children:t("button",{type:"button",className:"sf-page-edit","aria-label":a("Edit {name} in {place}",{name:e.label,place:a("the admin")}),onClick:o=>{o.stopPropagation(),te(e.slug)},children:t(g,{name:"pencil",size:13,strokeWidth:1.7,rounded:!0})})}),n&&t(R,{content:a("Delete “{name}”",{name:e.label}),children:t("button",{type:"button",className:"sf-page-edit sf-page-edit--danger",disabled:m,"aria-label":a("Delete {name}",{name:e.label}),onClick:o=>{o.stopPropagation(),ee(e)},children:t(g,{name:"trash",size:13,strokeWidth:1.7,rounded:!0})})})]},e.id)},A=(e,s,n)=>{const o=n.filter(Boolean);if(o.length===0)return null;const E=X(e);return r("div",{className:"sf-pgroup",children:[r("button",{type:"button",className:"sf-pgroup-head","aria-expanded":E,onClick:()=>T(e),children:[t(g,{name:"chevron-right",size:10,strokeWidth:2.6,rounded:!0,style:{transform:E?"rotate(90deg)":"none",transition:"transform 0.14s"}}),t("span",{className:"sf-pgroup-label",children:s}),t("span",{className:"sf-pgroup-count",children:o.length})]}),E&&t("div",{className:"sf-pgroup-body",children:o})]},e)},$=(b?.rows??[]).filter(e=>F(e.label)).map(e=>{const s=c===e.key;return r("div",{className:`sf-row sf-prow sf-prow--shop ${s?"is-selected":""}`,onClick:()=>p(e.key),children:[t("span",{className:"sf-chip",children:e.icon}),t("span",{className:"sf-row-name",children:e.label}),t("span",{className:"sf-badge-preview",children:a("Preview")}),t(R,{content:a("Open the {name} in a new tab",{name:e.label}),children:t("a",{className:"sf-page-edit",href:e.href,target:"_blank",rel:"noopener noreferrer","aria-label":a("Open the {name} in a new tab",{name:e.label}),onClick:n=>n.stopPropagation(),children:t(g,{name:"external-link",size:13,strokeWidth:1.7,rounded:!0})})})]},e.key)}),B=y.hasSiteSettings&&!!b,x=(()=>{if(l===null)return null;const e=[];let s=!1;for(const n of V){B&&!s&&n.key.startsWith("system:")&&(e.push(A("shop",b.title,$)),s=!0);const o=n.key===be||n.label===ye?a(n.label):n.label;e.push(A(n.key,o,n.rows.map(ae)))}return B&&!s&&e.push(A("shop",b.title,$)),e})();return r("div",{className:"sf-pages",children:[t(le,{icon:t(he,{}),title:a("Pages"),context:q,actions:t(ce,{label:a("New page"),onClick:Z,children:t(ue,{size:15})}),onHide:f}),r("div",{className:"sf-pages-search",children:[t(g,{name:"search",size:14,rounded:!0}),t("input",{type:"search",className:"sf-pages-search-input",placeholder:a("Search all pages…"),value:P,onChange:e=>J(e.target.value),"aria-label":a("Search all pages")})]}),r("div",{className:"sf-pages-list sf-scroll",children:[k&&!_&&t("div",{className:"sf-note sf-note--error",role:"alert",children:k}),x===null?t("div",{className:"sf-note",children:a("Loading…")}):x.some(Boolean)?x:t("div",{className:"sf-note",children:P.trim()?a("No pages match your search"):a("No pages yet. Add one with + above.")})]}),t(de,{open:_,onClose:()=>v(!1),size:"sm",title:a("Add a page"),description:a("Give the new template page a name. It starts blank — add sections once it opens."),footer:r(ne,{children:[t(H,{variant:"secondary",onClick:()=>v(!1),children:a("Cancel")}),t(H,{onClick:()=>{W()},disabled:m||!h.trim(),loading:m,children:a("Add page")})]}),children:t(pe,{label:a("Page name"),htmlFor:z,hint:h.trim()?a("URL: /{slug}",{slug:U(h,G)}):void 0,error:k??void 0,children:t(me,{id:z,value:h,invalid:!!k,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},placeholder:a("e.g. About")})})})]})}function Ce(){return r("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),t("path",{d:"M14 3v5h5"})]})}export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as k}from"react/jsx-runtime";import{useCallback as I,useEffect as S,useState as j}from"react";import{ExternalIcon as z}from"efficient-easel/icons";import{Button as K,Tooltip as A,buttonClasses as U}from"efficient-shell/ui";import{SettingsSwitch as Z}from"efficient-easel/panel";import{PagesIcon as q,StylesIcon as X}from"efficient-easel/rail";import{TreeRow as J}from"efficient-easel/tree";import{useEaselStrings as Q}from"efficient-easel/strings";import
|
|
1
|
+
"use client";import{jsx as r,jsxs as k}from"react/jsx-runtime";import{useCallback as I,useEffect as S,useState as j}from"react";import{ExternalIcon as z}from"efficient-easel/icons";import{Button as K,Tooltip as A,buttonClasses as U}from"efficient-shell/ui";import{SettingsSwitch as Z}from"efficient-easel/panel";import{PagesIcon as q,StylesIcon as X}from"efficient-easel/rail";import{TreeRow as J}from"efficient-easel/tree";import{useEaselStrings as Q}from"efficient-easel/strings";import{LocationsTreeContext as $}from"./LocationsTreeContext.js";import ee from"./PagesPanel.js";import{usePreviewChat as te}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as oe}from"./preview-devices.js";import{PreviewDeviceContext as re}from"./PreviewDeviceContext.js";import{usePreviewHeader as ie}from"./PreviewHeaderContext.js";import{usePreviewSocial as se}from"./PreviewSocialContext.js";import{usePreviewSurface as ne}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as ae,usePreviewTicker as ce}from"./PreviewTickerContext.js";import le,{CHAT_MODE as de,HEADER_MODE as B,SOCIAL_MODE as pe,WEBSITE_MODE as N}from"./SectionEditor.js";import C from"./SectionIcon.js";import me from"./SectionThumbnail.js";import{useStorefrontDocument as g}from"./StorefrontDocumentContext.js";import fe from"./StylesPanel.js";import ue from"./TemplateGlyph.js";import{useFooterFocus as Se}from"./useFooterFocus.js";import{LOCATIONS_TYPE as Te,useLocationsTree as Ee}from"./useLocationsTree.js";import{usePinnedChromeSeed as he}from"./usePinnedChromeSeed.js";import{usePreviewHref as we}from"./usePreviewHref.js";import{SITE_STYLES_TABS as be,SITE_STYLES_TEXT_TAB as Pe,useWebsiteName as ve}from"./WebsiteSettingsPanel.js";import{useOpenPageName as ke}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ie,duplicateBlocked as Ce,heroGroupNestDepth as ge}from"../lib/hero-group-placement.js";import{stripMarkup as _e}from"../lib/markup.js";import{categoryShortLabel as Le,PINNED_SECTION_TYPE as Oe}from"../lib/puck/add-palette.js";import{canAddTo as ye}from"../lib/puck/add-target.js";import{blockIsOffered as Ae}from"../lib/puck/block-offer.js";import{sectionIdOfBoxZone as Be,setBookingPreview as Ne}from"../lib/puck/booking-preview.js";import{footerBlockRowName as Re}from"../lib/puck/footer-block-row-name.js";import{FOOTER_TYPE as De,HEADER_TYPE as R}from"../lib/puck/footer-blocks.js";import{leftViewForSelection as He,readLeftView as We,resolveLeftView as xe,writeLeftView as Ve}from"../lib/puck/left-view.js";import{isLockedBlock as Me}from"../lib/puck/locked-blocks.js";import{scrollPreviewToSection as Ye,scrollPreviewToTop as D}from"../lib/puck/preview-dom.js";import{SiteCanvas as Fe}from"../lib/puck/overrides.js";import{labelAtLevel as Ge}from"../lib/puck/section-catalog.js";import{editorWords as je,say as i}from"../lib/editor-words.js";import{SECTION_DESCRIPTIONS as ze}from"../lib/puck/section-descriptions.js";import{isSectionGroupType as Ke,sectionGroupZone as Ue,SITE_FOOTER_TYPE as Ze,SITE_HEADER_TYPE as qe}from"../lib/puck/section-groups.js";import{resolveSaveAsTemplateAction as Xe,SAVE_AS_TEMPLATE_EVENT as Je}from"../lib/save-as-template-action.js";import{newSectionNode as Qe}from"../lib/sections/new-section-node.js";import{useHostProducts as $e}from"../lib/use-host-products.js";function H({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:s}=ce(),f=Q().tree,c=e,l=c.kind==="ticker"?c.heroId:null,n=I(d=>{if(!d)return;t({kind:"ticker",heroId:d}),Ye(d)},[t]);return S(()=>{o(l)},[l,o]),S(()=>{s(n)},[s,n]),{partRows:(d,{rowClick:a})=>{const u=String(d.props.id);return d.type==="Hero"&&r(J,{icon:r(C,{type:"ticker",size:13}),name:i(ae),onSelect:()=>n(u),selected:l===u,rowProps:{onClick:a(()=>n(u))},words:f})}}}function et(){const{adapter:e,capabilities:t,currentSlug:o,siteId:s,hasUnsavedEdits:f,bridgeCapabilities:c,notifyParent:l,token:n}=g(),{hasPreviewLink:d}=t,a=Xe({hasTrustedConsole:!!n,canCreatePlatformTemplate:c.canCreatePlatformTemplate,capabilities:t,siteId:s,hasUnsavedEdits:f}),u=I(()=>{!s||!o||l(Je,{siteId:s,slug:o})},[l,s,o]),T=we({pageSlug:o,siteId:s,token:n}),E=e.previewHref?.(o)??T;return{barLead:()=>a.visible&&r(A,{side:"bottom",content:a.enabled?i("Save this website as a platform template"):i(a.disabledReason),children:r("span",{className:"sf-tip-disabled",tabIndex:a.enabled?void 0:0,children:r(K,{variant:"secondary",disabled:!a.enabled,onClick:u,rightIcon:r(ue,{}),children:i("Save as Template")})})}),barTrail:()=>d&&o&&r(A,{content:i("Preview the live site (opens in a new tab)"),children:k("a",{className:U({variant:"secondary"}),href:E,target:"_blank",rel:"noopener noreferrer","aria-label":i("Preview the live site in a new tab"),children:[i("Preview"),r(z,{size:15})]})})}}function tt(){return k("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round",children:[r("path",{d:"M12 3a9 9 0 0 0 0 18 2.3 2.3 0 0 0 2.3-2.3c0-.55-.22-1.05-.57-1.42-.34-.37-.56-.87-.56-1.43A2.35 2.35 0 0 1 15.6 13.5H18a3 3 0 0 0 3-3c0-4.14-4-7.5-9-7.5z"}),r("circle",{cx:"7.7",cy:"11.3",r:"1.05",fill:"currentColor",stroke:"none"}),r("circle",{cx:"12",cy:"8",r:"1.05",fill:"currentColor",stroke:"none"}),r("circle",{cx:"16",cy:"11",r:"1.05",fill:"currentColor",stroke:"none"})]})}function ot(e,t){const{capabilities:o,templateId:s,siteId:f,tokenRef:c,navigate:l}=g(),{hasSiteTheme:n,explainsSiteSettings:d}=o,a=p=>t.setView(p),[u,T]=j(be[0].id),{surface:E,setSurface:b}=ne(),P=()=>{if(n){a("styles"),t.reveal(),D();return}e.show(N),e.reveal(),D()},v={id:"pages",label:i("Pages"),icon:r(q,{}),panel:({onHide:p})=>r(ee,{activeSurface:E,onPreviewSurface:b,onNavigate:m=>{b(null),l(s?{kind:"template",id:s,pageSlug:m}:{kind:"page",slug:m,siteId:f??void 0})},onClose:p})},h=[];return!n&&d&&h.push({id:"appearance",label:i("Appearance"),icon:r(tt,{}),active:e.kind==="website",onSelect:P}),n&&h.push({id:"styles",label:i("Site styles"),icon:r(X,{}),panel:({onHide:p,notify:m})=>r(fe,{tokenRef:c,siteId:f??void 0,onClose:p,onNotify:m,tab:u,onTabChange:T})}),{railLead:[v],railTrail:h,resolveLeftView:(p,m)=>xe(p,n,m),openSettings:P,openStyles:()=>{T(Pe),a("styles")}}}function rt(e,t,o,s){const{kind:f,open:c}=e,{selected:l,zoneOf:n}=t,d=Se(t,o);S(()=>{Ne(l?.type==="BookingBox"&&l.props.region==="confirm"?Be(n(String(l.props.id))):null)},[l?.props.id]);const a=Ee(e,t),{capabilities:{hasSiteSettings:u}}=g(),{setSelected:T,setSelectHandler:E}=ie(),{chat:b,setChat:P,setSelected:v,setSelectHandler:h}=te(),p=f==="header";S(()=>{T(p)},[p,T]),S(()=>{E(()=>c(B))},[E,c]);const m=I(()=>c(de),[c]),L=f==="chat";S(()=>{v(L)},[L,v]),S(()=>{h(m)},[h,m]);const{setOpenHandler:O}=se(),y=I(()=>c(pe),[c]);S(()=>{O(y)},[O,y]);const V=H(e),M=et(),Y=ot(e,s),F=o.device;return{...d,...V,...M,...Y,hasOwnRows:w=>w.type===Te,ownRows:a.renderLocationTree,sectionPressed:a.sectionPressed,wrap:w=>r($.Provider,{value:!0,children:r(re.Provider,{value:F,children:w})}),addPanelRow:w=>u?k("div",{className:"sf-addside-sitewide",children:[r("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:r(C,{type:"chat",size:16})}),k("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{w(),m()},children:[i("Live chat"),r("span",{className:"sf-addside-sitewide-desc",children:i("A chat bubble on every page")})]}),r(Z,{checked:b.enabled,onChange:G=>P({enabled:G}),ariaLabel:i("Show the chat bubble on the whole site")})]}):void 0}}let W=null,_=new WeakMap;function it(e){const t=je();if(!e||!t)return e;W!==t&&(W=t,_=new WeakMap);let o=_.get(e);return o||(o={...e,choices:e.choices?e.choices.map(s=>({...s,label:i(s.label)})):null,spec:e.spec?{...e.spec,addLabel:i(e.spec.addLabel)}:null},_.set(e,o)),o}const st={isLockedBlock:Me,duplicateBlocked:Ce,nestDepth:(e,t,o)=>t===Ie?ge(e,o):0,newSectionNode:Qe,canAddTo:(e,t)=>it(ye(e,t)),blockIsOffered:Ae},nt=new Proxy(ze,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?i(o):o}}),at={labelAtLevel:(e,t,o)=>i(Ge(e,t,o)),descriptions:nt,categoryLabel:e=>{const t=Le(e);return t===void 0?void 0:i(t)},firstSection:Oe,blockRowName:Re,plainText:_e,Icon:C,Thumbnail:me,useProducts:$e},ct={desktop:2e3,tablet:800,mobile:390},x="desktop",lt={options:oe,initial:x,fluid:x,widths:ct},dt={read:We,write:e=>Ve(e),forSelection:(e,t)=>He(e,t)},pt={first:R,last:De,firstGroup:qe,lastGroup:Ze,isSectionGroup:Ke,sectionGroupZone:Ue,panelOf:e=>e===R?B:null};function mt(e){return{...H(e),openSettings:()=>e.show(N)}}const ao={useOwnerName:ve,useDocumentLabel:ke,useBridges:rt,useStandaloneBridges:mt,useDocumentPass:he,blockRules:st,blockLook:at,devices:lt,leftView:dt,pinned:pt,Canvas:Fe,Inspector:le};export{ao as WEBSITE_SCREEN};
|