efficient-web-builder 55.0.0 → 55.1.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 +16 -0
- package/dist/editor/lib/document/blocks/general/CardList/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/general/CardList/fields.js +1 -0
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/blocks/general/index.js +1 -1
- package/dist/editor/lib/document/card-row-fields.js +1 -1
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/format/lib/content/box-background.d.ts +19 -0
- package/dist/format/lib/content/box-background.js +1 -1
- package/dist/format/lib/content/box-layout.d.ts +2 -0
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-phone-place.d.ts +3 -3
- package/dist/format/lib/content/box-phone-place.js +1 -1
- package/dist/format/lib/content/box-separator.js +1 -1
- package/dist/format/lib/content/card-state.d.ts +2 -0
- package/dist/format/lib/content/card-state.js +1 -1
- package/dist/format/lib/content/card-template.d.ts +9 -1
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/phone-focus.js +1 -1
- package/dist/format/lib/content/view-var-split.d.ts +11 -0
- package/dist/format/lib/content/view-var-split.js +1 -0
- package/dist/format/lib/document/blocks/general/CardList/item-seed.d.ts +4 -0
- package/dist/format/lib/document/blocks/general/CardList/item-seed.js +1 -0
- package/dist/format/lib/document/blocks/general/CardList/meta.d.ts +8 -0
- package/dist/format/lib/document/blocks/general/CardList/meta.js +1 -0
- package/dist/format/lib/document/blocks/general/metas.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/metas.js +1 -1
- package/dist/format/lib/document/general-order.d.ts +1 -1
- package/dist/format/lib/document/general-order.js +1 -1
- package/dist/format/lib/document/section-catalog.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +1 -0
- package/dist/format/lib/editor-words-catalogue.js +1 -1
- package/dist/format/lib/fit-words.d.ts +8 -0
- package/dist/format/lib/fit-words.js +23 -12
- package/dist/render/components/CardRowContext.d.ts +3 -2
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/Flex.d.ts +7 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/SiteGutterFrame.d.ts +2 -1
- package/dist/render/components/SiteGutterFrame.js +1 -1
- package/dist/render/lib/content/block-size.d.ts +2 -6
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/document/blocks/general/CardList/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/CardList/render.js +1 -0
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/general/renders.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -1
- package/dist/render/lib/document/passes/block-size.js +1 -1
- package/dist/render/lib/document/passes/clickable-parts.js +1 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BannerRender as r}from"./Banner/render.js";import{BreadcrumbRender as e}from"./Breadcrumb/render.js";import{ButtonBlockRender as o}from"./ButtonBlock/render.js";import{CardsRender as t}from"./Cards/render.js";import{CategoryBarRender as m}from"./CategoryBar/render.js";import{ChartRender as
|
|
1
|
+
import{BannerRender as r}from"./Banner/render.js";import{BreadcrumbRender as e}from"./Breadcrumb/render.js";import{ButtonBlockRender as o}from"./ButtonBlock/render.js";import{CardsRender as t}from"./Cards/render.js";import{CategoryBarRender as m}from"./CategoryBar/render.js";import{ChartRender as i}from"./Chart/render.js";import{ContactLocationsRender as n}from"./ContactLocations/render.js";import{CustomHTMLRender as d}from"./CustomHTML/render.js";import{DividerRender as a}from"./Divider/render.js";import{ContentsRender as p}from"./Contents/render.js";import{DocBodyRender as R}from"./DocBody/render.js";import{DocMastheadRender as f}from"./DocMasthead/render.js";import{DocMetaCardsRender as s}from"./DocMetaCards/render.js";import{DocTabsRender as c}from"./DocTabs/render.js";import{EyebrowRender as S}from"./Eyebrow/render.js";import{FAQRender as l}from"./FAQ/render.js";import{FeaturedCoverRender as g}from"./FeaturedCover/render.js";import{FlexRender as B}from"./Flex/render.js";import{FootprintRender as C}from"./Footprint/render.js";import{GridRender as u}from"./Grid/render.js";import{HeadingRender as T}from"./Heading/render.js";import{HeroRender as L}from"./Hero/render.js";import{HeroGroupRender as H}from"./HeroGroup/render.js";import{HeroSingleRender as M}from"./HeroSingle/render.js";import{HeroSlideRender as h}from"./HeroSlide/render.js";import{ImageBlockRender as k}from"./ImageBlock/render.js";import{IntegrationsRender as y}from"./Integrations/render.js";import{IntroBleedRender as P}from"./IntroBleed/render.js";import{CountdownRender as D}from"./Countdown/render.js";import{KeyFeaturesRender as F}from"./KeyFeatures/render.js";import{LocationMapRender as b}from"./LocationMap/render.js";import{LogoBlockRender as E}from"./LogoBlock/render.js";import{LogosRender as I}from"./Logos/render.js";import{LongReadRender as x}from"./LongRead/render.js";import{ManifestoRender as A}from"./Manifesto/render.js";import{MastheadRender as G}from"./Masthead/render.js";import{MockupRender as v}from"./Mockup/render.js";import{OrderSummaryRender as w}from"./OrderSummary/render.js";import{CardListRender as K}from"./CardList/render.js";import{ParagraphsARender as N}from"./ParagraphsA/render.js";import{PaymentBadgesRender as O}from"./PaymentBadges/render.js";import{PostCardRender as Q}from"./PostCard/render.js";import{ProcessStepsRender as W}from"./ProcessSteps/render.js";import{ProseRender as _}from"./Prose/render.js";import{SectionHeaderRender as j}from"./SectionHeader/render.js";import{SeriesRender as q}from"./Series/render.js";import{SpacerRender as z}from"./Spacer/render.js";import{SpecStripRender as J}from"./SpecStrip/render.js";import{SplitRender as U}from"./Split/render.js";import{StatsRender as V}from"./Stats/render.js";import{StatsParagraphRender as X}from"./StatsParagraph/render.js";import{TestimonialsRender as Y}from"./Testimonials/render.js";import{TextRender as Z}from"./Text/render.js";import{TickerRender as $}from"./Ticker/render.js";import{TimelineRender as rr}from"./Timeline/render.js";import{TimelineTrackRender as er}from"./TimelineTrack/render.js";import{TitleWithButtonsRender as or}from"./TitleWithButtons/render.js";const ne={Banner:r,Breadcrumb:e,ButtonBlock:o,Cards:t,CategoryBar:m,Chart:i,ContactLocations:n,CustomHTML:d,Divider:a,Contents:p,DocBody:R,DocMasthead:f,DocMetaCards:s,DocTabs:c,Eyebrow:S,FAQ:l,FeaturedCover:g,Flex:B,Footprint:C,Grid:u,Heading:T,Hero:L,HeroGroup:H,HeroSingle:M,HeroSlide:h,ImageBlock:k,Integrations:y,IntroBleed:P,Countdown:D,KeyFeatures:F,LocationMap:b,LogoBlock:E,Logos:I,LongRead:x,Manifesto:A,Masthead:G,Mockup:v,OrderSummary:w,CardList:K,ParagraphsA:N,PaymentBadges:O,PostCard:Q,ProcessSteps:W,Prose:_,SectionHeader:j,Series:q,Spacer:z,SpecStrip:J,Split:U,Stats:V,StatsParagraph:X,Testimonials:Y,Text:Z,Ticker:$,Timeline:rr,TimelineTrack:er,TitleWithButtons:or};export{ne as GENERAL_RENDERS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasWords as p}from"../../../sections/section-to-box.js";import{BLOCK_WIDTH_LIMIT as N}from"efficient-easel/draw";import{fluidToken as M,token as o}from"./section-head-looks.js";import{STRIP_BOX as R}from"../../../../../format/lib/sections/strip-shape.js";import{BUTTON as C,DIM as A,DROP_COMMON as l,DROP_SIDE_PADDING as d,INNER_BOX as n,leadLine as k,RIGHT_WORDS as P,SAME_KEYS as g,SECTION_BOX as c,SH_LINK as W,smallText as i,TEXT as a,wrapperPad as h,wrapperPadKeys as m}from"./section-to-box-row-parts.js";const r={textFit:"line",textFitPhone:"wrap"},f={minWidth:N.min},S=(e,t,s)=>({...i(e,{...t,...P}),props:{...a,align:"right",...r,...s}}),_={top:1,bottom:0},b=(e,t,s,H)=>({kind:"group",name:e,props:{...n,sectionPaddingBottom:t,sectionPaddingBottomPhone:s},parts:[H]}),
|
|
1
|
+
import{hasWords as p}from"../../../sections/section-to-box.js";import{BLOCK_WIDTH_LIMIT as N}from"efficient-easel/draw";import{fluidToken as M,token as o}from"./section-head-looks.js";import{STRIP_BOX as R}from"../../../../../format/lib/sections/strip-shape.js";import{BUTTON as C,DIM as A,DROP_COMMON as l,DROP_SIDE_PADDING as d,INNER_BOX as n,leadLine as k,RIGHT_WORDS as P,SAME_KEYS as g,SECTION_BOX as c,SH_LINK as W,smallText as i,TEXT as a,wrapperPad as h,wrapperPadKeys as m}from"./section-to-box-row-parts.js";const r={textFit:"line",textFitPhone:"wrap"},f={minWidth:N.min},S=(e,t,s)=>({...i(e,{...t,...P}),props:{...a,align:"right",...r,...s}}),_={top:1,bottom:0},b=(e,t,s,H)=>({kind:"group",name:e,props:{...n,sectionPaddingBottom:t,sectionPaddingBottomPhone:s},parts:[H]}),w={widthFit:"fill",...f},T={top:100,bottom:60,topPhone:60,bottomPhone:40},U={...o("label",13),letterSpacing:.22,lineHeight:1.8},x={textStyle:"heading-1",...M("headingLarge",56,8,128),case:"upper",weight:500,lineHeight:.88,letterSpacing:-.04},E=e=>e.titleLevel===2,v=()=>({name:"Document Header",boxProps:e=>({...c,direction:"column",gap:0,sectionBorder:{bottom:1},...h(e,T)}),box:[...g,...m(T)],parts:[{kind:"group",name:"Header",props:{...n,direction:"row",align:"end",justify:"between",gap:40,gapPhone:16,share:"content",sectionPaddingBottom:32},parts:[b("Eyebrow",12,0,{...i("eyebrow",o("label",13)),props:{...a,...r}}),{kind:"text",key:"title",role:"heading",props:{...a,tag:"h1",...w},style:x,when:e=>!E(e)},{kind:"text",key:"title",role:"heading",props:{...a,tag:"h2",...w},style:x,when:E},{kind:"group",name:"Details",props:{...n,align:"stretch",gap:0,gapPhone:0,sectionPaddingBottom:12,sectionPaddingBottomPhone:0},parts:[{kind:"list",key:"meta",name:"Detail",flat:!0,parts:[k("label","value",U,r)]}]}]},{kind:"group",name:"Deck",props:{...n,sectionBorder:_,sectionPaddingTop:32},parts:[{kind:"text",key:"deck",props:{...A,maxWidth:760},style:{textStyle:"body-1",fontRole:"accent",...o("body",22,19),italic:!0,lineHeight:1.5}}]}],drop:{...l,...d,titleLevel:"read by the title part's `when`: 2 (set by lib/document/one-h1 on a later opener) makes the Text an h2, anything else an h1"}}),I={top:80,bottom:40,topPhone:60,bottomPhone:32},X={...o("label",13),letterSpacing:.18,lineHeight:1.8},O={...o("label",13),letterSpacing:.22,lineHeight:1.9},G=()=>({name:"Issue Header",boxProps:e=>({...c,direction:"column",gap:0,sectionBorder:{bottom:1},...h(e,I)}),box:[...g,...m(I)],parts:[{kind:"group",name:"Top",props:{...n,direction:"row",align:"end",justify:"between",gap:60,gapPhone:16,share:"content",sectionPaddingBottom:32},parts:[b("Eyebrow",14,14,i("eyebrow",o("label",14))),{kind:"group",name:"Issue",props:{...n,align:"end",gap:0,gapPhone:0,sectionPaddingBottom:14},parts:[{kind:"list",key:"issueMeta",name:"Issue line",flat:!0,parts:[k("lead","rest",X)]}]}]},{kind:"group",name:"Bottom",props:{...n,direction:"row",align:"start",justify:"between",gap:60,gapPhone:16,share:"content",sectionBorder:_,sectionPaddingTop:32},parts:[{kind:"text",key:"lead",props:{...a,maxWidth:720,...f},style:{textStyle:"body-1",fontRole:"heading3",...o("headingSmall",20),lineHeight:1.5,letterSpacing:-.005,paragraphSpacing:16}},{kind:"group",name:"In this issue",props:{...n,align:"stretch",gap:0},parts:[b("Heading",6,6,{kind:"text",key:"issueHeading",props:{...a,align:"right",...r},style:{textStyle:"body-1",fontRole:"heading",...o("body",18),weight:400,letterSpacing:-.01,lineHeight:1.9,...P}}),{kind:"group",name:"Lines",props:{...n,align:"stretch",gap:0},parts:[{kind:"list",key:"issueList",name:"Line",flat:!0,parts:[S("text",{color:"labels",...O})]}]},S("issueTotal",O)]}]}],drop:{...l,...d}}),B={top:24,bottom:24,topPhone:16,bottomPhone:16},u={color:"labels",...o("label",13),letterSpacing:.2},L=e=>(Array.isArray(e.items)?e.items:[]).filter(t=>t&&typeof t.label=="string"&&t.label.trim()!==""),y=(e,t)=>t!==void 0&&L(e).at(-1)===t,D=(e,t)=>t!==void 0&&L(e).includes(t),K=(e,t)=>D(e,t)&&!y(e,t)&&p(t?.href),j=()=>({name:"Breadcrumb",skip:e=>p(e.meta)?'a trailing note after "·" needs a second mark; none live':void 0,boxProps:e=>({...c,...R,wrap:"wrap",gap:16,gapPhone:16,separator:"slash",sectionBorder:{bottom:1},...h(e,B)}),box:[...g,...m(B)],parts:[{kind:"list",key:"items",name:"Crumb",flat:!0,parts:[{kind:"button",key:"label",href:"href",variant:"ghost",when:K,props:{...C,...W,icon:"none"},style:u},{...i("label",u),when:(e,t)=>D(e,t)&&!y(e,t)&&!p(t?.href)},{...i("label",{...u,color:"text"}),when:y}]}],drop:{...l,...d,meta:"a node that stores a note is skipped (`skip`); an empty one draws nothing"}}),J={DocMasthead:v(),Masthead:G(),Breadcrumb:j()};export{J as PAGE_HEADER_SECTION_TO_BOX};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as T}from"react/jsx-runtime";import{parseBlockWidthFit as K,phoneKey as l,tabletKey as o}from"efficient-easel/draw";import{blockFillInCellClass as P,blockPhoneHideClass as A,blockSizeOf as L,blockSizeValuesOf as G}from"../../content/block-size.js";import{CellWrap as X,useBoxCell as Z}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as $,boxRowColumnsClass as W,boxShareClasses as g,boxShareTabletOf as v,boxTabletColumnsClass as U}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as M}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as V}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as Y}from"../part-styles.js";import{addShowWhenFacts as q,withRowRules as p}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as J}from"./cell-width.js";import{findParentNode as Q}from"../../../../format/lib/document/passes/document-position.js";const tt=new Set(["Text","Heading"]),et=new Set(["h1","h2","h3","h4","h5","h6"]);function O(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&et.has(e.tag)?!0:Y(e,"text").textStyle?.startsWith("heading-")===!0}const a={not:{context:"blockOutsideBox",is:!0}},B={all:[a,{not:{context:"boxSharesWidth",is:!0}}]},k={all:[a,{not:{context:"boxSharesWidthPhone",is:!0}}]},C={all:[a,{not:{context:"boxSharesWidthTablet",is:!0}}]};function H(t,e,i){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},i??{field:t,is:e}]}]}}function I(t,e,i){return{any:[{field:l(t),is:e},{all:[{field:l(t),set:!1},i??{field:t,is:e}]}]}}const y={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},it=[[["_gBlockSize","minWidth",o("minWidth"),l("minWidth"),"maxWidth",o("maxWidth"),l("maxWidth")],a],[["widthFit"],B],[[o("widthFit")],C],[[l("widthFit")],k],[["width"],{all:[B,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[C,H("widthFit","fixed")]}],[[l("width")],{all:[k,I("widthFit","fixed")]}]],N=H("textFit","shrink",y),E=[[["_gText","textFit",o("textFit"),l("textFit")],a],[["minFont"],{all:[a,y]}],[[o("minFont")],{all:[a,N]}],[[l("minFont")],{all:[a,I("textFit","shrink",N)]}]],h=(t,e)=>Q(e.appState,t.props?.id),u=t=>!!t&&typeof t.type=="string"&&V(t.type)!==null,S=t=>(t.type==="Flex"||t.type==="HeroGroup")&&M(t.type,t.props?.direction)==="row",b=t=>{const e=K(t);return e!==void 0&&e!=="fit"},nt={blockOutsideBox:(t,e)=>!u(h(t,e)),boxSharesWidth:(t,e)=>{const i=h(t,e);return!u(i)||!S(i)?!1:W({...i.props,direction:"row"})!==""?!0:g(i.props?.share)!==""&&!b(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=h(t,e);if(!u(i)||!S(i))return!1;if(U(i.props?.[o("columns")])!==""||W({...i.props,direction:"row"})!=="")return!0;const n=v(i.props?.[o("share")])??i.props?.share;return g(n)!==""&&!b(t.props?.[o("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=h(t,e);if(!u(i)||!S(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!$(n,i.props?.[l("share")])&&!b(t.props?.[l("widthFit")]??t.props?.widthFit)}},rt=t=>/^_[gds][A-Z]/.test(t);function st(t,e,i){const n=Object.entries(t),r=n.findIndex(([c])=>c===e);if(r===-1)return null;let s=r+1;for(;s<n.length&&!rt(n[s][0]);)s++;return Object.fromEntries([...n.slice(0,s),...Object.entries(i),...n.slice(s)])}function R(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function ot(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:r,...s}=i;return R(e,n.indexOf("_dSize")+1,s)}return lt.has(t)&&n.includes("_gSpacing")?R(e,n.indexOf("_gSpacing"),i):{...e,...i}}const lt=new Set(["Text","Heading"]);function ct(t,e){const{_gText:i,...n}=e;return st(t,"_gText",n)??{...t,...e}}function at(t){const e=new WeakMap;return i=>{if(!i||!("textFit"in i))return i;let n=e.get(i);if(!n){n={...i};for(const r of["textFit",o("textFit"),l("textFit")])r in n&&(n[r]=t[r]);e.set(i,n)}return n}}const Wt={name:"blockSize",applies:(t,e,i)=>J.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=tt.has(e),{text:r}=i.blockSizeFields(n?{tablet:!0,textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:s}=i.blockSizeFields({tablet:!0});let c=ot(e,t.fields??{},p(s,it));if(n){const f=p(r,E);if(c=ct(c,f),e==="Text"){const z=p(i.blockSizeFields({tablet:!0,textFit:"shrink"}).text,E),D=at(z),w=t.resolveFields,j=(F,d)=>{const x=w?w(F,d):d.fields,m=_=>O(e,F?.props??{})?D(_??d.fields):_;return x instanceof Promise?x.then(m):m(x)};t.resolveFields=j}}t.fields=c,q(t,{...nt,textWrapsByDefault:f=>!O(e,f.props??{})})},draw(t){ht(t)}};function ht(t){const e=t.render;t.render=i=>{const n=G(i),r=L(n),s=e(i);if(r===null)return s;const c=A(i);return T(ut,{size:r,className:c?`${r.className} ${c}`:r.className,inCell:P(n),children:s})}}function ut({size:t,className:e,inCell:i,children:n}){const r=Z()?.phoneCells===!0;return T(X,{className:r&&i?`${e} ${i}`:e,...Object.keys(t.style).length?{style:t.style}:{},attrs:t.attrs,children:n})}export{Wt as blockSize,O as textShrinksByDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";import{CardRowDrawn as f}from"../../../components/CardRowContext.js";import{PublishedPartStyles as h}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{CardRowDrawn as f}from"../../../components/CardRowContext.js";import{PublishedPartStyles as h}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as y}from"../part-styles.js";import{readPartMotions as p}from"../../animation/part-motion.js";import{partNeedles as P}from"../text-parts.js";import{CARD_LIST_TYPE as x}from"../../../../format/lib/content/card-template.js";const S={name:"clickableParts",applies:(o,e,s)=>typeof s?.render=="function"&&o!==x,draw(o,e,s){const r=o,d=()=>r.textParts??r.fields,i=r.render,m=s.inspector?.PartAnchors;r.render=t=>{const c=y(t),l=p(t);return t.editor?.isEditing&&m?n(f,{type:e,props:t,children:a=>n(m,{needles:P(d(),a),styles:c,motions:l,type:e,children:i(t)})}):!Object.keys(c).length&&!Object.keys(l).length?i(t):n(f,{type:e,props:t,children:a=>n(h,{needles:P(d(),a),styles:c,motions:l,type:e,children:i(t)})})}}};export{S as clickableParts};
|
|
@@ -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 V}from"../../../format/lib/theme.js";const P=ee,v=te;function Be(t){if(t.theme)return V(t.theme);const o=t.site?.themePresets;return o?V({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 Y=new Set(["id"]),T={},H=[],fe=[];function Ee(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 Pe(t){return T[t]}function ve(){return Object.keys(T)}function de(t){return t in T&&H.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 X=t=>Z(t),Ie=t=>X(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 D(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([...Y,"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)},F=r._partStyles??{},L=ye(o);let K=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++K}`}}),M=(n,s,b,y,x,d,w)=>{if(x){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 D(n??[],e,b,(c,p,f)=>w(c,f?`nothing — the old value draws nothing (${y}: no ${p})`:`${d}${y}: ${p}`),i)},J=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]:[],x=typeof n.props=="function"?n.props(r,i):n.props??{},d=y.map((f,g)=>{const l=f??{},u=n.item?.(l,g,r)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${g+1}: `);return n.flat?u.props?O.map(E=>({...E,props:{...E.props,...u.props,id:E.props.id}})):O:[$(P,{name:`${n.name} ${g+1}`,...x,...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(g=>g??{}),f.of,f.of).map((g,l)=>{const u=g.items.map(S=>S.item),O=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],E=g.items.map(S=>d[S.index]),z=f.perRow?.(u.length,r),I=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&I<E.length)for(let S=0;S*I<E.length;S++)C.push(E.slice(S*I,(S+1)*I).flat());return $(P,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(P,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:C.length?C.map((S,U)=>$(P,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:S})):E.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 g=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(P,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...g,...Array.from({length:l},(u,O)=>$(P,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const x=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?F[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=X(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...g}=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)}:{}})}x.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?ie(c.text):c.text,...g,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=X(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)??{}};x.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]:"";x.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":{x.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&&x.push($(P,{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&&x.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={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(F).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 g=typeof e.slots=="function"?e.slots(s,i):e.slots??{};for(const[l,u]of Object.entries(g))p[l]=u.flatMap(O=>"kind"in O?W(O,s,d):J([O]));x.push($(c,p));break}}return x},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,s===0?"":`${b}: `),x=typeof n.boxProps=="function"?n.boxProps(r,i):n.boxProps??{},d=D(n.box??[],x,r,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),i);return{type:P,props:{name:n.name,...d,[v]:y,id:ce(a,s)}}},G=[o,...o.also??[]].map(Q);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))Y.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:h,dropped:k,siteWrites:[...o.site?.(t,i)??[]],restyled:B}}function Re(t,o=H,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=H,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,P as SECTION_BOX_TYPE,H 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,Ee as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,Pe 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 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 P=ee,v=te;function Se(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={},H=[],fe=["Breadcrumb","DocBody"];function Ee(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 Pe(t){return T[t]}function ve(){return Object.keys(T)}function de(t){return t in T&&H.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 X=t=>Z(t),Ie=t=>X(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,S,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[S]:a[S]=_,r(k,S,_===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=[],S=[],j=new Set,_=(n,s)=>{h.push({key:n,home:s}),j.add(n)},F=r._partStyles??{},L=ye(o);let K=0;const $=(n,s)=>({type:n,props:{...s,id:`${a}~${n}-${++K}`}}),M=(n,s,b,y,x,d,w)=>{if(x){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)},J=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]:[],x=typeof n.props=="function"?n.props(r,i):n.props??{},d=y.map((f,g)=>{const l=f??{},u=n.item?.(l,g,r)??{},O=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${g+1}: `);return n.flat?u.props?O.map(E=>({...E,props:{...E.props,...u.props,id:E.props.id}})):O:[$(P,{name:`${n.name} ${g+1}`,...x,...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(g=>g??{}),f.of,f.of).map((g,l)=>{const u=g.items.map(B=>B.item),O=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],E=g.items.map(B=>d[B.index]),z=f.perRow?.(u.length,r),I=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&I<E.length)for(let B=0;B*I<E.length;B++)C.push(E.slice(B*I,(B+1)*I).flat());return $(P,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...O,$(P,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:C.length?C.map((B,U)=>$(P,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:B})):E.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 g=d.slice(f*e,(f+1)*e).flat(),l=n.rowFiller?e-d.slice(f*e,(f+1)*e).length:0;p.push($(P,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...c,[v]:[...g,...Array.from({length:l},(u,O)=>$(P,{name:`Empty ${O+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const x=[],d=(e,c)=>b?_(e,c):void 0,w=e=>b?F[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=X(s[e.key]);if(!c.text.trim()){d(e.key,"nothing — empty words draw nothing, so no block");break}const p=pe(e.role??"body"),{_partStyles:f,...g}=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??{};S.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)}:{}})}x.push($("Text",{text:e.mark==="accentLead"?le(c.text):e.mark==="accentItalic"?ie(c.text):c.text,...g,...e.props??{},...l,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${y}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=X(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)??{}};x.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]:"";x.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":{x.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&&x.push($(P,{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&&x.push($(e.type,{...p,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,p={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(F).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 g=typeof e.slots=="function"?e.slots(s,i):e.slots??{};for(const[l,u]of Object.entries(g))p[l]=u.flatMap(O=>"kind"in O?W(O,s,d):J([O]));x.push($(c,p));break}}return x},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,y=N(n.parts,r,!0,s===0?"":`${b}: `),x=typeof n.boxProps=="function"?n.boxProps(r,i):n.boxProps??{},d=Y(n.box??[],x,r,(w,e,c)=>_(w,c?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),i);return{type:P,props:{name:n.name,...d,[v]:y,id:ce(a,s)}}},D=[o,...o.also??[]].map(Q);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:S}}function Re(t,o=H,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 S=q(h,k,i);return S.skipped!==void 0?[h]:(m=!0,S.nodes)});return m?{...t,content:a}:t}function Ae(t,o=H,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,P as SECTION_BOX_TYPE,H as SECTION_TO_BOX_ON,fe as SECTION_TO_BOX_PRESS,_e as boxNativeReason,q as convertSection,Re as convertSectionsInPage,Se as convertTheme,de as convertsToBox,Ie as hasWords,Ne as headParts,je as pressesAsBox,Te as registerBoxNativeSections,Ee as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,Pe as sectionToBoxRow,ve as sectionToBoxTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "55.
|
|
3
|
+
"version": "55.1.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",
|