efficient-web-builder 70.2.0 → 70.4.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 +22 -0
- package/dist/editor/components/AddPageOnOpen.d.ts +4 -0
- package/dist/editor/components/AddPageOnOpen.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/format/lib/document/section-catalog.js +1 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 70.4.0 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
From main at `f6660eee`: #786. A minor: no `!`, no export is removed, no export changes its type, the peers stay `efficient-easel` `^35.0.0` and `efficient-shell` `^13.17.0`. One new export. No stored key or value moves.
|
|
6
|
+
|
|
7
|
+
**For hosts:**
|
|
8
|
+
- No step is required. A host that opens the editor with `openAddPage` now sees the Add page window open, whatever view the merchant left the editor on.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`openAddPage` opens the Add page window** (#786): the Pages panel takes the request only while it is drawn, and the editor reopens on the view the merchant left (Layers, Site styles, or the left side closed), so the window did not open. The website screen now shows the Pages view and brings the left panel out while a request waits; the panel takes it as before. New export `useShowPagesForAddPage` (`components/AddPageOnOpen`).
|
|
13
|
+
|
|
14
|
+
## 70.3.0 - 2026-11-18
|
|
15
|
+
|
|
16
|
+
From main at `43530778`: #782. A minor: no `!`, no export is removed, no export changes its type, the peers stay `efficient-easel` `^35.0.0` and `efficient-shell` `^13.17.0`. Two record entries are added. No stored key or value moves.
|
|
17
|
+
|
|
18
|
+
**For hosts:**
|
|
19
|
+
- No step is required. A host that registers a Product Hero row (efficient-storefront-blocks) now gets it from the Add menu's press; with no host row, a press is the ordinary insert, as before.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **Product Hero presses its host row** (#782): `ProductHero` joins `HOST_PRESS_BLOCKS` (so it is in `HOST_PRESS_TYPES` and `SECTION_TO_BOX_PRESS`), with the blocks its host row lays down outside the general set: `ProductGallery`, `ProductEyebrow`, `ProductName`, `ProductPrice`, `ProductBuyButton`. `UNLISTED_BLOCK_SETS` gives `ProductBuyButton` the `commerce` set, so a host that names its sets keeps it.
|
|
24
|
+
|
|
3
25
|
## 70.2.0 - 2026-11-17
|
|
4
26
|
|
|
5
27
|
From main at `874c0488`: #780. A minor: no `!`, no export is removed, no export changes its type, the peers stay `efficient-easel` `^35.0.0` and `efficient-shell` `^13.17.0`. New exports and one optional prop. No stored key or value moves.
|
|
@@ -4,3 +4,7 @@ export declare function AddPageOnOpen({ open, children }: {
|
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
}): import("react").JSX.Element;
|
|
6
6
|
export declare function useTakeAddPageOnOpen(): () => boolean;
|
|
7
|
+
export declare function useShowPagesForAddPage(left: {
|
|
8
|
+
setView: (view: "pages") => void;
|
|
9
|
+
reveal: () => void;
|
|
10
|
+
}): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as s}from"react/jsx-runtime";import{createContext as c,useContext as u,useEffect as a,useRef as o}from"react";const n=c(null);function d({open:e,children:t}){const r=o(!!e);return s(n.Provider,{value:r,children:t})}function l(){const e=u(n);return()=>e?.current?(e.current=!1,!0):!1}function p(e){const t=u(n),r=o(e);r.current=e,a(()=>{t?.current&&(r.current.setView("pages"),r.current.reveal())},[t])}export{d as AddPageOnOpen,p as useShowPagesForAddPage,l as useTakeAddPageOnOpen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,Fragment as y,jsxs as C}from"react/jsx-runtime";import{useCallback as v,useEffect as g,useRef as te,useState as B}from"react";import{SettingsSwitch as oe}from"efficient-easel/panel";import{PagesIcon as re,StylesIcon as ne}from"efficient-easel/rail";import{PaletteIcon as ie}from"efficient-shell/icons/efficient";import{Subtree as se,TreeRow as D}from"efficient-easel/tree";import{useEasel as N}from"efficient-easel/easel";import{toItemSelector as ae}from"efficient-easel/node-ops";import{useEaselStrings as H}from"efficient-easel/strings";import{LocationsTreeContext as ce}from"./LocationsTreeContext.js";import{usePartTypingDeps as de}from"./usePartTypingDeps.js";import{copyItemWrite as le}from"../lib/document/card-copy-rows.js";import pe from"./PagesPanel.js";import{usePreviewChat as me}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as ue}from"./preview-devices.js";import{PreviewDeviceContext as fe}from"efficient-easel/draw/client";import{usePreviewSocial as Se}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as Ee}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as he,usePreviewTicker as Pe}from"../../render/components/PreviewTickerContext.js";import{heroStoresLegacyTicker as Te}from"../../format/lib/hero-ticker.js";import{usePreviewHeroPart as we}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as ge,HERO_PART_MODE as W,heroMediaRows as Ie,heroPartId as V,readHeroPartId as be}from"../../render/lib/document/hero-media-parts.js";import ve,{CHAT_MODE as _e,HEADER_MODE as ke,SOCIAL_MODE as Ce,WEBSITE_MODE as M,WEBSITE_PAGE_MODE as Re}from"./SectionEditor.js";import R from"./SectionIcon.js";import Le from"./SectionThumbnail.js";import{useScreenDocument as L}from"efficient-easel/screen/components/ScreenDocumentContext";import Oe from"./StylesPanel.js";import{LOCATIONS_TYPE as Ae,useLocationsTree as ye}from"./useLocationsTree.js";import{usePinnedChromeSeed as Be}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as De}from"./useHostDocumentBridge.js";import{usePreviewHref as Ne}from"./usePreviewHref.js";import{WebsitePreviewButton as He}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as We,SITE_STYLES_TABS as Ve,SITE_STYLES_TEXT_TAB as Me,useWebsiteName as xe}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Ge}from"./useWebsiteMainAction.js";import{VersionHistory as Ye}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as Fe}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as ze,heroGroupNestDepth as Ke}from"../../format/lib/hero-group-placement.js";import{stripMarkup as je}from"../../format/lib/markup.js";import{categoryShortLabel as Ue,PINNED_SECTION_TYPE as Ze}from"../lib/document/add-palette.js";import{canAddTo as qe}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as Xe}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as Je}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as Qe,setBookingPreview as $e}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as et}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as tt}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as ot,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as rt,readLeftView as nt,resolveLeftView as it,writeLeftView as st}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as at}from"../lib/document/locked-blocks.js";import{everyPageNotice as ct,noOwnTab as dt,pinnedReach as Y,websiteDuplicateBlocked as lt}from"../lib/document/every-page.js";import{sharedSectionReach as pt,WEBSITE_SHARED_SECTIONS as mt}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as ut}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as _}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as ft,scrollPreviewToTop as z}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as St}from"../lib/document/overrides.js";import{labelAtLevel as Et}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as ht}from"../../format/lib/document/media-drop.js";import{editorWords as Pt,say as f}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as Tt}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as wt,isSectionGroupType as gt,sectionGroupZone as It,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as bt}from"../../format/lib/document/section-groups.js";import{SaveAsTemplateButton as vt}from"./SaveAsTemplateButton.js";import{resolveSaveAsTemplateAction as _t,SAVE_AS_TEMPLATE_EVENT as kt}from"../../format/lib/save-as-template-action.js";import{menuPresets as Ct}from"../lib/sections/menu-presets.js";import{newSectionNode as Rt}from"../lib/sections/new-section-node.js";import{useHostProducts as Lt}from"../lib/use-host-products.js";import{backendOf as Ot}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Pe(),c=H().tree,d=e,n=d.kind==="ticker"?d.heroId:null,s=v(i=>{if(!i)return;t({kind:"ticker",heroId:i}),ft(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(s)},[r,s]),{partRows:(i,{rowClick:m})=>{const S=String(i.props.id);return i.type==="Hero"&&Te(i.props)&&a(D,{icon:a(R,{type:"ticker",size:13}),name:f(he),onSelect:()=>s(S),selected:n===S,rowProps:{onClick:m(()=>s(S))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=we(),c=H().tree,{appState:d,config:n}=N(p=>p),s=te({data:d.data,config:n});s.current={data:d.data,config:n};const i=e,m=ge.find(p=>W[p]===i.kind),S=m&&"nodeId"in i?V(String(i.nodeId),m):null,h=v(p=>{const l=be(p);if(!l)return;const{data:T,config:P}=s.current,u=ae(T,P,{kind:"node",id:l.nodeId});if(!u)return;const I={kind:W[l.part],nodeId:l.nodeId};t({index:u.index,zone:u.zone},I)},[t]);return g(()=>{o(S)},[S,o]),g(()=>{r(h)},[r,h]),{partRows:(p,{rowClick:l})=>{const T=String(p.props.id),P=Ie(p);if(P.length===0)return null;const u=E=>{const w=V(T,E.part);return a(D,{icon:a(R,{type:E.part==="media"?"heroMedia":"heroImage",size:13}),name:f(E.label),onSelect:()=>h(w),selected:S===w,rowProps:{onClick:l(()=>h(w))},words:c},w)},[I,...b]=P;return C(y,{children:[u(I),b.length>0&&a(se,{children:b.map(u)})]})}}}function Z(e,t){return{partRows:(o,r)=>C(y,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function At(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:d,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=L(),{hasPreviewLink:S}=o,h=Ot(x()).preview?.draftLink,p=Ge(e.data),l=_t({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),T=v(()=>{!c||!r||i(kt,{siteId:c,slug:r})},[i,c,r]),P=Ne({pageSlug:r,siteId:c,token:m}),u=t.previewHref?.(r)??P;return{barLead:()=>l.visible&&a(vt,{enabled:l.enabled,reason:l.enabled?"":l.disabledReason,onSaved:T}),barView:()=>S&&r&&a(He,{liveHref:u,pageId:d??null,draftLink:h}),mainAction:p}}function yt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:d,navigate:n}=L(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=E=>t.setView(E),[S,h]=B(Ve[0].id),[p,l]=B(!1),{surface:T,setSurface:P}=Ee(),u=()=>{if(s){m("styles"),t.reveal(),z();return}e.show(M),e.reveal(),z()},I={id:"pages",label:f("Pages"),icon:a(re,{}),panel:({onHide:E})=>a(pe,{activeSurface:T,onPreviewSurface:P,onNavigate:w=>{P(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:c??void 0})},onClose:E})},b=[];return!s&&i&&b.push({id:"appearance",label:f("Appearance"),icon:a(ie,{}),active:e.kind==="website",onSelect:u}),s&&b.push({id:"styles",label:f("Styles"),icon:a(ne,{}),panel:({onHide:E,notify:w})=>a(Oe,{tokenRef:d,siteId:c??void 0,onClose:E,onNotify:w,tab:S,onTabChange:h,revealPageGroup:p,onPageGroupRevealed:()=>l(!1)})}),{railLead:[I],railTrail:b,resolveLeftView:E=>it(E,s),openSettings:u,openStyles:()=>{h(Me),m("styles")},openPageStyles:s?()=>{h(We),l(!0),m("styles"),t.reveal()}:i?()=>{e.show(Re),e.reveal()}:void 0}}function Bt(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=L(),c=N(n=>n.config),d=x();g(()=>(F({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>F(null)),[e,t,o,c]),g(()=>{const n=O();if(!n||!r)return;let s=!1;return ut(d).list().then(i=>{s||n.learn(i)}).catch(()=>{}),()=>{s=!0}},[r,d])}function q(){const e=de();return v(t=>{le(t,e)},[e])}function Dt(e,t,o,r){const{kind:c,open:d}=e,{selected:n,zoneOf:s}=t;g(()=>{$e(n?.type==="BookingBox"&&n.props.region==="confirm"?Qe(s(String(n.props.id))):null)},[n?.props.id]);const i=ye(e,t),{capabilities:{hasSiteSettings:m}}=L();Bt();const{chat:S,setChat:h,setSelected:p,setSelectHandler:l}=me(),T=v(()=>d(_e),[d]),P=c==="chat";g(()=>{p(P)},[P,p]),g(()=>{l(T)},[l,T]);const{setOpenHandler:u}=Se(),I=v(()=>d(Ce),[d]);g(()=>{u(I)},[u,I]);const b=Z(j(e),U(e)),E=At(t),w=yt(e,r),Q=o.device,$=q();return{...b,...E,...w,hasOwnRows:k=>k.type===Ae,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,onCopyItem:$,wrap:k=>a(ce.Provider,{value:!0,children:C(fe.Provider,{value:Q,children:[k,a(Ye,{})]})}),addPanelRow:k=>m?C("div",{className:"sf-addside-sitewide",children:[a("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:a(R,{type:"chat",size:16})}),C("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),T()},children:[f("Live chat"),a("span",{className:"sf-addside-sitewide-desc",children:f("A chat bubble on every page")})]}),a(oe,{checked:S.enabled,onChange:ee=>h({enabled:ee}),ariaLabel:f("Show the chat bubble on the whole site")})]}):void 0}}let X=null,A=new WeakMap;function Nt(e){const t=Pt();if(!e||!t)return e;X!==t&&(X=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:f(r.label)})):null,spec:e.spec?{...e.spec,addLabel:f(e.spec.addLabel),...e.spec.childLabel?{childLabel:f(e.spec.childLabel)}:{}}:null},A.set(e,o)),o}const Ht={isLockedBlock:(e,t)=>at(e,t)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:lt,nestDepth:(e,t,o)=>t===ze?Ke(e,o):0,newSectionNode:Rt,canAddTo:(e,t,o,r)=>Nt(qe(e,t,r,o)),blockIsOffered:Je,slotsOf:Xe,resolveOnInsert:!0},Wt=new Proxy(Tt,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?f(o):o}}),Vt={labelAtLevel:(e,t,o)=>f(Et(e,t,o)),descriptions:Wt,categoryLabel:e=>{const t=Ue(e);return t===void 0?void 0:f(t)},firstSection:Ze,blockRowName:et,rowName:tt,plainText:je,Icon:R,Thumbnail:Le,useProducts:Lt,presets:Ct()},Mt={desktop:2e3,tablet:800,mobile:390},J="desktop",xt={options:ue,initial:J,fluid:J,widths:Mt,hidesPerView:!0},Gt={read:nt,write:e=>st(e),forSelection:(e,t)=>rt(e,t)},Yt={first:G,last:ot,firstGroup:bt,lastGroup:K,isSectionGroup:gt,sectionGroupZone:It,panelOf:e=>e===G?ke:null,get sharedReach(){return _()?zt:void 0},get shared(){return O()?mt:void 0},get groupTab(){return _()?dt:void 0},get groupBadge(){return _()?Y({type:K})??void 0:void 0},get changeNotice(){return _()?ct():void 0},get band(){return _()?Ft:void 0},get groupAccepts(){return _()?wt:void 0}},Ft={foldable:!0},zt=e=>Y(e)??pt(e);function Kt(e){return{...Z(j(e),U(e)),onCopyItem:q(),openSettings:()=>e.show(M)}}function jt(e,t){Be(e,t),De()}const ar={useOwnerName:xe,useDocumentLabel:Fe,useBridges:Dt,useStandaloneBridges:Kt,useDocumentPass:jt,blockRules:Ht,blockLook:Vt,devices:xt,leftView:Gt,pinned:Yt,Canvas:St,canvasDrag:{media:ht},Inspector:ve};export{ar as WEBSITE_SCREEN};
|
|
1
|
+
"use client";import{jsx as a,Fragment as y,jsxs as C}from"react/jsx-runtime";import{useCallback as v,useEffect as g,useRef as te,useState as B}from"react";import{SettingsSwitch as oe}from"efficient-easel/panel";import{PagesIcon as re,StylesIcon as ne}from"efficient-easel/rail";import{PaletteIcon as ie}from"efficient-shell/icons/efficient";import{Subtree as se,TreeRow as D}from"efficient-easel/tree";import{useEasel as N}from"efficient-easel/easel";import{toItemSelector as ae}from"efficient-easel/node-ops";import{useEaselStrings as H}from"efficient-easel/strings";import{LocationsTreeContext as ce}from"./LocationsTreeContext.js";import{usePartTypingDeps as de}from"./usePartTypingDeps.js";import{copyItemWrite as le}from"../lib/document/card-copy-rows.js";import pe from"./PagesPanel.js";import{useShowPagesForAddPage as me}from"./AddPageOnOpen.js";import{usePreviewChat as ue}from"./PreviewChatContext.js";import{PREVIEW_DEVICES as fe}from"./preview-devices.js";import{PreviewDeviceContext as Se}from"efficient-easel/draw/client";import{usePreviewSocial as Ee}from"../../render/components/PreviewSocialContext.js";import{usePreviewSurface as Pe}from"./PreviewSurfaceContext.js";import{TICKER_PART_LABEL as he,usePreviewTicker as Te}from"../../render/components/PreviewTickerContext.js";import{heroStoresLegacyTicker as we}from"../../format/lib/hero-ticker.js";import{usePreviewHeroPart as ge}from"../../render/components/PreviewHeroPartContext.js";import{HERO_MEDIA_PARTS as Ie,HERO_PART_MODE as W,heroMediaRows as be,heroPartId as V,readHeroPartId as ve}from"../../render/lib/document/hero-media-parts.js";import _e,{CHAT_MODE as ke,HEADER_MODE as Ce,SOCIAL_MODE as Re,WEBSITE_MODE as M,WEBSITE_PAGE_MODE as Le}from"./SectionEditor.js";import R from"./SectionIcon.js";import Oe from"./SectionThumbnail.js";import{useScreenDocument as L}from"efficient-easel/screen/components/ScreenDocumentContext";import Ae from"./StylesPanel.js";import{LOCATIONS_TYPE as ye,useLocationsTree as Be}from"./useLocationsTree.js";import{usePinnedChromeSeed as De}from"./usePinnedChromeSeed.js";import{useHostDocumentBridge as Ne}from"./useHostDocumentBridge.js";import{usePreviewHref as He}from"./usePreviewHref.js";import{WebsitePreviewButton as We}from"./WebsitePreviewButton.js";import{SITE_STYLES_BASICS_TAB as Ve,SITE_STYLES_TABS as Me,SITE_STYLES_TEXT_TAB as xe,useWebsiteName as Ge}from"./WebsiteSettingsPanel.js";import{useWebsiteMainAction as Ye}from"./useWebsiteMainAction.js";import{VersionHistory as Fe}from"./VersionHistoryDrawer.js";import{useEaselSession as x}from"efficient-easel/screen/lib/session-context";import{useOpenPageName as ze}from"../lib/page-rows.js";import{HERO_GROUP_TYPE as Ke,heroGroupNestDepth as je}from"../../format/lib/hero-group-placement.js";import{stripMarkup as Ue}from"../../format/lib/markup.js";import{categoryShortLabel as Ze,PINNED_SECTION_TYPE as qe}from"../lib/document/add-palette.js";import{canAddTo as Xe}from"../lib/document/add-target.js";import{cardTemplateSlotsOf as Je}from"../../format/lib/document/card-template-layers.js";import{blockIsOffered as Qe}from"../lib/document/block-offer.js";import{sectionIdOfBoxZone as $e,setBookingPreview as et}from"../../render/lib/document/booking-preview.js";import{footerBlockRowName as tt}from"../../format/lib/document/footer-block-row-name.js";import{sourceRowName as ot}from"../../format/lib/document/source-row-name.js";import{FOOTER_TYPE as rt,HEADER_TYPE as G}from"../lib/document/footer-blocks.js";import{leftViewForSelection as nt,readLeftView as it,resolveLeftView as st,writeLeftView as at}from"../../format/lib/document/left-view.js";import{websiteNodeIsLocked as ct}from"../lib/document/locked-blocks.js";import{everyPageNotice as dt,noOwnTab as lt,pinnedReach as Y,websiteDuplicateBlocked as pt}from"../lib/document/every-page.js";import{sharedSectionReach as mt,WEBSITE_SHARED_SECTIONS as ut}from"../lib/shared-sections-layer.js";import{activeSharedSections as O,setSharedEditor as F}from"../../format/lib/shared-sections-active.js";import{sharedSectionsOf as ft}from"efficient-easel/screen/lib/shared-sections";import{pinnedChromeInPlace as _}from"../../format/lib/pinned-chrome-lock.js";import{scrollPreviewToSection as St,scrollPreviewToTop as z}from"efficient-easel/screen/lib/document/preview-dom";import{SiteCanvas as Et}from"../lib/document/overrides.js";import{labelAtLevel as Pt}from"../../format/lib/document/section-catalog.js";import{WEBSITE_MEDIA_DROP as ht}from"../../format/lib/document/media-drop.js";import{editorWords as Tt,say as f}from"../../format/lib/editor-words.js";import{SECTION_DESCRIPTIONS as wt}from"../../format/lib/document/section-descriptions.js";import{groupAccepts as gt,isSectionGroupType as It,sectionGroupZone as bt,SITE_FOOTER_TYPE as K,SITE_HEADER_TYPE as vt}from"../../format/lib/document/section-groups.js";import{SaveAsTemplateButton as _t}from"./SaveAsTemplateButton.js";import{resolveSaveAsTemplateAction as kt,SAVE_AS_TEMPLATE_EVENT as Ct}from"../../format/lib/save-as-template-action.js";import{menuPresets as Rt}from"../lib/sections/menu-presets.js";import{newSectionNode as Lt}from"../lib/sections/new-section-node.js";import{useHostProducts as Ot}from"../lib/use-host-products.js";import{backendOf as At}from"../lib/website-session.js";function j({mode:e,open:t}){const{setSelectedHeroId:o,setSelectHandler:r}=Te(),c=H().tree,d=e,n=d.kind==="ticker"?d.heroId:null,s=v(i=>{if(!i)return;t({kind:"ticker",heroId:i}),St(i)},[t]);return g(()=>{o(n)},[n,o]),g(()=>{r(s)},[r,s]),{partRows:(i,{rowClick:m})=>{const S=String(i.props.id);return i.type==="Hero"&&we(i.props)&&a(D,{icon:a(R,{type:"ticker",size:13}),name:f(he),onSelect:()=>s(S),selected:n===S,rowProps:{onClick:m(()=>s(S))},words:c})}}}function U({mode:e,select:t}){const{setSelectedHeroPart:o,setSelectHandler:r}=ge(),c=H().tree,{appState:d,config:n}=N(p=>p),s=te({data:d.data,config:n});s.current={data:d.data,config:n};const i=e,m=Ie.find(p=>W[p]===i.kind),S=m&&"nodeId"in i?V(String(i.nodeId),m):null,P=v(p=>{const l=ve(p);if(!l)return;const{data:T,config:h}=s.current,u=ae(T,h,{kind:"node",id:l.nodeId});if(!u)return;const I={kind:W[l.part],nodeId:l.nodeId};t({index:u.index,zone:u.zone},I)},[t]);return g(()=>{o(S)},[S,o]),g(()=>{r(P)},[r,P]),{partRows:(p,{rowClick:l})=>{const T=String(p.props.id),h=be(p);if(h.length===0)return null;const u=E=>{const w=V(T,E.part);return a(D,{icon:a(R,{type:E.part==="media"?"heroMedia":"heroImage",size:13}),name:f(E.label),onSelect:()=>P(w),selected:S===w,rowProps:{onClick:l(()=>P(w))},words:c},w)},[I,...b]=h;return C(y,{children:[u(I),b.length>0&&a(se,{children:b.map(u)})]})}}}function Z(e,t){return{partRows:(o,r)=>C(y,{children:[e.partRows?.(o,r),t.partRows?.(o,r)]})}}function yt(e){const{adapter:t,capabilities:o,currentSlug:r,siteId:c,docId:d,hasUnsavedEdits:n,bridgeCapabilities:s,notifyParent:i,token:m}=L(),{hasPreviewLink:S}=o,P=At(x()).preview?.draftLink,p=Ye(e.data),l=kt({hasTrustedConsole:!!m,canCreatePlatformTemplate:s.canCreatePlatformTemplate,capabilities:o,siteId:c,hasUnsavedEdits:n}),T=v(()=>{!c||!r||i(Ct,{siteId:c,slug:r})},[i,c,r]),h=He({pageSlug:r,siteId:c,token:m}),u=t.previewHref?.(r)??h;return{barLead:()=>l.visible&&a(_t,{enabled:l.enabled,reason:l.enabled?"":l.disabledReason,onSaved:T}),barView:()=>S&&r&&a(We,{liveHref:u,pageId:d??null,draftLink:P}),mainAction:p}}function Bt(e,t){const{capabilities:o,templateId:r,siteId:c,tokenRef:d,navigate:n}=L(),{hasSiteTheme:s,explainsSiteSettings:i}=o,m=E=>t.setView(E),[S,P]=B(Me[0].id),[p,l]=B(!1),{surface:T,setSurface:h}=Pe(),u=()=>{if(s){m("styles"),t.reveal(),z();return}e.show(M),e.reveal(),z()},I={id:"pages",label:f("Pages"),icon:a(re,{}),panel:({onHide:E})=>a(pe,{activeSurface:T,onPreviewSurface:h,onNavigate:w=>{h(null),n(r?{kind:"template",id:r,pageSlug:w}:{kind:"page",slug:w,siteId:c??void 0})},onClose:E})},b=[];return!s&&i&&b.push({id:"appearance",label:f("Appearance"),icon:a(ie,{}),active:e.kind==="website",onSelect:u}),s&&b.push({id:"styles",label:f("Styles"),icon:a(ne,{}),panel:({onHide:E,notify:w})=>a(Ae,{tokenRef:d,siteId:c??void 0,onClose:E,onNotify:w,tab:S,onTabChange:P,revealPageGroup:p,onPageGroupRevealed:()=>l(!1)})}),{railLead:[I],railTrail:b,resolveLeftView:E=>st(E,s),openSettings:u,openStyles:()=>{P(xe),m("styles")},openPageStyles:s?()=>{P(Ve),l(!0),m("styles"),t.reveal()}:i?()=>{e.show(Le),e.reveal()}:void 0}}function Dt(){const{navigate:e,siteId:t,reloadFromServer:o,docId:r}=L(),c=N(n=>n.config),d=x();g(()=>(F({openPage:n=>e({kind:"page",slug:n.slug,siteId:t??void 0}),reload:()=>{o()},config:c}),()=>F(null)),[e,t,o,c]),g(()=>{const n=O();if(!n||!r)return;let s=!1;return ft(d).list().then(i=>{s||n.learn(i)}).catch(()=>{}),()=>{s=!0}},[r,d])}function q(){const e=de();return v(t=>{le(t,e)},[e])}function Nt(e,t,o,r){const{kind:c,open:d}=e,{selected:n,zoneOf:s}=t;g(()=>{et(n?.type==="BookingBox"&&n.props.region==="confirm"?$e(s(String(n.props.id))):null)},[n?.props.id]);const i=Be(e,t),{capabilities:{hasSiteSettings:m}}=L();Dt();const{chat:S,setChat:P,setSelected:p,setSelectHandler:l}=ue(),T=v(()=>d(ke),[d]),h=c==="chat";g(()=>{p(h)},[h,p]),g(()=>{l(T)},[l,T]);const{setOpenHandler:u}=Ee(),I=v(()=>d(Re),[d]);g(()=>{u(I)},[u,I]);const b=Z(j(e),U(e)),E=yt(t),w=Bt(e,r);me(r);const Q=o.device,$=q();return{...b,...E,...w,hasOwnRows:k=>k.type===ye,ownRows:i.renderLocationTree,sectionPressed:i.sectionPressed,onCopyItem:$,wrap:k=>a(ce.Provider,{value:!0,children:C(Se.Provider,{value:Q,children:[k,a(Fe,{})]})}),addPanelRow:k=>m?C("div",{className:"sf-addside-sitewide",children:[a("span",{className:"sf-addside-sitewide-glyph","aria-hidden":"true",children:a(R,{type:"chat",size:16})}),C("button",{type:"button",className:"sf-addside-sitewide-name",onClick:()=>{k(),T()},children:[f("Live chat"),a("span",{className:"sf-addside-sitewide-desc",children:f("A chat bubble on every page")})]}),a(oe,{checked:S.enabled,onChange:ee=>P({enabled:ee}),ariaLabel:f("Show the chat bubble on the whole site")})]}):void 0}}let X=null,A=new WeakMap;function Ht(e){const t=Tt();if(!e||!t)return e;X!==t&&(X=t,A=new WeakMap);let o=A.get(e);return o||(o={...e,choices:e.choices?e.choices.map(r=>({...r,label:f(r.label)})):null,spec:e.spec?{...e.spec,addLabel:f(e.spec.addLabel),...e.spec.childLabel?{childLabel:f(e.spec.childLabel)}:{}}:null},A.set(e,o)),o}const Wt={isLockedBlock:(e,t)=>ct(e,t)||!!(t&&O()?.heldElsewhere(t.props.id)),duplicateBlocked:pt,nestDepth:(e,t,o)=>t===Ke?je(e,o):0,newSectionNode:Lt,canAddTo:(e,t,o,r)=>Ht(Xe(e,t,r,o)),blockIsOffered:Qe,slotsOf:Je,resolveOnInsert:!0},Vt=new Proxy(wt,{get:(e,t)=>{const o=Reflect.get(e,t);return typeof o=="string"?f(o):o}}),Mt={labelAtLevel:(e,t,o)=>f(Pt(e,t,o)),descriptions:Vt,categoryLabel:e=>{const t=Ze(e);return t===void 0?void 0:f(t)},firstSection:qe,blockRowName:tt,rowName:ot,plainText:Ue,Icon:R,Thumbnail:Oe,useProducts:Ot,presets:Rt()},xt={desktop:2e3,tablet:800,mobile:390},J="desktop",Gt={options:fe,initial:J,fluid:J,widths:xt,hidesPerView:!0},Yt={read:it,write:e=>at(e),forSelection:(e,t)=>nt(e,t)},Ft={first:G,last:rt,firstGroup:vt,lastGroup:K,isSectionGroup:It,sectionGroupZone:bt,panelOf:e=>e===G?Ce:null,get sharedReach(){return _()?Kt:void 0},get shared(){return O()?ut:void 0},get groupTab(){return _()?lt:void 0},get groupBadge(){return _()?Y({type:K})??void 0:void 0},get changeNotice(){return _()?dt():void 0},get band(){return _()?zt:void 0},get groupAccepts(){return _()?gt:void 0}},zt={foldable:!0},Kt=e=>Y(e)??mt(e);function jt(e){return{...Z(j(e),U(e)),onCopyItem:q(),openSettings:()=>e.show(M)}}function Ut(e,t){De(e,t),Ne()}const dr={useOwnerName:Ge,useDocumentLabel:ze,useBridges:Nt,useStandaloneBridges:jt,useDocumentPass:Ut,blockRules:Wt,blockLook:Mt,devices:Gt,leftView:Yt,pinned:Ft,Canvas:Et,canvasDrag:{media:ht},Inspector:_e};export{dr as WEBSITE_SCREEN};
|
|
@@ -92,4 +92,4 @@ WHAT A MERCHANT LOSES until the wall is redone: the photo wall and the section h
|
|
|
92
92
|
|
|
93
93
|
Old sites stay as they are (owner, 2026-11-06); moving a stored page is a separate write that needs the owner's word.
|
|
94
94
|
|
|
95
|
-
THE TYPE KEY STAYS AND SO DOES THE COMPONENT. A stored Contact / Locations node still renders through it and can still be edited; no document is rewritten.`},PaymentBadges:{label:"Payment Methods",note:"Owner, 2026-10-10: Logos and Payment Methods are one block, and a payment wall is a Logos block with the payment chip for its look. 2026-11-07: the dot before each line is a Mark Box at full strength (approved).\n\nWHAT REPLACES IT: the Logos row (Layouts group), Logo style Cards. Field by field, as its converter row (`section-to-box-rows-logos`) moves it: `heading` is a Text block; each of `badges` is a Logo block in the wall, its name the Logo's name and its `src` the Logo's picture; `dataSource` is the wall's own Logo content row (\"Ways to pay here\" or \"Ways to pay at checkout\", served by the backend to Logos too), and the wall draws ONE Logo card template per served method, the same chip; `assurances` are a Reassurance Box of lines, each a Mark Box (an empty Box, 4 x 4, Corners 2, Fill main) before a Text; `contained` is the Box's site frame. A press of this type lays down that Box (SECTION_TO_BOX_PRESS).\n\nWHAT A MERCHANT LOSES: the 60% and 70% opacity of the old dot and words (a Box and a Text have no opacity: the dot is the main colour, the words the label ink) and the 4px gap between wrapped lines (a Box has one Gap). No field is lost.\n\n4 Payment Methods nodes are stored on the US sites, all on template pages, draft only, all fed by a source; 0 on pages (read only, 2026-11-07). Old sites stay as they are (owner, 2026-11-06); moving a page is a separate write.\n\nTHE TYPE KEY STAYS AND SO DOES THE COMPONENT. A stored Payment Methods node still renders through it, its dot included, and can still be edited; no document is rewritten."},Gallery:{label:"Tabbed Gallery",note:'Owner, 2026-10-10 (approved): the Tabbed Gallery goes into the Customer Photo Grid, and the one that is left is called Gallery; its vehicle / wheel / others halves become a Tabs list, and its wall becomes one of the photo layouts. Retired from the Add menu with no preset row and no migration.\n\nWHAT REPLACES IT, field by field: the Gallery (`GalleryB`). `mode` both = a Box in Tabs mode with one Gallery per panel; one mode = one Gallery, no Tabs Box. `vehicleTabLabel` / `wheelTabLabel` = the Box\'s panel names, Tab shape "Large tabs" (this strip is the Tabbed Gallery\'s own, class for class); `showTabs` off = the Box Stacked. `source` (one product, or All products and a `category`) = each Gallery\'s `dataSource: "product-pictures"`, with `product`, `designCode`, `mediaZone` (lifestyle = the vehicle half, photos = the wheel half, others) and `category`; it reads live on every view, nothing is baked. `kicker`, the titles, `*Body1` / `*Body2` = Text blocks in the panel\'s Box (Heading N, Body N); `showIntro` off = the Layers eye. `*Stats` = a Stats block; `breadcrumbLabel` = a Breadcrumb block; `showFilters`, `showCount`, `showSort` = a Filter chips block over the Gallery (`showCount`, `showSort`). A card\'s `image`, `photos`, `href`, `name`, `meta`, `process` (the Tag) and `eyebrow` (the caption line over the title) = a Gallery Item\'s, or the served row\'s. The wall (two half, then thirds, 4:3, one across on a phone) = layout "Two, then threes" (`twoThenThreesPhoto`), the default for product pictures. Words at rest, the tile number, the hover zoom and the lightbox\'s "View product" are the Gallery card\'s. `previewTab` = the Box Tabs pane switch; `previewHover` = the Gallery\'s own. `anchor`, `sectionAccent` and `_partStyles` are the same injected keys on the Box and the Gallery.\n\nWHAT A MERCHANT LOSES: the per-tab note under each tab ("N items · Community photos" / "Featured photos", desktop only): Large tabs draws the letter and the name only. Accepted only because nothing stored moves now. ⛔ A "Tab note" Box setting MUST exist before the /gallery move: a moved page with no home for it loses a line the shopper sees. Also lost: the empty line ("No items in this gallery yet." / "No items match this filter."); an empty Gallery draws nothing, and the chips come from the tiles, so "no match" cannot happen.\n\nNO CONVERTER ROW: no stored node is rewritten and SECTION_TO_BOX_ON stays without it (owner, 2026-11-06: old sites stay as they are). 2 Tabbed Gallery nodes are stored on the US sites, both top level, draft equal to published (read only, 2026-11-08): `Gallery-f1eb706a` (inovit.com /gallery: mode both, every show flag on, All products, 10 + 10 cards, 20 of 20 with a caption, 3 + 3 stats) and `Gallery-ce49eb98` (hartesmetal.com /gallery: mode vehicles, count and stats on, All products, 49 cards, 0 with a caption, 2 stats).\n\nTHE MOVE RECIPE, for the day the owner orders the /gallery move (a live write, his word): a Box in Tabs mode (inovit) or one Gallery (hartes); each Gallery `dataSource: "product-pictures"`, `mediaZone` lifestyle / photos, and `displayPhone: {tag:true}` (a new Gallery stores `{tag:false}`, and the Tabbed Gallery drew its Tag at every width). The captions: the stored ones are frozen copies that live only in the page; a product-pictures row serves its media group\'s `vehicle` as `eyebrow`, and that is empty on every group today (the editor\'s product binding clears `eyebrow` and reads only `vehicle`). So carry them as typed Gallery Items with the stored `eyebrow` copies, OR fill each media group\'s `vehicle` first (a data write). It needs efficient-storefront-blocks 0.91.0 (the photo layout default and the stored cards kept on open) and the backend\'s product-pictures source (106.0.0).\n\nTHE TYPE KEY STAYS AND SO DOES THE COMPONENT (efficient-storefront-blocks GalleryShowcase). A stored Tabbed Gallery still renders through it and can still be edited, its source row, cover, width, heading level and settings groups included; in Layers it keeps its block\'s own label, "Tabbed Gallery". Delete the component only when the last stored `Gallery` node is gone.'}},p=Object.fromEntries(Object.entries(l).map(([e,t])=>[e,t.note])),S=["Grid","Spacer","TyreFitment"],f=Array.from(new Set([...o.flatMap(e=>e.sections.map(t=>t.type)),...Object.keys(p)])),u=Object.fromEntries(Object.entries(l).map(([e,t])=>[e,t.label])),O={...u,...Object.fromEntries(o.flatMap(e=>e.sections.map(t=>[t.type,t.label])))},m={Heading:"general",Text:"general",Eyebrow:"general",ImageBlock:"general",LogoBlock:"general",LocationMap:"general",Contents:"general",ListSearch:"general",ButtonBlock:"general",CardList:"general",HostPart:"general",PostCard:"general",HeroSlide:"general",HeroGroup:"general",Integrations:"general",Grid:"general",KeyFeatures:"general",Spacer:"general",Series:"general",DocMetaCards:"general",StatsParagraph:"general",Testimonials:"general",Masthead:"general",CategoryBar:"general",CollectionCard:"commerce",GalleryItem:"commerce",ProductRef:"commerce",CompatibleTyres:"commerce",DeliveryOptions:"commerce",Header:"commerce",SearchBlock:"commerce",CartBlock:"commerce",CountrySwitchBlock:"commerce",AccountBlock:"commerce",ThemeSwitchBlock:"commerce",ProductGallery:"commerce",EuTyreLabelBlock:"commerce",WheelDiagram:"commerce",SubmitBox:"service",BookingBox:"service",SubscribeBlogs:"service",RatingBlock:"service",Footer:"service",FooterLogo:"service",FooterMenu:"service",FooterDivider:"service",FooterGroup:"service",FooterText:"service",FooterEmailSignup:"service",FooterSocial:"service",FooterPayment:"service",MenuBlock:"service",MenuLinkBlock:"service",ProductPrice:"commerce",ProductSize:"commerce",ProductColour:"commerce",ProductPicture:"commerce",ProductEyebrow:"commerce",ProductName:"commerce",ProductSpecs:"commerce",ProductBuy:"commerce",FitmentPicker:"commerce",StockFitment:"commerce",RelatedProducts:"commerce",BundleOffer:"commerce",TyreFitment:"commerce",EuTyreLabel:"commerce",PaymentBadges:"general",ContactLocations:"general",HeroSingle:"general",Gallery:"commerce",EmailFormBlock:"service",SocialLogosBlock:"service",PaymentLogosBlock:"service",LegalLineBlock:"service",SiteHeader:"service",SiteFooter:"service"},r={...m,...Object.fromEntries(o.flatMap(e=>e.sections.map(t=>[t.type,t.set])))},
|
|
95
|
+
THE TYPE KEY STAYS AND SO DOES THE COMPONENT. A stored Contact / Locations node still renders through it and can still be edited; no document is rewritten.`},PaymentBadges:{label:"Payment Methods",note:"Owner, 2026-10-10: Logos and Payment Methods are one block, and a payment wall is a Logos block with the payment chip for its look. 2026-11-07: the dot before each line is a Mark Box at full strength (approved).\n\nWHAT REPLACES IT: the Logos row (Layouts group), Logo style Cards. Field by field, as its converter row (`section-to-box-rows-logos`) moves it: `heading` is a Text block; each of `badges` is a Logo block in the wall, its name the Logo's name and its `src` the Logo's picture; `dataSource` is the wall's own Logo content row (\"Ways to pay here\" or \"Ways to pay at checkout\", served by the backend to Logos too), and the wall draws ONE Logo card template per served method, the same chip; `assurances` are a Reassurance Box of lines, each a Mark Box (an empty Box, 4 x 4, Corners 2, Fill main) before a Text; `contained` is the Box's site frame. A press of this type lays down that Box (SECTION_TO_BOX_PRESS).\n\nWHAT A MERCHANT LOSES: the 60% and 70% opacity of the old dot and words (a Box and a Text have no opacity: the dot is the main colour, the words the label ink) and the 4px gap between wrapped lines (a Box has one Gap). No field is lost.\n\n4 Payment Methods nodes are stored on the US sites, all on template pages, draft only, all fed by a source; 0 on pages (read only, 2026-11-07). Old sites stay as they are (owner, 2026-11-06); moving a page is a separate write.\n\nTHE TYPE KEY STAYS AND SO DOES THE COMPONENT. A stored Payment Methods node still renders through it, its dot included, and can still be edited; no document is rewritten."},Gallery:{label:"Tabbed Gallery",note:'Owner, 2026-10-10 (approved): the Tabbed Gallery goes into the Customer Photo Grid, and the one that is left is called Gallery; its vehicle / wheel / others halves become a Tabs list, and its wall becomes one of the photo layouts. Retired from the Add menu with no preset row and no migration.\n\nWHAT REPLACES IT, field by field: the Gallery (`GalleryB`). `mode` both = a Box in Tabs mode with one Gallery per panel; one mode = one Gallery, no Tabs Box. `vehicleTabLabel` / `wheelTabLabel` = the Box\'s panel names, Tab shape "Large tabs" (this strip is the Tabbed Gallery\'s own, class for class); `showTabs` off = the Box Stacked. `source` (one product, or All products and a `category`) = each Gallery\'s `dataSource: "product-pictures"`, with `product`, `designCode`, `mediaZone` (lifestyle = the vehicle half, photos = the wheel half, others) and `category`; it reads live on every view, nothing is baked. `kicker`, the titles, `*Body1` / `*Body2` = Text blocks in the panel\'s Box (Heading N, Body N); `showIntro` off = the Layers eye. `*Stats` = a Stats block; `breadcrumbLabel` = a Breadcrumb block; `showFilters`, `showCount`, `showSort` = a Filter chips block over the Gallery (`showCount`, `showSort`). A card\'s `image`, `photos`, `href`, `name`, `meta`, `process` (the Tag) and `eyebrow` (the caption line over the title) = a Gallery Item\'s, or the served row\'s. The wall (two half, then thirds, 4:3, one across on a phone) = layout "Two, then threes" (`twoThenThreesPhoto`), the default for product pictures. Words at rest, the tile number, the hover zoom and the lightbox\'s "View product" are the Gallery card\'s. `previewTab` = the Box Tabs pane switch; `previewHover` = the Gallery\'s own. `anchor`, `sectionAccent` and `_partStyles` are the same injected keys on the Box and the Gallery.\n\nWHAT A MERCHANT LOSES: the per-tab note under each tab ("N items · Community photos" / "Featured photos", desktop only): Large tabs draws the letter and the name only. Accepted only because nothing stored moves now. ⛔ A "Tab note" Box setting MUST exist before the /gallery move: a moved page with no home for it loses a line the shopper sees. Also lost: the empty line ("No items in this gallery yet." / "No items match this filter."); an empty Gallery draws nothing, and the chips come from the tiles, so "no match" cannot happen.\n\nNO CONVERTER ROW: no stored node is rewritten and SECTION_TO_BOX_ON stays without it (owner, 2026-11-06: old sites stay as they are). 2 Tabbed Gallery nodes are stored on the US sites, both top level, draft equal to published (read only, 2026-11-08): `Gallery-f1eb706a` (inovit.com /gallery: mode both, every show flag on, All products, 10 + 10 cards, 20 of 20 with a caption, 3 + 3 stats) and `Gallery-ce49eb98` (hartesmetal.com /gallery: mode vehicles, count and stats on, All products, 49 cards, 0 with a caption, 2 stats).\n\nTHE MOVE RECIPE, for the day the owner orders the /gallery move (a live write, his word): a Box in Tabs mode (inovit) or one Gallery (hartes); each Gallery `dataSource: "product-pictures"`, `mediaZone` lifestyle / photos, and `displayPhone: {tag:true}` (a new Gallery stores `{tag:false}`, and the Tabbed Gallery drew its Tag at every width). The captions: the stored ones are frozen copies that live only in the page; a product-pictures row serves its media group\'s `vehicle` as `eyebrow`, and that is empty on every group today (the editor\'s product binding clears `eyebrow` and reads only `vehicle`). So carry them as typed Gallery Items with the stored `eyebrow` copies, OR fill each media group\'s `vehicle` first (a data write). It needs efficient-storefront-blocks 0.91.0 (the photo layout default and the stored cards kept on open) and the backend\'s product-pictures source (106.0.0).\n\nTHE TYPE KEY STAYS AND SO DOES THE COMPONENT (efficient-storefront-blocks GalleryShowcase). A stored Tabbed Gallery still renders through it and can still be edited, its source row, cover, width, heading level and settings groups included; in Layers it keeps its block\'s own label, "Tabbed Gallery". Delete the component only when the last stored `Gallery` node is gone.'}},p=Object.fromEntries(Object.entries(l).map(([e,t])=>[e,t.note])),S=["Grid","Spacer","TyreFitment"],f=Array.from(new Set([...o.flatMap(e=>e.sections.map(t=>t.type)),...Object.keys(p)])),u=Object.fromEntries(Object.entries(l).map(([e,t])=>[e,t.label])),O={...u,...Object.fromEntries(o.flatMap(e=>e.sections.map(t=>[t.type,t.label])))},m={Heading:"general",Text:"general",Eyebrow:"general",ImageBlock:"general",LogoBlock:"general",LocationMap:"general",Contents:"general",ListSearch:"general",ButtonBlock:"general",CardList:"general",HostPart:"general",PostCard:"general",HeroSlide:"general",HeroGroup:"general",Integrations:"general",Grid:"general",KeyFeatures:"general",Spacer:"general",Series:"general",DocMetaCards:"general",StatsParagraph:"general",Testimonials:"general",Masthead:"general",CategoryBar:"general",CollectionCard:"commerce",GalleryItem:"commerce",ProductRef:"commerce",CompatibleTyres:"commerce",DeliveryOptions:"commerce",Header:"commerce",SearchBlock:"commerce",CartBlock:"commerce",CountrySwitchBlock:"commerce",AccountBlock:"commerce",ThemeSwitchBlock:"commerce",ProductGallery:"commerce",EuTyreLabelBlock:"commerce",WheelDiagram:"commerce",SubmitBox:"service",BookingBox:"service",SubscribeBlogs:"service",RatingBlock:"service",Footer:"service",FooterLogo:"service",FooterMenu:"service",FooterDivider:"service",FooterGroup:"service",FooterText:"service",FooterEmailSignup:"service",FooterSocial:"service",FooterPayment:"service",MenuBlock:"service",MenuLinkBlock:"service",ProductPrice:"commerce",ProductSize:"commerce",ProductColour:"commerce",ProductPicture:"commerce",ProductEyebrow:"commerce",ProductName:"commerce",ProductSpecs:"commerce",ProductBuy:"commerce",ProductBuyButton:"commerce",FitmentPicker:"commerce",StockFitment:"commerce",RelatedProducts:"commerce",BundleOffer:"commerce",TyreFitment:"commerce",EuTyreLabel:"commerce",PaymentBadges:"general",ContactLocations:"general",HeroSingle:"general",Gallery:"commerce",EmailFormBlock:"service",SocialLogosBlock:"service",PaymentLogosBlock:"service",LegalLineBlock:"service",SiteHeader:"service",SiteFooter:"service"},r={...m,...Object.fromEntries(o.flatMap(e=>e.sections.map(t=>[t.type,t.set])))},y={DocTabs:{set:"service",blocks:["MenuBlock"],reason:"the Tab Bar press holds the Menu block, whose only source is a Console menu; a stored bar's typed tabs need nothing, so the Tab Bar stays general"}};function A(e,t,a=y){const i=s(a,e);return i!==void 0&&!t.includes(i.set)}function v(e){return s(r,e)}function n(e){return Object.keys(r).filter(t=>s(r,t)===e).sort()}const C=n("general"),k=n("commerce"),B=n("service"),b="Flex",d="Box",x=`${d}es`;function g(e){return e==="section"?"Blank section":d}function N(e,t,a){return e===b?g(t):a}export{f as ALL_SECTION_TYPES,T as BLOCK_SETS,d as BOX_LABEL,x as BOX_LABEL_PLURAL,k as COMMERCE_BLOCKS,C as GENERAL_BLOCKS,c as INTEGRATIONS_DELETE_BY,h as KEY_FEATURES_DELETE_BY,b as LEVEL_NAMED_TYPE,y as PRESS_NEEDS_SET,S as RETIRED_NESTABLE_SECTIONS,p as RETIRED_SECTIONS,u as RETIRED_SECTION_LABELS,o as SECTION_CATALOG,O as SECTION_LABELS,B as SERVICE_BLOCKS,m as UNLISTED_BLOCK_SETS,v as blockSetOf,n as blocksInSet,E as buildBlockCategories,N as labelAtLevel,g as labelForFlex,A as pressWithheld};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se,parseSectionHeadPlacement as re}from"../../../format/lib/sections/section-head-placement.js";import{accentItalicRuns as ie}from"../../../format/lib/markup.js";import{seedNodes as ce}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ae}from"../../../format/lib/locations-grid.js";import{normalizeTheme as z}from"../../../format/lib/theme.js";import{hasOwnEntry as R,ownEntry as E}from"../../../format/lib/own-entry.js";const v=ee,_=te;function Ie(t){if(t.theme)return z(t.theme);const o=t.site?.themePresets;return o?z({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function de(t,o){return o===0?`${t}~box`:`${t}~box-${o+1}`}const A={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box), and its Scrolling Bar is a Box in its strip slot (Hero › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function Ne(t){for(const[o,s]of Object.entries(t)){if(R(A,o)&&E(A,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=s}}function Re(t){return E(A,t)}const Y=new Set(["id"]),P={},W=[],le={ProductGrid:["ProductColour","ProductEyebrow","ProductName","ProductPicture","ProductPrice","ProductRef","ProductSpecs"],Events:[],Collections:["CollectionCard"],GalleryB:["GalleryItem"],ContactRouting:[],ReviewForm:[],AppointmentBooking:["BookingBox"],Reviews:["RatingBlock"],CheckoutCTA:[],AlloyWheelsListing:["ProductBuy","ProductColour","ProductEyebrow","ProductName","ProductPicture","ProductPrice","ProductSpecs"],SpecTable:["EuTyreLabelBlock","WheelDiagram"],FitmentTable:[]},fe=Object.keys(le),pe=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ContactLocations","ProcessSteps",...fe,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","DocTabs","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Integrations","Countdown","FeaturedCover","IntroBleed","SectionHeader","TitleWithButtons","Prose","ParagraphsA","Banner","Cards"];function Ae(t){for(const[o,s]of Object.entries(t)){if(R(P,o)&&E(P,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);P[o]=s}}function Le(t){return E(P,t)}function He(){return Object.keys(P)}function ue(t){return R(P,t)&&W.includes(t)}function Fe(t,o=pe){return R(P,t)&&(o.includes(t)||ue(t))}function We(t){const o=E(se,t);if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const s=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&s.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&s.push({kind:"button",key:"linkText",href:"linkHref"}),s}const K=t=>Z(t),Ke=t=>K(t).text.trim()!=="";function he(t){if(t.includes("=="))return t;const o=t.indexOf("/"),s=o===-1?t:t.slice(0,o),r=s.trim();if(!r)return t;const a=s.indexOf(r);return`${s.slice(0,a)}==${r}==${s.slice(a+r.length)}${o===-1?"":t.slice(o)}`}const ye=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function me(t,o,s,r){const c={...t._partStyles?.text??{},...o??{},...s??{}};return(r==="center"||r==="right")&&c.align===void 0&&(c.align=r),Object.keys(c).length?{_partStyles:{text:c}}:{}}function ke(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const s=o[t.key];return{variant:(typeof s=="string"?E(t.map,s):void 0)??t.fallback}}function V(t,o,s,r,a={}){const c={...o};for(const u of t){const[m,$,j]=typeof u=="string"?[u,u,void 0]:u;if(s[m]===void 0)continue;const C=j?j(s[m],s,a):s[m];C===void 0?delete c[$]:c[$]=C,r(m,$,C===void 0)}return c}function be(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),s=a=>{for(const c of a??[])o.add(typeof c=="string"?c:c[0])},r=a=>{for(const c of a)switch(c.kind){case"text":case"image":o.add(c.key),c.kind==="image"&&c.alt&&o.add(c.alt);break;case"button":o.add(c.key),o.add(c.href),typeof c.variant=="object"&&o.add(c.variant.key);break;case"list":o.add(c.key);break;case"group":case"block":s(c.box),r(c.parts??[]);break;case"core":if(c.keep!=="rest"&&c.keep.forEach(u=>o.add(u)),Object.keys(c.rename??{}).forEach(u=>o.add(u)),c.derive?.reads.forEach(u=>o.add(u)),typeof c.slots!="function")for(const u of Object.values(c.slots??{}))for(const m of u)"kind"in m&&o.add(m.key);break}};for(const a of[t,...t.also??[]])s(a.box),r(a.parts);return o}const ge=t=>re(t.headPlacement)==="own-box";function xe(t){return ge(t)?"its head sits in a Box of its own above it (own-box): the row draws the head inline":void 0}function we(t,o){const s=t[o];return Array.isArray(s)&&s.some(a=>!!a&&typeof a=="object"&&typeof a.type=="string")?"already on the Box path: its items draw from a filled card template":void 0}function Be(t){const o=new Set,s=r=>{for(const a of r)if(a.kind==="group"||a.kind==="block")s(a.parts??[]);else if(a.kind==="core"&&a.slots&&typeof a.slots!="function")for(const[c,u]of Object.entries(a.slots))u.length>0&&u.every(m=>!("kind"in m))&&o.add(c)};for(const r of[t,...t.also??[]])s(r.parts);return[...o]}function Se(t,o,s){if(!s.press)for(const r of Be(t)){const a=we(o,r);if(a!==void 0)return a}}function Q(t,o,s={}){const r=t.props,a=(o.ownBoxConverts?void 0:xe(r))??Se(o,r,s)??o.skip?.(r);if(a!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],skipped:a};const c=String(r.id??t.type),u=[],m=[],$=new Set,j=(n,i)=>{u.push({key:n,home:i}),$.add(n)},C=r._partStyles??{},L=be(o);let M=0;const w=(n,i)=>({type:n,props:{...i,id:`${c}~${n}-${++M}`}}),X=(n,i,b,y,g,f,B)=>{if(g){for(const d of n??[]){const h=typeof d=="string"?d:d[0];b[h]!==void 0&&B(h,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof i=="function"?i(r,s):i??{};return V(n??[],e,b,(d,h,l)=>B(d,l?`nothing — the old value draws nothing (${y}: no ${h})`:`${f}${y}: ${h}`),s)},q=n=>ce(n,i=>`${c}~${i}-${++M}`),D=(n,i,b)=>{const y=n.of?n.of(i):Array.isArray(i[n.key])?i[n.key]:[],g=typeof n.props=="function"?n.props(r,s):n.props??{},f=y.map((l,x)=>{const p=l??{},k=n.item?.(p,x,r)??{},S=I(k.reverse?[...n.parts].reverse():n.parts,p,!1,`item ${x+1}: `);return n.flat?k.props?S.map(T=>({...T,props:{...T.props,...k.props,id:T.props.id}})):S:[w(v,{name:`${n.name} ${x+1}`,...g,...k.props??{},[_]:S})]});if(n.groups){const l=n.groups;return b(n.key,y.length?`one Box per item (${y.length}), in a Box per group`:"nothing — the list is empty"),ae(y.map(x=>x??{}),l.of,l.of).map((x,p)=>{const k=x.items.map(O=>O.item),S=l.parts?I(l.parts,l.head?.(k,r)??{},!1,`group ${p+1}: `):[],T=x.items.map(O=>f[O.index]),H=l.perRow?.(k.length,r),N=Number.isInteger(H)&&H>=1?H:1,F=[];if(l.perRow&&N<T.length)for(let O=0;O*N<T.length;O++)F.push(T.slice(O*N,(O+1)*N).flat());return w(v,{name:`${l.name} ${p+1}`,...l.props??{},[_]:[...S,w(v,{name:`${l.itemsName} ${p+1}`,...l.itemsProps?.(k.length,r)??{},[_]:F.length?F.map((O,U)=>w(v,{name:`${l.rowName??`${l.itemsName} row`} ${U+1}`,...l.rowProps??{},[_]:O})):T.flat()})]})})}const B=n.perRow?.(r),e=n.perRow?Number.isInteger(B)&&B>=1?B:1:0;if(b(n.key,(y.length?n.flat?`each item's parts (${y.length} items), in order`:`one Box per item (${y.length}), its parts inside`:"nothing — the list is empty")+(e&&y.length?`, in rows of ${e}`:"")),!e)return f.flat();const d=typeof n.rowProps=="function"?n.rowProps(r,s):n.rowProps??{},h=[];for(let l=0;l*e<f.length;l++){const x=f.slice(l*e,(l+1)*e).flat(),p=n.rowFiller?e-f.slice(l*e,(l+1)*e).length:0;h.push(w(v,{name:`${n.rowName??`${n.name} row`} ${l+1}`,...d,[_]:[...x,...Array.from({length:p},(k,S)=>w(v,{name:`Empty ${S+1}`,...n.rowFiller,[_]:[]}))]}))}return h},I=(n,i,b,y)=>{const g=[],f=(e,d)=>b?j(e,d):void 0,B=e=>b?C[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:i)))switch(e.kind){case"text":{const d=K(i[e.key]);if(!d.text.trim()&&!(b&&s.press&&o.pressKeepsEmpty?.includes(e.key))){f(e.key,"nothing — empty words draw nothing, so no block");break}const h=ye(e.role??"body"),{_partStyles:l,...x}=h,p=me(h,e.styleFrom?{...e.style,...e.styleFrom(r,s)}:e.style,B(e.key),e.props?.align);g.push(w("Text",{text:e.mark==="accentLead"?he(d.text):e.mark==="accentItalic"?ie(d.text):d.text,...x,...e.props??{},...p,...d.hidden?{_hidden:!0}:{}})),f(e.key,`${y}Text block: its words${d.hidden?", hidden":""}`);break}case"button":{const d=K(i[e.key]);if(!d.text.trim()){f(e.key,"nothing — no words, no button"),f(e.href,"nothing — no button to link"),typeof e.variant=="object"&&f(e.variant.key,"nothing — no button to style");break}const h=typeof i[e.href]=="string"&&i[e.href]?i[e.href]:"#",l={...e.style??{},...B(e.key)??{}};g.push(w("ButtonBlock",{label:d.text,href:h,...typeof e.props=="function"?e.props(i,s):e.props??{},...ke(e.variant,i),...Object.keys(l).length?{_partStyles:{label:l}}:{},...d.hidden?{_hidden:!0}:{}})),f(e.key,`${y}Button block: its words`),f(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&f(e.variant.key,`${y}Button block: its Style`);break}case"image":{const d=i[e.key];if(typeof d!="string"||!d){f(e.key,"nothing — no picture, no block"),e.alt&&f(e.alt,"nothing — no picture to describe");break}const h=e.alt&&typeof i[e.alt]=="string"?i[e.alt]:"";g.push(w("ImageBlock",{src:d,alt:h,...e.props??{}})),f(e.key,`${y}Image block: its picture`),e.alt&&f(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...D(e,i,f));break}case"group":{const d=I(e.parts,i,b,y),h=X(e.box,e.props,i,`${e.name} Box`,!d.length&&!e.keepEmpty,y,f);h&&g.push(w(v,{name:e.name,...h,[_]:d}));break}case"block":{const d=e.parts?I(e.parts,i,b,y):[],h=X(e.box,e.props,i,`${e.type} block`,!!e.parts&&!d.length&&!e.keepEmpty,y,f);h&&g.push(w(e.type,{...h,...e.slot?{[e.slot]:d}:{}}));break}case"core":{const d=e.as??t.type,h={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},l=e.keep==="rest"?Object.keys(i).filter(p=>!L.has(p)&&!(p in h)):e.keep;for(const p of l)i[p]!==void 0&&(h[p]=i[p],f(p,`the ${d} block inside the Box`));if(e.keep==="rest"){for(const k of Object.keys(e.props??{}))i[k]!==void 0&&!L.has(k)&&f(k,`nothing — the ${d} block inside the Box has the row's own value`);i.headPlacement!==void 0&&f("headPlacement",`the ${d} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(C).filter(([k])=>!L.has(k)));Object.keys(p).length&&(h._partStyles=p)}for(const[p,k]of Object.entries(e.rename??{}))i[p]!==void 0&&(h[k]=i[p],f(p,`the ${d} block inside the Box: ${k}`));if(e.derive){Object.assign(h,e.derive.props(i,s));for(const p of e.derive.reads)i[p]!==void 0&&f(p,`the ${d} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(i,s):e.slots??{};for(const[p,k]of Object.entries(x))h[p]=k.flatMap(S=>"kind"in S?D(S,i,f):q([S]));g.push(w(d,h));break}}return g},J=(n,i)=>{const b=i===0?"Box":`${n.name} Box`,y=I(n.parts,r,!0,i===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,s):n.boxProps??{},f=V(n.box??[],g,r,(B,e,d)=>j(B,d?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:v,props:{name:n.name,...f,[_]:y,id:de(c,i)}}},G=[o,...o.also??[]].map(J);r._partStyles!==void 0&&j("_partStyles","each old part's style moved to its new part");for(const[n,i]of Object.entries(o.reads??{}))r[n]!==void 0&&j(n,i);for(const[n,i]of Object.entries(o.drop??{}))n in r&&(m.push({key:n,why:i}),$.add(n));for(const n of Object.keys(r))Y.has(n)||$.has(n)||m.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:u,dropped:m,siteWrites:[...o.site?.(t,s)??[]]}}function Me(t,o=W,s={}){const r=t.content;if(!Array.isArray(r))return t;let a=!1;const c=r.flatMap(u=>{const m=u&&typeof u.type=="string"&&o.includes(u.type)?E(P,u.type):void 0;if(!m)return[u];const $=Q(u,m,s);return $.skipped!==void 0?[u]:(a=!0,$.nodes)});return a?{...t,content:c}:t}function Xe(t,o=W,s={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((a,c)=>{const u=a&&typeof a.type=="string"&&o.includes(a.type)?E(P,a.type):void 0;if(!u)return;const m=Q(a,u,s);m.skipped===void 0&&r.push({index:c,node:m.node,nodes:m.nodes})}),r}export{le as HOST_PRESS_BLOCKS,fe as HOST_PRESS_TYPES,_ as SECTION_BOX_SLOT,v as SECTION_BOX_TYPE,W as SECTION_TO_BOX_ON,pe as SECTION_TO_BOX_PRESS,Re as boxNativeReason,Q as convertSection,Me as convertSectionsInPage,Ie as convertTheme,ue as convertsToBox,we as filledTemplateHold,Ke as hasWords,ge as headInOwnBox,We as headParts,xe as ownBoxHold,Fe as pressesAsBox,Ne as registerBoxNativeSections,Ae as registerSectionToBox,de as sectionBoxIdOf,Xe as sectionToBoxEdits,Le as sectionToBoxRow,He as sectionToBoxTypes};
|
|
1
|
+
import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se,parseSectionHeadPlacement as re}from"../../../format/lib/sections/section-head-placement.js";import{accentItalicRuns as ie}from"../../../format/lib/markup.js";import{seedNodes as ce}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ae}from"../../../format/lib/locations-grid.js";import{normalizeTheme as z}from"../../../format/lib/theme.js";import{hasOwnEntry as R,ownEntry as E}from"../../../format/lib/own-entry.js";const v=ee,_=te;function Ie(t){if(t.theme)return z(t.theme);const o=t.site?.themePresets;return o?z({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function de(t,o){return o===0?`${t}~box`:`${t}~box-${o+1}`}const A={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box), and its Scrolling Bar is a Box in its strip slot (Hero › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function Ne(t){for(const[o,s]of Object.entries(t)){if(R(A,o)&&E(A,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=s}}function Re(t){return E(A,t)}const Y=new Set(["id"]),O={},W=[],le={ProductGrid:["ProductColour","ProductEyebrow","ProductName","ProductPicture","ProductPrice","ProductRef","ProductSpecs"],Events:[],Collections:["CollectionCard"],GalleryB:["GalleryItem"],ContactRouting:[],ReviewForm:[],AppointmentBooking:["BookingBox"],Reviews:["RatingBlock"],CheckoutCTA:[],AlloyWheelsListing:["ProductBuy","ProductColour","ProductEyebrow","ProductName","ProductPicture","ProductPrice","ProductSpecs"],SpecTable:["EuTyreLabelBlock","WheelDiagram"],FitmentTable:[],ProductHero:["ProductGallery","ProductEyebrow","ProductName","ProductPrice","ProductBuyButton"]},fe=Object.keys(le),ue=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ContactLocations","ProcessSteps",...fe,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","DocTabs","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Integrations","Countdown","FeaturedCover","IntroBleed","SectionHeader","TitleWithButtons","Prose","ParagraphsA","Banner","Cards"];function Ae(t){for(const[o,s]of Object.entries(t)){if(R(O,o)&&E(O,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);O[o]=s}}function Le(t){return E(O,t)}function He(){return Object.keys(O)}function pe(t){return R(O,t)&&W.includes(t)}function Fe(t,o=ue){return R(O,t)&&(o.includes(t)||pe(t))}function We(t){const o=E(se,t);if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const s=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&s.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&s.push({kind:"button",key:"linkText",href:"linkHref"}),s}const G=t=>Z(t),Ge=t=>G(t).text.trim()!=="";function ye(t){if(t.includes("=="))return t;const o=t.indexOf("/"),s=o===-1?t:t.slice(0,o),r=s.trim();if(!r)return t;const a=s.indexOf(r);return`${s.slice(0,a)}==${r}==${s.slice(a+r.length)}${o===-1?"":t.slice(o)}`}const he=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function me(t,o,s,r){const c={...t._partStyles?.text??{},...o??{},...s??{}};return(r==="center"||r==="right")&&c.align===void 0&&(c.align=r),Object.keys(c).length?{_partStyles:{text:c}}:{}}function ke(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const s=o[t.key];return{variant:(typeof s=="string"?E(t.map,s):void 0)??t.fallback}}function V(t,o,s,r,a={}){const c={...o};for(const p of t){const[m,$,j]=typeof p=="string"?[p,p,void 0]:p;if(s[m]===void 0)continue;const C=j?j(s[m],s,a):s[m];C===void 0?delete c[$]:c[$]=C,r(m,$,C===void 0)}return c}function be(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),s=a=>{for(const c of a??[])o.add(typeof c=="string"?c:c[0])},r=a=>{for(const c of a)switch(c.kind){case"text":case"image":o.add(c.key),c.kind==="image"&&c.alt&&o.add(c.alt);break;case"button":o.add(c.key),o.add(c.href),typeof c.variant=="object"&&o.add(c.variant.key);break;case"list":o.add(c.key);break;case"group":case"block":s(c.box),r(c.parts??[]);break;case"core":if(c.keep!=="rest"&&c.keep.forEach(p=>o.add(p)),Object.keys(c.rename??{}).forEach(p=>o.add(p)),c.derive?.reads.forEach(p=>o.add(p)),typeof c.slots!="function")for(const p of Object.values(c.slots??{}))for(const m of p)"kind"in m&&o.add(m.key);break}};for(const a of[t,...t.also??[]])s(a.box),r(a.parts);return o}const ge=t=>re(t.headPlacement)==="own-box";function xe(t){return ge(t)?"its head sits in a Box of its own above it (own-box): the row draws the head inline":void 0}function we(t,o){const s=t[o];return Array.isArray(s)&&s.some(a=>!!a&&typeof a=="object"&&typeof a.type=="string")?"already on the Box path: its items draw from a filled card template":void 0}function Be(t){const o=new Set,s=r=>{for(const a of r)if(a.kind==="group"||a.kind==="block")s(a.parts??[]);else if(a.kind==="core"&&a.slots&&typeof a.slots!="function")for(const[c,p]of Object.entries(a.slots))p.length>0&&p.every(m=>!("kind"in m))&&o.add(c)};for(const r of[t,...t.also??[]])s(r.parts);return[...o]}function Se(t,o,s){if(!s.press)for(const r of Be(t)){const a=we(o,r);if(a!==void 0)return a}}function Q(t,o,s={}){const r=t.props,a=(o.ownBoxConverts?void 0:xe(r))??Se(o,r,s)??o.skip?.(r);if(a!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],skipped:a};const c=String(r.id??t.type),p=[],m=[],$=new Set,j=(n,i)=>{p.push({key:n,home:i}),$.add(n)},C=r._partStyles??{},L=be(o);let K=0;const w=(n,i)=>({type:n,props:{...i,id:`${c}~${n}-${++K}`}}),M=(n,i,b,h,g,f,B)=>{if(g){for(const d of n??[]){const y=typeof d=="string"?d:d[0];b[y]!==void 0&&B(y,`nothing — the ${h} has no parts, so it is not drawn`)}return}const e=typeof i=="function"?i(r,s):i??{};return V(n??[],e,b,(d,y,l)=>B(d,l?`nothing — the old value draws nothing (${h}: no ${y})`:`${f}${h}: ${y}`),s)},q=n=>ce(n,i=>`${c}~${i}-${++K}`),X=(n,i,b)=>{const h=n.of?n.of(i):Array.isArray(i[n.key])?i[n.key]:[],g=typeof n.props=="function"?n.props(r,s):n.props??{},f=h.map((l,x)=>{const u=l??{},k=n.item?.(u,x,r)??{},S=I(k.reverse?[...n.parts].reverse():n.parts,u,!1,`item ${x+1}: `);return n.flat?k.props?S.map(T=>({...T,props:{...T.props,...k.props,id:T.props.id}})):S:[w(v,{name:`${n.name} ${x+1}`,...g,...k.props??{},[_]:S})]});if(n.groups){const l=n.groups;return b(n.key,h.length?`one Box per item (${h.length}), in a Box per group`:"nothing — the list is empty"),ae(h.map(x=>x??{}),l.of,l.of).map((x,u)=>{const k=x.items.map(P=>P.item),S=l.parts?I(l.parts,l.head?.(k,r)??{},!1,`group ${u+1}: `):[],T=x.items.map(P=>f[P.index]),H=l.perRow?.(k.length,r),N=Number.isInteger(H)&&H>=1?H:1,F=[];if(l.perRow&&N<T.length)for(let P=0;P*N<T.length;P++)F.push(T.slice(P*N,(P+1)*N).flat());return w(v,{name:`${l.name} ${u+1}`,...l.props??{},[_]:[...S,w(v,{name:`${l.itemsName} ${u+1}`,...l.itemsProps?.(k.length,r)??{},[_]:F.length?F.map((P,U)=>w(v,{name:`${l.rowName??`${l.itemsName} row`} ${U+1}`,...l.rowProps??{},[_]:P})):T.flat()})]})})}const B=n.perRow?.(r),e=n.perRow?Number.isInteger(B)&&B>=1?B:1:0;if(b(n.key,(h.length?n.flat?`each item's parts (${h.length} items), in order`:`one Box per item (${h.length}), its parts inside`:"nothing — the list is empty")+(e&&h.length?`, in rows of ${e}`:"")),!e)return f.flat();const d=typeof n.rowProps=="function"?n.rowProps(r,s):n.rowProps??{},y=[];for(let l=0;l*e<f.length;l++){const x=f.slice(l*e,(l+1)*e).flat(),u=n.rowFiller?e-f.slice(l*e,(l+1)*e).length:0;y.push(w(v,{name:`${n.rowName??`${n.name} row`} ${l+1}`,...d,[_]:[...x,...Array.from({length:u},(k,S)=>w(v,{name:`Empty ${S+1}`,...n.rowFiller,[_]:[]}))]}))}return y},I=(n,i,b,h)=>{const g=[],f=(e,d)=>b?j(e,d):void 0,B=e=>b?C[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:i)))switch(e.kind){case"text":{const d=G(i[e.key]);if(!d.text.trim()&&!(b&&s.press&&o.pressKeepsEmpty?.includes(e.key))){f(e.key,"nothing — empty words draw nothing, so no block");break}const y=he(e.role??"body"),{_partStyles:l,...x}=y,u=me(y,e.styleFrom?{...e.style,...e.styleFrom(r,s)}:e.style,B(e.key),e.props?.align);g.push(w("Text",{text:e.mark==="accentLead"?ye(d.text):e.mark==="accentItalic"?ie(d.text):d.text,...x,...e.props??{},...u,...d.hidden?{_hidden:!0}:{}})),f(e.key,`${h}Text block: its words${d.hidden?", hidden":""}`);break}case"button":{const d=G(i[e.key]);if(!d.text.trim()){f(e.key,"nothing — no words, no button"),f(e.href,"nothing — no button to link"),typeof e.variant=="object"&&f(e.variant.key,"nothing — no button to style");break}const y=typeof i[e.href]=="string"&&i[e.href]?i[e.href]:"#",l={...e.style??{},...B(e.key)??{}};g.push(w("ButtonBlock",{label:d.text,href:y,...typeof e.props=="function"?e.props(i,s):e.props??{},...ke(e.variant,i),...Object.keys(l).length?{_partStyles:{label:l}}:{},...d.hidden?{_hidden:!0}:{}})),f(e.key,`${h}Button block: its words`),f(e.href,`${h}Button block: its link`),typeof e.variant=="object"&&f(e.variant.key,`${h}Button block: its Style`);break}case"image":{const d=i[e.key];if(typeof d!="string"||!d){f(e.key,"nothing — no picture, no block"),e.alt&&f(e.alt,"nothing — no picture to describe");break}const y=e.alt&&typeof i[e.alt]=="string"?i[e.alt]:"";g.push(w("ImageBlock",{src:d,alt:y,...e.props??{}})),f(e.key,`${h}Image block: its picture`),e.alt&&f(e.alt,`${h}Image block: its alt text`);break}case"list":{g.push(...X(e,i,f));break}case"group":{const d=I(e.parts,i,b,h),y=M(e.box,e.props,i,`${e.name} Box`,!d.length&&!e.keepEmpty,h,f);y&&g.push(w(v,{name:e.name,...y,[_]:d}));break}case"block":{const d=e.parts?I(e.parts,i,b,h):[],y=M(e.box,e.props,i,`${e.type} block`,!!e.parts&&!d.length&&!e.keepEmpty,h,f);y&&g.push(w(e.type,{...y,...e.slot?{[e.slot]:d}:{}}));break}case"core":{const d=e.as??t.type,y={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},l=e.keep==="rest"?Object.keys(i).filter(u=>!L.has(u)&&!(u in y)):e.keep;for(const u of l)i[u]!==void 0&&(y[u]=i[u],f(u,`the ${d} block inside the Box`));if(e.keep==="rest"){for(const k of Object.keys(e.props??{}))i[k]!==void 0&&!L.has(k)&&f(k,`nothing — the ${d} block inside the Box has the row's own value`);i.headPlacement!==void 0&&f("headPlacement",`the ${d} block inside the Box: own-box`);const u=Object.fromEntries(Object.entries(C).filter(([k])=>!L.has(k)));Object.keys(u).length&&(y._partStyles=u)}for(const[u,k]of Object.entries(e.rename??{}))i[u]!==void 0&&(y[k]=i[u],f(u,`the ${d} block inside the Box: ${k}`));if(e.derive){Object.assign(y,e.derive.props(i,s));for(const u of e.derive.reads)i[u]!==void 0&&f(u,`the ${d} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(i,s):e.slots??{};for(const[u,k]of Object.entries(x))y[u]=k.flatMap(S=>"kind"in S?X(S,i,f):q([S]));g.push(w(d,y));break}}return g},J=(n,i)=>{const b=i===0?"Box":`${n.name} Box`,h=I(n.parts,r,!0,i===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,s):n.boxProps??{},f=V(n.box??[],g,r,(B,e,d)=>j(B,d?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:v,props:{name:n.name,...f,[_]:h,id:de(c,i)}}},D=[o,...o.also??[]].map(J);r._partStyles!==void 0&&j("_partStyles","each old part's style moved to its new part");for(const[n,i]of Object.entries(o.reads??{}))r[n]!==void 0&&j(n,i);for(const[n,i]of Object.entries(o.drop??{}))n in r&&(m.push({key:n,why:i}),$.add(n));for(const n of Object.keys(r))Y.has(n)||$.has(n)||m.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:p,dropped:m,siteWrites:[...o.site?.(t,s)??[]]}}function Ke(t,o=W,s={}){const r=t.content;if(!Array.isArray(r))return t;let a=!1;const c=r.flatMap(p=>{const m=p&&typeof p.type=="string"&&o.includes(p.type)?E(O,p.type):void 0;if(!m)return[p];const $=Q(p,m,s);return $.skipped!==void 0?[p]:(a=!0,$.nodes)});return a?{...t,content:c}:t}function Me(t,o=W,s={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((a,c)=>{const p=a&&typeof a.type=="string"&&o.includes(a.type)?E(O,a.type):void 0;if(!p)return;const m=Q(a,p,s);m.skipped===void 0&&r.push({index:c,node:m.node,nodes:m.nodes})}),r}export{le as HOST_PRESS_BLOCKS,fe as HOST_PRESS_TYPES,_ as SECTION_BOX_SLOT,v as SECTION_BOX_TYPE,W as SECTION_TO_BOX_ON,ue as SECTION_TO_BOX_PRESS,Re as boxNativeReason,Q as convertSection,Ke as convertSectionsInPage,Ie as convertTheme,pe as convertsToBox,we as filledTemplateHold,Ge as hasWords,ge as headInOwnBox,We as headParts,xe as ownBoxHold,Fe as pressesAsBox,Ne as registerBoxNativeSections,Ae as registerSectionToBox,de as sectionBoxIdOf,Me as sectionToBoxEdits,Le as sectionToBoxRow,He as sectionToBoxTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "70.
|
|
3
|
+
"version": "70.4.0",
|
|
4
4
|
"description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|