efficient-web-builder 67.4.0 → 67.5.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/editor/lib/document/block-offer.d.ts +6 -0
  3. package/dist/editor/lib/document/block-offer.js +1 -1
  4. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  5. package/dist/editor/lib/document/blocks/general/Footprint/fields.js +1 -1
  6. package/dist/editor/lib/document/blocks/general/ParagraphsA/fields.js +1 -1
  7. package/dist/editor/lib/document/blocks/general/ProcessSteps/fields.js +1 -1
  8. package/dist/editor/lib/document/blocks/general/StatsParagraph/fields.js +1 -1
  9. package/dist/editor/lib/document/blocks/general/Timeline/fields.js +1 -1
  10. package/dist/editor/lib/document/blocks/general/TimelineTrack/fields.js +1 -1
  11. package/dist/editor/lib/document/blocks/general/TitleWithButtons/fields.js +1 -1
  12. package/dist/editor/lib/document/field-groups.js +1 -1
  13. package/dist/format/lib/content/accordion-row-style.d.ts +4 -1
  14. package/dist/format/lib/content/accordion-row-style.js +1 -1
  15. package/dist/format/lib/document/passes/types.d.ts +2 -0
  16. package/dist/render/components/BoxAccordionRow.d.ts +2 -1
  17. package/dist/render/components/BoxAccordionRow.js +1 -1
  18. package/dist/render/components/Flex.js +1 -1
  19. package/dist/render/components/Footprint.d.ts +3 -1
  20. package/dist/render/components/Footprint.js +1 -1
  21. package/dist/render/components/ParagraphsA.d.ts +3 -1
  22. package/dist/render/components/ParagraphsA.js +1 -1
  23. package/dist/render/components/ProcessSteps.d.ts +3 -1
  24. package/dist/render/components/ProcessSteps.js +1 -1
  25. package/dist/render/components/StatsParagraph.d.ts +3 -1
  26. package/dist/render/components/StatsParagraph.js +1 -1
  27. package/dist/render/components/Timeline.d.ts +3 -1
  28. package/dist/render/components/Timeline.js +1 -1
  29. package/dist/render/components/TimelineTrack.d.ts +3 -1
  30. package/dist/render/components/TimelineTrack.js +1 -1
  31. package/dist/render/components/TitleWithButtons.d.ts +3 -1
  32. package/dist/render/components/TitleWithButtons.js +1 -1
  33. package/dist/render/lib/content/section-padding.d.ts +20 -0
  34. package/dist/render/lib/content/section-padding.js +1 -1
  35. package/dist/render/lib/document/blocks/general/Footprint/render.js +1 -1
  36. package/dist/render/lib/document/blocks/general/ParagraphsA/render.js +1 -1
  37. package/dist/render/lib/document/blocks/general/ProcessSteps/render.js +1 -1
  38. package/dist/render/lib/document/blocks/general/StatsParagraph/render.js +1 -1
  39. package/dist/render/lib/document/blocks/general/Timeline/render.js +1 -1
  40. package/dist/render/lib/document/blocks/general/TimelineTrack/render.js +1 -1
  41. package/dist/render/lib/document/blocks/general/TitleWithButtons/render.js +1 -1
  42. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  43. package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
  44. package/dist/render/lib/document/passes/section-padding.d.ts +4 -0
  45. package/dist/render/lib/document/passes/section-padding.js +1 -1
  46. package/dist/render/lib/sections/section-to-box.d.ts +1 -0
  47. package/dist/render/lib/sections/section-to-box.js +1 -1
  48. package/package.json +1 -1
@@ -1 +1 @@
1
- import{SPLITTABLE_SECTIONS as b}from"../../../../../format/lib/sections/section-head-placement.js";import{SECTION_LABELS as g}from"../../../../../format/lib/document/section-catalog.js";import{SAME_KEYS as B,SECTION_BOX as A,innerPad as R}from"./section-to-box-row-parts.js";import{SITE_SIDE as l}from"efficient-easel/screen/lib/content/length-units";import{EDITORIAL_LINE as C,HEAD_BELOW as S,headLookOf as E,headReads as L,headTree as w}from"./section-head-looks.js";import{finiteNumber as I}from"../../../../../format/lib/finite-number.js";import{CARD_TEMPLATE_SLOT as P}from"../../../../../format/lib/content/card-template.js";import{footprintCardSeed as N}from"../../../../../format/lib/document/blocks/general/Footprint/card-seed.js";import{faqCardSeed as k,faqRunStyleKeys as D}from"../../../../../format/lib/document/blocks/general/FAQ/card-seed.js";import{PROCESS_COLUMNS_SLOT as H,processColumnSeeds as F}from"../../../../../format/lib/document/blocks/general/ProcessSteps/column-seed.js";import{BOX_SIDE_SPACE_PROP as y,BOX_SIDE_SPACE_SITE as j}from"../../../../../format/lib/content/box-side-space.js";import{INNER_BOX as x}from"../../../../../format/lib/document/seed-parts.js";import{SECTION_ACCENT_INHERIT as X}from"../../../../../format/lib/content/section-surface.js";import{ownEntry as c}from"../../../../../format/lib/own-entry.js";const Y=["FAQ","Footprint","LongRead","ProcessSteps","RelatedProducts"],io=["Collections","Events","FitmentTable","GalleryB","ProductGrid","SpecTable"],s=(e,o)=>()=>({top:e,topPhone:o}),_=e=>o=>{const r=R(o,e).sectionPaddingTop;return{top:r,topPhone:r}},M={Collections:s(120,70),Events:s(120,70),FAQ:s(120,70),GalleryB:s(120,70),FitmentTable:s(120,80),SpecTable:s(120,80),LongRead:s(120,80),RelatedProducts:s(0,0),Footprint:_("Footprint"),ProcessSteps:_("ProcessSteps"),ProductGrid:e=>({top:I(e.padTop)??120,topPhone:0})};function Q(e,o={}){const r=c(b,e),n=c(M,e);if(!r||!n)throw new Error(`section-to-box-rows-head: "${e}" has no head row or no head room`);const p=r.padKey,O=w(e),d=L(e),f=r.headRows.filter(t=>![r.num,r.title,r.description,"linkText","linkHref"].includes(t)),a={...Object.fromEntries(f.filter(t=>!(t in d)).map(t=>[t,"a head setting no Header Box part reads (lib/document/blocks/general/section-head-looks `headReads`)"])),...o.drop};return{name:c(g,e)??e,boxProps:(t,i)=>{const m=n(t),h=o.roomBelow?{sectionPaddingBottom:o.roomBelow.bottom,sectionPaddingBottomPhone:o.roomBelow.bottomPhone}:{},T=typeof o.boxProps=="function"?o.boxProps(t,i):o.boxProps??{},u=E(e)==="editorial"?C:{};return{...A,direction:"column",gap:S[E(e)],sectionPaddingTop:m.top,sectionPaddingTopPhone:m.topPhone,...u,...h,...T}},box:[...B,...p?[[p,"sectionPaddingTop",(t,i)=>n(i).top]]:[]],parts:[O,...(()=>{const t={...p?{[p]:0}:{},...o.coreProps},i={kind:"core",keep:"rest",...Object.keys(t).length?{props:t}:{},...o.slots?{slots:o.slots}:{}};return[o.coreBox?{kind:"group",name:o.coreBox.name,props:o.coreBox.props,parts:[i]}:i]})(),...o.partsAfter??[]],...Object.keys(d).length?{reads:d}:{},...Object.keys(a).length?{drop:a}:{},...o.pressHeading?{pressKeepsEmpty:[r.title]}:{},...o.skip?{skip:o.skip}:{}}}const G={...x,direction:"accordion",rowStyle:"numbered"},K={sectionPaddingLeft:l,sectionPaddingRight:l},v={Footprint:{slots:{[P]:[N()]},pressHeading:!0},ProcessSteps:{slots:(e,o)=>o.press?{[H]:F().map(r=>({...r,props:{...r.props,...K}}))}:{},boxProps:{gapPhone:S.editorial}},FAQ:{slots:{[P]:[k()]},pressHeading:!0,coreBox:{name:"Questions",props:G},coreProps:{sectionAccent:X},roomBelow:{bottom:120,bottomPhone:70},boxProps:(e,o)=>o.press?{}:{[y]:j},skip:e=>{const o=e._partStyles??{},r=D().filter(n=>o[n]!==void 0);return r.length?`held: its rows carry their own run style (_partStyles ${r.map(n=>`"${n}"`).join(", ")}), which the Box path does not draw the same`:void 0}}},po=Object.fromEntries(Y.map(e=>[e,Q(e,c(v,e))]));export{G as FAQ_ROWS_BOX,v as HEAD_ONLY_CARD_SEEDS,po as HEAD_ONLY_SECTION_TO_BOX,Y as HEAD_ONLY_TYPES,io as HOST_ROW_HEAD_TYPES,Q as headOnlyRow};
1
+ import{SPLITTABLE_SECTIONS as B}from"../../../../../format/lib/sections/section-head-placement.js";import{SECTION_LABELS as N}from"../../../../../format/lib/document/section-catalog.js";import{SAME_KEYS as R,SECTION_BOX as I}from"./section-to-box-row-parts.js";import{SITE_SIDE as S,sideLengthAt as C}from"efficient-easel/screen/lib/content/length-units";import{EDITORIAL_LINE as L,HEAD_BELOW as f,headLookOf as u,headReads as w,headTree as D}from"./section-head-looks.js";import{finiteNumber as T}from"../../../../../format/lib/finite-number.js";import{CARD_TEMPLATE_SLOT as b}from"../../../../../format/lib/content/card-template.js";import{footprintCardSeed as k}from"../../../../../format/lib/document/blocks/general/Footprint/card-seed.js";import{faqCardSeed as H,faqRunStyleKeys as F}from"../../../../../format/lib/document/blocks/general/FAQ/card-seed.js";import{PROCESS_COLUMNS_SLOT as x,processColumnSeeds as y}from"../../../../../format/lib/document/blocks/general/ProcessSteps/column-seed.js";import{BOX_SIDE_SPACE_PROP as Y,BOX_SIDE_SPACE_SITE as K}from"../../../../../format/lib/content/box-side-space.js";import{INNER_BOX as j}from"../../../../../format/lib/document/seed-parts.js";import{SECTION_ACCENT_INHERIT as X}from"../../../../../format/lib/content/section-surface.js";import{ownEntry as _}from"../../../../../format/lib/own-entry.js";import{BAND_PAD_KEYS as E,BAND_PAD_UNIT_KEY as v,bandTopBottom as M}from"../../../content/section-padding.js";import{SECTION_PAD_INNER as Q,innerPaddingFallback as G}from"../../passes/section-padding.js";import{viewKeyAt as P}from"efficient-easel/draw";const U=["FAQ","Footprint","LongRead","ProcessSteps","RelatedProducts"],So=["Collections","Events","FitmentTable","GalleryB","ProductGrid","SpecTable"],p=(e,o)=>()=>({top:e,topPhone:o}),h=e=>o=>{const t=G(e),s={...o,[E.top]:M(o,t).top},r=d=>{const n=C(s,E,v,d,"top");return n?.unit==="px"?n.value:void 0},m=d=>T(o[P(E.top,d)])===void 0?void 0:r(d),a=m("tablet"),l=m("mobile");return{top:r("desktop")??t.top??0,...a!==void 0?{topTablet:a}:{},...l!==void 0?{topPhone:l}:{}}},W={Collections:p(120,70),Events:p(120,70),FAQ:p(120,70),GalleryB:p(120,70),FitmentTable:p(120,80),SpecTable:p(120,80),LongRead:p(120,80),RelatedProducts:p(0,0),Footprint:h("Footprint"),ProcessSteps:h("ProcessSteps"),ProductGrid:e=>({top:T(e.padTop)??120,topPhone:0})};function $(e,o={}){const t=_(B,e),s=_(W,e);if(!t||!s)throw new Error(`section-to-box-rows-head: "${e}" has no head row or no head room`);const r=t.padKey,m=D(e),a=w(e),l=t.headRows.filter(n=>![t.num,t.title,t.description,"linkText","linkHref"].includes(n)),d={...Object.fromEntries(l.filter(n=>!(n in a)).map(n=>[n,"a head setting no Header Box part reads (lib/document/blocks/general/section-head-looks `headReads`)"])),...o.drop};return{name:_(N,e)??e,boxProps:(n,c)=>{const i=s(n),O=o.roomBelow?{sectionPaddingBottom:o.roomBelow.bottom,sectionPaddingBottomPhone:o.roomBelow.bottomPhone}:{},A=typeof o.boxProps=="function"?o.boxProps(n,c):o.boxProps??{},g=u(e)==="editorial"?L:{};return{...I,direction:"column",gap:f[u(e)],sectionPaddingTop:i.top,...i.topTablet!==void 0?{sectionPaddingTopTablet:i.topTablet}:{},...i.topPhone!==void 0?{sectionPaddingTopPhone:i.topPhone}:{},...g,...O,...A}},box:[...R,...r?[[r,"sectionPaddingTop",(n,c)=>s(c).top]]:[]],parts:[m,...(()=>{const n=r&&Q.has(e)?{[P(r,"tablet")]:0,[P(r,"mobile")]:0}:{},c={...r?{[r]:0}:{},...n,...o.coreProps},i={kind:"core",keep:"rest",...Object.keys(c).length?{props:c}:{},...o.slots?{slots:o.slots}:{}};return[o.coreBox?{kind:"group",name:o.coreBox.name,props:o.coreBox.props,parts:[i]}:i]})(),...o.partsAfter??[]],...Object.keys(a).length?{reads:a}:{},...Object.keys(d).length?{drop:d}:{},...o.pressHeading?{pressKeepsEmpty:[t.title]}:{},...o.skip?{skip:o.skip}:{}}}const q={...j,direction:"accordion",rowStyle:"numbered"},z={sectionPaddingLeft:S,sectionPaddingRight:S},J={Footprint:{slots:{[b]:[k()]},pressHeading:!0},ProcessSteps:{slots:(e,o)=>o.press?{[x]:y().map(t=>({...t,props:{...t.props,...z}}))}:{},boxProps:{gapPhone:f.editorial}},FAQ:{slots:{[b]:[H()]},pressHeading:!0,coreBox:{name:"Questions",props:q},coreProps:{sectionAccent:X},roomBelow:{bottom:120,bottomPhone:70},boxProps:(e,o)=>o.press?{}:{[Y]:K},skip:e=>{const o=e._partStyles??{},t=F().filter(s=>o[s]!==void 0);return t.length?`held: its rows carry their own run style (_partStyles ${t.map(s=>`"${s}"`).join(", ")}), which the Box path does not draw the same`:void 0}}},fo=Object.fromEntries(U.map(e=>[e,$(e,_(J,e))]));export{q as FAQ_ROWS_BOX,J as HEAD_ONLY_CARD_SEEDS,fo as HEAD_ONLY_SECTION_TO_BOX,U as HEAD_ONLY_TYPES,So as HOST_ROW_HEAD_TYPES,$ as headOnlyRow};
@@ -4,6 +4,10 @@ export declare const SECTION_PAD_INNER_DEFAULTS: Record<string, {
4
4
  bottom: number;
5
5
  }>;
6
6
  export declare const SECTION_PAD_INNER: Set<string>;
7
+ export declare const innerPaddingFallback: (type: string) => {
8
+ top?: number;
9
+ bottom?: number;
10
+ };
7
11
  export declare const PAD_ON_ROOT: ReadonlySet<string>;
8
12
  export declare const PADS_ITS_OWN_SPACE: ReadonlySet<string>;
9
13
  export declare const sectionPadding: BlockPass;
@@ -1 +1 @@
1
- import{jsx as S}from"react/jsx-runtime";import{HideTaker as m}from"../../../components/ViewHideRoot.js";import{isBackgroundBox as _}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as u}from"../../../../format/lib/content/box-side-space.js";import{SECTION_PAD_KEYS as p,padValuesOf as T,resolveSectionPadding as g,sectionPadAttrs as I}from"../../content/section-padding.js";import{sectionFillPassClass as E}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as b,drawsCopiesInTheBox as O}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as x}from"../../../../format/lib/own-entry.js";const l={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120},DetailRows:{top:100,bottom:100}},c=new Set(Object.keys(l)),f=new Set(["Flex","Text","Heading","ImageBlock"]),N=new Set(["Divider"]),h=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),P=new Set(["ProductGrid"]);function s(e,t,o=!1){const i=e.render;e.render=n=>{if(t?.(n))return i(n);const r=I({...T(n,p,o),sideSpace:u(n.sideSpace)}),a=i(n),d=E(n);return r?S(m,{className:d?`${r.className} ${d}`:r.className,style:r.style,children:a}):a}}const j={name:"sectionPadding",applies:(e,t,o)=>t.isSection(e)&&!h.has(e)&&!!o&&typeof o.render=="function",panel(e,t,o){c.has(t)||P.has(t)||(e.fields={...e.fields,...o.sidesPaddingFields({tablet:!0,siteSide:!0})})},draw(e,t){if(c.has(t)){const o=e.render,i=x(l,t);e.render=n=>{const r=g(n,i);return o({...n,padTop:r.top,padBottom:r.bottom})};return}if(P.has(t)){s(e);return}f.has(t)||N.has(t)||s(e,t==="Flex"?o=>_(o.bgImage):b.has(t)?o=>O(t,o):void 0,!0)}},A=["Heading","Text","ImageBlock"],B=["LogoBlock"],K={name:"blockPadding",applies:(e,t,o)=>(A.includes(e)||B.includes(e))&&!!o&&typeof o.render=="function",panel(e,t,o){e.fields={...e.fields,...o.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(e,t){f.has(t)||s(e,void 0,!0)}};export{N as PADS_ITS_OWN_SPACE,f as PAD_ON_ROOT,c as SECTION_PAD_INNER,l as SECTION_PAD_INNER_DEFAULTS,K as blockPadding,j as sectionPadding};
1
+ import{jsx as u}from"react/jsx-runtime";import{HideTaker as m}from"../../../components/ViewHideRoot.js";import{isBackgroundBox as p}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as T}from"../../../../format/lib/content/box-side-space.js";import{BAND_PAD_KEYS as I,BAND_PAD_UNIT_KEY as g,SECTION_PAD_KEYS as b,padValuesOf as A,resolveSectionPadding as D,sectionPadAttrs as E}from"../../content/section-padding.js";import{sectionFillPassClass as N}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as h,drawsCopiesInTheBox as O}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as x}from"../../../../format/lib/own-entry.js";const c={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120},DetailRows:{top:100,bottom:100}},f=new Set(Object.keys(c)),P=e=>x(c,e)??{},r=new Set(["DetailRows"]),_=new Set(["Flex","Text","Heading","ImageBlock"]),B=new Set(["Divider"]),w=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),S=new Set(["ProductGrid"]);function a(e,t,o=!1){const s=e.render;e.render=n=>{if(t?.(n))return s(n);const i=E({...A(n,b,o),sideSpace:T(n.sideSpace)}),d=s(n),l=N(n);return i?u(m,{className:l?`${i.className} ${l}`:i.className,style:i.style,children:d}):d}}const v={name:"sectionPadding",applies:(e,t,o)=>t.isSection(e)&&!w.has(e)&&!!o&&typeof o.render=="function",panel(e,t,o){if(f.has(t)&&!r.has(t)){e.fields={...e.fields,...o.sidesPaddingFields({keys:I,unitKey:g,fallback:P(t),tablet:!0,siteSide:!0})};return}r.has(t)||S.has(t)||(e.fields={...e.fields,...o.sidesPaddingFields({tablet:!0,siteSide:!0})})},draw(e,t){if(!(f.has(t)&&!r.has(t))){if(r.has(t)){const o=e.render,s=P(t);e.render=n=>{const i=D(n,s);return o({...n,padTop:i.top,padBottom:i.bottom})};return}if(S.has(t)){a(e);return}_.has(t)||B.has(t)||a(e,t==="Flex"?o=>p(o.bgImage):h.has(t)?o=>O(t,o):void 0,!0)}}},C=["Heading","Text","ImageBlock"],R=["LogoBlock"],V={name:"blockPadding",applies:(e,t,o)=>(C.includes(e)||R.includes(e))&&!!o&&typeof o.render=="function",panel(e,t,o){e.fields={...e.fields,...o.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(e,t){_.has(t)||a(e,void 0,!0)}};export{B as PADS_ITS_OWN_SPACE,_ as PAD_ON_ROOT,f as SECTION_PAD_INNER,c as SECTION_PAD_INNER_DEFAULTS,V as blockPadding,P as innerPaddingFallback,v as sectionPadding};
@@ -168,6 +168,7 @@ export declare function sectionBoxIdOf(oldId: string, piece: number): string;
168
168
  export declare function registerBoxNativeSections(types: Readonly<Record<string, string>>): void;
169
169
  export declare function boxNativeReason(type: string): string | undefined;
170
170
  export declare const SECTION_TO_BOX_ON: readonly string[];
171
+ export declare const HOST_PRESS_BLOCKS: Readonly<Record<string, readonly string[]>>;
171
172
  export declare const HOST_PRESS_TYPES: readonly string[];
172
173
  export declare const SECTION_TO_BOX_PRESS: readonly string[];
173
174
  export declare function registerSectionToBox(rows: Readonly<Record<string, SectionToBoxRow>>): void;
@@ -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 ae}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ce}from"../../../format/lib/locations-grid.js";import{normalizeTheme as z}from"../../../format/lib/theme.js";import{hasOwnEntry as R,ownEntry as v}from"../../../format/lib/own-entry.js";const E=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 C={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(C,o)&&v(C,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);C[o]=s}}function Ae(t){return v(C,t)}const Y=new Set(["id"]),T={},M=[],fe=["ProductGrid","Events","Collections","GalleryB","ContactRouting","ReviewForm","AppointmentBooking","Reviews","CheckoutCTA","AlloyWheelsListing","SpecTable"],le=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ProcessSteps",...fe,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","DocTabs","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","SectionHeader","TitleWithButtons","Prose","ParagraphsA","Banner","Cards"];function Re(t){for(const[o,s]of Object.entries(t)){if(R(T,o)&&v(T,o)!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=s}}function Ce(t){return v(T,t)}function He(){return Object.keys(T)}function pe(t){return R(T,t)&&M.includes(t)}function Le(t,o=le){return R(T,t)&&(o.includes(t)||pe(t))}function Fe(t){const o=v(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 W=t=>Z(t),Me=t=>W(t).text.trim()!=="";function ue(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 c=s.indexOf(r);return`${s.slice(0,c)}==${r}==${s.slice(c+r.length)}${o===-1?"":t.slice(o)}`}const he=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ye(t,o,s,r){const a={...t._partStyles?.text??{},...o??{},...s??{}};return(r==="center"||r==="right")&&a.align===void 0&&(a.align=r),Object.keys(a).length?{_partStyles:{text:a}}:{}}function me(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const s=o[t.key];return{variant:(typeof s=="string"?v(t.map,s):void 0)??t.fallback}}function V(t,o,s,r,c={}){const a={...o};for(const u of t){const[m,S,j]=typeof u=="string"?[u,u,void 0]:u;if(s[m]===void 0)continue;const I=j?j(s[m],s,c):s[m];I===void 0?delete a[S]:a[S]=I,r(m,S,I===void 0)}return a}function ke(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),s=c=>{for(const a of c??[])o.add(typeof a=="string"?a:a[0])},r=c=>{for(const a of c)switch(a.kind){case"text":case"image":o.add(a.key),a.kind==="image"&&a.alt&&o.add(a.alt);break;case"button":o.add(a.key),o.add(a.href),typeof a.variant=="object"&&o.add(a.variant.key);break;case"list":o.add(a.key);break;case"group":case"block":s(a.box),r(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(u=>o.add(u)),Object.keys(a.rename??{}).forEach(u=>o.add(u)),a.derive?.reads.forEach(u=>o.add(u)),typeof a.slots!="function")for(const u of Object.values(a.slots??{}))for(const m of u)"kind"in m&&o.add(m.key);break}};for(const c of[t,...t.also??[]])s(c.box),r(c.parts);return o}const be=t=>re(t.headPlacement)==="own-box";function ge(t){return be(t)?"its head sits in a Box of its own above it (own-box): the row draws the head inline":void 0}function xe(t,o){const s=t[o];return Array.isArray(s)&&s.some(c=>!!c&&typeof c=="object"&&typeof c.type=="string")?"already on the Box path: its items draw from a filled card template":void 0}function we(t){const o=new Set,s=r=>{for(const c of r)if(c.kind==="group"||c.kind==="block")s(c.parts??[]);else if(c.kind==="core"&&c.slots&&typeof c.slots!="function")for(const[a,u]of Object.entries(c.slots))u.length>0&&u.every(m=>!("kind"in m))&&o.add(a)};for(const r of[t,...t.also??[]])s(r.parts);return[...o]}function $e(t,o,s){if(!s.press)for(const r of we(t)){const c=xe(o,r);if(c!==void 0)return c}}function Q(t,o,s={}){const r=t.props,c=(o.ownBoxConverts?void 0:ge(r))??$e(o,r,s)??o.skip?.(r);if(c!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],skipped:c};const a=String(r.id??t.type),u=[],m=[],S=new Set,j=(n,i)=>{u.push({key:n,home:i}),S.add(n)},I=r._partStyles??{},H=ke(o);let X=0;const w=(n,i)=>({type:n,props:{...i,id:`${a}~${n}-${++X}`}}),K=(n,i,b,y,g,l,$)=>{if(g){for(const d of n??[]){const h=typeof d=="string"?d:d[0];b[h]!==void 0&&$(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,f)=>$(d,f?`nothing — the old value draws nothing (${y}: no ${h})`:`${l}${y}: ${h}`),s)},q=n=>ae(n,i=>`${a}~${i}-${++X}`),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??{},l=y.map((f,x)=>{const p=f??{},k=n.item?.(p,x,r)??{},B=N(k.reverse?[...n.parts].reverse():n.parts,p,!1,`item ${x+1}: `);return n.flat?k.props?B.map(P=>({...P,props:{...P.props,...k.props,id:P.props.id}})):B:[w(E,{name:`${n.name} ${x+1}`,...g,...k.props??{},[_]:B})]});if(n.groups){const f=n.groups;return b(n.key,y.length?`one Box per item (${y.length}), in a Box per group`:"nothing — the list is empty"),ce(y.map(x=>x??{}),f.of,f.of).map((x,p)=>{const k=x.items.map(O=>O.item),B=f.parts?N(f.parts,f.head?.(k,r)??{},!1,`group ${p+1}: `):[],P=x.items.map(O=>l[O.index]),L=f.perRow?.(k.length,r),A=Number.isInteger(L)&&L>=1?L:1,F=[];if(f.perRow&&A<P.length)for(let O=0;O*A<P.length;O++)F.push(P.slice(O*A,(O+1)*A).flat());return w(E,{name:`${f.name} ${p+1}`,...f.props??{},[_]:[...B,w(E,{name:`${f.itemsName} ${p+1}`,...f.itemsProps?.(k.length,r)??{},[_]:F.length?F.map((O,U)=>w(E,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[_]:O})):P.flat()})]})})}const $=n.perRow?.(r),e=n.perRow?Number.isInteger($)&&$>=1?$: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 l.flat();const d=typeof n.rowProps=="function"?n.rowProps(r,s):n.rowProps??{},h=[];for(let f=0;f*e<l.length;f++){const x=l.slice(f*e,(f+1)*e).flat(),p=n.rowFiller?e-l.slice(f*e,(f+1)*e).length:0;h.push(w(E,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...d,[_]:[...x,...Array.from({length:p},(k,B)=>w(E,{name:`Empty ${B+1}`,...n.rowFiller,[_]:[]}))]}))}return h},N=(n,i,b,y)=>{const g=[],l=(e,d)=>b?j(e,d):void 0,$=e=>b?I[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=W(i[e.key]);if(!d.text.trim()&&!(b&&s.press&&o.pressKeepsEmpty?.includes(e.key))){l(e.key,"nothing — empty words draw nothing, so no block");break}const h=he(e.role??"body"),{_partStyles:f,...x}=h,p=ye(h,e.styleFrom?{...e.style,...e.styleFrom(r,s)}:e.style,$(e.key),e.props?.align);g.push(w("Text",{text:e.mark==="accentLead"?ue(d.text):e.mark==="accentItalic"?ie(d.text):d.text,...x,...e.props??{},...p,...d.hidden?{_hidden:!0}:{}})),l(e.key,`${y}Text block: its words${d.hidden?", hidden":""}`);break}case"button":{const d=W(i[e.key]);if(!d.text.trim()){l(e.key,"nothing — no words, no button"),l(e.href,"nothing — no button to link"),typeof e.variant=="object"&&l(e.variant.key,"nothing — no button to style");break}const h=typeof i[e.href]=="string"&&i[e.href]?i[e.href]:"#",f={...e.style??{},...$(e.key)??{}};g.push(w("ButtonBlock",{label:d.text,href:h,...typeof e.props=="function"?e.props(i,s):e.props??{},...me(e.variant,i),...Object.keys(f).length?{_partStyles:{label:f}}:{},...d.hidden?{_hidden:!0}:{}})),l(e.key,`${y}Button block: its words`),l(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${y}Button block: its Style`);break}case"image":{const d=i[e.key];if(typeof d!="string"||!d){l(e.key,"nothing — no picture, no block"),e.alt&&l(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??{}})),l(e.key,`${y}Image block: its picture`),e.alt&&l(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...D(e,i,l));break}case"group":{const d=N(e.parts,i,b,y),h=K(e.box,e.props,i,`${e.name} Box`,!d.length&&!e.keepEmpty,y,l);h&&g.push(w(E,{name:e.name,...h,[_]:d}));break}case"block":{const d=e.parts?N(e.parts,i,b,y):[],h=K(e.box,e.props,i,`${e.type} block`,!!e.parts&&!d.length&&!e.keepEmpty,y,l);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??{}},f=e.keep==="rest"?Object.keys(i).filter(p=>!H.has(p)&&!(p in h)):e.keep;for(const p of f)i[p]!==void 0&&(h[p]=i[p],l(p,`the ${d} block inside the Box`));if(e.keep==="rest"){for(const k of Object.keys(e.props??{}))i[k]!==void 0&&!H.has(k)&&l(k,`nothing — the ${d} block inside the Box has the row's own value`);i.headPlacement!==void 0&&l("headPlacement",`the ${d} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(I).filter(([k])=>!H.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],l(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&&l(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(B=>"kind"in B?D(B,i,l):q([B]));g.push(w(d,h));break}}return g},J=(n,i)=>{const b=i===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,i===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,s):n.boxProps??{},l=V(n.box??[],g,r,($,e,d)=>j($,d?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:E,props:{name:n.name,...l,[_]:y,id:de(a,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}),S.add(n));for(const n of Object.keys(r))Y.has(n)||S.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 We(t,o=M,s={}){const r=t.content;if(!Array.isArray(r))return t;let c=!1;const a=r.flatMap(u=>{const m=u&&typeof u.type=="string"&&o.includes(u.type)?v(T,u.type):void 0;if(!m)return[u];const S=Q(u,m,s);return S.skipped!==void 0?[u]:(c=!0,S.nodes)});return c?{...t,content:a}:t}function Xe(t,o=M,s={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((c,a)=>{const u=c&&typeof c.type=="string"&&o.includes(c.type)?v(T,c.type):void 0;if(!u)return;const m=Q(c,u,s);m.skipped===void 0&&r.push({index:a,node:m.node,nodes:m.nodes})}),r}export{fe as HOST_PRESS_TYPES,_ as SECTION_BOX_SLOT,E as SECTION_BOX_TYPE,M as SECTION_TO_BOX_ON,le as SECTION_TO_BOX_PRESS,Ae as boxNativeReason,Q as convertSection,We as convertSectionsInPage,Ie as convertTheme,pe as convertsToBox,xe as filledTemplateHold,Me as hasWords,be as headInOwnBox,Fe as headParts,ge as ownBoxHold,Le as pressesAsBox,Ne as registerBoxNativeSections,Re as registerSectionToBox,de as sectionBoxIdOf,Xe as sectionToBoxEdits,Ce 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"]),P={},W=[],fe={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"]},le=Object.keys(fe),pe=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ProcessSteps",...le,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","DocTabs","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","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,l,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,f)=>B(d,f?`nothing — the old value draws nothing (${y}: no ${h})`:`${l}${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??{},l=y.map((f,x)=>{const p=f??{},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 f=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??{}),f.of,f.of).map((x,p)=>{const k=x.items.map(O=>O.item),S=f.parts?I(f.parts,f.head?.(k,r)??{},!1,`group ${p+1}: `):[],T=x.items.map(O=>l[O.index]),H=f.perRow?.(k.length,r),N=Number.isInteger(H)&&H>=1?H:1,F=[];if(f.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:`${f.name} ${p+1}`,...f.props??{},[_]:[...S,w(v,{name:`${f.itemsName} ${p+1}`,...f.itemsProps?.(k.length,r)??{},[_]:F.length?F.map((O,U)=>w(v,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.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 l.flat();const d=typeof n.rowProps=="function"?n.rowProps(r,s):n.rowProps??{},h=[];for(let f=0;f*e<l.length;f++){const x=l.slice(f*e,(f+1)*e).flat(),p=n.rowFiller?e-l.slice(f*e,(f+1)*e).length:0;h.push(w(v,{name:`${n.rowName??`${n.name} row`} ${f+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=[],l=(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))){l(e.key,"nothing — empty words draw nothing, so no block");break}const h=ye(e.role??"body"),{_partStyles:f,...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}:{}})),l(e.key,`${y}Text block: its words${d.hidden?", hidden":""}`);break}case"button":{const d=K(i[e.key]);if(!d.text.trim()){l(e.key,"nothing — no words, no button"),l(e.href,"nothing — no button to link"),typeof e.variant=="object"&&l(e.variant.key,"nothing — no button to style");break}const h=typeof i[e.href]=="string"&&i[e.href]?i[e.href]:"#",f={...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(f).length?{_partStyles:{label:f}}:{},...d.hidden?{_hidden:!0}:{}})),l(e.key,`${y}Button block: its words`),l(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${y}Button block: its Style`);break}case"image":{const d=i[e.key];if(typeof d!="string"||!d){l(e.key,"nothing — no picture, no block"),e.alt&&l(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??{}})),l(e.key,`${y}Image block: its picture`),e.alt&&l(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...D(e,i,l));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,l);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,l);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??{}},f=e.keep==="rest"?Object.keys(i).filter(p=>!L.has(p)&&!(p in h)):e.keep;for(const p of f)i[p]!==void 0&&(h[p]=i[p],l(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)&&l(k,`nothing — the ${d} block inside the Box has the row's own value`);i.headPlacement!==void 0&&l("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],l(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&&l(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,l):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??{},l=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,...l,[_]: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{fe as HOST_PRESS_BLOCKS,le 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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "67.4.0",
3
+ "version": "67.5.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",