efficient-web-builder 70.1.0 → 70.3.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 +6 -0
- package/dist/editor/components/AddPageOnOpen.js +1 -0
- package/dist/editor/components/PagesPanel.js +1 -1
- package/dist/editor/components/StorefrontEditor.d.ts +2 -1
- package/dist/editor/components/StorefrontEditor.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.3.0 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
**For hosts:**
|
|
8
|
+
- 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.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **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.
|
|
13
|
+
|
|
14
|
+
## 70.2.0 - 2026-11-17
|
|
15
|
+
|
|
16
|
+
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.
|
|
17
|
+
|
|
18
|
+
**For hosts:**
|
|
19
|
+
- No step is required. A host may open the website editor with the Add page window open: `<StorefrontEditor target={…} openAddPage />`.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- **Open the editor with the Add page window open** (#780): `StorefrontEditor` takes the optional `openAddPage`. New `components/AddPageOnOpen` (`AddPageOnOpen`, `useTakeAddPageOnOpen`) holds the request and gives it once, so a page switch does not open the window again. The Pages panel takes it on mount and calls the same path as its **+** button, so a backend that cannot add a page still hands the job to the host (`storefront-editor:new-page`).
|
|
24
|
+
|
|
3
25
|
## 70.1.0 - 2026-11-17
|
|
4
26
|
|
|
5
27
|
From main at `74cb8eb0`: #776, #777, #778. 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 only. No stored key or value moves.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{createContext as u,useContext as s,useRef as a}from"react";const n=u(null);function f({open:e,children:t}){const r=a(!!e);return o(n.Provider,{value:r,children:t})}function i(){const e=s(n);return()=>e?.current?(e.current=!1,!0):!1}export{f as AddPageOnOpen,i as useTakeAddPageOnOpen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,Fragment as ke,jsxs as R}from"react/jsx-runtime";import{Fragment as Ce,useEffect as $,useMemo as ee,useRef as Ae,useState as d}from"react";import{useScreenDocument as ne}from"efficient-easel/screen/components/ScreenDocumentContext";import{UiIcon as H}from"efficient-easel/draw/client";import Ie from"efficient-easel/screen/components/SidePanelHead";import{useWebsiteName as Re}from"./WebsiteSettingsPanel.js";import{InspectorIconButton as De}from"efficient-easel/chrome";import{Input as Oe,PopupMenu as xe,PopupMenuItem as te,toast as oe}from"efficient-shell/ui";import{LayersTree as Ee,TreeGroupLabel as Ne,TreeRow as se,TreeRowAction as D}from"efficient-easel/tree";import{AddIcon as Le,DuplicateIcon as Be,PageIcon as Me,SettingsIcon as _e}from"efficient-easel/icons";import{PagesIcon as Fe}from"efficient-easel/rail";import{useEaselHost as ve}from"efficient-easel/screen/lib/host";import{bucketEditorPageRows as ze,DYNAMIC_PAGES_GROUP_KEY as Ge,isDynamicPageRow as He,isPopupPageRow as Te,MAIN_PAGES_GROUP as We}from"../../format/lib/editor-page-rows.js";import{useEaselSession as T}from"efficient-easel/screen/lib/session-context";import{holdPageRow as W,usePageRows as je}from"../lib/page-rows.js";import{say as t,sayCount as Ue}from"../../format/lib/editor-words.js";import{canDuplicatePage as Ye,DuplicatePageDialog as qe}from"efficient-easel/page-copy";import Je from"./AddPageWindow.js";import{useTakeAddPageOnOpen as Ke}from"./AddPageOnOpen.js";import{backendOf as ae}from"../lib/website-session.js";import{shopHost as Qe}from"../../format/lib/web-runtime.js";import{newPopupPage as Ve}from"../../format/lib/popup/new-popup.js";const le="sf-editor-pages-collapsed-groups";function Xe(){const r=T(),{siteId:O,templateId:S}=ne(),w=ae(r).pages;if(!(!w.duplicate||S))return(u,y)=>w.duplicate(u.id,{...y,...O?{siteId:O}:{}})}function Ze({onNavigate:r,onClose:O,activeSurface:S,onPreviewSurface:w}){const u=T().chrome?.pageRows,y=ve(),{adapter:k,capabilities:p,ready:j,currentSlug:U}=ne(),re=Re(),{rows:c,reload:x,setRows:Y,getRows:ie}=je(),[E,ce]=d(""),[m,q]=d(!1),[J,C]=d(null),[K,N]=d(!1),de=!!ae(T()).pages.createFromStarter,L=Xe(),[g,B]=d(null),[M,ue]=d(()=>{if(typeof window>"u")return new Set;try{const e=window.localStorage.getItem(le);return new Set(e?JSON.parse(e):[])}catch{return new Set}});$(()=>{try{window.localStorage.setItem(le,JSON.stringify([...M]))}catch{}},[M]);const pe=e=>ue(s=>{const o=new Set(s);return o.has(e)?o.delete(e):o.add(e),o}),me=ee(()=>ze(c??[]),[c]),_=E.trim().toLowerCase(),Q=e=>!_||e.toLowerCase().includes(_),ge=e=>_?!0:!M.has(e),F=ee(()=>new Set((c??[]).map(e=>e.slug)),[c]),v=()=>{if(p.pageCreationInAdminForm&&!de){y.send("storefront-editor:new-page");return}C(null),N(!0)},fe=Ke();$(()=>{fe()&&v()},[]);const A=p.hasSiteSettings&&!!k.createPage,he=async()=>{if(!(!j||m||!k.createPage)){q(!0),C(null);try{const e=await k.createPage(Ve(t("New popup"),F));await x(),r(e.slug)}catch{C(t("Couldn’t add the popup — please retry."))}finally{q(!1)}}},V=Ae(null),[f,h]=d(null),be=()=>{if(!A)return v();if(f)return h(null);const e=V.current?.getBoundingClientRect();e&&h({top:e.bottom+6,right:Math.max(8,window.innerWidth-e.right)})},Pe=e=>{const s=c??[],o=k.deletePage;if(!j||m||!o||s.length<=1)return;const l=s.findIndex(a=>a.id===e.id),i=s.filter(a=>a.id!==e.id),b=e.slug===U;W(e.id,!0),Y(i),C(null),b&&i[0]&&r(i[0].slug);const I=()=>{W(e.id,!1);const a=ie()??[];if(a.some(ye=>ye.id===e.id))return;const P=[...a];P.splice(Math.max(0,Math.min(l,P.length)),0,e),Y(P)};oe.undoable(t("Deleted “{name}”",{name:e.label}),{actionLabel:t("Undo"),commit:async a=>{await o(e.id,a),W(e.id,!1)},undo:()=>{I(),b&&r(e.slug)},onFail:()=>{I(),oe.error(t("Couldn’t delete the page — please retry."))}})},Se=e=>y.send("storefront-editor:open-page",{slug:e}),we=e=>{if(!Q(e.label))return null;const s=!S&&e.slug===U,o=p.canDeletePagesInline&&(c??[]).length>1,l=He(e),i=Te(e),b=[...l?[{label:t("Dynamic"),tone:"info"}]:[],...i?[{label:t("Lightbox"),tone:"success"}]:[],...e.draft?[{label:t("draft"),tone:"draft"}]:[]],I=b.length>0?b:void 0,a=!!L&&Ye(e),P=a||p.pageCreationInAdminForm||o?R(ke,{children:[a&&n(D,{kind:"plain",label:t("Duplicate “{name}”",{name:e.label}),disabled:m,onClick:()=>B(e),children:n(Be,{size:13})}),p.pageCreationInAdminForm&&n(D,{kind:"plain",label:t("Page settings for “{name}”",{name:e.label}),onClick:()=>Se(e.slug),children:n(_e,{size:13})}),o&&n(D,{kind:"delete",label:t("Delete “{name}”",{name:e.label}),disabled:m,onClick:()=>Pe(e),children:n(H,{name:"trash",size:13,strokeWidth:1.7,rounded:!0})})]}):void 0;return n(se,{icon:n(Me,{size:14}),name:e.label,selected:s,onSelect:()=>r(e.slug),badge:I,actions:P,rowProps:{"data-page-slug":e.slug}},e.id)},z=(e,s,o)=>{const l=o.filter(Boolean);if(l.length===0)return null;const i=ge(e);return R(Ce,{children:[n(Ne,{count:l.length,countLabel:Ue("{n} page","{n} pages",l.length),expanded:i,onToggle:()=>pe(e),children:s}),i&&l]},e)},X=(u?.rows??[]).filter(e=>Q(e.label)).map(e=>{const s=S===e.key;return n(se,{icon:e.icon,name:e.label,selected:s,onSelect:()=>w(e.key),badge:{label:t("Preview"),tone:"warning"},actions:n(D,{kind:"plain",label:t("Open the {name} in a new tab",{name:e.label}),onClick:()=>window.open(e.href,"_blank","noopener,noreferrer"),children:n(H,{name:"external-link",size:13,strokeWidth:1.7,rounded:!0})}),rowProps:{"data-shop-surface":e.key}},e.key)}),Z=p.hasSiteSettings&&!!u,G=(()=>{if(c===null)return null;const e=[];let s=!1;for(const o of me){Z&&!s&&o.key.startsWith("system:")&&(e.push(z("shop",u.title,X)),s=!0);const l=o.key===Ge||o.label===We?t(o.label):o.label;e.push(z(o.key,l,o.rows.map(we)))}return Z&&!s&&e.push(z("shop",u.title,X)),e})();return R("div",{className:"sf-pages",children:[n(Ie,{icon:n(Fe,{}),title:t("Pages"),context:re,actions:n(De,{buttonRef:V,label:A?t("Add"):t("New page"),hasPopup:A?"menu":void 0,expanded:A?f!==null:void 0,onClick:be,children:n(Le,{size:15})})}),f&&n(xe,{portal:!0,style:{top:f.top,right:f.right},onClose:()=>h(null),children:R("div",{role:"menu","aria-label":t("Add"),children:[n(te,{role:"menuitem",onClick:()=>{h(null),v()},children:t("Page")}),n(te,{role:"menuitem",disabled:m,onClick:()=>{h(null),he()},children:t("Popup")})]})}),n("div",{className:"sf-pages-find",children:n(Oe,{type:"search",leftIcon:n(H,{name:"search",size:14,rounded:!0}),placeholder:t("Search all pages…"),value:E,onChange:e=>ce(e.target.value),"aria-label":t("Search all pages")})}),J&&!K&&n("div",{className:"sf-note sf-note--error",role:"alert",children:J}),G===null?n("div",{className:"sf-note",children:t("Loading…")}):G.some(Boolean)?n(Ee,{ariaLabel:t("Pages"),className:"sf-scroll",children:G}):n("div",{className:"sf-note",children:E.trim()?t("No pages match your search"):t("No pages yet. Add one with + above.")}),L&&g&&n(qe,{source:{title:g.label,slug:g.slug},taken:F,host:Qe(),duplicate:e=>L(g,e),onClose:()=>B(null),onDuplicated:e=>{B(null),x(),r(e.slug)}},g.id),K?n(Je,{open:!0,onClose:()=>N(!1),takenSlugs:F,onCreated:e=>{N(!1),x(),r(e.slug)}}):null]})}export{Ze as default};
|
|
@@ -14,6 +14,7 @@ import "efficient-easel/drag.css";
|
|
|
14
14
|
import "efficient-easel/screen.css";
|
|
15
15
|
import "./storefront-editor.css";
|
|
16
16
|
import { type ScreenTarget as EditorTarget } from "efficient-easel/screen/components/ScreenDocumentContext";
|
|
17
|
-
export default function StorefrontEditor({ target }: {
|
|
17
|
+
export default function StorefrontEditor({ target, openAddPage }: {
|
|
18
18
|
target: EditorTarget;
|
|
19
|
+
openAddPage?: boolean;
|
|
19
20
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as c,jsxs as wt}from"react/jsx-runtime";import{useCallback as o,useEffect as f,useMemo as Ct,useRef as g,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{useHostConfig as _t}from"../lib/document/host-config.js";import{ChromeWrap as Pt}from"efficient-easel/screen/lib/host-chrome";import{refreshSiteLiveState as Tt}from"../lib/site-live-state.js";import{holdSiteWrites as Et}from"../../format/lib/site-writes.js";import{backendOf as W}from"../lib/website-session.js";import{useEaselSession as yt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Gt}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/document/templateFields.js";import{setEditorPage as he}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as kt}from"./EditorPagePathProvider.js";import{resolveSiteName as Ht}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Wt,normalizeSiteGutterPhone as Bt,normalizeSiteWidth as Rt}from"../../format/lib/content/page-width.js";import{siteLengthNumber as w,siteLengthUnitsOfRow as Ft}from"../../format/lib/content/css-length.js";import{normalizeSiteBackground as ue}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as le}from"../../format/lib/content/container-gap.js";import It,{DocumentScreen as Dt}from"efficient-easel/screen/components/ScreenMount";import bt from"./WebsiteHintsProvider.js";import{useScreenDocument as Mt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Nt,siteThemeRow as xt,themeEdited as Ot,themeSeeded as Ut}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as At}from"./PreviewFooterContext.js";import{PreviewChatProvider as Lt,DEFAULT_CHAT_PREVIEW as zt}from"./PreviewChatContext.js";import{PreviewSocialProvider as Yt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as jt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Kt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Vt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Xt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as Zt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as qt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Jt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as Qt}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as $t}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as er,DEFAULT_HEADING_COMPRESSION as tr,DEFAULT_HEADING_TYPOGRAPHY as rr,DEFAULT_SWITCH_SHOWN as B,DEFAULT_SIZES as or,DEFAULT_THEME_MODE as T,normalizeCornerRadius as nr,normalizeCornerStyle as ir,normalizeCardShadow as ar,normalizeCardGap as cr,normalizeHoverEffect as sr,IDENTITY_CARD_GAP as me,IDENTITY_CARD_SHADOW as dr,IDENTITY_HOVER_EFFECT as hr,THEME_MODE_KEY as pe,THEME_STORAGE_KEY as ur,THEME_SWITCH_HIDE as Se,THEME_SWITCH_KEY as R}from"../../format/lib/theme.js";import{pictureShadowColor as lr}from"efficient-easel/screen/lib/document/shadow-values";import{DEFAULT_FONTS as mr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as pr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as Sr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as fr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as gr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as wr}from"./PreviewChatContext.js";const Cr=()=>{if(typeof window>"u")return T;try{const s=window.localStorage.getItem(pe);return s==="light"||s==="dark"||s==="auto"?s:T}catch{return T}},fe=s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pe,s)}catch{}},_r=()=>{if(typeof window>"u")return B;try{return window.localStorage.getItem(R)!==Se}catch{return B}},Pr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(ur)}catch{}},ge=s=>{if(!(typeof window>"u"))try{s?window.localStorage.removeItem(R):window.localStorage.setItem(R,Se)}catch{}};function Tr(){const{adapter:s,capabilities:d,templateId:F,ready:_,token:h,siteId:a,currentSlug:I,currentKind:D}=Mt();f(()=>(he(I,D),()=>he(null,null)),[I,D]);const E=d.placeholderFrames,[we,b]=r(null),[Ce,M]=r("");f(()=>{const e=s.templateName;if(!_||!F||!e){M("");return}let i=!1;return e().then(u=>!i&&M(u??"")).catch(()=>{}),()=>{i=!0}},[_,h,F,s]);const[_e,y]=r(T),[Pe,G]=r(B),[N,x]=r({value:{selected:0,themes:[]},readFor:null}),Te=N.value,[Ee,O]=r(mr),[ye,U]=r(or),[Ge,A]=r(null),[ve,L]=r(tr),[ke,z]=r(null),[He,Y]=r(null),[We,j]=r(me),[Be,K]=r(null),[Re,V]=r(null),[Fe,X]=r(null),[Ie,Z]=r(null),[v,q]=r(null),[k,J]=r(null),[De,Q]=r({}),be=o(e=>Q(i=>({...i,...e})),[]),l=yt(),$=_t(),Me=Ct(()=>Gt(vt($,E),v,k),[$,E,v,k]),[Ne,ee]=r(rr),[xe,te]=r(null),[Oe,re]=r(null),[Ue,oe]=r(null),[Ae,ne]=r(null),[Le,ie]=r(null),ae=g(null),n=g(!1);f(()=>{y(Cr()),G(_r())},[]);const ze=o(e=>{n.current=!0,Pr(),fe(e),y(e)},[]),Ye=o(e=>{n.current=!0,ge(e),G(e)},[]),je=o(e=>{n.current=!0,x(i=>Ot(i,e,a??""))},[a]),Ke=o(e=>{n.current=!0,O(e)},[]),Ve=o(e=>{n.current=!0,U(e)},[]),Xe=o(e=>{n.current=!0,A(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,z(e)},[]),Je=o(e=>{n.current=!0,Y(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,K(e)},[]),et=o(e=>{n.current=!0,ee(e)},[]),[tt,ce]=r(null),[rt,ot]=r(null),nt=o(e=>{n.current=!0,ce(e)},[]),it=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),ct=o(e=>{n.current=!0,Z(e)},[]),st=o(e=>{n.current=!0,q(e)},[]),dt=o(e=>{n.current=!0,J(e)},[]),ht=o(e=>{n.current=!0,te(e)},[]),ut=o(e=>{n.current=!0,re(e)},[]),lt=o(e=>{n.current=!0,oe(e)},[]),mt=o(e=>{n.current=!0,ne(e)},[]),pt=o(e=>{n.current=!0,ie(e)},[]);f(()=>{const e=W(l).theme;if(!h||!d.hasSiteTheme||!e)return;const i=a??"";ae.current!==i&&(ae.current=i,n.current=!1);let u=!1;return e.get(a?{siteId:a}:void 0).then(t=>{if(u||n.current)return;fe(t.default_mode),ge(t.show_theme_switch),y(t.default_mode),G(t.show_theme_switch),x(Ut({selected:t.selected_preset,themes:t.theme_presets},i));const C=fr(t);O(C.fonts),U(C.sizes);const S=Ft(t);Q(S),A(t.corner_radius_px===void 0?er[ir(t.corner_style)]:w(t.corner_radius_px,S.cornerRadiusUnit,nr)),L(C.compression),z(t.card_shadow==null?dr:ar(t.card_shadow)),j(t.card_gap==null?me:cr(t.card_gap)),K(t.hover_effect==null?hr:sr(t.hover_effect)),Y(lr(t.shadow_color)),V(w(t.site_width,S.siteWidthUnit,Rt)),X(w(t.site_gutter,S.siteGutterUnit,Wt)),Z(w(t.site_gutter_phone,S.siteGutterPhoneUnit,Bt)),q(w(t.block_gap,S.blockGapUnit,le)),J(w(t.block_gap_phone,S.blockGapPhoneUnit,le)),ee(C.typography),ce(C.textStyles),ot(gr(t)),te(t.hero_background_follows_width===!0),re(ue(t.section_background_width)),oe(ue(t.section_content_width)),ne(t.photography_grayscale===!0),ie(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[h,a,d.hasSiteTheme,l]);const St=jt({token:h,siteId:a,enabled:d.hasSiteSettings}),[ft,se]=r(zt),de=g(null),H=g(!1),m=g(null),p=g({}),P=o(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await W(l).chat?.update(e,a?{siteId:a}:void 0),Tt()}catch(i){throw p.current={...e,...p.current},i}},[l,a]);f(()=>Et(()=>m.current||Object.keys(p.current).length>0?P():void 0),[P]);const gt=o(e=>{H.current=!0,se(i=>({...i,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{P().catch(()=>{})},500))},[d.hasSiteSettings,h,P]);return f(()=>{if(!h||!d.hasSiteSettings)return;const e=a??"";de.current!==e&&(de.current=e,H.current=!1);let i=!1;const u=W(l).chat;if(u)return u.get(a?{siteId:a}:void 0).then(t=>{i||H.current||se(wr(t))}).catch(()=>{}),()=>{i=!0}},[h,a,d.hasSiteSettings,l]),f(()=>{const e=s.site;if(!_||!d.hasSiteRecord||!e){b(null);return}let i=!1;return e().then(u=>{i||b(Ht(u.name))}).catch(()=>{}),()=>{i=!0}},[_,h,d.hasSiteRecord,a,s]),c(Dt,{config:Me,parts:pr,wrap:(e,i)=>c(Nt,{websiteName:we,templateChrome:E,templateName:Ce||null,themeMode:_e,onThemeModeChange:ze,themeSwitchShown:Pe,onThemeSwitchShownChange:Ye,theme:Te,themeRow:xt(d.hasSiteTheme,N.readFor,a??""),onThemeChange:je,fonts:Ee,onFontsChange:Ke,cornerRadiusPx:Ge,onCornerRadiusPxChange:Xe,cardShadow:ke,onCardShadowChange:qe,shadowColor:He,onShadowColorChange:Je,cardGap:We,onCardGapChange:Qe,hoverEffect:Be,onHoverEffectChange:$e,headingCompression:ve,onHeadingCompressionChange:Ze,headingTypography:Ne,onHeadingTypographyChange:et,textStyles:tt,onTextStylesChange:nt,wordStyles:rt,sizes:ye,onSizesChange:Ve,siteWidth:Re,onSiteWidthChange:it,siteGutter:Fe,onSiteGutterChange:at,siteGutterPhone:Ie,onSiteGutterPhoneChange:ct,blockGap:v,onBlockGapChange:st,blockGapPhone:k,onBlockGapPhoneChange:dt,siteLengthUnits:De,onSiteLengthUnitsChange:be,heroBackgroundFollowsWidth:xe,onHeroBackgroundFollowsWidthChange:ht,sectionBackgroundWidth:Oe,onSectionBackgroundWidthChange:ut,sectionContentWidth:Ue,onSectionContentWidthChange:lt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:mt,shareButtonOnPosts:Le,onShareButtonOnPostsChange:pt,themeFromDocument:!d.hasSiteTheme,children:c(At,{children:c(Pt,{wrap:l.chrome?.wrap,surface:"page",children:c(Xt,{children:c(Zt,{children:c(qt,{children:c(Qt,{children:c(Jt,{children:wt($t,{children:[c(Lt,{chat:ft,onChatChange:gt,children:c(Yt,{value:St,children:c(Kt,{children:c(kt,{children:c(bt,{children:e})})})})}),i]})})})})})})})})})})}function Er({target:s}){return c(It,{target:s,addressing:Vt,onHostMessage:Sr,children:c(Tr,{})})}export{Er as default};
|
|
1
|
+
"use client";import{jsx as a,jsxs as wt}from"react/jsx-runtime";import{useCallback as o,useEffect as f,useMemo as Ct,useRef as g,useState as r}from"react";import"efficient-easel/easel.css";import"efficient-easel/shell.css";import"efficient-easel/rail.css";import"efficient-easel/panel.css";import"efficient-easel/fields.css";import"efficient-easel/pick.css";import"efficient-easel/copy.css";import"efficient-easel/gold.css";import"efficient-easel/text-styles.css";import"efficient-easel/menu.css";import"efficient-easel/chrome.css";import"efficient-easel/tree.css";import"efficient-easel/drag.css";import"efficient-easel/screen.css";import"./storefront-editor.css";import{useHostConfig as _t}from"../lib/document/host-config.js";import{ChromeWrap as Pt}from"efficient-easel/screen/lib/host-chrome";import{refreshSiteLiveState as Tt}from"../lib/site-live-state.js";import{holdSiteWrites as Et}from"../../format/lib/site-writes.js";import{backendOf as W}from"../lib/website-session.js";import{useEaselSession as yt}from"efficient-easel/screen/lib/session-context";import{withSiteBlockGapFields as Gt}from"../../format/lib/document/site-gap-fields.js";import{withTemplateMediaPlaceholders as vt}from"../../format/lib/document/templateFields.js";import{setEditorPage as he}from"../../format/lib/document/editor-page-context.js";import{EditorPagePathProvider as kt}from"./EditorPagePathProvider.js";import{AddPageOnOpen as Ht}from"./AddPageOnOpen.js";import{resolveSiteName as Wt}from"../../format/lib/content/site-name.js";import{normalizeSiteGutter as Bt,normalizeSiteGutterPhone as Rt,normalizeSiteWidth as Ft}from"../../format/lib/content/page-width.js";import{siteLengthNumber as w,siteLengthUnitsOfRow as It}from"../../format/lib/content/css-length.js";import{normalizeSiteBackground as ue}from"../../format/lib/content/section-width.js";import{normalizeSiteBlockGap as le}from"../../format/lib/content/container-gap.js";import Dt,{DocumentScreen as bt}from"efficient-easel/screen/components/ScreenMount";import Ot from"./WebsiteHintsProvider.js";import{useScreenDocument as Mt}from"efficient-easel/screen/components/ScreenDocumentContext";import{PreviewHeaderProvider as Nt,siteThemeRow as xt,themeEdited as Ut,themeSeeded as At}from"../../render/components/PreviewHeaderContext.js";import{PreviewFooterProvider as Lt}from"./PreviewFooterContext.js";import{PreviewChatProvider as zt,DEFAULT_CHAT_PREVIEW as Yt}from"./PreviewChatContext.js";import{PreviewSocialProvider as jt}from"../../render/components/PreviewSocialContext.js";import{useSocialSettings as Kt}from"./useSocialSettings.js";import{PreviewSurfaceProvider as Vt}from"./PreviewSurfaceContext.js";import{WEBSITE_ADDRESSING as Xt}from"../lib/website-document-addressing.js";import{PreviewTickerProvider as Zt}from"../../render/components/PreviewTickerContext.js";import{PreviewHeroPartProvider as qt}from"../../render/components/PreviewHeroPartContext.js";import{PreviewPartsProvider as Jt}from"efficient-easel/draw/client";import{CanvasPartsBridge as Qt}from"./CanvasPartsBridge.js";import{PreviewLocationPartProvider as $t}from"../../render/components/PreviewLocationPartContext.js";import{PreviewPartStyleProvider as er}from"./PreviewPartStyleContext.js";import{CORNER_STYLE_TO_PX as tr,DEFAULT_HEADING_COMPRESSION as rr,DEFAULT_HEADING_TYPOGRAPHY as or,DEFAULT_SWITCH_SHOWN as B,DEFAULT_SIZES as nr,DEFAULT_THEME_MODE as T,normalizeCornerRadius as ir,normalizeCornerStyle as ar,normalizeCardShadow as cr,normalizeCardGap as sr,normalizeHoverEffect as dr,IDENTITY_CARD_GAP as me,IDENTITY_CARD_SHADOW as hr,IDENTITY_HOVER_EFFECT as ur,THEME_MODE_KEY as pe,THEME_STORAGE_KEY as lr,THEME_SWITCH_HIDE as Se,THEME_SWITCH_KEY as R}from"../../format/lib/theme.js";import{pictureShadowColor as mr}from"efficient-easel/screen/lib/document/shadow-values";import{DEFAULT_FONTS as pr}from"../../format/lib/fonts.js";import{WEBSITE_SCREEN as Sr}from"./WebsiteScreenParts.js";import{routeWebsiteHostMessage as fr}from"../../format/lib/website-host-inbound.js";import{siteTextFromRow as gr}from"../../render/lib/text-styles/site-text-styles.js";import{wordStylesFromRow as wr}from"../../format/lib/word-styles.js";import{chatPreviewFrom as Cr}from"./PreviewChatContext.js";const _r=()=>{if(typeof window>"u")return T;try{const s=window.localStorage.getItem(pe);return s==="light"||s==="dark"||s==="auto"?s:T}catch{return T}},fe=s=>{if(!(typeof window>"u"))try{window.localStorage.setItem(pe,s)}catch{}},Pr=()=>{if(typeof window>"u")return B;try{return window.localStorage.getItem(R)!==Se}catch{return B}},Tr=()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem(lr)}catch{}},ge=s=>{if(!(typeof window>"u"))try{s?window.localStorage.removeItem(R):window.localStorage.setItem(R,Se)}catch{}};function Er(){const{adapter:s,capabilities:d,templateId:F,ready:_,token:h,siteId:c,currentSlug:I,currentKind:D}=Mt();f(()=>(he(I,D),()=>he(null,null)),[I,D]);const E=d.placeholderFrames,[we,b]=r(null),[Ce,O]=r("");f(()=>{const e=s.templateName;if(!_||!F||!e){O("");return}let i=!1;return e().then(u=>!i&&O(u??"")).catch(()=>{}),()=>{i=!0}},[_,h,F,s]);const[_e,y]=r(T),[Pe,G]=r(B),[M,N]=r({value:{selected:0,themes:[]},readFor:null}),Te=M.value,[Ee,x]=r(pr),[ye,U]=r(nr),[Ge,A]=r(null),[ve,L]=r(rr),[ke,z]=r(null),[He,Y]=r(null),[We,j]=r(me),[Be,K]=r(null),[Re,V]=r(null),[Fe,X]=r(null),[Ie,Z]=r(null),[v,q]=r(null),[k,J]=r(null),[De,Q]=r({}),be=o(e=>Q(i=>({...i,...e})),[]),l=yt(),$=_t(),Oe=Ct(()=>Gt(vt($,E),v,k),[$,E,v,k]),[Me,ee]=r(or),[Ne,te]=r(null),[xe,re]=r(null),[Ue,oe]=r(null),[Ae,ne]=r(null),[Le,ie]=r(null),ae=g(null),n=g(!1);f(()=>{y(_r()),G(Pr())},[]);const ze=o(e=>{n.current=!0,Tr(),fe(e),y(e)},[]),Ye=o(e=>{n.current=!0,ge(e),G(e)},[]),je=o(e=>{n.current=!0,N(i=>Ut(i,e,c??""))},[c]),Ke=o(e=>{n.current=!0,x(e)},[]),Ve=o(e=>{n.current=!0,U(e)},[]),Xe=o(e=>{n.current=!0,A(e)},[]),Ze=o(e=>{n.current=!0,L(e)},[]),qe=o(e=>{n.current=!0,z(e)},[]),Je=o(e=>{n.current=!0,Y(e)},[]),Qe=o(e=>{n.current=!0,j(e)},[]),$e=o(e=>{n.current=!0,K(e)},[]),et=o(e=>{n.current=!0,ee(e)},[]),[tt,ce]=r(null),[rt,ot]=r(null),nt=o(e=>{n.current=!0,ce(e)},[]),it=o(e=>{n.current=!0,V(e)},[]),at=o(e=>{n.current=!0,X(e)},[]),ct=o(e=>{n.current=!0,Z(e)},[]),st=o(e=>{n.current=!0,q(e)},[]),dt=o(e=>{n.current=!0,J(e)},[]),ht=o(e=>{n.current=!0,te(e)},[]),ut=o(e=>{n.current=!0,re(e)},[]),lt=o(e=>{n.current=!0,oe(e)},[]),mt=o(e=>{n.current=!0,ne(e)},[]),pt=o(e=>{n.current=!0,ie(e)},[]);f(()=>{const e=W(l).theme;if(!h||!d.hasSiteTheme||!e)return;const i=c??"";ae.current!==i&&(ae.current=i,n.current=!1);let u=!1;return e.get(c?{siteId:c}:void 0).then(t=>{if(u||n.current)return;fe(t.default_mode),ge(t.show_theme_switch),y(t.default_mode),G(t.show_theme_switch),N(At({selected:t.selected_preset,themes:t.theme_presets},i));const C=gr(t);x(C.fonts),U(C.sizes);const S=It(t);Q(S),A(t.corner_radius_px===void 0?tr[ar(t.corner_style)]:w(t.corner_radius_px,S.cornerRadiusUnit,ir)),L(C.compression),z(t.card_shadow==null?hr:cr(t.card_shadow)),j(t.card_gap==null?me:sr(t.card_gap)),K(t.hover_effect==null?ur:dr(t.hover_effect)),Y(mr(t.shadow_color)),V(w(t.site_width,S.siteWidthUnit,Ft)),X(w(t.site_gutter,S.siteGutterUnit,Bt)),Z(w(t.site_gutter_phone,S.siteGutterPhoneUnit,Rt)),q(w(t.block_gap,S.blockGapUnit,le)),J(w(t.block_gap_phone,S.blockGapPhoneUnit,le)),ee(C.typography),ce(C.textStyles),ot(wr(t)),te(t.hero_background_follows_width===!0),re(ue(t.section_background_width)),oe(ue(t.section_content_width)),ne(t.photography_grayscale===!0),ie(t.share_button_on_posts===!0)}).catch(()=>{}),()=>{u=!0}},[h,c,d.hasSiteTheme,l]);const St=Kt({token:h,siteId:c,enabled:d.hasSiteSettings}),[ft,se]=r(Yt),de=g(null),H=g(!1),m=g(null),p=g({}),P=o(async()=>{m.current&&clearTimeout(m.current),m.current=null;const e=p.current;p.current={};try{await W(l).chat?.update(e,c?{siteId:c}:void 0),Tt()}catch(i){throw p.current={...e,...p.current},i}},[l,c]);f(()=>Et(()=>m.current||Object.keys(p.current).length>0?P():void 0),[P]);const gt=o(e=>{H.current=!0,se(i=>({...i,...e})),!(!d.hasSiteSettings||!h)&&(p.current={...p.current,...e},m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{P().catch(()=>{})},500))},[d.hasSiteSettings,h,P]);return f(()=>{if(!h||!d.hasSiteSettings)return;const e=c??"";de.current!==e&&(de.current=e,H.current=!1);let i=!1;const u=W(l).chat;if(u)return u.get(c?{siteId:c}:void 0).then(t=>{i||H.current||se(Cr(t))}).catch(()=>{}),()=>{i=!0}},[h,c,d.hasSiteSettings,l]),f(()=>{const e=s.site;if(!_||!d.hasSiteRecord||!e){b(null);return}let i=!1;return e().then(u=>{i||b(Wt(u.name))}).catch(()=>{}),()=>{i=!0}},[_,h,d.hasSiteRecord,c,s]),a(bt,{config:Oe,parts:Sr,wrap:(e,i)=>a(Nt,{websiteName:we,templateChrome:E,templateName:Ce||null,themeMode:_e,onThemeModeChange:ze,themeSwitchShown:Pe,onThemeSwitchShownChange:Ye,theme:Te,themeRow:xt(d.hasSiteTheme,M.readFor,c??""),onThemeChange:je,fonts:Ee,onFontsChange:Ke,cornerRadiusPx:Ge,onCornerRadiusPxChange:Xe,cardShadow:ke,onCardShadowChange:qe,shadowColor:He,onShadowColorChange:Je,cardGap:We,onCardGapChange:Qe,hoverEffect:Be,onHoverEffectChange:$e,headingCompression:ve,onHeadingCompressionChange:Ze,headingTypography:Me,onHeadingTypographyChange:et,textStyles:tt,onTextStylesChange:nt,wordStyles:rt,sizes:ye,onSizesChange:Ve,siteWidth:Re,onSiteWidthChange:it,siteGutter:Fe,onSiteGutterChange:at,siteGutterPhone:Ie,onSiteGutterPhoneChange:ct,blockGap:v,onBlockGapChange:st,blockGapPhone:k,onBlockGapPhoneChange:dt,siteLengthUnits:De,onSiteLengthUnitsChange:be,heroBackgroundFollowsWidth:Ne,onHeroBackgroundFollowsWidthChange:ht,sectionBackgroundWidth:xe,onSectionBackgroundWidthChange:ut,sectionContentWidth:Ue,onSectionContentWidthChange:lt,photographyGrayscale:Ae,onPhotographyGrayscaleChange:mt,shareButtonOnPosts:Le,onShareButtonOnPostsChange:pt,themeFromDocument:!d.hasSiteTheme,children:a(Lt,{children:a(Pt,{wrap:l.chrome?.wrap,surface:"page",children:a(Zt,{children:a(qt,{children:a(Jt,{children:a($t,{children:a(Qt,{children:wt(er,{children:[a(zt,{chat:ft,onChatChange:gt,children:a(jt,{value:St,children:a(Vt,{children:a(kt,{children:a(Ot,{children:e})})})})}),i]})})})})})})})})})})}function yr({target:s,openAddPage:d}){return a(Ht,{open:d,children:a(Dt,{target:s,addressing:Xt,onHostMessage:fr,children:a(Er,{})})})}export{yr as default};
|
|
@@ -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.3.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",
|