efficient-web-builder 58.0.0 → 59.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/editor/lib/document/ColourControl.js +1 -1
- package/dist/editor/lib/document/blocks/general/CardList/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Cards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Chart/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Countdown/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Mockup/fields.js +2 -2
- package/dist/editor/lib/document/card-row-fields.d.ts +2 -1
- package/dist/editor/lib/document/card-row-fields.js +1 -1
- package/dist/editor/lib/document/controls.d.ts +12 -6
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/sections/text-layouts.js +1 -1
- package/dist/format/lib/content/box-background.d.ts +2 -2
- package/dist/format/lib/content/box-background.js +1 -1
- package/dist/format/lib/content/card-columns.d.ts +1 -0
- package/dist/format/lib/content/card-columns.js +1 -0
- package/dist/format/lib/content/card-place.js +1 -1
- package/dist/format/lib/content/card-state.d.ts +17 -0
- package/dist/format/lib/content/card-state.js +1 -1
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/gallery-layout.d.ts +13 -1
- package/dist/format/lib/content/gallery-layout.js +1 -1
- package/dist/format/lib/content/page-background.js +1 -1
- package/dist/format/lib/content/section-background.js +1 -1
- package/dist/format/lib/document/blocks/general/Chart/meta.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/Chart/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/Countdown/meta.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/Countdown/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/Mockup/meta.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/Mockup/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/text-part-shapes.json +10 -0
- package/dist/format/lib/document/card-row-keys.d.ts +14 -0
- package/dist/format/lib/document/card-row-keys.js +1 -0
- package/dist/format/lib/document/cards-template-on-read.d.ts +1 -1
- package/dist/format/lib/document/cards-template-on-read.js +1 -1
- package/dist/format/lib/document/neutralization-contracts.js +1 -1
- package/dist/format/lib/document/part-inks.d.ts +5 -2
- package/dist/format/lib/document/part-inks.js +1 -1
- package/dist/format/lib/document/theme-slots.d.ts +20 -0
- package/dist/format/lib/document/theme-slots.js +1 -0
- package/dist/format/lib/editor-words-catalogue.d.ts +3 -0
- package/dist/format/lib/editor-words-catalogue.js +1 -1
- package/dist/format/lib/theme.d.ts +1 -0
- package/dist/format/lib/theme.js +4 -4
- package/dist/render/components/Cards.d.ts +2 -1
- package/dist/render/components/Cards.js +1 -1
- package/dist/render/components/ChartSection.d.ts +2 -1
- package/dist/render/components/ChartSection.js +1 -1
- package/dist/render/components/Countdown.d.ts +2 -1
- package/dist/render/components/Countdown.js +1 -1
- package/dist/render/components/FeaturedCover.d.ts +2 -1
- package/dist/render/components/FeaturedCover.js +1 -1
- package/dist/render/components/KeyFeatures.js +1 -1
- package/dist/render/components/MockupSection.d.ts +2 -1
- package/dist/render/components/MockupSection.js +1 -1
- package/dist/render/lib/document/blocks/general/CardList/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Cards/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Chart/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Countdown/render.js +1 -1
- package/dist/render/lib/document/blocks/general/FeaturedCover/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Mockup/render.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +3 -1
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.d.ts +3 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-promo.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-promo.js +1 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-proof.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-proof.js +1 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
- package/dist/render/lib/document/head-core-boxes.js +1 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +3 -3
- package/dist/editor/lib/document/theme-swatches.d.ts +0 -3
- package/dist/editor/lib/document/theme-swatches.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DIM as u,DROP_COMMON as a,DROP_SIDE_PADDING as s,FOLLOW_THE_BOX as c,INNER_BOX as r,SAME_KEYS as _,SECTION_BOX as P,TEXT as b,bandPage as y,smallText as i,wrapperPad as C,wrapperPadKeys as f}from"./section-to-box-row-parts.js";import{boxPadding as x,token as p}from"../../../../../format/lib/document/seed-parts.js";import{phoneKey as E}from"efficient-easel/draw";import{convertTheme as S}from"../../../sections/section-to-box.js";import{surfacePresetIndex as w}from"../../../../../format/lib/theme.js";import{CHART_OWN_BOX_WORDS as A}from"../../../../../format/lib/document/blocks/general/Chart/meta.js";import{MOCKUP_OWN_BOX_WORDS as N}from"../../../../../format/lib/document/blocks/general/Mockup/meta.js";const m={top:76,bottom:76,topPhone:76,bottomPhone:76},d=()=>({kind:"group",name:"Words",props:{...r,gap:20,gapPhone:20},parts:[{kind:"group",name:"Chip row",props:{...r,direction:"row",phoneRow:2,[E("share")]:"content"},parts:[{kind:"group",name:"Chip",props:{...r,fillColor:"main",...x(6,14)},parts:[i("eyebrow",{color:"background",...p("label",12),weight:600,letterSpacing:.16})]}]},{kind:"text",key:"title",role:"heading",props:b,style:{textStyle:"heading-2",...p("headingMedium",44,32),weight:500,case:"upper",lineHeight:1.04,letterSpacing:-.02}},{kind:"text",key:"body",props:{...u,maxWidth:435},style:{textStyle:"body-1",...p("body",15),lineHeight:1.625}}]}),l=(e,o)=>{const t=S(o)?.themes,n=t?w(t,y(e,o)):-1;return n>=0?n:e},g=e=>(o,t)=>({...P,sectionAccent:l(o.sectionAccent??0,t),direction:"row",align:"center",gap:56,gapPhone:56,share:e,sectionBorder:{top:1,bottom:1},...C(o,m)}),h=[..._.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,o,t)=>l(e,t)],...f(m)],B=()=>({name:"Chart",boxProps:g([42]),box:h,parts:[d(),{kind:"group",name:"Chart",props:{...r,gap:16,gapPhone:16},keepEmpty:!0,parts:[{kind:"core",keep:"rest",props:c},i("caption",{color:"muted",...p("label",10),letterSpacing:.14})]}],pressKeepsEmpty:[...A],drop:{...a,...s}}),O=e=>e.align==="left",k={kind:"group",name:"Card",keepEmpty:!0,props:r,parts:[{kind:"core",keep:"rest",props:c}]},D=()=>({name:"Mockup Card",boxProps:g("equal"),box:h,parts:[{...k,when:O},d(),{...k,when:e=>!O(e)}],pressKeepsEmpty:[...N],drop:{...a,...s}}),H={Chart:B(),Mockup:D()};export{H as PROOF_SECTION_TO_BOX};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{phoneKey as D}from"efficient-easel/draw";import{newId as K}from"efficient-easel/data";import{COUNT_KEY_PROP as
|
|
1
|
+
import{phoneKey as D}from"efficient-easel/draw";import{newId as K}from"efficient-easel/data";import{COUNT_KEY_PROP as _}from"../../../../../format/lib/content/block-sources.js";import{resolveSectionBackground as k,THEME_SECTION_BG as M}from"../../../../../format/lib/content/section-background.js";import{finiteNumber as H}from"../../../../../format/lib/finite-number.js";import{hasWords as g}from"../../../sections/section-to-box.js";import{DROP_COMMON as x,DROP_SIDE_PADDING as T,INNER_BOX as a,NUMBER_TEXT as m,SAME_KEYS as P,SECTION_BOX as O,TEXT as i,bandAccent as Y,bandProps as U,bandWrites as W,fillFrom as G,onBandPreset as X,innerPad as $,innerPadKeys as q,smallText as S,wrapperPad as j,wrapperPadKeys as z}from"./section-to-box-row-parts.js";import{fluidToken as V,headTree as J,token as n}from"./section-head-looks.js";import{SECTION_BG_BUILT_IN as E}from"../../../../../format/lib/document/blocks/general/section-bg-built-in.js";import{CARD_STYLES as s,CARD_STYLE_KEY as f}from"../../../sections/card-list-style.js";import{CARD_LIST_TYPE as Q,CARD_TEMPLATE_SLOT as Z,cardListProps as ee}from"../../../../../format/lib/content/card-template.js";import{BOX_TYPE as d,CONTAINER_BLOCKS_SLOT as l}from"../../../../../format/lib/document/container-blocks.js";import{rowFieldTextSeed as c}from"../../../../../format/lib/document/blocks/general/Cards/card-seed.js";import{say as r}from"../../../../../format/lib/editor-words.js";const b=e=>typeof e=="string"?e.trim():"";function A(e){const t=`${b(e.prefix)}${b(e.value)}`,o=b(e.suffix);return e.emphasizeAll===!0?t?`==_${t}_==`:"":`${t}${o?`==_${o}_==`:""}`}const B={textStyle:"heading-2",...V("headingMedium",56,7,96),weight:500,case:"none",lineHeight:.9,letterSpacing:-.04},w={kind:"block",type:"Text",props:{...m,_partStyles:{text:B}},box:[["value","text",(e,t)=>A(t)]],when:(e,t)=>t!==void 0&&typeof t.value=="string"&&A(t)!==""},R=e=>g(e?.supSuffix),C={textStyle:"body-1",fontRole:"heading",...n("body",16),lineHeight:1.5,letterSpacing:-.01},L={color:"labels",...n("label",12),lineHeight:1.5,letterSpacing:.24},N={...a,direction:"row",align:"start",gap:32,gapPhone:32,share:"content",phoneRow:2,[D("share")]:"content"},I={textStyle:"body-5",...n("label",13),weight:500,color:"accent",letterSpacing:.18,lineHeight:1,padding:12},y=e=>k(e.background,E.StatsParagraph),p=e=>y(e)===M,u=e=>({...e,sectionAccent:e.sectionAccent??0}),te=(e,t)=>p(e)?G("background",(o,h)=>X(u(o),h))(e,t):{},oe={name:"Stats with Text",skip:e=>y(e)&&y(e)!=="transparent"&&!p(e)?"it paints a colour of its own, not the section band":void 0,boxProps:(e,t)=>({...O,direction:"column",gap:60,gapPhone:60,sectionBorder:{bottom:1},...$(e,"StatsParagraph"),...p(e)?U(u(e),t):{}}),box:[...P.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,o)=>p(t)?Y(e,u(t),o):e],...q("StatsParagraph")],site:(e,t)=>p(e.props)?W({props:u(e.props)},t):[],parts:[J("StatsParagraph"),{kind:"group",name:"Stats",props:{...a,...s.table.grid,[f]:"table"},parts:[{kind:"list",key:"stats",name:"Stat",perRow:()=>4,rowName:"Stats row",rowProps:{...a,direction:"row",share:"equal",phoneRow:2,...s.table.row},props:(e,t)=>({...a,...s.table.card,...te(e,t)}),parts:[{...w,when:(e,t)=>!R(t)&&w.when(e,t)},{kind:"group",name:"Figure",props:N,when:(e,t)=>R(t),parts:[w,{kind:"text",key:"supSuffix",props:i,style:I}]},{kind:"group",name:"Words",props:{...a,gap:4,gapPhone:4},parts:[{kind:"text",key:"label",props:i,style:C},S("sub",L)]}]}]}],drop:{...x,...T,background:"the band is the Box's theme: the site's band preset (`sectionAccent`), or a declared band-preset write; none paints nothing, and any other colour is skipped",headPlacement:"needs a row per head placement: an own-box Stats with Text draws no head (its words sit in a Section Header above it), the row always draws the head"}},re=new Set(["value","label",_]),F={top:48,bottom:48,topPhone:48,bottomPhone:48},ae=e=>{const t=k(typeof e.background=="string"?e.background:void 0,E.Stats);return!!t&&t!=="transparent"},se={name:"Stats",skip:e=>ae(e)?"it paints a colour inside its padding, and a Box paints its Fill over the padding too":g(e.dataSource)?"its figures come from a source":Array.isArray(e.items)&&e.items.some(t=>g(t?.[_]))?"a figure names a count, and each figure Text here is typed by hand until it is linked":Array.isArray(e.items)&&e.items.some(t=>Object.keys(t??{}).some(o=>!re.has(o)))?"a figure has a key no part here reads":Object.keys(e._partStyles??{}).some(t=>t!=="heading")?"a figure or a name has a style of its own, kept by kind, which no part here reads":void 0,boxProps:e=>({...O,direction:"column",gap:24,gapPhone:24,...j(e,F)}),box:[...P,...z(F)],parts:[S("heading",{color:"labels",...n("label",12),letterSpacing:.2}),{kind:"group",name:"Stats",props:{...a,...s.list.grid,[f]:"list"},parts:[{kind:"list",key:"items",name:"Stat",perRow:e=>H(e.columns)??4,rowName:"Stats row",rowProps:{...a,direction:"row",share:"equal",phoneRow:2,...s.list.row},props:{...a,...s.list.card},parts:[{kind:"text",key:"value",props:m,style:{textStyle:"heading-2",...n("headingMedium",48,36),weight:500,case:"none",lineHeight:1,letterSpacing:-.03}},S("label",{color:"labels",...n("label",12),letterSpacing:.2})]}]}],drop:{...x,...T,columns:"the rows of N: one row Box per `columns` figures, which the Box draws",dataSource:"an empty source is typed figures, what the row draws; a sourced node is skipped (0 Hartes nodes)",dataSourceOptions:"read only with a source; a sourced node is skipped (0 Hartes nodes)",contained:"the Box draws the site frame now; each figure fills the Box's column",background:"only no fill reaches here: a node that paints a colour is skipped"}},ke={StatsParagraph:oe,Stats:se};function xe(){return{eyebrow:r("By the numbers"),title:r("What we count."),desc:r("A few numbers that matter to us."),stats:[],background:"transparent"}}const ne=[{key:"figure",label:"Figure"},{key:"superscript",label:"Superscript"},{key:"label",label:"Label"},{key:"body",label:"Text",multiline:!0}];function Te(){const e=(t,o,h,v="")=>({key:K("stat"),figure:t,superscript:v,label:o,body:h});return[e("28==_yr_==",r("Years in business"),r("Privately held since day one. Same two founders.")),e("==_8_==",r("Operating footprint"),r("Los Angeles · Fort Lauderdale · Bewdley · Drachten · Mumbai · Selangor · Ho Chi Minh · Sydney. Three continents covered from one California design studio."),r("cities")),e("−21==_%_==",r("Avg. weight saving"),r("Versus OEM equivalents, across our forged catalog.")),e("14==_×_==",r("Finish steps"),r("Specified in California to a 14-step protocol. No two sets are identical."))]}function ie(e){return{type:d,props:{...a,name:"Card",...structuredClone(s[e].listCard)},slots:{[l]:[{type:d,props:{...N,name:"Figure"},slots:{[l]:[c("figure",m,B),c("superscript",i,I)]}},{type:d,props:{...a,name:"Words",gap:4,gapPhone:4},slots:{[l]:[c("label",{...i,widthFit:"fill"},C),c("body",{...i,widthFit:"fill"},L,!0)]}}]}}}function Pe(e,t,o=4){return{type:d,props:{...a,name:"Stats",direction:"row",columns:o,...structuredClone(s[t].items),[f]:t},slots:{[l]:[{type:Q,props:ee(e,ne),slots:{[Z]:[ie(t)]}}]}}}export{ke as STATS_SECTION_TO_BOX,A as figureWords,Pe as statsBoxSeed,xe as statsPressSeed,Te as statsSeedRows};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasWords as
|
|
1
|
+
import{hasWords as C,registerSectionToBox as t}from"../../../sections/section-to-box.js";import{BUTTON as m,DIM as g,DROP_COMMON as a,DROP_SIDE_PADDING as c,INNER_BOX as o,leadLine as v,SAME_KEYS as s,SECTION_BOX as d,TEXT as l,innerPad as T,siteGutterOf as A,innerPadKeys as y,smallText as O,wrapperPad as u,wrapperPadKeys as P}from"./section-to-box-row-parts.js";import{CARDS_SECTION_TO_BOX as H}from"./section-to-box-rows-cards.js";import{normalizeSiteGutterPhone as R,siteGutterPhoneFollows as X}from"../../../../../format/lib/content/page-width.js";import{finiteNumber as D}from"../../../../../format/lib/finite-number.js";import{STATS_SECTION_TO_BOX as L}from"./section-to-box-rows-stats.js";import{LOGOS_SECTION_TO_BOX as W}from"./section-to-box-rows-logos.js";import{STRIP_SECTION_TO_BOX as G}from"./section-to-box-rows-strip.js";import{TIMELINE_SECTION_TO_BOX as M}from"./section-to-box-rows-timeline.js";import{LOCATIONS_SECTION_TO_BOX as F}from"./section-to-box-rows-locations.js";import{HEAD_ONLY_SECTION_TO_BOX as K}from"./section-to-box-rows-head.js";import{PAGE_HEADER_SECTION_TO_BOX as U}from"./section-to-box-rows-pageheader.js";import{DOCBODY_SECTION_TO_BOX as z}from"./section-to-box-rows-docbody.js";import{EDITORIAL_SECTION_TO_BOX as Y}from"./section-to-box-rows-editorial.js";import{FORMS_SECTION_TO_BOX as j}from"./section-to-box-rows-forms.js";import{CHECKOUT_SECTION_TO_BOX as q}from"./section-to-box-rows-checkout.js";import{PROOF_SECTION_TO_BOX as J}from"./section-to-box-rows-proof.js";import{PROMO_SECTION_TO_BOX as Q}from"./section-to-box-rows-promo.js";import{FITMENT_SECTION_TO_BOX as V}from"./section-to-box-rows-fitment.js";import{fluidToken as Z,headTree as S,token as i}from"./section-head-looks.js";import{boxPadding as $}from"../../../../../format/lib/document/seed-parts.js";const _={top:72,bottom:72,topPhone:72,bottomPhone:72},ee={name:"Editorial Text",boxProps:e=>({...d,direction:"column",gap:28,gapPhone:28,sectionBorder:{top:1},...u(e,_)}),box:[["topBorder","sectionBorder",e=>e===!1?void 0:{top:1}],...s,...P(_)],parts:[S("Prose"),{kind:"text",key:"body",props:g,style:{textStyle:"body-1",...i("body",16),lineHeight:1.7,paragraphSpacing:18}}],drop:{...a,...c,headPlacement:"needs a row per head placement: an own-box Prose draws no head (its words sit in a Section Header above it), the row always draws the head. 0 of 123 live nodes store it (the live export, 2026-10-24)"}},f={buttonPaddingTop:20,buttonPaddingBottom:20,buttonPaddingLeft:28,buttonPaddingRight:28},w=(e,n)=>n?.variant==="primary",k=(e,n)=>({kind:"list",key:"buttons",name:"Button",flat:!0,when:e,parts:[{kind:"button",key:"label",href:"href",when:w,variant:"primary",style:{letterSpacing:.3},props:{...m,...f,...n}},{kind:"button",key:"label",href:"href",when:(r,p)=>!w(r,p),variant:"ghost",style:{letterSpacing:.3},props:{...m,...f,...n}}]}),h=e=>C(e.title),te={name:"Call-to-Action Heading",boxProps:e=>({...d,direction:"row",align:"center",justify:h(e)?"between":"end",gap:60,gapPhone:60,share:"content",sectionBorder:{bottom:1},...T(e,"TitleWithButtons")}),box:[...s,...y("TitleWithButtons")],parts:[{kind:"group",name:"Title",props:{...o,maxWidth:1e3,widthFitPhone:"fill"},parts:[{kind:"text",key:"title",role:"heading",props:l,style:{textStyle:"heading-1",...Z("headingLarge",48,7,108),case:"upper",lineHeight:.94,letterSpacing:-.035}}]},{kind:"group",name:"Buttons",props:e=>({...o,gap:14,gapPhone:14,widthFitPhone:"fill",...h(e)?{minWidth:280,minWidthPhone:0}:{}}),parts:[k(h,{widthFit:"fill",iconPosition:"end"}),k(e=>!h(e),{})]}],drop:{...a,buttonsAlign:"moves the buttons only when there is no heading (4 of 128 live nodes), where the Box puts them at the end. 0 of 128 live nodes store it (the live export, 2026-10-24)",buttonsAlignPhone:"the phone's own side of `buttonsAlign`, read only with no heading; no old node stores it (it is new with the Phone view's Block alignment row), so nothing moves",buttonsAlignTablet:"the tablet's own side of `buttonsAlign`, read only with no heading; no old node stores it (it is new with the Tablet view's Block alignment row, 0 stored on the US sites 2026-11-05), so nothing moves"}};function oe(e){const{siteGutter:n,siteGutterPhone:r}=e.site??{},p=A(e),b=Math.min(20,R(r)??X(n));return{sectionPaddingLeft:p,sectionPaddingRight:p,sectionPaddingLeftPhone:b,sectionPaddingRightPhone:b}}const B={top:40,bottom:64,topPhone:24,bottomPhone:36},ne={name:"Section Header",boxProps:(e,n)=>({...d,direction:"column",gap:0,...u(e,B),...oe(n)}),box:[...s,...P(B)],parts:[S("SectionHeader")],drop:{...a,...c,headStyle:"needs a row per head look: the row draws the standard look; the editorial, simple, statement, natural and essay looks are other layouts. 0 of 69 live nodes store it (the live export, 2026-10-24)",eyebrowLook:"read only by the simple, statement, natural and essay looks, which this row does not draw. 0 of 69 live nodes store it",rowGap:"read only by the natural look, which this row does not draw. 0 of 69 live nodes store it",descriptionSize:"read only by the natural look, which this row does not draw. 0 of 69 live nodes store it",numStyle:"Solid (the default; 4 of 69 live nodes store it) IS the eyebrow Text the row draws; Outlined (0 live) needs an outlined-number text look"}},x={...o,direction:"row",share:[67],gap:30},E={...o,sectionPaddingLeft:30,sectionPaddingLeftPhone:0},N=(e,n,r)=>({kind:"group",name:e,props:n,parts:[r]}),ie={name:"Lead Text",boxProps:e=>({...d,direction:"column",gap:40,gapPhone:40,sectionBorder:{bottom:1},...T(e,"ParagraphsA")}),box:[...s,...y("ParagraphsA")],parts:[{kind:"group",name:"Numbers",props:{...x,gapPhone:24,sectionBorder:{bottom:1},sectionPaddingBottom:40,sectionPaddingBottomPhone:40},parts:[{kind:"group",name:"Eyebrow",props:{...o,sectionPaddingTop:5,sectionPaddingBottom:1,sectionPaddingTopPhone:5,sectionPaddingBottomPhone:1},parts:[O("eyebrow",{color:"labels",...i("label",12),letterSpacing:.24})]},N("Stats column",o,{kind:"group",name:"Stats",props:{...E,gap:0,gapPhone:0},parts:[{kind:"list",key:"stats",name:"Stat",flat:!0,parts:[v("value","label",{...i("label",13),letterSpacing:.18,lineHeight:1.8})]}]})]},{kind:"group",name:"Words",props:{...x,gapPhone:28},parts:[{kind:"group",name:"Lead",props:o,parts:[{kind:"group",name:"Measure",props:{...o,maxWidth:780},parts:[{kind:"text",key:"lead",props:l,style:{textStyle:"heading-3",...i("headingSmall",22,20),weight:400,case:"none",lineHeight:1.45,letterSpacing:-.005}}]}]},N("Note column",{...o,justify:"end",widthFit:"fill"},{kind:"group",name:"Founders",props:{...E,gap:8,gapPhone:8},parts:[{kind:"group",name:"Note",props:{...o,gap:6,gapPhone:6},parts:[{kind:"text",key:"foundersHeading",props:l,style:{textStyle:"body-1",fontRole:"heading",...i("body",18,16),weight:500,letterSpacing:-.01,lineHeight:1.7}},{kind:"text",key:"foundersBody",props:g,style:{textStyle:"body-5",fontRole:"heading",...i("body",14,12),lineHeight:1.7}}]},O("attribution",{...i("label",12,10),letterSpacing:.24,lineHeight:1.7})]})]}],drop:{...a}},I={top:24,bottom:24,topPhone:24,bottomPhone:24},re={name:"Banner",boxProps:e=>({...d,direction:"column",gap:0,...u(e,I)}),box:[...s,"contained",...P(I)],parts:[{kind:"group",name:"Card",keepEmpty:!0,props:{...o,gap:28,placement:"top-left",darken:60,darkenStyle:"even",sectionBorder:{width:1},...$(64,40,40,24)},box:[["imageSrc","bgImage"],["overlay","darken",e=>Math.min(Math.max(D(e)??60,0),100)]],parts:[{kind:"group",name:"Words",props:{...o,gap:20},parts:[O("eyebrow"),{kind:"text",key:"title",role:"heading",props:{...l,maxWidth:680},style:{weight:500,lineHeight:1.05,letterSpacing:-.03,case:"none"}},{kind:"text",key:"body",props:{...g,maxWidth:680},style:{textStyle:"body-1",lineHeight:1.6},was:{size:16}}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"primary",props:m}]}],drop:{...a,...c}},ae={Prose:ee,TitleWithButtons:te,SectionHeader:ne,ParagraphsA:ie,Banner:re};function Ee(){t(ae),t(L),t(W),t(H),t(G),t(M),t(F),t(K),t(U),t(z),t(Y),t(j),t(q),t(V),t(J),t(Q)}export{ae as GENERAL_SECTION_TO_BOX,Ee as registerGeneralSectionRows};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNode as
|
|
1
|
+
import{isNode as x,isNodeList as c}from"efficient-easel/data";import{storedStepsShown as E}from"../../components/ProcessSteps.js";import{declaredBlockSource as m,sourcedRows as P}from"../../../format/lib/content/block-sources.js";import{rowHoldsContent as S}from"../../../format/lib/content/card-state.js";import{CARD_LIST_TYPE as k}from"../../../format/lib/content/card-template.js";import{HEAD_CORE_PROP as C,HOLDS_HEAD_CORE_PROP as l}from"../content/empty-hides.js";import{parseSectionHeadPlacement as L}from"../../../format/lib/sections/section-head-placement.js";const p="Flex",_="Text",i=r=>Object.values(r??{}).filter(c),A=r=>r.type===k&&m(r.props)!=="",a=r=>{if(r.type!==p)return!1;const t=i(r.props).flat();return t.length>0&&t.every(A)},u=r=>L(r.props?.headPlacement)==="own-box"||a(r),f=r=>r===void 0||Array.isArray(r)&&r.length===0;function y(r){return r.type===_?!0:r.type===p&&i(r.props).every(t=>t.every(y))}const H={ProcessSteps:r=>f(r.boxes)&&E(r.steps).length===0,Logos:r=>!m(r)&&f(r.logos)&&f(r.items)};function B(r){return i(r.props).flat().every(t=>!P(t.props,!1).rows.some(S))}function g(r){const t=i(r.props).flat();return t.some(u)&&t.every(o=>u(o)||y(o))}function O(r){const t={...r.props};for(const[o,s]of Object.entries(r.props??{}))!c(s)||!s.some(e=>x(e)&&u(e))||(t[o]=s.map(e=>{if(!u(e))return e;const n=a(e)?B(e):H[String(e.type)]?.(e.props??{})===!0;return{...e,props:{...e.props,[C]:n?"empty":!0}}}));return{...r,props:t}}function R(r){const o=Object.entries(r.props??{}).filter(([,e])=>c(e)).filter(([,e])=>e.length>0);if(o.length!==1||o[0][1].length!==1)return null;const s=o[0][1][0];return s?.type===p&&s.props?{key:o[0][0],inner:s}:null}function T(r){if(r?.type!==p||!r.props)return r;if(g(r)){const o=O(r);return{...o,props:{...o.props,[l]:!0}}}const t=R(r);return!t||!g(t.inner)?r:{...r,props:{...r.props,[t.key]:[O(t.inner)],[l]:!0}}}function j(r){const t=r;if(!t||!Array.isArray(t.content))return r;let o=!1;const s=t.content.map(e=>{const n=T(e);return n!==e&&(o=!0),n});return o?{...t,content:s}:r}export{j as markHeadCoreBoxes};
|
|
@@ -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}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{accentItalicRuns as ie}from"../../../format/lib/markup.js";import{seedNodes as re}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ae}from"../../../format/lib/locations-grid.js";import{normalizeTheme as G}from"../../../format/lib/theme.js";const E=ee,v=te;function Be(t){if(t.theme)return G(t.theme);const o=t.site?.themePresets;return o?G({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function ce(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 Te(t){for(const[o,i]of Object.entries(t)){if(o in A&&A[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=i}}function _e(t){return A[t]}const V=new Set(["id"]),T={},C=[],fe=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ProductGrid","Stats","Logos","PaymentBadges","FitmentFinder","DocMasthead","Timeline","TimelineTrack","OrderSummary"];function Pe(t){for(const[o,i]of Object.entries(t)){if(o in T&&T[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=i}}function Ee(t){return T[t]}function ve(){return Object.keys(T)}function de(t){return t in T&&C.includes(t)}function je(t,o=fe){return t in T&&(o.includes(t)||de(t))}function Ne(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const i=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&i.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&i.push({kind:"button",key:"linkText",href:"linkHref"}),i}const H=t=>Z(t),Ie=t=>H(t).text.trim()!=="";function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),i=o===-1?t:t.slice(0,o),r=i.trim();if(!r)return t;const m=i.indexOf(r);return`${i.slice(0,m)}==${r}==${i.slice(m+r.length)}${o===-1?"":t.slice(o)}`}const pe=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ue(t,o,i,r){const a={...t._partStyles?.text??{},...o??{},...i??{}};return(r==="center"||r==="right")&&a.align===void 0&&(a.align=r),Object.keys(a).length?{_partStyles:{text:a}}:{}}function he(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const i=o[t.key];return{variant:typeof i=="string"&&Object.hasOwn(t.map,i)?t.map[i]:t.fallback}}function Y(t,o,i,r,m={}){const a={...o};for(const h of t){const[k,B,j]=typeof h=="string"?[h,h,void 0]:h;if(i[k]===void 0)continue;const _=j?j(i[k],i,m):i[k];_===void 0?delete a[B]:a[B]=_,r(k,B,_===void 0)}return a}function ye(t){const o=new Set([...V,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),i=m=>{for(const a of m??[])o.add(typeof a=="string"?a:a[0])},r=m=>{for(const a of m)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":i(a.box),r(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(h=>o.add(h)),Object.keys(a.rename??{}).forEach(h=>o.add(h)),a.derive?.reads.forEach(h=>o.add(h)),typeof a.slots!="function")for(const h of Object.values(a.slots??{}))for(const k of h)"kind"in k&&o.add(k.key);break}};for(const m of[t,...t.also??[]])i(m.box),r(m.parts);return o}function Q(t,o,i={}){const r=t.props,m=o.skip?.(r);if(m!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:m};const a=String(r.id??t.type),h=[],k=[],B=[],j=new Set,_=(n,s)=>{h.push({key:n,home:s}),j.add(n)},X=r._partStyles??{},L=ye(o);let K=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++K}`}}),M=(n,s,b,y,g,d,w)=>{if(g){for(const c of n??[]){const p=typeof c=="string"?c:c[0];b[p]!==void 0&&w(p,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(r,i):s??{};return Y(n??[],e,b,(c,p,f)=>w(c,f?`nothing — the old value draws nothing (${y}: no ${p})`:`${d}${y}: ${p}`),i)},q=n=>re(n,s=>`${a}~${s}-${++K}`),W=(n,s,b)=>{const y=n.of?n.of(s):Array.isArray(s[n.key])?s[n.key]:[],g=typeof n.props=="function"?n.props(r,i):n.props??{},d=y.map((f,x)=>{const l=f??{},u=n.item?.(l,x,r)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${x+1}: `);return n.flat?u.props?O.map(P=>({...P,props:{...P.props,...u.props,id:P.props.id}})):O:[$(E,{name:`${n.name} ${x+1}`,...g,...u.props??{},[v]:O})]});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,l)=>{const u=x.items.map(S=>S.item),O=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],P=x.items.map(S=>d[S.index]),F=f.perRow?.(u.length,r),I=Number.isInteger(F)&&F>=1?F:1,z=[];if(f.perRow&&I<P.length)for(let S=0;S*I<P.length;S++)z.push(P.slice(S*I,(S+1)*I).flat());return $(E,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(E,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:z.length?z.map((S,U)=>$(E,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:S})):P.flat()})]})})}const w=n.perRow?.(r),e=n.perRow?Number.isInteger(w)&&w>=1?w: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 d.flat();const c=typeof n.rowProps=="function"?n.rowProps(r,i):n.rowProps??{},p=[];for(let f=0;f*e<d.length;f++){const x=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(E,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...x,...Array.from({length:l},(u,O)=>$(E,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const g=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(r,b?void 0:s)))switch(e.kind){case"text":{const c=H(s[e.key]);if(!c.text.trim()&&!(b&&i.press&&o.pressKeepsEmpty?.includes(e.key))){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...x}=p,l=ue(p,e.styleFrom?{...e.style,...e.styleFrom(r,i)}:e.style,w(e.key),e.props?.align);if(e.was&&b){const u=l._partStyles?.text??{};B.push({key:e.key,was:e.was,...typeof u.textStyle=="string"?{textStyle:u.textStyle}:{},...R(u.size)!==void 0?{size:R(u.size)}:{},...R(u.sizePhone)!==void 0?{sizePhone:R(u.sizePhone)}:{}})}g.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?ie(c.text):c.text,...x,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=H(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — no words, no button"),d(e.href,"nothing — no button to link"),typeof e.variant=="object"&&d(e.variant.key,"nothing — no button to style");break}const p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...w(e.key)??{}};g.push($("ButtonBlock",{label:c.text,href:p,...typeof e.props=="function"?e.props(s,i):e.props??{},...he(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Button block: its words`),d(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&d(e.variant.key,`${y}Button block: its Style`);break}case"image":{const c=s[e.key];if(typeof c!="string"||!c){d(e.key,"nothing — no picture, no block"),e.alt&&d(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";g.push($("ImageBlock",{src:c,alt:p,...e.props??{}})),d(e.key,`${y}Image block: its picture`),e.alt&&d(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...W(e,s,d));break}case"group":{const c=N(e.parts,s,b,y),p=M(e.box,e.props,s,`${e.name} Box`,!c.length&&!e.keepEmpty,y,d);p&&g.push($(E,{name:e.name,...p,[v]:c}));break}case"block":{const c=e.parts?N(e.parts,s,b,y):[],p=M(e.box,e.props,s,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,y,d);p&&g.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(l=>!L.has(l)&&!(l in p)):e.keep;for(const l of f)s[l]!==void 0&&(p[l]=s[l],d(l,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const u of Object.keys(e.props??{}))s[u]!==void 0&&!L.has(u)&&d(u,`nothing — the ${c} block inside the Box has the row's own value`);s.headPlacement!==void 0&&d("headPlacement",`the ${c} block inside the Box: own-box`);const l=Object.fromEntries(Object.entries(X).filter(([u])=>!L.has(u)));Object.keys(l).length&&(p._partStyles=l)}for(const[l,u]of Object.entries(e.rename??{}))s[l]!==void 0&&(p[u]=s[l],d(l,`the ${c} block inside the Box: ${u}`));if(e.derive){Object.assign(p,e.derive.props(s,i));for(const l of e.derive.reads)s[l]!==void 0&&d(l,`the ${c} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(s,i):e.slots??{};for(const[l,u]of Object.entries(x))p[l]=u.flatMap(O=>"kind"in O?W(O,s,d):q([O]));g.push($(c,p));break}}return g},J=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,s===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(r,i):n.boxProps??{},d=Y(n.box??[],g,r,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),i);return{type:E,props:{name:n.name,...d,[v]:y,id:ce(a,s)}}},D=[o,...o.also??[]].map(J);r._partStyles!==void 0&&_("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))r[n]!==void 0&&_(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in r&&(k.push({key:n,why:s}),j.add(n));for(const n of Object.keys(r))V.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:h,dropped:k,siteWrites:[...o.site?.(t,i)??[]],restyled:B}}function Re(t,o=C,i={}){const r=t.content;if(!Array.isArray(r))return t;let m=!1;const a=r.flatMap(h=>{const k=h&&typeof h.type=="string"&&o.includes(h.type)?T[h.type]:void 0;if(!k)return[h];const B=Q(h,k,i);return B.skipped!==void 0?[h]:(m=!0,B.nodes)});return m?{...t,content:a}:t}function Ae(t,o=C,i={}){if(!Array.isArray(t))return[];const r=[];return t.forEach((m,a)=>{const h=m&&typeof m.type=="string"&&o.includes(m.type)?T[m.type]:void 0;if(!h)return;const k=Q(m,h,i);k.skipped===void 0&&r.push({index:a,node:k.node,nodes:k.nodes})}),r}export{v as SECTION_BOX_SLOT,E as SECTION_BOX_TYPE,C as SECTION_TO_BOX_ON,fe as SECTION_TO_BOX_PRESS,_e as boxNativeReason,Q as convertSection,Re as convertSectionsInPage,Be as convertTheme,de as convertsToBox,Ie as hasWords,Ne as headParts,je as pressesAsBox,Te as registerBoxNativeSections,Pe as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,Ee as sectionToBoxRow,ve 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}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{accentItalicRuns as re}from"../../../format/lib/markup.js";import{seedNodes as ie}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ae}from"../../../format/lib/locations-grid.js";import{normalizeTheme as G}from"../../../format/lib/theme.js";const E=ee,v=te;function Be(t){if(t.theme)return G(t.theme);const o=t.site?.themePresets;return o?G({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function ce(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 Te(t){for(const[o,r]of Object.entries(t)){if(o in A&&A[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=r}}function _e(t){return A[t]}const V=new Set(["id"]),T={},z=[],fe=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ","ProductGrid","Stats","Logos","PaymentBadges","FitmentFinder","DocMasthead","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","Cards"];function Pe(t){for(const[o,r]of Object.entries(t)){if(o in T&&T[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=r}}function Ee(t){return T[t]}function ve(){return Object.keys(T)}function de(t){return t in T&&z.includes(t)}function je(t,o=fe){return t in T&&(o.includes(t)||de(t))}function Ne(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const r=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&r.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&r.push({kind:"button",key:"linkText",href:"linkHref"}),r}const H=t=>Z(t),Ie=t=>H(t).text.trim()!=="";function le(t){if(t.includes("=="))return t;const o=t.indexOf("/"),r=o===-1?t:t.slice(0,o),i=r.trim();if(!i)return t;const m=r.indexOf(i);return`${r.slice(0,m)}==${i}==${r.slice(m+i.length)}${o===-1?"":t.slice(o)}`}const pe=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ue(t,o,r,i){const a={...t._partStyles?.text??{},...o??{},...r??{}};return(i==="center"||i==="right")&&a.align===void 0&&(a.align=i),Object.keys(a).length?{_partStyles:{text:a}}:{}}function he(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const r=o[t.key];return{variant:typeof r=="string"&&Object.hasOwn(t.map,r)?t.map[r]:t.fallback}}function Y(t,o,r,i,m={}){const a={...o};for(const h of t){const[k,B,j]=typeof h=="string"?[h,h,void 0]:h;if(r[k]===void 0)continue;const _=j?j(r[k],r,m):r[k];_===void 0?delete a[B]:a[B]=_,i(k,B,_===void 0)}return a}function ye(t){const o=new Set([...V,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),r=m=>{for(const a of m??[])o.add(typeof a=="string"?a:a[0])},i=m=>{for(const a of m)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":r(a.box),i(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(h=>o.add(h)),Object.keys(a.rename??{}).forEach(h=>o.add(h)),a.derive?.reads.forEach(h=>o.add(h)),typeof a.slots!="function")for(const h of Object.values(a.slots??{}))for(const k of h)"kind"in k&&o.add(k.key);break}};for(const m of[t,...t.also??[]])r(m.box),i(m.parts);return o}function Q(t,o,r={}){const i=t.props,m=o.skip?.(i);if(m!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:m};const a=String(i.id??t.type),h=[],k=[],B=[],j=new Set,_=(n,s)=>{h.push({key:n,home:s}),j.add(n)},M=i._partStyles??{},C=ye(o);let X=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++X}`}}),K=(n,s,b,y,g,d,w)=>{if(g){for(const c of n??[]){const p=typeof c=="string"?c:c[0];b[p]!==void 0&&w(p,`nothing — the ${y} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(i,r):s??{};return Y(n??[],e,b,(c,p,f)=>w(c,f?`nothing — the old value draws nothing (${y}: no ${p})`:`${d}${y}: ${p}`),r)},q=n=>ie(n,s=>`${a}~${s}-${++X}`),W=(n,s,b)=>{const y=n.of?n.of(s):Array.isArray(s[n.key])?s[n.key]:[],g=typeof n.props=="function"?n.props(i,r):n.props??{},d=y.map((f,x)=>{const l=f??{},u=n.item?.(l,x,i)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${x+1}: `);return n.flat?u.props?O.map(P=>({...P,props:{...P.props,...u.props,id:P.props.id}})):O:[$(E,{name:`${n.name} ${x+1}`,...g,...u.props??{},[v]:O})]});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,l)=>{const u=x.items.map(S=>S.item),O=f.parts?N(f.parts,f.head?.(u,i)??{},!1,`group ${l+1}: `):[],P=x.items.map(S=>d[S.index]),L=f.perRow?.(u.length,i),I=Number.isInteger(L)&&L>=1?L:1,F=[];if(f.perRow&&I<P.length)for(let S=0;S*I<P.length;S++)F.push(P.slice(S*I,(S+1)*I).flat());return $(E,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(E,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,i)??{},[v]:F.length?F.map((S,U)=>$(E,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:S})):P.flat()})]})})}const w=n.perRow?.(i),e=n.perRow?Number.isInteger(w)&&w>=1?w: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 d.flat();const c=typeof n.rowProps=="function"?n.rowProps(i,r):n.rowProps??{},p=[];for(let f=0;f*e<d.length;f++){const x=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(E,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...x,...Array.from({length:l},(u,O)=>$(E,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const g=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?M[e]:void 0;for(const e of n)if(!(e.when&&!e.when(i,b?void 0:s)))switch(e.kind){case"text":{const c=H(s[e.key]);if(!c.text.trim()&&!(b&&r.press&&o.pressKeepsEmpty?.includes(e.key))){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...x}=p,l=ue(p,e.styleFrom?{...e.style,...e.styleFrom(i,r)}:e.style,w(e.key),e.props?.align);if(e.was&&b){const u=l._partStyles?.text??{};B.push({key:e.key,was:e.was,...typeof u.textStyle=="string"?{textStyle:u.textStyle}:{},...R(u.size)!==void 0?{size:R(u.size)}:{},...R(u.sizePhone)!==void 0?{sizePhone:R(u.sizePhone)}:{}})}g.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?re(c.text):c.text,...x,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=H(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — no words, no button"),d(e.href,"nothing — no button to link"),typeof e.variant=="object"&&d(e.variant.key,"nothing — no button to style");break}const p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...w(e.key)??{}};g.push($("ButtonBlock",{label:c.text,href:p,...typeof e.props=="function"?e.props(s,r):e.props??{},...he(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Button block: its words`),d(e.href,`${y}Button block: its link`),typeof e.variant=="object"&&d(e.variant.key,`${y}Button block: its Style`);break}case"image":{const c=s[e.key];if(typeof c!="string"||!c){d(e.key,"nothing — no picture, no block"),e.alt&&d(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";g.push($("ImageBlock",{src:c,alt:p,...e.props??{}})),d(e.key,`${y}Image block: its picture`),e.alt&&d(e.alt,`${y}Image block: its alt text`);break}case"list":{g.push(...W(e,s,d));break}case"group":{const c=N(e.parts,s,b,y),p=K(e.box,e.props,s,`${e.name} Box`,!c.length&&!e.keepEmpty,y,d);p&&g.push($(E,{name:e.name,...p,[v]:c}));break}case"block":{const c=e.parts?N(e.parts,s,b,y):[],p=K(e.box,e.props,s,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,y,d);p&&g.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(l=>!C.has(l)&&!(l in p)):e.keep;for(const l of f)s[l]!==void 0&&(p[l]=s[l],d(l,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const u of Object.keys(e.props??{}))s[u]!==void 0&&!C.has(u)&&d(u,`nothing — the ${c} block inside the Box has the row's own value`);s.headPlacement!==void 0&&d("headPlacement",`the ${c} block inside the Box: own-box`);const l=Object.fromEntries(Object.entries(M).filter(([u])=>!C.has(u)));Object.keys(l).length&&(p._partStyles=l)}for(const[l,u]of Object.entries(e.rename??{}))s[l]!==void 0&&(p[u]=s[l],d(l,`the ${c} block inside the Box: ${u}`));if(e.derive){Object.assign(p,e.derive.props(s,r));for(const l of e.derive.reads)s[l]!==void 0&&d(l,`the ${c} block inside the Box`)}const x=typeof e.slots=="function"?e.slots(s,r):e.slots??{};for(const[l,u]of Object.entries(x))p[l]=u.flatMap(O=>"kind"in O?W(O,s,d):q([O]));g.push($(c,p));break}}return g},J=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,i,!0,s===0?"":`${b}: `),g=typeof n.boxProps=="function"?n.boxProps(i,r):n.boxProps??{},d=Y(n.box??[],g,i,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),r);return{type:E,props:{name:n.name,...d,[v]:y,id:ce(a,s)}}},D=[o,...o.also??[]].map(J);i._partStyles!==void 0&&_("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))i[n]!==void 0&&_(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in i&&(k.push({key:n,why:s}),j.add(n));for(const n of Object.keys(i))V.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:h,dropped:k,siteWrites:[...o.site?.(t,r)??[]],restyled:B}}function Re(t,o=z,r={}){const i=t.content;if(!Array.isArray(i))return t;let m=!1;const a=i.flatMap(h=>{const k=h&&typeof h.type=="string"&&o.includes(h.type)?T[h.type]:void 0;if(!k)return[h];const B=Q(h,k,r);return B.skipped!==void 0?[h]:(m=!0,B.nodes)});return m?{...t,content:a}:t}function Ae(t,o=z,r={}){if(!Array.isArray(t))return[];const i=[];return t.forEach((m,a)=>{const h=m&&typeof m.type=="string"&&o.includes(m.type)?T[m.type]:void 0;if(!h)return;const k=Q(m,h,r);k.skipped===void 0&&i.push({index:a,node:k.node,nodes:k.nodes})}),i}export{v as SECTION_BOX_SLOT,E as SECTION_BOX_TYPE,z as SECTION_TO_BOX_ON,fe as SECTION_TO_BOX_PRESS,_e as boxNativeReason,Q as convertSection,Re as convertSectionsInPage,Be as convertTheme,de as convertsToBox,Ie as hasWords,Ne as headParts,je as pressesAsBox,Te as registerBoxNativeSections,Pe as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,Ee as sectionToBoxRow,ve as sectionToBoxTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "59.0.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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@tabler/icons-react": "^3.46.0",
|
|
56
56
|
"efficient-easel": "^29.0.0",
|
|
57
|
-
"efficient-shell": "^12.
|
|
57
|
+
"efficient-shell": "^12.17.0",
|
|
58
58
|
"isomorphic-dompurify": "^3.18.0",
|
|
59
59
|
"next": ">=16",
|
|
60
60
|
"react": ">=19",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@types/react": "^19",
|
|
74
74
|
"@types/react-dom": "^19",
|
|
75
75
|
"efficient-easel": "^29.0.0",
|
|
76
|
-
"efficient-shell": "^12.
|
|
76
|
+
"efficient-shell": "^12.17.0",
|
|
77
77
|
"esbuild": "^0.28.0",
|
|
78
78
|
"happy-dom": "^20.14.5",
|
|
79
79
|
"isomorphic-dompurify": "^3.18.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{say as t}from"../../../format/lib/editor-words.js";import{typedHex as h}from"efficient-easel/pick";import{normalizeTheme as u}from"../../../format/lib/theme.js";function p(m){const r=new Set,c=[];return u(m).themes.forEach((o,n)=>{const s=[[t("Theme {n} main color",{n:n+1}),o.accent],[t("Theme {n} text color",{n:n+1}),o.text],[t("Theme {n} background",{n:n+1}),o.background]];for(const[f,a]of s){const e=a?h(a):null;!e||r.has(e)||(r.add(e),c.push({name:f,value:e}))}}),c}export{p as themeSwatches};
|