efficient-web-builder 59.2.0 → 59.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/editor/components/SectionThumbnail.js +1 -1
- package/dist/editor/components/storefront-editor.css +21 -7
- package/dist/editor/lib/animation/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/card-row-fields.d.ts +3 -1
- package/dist/editor/lib/document/card-row-fields.js +1 -1
- package/dist/editor/lib/document/mirror-cards-field.js +1 -1
- package/dist/format/lib/content/block-align.d.ts +3 -1
- package/dist/format/lib/content/block-align.js +1 -1
- package/dist/format/lib/content/box-background.d.ts +7 -0
- package/dist/format/lib/content/box-background.js +1 -1
- package/dist/format/lib/content/box-card-rule.d.ts +7 -0
- package/dist/format/lib/content/box-card-rule.js +1 -0
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-phone-place.d.ts +4 -4
- package/dist/format/lib/content/box-phone-place.js +1 -1
- package/dist/format/lib/content/box-shape.d.ts +1 -1
- package/dist/format/lib/content/box-shape.js +1 -1
- package/dist/format/lib/content/box-side-space.d.ts +2 -1
- package/dist/format/lib/content/box-side-space.js +1 -1
- package/dist/format/lib/content/button-icon.d.ts +3 -1
- package/dist/format/lib/content/button-icon.js +1 -1
- package/dist/format/lib/content/cell-picture-sizes.js +1 -1
- package/dist/format/lib/content/gallery-card-layout.d.ts +6 -1
- package/dist/format/lib/content/gallery-card-layout.js +1 -1
- package/dist/format/lib/content/image-aspect.d.ts +3 -3
- package/dist/format/lib/content/image-aspect.js +1 -1
- package/dist/format/lib/content/mirror-cards.d.ts +3 -0
- package/dist/format/lib/content/mirror-cards.js +1 -1
- package/dist/format/lib/content/part-display.d.ts +2 -1
- package/dist/format/lib/content/part-display.js +1 -1
- package/dist/format/lib/content/site-gutter.d.ts +2 -0
- package/dist/format/lib/content/site-gutter.js +1 -1
- package/dist/format/lib/content/view-hide-class.d.ts +5 -2
- package/dist/format/lib/content/view-hide-class.js +1 -1
- package/dist/format/lib/content/view-lines.d.ts +2 -1
- package/dist/format/lib/content/view-lines.js +1 -1
- package/dist/format/lib/document/row-hand.js +1 -1
- package/dist/format/lib/document/section-catalog.d.ts +2 -1
- package/dist/format/lib/document/section-catalog.js +10 -10
- package/dist/format/lib/document/section-descriptions.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +7 -0
- package/dist/format/lib/editor-words-catalogue.js +3 -3
- package/dist/format/lib/editor-words-kept.js +1 -1
- package/dist/format/lib/fit-words.d.ts +1 -0
- package/dist/format/lib/fit-words.js +9 -8
- package/dist/format/lib/sized-image.js +1 -1
- package/dist/format/lib/source-rules/one-phone-edge.d.ts +13 -0
- package/dist/format/lib/source-rules/one-phone-edge.js +8 -0
- package/dist/format/lib/source-rules/published-mounts.d.ts +12 -0
- package/dist/format/lib/source-rules/published-mounts.js +10 -0
- package/dist/render/components/ButtonBlock.js +1 -1
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/Eyebrow.js +1 -1
- package/dist/render/components/Flex.d.ts +2 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/HeroPictures.js +1 -1
- package/dist/render/components/InBoxContext.d.ts +3 -0
- package/dist/render/components/InBoxContext.js +1 -1
- package/dist/render/components/LogoBlock.js +1 -1
- package/dist/render/components/Logos.js +1 -1
- package/dist/render/components/PublishedPartStylesContext.d.ts +2 -1
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/components/SectionAnimation.d.ts +4 -2
- package/dist/render/components/SectionAnimation.js +1 -1
- package/dist/render/components/Split.js +1 -1
- package/dist/render/components/Text.js +1 -1
- package/dist/render/components/TitleWithButtons.js +1 -1
- package/dist/render/components/ViewHideRoot.d.ts +7 -1
- package/dist/render/components/ViewHideRoot.js +1 -1
- package/dist/render/lib/content/block-size.d.ts +4 -1
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/content/box-cell-bound.js +1 -1
- package/dist/render/lib/content/box-shared-columns.js +1 -1
- package/dist/render/lib/content/box-stack-line.d.ts +1 -0
- package/dist/render/lib/content/box-stack-line.js +1 -1
- package/dist/render/lib/content/view-values.d.ts +2 -0
- package/dist/render/lib/content/view-values.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/Flex/render.js +1 -1
- 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-forms.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-head.js +1 -1
- package/dist/render/lib/document/page-render.js +1 -1
- package/dist/render/lib/document/part-styles.d.ts +3 -1
- package/dist/render/lib/document/part-styles.js +2 -2
- 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/document/passes/hidden-nodes.js +1 -1
- package/dist/render/lib/document/passes/section-animation.js +1 -1
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/dist/render/lib/document/published-passes.d.ts +13 -0
- package/dist/render/lib/document/published-passes.js +1 -0
- package/dist/render/lib/sections/section-to-box.d.ts +4 -0
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{BOX_ANGLE_PROP as g}from"../../../../../../format/lib/content/box-angle.js";import{BOX_SIDE_SPACE_PROP as b}from"../../../../../../format/lib/content/box-side-space.js";import{phoneKey as a,tabletKey as t}from"efficient-easel/draw";import{BOX_SWATCH_PROP as f,boxCardProps as d,boxPaintOf as S}from"../../../../../../format/lib/content/box-background.js";import{BOX_ROW_IMAGE_PROP as u}from"../../../../../../format/lib/content/box-card-rule.js";import{sharedColumnsDrawn as w,sharedRowsDrawn as P}from"../../../../content/box-shared-columns.js";import{CountRowsContext as O,NO_COUNTS as k}from"../../../../../components/CountRowsContext.js";import{RowEmptyGate as y}from"../../../../../components/CardRowContext.js";import{BOX_HIDE_WHEN_ROW_EMPTY as C,CARD_ROW_LINK_PROP as T,namedRowField as r}from"../../../../../../format/lib/content/card-template.js";import _ from"../../../../../components/Flex.js";import{loopDelayOf as R,loopSecondsOf as x,parseLoop as D,parseLoopDirection as B}from"../../../../../../format/lib/animation/index.js";import{COUNTS_SOURCE as j,declaredBlockSource as E,servedRows as H}from"../../../../../../format/lib/content/block-sources.js";import{padValuesOf as I}from"../../../../content/section-padding.js";import{sectionFillsHeight as N}from"../../../../../../format/lib/content/section-min-height.js";import{boxHighlightStyle as v,pictureHoverOf as A}from"../../../../../../format/lib/animation/hover.js";import{slotCountOf as F}from"../../../slot-counts.js";import{FlexMeta as L}from"../../../../../../format/lib/document/blocks/general/Flex/meta.js";const te={...L,render:e=>{const n=!!e.editor?.isEditing,h=l(_,{direction:e.direction,label:e.label,tabShape:e.tabShape,gap:e.gap,gapPhone:e[a("gap")],gapTablet:e[t("gap")],justify:e.justify,justifyTablet:e[t("justify")],justifyPhone:e[a("justify")],align:e.align,alignTablet:e[t("align")],alignPhone:e[a("align")],wrap:e.wrap,wrapTablet:e[t("wrap")],share:e.share,sharePhone:e[a("share")],shareTablet:e[t("share")],wrapPhone:e[a("wrap")],orderPhone:e[a("order")],phoneRow:e.phoneRow,columns:e.columns,columnsTablet:e[t("columns")],separator:e.separator,stackBelow:e.stackBelow,blockSpacing:e.blockSpacing,blockSpacingTablet:e[t("blockSpacing")],blockSpacingPhone:e[a("blockSpacing")],bgImage:e.bgImage,bgImagePhone:e.bgImagePhone,rowImage:r(e,u),pictureHover:A(e),darken:e.darken,darkenStyle:e.darkenStyle,darkenTablet:e[t("darken")],darkenPhone:e[a("darken")],darkenStyleTablet:e[t("darkenStyle")],darkenStylePhone:e[a("darkenStyle")],placement:e.placement,padV2:e.padV2===!0,border:e.sectionBorder,borderTablet:e.sectionBorderTablet,borderPhone:e.sectionBorderPhone,pad:I(e),contained:e.contained,fillHeight:N(e),shadow:e.shadow,shadowTablet:e[t("shadow")],shadowPhone:e[a("shadow")],loop:D(e.loop),scrollDirection:B(e.scrollDirection),loopSeconds:x({loopDuration:e.loopDuration}),loopDelay:R({loopDelay:e.loopDelay}),editing:n,fillColor:e.fillColor,fillColorTablet:e[t("fillColor")],fillColorPhone:e[a("fillColor")],swatch:e[f],line:e.line,upcoming:e.upcoming,link:e.link,rowLink:r(e,T),highlight:v(e,m=>S(m)??""),boxShape:e.boxShape,boxShapePhone:e[a("boxShape")],boxShapeTablet:e[t("boxShape")],angle:e[g],jumpHighlight:e.jumpHighlight,anchor:e.anchor,sharedSides:w(d(e,!1)),sharedRows:P(d(e,!1)),boxId:typeof e.id=="string"?e.id:void 0,slotCount:F(e),mirrorCards:e.mirrorCards,content:e.content,rowTitle:e.rowTitle,startsOpen:e.startsOpen,rowStyle:e.rowStyle,sideSpace:e[b]}),o=E(e),c=o?o===j?H(e):k:null,i=l(O.Provider,{value:c,children:h});return e[C]===void 0?i:l(y,{props:e,editing:n,children:i})}};export{te as FlexRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{phoneKey as k,readHidable as E}from"efficient-easel/draw";import{isNodeList as de,newId as ce}from"efficient-easel/data";import{say as u}from"../../../../../format/lib/editor-words.js";import{cardColumns as pe}from"../../../../../format/lib/content/card-columns.js";import{resolveSectionBackground as me,THEME_SECTION_BG as he}from"../../../../../format/lib/content/section-background.js";import{CardsMeta as be}from"../../../../../format/lib/document/blocks/general/Cards/meta.js";import{KeyFeaturesMeta as ue}from"../../../../../format/lib/document/blocks/general/KeyFeatures/meta.js";import{finiteNumber as I}from"../../../../../format/lib/finite-number.js";import{nonEmptyString as x}from"../../../../../format/lib/non-empty-string.js";import{parseSectionHeadPlacement as ye}from"../../../../../format/lib/sections/section-head-placement.js";import{parseSectionEyebrowLook as ge}from"../../../../../format/lib/sections/section-eyebrow-look.js";import{hasWords as fe}from"../../../sections/section-to-box.js";import{BOX_TYPE as a,CONTAINER_BLOCKS_SLOT as l}from"../../../../../format/lib/document/container-blocks.js";import{labelTextSeed as Se}from"../../../../../format/lib/document/text-seeds.js";import{LABEL_ONLY_CARD_FIELDS as B,rowFieldTextSeed as d}from"../../../../../format/lib/document/blocks/general/Cards/card-seed.js";import{CARDS_CELL as Ce,cardListCardSeed as Pe,cardsGridLook as N,labelOnlyListCardSeed as F}from"../../../../../format/lib/document/blocks/general/Cards/card-list-seed.js";import{BOX_HIDE_WHEN_ROW_EMPTY as we,CARD_LIST_TYPE as _e,CARD_TEMPLATE_SLOT as Oe,cardKeyOf as H,cardListProps as Le,cardRow as W}from"../../../../../format/lib/content/card-template.js";import{bandAccent as ke,bandProps as Ee,onBandPreset as xe,bandWrites as Te,DIM as T,DROP_COMMON as y,DROP_SIDE_PADDING as g,INNER_BOX as r,SAME_KEYS as f,SECTION_BOX as S,fillFrom as m,filledChip as Re,fillNoBoxHolds as Ae,ownFill as De,TEXT as c,smallText as Ie,wrapperPad as C,wrapperPadKeys as P}from"./section-to-box-row-parts.js";import{headTree as M,SIMPLE_HEADING_LOOK as Be,token as p}from"./section-head-looks.js";import{boxPadding as Ne,labelStyle as Fe}from"../../../../../format/lib/document/seed-parts.js";import{SECTION_BG_BUILT_IN as He}from"../../../../../format/lib/document/blocks/general/section-bg-built-in.js";const h=(e,t,o,n)=>({sectionBorder:{top:e,right:t,bottom:o,left:n}}),v=e=>t=>pe(I(t.columns)??I(e.columns)),We="its head sits in a Box of its own above it (own-box): the row draws the head inline",K=e=>ye(e.headPlacement)==="own-box",Me="inline is the head the row draws; an own-box node is skipped (`skip`)",ve={kind:"text",key:"title",role:"heading",props:c,style:{textStyle:"heading-3",...Be}},G={top:120,bottom:120,topPhone:80,bottomPhone:80,topTablet:80,bottomTablet:80},w=e=>{const t=me(typeof e.background=="string"?e.background:void 0,He.Series);return t&&t!=="transparent"?t:void 0},_=e=>w(e)===he,Ke={...r,justify:"between",gap:16,gapPhone:16,sectionHeightMode:"fixed",sectionHeightValue:340,sectionHeightUnit:"px",sectionPaddingTop:36,sectionPaddingRight:28,sectionPaddingBottom:32,sectionPaddingLeft:28,sectionPaddingTopPhone:36,sectionPaddingRightPhone:28,sectionPaddingBottomPhone:32,sectionPaddingLeftPhone:28},X={...r,direction:"row",justify:"between",gap:12,share:"content",phoneRow:2,[k("share")]:"content"},Ge=e=>{const t=w(e)?1:2;return{...r,direction:"row",columns:4,columnsTablet:2,gap:t,gapPhone:t}},R={...Fe(12),letterSpacing:.22,lineHeight:1.5},j=e=>fe(e.viewLabel)&&!E(e.viewLabel).hidden,s=e=>E(e).text?.trim?.()??"",O=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>x(t)!==void 0)),A=e=>e.map(([t,o,n])=>({key:t,label:o,...n?{multiline:!0}:{}})),Xe=A([["num","Number"],["since","Corner note"],["title","Card title"],["body","Card body",!0],["count","Count"],["countLabel","Count word"]]),je=A([["label","Label"],["value","Value"],["body","Card body",!0]]),b=(e,t,o,n,i,{reads:ae=["cards"],keep:ie=[]}={})=>({kind:"group",name:e,props:t,parts:[{kind:"core",as:_e,headless:!0,keep:ie,derive:{reads:ae,props:L=>Le(n(L),o)},slots:(L,le)=>({[Oe]:[i(L,le)]})}]}),Y=e=>Array.isArray(e.cards)?e.cards:[],V={top:76,bottom:76,topPhone:76,bottomPhone:76},U=e=>(Array.isArray(e.items)?e.items:[]).map(t=>O({title:s(t?.label),href:typeof t?.href=="string"?t.href.trim():""})).filter(t=>t.title!==void 0).map((t,o)=>({key:H(W(t),o),...t})),Ye=e=>U(e).some(t=>x(t.href)!==void 0),q=[{key:B.label,label:"Feature label"},{key:B.href,label:"Link",kind:"link"}],z=e=>ge(e.eyebrowLook,"KeyFeatures")==="filled",Ve={name:"Key Features",boxProps:(e,t)=>({...S,direction:"column",gap:44,gapPhone:32,...m("surface")(e,t),...h(1,0,1,0),...C(e,V)}),box:[...f,...P(V)],parts:[{kind:"group",name:"Heading",props:{...r,direction:"row",align:"end",gap:20,wrap:!0,share:"content",phoneRow:2,[k("share")]:"content"},parts:[{...Re("eyebrow"),when:z},{...Ie("eyebrow"),when:e=>!z(e)},ve]},b("Cards",e=>({...r,...N(v(ue.defaultProps)(e))}),q,U,e=>F(Ye(e)),{reads:["items"]})],drop:{...y,...g,columns:'Box "Cards": its Columns and tablet Columns',eyebrowLook:"the Filled look is a Box in the main colour round the eyebrow Text; the plain look is the eyebrow Text"}},J={top:72,bottom:72,topPhone:72,bottomPhone:72},Q=(e,t)=>({...Ce,...m("background")(e,t)}),Z=e=>{const t=v(be.defaultProps)(e);return{...r,...N(t)}},Ue=A([["title","Card title"],["body","Card body",!0]]),$=e=>(Array.isArray(e.items)?e.items:[]).map((t,o)=>({key:typeof t?.key=="string"&&t.key?t.key:H(W(t),o),title:s(t?.title),body:s(t?.body)})),ee=e=>{const t={},o={};for(const[n,i]of Object.entries(e.props??{}))n!=="id"&&(de(i)?o[n]=i.map(ee):t[n]=i);return{type:String(e.type),props:t,...Object.keys(o).length?{slots:o}:{}}},te=(e,t)=>{const o=D(e)?F(qe(e)):Pe(),n=Array.isArray(e.template)?e.template.map(ee):[o],[i]=n;return n.length===1&&i.type===a?{...i,props:{...Q(e,t),...i.props}}:{type:a,props:{...r,...Q(e,t),name:"Card"},slots:{[l]:n}}},D=e=>e.cardStyle==="label-only",oe=e=>$(e).map((t,o)=>{const n=e.items[o]?.href;return O({key:t.key,title:t.title,href:typeof n=="string"?n.trim():""})}),qe=e=>oe(e).some(t=>x(t.href)!==void 0),ne=e=>Array.isArray(e.template)&&e.template.length===0,re=["dataSource","dataSourceOptions","highlightedCard","highlightBadge"];function Pt(){const e=o=>({key:ce("card"),title:u(o),body:u("A short line about this card.")}),t=[e("Card title one"),e("Card title two"),e("Card title three")];return{eyebrow:u("Label"),title:u("Section *heading.*"),items:t}}const ze={name:"Cards",boxProps:(e,t)=>({...S,direction:"column",gap:36,gapPhone:28,...m("surface")(e,t),...C(e,J)}),box:[...f,...P(J)],parts:[{...M("Cards"),when:e=>!K(e)},{...b("Cards",Z,Ue,$,te,{reads:["items"],keep:re}),when:e=>!ne(e)&&!D(e)},{...b("Cards",Z,q,oe,te,{reads:["items"],keep:re}),when:e=>!ne(e)&&D(e)}],drop:{...y,...g,columns:'Box "Cards": its Columns and tablet Columns',cardStyle:"the Card list's template: the Cards card, or under Label only the Label only card (a cell Box, a Mark Box, the label Text)",template:"the Card list's template (the card Box takes the old cell's ground and lines)",headPlacement:"an own-box node lands without its head; inline is the head the row draws",eyebrowLook:"needs the eyebrow's Filled look on a Text block: Plain is the eyebrow start look the row draws; 2 of 62 live nodes store it (the stored-node export, 2026-10-24)"}},Je={name:"Recurring Columns",boxProps:(e,t)=>({...S,direction:"column",gap:60,gapPhone:60,...h(0,0,1,0),..._(e)?Ee(e,t):{},...De(w(e),e,t),...C(e,G)}),box:[...f.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,o)=>_(t)?ke(e,t,o):e],...P(G)],skip:e=>Ae(w(e))??(K(e)?We:void 0),site:(e,t)=>_(e.props)?Te(e,t):[],parts:[M("Series"),b("Cards",Ge,Xe,e=>Y(e).map(t=>O({num:s(t.num),since:s(t.since),title:s(t.title),body:s(t.desc),count:s(t.entries),countLabel:s(t.entriesLabel)})),(e,t)=>({type:a,props:{...Ke,...m("background",(o,n)=>_(o)&&xe(o,n))(e,t),name:"Card"},slots:{[l]:[{type:a,props:{...r,name:"Words",gap:16,gapPhone:16},slots:{[l]:[{type:a,props:{...X,name:"Top"},slots:{[l]:[d("num",c,p("label",13),!0),d("since",c,p("label",13),!0)]}},d("title",{...c,tag:"h3"},{textStyle:"heading-3",...p("headingSmall",28),weight:500,case:"upper",lineHeight:1.04,letterSpacing:-.02}),d("body",T,{textStyle:"body-5",fontRole:"heading",...p("body",14),lineHeight:1.6})]}},{type:a,props:{...X,name:"Footer",align:"center",gap:0,gapPhone:0,sectionPaddingTop:16,sectionPaddingTopPhone:16,...h(1,0,0,0),...j(e)?{}:{[we]:["count","countLabel"]}},slots:{[l]:[{type:a,props:{...r,name:"Count",direction:"row",align:"center",gap:12,gapPhone:12,share:"content",phoneRow:2,[k("share")]:"content"},slots:{[l]:[d("count",c,R),d("countLabel",T,R)]}},...j(e)?[{type:a,props:{...r,name:"View",maxWidthPhone:266},slots:{[l]:[{type:"Text",props:{...c,text:E(e.viewLabel).text,_partStyles:{text:{...Se()._partStyles.text,...R}}}}]}}]:[]]}}]}}))],reads:{viewLabel:"a Text typed once in the card template: the far end of every card's footer",background:"the Box's theme (the band preset) or its Fill"},drop:{...y,...g,headPlacement:Me}},se={top:60,bottom:60,topPhone:40,bottomPhone:40},Qe={...r,direction:"row",columns:3,gap:40,gapPhone:16},Ze={...r,gap:8,gapPhone:8,...Ne(24),...h(1,1,1,1)},$e={name:"Document Detail Cards",boxProps:e=>({...S,direction:"column",gap:40,gapPhone:16,...h(0,0,1,0),...C(e,se)}),box:[...f,...P(se)],parts:[b("Cards",Qe,je,e=>Y(e).map(t=>O({label:s(t.label),value:s(t.value),body:s(t.desc)})),(e,t)=>({type:a,props:{...Ze,...m("surface")(e,t),name:"Card"},slots:{[l]:[d("label",c,{...p("label",12),lineHeight:1.5},!0),{type:a,props:{...r,name:"Words",gap:14,gapPhone:14},slots:{[l]:[d("value",c,{textStyle:"heading-3",...p("headingSmall",20),weight:500,letterSpacing:-.015,lineHeight:1.5}),d("body",T,{textStyle:"body-5",fontRole:"accent",...p("body",14),italic:!0,lineHeight:1.5})]}}]}}))],drop:{...y,...g}},wt={Cards:ze,KeyFeatures:Ve,Series:Je,DocMetaCards:$e};export{wt as CARDS_SECTION_TO_BOX,Pt as cardsPressStarter};
|
|
1
|
+
import{phoneKey as k,readHidable as E}from"efficient-easel/draw";import{isNodeList as le,newId as de}from"efficient-easel/data";import{say as u}from"../../../../../format/lib/editor-words.js";import{cardColumns as ce}from"../../../../../format/lib/content/card-columns.js";import{resolveSectionBackground as pe,THEME_SECTION_BG as me}from"../../../../../format/lib/content/section-background.js";import{CardsMeta as he}from"../../../../../format/lib/document/blocks/general/Cards/meta.js";import{KeyFeaturesMeta as be}from"../../../../../format/lib/document/blocks/general/KeyFeatures/meta.js";import{finiteNumber as I}from"../../../../../format/lib/finite-number.js";import{nonEmptyString as x}from"../../../../../format/lib/non-empty-string.js";import{parseSectionEyebrowLook as ue}from"../../../../../format/lib/sections/section-eyebrow-look.js";import{hasWords as ye,headInOwnBox as ge}from"../../../sections/section-to-box.js";import{BOX_TYPE as a,CONTAINER_BLOCKS_SLOT as l}from"../../../../../format/lib/document/container-blocks.js";import{labelTextSeed as fe}from"../../../../../format/lib/document/text-seeds.js";import{LABEL_ONLY_CARD_FIELDS as B,rowFieldTextSeed as d}from"../../../../../format/lib/document/blocks/general/Cards/card-seed.js";import{CARDS_CELL as Ce,cardListCardSeed as Se,cardsGridLook as N,labelOnlyListCardSeed as F}from"../../../../../format/lib/document/blocks/general/Cards/card-list-seed.js";import{BOX_HIDE_WHEN_ROW_EMPTY as Pe,CARD_LIST_TYPE as we,CARD_TEMPLATE_SLOT as _e,cardKeyOf as H,cardListProps as Oe,cardRow as W}from"../../../../../format/lib/content/card-template.js";import{bandAccent as Le,bandProps as ke,onBandPreset as Ee,bandWrites as xe,DIM as T,DROP_COMMON as y,DROP_SIDE_PADDING as g,INNER_BOX as r,SAME_KEYS as f,SECTION_BOX as C,fillFrom as m,filledChip as Te,fillNoBoxHolds as Re,ownFill as Ae,TEXT as c,smallText as De,wrapperPad as S,wrapperPadKeys as P}from"./section-to-box-row-parts.js";import{headTree as M,SIMPLE_HEADING_LOOK as Ie,token as p}from"./section-head-looks.js";import{boxPadding as Be,labelStyle as Ne}from"../../../../../format/lib/document/seed-parts.js";import{SECTION_BG_BUILT_IN as Fe}from"../../../../../format/lib/document/blocks/general/section-bg-built-in.js";const h=(e,t,o,n)=>({sectionBorder:{top:e,right:t,bottom:o,left:n}}),v=e=>t=>ce(I(t.columns)??I(e.columns)),He="inline is the head the row draws; an own-box node is skipped (`skip`)",We={kind:"text",key:"title",role:"heading",props:c,style:{textStyle:"heading-3",...Ie}},K={top:120,bottom:120,topPhone:80,bottomPhone:80,topTablet:80,bottomTablet:80},w=e=>{const t=pe(typeof e.background=="string"?e.background:void 0,Fe.Series);return t&&t!=="transparent"?t:void 0},_=e=>w(e)===me,Me={...r,justify:"between",gap:16,gapPhone:16,sectionHeightMode:"fixed",sectionHeightValue:340,sectionHeightUnit:"px",sectionPaddingTop:36,sectionPaddingRight:28,sectionPaddingBottom:32,sectionPaddingLeft:28,sectionPaddingTopPhone:36,sectionPaddingRightPhone:28,sectionPaddingBottomPhone:32,sectionPaddingLeftPhone:28},G={...r,direction:"row",justify:"between",gap:12,share:"content",phoneRow:2,[k("share")]:"content"},ve=e=>{const t=w(e)?1:2;return{...r,direction:"row",columns:4,columnsTablet:2,gap:t,gapPhone:t}},R={...Ne(12),letterSpacing:.22,lineHeight:1.5},j=e=>ye(e.viewLabel)&&!E(e.viewLabel).hidden,s=e=>E(e).text?.trim?.()??"",O=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>x(t)!==void 0)),A=e=>e.map(([t,o,n])=>({key:t,label:o,...n?{multiline:!0}:{}})),Ke=A([["num","Number"],["since","Corner note"],["title","Card title"],["body","Card body",!0],["count","Count"],["countLabel","Count word"]]),Ge=A([["label","Label"],["value","Value"],["body","Card body",!0]]),b=(e,t,o,n,i,{reads:se=["cards"],keep:ae=[]}={})=>({kind:"group",name:e,props:t,parts:[{kind:"core",as:we,headless:!0,keep:ae,derive:{reads:se,props:L=>Oe(n(L),o)},slots:(L,ie)=>({[_e]:[i(L,ie)]})}]}),X=e=>Array.isArray(e.cards)?e.cards:[],Y={top:76,bottom:76,topPhone:76,bottomPhone:76},V=e=>(Array.isArray(e.items)?e.items:[]).map(t=>O({title:s(t?.label),href:typeof t?.href=="string"?t.href.trim():""})).filter(t=>t.title!==void 0).map((t,o)=>({key:H(W(t),o),...t})),je=e=>V(e).some(t=>x(t.href)!==void 0),U=[{key:B.label,label:"Feature label"},{key:B.href,label:"Link",kind:"link"}],q=e=>ue(e.eyebrowLook,"KeyFeatures")==="filled",Xe={name:"Key Features",boxProps:(e,t)=>({...C,direction:"column",gap:44,gapPhone:32,...m("surface")(e,t),...h(1,0,1,0),...S(e,Y)}),box:[...f,...P(Y)],parts:[{kind:"group",name:"Heading",props:{...r,direction:"row",align:"end",gap:20,wrap:!0,share:"content",phoneRow:2,[k("share")]:"content"},parts:[{...Te("eyebrow"),when:q},{...De("eyebrow"),when:e=>!q(e)},We]},b("Cards",e=>({...r,...N(v(be.defaultProps)(e))}),U,V,e=>F(je(e)),{reads:["items"]})],drop:{...y,...g,columns:'Box "Cards": its Columns and tablet Columns',eyebrowLook:"the Filled look is a Box in the main colour round the eyebrow Text; the plain look is the eyebrow Text"}},z={top:72,bottom:72,topPhone:72,bottomPhone:72},J=(e,t)=>({...Ce,...m("background")(e,t)}),Q=e=>{const t=v(he.defaultProps)(e);return{...r,...N(t)}},Ye=A([["title","Card title"],["body","Card body",!0]]),Z=e=>(Array.isArray(e.items)?e.items:[]).map((t,o)=>({key:typeof t?.key=="string"&&t.key?t.key:H(W(t),o),title:s(t?.title),body:s(t?.body)})),$=e=>{const t={},o={};for(const[n,i]of Object.entries(e.props??{}))n!=="id"&&(le(i)?o[n]=i.map($):t[n]=i);return{type:String(e.type),props:t,...Object.keys(o).length?{slots:o}:{}}},ee=(e,t)=>{const o=D(e)?F(Ve(e)):Se(),n=Array.isArray(e.template)?e.template.map($):[o],[i]=n;return n.length===1&&i.type===a?{...i,props:{...J(e,t),...i.props}}:{type:a,props:{...r,...J(e,t),name:"Card"},slots:{[l]:n}}},D=e=>e.cardStyle==="label-only",te=e=>Z(e).map((t,o)=>{const n=e.items[o]?.href;return O({key:t.key,title:t.title,href:typeof n=="string"?n.trim():""})}),Ve=e=>te(e).some(t=>x(t.href)!==void 0),oe=e=>Array.isArray(e.template)&&e.template.length===0,ne=["dataSource","dataSourceOptions","highlightedCard","highlightBadge"];function ft(){const e=o=>({key:de("card"),title:u(o),body:u("A short line about this card.")}),t=[e("Card title one"),e("Card title two"),e("Card title three")];return{eyebrow:u("Label"),title:u("Section *heading.*"),items:t}}const Ue={name:"Cards",ownBoxConverts:!0,boxProps:(e,t)=>({...C,direction:"column",gap:36,gapPhone:28,...m("surface")(e,t),...S(e,z)}),box:[...f,...P(z)],parts:[{...M("Cards"),when:e=>!ge(e)},{...b("Cards",Q,Ye,Z,ee,{reads:["items"],keep:ne}),when:e=>!oe(e)&&!D(e)},{...b("Cards",Q,U,te,ee,{reads:["items"],keep:ne}),when:e=>!oe(e)&&D(e)}],drop:{...y,...g,columns:'Box "Cards": its Columns and tablet Columns',cardStyle:"the Card list's template: the Cards card, or under Label only the Label only card (a cell Box, a Mark Box, the label Text)",template:"the Card list's template (the card Box takes the old cell's ground and lines)",headPlacement:"an own-box node lands without its head; inline is the head the row draws",eyebrowLook:"needs the eyebrow's Filled look on a Text block: Plain is the eyebrow start look the row draws; 2 of 62 live nodes store it (the stored-node export, 2026-10-24)"}},qe={name:"Recurring Columns",boxProps:(e,t)=>({...C,direction:"column",gap:60,gapPhone:60,...h(0,0,1,0),..._(e)?ke(e,t):{},...Ae(w(e),e,t),...S(e,K)}),box:[...f.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,o)=>_(t)?Le(e,t,o):e],...P(K)],skip:e=>Re(w(e)),site:(e,t)=>_(e.props)?xe(e,t):[],parts:[M("Series"),b("Cards",ve,Ke,e=>X(e).map(t=>O({num:s(t.num),since:s(t.since),title:s(t.title),body:s(t.desc),count:s(t.entries),countLabel:s(t.entriesLabel)})),(e,t)=>({type:a,props:{...Me,...m("background",(o,n)=>_(o)&&Ee(o,n))(e,t),name:"Card"},slots:{[l]:[{type:a,props:{...r,name:"Words",gap:16,gapPhone:16},slots:{[l]:[{type:a,props:{...G,name:"Top"},slots:{[l]:[d("num",c,p("label",13),!0),d("since",c,p("label",13),!0)]}},d("title",{...c,tag:"h3"},{textStyle:"heading-3",...p("headingSmall",28),weight:500,case:"upper",lineHeight:1.04,letterSpacing:-.02}),d("body",T,{textStyle:"body-5",fontRole:"heading",...p("body",14),lineHeight:1.6})]}},{type:a,props:{...G,name:"Footer",align:"center",gap:0,gapPhone:0,sectionPaddingTop:16,sectionPaddingTopPhone:16,...h(1,0,0,0),...j(e)?{}:{[Pe]:["count","countLabel"]}},slots:{[l]:[{type:a,props:{...r,name:"Count",direction:"row",align:"center",gap:12,gapPhone:12,share:"content",phoneRow:2,[k("share")]:"content"},slots:{[l]:[d("count",c,R),d("countLabel",T,R)]}},...j(e)?[{type:a,props:{...r,name:"View",maxWidthPhone:266},slots:{[l]:[{type:"Text",props:{...c,text:E(e.viewLabel).text,_partStyles:{text:{...fe()._partStyles.text,...R}}}}]}}]:[]]}}]}}))],reads:{viewLabel:"a Text typed once in the card template: the far end of every card's footer",background:"the Box's theme (the band preset) or its Fill"},drop:{...y,...g,headPlacement:He}},re={top:60,bottom:60,topPhone:40,bottomPhone:40},ze={...r,direction:"row",columns:3,gap:40,gapPhone:16},Je={...r,gap:8,gapPhone:8,...Be(24),...h(1,1,1,1)},Qe={name:"Document Detail Cards",boxProps:e=>({...C,direction:"column",gap:40,gapPhone:16,...h(0,0,1,0),...S(e,re)}),box:[...f,...P(re)],parts:[b("Cards",ze,Ge,e=>X(e).map(t=>O({label:s(t.label),value:s(t.value),body:s(t.desc)})),(e,t)=>({type:a,props:{...Je,...m("surface")(e,t),name:"Card"},slots:{[l]:[d("label",c,{...p("label",12),lineHeight:1.5},!0),{type:a,props:{...r,name:"Words",gap:14,gapPhone:14},slots:{[l]:[d("value",c,{textStyle:"heading-3",...p("headingSmall",20),weight:500,letterSpacing:-.015,lineHeight:1.5}),d("body",T,{textStyle:"body-5",fontRole:"accent",...p("body",14),italic:!0,lineHeight:1.5})]}}]}}))],drop:{...y,...g}},Ct={Cards:Ue,KeyFeatures:Xe,Series:qe,DocMetaCards:Qe};export{Ct as CARDS_SECTION_TO_BOX,ft as cardsPressStarter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DIM as m,DROP_COMMON as t,DROP_SIDE_PADDING as e,SAME_KEYS as r,SECTION_BOX as n,TEXT as b,smallText as h,wrapperPad as s,wrapperPadKeys as i}from"./section-to-box-row-parts.js";const a={headPlacement:void 0},p={top:0,bottom:0,topPhone:0,bottomPhone:0},
|
|
1
|
+
import{DIM as m,DROP_COMMON as t,DROP_SIDE_PADDING as e,SAME_KEYS as r,SECTION_BOX as n,TEXT as b,smallText as h,wrapperPad as s,wrapperPadKeys as i}from"./section-to-box-row-parts.js";const a={headPlacement:void 0},p={top:0,bottom:0,topPhone:0,bottomPhone:0},u=()=>({name:"Form",ownBoxConverts:!0,boxProps:o=>({...n,direction:"column",...s(o,p)}),box:[...r,...i(p)],parts:[{kind:"core",keep:"rest",props:a}],drop:{...t,...e}}),d={top:120,bottom:120,topPhone:60,bottomPhone:60},l=()=>({name:"Photo Submission Form",boxProps:o=>({...n,direction:"column",gap:24,...s(o,d)}),box:[...r,...i(d)],parts:[h("eyebrow"),{kind:"text",key:"title",role:"heading",props:b,style:{textStyle:"heading-2"},mark:"accentItalic"},{kind:"text",key:"body",role:"body",props:m},{kind:"core",as:"Form",keep:["formSlug"],rename:{buttonText:"submitText",consent:"finePrint"},props:a}],skip:o=>o.layout==="boxes"?`its words are in its two SubmitBox regions (layout "boxes"); this row reads only the section's own words`:void 0,drop:{...t,...e,layout:'the marker of the two-region drawing; a node that has it is skipped (above), so here it is never "boxes"',boxes:'the SubmitBox regions, drawn only under layout "boxes", which this row skips (above); without that marker they draw nothing'}}),x={Form:u(),SubmitBuild:l()};export{x as FORMS_SECTION_TO_BOX};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SPLITTABLE_SECTIONS as
|
|
1
|
+
import{SPLITTABLE_SECTIONS as h}from"../../../../../format/lib/sections/section-head-placement.js";import{SECTION_LABELS as f}from"../../../../../format/lib/document/section-catalog.js";import{SAME_KEYS as O,SECTION_BOX as T,innerPad as u}from"./section-to-box-row-parts.js";import{HEAD_BELOW as b,headLookOf as B,headReads as A,headTree as g}from"./section-head-looks.js";import{finiteNumber as w}from"../../../../../format/lib/finite-number.js";import{CARD_TEMPLATE_SLOT as m}from"../../../../../format/lib/content/card-template.js";import{footprintCardSeed as R}from"../../../../../format/lib/document/blocks/general/Footprint/card-seed.js";import{faqCardSeed as k,faqRunStyleKeys as C}from"../../../../../format/lib/document/blocks/general/FAQ/card-seed.js";import{BOX_SIDE_SPACE_PROP as H,BOX_SIDE_SPACE_SITE as L}from"../../../../../format/lib/content/box-side-space.js";import{INNER_BOX as N}from"../../../../../format/lib/document/seed-parts.js";import{SECTION_ACCENT_INHERIT as I}from"../../../../../format/lib/content/section-surface.js";const D=["Collections","FAQ","Footprint","GalleryB","LongRead","ProcessSteps","RelatedProducts"],J=["Events","FitmentTable","ProductGrid","SpecTable"],n=(e,o)=>()=>({top:e,topPhone:o}),l=e=>o=>{const t=u(o,e).sectionPaddingTop;return{top:t,topPhone:t}},F={Collections:n(120,70),Events:n(120,70),FAQ:n(120,70),GalleryB:n(120,70),FitmentTable:n(120,80),SpecTable:n(120,80),LongRead:n(120,80),RelatedProducts:n(0,0),Footprint:l("Footprint"),ProcessSteps:l("ProcessSteps"),ProductGrid:e=>({top:w(e.padTop)??120,topPhone:0})};function y(e,o={}){const t=h[e],s=F[e];if(!t||!s)throw new Error(`section-to-box-rows-head: "${e}" has no head row or no head room`);const p=t.padKey,E=g(e),c=A(e),P=t.headRows.filter(r=>![t.num,t.title,t.description,"linkText","linkHref"].includes(r)),d={...Object.fromEntries(P.filter(r=>!(r in c)).map(r=>[r,"a head setting no Header Box part reads (lib/document/blocks/general/section-head-looks `headReads`)"])),...o.drop};return{name:f[e]??e,boxProps:(r,i)=>{const a=s(r),_=o.roomBelow?{sectionPaddingBottom:o.roomBelow.bottom,sectionPaddingBottomPhone:o.roomBelow.bottomPhone}:{},S=typeof o.boxProps=="function"?o.boxProps(r,i):o.boxProps??{};return{...T,direction:"column",gap:b[B(e)],sectionPaddingTop:a.top,sectionPaddingTopPhone:a.topPhone,..._,...S}},box:[...O,...p?[[p,"sectionPaddingTop",(r,i)=>s(i).top]]:[]],parts:[E,...(()=>{const r={...p?{[p]:0}:{},...o.coreProps},i={kind:"core",keep:"rest",...Object.keys(r).length?{props:r}:{},...o.slots?{slots:o.slots}:{}};return[o.coreBox?{kind:"group",name:o.coreBox.name,props:o.coreBox.props,parts:[i]}:i]})(),...o.partsAfter??[]],...Object.keys(c).length?{reads:c}:{},...Object.keys(d).length?{drop:d}:{},...o.pressHeading?{pressKeepsEmpty:[t.title]}:{},...o.skip?{skip:o.skip}:{}}}const j={...N,direction:"accordion",rowStyle:"numbered"},X={Footprint:{slots:{[m]:[R()]},pressHeading:!0},FAQ:{slots:{[m]:[k()]},pressHeading:!0,coreBox:{name:"Questions",props:j},coreProps:{sectionAccent:I},roomBelow:{bottom:120,bottomPhone:70},boxProps:(e,o)=>o.press?{}:{[H]:L},skip:e=>{const o=e._partStyles??{},t=C().filter(s=>o[s]!==void 0);return t.length?`held: its rows carry their own run style (_partStyles ${t.map(s=>`"${s}"`).join(", ")}), which the Box path does not draw the same`:void 0}}},U=Object.fromEntries(D.map(e=>[e,y(e,X[e])]));export{j as FAQ_ROWS_BOX,X as HEAD_ONLY_CARD_SEEDS,U as HEAD_ONLY_SECTION_TO_BOX,D as HEAD_ONLY_TYPES,J as HOST_ROW_HEAD_TYPES,y as headOnlyRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{Render as c}from"efficient-easel/render";import{BelowFirstScreen as d,LATER_SLIDES_KEY as l,firstScreenLead as f,laterSlideIdsOf as m,useLeadDrawsFirst as p}from"../first-screen.js";import{publishedPageData as u}from"./published-passes.js";import{withSlotCounts as S}from"./slot-counts.js";function g({config:o,data:s,metadata:t}){const e=u(s,t),i=p(o,f(e.content)),r=m(e.content),a=r.length>0?{...t,[l]:r}:t;return n(d,{children:n(c,{config:i,metadata:S(a,e.content),data:e})})}export{g as default};
|
|
@@ -200,6 +200,8 @@ export type PublishedPartSheet = {
|
|
|
200
200
|
export declare function publishedPartStyles(needles: readonly PartNeedle[], styles: PartStyles, scope: string, styleKeyOf?: (partKey: string) => string, drawsStyle?: (partKey: string) => boolean, motionOf?: (styleKey: string) => PublishedPartMotion | null, motionKeys?: readonly string[]): PublishedPartSheet | null;
|
|
201
201
|
export declare function isPartKindKey(key: string): boolean;
|
|
202
202
|
export declare function partRuleForKind(sheet: PublishedPartSheet | null, kind: string): PublishedPartRule | null;
|
|
203
|
-
export declare function partStyleCss(sheet: PublishedPartSheet
|
|
203
|
+
export declare function partStyleCss(sheet: PublishedPartSheet, { inBox }?: {
|
|
204
|
+
inBox?: boolean;
|
|
205
|
+
}): string;
|
|
204
206
|
export declare function paragraphRules(scope: string, paragraph: string): string[];
|
|
205
207
|
export declare function partRuleForText(sheet: PublishedPartSheet | null, value: string): PublishedPartRule | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as tt,textStyleCaseOfCss as et}from"efficient-easel/draw";import{FONT_OPTIONS as nt,fontOption as ot,fontRoleOf as A,SIZE_STEP_OF_ROLE as w}from"../../../format/lib/fonts.js";import{encodePartKey as v}from"../../../format/lib/document/part-key.js";import{decodePartId as C,normalizePartText as O}from"./text-parts.js";import{partInkCss as rt}from"../../../format/lib/document/part-inks.js";import{regionStyle as it}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as at,TABLET_MEDIA as st,viewOverrides as ft}from"../content/view-values.js";import{plainRecord as N,propsWithPartRecord as lt,readPartRecord as ct,readPartRecords as ut}from"../../../format/lib/document/part-records.js";const k="_partStyles",pt="data-sf-part-styled",W="data-sf-text-style",dt=/^(heading|body)-[1-7]$/;function h(t){return typeof t=="string"&&dt.test(t)}const G={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function xt(t){if(!t)return null;for(const[e,n]of Object.entries(G))if(n===t)return e;return null}function Pe(t){if(h(t.textStyle))return t.textStyle;const e=A(t.role);return e?G[e]:void 0}const gt=[400,500,600,700],R=["left","center","right","justify"],y=5,F=1e3,ht=-5,St=10,mt=0,bt=64,Pt=2,B={size:{min:y,max:F,step:1},sizeTablet:{min:y,max:F,step:1},sizePhone:{min:y,max:F,step:1},padding:{min:mt,max:bt,step:Pt}},Tt=.05,Rt=.01,zt=["line","letter"],At=.5,_t=2.5,Et=-1,$t=1,wt=0,Ot=400,Nt=[...new Set(Object.values(w))];function Te(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Re(t){return ut(t,k)}function K(t,e){return ct(t,k,e)}function ze(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function X(t,e,n){return lt(t,k,e,kt(n).length?n:null)}function kt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return zt.includes(t)}const z=(t,e,n)=>Math.min(n,Math.max(e,t));function Ft(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:z(n,ht,St)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?b(z(n,At,_t),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?b(z(n,Et,$t),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:z(n,wt,Ot)}if(Object.hasOwn(B,t)){const{min:n,max:o}=B[t],r=Math.round(Number(e));return Number.isFinite(r)?z(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?A(e)?e:null:t==="sizeToken"?I(e)?e:null:t==="textStyle"?h(e)?e:null:t==="alignPhone"||t==="alignTablet"?R.includes(e)?e:null:e}const It=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function m(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of It){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!R.includes(t.align)&&n("align"),t.alignTablet!==void 0&&!R.includes(t.alignTablet)&&n("alignTablet"),t.alignPhone!==void 0&&!R.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!h(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!I(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!A(t.fontRole)&&n("fontRole"),e??t}function I(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,f=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&Nt.includes(l);return a(e)&&f(n)&&(o===void 0||a(o))&&(r===void 0||f(r))&&(i===void 0||Mt(i,n))}function Mt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function M(t){return t?.pxPhone&&I(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function U({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const Lt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function jt(t){const e=[];for(const[n,o]of Lt)n===t?e.push(o):o===t&&e.push(n);return e}function Ae(t,e,n,o){const r={...K(t,e)},i=o==null?null:Ft(n,o);if(i===null)delete r[n];else{r[n]=i;for(const f of jt(n))delete r[f]}return X(t,e,r)}function _e(t,e){return X(t,e,{})}function Ht(t){return et(t)??"none"}function Dt(t){return tt(t)??""}const V={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function vt(t,e){const n=A(t.role);return n||(e?.blockDrawsStyle?null:xt(t.textStyle))}function Ee(t,e){return t==="Text"&&e==="text"}const Ct={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function Wt(t){const e=w[t],n=Ct[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Gt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=b(Bt+t.line*Tt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=b(t.letter*Rt,4)),e}const Bt=1,S="--sf-part-para";function Kt(t){t=m(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const o=M(t.sizeToken);if(o)e.fontSize=U(o);else{const r=E(t);r!==void 0&&(e.fontSize=`${r}px`)}}const n=t.alignPhone??_(t);return n&&(e.textAlign=n),e}function _(t){return t.alignTablet&&t.alignTablet!==t.align?t.alignTablet:void 0}function E(t){const e=ft("textSize",t.size,t.sizeTablet,void 0).tablet;return e&&e>0?e:void 0}function Xt(t){const e=m(t),n={},o=E(e);o!==void 0&&(n.fontSize=`${o}px`);const r=_(e);return r&&(n.textAlign=r),n}function $e(t,e){if(e==="desktop")return;const n=m(t);return(e==="mobile"?_(n):void 0)??n.align}function Ut(t,e){if(e==="desktop")return t;const n=m(t),o=E(n),r=_(n);if(e==="tablet"){let a=t;return o!==void 0&&(a={...a,size:o}),r&&(a={...a,align:r}),a}let i=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)i={...i,size:n.sizePhone};else{const a=M(n.sizeToken);a?i={...i,size:void 0,sizeToken:a}:o!==void 0&&(i={...i,size:o})}const f=n.alignPhone??r;return f&&(i={...i,align:f}),i}function L(t,e,n){return j(Ut(t,e),$,n)}function Vt(t){return t==="mobile"?"sizePhone":t==="tablet"?"sizeTablet":"size"}function we(t,e){if(e==="desktop")return null;const n=m(t);if(e==="mobile"){if(M(n.sizeToken))return null;const o=E(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function Y(t,e){const n=Vt(e);if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function Oe(t,e,n){const o=L(Y(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function j(t,e,n){t=m(t);const o=vt(t,n),r=Gt(t),i=t.size?`${t.size}px`:t.sizeToken?U(t.sizeToken):o?Wt(o):"";return{fontFamily:t.font?Jt(t.font):t.fontRole?`var(${V[t.fontRole]})`:o?`var(${V[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[S]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Dt(t.case),textAlign:t.align??"",paddingTop:Z(t.padding),paddingBottom:Z(t.padding),color:Yt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Yt=t=>rt(t),Z=t=>t===void 0?"":`${t}px`,b=(t,e)=>Number(t.toFixed(e));function Ne(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Zt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?b(o/n,3):1.2,letterEm:Number.isFinite(r)?b(r/n,4):0,align:qt(t.textAlign),case:Ht(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Zt(t){return Number.isFinite(t)?gt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function qt(t){for(const e of R)if(e===t)return e;return t==="end"?"right":"left"}function ke(t,e){const n=q(t);if(!n)return"";for(const o of nt)if(q(e(o.cssVar))===n)return o.key;return""}const q=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Jt(t){const e=ot(t);return e?`var(${e.cssVar})`:""}function ye(t,e,n,o){return!e||C(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Qt(t,e){return Object.hasOwn(t,e)?N(t[e])??{}:{}}function Fe(t,e,n=()=>$,o=a=>a,r=ne,i="desktop",f=()=>!1){let a=0;for(const{element:l,partId:p}of t){const x=C(p)?.propKey;if(!x)continue;const s=Qt(e,o(x)),u=L(s,i,{blockDrawsStyle:f(x)});h(s.textStyle)?l.setAttribute?.(W,s.textStyle):l.removeAttribute?.(W);const d=D.some(g=>l.style[g]);let c=!1;for(const[g,T]of Object.entries(u))ie(l,g,T),T&&(c=!0);if(d||D.some(g=>u[g]))for(const g of te(l,r))for(const T of D)g.style[T]=u[T]??"";c&&(a+=1)}return a}function te(t,e){const n=O(t.textContent??""),o=[];let r=t;for(let i=0;i<ee&&e(r);i+=1){const f=r.parentElement;if(!f||O(f.textContent??"")!==n)break;o.push(f),r=f}return o}const ee=8;function ne(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const $={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function oe(t){if(!t||typeof t!="object")return null;const e={};return h(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizeTablet=="number"&&t.sizeTablet>0&&(e.sizeTablet=t.sizeTablet),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function re(t,e){const n=oe(t);if(!n)return{};const o=L(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Ie(t){return h(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function Me(t,e,n){if(!t||typeof t!="object")return{};const o=it(t.role,e,w)??{},r=e.sized?re(Y(t,n),n):{};return{...o,...r}}function Le(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function ie(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const r=t;e===S&&(n?r.setAttribute?.(J,""):r.removeAttribute?.(J))}const J="data-sf-part-para",ae=Object.keys(j({},$)),H=new Set(["color","overflowWrap",S,"fontStyle"]),D=ae.filter(t=>!H.has(t));function je(t,e,n,o=a=>a,r=()=>!1,i=()=>null,f=[]){const a=new Map;for(const s of t){const u=v(s.key,s.row);for(const d of s.texts){const c=a.get(d);c?(c.keys.add(s.key),c.partKeys.add(u)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([u])})}}const l=new Map;for(const s of new Set([...Object.keys(e),...f])){if(!se(s))continue;const u=Q(n,s,N(e[s])??{},!1,i(s));u&&l.set(s,u)}const p=s=>{const u=o(s),d=i(u);if(!Object.hasOwn(e,u)&&!d)return null;const c=N(e[u])??{};return Q(n,s,c,r(s),d)},x=new Map;for(const[s,{keys:u,partKeys:d}]of a){const c=d.size===1?[...d][0]:u.size===1?[...u][0]:null;if(!c)continue;const P=p(c);P&&x.set(s,P)}for(const s of t){if(!s.keyed)continue;const u=p(v(s.key,s.row));u&&l.set(s.key,u)}return x.size||l.size?{rules:x,kindRules:l,drawn:new Set(a.keys())}:null}function Q(t,e,n,o,r){const i=j(n,$,{blockDrawsStyle:o}),f=Xt(n),a=Kt(n),l=h(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(f).length&&!Object.keys(a).length&&!l&&!r?null:{stamp:fe(t,e),declarations:i,...Object.keys(f).length?{tablet:f}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...r?{motion:r}:{}}}function se(t){return t.startsWith("@")}function He(t,e){return t?.kindRules.get(e)??null}function fe(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function De(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:f}=r;if(n.has(i))return;n.add(i);const a=Object.entries(f).filter(([,c])=>c!==""),l=c=>c.map(([P,g])=>`${ce(P)}: ${g}`).join("; "),p=`[${pt}="${i}"]`,x=a.filter(([c])=>!H.has(c)),s=a.filter(([c])=>H.has(c));x.length&&e.push(`${p}, *:has(> ${p}) { ${l(x)} }`),s.length&&e.push(`${p} { ${l(s)} }`),f[S]&&(e.push(`*:has(> ${p}) { ${S}: ${f[S]} }`),e.push(...le(p,`*:has(> ${p})`)));const u=Object.entries(r.tablet??{}).filter(([,c])=>c!=="");u.length&&e.push(`@media ${st} { ${p}, *:has(> ${p}) { ${l(u)} } }`);const d=Object.entries(r.phone??{}).filter(([,c])=>c!=="");d.length&&e.push(`@media ${at} { ${p}, *:has(> ${p}) { ${l(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as nt,textStyleCaseOfCss as ot}from"efficient-easel/draw";import{FONT_OPTIONS as it,fontOption as rt,fontRoleOf as _,SIZE_STEP_OF_ROLE as w}from"../../../format/lib/fonts.js";import{encodePartKey as v}from"../../../format/lib/document/part-key.js";import{decodePartId as C,normalizePartText as O}from"./text-parts.js";import{partInkCss as at}from"../../../format/lib/document/part-inks.js";import{regionStyle as st}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as ft,EDGE_TABLET_MEDIA as lt,PHONE_MEDIA as ct,TABLET_MEDIA as ut,viewOverrides as pt}from"../content/view-values.js";import{plainRecord as N,propsWithPartRecord as dt,readPartRecord as xt,readPartRecords as gt}from"../../../format/lib/document/part-records.js";const k="_partStyles",ht="data-sf-part-styled",W="data-sf-text-style",St=/^(heading|body)-[1-7]$/;function S(t){return typeof t=="string"&&St.test(t)}const G={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function mt(t){if(!t)return null;for(const[e,n]of Object.entries(G))if(n===t)return e;return null}function _e(t){if(S(t.textStyle))return t.textStyle;const e=_(t.role);return e?G[e]:void 0}const bt=[400,500,600,700],A=["left","center","right","justify"],I=5,y=1e3,Tt=-5,Pt=10,At=0,Rt=64,_t=2,B={size:{min:I,max:y,step:1},sizeTablet:{min:I,max:y,step:1},sizePhone:{min:I,max:y,step:1},padding:{min:At,max:Rt,step:_t}},zt=.05,Et=.01,$t=["line","letter"],wt=.5,Ot=2.5,Nt=-1,kt=1,It=0,yt=400,Ft=[...new Set(Object.values(w))];function ze(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Ee(t){return gt(t,k)}function K(t,e){return xt(t,k,e)}function $e(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function X(t,e,n){return dt(t,k,e,Mt(n).length?n:null)}function Mt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Lt(t){return $t.includes(t)}const R=(t,e,n)=>Math.min(n,Math.max(e,t));function Dt(t,e){if(Lt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:R(n,Tt,Pt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(R(n,wt,Ot),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(R(n,Nt,kt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:R(n,It,yt)}if(Object.hasOwn(B,t)){const{min:n,max:o}=B[t],i=Math.round(Number(e));return Number.isFinite(i)?R(i,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?_(e)?e:null:t==="sizeToken"?F(e)?e:null:t==="textStyle"?S(e)?e:null:t==="alignPhone"||t==="alignTablet"?A.includes(e)?e:null:e}const Ht=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function T(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Ht){const i=t[o];i!==void 0&&!(typeof i=="number"&&Number.isFinite(i))&&n(o)}return t.align!==void 0&&!A.includes(t.align)&&n("align"),t.alignTablet!==void 0&&!A.includes(t.alignTablet)&&n("alignTablet"),t.alignPhone!==void 0&&!A.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!S(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!F(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!_(t.fontRole)&&n("fontRole"),e??t}function F(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:i,fluid:r}=t,l=c=>typeof c=="number"&&Number.isFinite(c)&&c>0,a=c=>typeof c=="string"&&Ft.includes(c);return a(e)&&l(n)&&(o===void 0||a(o))&&(i===void 0||l(i))&&(r===void 0||jt(r,n))}function jt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...i}=t;return Object.keys(i).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function M(t){return t?.pxPhone&&F(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function U({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,i=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${i}, var(--sf-heading-max,9999px))`:i}const vt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ct(t){const e=[];for(const[n,o]of vt)n===t?e.push(o):o===t&&e.push(n);return e}function we(t,e,n,o){const i={...K(t,e)},r=o==null?null:Dt(n,o);if(r===null)delete i[n];else{i[n]=r;for(const l of Ct(n))delete i[l]}return X(t,e,i)}function Oe(t,e){return X(t,e,{})}function Wt(t){return ot(t)??"none"}function Gt(t){return nt(t)??""}const V={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Bt(t,e){const n=_(t.role);return n||(e?.blockDrawsStyle?null:mt(t.textStyle))}function Ne(t,e){return t==="Text"&&e==="text"}const Kt={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function Xt(t){const e=w[t],n=Kt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ut(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Vt+t.line*zt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Et,4)),e}const Vt=1,m="--sf-part-para";function Yt(t){t=T(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const o=M(t.sizeToken);if(o)e.fontSize=U(o);else{const i=E(t);i!==void 0&&(e.fontSize=`${i}px`)}}const n=t.alignPhone??z(t);return n&&(e.textAlign=n),e}function z(t){return t.alignTablet&&t.alignTablet!==t.align?t.alignTablet:void 0}function E(t){const e=pt("textSize",t.size,t.sizeTablet,void 0).tablet;return e&&e>0?e:void 0}function Zt(t){const e=T(t),n={},o=E(e);o!==void 0&&(n.fontSize=`${o}px`);const i=z(e);return i&&(n.textAlign=i),n}function ke(t,e){if(e==="desktop")return;const n=T(t);return(e==="mobile"?z(n):void 0)??n.align}function qt(t,e){if(e==="desktop")return t;const n=T(t),o=E(n),i=z(n);if(e==="tablet"){let a=t;return o!==void 0&&(a={...a,size:o}),i&&(a={...a,align:i}),a}let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone};else{const a=M(n.sizeToken);a?r={...r,size:void 0,sizeToken:a}:o!==void 0&&(r={...r,size:o})}const l=n.alignPhone??i;return l&&(r={...r,align:l}),r}function L(t,e,n){return D(qt(t,e),$,n)}function Jt(t){return t==="mobile"?"sizePhone":t==="tablet"?"sizeTablet":"size"}function Ie(t,e){if(e==="desktop")return null;const n=T(t);if(e==="mobile"){if(M(n.sizeToken))return null;const o=E(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function Y(t,e){const n=Jt(e);if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function ye(t,e,n){const o=L(Y(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function D(t,e,n){t=T(t);const o=Bt(t,n),i=Ut(t),r=t.size?`${t.size}px`:t.sizeToken?U(t.sizeToken):o?Xt(o):"";return{fontFamily:t.font?ne(t.font):t.fontRole?`var(${V[t.fontRole]})`:o?`var(${V[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:i.lineHeight!==void 0?String(i.lineHeight):"",letterSpacing:i.letterSpacingEm!==void 0?`${i.letterSpacingEm}em`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Gt(t.case),textAlign:t.align??"",paddingTop:Z(t.padding),paddingBottom:Z(t.padding),color:Qt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Qt=t=>at(t),Z=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Fe(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.letterSpacing),r=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:te(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(i)?P(i/n,4):0,align:ee(t.textAlign),case:Wt(t.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function te(t){return Number.isFinite(t)?bt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function ee(t){for(const e of A)if(e===t)return e;return t==="end"?"right":"left"}function Me(t,e){const n=q(t);if(!n)return"";for(const o of it)if(q(e(o.cssVar))===n)return o.key;return""}const q=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function ne(t){const e=rt(t);return e?`var(${e.cssVar})`:""}function Le(t,e,n,o){return!e||C(e)?.nodeId!==t?null:n.find(r=>o(r.getAttribute("class")))??n[0]??null}function oe(t,e){return Object.hasOwn(t,e)?N(t[e])??{}:{}}function De(t,e,n=()=>$,o=a=>a,i=ae,r="desktop",l=()=>!1){let a=0;for(const{element:c,partId:h}of t){const x=C(h)?.propKey;if(!x)continue;const s=oe(e,o(x)),f=L(s,r,{blockDrawsStyle:l(x)});S(s.textStyle)?c.setAttribute?.(W,s.textStyle):c.removeAttribute?.(W);const d=j.some(g=>c.style[g]);let p=!1;for(const[g,u]of Object.entries(f))le(c,g,u),u&&(p=!0);if(d||j.some(g=>f[g]))for(const g of ie(c,i))for(const u of j)g.style[u]=f[u]??"";p&&(a+=1)}return a}function ie(t,e){const n=O(t.textContent??""),o=[];let i=t;for(let r=0;r<re&&e(i);r+=1){const l=i.parentElement;if(!l||O(l.textContent??"")!==n)break;o.push(l),i=l}return o}const re=8;function ae(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const $={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function se(t){if(!t||typeof t!="object")return null;const e={};return S(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizeTablet=="number"&&t.sizeTablet>0&&(e.sizeTablet=t.sizeTablet),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function fe(t,e){const n=se(t);if(!n)return{};const o=L(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function He(t){return S(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function je(t,e,n){if(!t||typeof t!="object")return{};const o=st(t.role,e,w)??{},i=e.sized?fe(Y(t,n),n):{};return{...o,...i}}function ve(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function le(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const i=t;e===m&&(n?i.setAttribute?.(J,""):i.removeAttribute?.(J))}const J="data-sf-part-para",ce=Object.keys(D({},$)),H=new Set(["color","overflowWrap",m,"fontStyle"]),j=ce.filter(t=>!H.has(t));function Ce(t,e,n,o=a=>a,i=()=>!1,r=()=>null,l=[]){const a=new Map;for(const s of t){const f=v(s.key,s.row);for(const d of s.texts){const p=a.get(d);p?(p.keys.add(s.key),p.partKeys.add(f)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([f])})}}const c=new Map;for(const s of new Set([...Object.keys(e),...l])){if(!ue(s))continue;const f=Q(n,s,N(e[s])??{},!1,r(s));f&&c.set(s,f)}const h=s=>{const f=o(s),d=r(f);if(!Object.hasOwn(e,f)&&!d)return null;const p=N(e[f])??{};return Q(n,s,p,i(s),d)},x=new Map;for(const[s,{keys:f,partKeys:d}]of a){const p=d.size===1?[...d][0]:f.size===1?[...f][0]:null;if(!p)continue;const b=h(p);b&&x.set(s,b)}for(const s of t){if(!s.keyed)continue;const f=h(v(s.key,s.row));f&&c.set(s.key,f)}return x.size||c.size?{rules:x,kindRules:c,drawn:new Set(a.keys())}:null}function Q(t,e,n,o,i){const r=D(n,$,{blockDrawsStyle:o}),l=Zt(n),a=Yt(n),c=S(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(l).length&&!Object.keys(a).length&&!c&&!i?null:{stamp:pe(t,e),declarations:r,...Object.keys(l).length?{tablet:l}:{},...Object.keys(a).length?{phone:a}:{},...c?{textStyle:c}:{},...i?{motion:i}:{}}}function ue(t){return t.startsWith("@")}function We(t,e){return t?.kindRules.get(e)??null}function pe(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Ge(t,{inBox:e=!1}={}){const n=e?lt:ut,o=e?ft:ct,i=[],r=new Set,l=a=>{const{stamp:c,declarations:h}=a;if(r.has(c))return;r.add(c);const x=Object.entries(h).filter(([,u])=>u!==""),s=u=>u.map(([tt,et])=>`${xe(tt)}: ${et}`).join("; "),f=`[${ht}="${c}"]`,d=x.filter(([u])=>!H.has(u)),p=x.filter(([u])=>H.has(u));d.length&&i.push(`${f}, *:has(> ${f}) { ${s(d)} }`),p.length&&i.push(`${f} { ${s(p)} }`),h[m]&&(i.push(`*:has(> ${f}) { ${m}: ${h[m]} }`),i.push(...de(f,`*:has(> ${f})`)));const b=Object.entries(a.tablet??{}).filter(([,u])=>u!=="");b.length&&i.push(`@media ${n} { ${f}, *:has(> ${f}) { ${s(b)} } }`);const g=Object.entries(a.phone??{}).filter(([,u])=>u!=="");g.length&&i.push(`@media ${o} { ${f}, *:has(> ${f}) { ${s(g)} } }`)};for(const a of t.rules.values())l(a);for(const a of t.kindRules.values())l(a);return i.join(`
|
|
2
|
+
`)}function de(t,e){const n=`var(${m})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const xe=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Be(t,e){if(!t)return null;const n=O(e),o=t.rules.get(n);if(o)return o;if(n.length<ge||t.drawn.has(n))return null;let i=null;for(const[r,l]of t.rules)if(r.includes(n)){if(i&&i.stamp!==l.stamp)return null;i=l}return i}const ge=8;export{A as PART_ALIGNS,kt as PART_LETTER_EM_MAX,Nt as PART_LETTER_EM_MIN,Et as PART_LETTER_STEP,Ot as PART_LINE_HEIGHT_MAX,wt as PART_LINE_HEIGHT_MIN,zt as PART_LINE_STEP,B as PART_MEASURED_TRACKS,Pt as PART_NUDGE_MAX,Tt as PART_NUDGE_MIN,Rt as PART_PADDING_MAX,At as PART_PADDING_MIN,_t as PART_PADDING_STEP,J as PART_PARAGRAPH_ATTR,yt as PART_PARAGRAPH_MAX,It as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,$t as PART_RELATIVE_PROPS,y as PART_SIZE_MAX,I as PART_SIZE_MIN,Ft as PART_SIZE_STEPS,ht as PART_STYLED_ATTR,k as PART_STYLES_PROP,ce as PART_STYLE_PROPERTIES,bt as PART_WEIGHTS,j as SHARED_PART_PROPERTIES,G as STYLE_ID_OF_ROLE,W as TEXT_STYLE_ATTR,De as applyPartStyles,Ne as blockDrawsTextStyle,_e as followedStyleOf,ue as isPartKindKey,S as isTextStyleId,de as paragraphRules,ke as partAlignFollowed,L as partCanvasDeclarations,Wt as partCaseOfTransform,Gt as partCaseTransform,Me as partFontKeyOf,ze as partLiftRules,Yt as partPhoneDeclarations,We as partRuleForKind,Be as partRuleForText,ye as partShownDeclarations,Jt as partSizeBoxOf,Ie as partSizeFollowed,Ut as partSpacingOf,Fe as partStyleBase,$e as partStyleCount,Ge as partStyleCss,D as partStyleDeclarations,qt as partStyleForScreen,Le as partStyleSource,Y as partStyleWithoutSizeBox,Zt as partTabletDeclarations,we as propsWithPartStyleValue,Oe as propsWithoutPartStyle,Ce as publishedPartStyles,K as readPartStyle,Ee as readPartStyles,fe as regionCanvasDeclarations,ve as regionCanvasRestore,He as regionHasOwnLook,se as regionSheetStyle,je as regionShownDeclarations,oe as storedPartStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as w}from"react/jsx-runtime";import{parseBlockWidthFit as K,phoneKey as c,tabletKey as o}from"efficient-easel/draw";import{blockCanWidenPastCell as A,blockFillInCellClass as L,blockSizeOf as O,blockSizeValuesOf as X}from"../../content/block-size.js";import{NoCellBound as G}from"../../../components/BoxCellContext.js";import{CellWrap as Z,useBoxCell as v}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as U,boxRowColumnsClass as B,boxShareClasses as k,boxShareTabletOf as Y,boxTabletColumnsClass as $}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as M}from"../../../../format/lib/content/container-direction.js";import{BOX_TYPE as V,containerBlocksFor as q}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as J}from"../part-styles.js";import{addShowWhenFacts as Q,withRowRules as F}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as tt}from"./cell-width.js";import{findParentNode as et}from"../../../../format/lib/document/passes/document-position.js";const it=new Set(["Text","Heading"]),nt=new Set(["h1","h2","h3","h4","h5","h6"]);function z(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&nt.has(e.tag)?!0:J(e,"text").textStyle?.startsWith("heading-")===!0}const u={not:{context:"blockOutsideBox",is:!0}},C={all:[u,{not:{context:"boxSharesWidth",is:!0}}]},I={all:[u,{not:{context:"boxSharesWidthPhone",is:!0}}]},N={all:[u,{not:{context:"boxSharesWidthTablet",is:!0}}]};function y(t,e,i){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},i??{field:t,is:e}]}]}}function E(t,e,i){return{any:[{field:c(t),is:e},{all:[{field:c(t),set:!1},i??{field:t,is:e}]}]}}const H={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},st=[[["_gBlockSize","minWidth",o("minWidth"),c("minWidth"),"maxWidth",o("maxWidth"),c("maxWidth")],u],[["widthFit"],C],[[o("widthFit")],N],[[c("widthFit")],I],[["width"],{all:[C,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[N,y("widthFit","fixed")]}],[[c("width")],{all:[I,E("widthFit","fixed")]}]],R=y("textFit","shrink",H),D=[[["_gText","textFit",o("textFit"),c("textFit")],u],[["minFont"],{all:[u,H]}],[[o("minFont")],{all:[u,R]}],[[c("minFont")],{all:[u,E("textFit","shrink",R)]}]],f=(t,e)=>et(e.appState,t.props?.id),p=t=>!!t&&typeof t.type=="string"&&q(t.type)!==null,m=t=>(t.type==="Flex"||t.type==="HeroGroup")&&M(t.type,t.props?.direction)==="row",_=t=>{const e=K(t);return e!==void 0&&e!=="fit"},rt={blockOutsideBox:(t,e)=>!p(f(t,e)),boxSharesWidth:(t,e)=>{const i=f(t,e);return!p(i)||!m(i)?!1:B({...i.props,direction:"row"})!==""?!0:k(i.props?.share)!==""&&!_(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=f(t,e);if(!p(i)||!m(i))return!1;if($(i.props?.[o("columns")])!==""||B({...i.props,direction:"row"})!=="")return!0;const n=Y(i.props?.[o("share")])??i.props?.share;return k(n)!==""&&!_(t.props?.[o("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=f(t,e);if(!p(i)||!m(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!U(n,i.props?.[c("share")])&&!_(t.props?.[c("widthFit")]??t.props?.widthFit)}},ot=t=>/^_[gds][A-Z]/.test(t);function lt(t,e,i){const n=Object.entries(t),r=n.findIndex(([l])=>l===e);if(r===-1)return null;let s=r+1;for(;s<n.length&&!ot(n[s][0]);)s++;return Object.fromEntries([...n.slice(0,s),...Object.entries(i),...n.slice(s)])}function j(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function ct(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:r,...s}=i;return j(e,n.indexOf("_dSize")+1,s)}return at.has(t)&&n.includes("_gSpacing")?j(e,n.indexOf("_gSpacing"),i):{...e,...i}}const at=new Set(["Text","Heading"]);function ut(t,e){const{_gText:i,...n}=e;return lt(t,"_gText",n)??{...t,...e}}function ht(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"),c("textFit")])r in n&&(n[r]=t[r]);e.set(i,n)}return n}}const Bt={name:"blockSize",applies:(t,e,i)=>tt.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=it.has(e),{text:r}=i.blockSizeFields(n?{tablet:!0,textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:s}=i.blockSizeFields({tablet:!0});let l=ct(e,t.fields??{},F(s,st));if(n){const a=F(r,D);if(l=ut(l,a),e==="Text"){const h=F(i.blockSizeFields({tablet:!0,textFit:"shrink"}).text,D),x=ht(h),d=t.resolveFields,P=(T,S)=>{const b=d?d(T,S):S.fields,W=g=>z(e,T?.props??{})?x(g??S.fields):g;return b instanceof Promise?b.then(W):W(b)};t.resolveFields=P}}t.fields=l,Q(t,{...rt,textWrapsByDefault:a=>!z(e,a.props??{})})},draw(t,e){dt(t,e)}};function dt(t,e){const i=t.render;t.render=n=>{const r=X(n),s=O(r),l=i(n),a=s&&O(r,{atSectionLine:!0});return s===null?l:w(ft,{size:s,sectionSize:a??s,atEdge:e===V,inCell:L(r),widens:A(r),children:l})}}function ft({size:t,sectionSize:e,atEdge:i,inCell:n,widens:r,children:s}){const l=v(),a=l||i?t:e,h=a.className,x=l?.phoneCells===!0,d=r?w(G,{children:s}):s;return w(Z,{className:x&&n?`${h} ${n}`:h,...Object.keys(a.style).length?{style:a.style}:{},attrs:a.attrs,children:d})}export{Bt as blockSize,z as textShrinksByDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as s}from"react/jsx-runtime";import{CardRowDrawn as f}from"../../../components/CardRowContext.js";import{PublishedPartStyles as
|
|
1
|
+
import{jsx as s}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 x}from"../../animation/part-motion.js";import{partNeedles as b}from"../text-parts.js";import{CARD_LIST_TYPE as p,rowPartByKey as u}from"../../../../format/lib/content/card-template.js";import{BOX_TYPE as _}from"../../../../format/lib/document/container-blocks.js";const B={name:"clickableParts",applies:(i,e,c)=>typeof c?.render=="function"&&i!==p,draw(i,e,c){const o=i,P=()=>o.textParts??o.fields,l=o.render,d=c.inspector?.PartAnchors,m=(t,r)=>b(P(),r,n=>u(e,t,n));o.render=t=>{const r=y(t),n=x(t);return t.editor?.isEditing&&d?s(f,{type:e,props:t,children:a=>s(d,{needles:m(t,a),styles:r,motions:n,type:e,children:l(t)})}):!Object.keys(r).length&&!Object.keys(n).length?l(t):s(f,{type:e,props:t,children:a=>s(h,{needles:m(t,a),styles:r,motions:n,type:e,atEdge:e===_,children:l(t)})})}}};export{B as clickableParts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElement as
|
|
1
|
+
import{createElement as c}from"react";import{ViewHideContext as m,viewHideClaim as l}from"../../../components/ViewHideRoot.js";import{nodeHiddenEverywhere as f,nodeViewHideClass as o,nodeViewHideWords as u}from"../../../../format/lib/content/view-hide-class.js";import{BOX_TYPE as w}from"../../../../format/lib/document/container-blocks.js";const N={name:"hiddenNodes",applies:(n,i,t)=>typeof t?.render=="function",draw(n,i,t){const r=i===w?"edge":t.isSection(i)?"section":"by-box",d=n.render;n.render=e=>{if(f(e))return null;const s=o(e),a=l(s,u(e),{sectionClassName:o(e,{atSectionLine:!0}),line:r});return c(m.Provider,{value:a},d(e))}}};export{N as hiddenNodes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as E}from"react/jsx-runtime";import{SectionAnimation as f}from"../../../components/SectionAnimation.js";import{ENTRANCE_EXCLUDED as l,entranceDrawn as p}from"../../animation/entrance.js";import{CARD_HOVER_SECTIONS as w,PICTURE_HOVER_BLOCKS as T}from"../../../../format/lib/animation/hover.js";import{BOX_TYPE as a}from"../../../../format/lib/document/container-blocks.js";import{drawsCopiesInTheBox as _}from"../../../../format/lib/content/copies-in-box.js";const c=Object.fromEntries(T.map(n=>[n,"picture"])),b={[a]:"box",Ticker:"marquee",...Object.fromEntries(w.map(n=>[n,"cards"])),...c},s=(n,e)=>!l.has(n)&&!!e&&typeof e.render=="function";function d(n,e,o,i){n.fields={...n.fields,...o.animationTabFields(e,i)}}function m(n,e){const o=n,i=o.render;o.render=t=>{const r=p(t);return!r||_(e,t)?i(t):E(f,{desktop:r.desktop,phone:r.phone,editing:!!t.editor?.isEditing,takesViewHide:!0,atEdge:e===a,children:i(t)})}}const R={name:"sectionAnimation",applies:(n,e,o)=>e.isSection(n)&&s(n,o),panel:(n,e,o)=>d(n,b[e]??"section",o,e),draw:(n,e)=>m(n,e)},x={name:"blockEntrance",applies:(n,e,o)=>!e.isSection(n)&&s(n,o),panel:(n,e,o)=>d(n,c[e]??"block",o,e),draw:(n,e)=>m(n,e)};export{x as blockEntrance,R as sectionAnimation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as l}from"react/jsx-runtime";import{HideTaker as u}from"../../../components/ViewHideRoot.js";import{INTRO_EDGE_CLASS as K}from"../../../../format/lib/sections/intro-bleed-layout.js";import{resolveContainerDirection as j}from"../../../../format/lib/content/container-direction.js";import{HERO_BACKGROUND_VAR as X,HERO_CHROME_CAP_VAR as q,HERO_CHROME_INSET_VAR as z,FULL_SECTION_WIDTH as J,SITE_WIDTH_CAP as _,centredCap as B,heroBackgroundTokens as Q}from"../../../../format/lib/content/page-width.js";import{SECTION_WIDTH_FAMILY as v,SECTION_WIDTH_KEYS as G,hasOwnSectionWidth as Z,hasWidthFamily as tt,resolveWidth as D,siteWidthsOf as nt}from"../../../../format/lib/content/section-width.js";import{BOX_GUTTER_KEY as
|
|
1
|
+
import{jsx as l}from"react/jsx-runtime";import{HideTaker as u}from"../../../components/ViewHideRoot.js";import{INTRO_EDGE_CLASS as K}from"../../../../format/lib/sections/intro-bleed-layout.js";import{resolveContainerDirection as j}from"../../../../format/lib/content/container-direction.js";import{HERO_BACKGROUND_VAR as X,HERO_CHROME_CAP_VAR as q,HERO_CHROME_INSET_VAR as z,FULL_SECTION_WIDTH as J,SITE_WIDTH_CAP as _,centredCap as B,heroBackgroundTokens as Q}from"../../../../format/lib/content/page-width.js";import{SECTION_WIDTH_FAMILY as v,SECTION_WIDTH_KEYS as G,hasOwnSectionWidth as Z,hasWidthFamily as tt,resolveWidth as D,siteWidthsOf as nt}from"../../../../format/lib/content/section-width.js";import{boxCardProps as et}from"../../../../format/lib/content/box-background.js";import{cardCopyPlace as ot}from"../../../../format/lib/content/card-template.js";import{BOX_GUTTER_KEY as it,boxGutterOf as ct,boxPlaceOf as rt,boxRunsEdgeToEdge as lt,isFrameContainer as T,ownNodeWidth as dt,siteDrawsGutter as ut}from"../../../../format/lib/content/site-gutter.js";import{getEditorSiteContentWidth as st}from"../../../../format/lib/document/editor-site-widths.js";import{GroundStopsAt as F,NestedBoxChoice as at,SectionGroupChoice as ft,SectionGroupWidthsProvider as ht,SectionRootChoice as _t,SplitBandAndColumn as H}from"../../../components/SiteGutterFrame.js";import{FRAME as L}from"../../../components/BlockFrame.js";import{sectionFillPassClass as M}from"../../../../format/lib/content/section-min-height.js";import{parentCapsWidth as Nt}from"../../../../format/lib/sections/section-head-placement.js";import{addShowWhenFacts as E,withRowsShownWhen as O}from"../../../../format/lib/document/show-when-attach.js";import{findParentNode as wt,heldByANode as Ct,isNestedNode as Tt,NOT_HELD_BY_A_NODE as P}from"../../../../format/lib/document/passes/document-position.js";const N="--sf-sw-site",Et="--sf-sw-content",Ot="--sf-bg-cap",St="contents [--sf-site-width:var(--sf-sw-content)] max-view-wide:[--sf-site-width:var(--sf-sw-site)]",R=({own:t,content:n,siteContent:e})=>t===!0&&n==="full"&&e!=="full",k="contents view-wide:[--sf-site-width:100vw]",A=({held:t},n,e)=>t?e:l(u,{className:n,children:e}),mt=`contents view-wide:[--sf-site-width:100vw] ${K} view-wide:[--sf-site-gutter:var(--intro-edge)]`,W=(t,n)=>n==="content"?`min(${t}px,var(${N}))`:`${t}px`;function S({content:t,contentMax:n},e){return t==="full"?e!=="content"?J:null:n===null?null:W(n,e)}function m(t,n){return n===null?t:l(u,{className:"contents",style:{[N]:_},children:l(u,{className:St,style:{[Et]:n},children:t})})}const pt="--sf-content-cap",xt="contents max-view-wide:[--sf-content-cap:none]";function Rt({content:t,contentMax:n},e){return t==="full"?null:n!==null?W(n,e):e==="content"?null:`var(${N})`}function At(t,n){return n===null?t:l(u,{className:"contents",style:{[N]:_},children:l(u,{className:xt,style:{[pt]:n},children:t})})}const y=`var(${N},${_})`,f=(t,n,e="")=>t==="content"?l(u,{className:e||void 0,style:B(_),children:l(F,{ground:y,children:n})}):n;function U(t,n,e,o,i){if(R(e))return f(o,A(e,k,l(H,{children:t({...n,contained:!0})})),i);if(e.content==="full")return f(o,t({...n,contained:!1}),i);const c=S(e,o);return o==="content"&&c===null&&!e.own?t({...n,contained:!0}):f(o,m(l(H,{children:t({...n,contained:!0})}),c),i)}function V(t,n,e,o){if(e==="hero"){const r=m(t(n),S(o,o.band));return o.band==="full"?l(u,{style:{[X]:"none",[z]:"initial",[q]:"initial"},children:r}):o.band==="content"?l(u,{style:Q(!0),children:r}):r}const i=o.band??"full",c=M(n);if(e==="rawMarkup"){if(o.content==="full")return f(i,t(n),c);const r=o.contentMax===null?_:W(o.contentMax,i);return l(u,{className:"contents",style:{[N]:_},children:f(i,l(u,{className:c||void 0,style:B(r),children:t(n)}),c)})}if(e==="scrollOver"){const r=o.content==="full",d=R(o)?A(o,mt,t({...n,fullWidth:!1})):m(t({...n,fullWidth:r}),r?null:S(o,i));return i==="content"?l(u,{className:"contents",style:{[Ot]:_},children:d}):d}switch(e){case"both":return f(i,At(t(n),Rt(o,i)),c);case"contained":return U(t,n,o,i,c);case"contentColumn":case"contentFull":case"productGrid":{const r=R(o),d=o.content==="full"&&!r?"full":"page",s=r?A(o,k,t({...n,widthMode:d})):m(t({...n,widthMode:d}),o.content==="full"?null:S(o,i));return e==="productGrid"&&!o.own?i==="content"?l(u,{className:c?`${L} ${c}`:L,children:s}):s:f(i,s,c)}default:return f(i,m(t(n),S(o,i)),c)}}function Wt(t,n){const e=v[n],o=t.render;t.render=i=>{const c=nt(i),r={band:c.background,content:c.content??"content",contentMax:null},d=()=>e==="rawMarkup"?o(i):l(ft,{draw:a=>a?.background==="content"?l(F,{ground:y,children:s(a)}):s(a)}),s=a=>{const C=a?{...r,band:a.background==="content"?r.band:a.background??r.band,content:a.content??r.content,own:a.background==="full"||a.content!==null,held:!0,siteContent:r.content}:r,x=V(o,i,e,C);if(!T(n))return x;const b=ct(i),g=b===void 0?C.content:b?"content":"full";return g===C.content?x:l(at,{atTop:x,nested:U(o,i,{...C,content:g,own:!1},C.band??"full",M(i))})},h=dt(n,i);if(!Z(h))return d();const w=e==="rawMarkup",I=h.background??(w?"full":c.background),Y=h.content??(w?"full":r.content),p={band:I,content:I==="content"?"content":Y,contentMax:h.contentMax,own:!w,siteContent:r.content};return l(_t,{own:()=>l(ht,{value:{background:p.band,content:p.content},children:V(o,i,e,p)}),followed:d})}}const It={all:[P,{not:{context:"runsEdgeToEdge",is:!0}}]},Qt={name:"sectionWidth",applies:(t,n,e)=>tt(t)&&!!e&&typeof e.render=="function",panel(t,n,e){const o=e.sectionOwnWidthFields({drawsFullOnItsOwn:v[n]==="rawMarkup"}),i=T(n)?e.boxGutterFields():{},c={...t.fields,...i,...o},r=T(n)?$(n,t,c,[it]):c;E(t,{heldByANode:Ct}),T(n)&&E(t,{runsEdgeToEdge:(d,s)=>lt(et(d.props??{},ot(s.appState,d.props?.id)?.inCopy!==!1))}),t.fields=O(r,[G.background,G.content],T(n)?It:P)},draw(t,n){Wt(t,n)}};function bt(t,n){if(!t||!("widthMode"in t))return t;const e={...t},o=e.widthMode;return o&&(e.widthMode={...o,currentValue:n.mode,inherited:n.inherited}),e}const gt=new Set(["Heading","Text","ImageBlock","ButtonBlock"]),Zt={name:"containedWidth",applies:(t,n,e)=>gt.has(t)&&!!e&&typeof e.render=="function",panel(t,n,e){const o=e.widthField;t.fields=$(n,t,{...t.fields,...o("page")});const i=t.resolveFields;t.resolveFields=(c,r)=>{const d=i?i(c,r):r.fields,s=D(c?.props??{},"page"),h=w=>bt(w,s);return d&&typeof d.then=="function"?d.then(h):h(d)}},draw(t){const n=t.render;t.render=e=>{const{mode:o}=D(e,"page");return n({...e,contained:o!=="full"})}}},Bt={not:{context:"inHeroGroupRow",is:!0}},tn={name:"buttonAlignInRow",applies:t=>t==="ButtonBlock",panel(t){const n=t;n.fields=O(n.fields??{},["align"],Bt),E(n,{inHeroGroupRow:(e,o)=>{const i=wt(o.appState,e.props?.id);return!!i&&i.type==="HeroGroup"&&j("HeroGroup",i.props?.direction)==="row"}})}};function vt(t){return Object.values(t).some(n=>!!n&&typeof n=="object"&&n.type==="slot")}const Gt={any:[]},Dt={all:[{not:{context:"outsideBox",is:!0}},{not:{context:"insideSiteGutter",is:!0}}]},Ft={not:{context:"widthCappedByParent",is:!0}};function $(t,n,e,o=["widthMode"]){if(t==="ButtonBlock")return O(e,["_gWidth",...o],Gt);if(vt(e)){const i=(c,r)=>rt(r.appState?.data?.content,c.props?.id,ut(st()));return E(n,{outsideBox:(c,r)=>i(c,r)?.inBox!==!0,insideSiteGutter:(c,r)=>i(c,r)?.insideGutter}),O(e,o,Dt)}return E(n,{widthCappedByParent:(i,c)=>"parent"in c?Nt(c.parent):Tt({props:i.props??{}},c)}),O(e,o,Ft)}export{Ot as SECTION_BACKGROUND_VAR,xt as SECTION_CONTENT_CAP_CLASS,pt as SECTION_CONTENT_CAP_VAR,St as SECTION_CONTENT_CLASS,Et as SECTION_CONTENT_VAR,N as SITE_CONTENT_VAR,tn as buttonAlignInRow,Zt as containedWidth,Qt as sectionWidth,bt as widthModeFields};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Data } from "efficient-easel/blocks";
|
|
2
|
+
export type PublishedPassContext = {
|
|
3
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
4
|
+
};
|
|
5
|
+
export type PublishedPass = {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly chrome: boolean;
|
|
8
|
+
readonly why: string;
|
|
9
|
+
readonly run: (data: Data, ctx: PublishedPassContext) => Data;
|
|
10
|
+
};
|
|
11
|
+
export declare const PUBLISHED_PASSES: readonly PublishedPass[];
|
|
12
|
+
export declare function publishedPageData(data: unknown, metadata?: Readonly<Record<string, unknown>>): Data;
|
|
13
|
+
export declare function publishedChromeData(data: Data, metadata?: Readonly<Record<string, unknown>>): Data;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{capHeroGroups as s}from"../../../format/lib/document/cap-hero-groups.js";import{markListSearchScopes as m}from"../../../format/lib/document/list-search-scopes.js";import{dropEmptySourcedBoxes as i,markHeadCoreBoxes as h}from"./head-core-boxes.js";import{oneH1 as c}from"../../../format/lib/document/one-h1.js";import{withPageContents as l}from"../content/page-contents.js";import{markWallLabels as p}from"./wall-labels.js";import{migrateLegacyPageData as d}from"./migrate-legacy.js";import{migrateRenamedProps as u}from"../../../format/lib/document/renamed-props.js";import{convertSectionsInPage as f,SECTION_TO_BOX_ON as y}from"../sections/section-to-box.js";import{siteThemeOf as g}from"../../../format/lib/theme.js";import{registerGeneralSectionRows as w}from"./blocks/general/section-to-box-rows.js";const S=[{name:"migrateLegacyPageData",chrome:!1,why:"page-only: it walks the top-level sections (Gallery B's array to its slot, a second pinned Header or Footer); a chrome document's one top-level node is the chrome itself",run:e=>d(e)},{name:"migrateRenamedProps",chrome:!0,why:"every document built from stored props: a renamed key still reads its stored answer (lib/source-rules/document-surfaces)",run:e=>u(e)},{name:"convertSectionsInPage",chrome:!1,why:"page-only: it turns an old top-level SECTION into its Box, with the site theme off the page's metadata; chrome is a Box group, never one of those sections",run:(e,{metadata:o})=>(w(),f(e,y,{theme:g(o)}))},{name:"capHeroGroups",chrome:!1,why:"page-only: it caps a top-level Hero's slide groups, and a Hero is a page section",run:e=>s(e)},{name:"oneH1",chrome:!1,why:"page-only: it hands the h1 to the first opener in the PAGE's document order; on a chrome document it would count a second document on its own",run:e=>c(e)},{name:"dropEmptySourcedBoxes",chrome:!0,why:"any document: a nested head over sourced cores served none goes (the Box footer's payment line), at any depth inside a slot",run:e=>i(e)},{name:"markHeadCoreBoxes",chrome:!1,why:"page-only: it marks a head Box at the TOP of the page, where the mark element draws (lib/content/empty-hides); a chrome document's top is the chrome group",run:e=>h(e)},{name:"markListSearchScopes",chrome:!1,why:"page-only for now: it ties a Search to the lists of the page's Box; no chrome holds a Search, and a chrome entry is one flag when one does",run:e=>m(e)},{name:"withPageContents",chrome:!1,why:"page-only: a Contents block lists the PAGE's anchored sections and numbers their kickers",run:e=>l(e)},{name:"markWallLabels",chrome:!0,why:"any document: each Marks wall is named by the lead Text drawn before it (aria-labelledby), the Box footer's walls too",run:e=>p(e)}];function a(e,o,n){let r=e;for(const t of S)(!n||t.chrome)&&(r=t.run(r,o));return r}function G(e,o){return a(e,{metadata:o},!1)}function T(e,o){return a(e,{metadata:o},!0)}export{S as PUBLISHED_PASSES,T as publishedChromeData,G as publishedPageData};
|
|
@@ -167,6 +167,7 @@ export interface SectionToBoxRow {
|
|
|
167
167
|
pressKeepsEmpty?: readonly string[];
|
|
168
168
|
site?: (node: SectionNode, ctx: ConvertContext) => readonly SiteWrite[];
|
|
169
169
|
skip?: (props: Props) => string | undefined;
|
|
170
|
+
ownBoxConverts?: true;
|
|
170
171
|
also?: readonly SectionPiece[];
|
|
171
172
|
reads?: Readonly<Record<string, string>>;
|
|
172
173
|
}
|
|
@@ -189,6 +190,9 @@ export declare function convertsToBox(type: string): boolean;
|
|
|
189
190
|
export declare function pressesAsBox(type: string, press?: readonly string[]): boolean;
|
|
190
191
|
export declare function headParts(type: string): PartRow[];
|
|
191
192
|
export declare const hasWords: (v: unknown) => boolean;
|
|
193
|
+
export declare const headInOwnBox: (p: Props) => boolean;
|
|
194
|
+
export declare function ownBoxHold(p: Props): string | undefined;
|
|
195
|
+
export declare function filledTemplateHold(p: Props, slot: string): string | undefined;
|
|
192
196
|
export declare function convertSection(node: SectionNode, row: SectionToBoxRow, ctx?: ConvertContext): SectionConversion;
|
|
193
197
|
export declare function convertSectionsInPage<D extends {
|
|
194
198
|
content?: unknown;
|
|
@@ -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 Te(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 C={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box), and its Scrolling Bar is a Box in its strip slot (Hero › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function Pe(t){for(const[o,i]of Object.entries(t)){if(o in C&&C[o]!==i)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);C[o]=i}}function _e(t){return C[t]}const Y=new Set(["id"]),T={},z=[],fe=["ProductGrid","Events","ContactRouting","ReviewForm","AppointmentBooking","Reviews","CheckoutCTA"],de=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ",...fe,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","Cards"];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 ve(t){return T[t]}function je(){return Object.keys(T)}function le(t){return t in T&&z.includes(t)}function Ne(t,o=de){return t in T&&(o.includes(t)||le(t))}function Ie(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),Re=t=>H(t).text.trim()!=="";function pe(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 ue=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function he(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 ye(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 V(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 P=j?j(i[k],i,m):i[k];P===void 0?delete a[B]:a[B]=P,r(k,B,P===void 0)}return a}function me(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,P=(n,s)=>{h.push({key:n,home:s}),j.add(n)},M=r._partStyles??{},A=me(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(r,i):s??{};return V(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}-${++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(r,i):n.props??{},d=y.map((f,x)=>{const l=f??{},u=n.item?.(l,x,r)??{},S=N(u.reverse?[...n.parts].reverse():n.parts,l,!1,`item ${x+1}: `);return n.flat?u.props?S.map(_=>({..._,props:{..._.props,...u.props,id:_.props.id}})):S:[$(E,{name:`${n.name} ${x+1}`,...g,...u.props??{},[v]:S})]});if(n.groups){const f=n.groups;return b(n.key,y.length?`one Box per item (${y.length}), in a Box per group`:"nothing — the list is empty"),ae(y.map(x=>x??{}),f.of,f.of).map((x,l)=>{const u=x.items.map(O=>O.item),S=f.parts?N(f.parts,f.head?.(u,r)??{},!1,`group ${l+1}: `):[],_=x.items.map(O=>d[O.index]),L=f.perRow?.(u.length,r),I=Number.isInteger(L)&&L>=1?L:1,F=[];if(f.perRow&&I<_.length)for(let O=0;O*I<_.length;O++)F.push(_.slice(O*I,(O+1)*I).flat());return $(E,{name:`${f.name} ${l+1}`,...f.props??{},[v]:[...S,$(E,{name:`${f.itemsName} ${l+1}`,...f.itemsProps?.(u.length,r)??{},[v]:F.length?F.map((O,U)=>$(E,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[v]:O})):_.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,S)=>$(E,{name:`Empty ${S+1}`,...n.rowFiller,[v]:[]}))]}))}return p},N=(n,s,b,y)=>{const g=[],d=(e,c)=>b?P(e,c):void 0,w=e=>b?M[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=ue(e.role??"body"),{_partStyles:f,...x}=p,l=he(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"?pe(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??{},...ye(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=>!A.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&&!A.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])=>!A.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(S=>"kind"in S?W(S,s,d):q([S]));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=V(n.box??[],g,r,(w,e,c)=>P(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&&P("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))r[n]!==void 0&&P(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:D[0],nodes:D,carried:h,dropped:k,siteWrites:[...o.site?.(t,i)??[]],restyled:B}}function Ce(t,o=z,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=z,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{fe as HOST_PRESS_TYPES,v as SECTION_BOX_SLOT,E as SECTION_BOX_TYPE,z as SECTION_TO_BOX_ON,de as SECTION_TO_BOX_PRESS,_e as boxNativeReason,Q as convertSection,Ce as convertSectionsInPage,Te as convertTheme,le as convertsToBox,Re as hasWords,Ie as headParts,Ne as pressesAsBox,Pe as registerBoxNativeSections,Ee as registerSectionToBox,ce as sectionBoxIdOf,Ae as sectionToBoxEdits,ve as sectionToBoxRow,je as sectionToBoxTypes};
|
|
1
|
+
import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se,parseSectionHeadPlacement as ie}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 ae}from"../../../format/lib/document/seed-parts.js";import{bucketByGroup as ce}from"../../../format/lib/locations-grid.js";import{normalizeTheme as G}from"../../../format/lib/theme.js";const _=ee,E=te;function Ie(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 fe(t,o){return o===0?`${t}~box`:`${t}~box-${o+1}`}const A={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box), and its Scrolling Bar is a Box in its strip slot (Hero › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function Ne(t){for(const[o,s]of Object.entries(t)){if(o in A&&A[o]!==s)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=s}}function Re(t){return A[t]}const Y=new Set(["id"]),T={},F=[],de=["ProductGrid","Events","ContactRouting","ReviewForm","AppointmentBooking","Reviews","CheckoutCTA"],le=["Breadcrumb","DocBody","Form","SubmitBuild","Footprint","FAQ",...de,"Stats","Logos","PaymentBadges","PaymentLogosBlock","FitmentFinder","DocMasthead","Timeline","TimelineTrack","OrderSummary","Chart","Mockup","Countdown","FeaturedCover","Cards"];function Ae(t){for(const[o,s]of Object.entries(t)){if(o in T&&T[o]!==s)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=s}}function Ce(t){return T[t]}function He(){return Object.keys(T)}function pe(t){return t in T&&F.includes(t)}function Le(t,o=le){return t in T&&(o.includes(t)||pe(t))}function Fe(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const s=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&s.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&s.push({kind:"button",key:"linkText",href:"linkHref"}),s}const z=t=>Z(t),ze=t=>z(t).text.trim()!=="";function ue(t){if(t.includes("=="))return t;const o=t.indexOf("/"),s=o===-1?t:t.slice(0,o),i=s.trim();if(!i)return t;const c=s.indexOf(i);return`${s.slice(0,c)}==${i}==${s.slice(c+i.length)}${o===-1?"":t.slice(o)}`}const he=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function ye(t,o,s,i){const a={...t._partStyles?.text??{},...o??{},...s??{}};return(i==="center"||i==="right")&&a.align===void 0&&(a.align=i),Object.keys(a).length?{_partStyles:{text:a}}:{}}function me(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const s=o[t.key];return{variant:typeof s=="string"&&Object.hasOwn(t.map,s)?t.map[s]:t.fallback}}function V(t,o,s,i,c={}){const a={...o};for(const u of t){const[k,O,j]=typeof u=="string"?[u,u,void 0]:u;if(s[k]===void 0)continue;const P=j?j(s[k],s,c):s[k];P===void 0?delete a[O]:a[O]=P,i(k,O,P===void 0)}return a}function ke(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),s=c=>{for(const a of c??[])o.add(typeof a=="string"?a:a[0])},i=c=>{for(const a of c)switch(a.kind){case"text":case"image":o.add(a.key),a.kind==="image"&&a.alt&&o.add(a.alt);break;case"button":o.add(a.key),o.add(a.href),typeof a.variant=="object"&&o.add(a.variant.key);break;case"list":o.add(a.key);break;case"group":case"block":s(a.box),i(a.parts??[]);break;case"core":if(a.keep!=="rest"&&a.keep.forEach(u=>o.add(u)),Object.keys(a.rename??{}).forEach(u=>o.add(u)),a.derive?.reads.forEach(u=>o.add(u)),typeof a.slots!="function")for(const u of Object.values(a.slots??{}))for(const k of u)"kind"in k&&o.add(k.key);break}};for(const c of[t,...t.also??[]])s(c.box),i(c.parts);return o}const be=t=>ie(t.headPlacement)==="own-box";function xe(t){return be(t)?"its head sits in a Box of its own above it (own-box): the row draws the head inline":void 0}function ge(t,o){const s=t[o];return Array.isArray(s)&&s.some(c=>!!c&&typeof c=="object"&&typeof c.type=="string")?"already on the Box path: its items draw from a filled card template":void 0}function we(t){const o=new Set,s=i=>{for(const c of i)if(c.kind==="group"||c.kind==="block")s(c.parts??[]);else if(c.kind==="core"&&c.slots&&typeof c.slots!="function")for(const[a,u]of Object.entries(c.slots))u.length>0&&u.every(k=>!("kind"in k))&&o.add(a)};for(const i of[t,...t.also??[]])s(i.parts);return[...o]}function $e(t,o,s){if(!s.press)for(const i of we(t)){const c=ge(o,i);if(c!==void 0)return c}}function Q(t,o,s={}){const i=t.props,c=(o.ownBoxConverts?void 0:xe(i))??$e(o,i,s)??o.skip?.(i);if(c!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:c};const a=String(i.id??t.type),u=[],k=[],O=[],j=new Set,P=(n,r)=>{u.push({key:n,home:r}),j.add(n)},M=i._partStyles??{},C=ke(o);let X=0;const w=(n,r)=>({type:n,props:{...r,id:`${a}~${n}-${++X}`}}),K=(n,r,b,m,x,l,$)=>{if(x){for(const f of n??[]){const h=typeof f=="string"?f:f[0];b[h]!==void 0&&$(h,`nothing — the ${m} has no parts, so it is not drawn`)}return}const e=typeof r=="function"?r(i,s):r??{};return V(n??[],e,b,(f,h,d)=>$(f,d?`nothing — the old value draws nothing (${m}: no ${h})`:`${l}${m}: ${h}`),s)},q=n=>ae(n,r=>`${a}~${r}-${++X}`),W=(n,r,b)=>{const m=n.of?n.of(r):Array.isArray(r[n.key])?r[n.key]:[],x=typeof n.props=="function"?n.props(i,s):n.props??{},l=m.map((d,g)=>{const p=d??{},y=n.item?.(p,g,i)??{},S=I(y.reverse?[...n.parts].reverse():n.parts,p,!1,`item ${g+1}: `);return n.flat?y.props?S.map(v=>({...v,props:{...v.props,...y.props,id:v.props.id}})):S:[w(_,{name:`${n.name} ${g+1}`,...x,...y.props??{},[E]:S})]});if(n.groups){const d=n.groups;return b(n.key,m.length?`one Box per item (${m.length}), in a Box per group`:"nothing — the list is empty"),ce(m.map(g=>g??{}),d.of,d.of).map((g,p)=>{const y=g.items.map(B=>B.item),S=d.parts?I(d.parts,d.head?.(y,i)??{},!1,`group ${p+1}: `):[],v=g.items.map(B=>l[B.index]),H=d.perRow?.(y.length,i),N=Number.isInteger(H)&&H>=1?H:1,L=[];if(d.perRow&&N<v.length)for(let B=0;B*N<v.length;B++)L.push(v.slice(B*N,(B+1)*N).flat());return w(_,{name:`${d.name} ${p+1}`,...d.props??{},[E]:[...S,w(_,{name:`${d.itemsName} ${p+1}`,...d.itemsProps?.(y.length,i)??{},[E]:L.length?L.map((B,U)=>w(_,{name:`${d.rowName??`${d.itemsName} row`} ${U+1}`,...d.rowProps??{},[E]:B})):v.flat()})]})})}const $=n.perRow?.(i),e=n.perRow?Number.isInteger($)&&$>=1?$:1:0;if(b(n.key,(m.length?n.flat?`each item's parts (${m.length} items), in order`:`one Box per item (${m.length}), its parts inside`:"nothing — the list is empty")+(e&&m.length?`, in rows of ${e}`:"")),!e)return l.flat();const f=typeof n.rowProps=="function"?n.rowProps(i,s):n.rowProps??{},h=[];for(let d=0;d*e<l.length;d++){const g=l.slice(d*e,(d+1)*e).flat(),p=n.rowFiller?e-l.slice(d*e,(d+1)*e).length:0;h.push(w(_,{name:`${n.rowName??`${n.name} row`} ${d+1}`,...f,[E]:[...g,...Array.from({length:p},(y,S)=>w(_,{name:`Empty ${S+1}`,...n.rowFiller,[E]:[]}))]}))}return h},I=(n,r,b,m)=>{const x=[],l=(e,f)=>b?P(e,f):void 0,$=e=>b?M[e]:void 0;for(const e of n)if(!(e.when&&!e.when(i,b?void 0:r)))switch(e.kind){case"text":{const f=z(r[e.key]);if(!f.text.trim()&&!(b&&s.press&&o.pressKeepsEmpty?.includes(e.key))){l(e.key,"nothing — empty words draw nothing, so no block");break}const h=he(e.role??"body"),{_partStyles:d,...g}=h,p=ye(h,e.styleFrom?{...e.style,...e.styleFrom(i,s)}:e.style,$(e.key),e.props?.align);if(e.was&&b){const y=p._partStyles?.text??{};O.push({key:e.key,was:e.was,...typeof y.textStyle=="string"?{textStyle:y.textStyle}:{},...R(y.size)!==void 0?{size:R(y.size)}:{},...R(y.sizePhone)!==void 0?{sizePhone:R(y.sizePhone)}:{}})}x.push(w("Text",{text:e.mark==="accentLead"?ue(f.text):e.mark==="accentItalic"?re(f.text):f.text,...g,...e.props??{},...p,...f.hidden?{_hidden:!0}:{}})),l(e.key,`${m}Text block: its words${f.hidden?", hidden":""}`);break}case"button":{const f=z(r[e.key]);if(!f.text.trim()){l(e.key,"nothing — no words, no button"),l(e.href,"nothing — no button to link"),typeof e.variant=="object"&&l(e.variant.key,"nothing — no button to style");break}const h=typeof r[e.href]=="string"&&r[e.href]?r[e.href]:"#",d={...e.style??{},...$(e.key)??{}};x.push(w("ButtonBlock",{label:f.text,href:h,...typeof e.props=="function"?e.props(r,s):e.props??{},...me(e.variant,r),...Object.keys(d).length?{_partStyles:{label:d}}:{},...f.hidden?{_hidden:!0}:{}})),l(e.key,`${m}Button block: its words`),l(e.href,`${m}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${m}Button block: its Style`);break}case"image":{const f=r[e.key];if(typeof f!="string"||!f){l(e.key,"nothing — no picture, no block"),e.alt&&l(e.alt,"nothing — no picture to describe");break}const h=e.alt&&typeof r[e.alt]=="string"?r[e.alt]:"";x.push(w("ImageBlock",{src:f,alt:h,...e.props??{}})),l(e.key,`${m}Image block: its picture`),e.alt&&l(e.alt,`${m}Image block: its alt text`);break}case"list":{x.push(...W(e,r,l));break}case"group":{const f=I(e.parts,r,b,m),h=K(e.box,e.props,r,`${e.name} Box`,!f.length&&!e.keepEmpty,m,l);h&&x.push(w(_,{name:e.name,...h,[E]:f}));break}case"block":{const f=e.parts?I(e.parts,r,b,m):[],h=K(e.box,e.props,r,`${e.type} block`,!!e.parts&&!f.length&&!e.keepEmpty,m,l);h&&x.push(w(e.type,{...h,...e.slot?{[e.slot]:f}:{}}));break}case"core":{const f=e.as??t.type,h={...e.headless?{}:{headPlacement:"own-box"},...e.props??{}},d=e.keep==="rest"?Object.keys(r).filter(p=>!C.has(p)&&!(p in h)):e.keep;for(const p of d)r[p]!==void 0&&(h[p]=r[p],l(p,`the ${f} block inside the Box`));if(e.keep==="rest"){for(const y of Object.keys(e.props??{}))r[y]!==void 0&&!C.has(y)&&l(y,`nothing — the ${f} block inside the Box has the row's own value`);r.headPlacement!==void 0&&l("headPlacement",`the ${f} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(M).filter(([y])=>!C.has(y)));Object.keys(p).length&&(h._partStyles=p)}for(const[p,y]of Object.entries(e.rename??{}))r[p]!==void 0&&(h[y]=r[p],l(p,`the ${f} block inside the Box: ${y}`));if(e.derive){Object.assign(h,e.derive.props(r,s));for(const p of e.derive.reads)r[p]!==void 0&&l(p,`the ${f} block inside the Box`)}const g=typeof e.slots=="function"?e.slots(r,s):e.slots??{};for(const[p,y]of Object.entries(g))h[p]=y.flatMap(S=>"kind"in S?W(S,r,l):q([S]));x.push(w(f,h));break}}return x},J=(n,r)=>{const b=r===0?"Box":`${n.name} Box`,m=I(n.parts,i,!0,r===0?"":`${b}: `),x=typeof n.boxProps=="function"?n.boxProps(i,s):n.boxProps??{},l=V(n.box??[],x,i,($,e,f)=>P($,f?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),s);return{type:_,props:{name:n.name,...l,[E]:m,id:fe(a,r)}}},D=[o,...o.also??[]].map(J);i._partStyles!==void 0&&P("_partStyles","each old part's style moved to its new part");for(const[n,r]of Object.entries(o.reads??{}))i[n]!==void 0&&P(n,r);for(const[n,r]of Object.entries(o.drop??{}))n in i&&(k.push({key:n,why:r}),j.add(n));for(const n of Object.keys(i))Y.has(n)||j.has(n)||k.push({key:n,why:"not in the row — not carried"});return{node:D[0],nodes:D,carried:u,dropped:k,siteWrites:[...o.site?.(t,s)??[]],restyled:O}}function Me(t,o=F,s={}){const i=t.content;if(!Array.isArray(i))return t;let c=!1;const a=i.flatMap(u=>{const k=u&&typeof u.type=="string"&&o.includes(u.type)?T[u.type]:void 0;if(!k)return[u];const O=Q(u,k,s);return O.skipped!==void 0?[u]:(c=!0,O.nodes)});return c?{...t,content:a}:t}function Xe(t,o=F,s={}){if(!Array.isArray(t))return[];const i=[];return t.forEach((c,a)=>{const u=c&&typeof c.type=="string"&&o.includes(c.type)?T[c.type]:void 0;if(!u)return;const k=Q(c,u,s);k.skipped===void 0&&i.push({index:a,node:k.node,nodes:k.nodes})}),i}export{de as HOST_PRESS_TYPES,E as SECTION_BOX_SLOT,_ as SECTION_BOX_TYPE,F as SECTION_TO_BOX_ON,le as SECTION_TO_BOX_PRESS,Re as boxNativeReason,Q as convertSection,Me as convertSectionsInPage,Ie as convertTheme,pe as convertsToBox,ge as filledTemplateHold,ze as hasWords,be as headInOwnBox,Fe as headParts,xe as ownBoxHold,Le as pressesAsBox,Ne as registerBoxNativeSections,Ae as registerSectionToBox,fe as sectionBoxIdOf,Xe as sectionToBoxEdits,Ce as sectionToBoxRow,He as sectionToBoxTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "59.
|
|
3
|
+
"version": "59.3.0",
|
|
4
4
|
"description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|