efficient-web-builder 47.1.0 → 48.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -1
- package/dist/editor/components/BlockGapField.d.ts +15 -1
- package/dist/editor/components/BlockGapField.js +1 -1
- package/dist/editor/components/DuplicateToPageMenu.d.ts +2 -0
- package/dist/editor/components/DuplicateToPageMenu.js +1 -1
- package/dist/editor/components/HeroPartPanel.js +1 -1
- package/dist/editor/components/HoverEffectField.d.ts +1 -0
- package/dist/editor/components/HoverEffectField.js +1 -1
- package/dist/editor/components/MediaUploadField.d.ts +9 -0
- package/dist/editor/components/MediaUploadField.js +1 -1
- package/dist/editor/components/PartSettingsPanel.d.ts +2 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/PreviewPartAnchors.d.ts +3 -1
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/components/SameInEveryViewNote.d.ts +1 -0
- package/dist/editor/components/SameInEveryViewNote.js +1 -0
- package/dist/editor/components/SaveAsTemplateButton.d.ts +5 -0
- package/dist/editor/components/SaveAsTemplateButton.js +1 -0
- package/dist/editor/components/SideSpaceField.d.ts +31 -1
- package/dist/editor/components/SideSpaceField.js +1 -1
- package/dist/editor/components/SiteFields.d.ts +4 -1
- package/dist/editor/components/SiteFields.js +1 -1
- package/dist/editor/components/SiteRestoreNotice.js +1 -1
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/components/StandaloneSectionEditor.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/TickerSettingsPanel.js +1 -1
- package/dist/editor/components/VersionHistoryDrawer.js +1 -1
- package/dist/editor/components/WebsitePreviewButton.d.ts +2 -1
- package/dist/editor/components/WebsitePreviewButton.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/editor/components/WebsiteSettingsPanel.d.ts +10 -0
- package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
- package/dist/editor/components/usePartMotion.d.ts +10 -0
- package/dist/editor/components/usePartMotion.js +1 -0
- package/dist/editor/components/useSocialSettings.d.ts +2 -2
- package/dist/editor/lib/animation/AnimationDurationRow.d.ts +4 -0
- package/dist/editor/lib/animation/AnimationDurationRow.js +1 -1
- package/dist/editor/lib/animation/entrance-fields.js +1 -1
- package/dist/editor/lib/animation/fields.d.ts +1 -1
- package/dist/editor/lib/animation/fields.js +1 -1
- package/dist/editor/lib/animation/hover-fields.d.ts +1 -0
- package/dist/editor/lib/animation/hover-fields.js +1 -0
- package/dist/editor/lib/animation/loop-fields.js +1 -1
- package/dist/editor/lib/document/add-target.d.ts +2 -1
- package/dist/editor/lib/document/add-target.js +1 -1
- package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/build-config.js +1 -1
- package/dist/editor/lib/document/canvas-typing.js +1 -1
- package/dist/editor/lib/document/card-display-chips.d.ts +33 -0
- package/dist/editor/lib/document/card-display-chips.js +1 -0
- package/dist/editor/lib/document/controls.d.ts +19 -2
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/field-groups.js +1 -1
- package/dist/editor/lib/document/geocode-resolve.d.ts +1 -0
- package/dist/editor/lib/document/geocode-resolve.js +1 -1
- package/dist/editor/lib/document/live-number-field.d.ts +12 -0
- package/dist/editor/lib/document/live-number-field.js +1 -0
- package/dist/editor/lib/document/page-root.js +2 -2
- package/dist/editor/lib/document/part-motion-canvas.d.ts +10 -0
- package/dist/editor/lib/document/part-motion-canvas.js +2 -0
- package/dist/editor/lib/editor-document-adapter.d.ts +5 -1
- package/dist/editor/lib/editor-document-adapter.js +1 -1
- package/dist/editor/lib/sections/section-dry-run.d.ts +34 -0
- package/dist/editor/lib/sections/section-dry-run.js +2 -2
- package/dist/format/lib/animation/hover.d.ts +5 -0
- package/dist/format/lib/animation/hover.js +1 -0
- package/dist/format/lib/animation/index.d.ts +1 -0
- package/dist/format/lib/animation/index.js +1 -1
- package/dist/format/lib/content/block-sources.d.ts +9 -0
- package/dist/format/lib/content/block-sources.js +1 -1
- package/dist/format/lib/content/box-layout.d.ts +20 -1
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-separator.js +1 -1
- package/dist/format/lib/content/card-template.d.ts +9 -0
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/container-gap.d.ts +11 -2
- package/dist/format/lib/content/container-gap.js +1 -1
- package/dist/format/lib/content/count-numbers.d.ts +7 -0
- package/dist/format/lib/content/count-numbers.js +1 -0
- package/dist/format/lib/content/page-width.d.ts +11 -0
- package/dist/format/lib/content/page-width.js +1 -1
- package/dist/format/lib/content/section-sticky.d.ts +1 -0
- package/dist/format/lib/content/section-sticky.js +1 -1
- package/dist/format/lib/content/site-gutter.d.ts +6 -0
- package/dist/format/lib/content/site-gutter.js +1 -1
- package/dist/format/lib/document/easel-row-words.d.ts +2 -0
- package/dist/format/lib/document/easel-row-words.js +1 -1
- package/dist/format/lib/document/panel-bands.d.ts +1 -0
- package/dist/format/lib/document/panel-bands.js +1 -1
- package/dist/format/lib/document/panel-tabs.d.ts +8 -0
- package/dist/format/lib/document/panel-tabs.js +1 -0
- package/dist/format/lib/document/part-records.d.ts +6 -0
- package/dist/format/lib/document/part-records.js +1 -0
- package/dist/format/lib/document/passes/registry-context.d.ts +1 -1
- package/dist/format/lib/document/passes/registry-context.js +1 -1
- package/dist/format/lib/document/passes/settings-groups.js +1 -1
- package/dist/format/lib/document/passes/types.d.ts +2 -0
- package/dist/format/lib/document/section-groups.d.ts +1 -1
- package/dist/format/lib/document/site-gap-fields.d.ts +1 -1
- package/dist/format/lib/document/site-gap-fields.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +11 -0
- package/dist/format/lib/editor-words-catalogue.js +4 -4
- package/dist/format/lib/fit-words.js +4 -3
- package/dist/format/lib/hero-ticker.d.ts +1 -0
- package/dist/format/lib/hero-ticker.js +1 -1
- package/dist/format/lib/sections/strip-shape.d.ts +1 -0
- package/dist/format/lib/sections/strip-shape.js +1 -1
- package/dist/format/lib/site-theme-row.d.ts +2 -0
- package/dist/format/lib/site-twin-row.d.ts +5 -0
- package/dist/format/lib/site-twin-row.js +1 -0
- package/dist/format/lib/source-rules/flat-theme-palette.js +1 -1
- package/dist/format/lib/source-rules/one-loop-module.js +3 -3
- package/dist/render/components/BlockFrame.d.ts +2 -1
- package/dist/render/components/BlockFrame.js +1 -1
- package/dist/render/components/Btn.js +1 -1
- package/dist/render/components/CardRowContext.d.ts +3 -1
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/CountRowsContext.d.ts +8 -0
- package/dist/render/components/CountRowsContext.js +1 -0
- package/dist/render/components/Flex.d.ts +5 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/Grid.d.ts +2 -1
- package/dist/render/components/Grid.js +1 -1
- package/dist/render/components/HeroGroup.d.ts +2 -1
- package/dist/render/components/HeroGroup.js +1 -1
- package/dist/render/components/HeroSection.d.ts +2 -1
- package/dist/render/components/HeroSection.js +1 -1
- package/dist/render/components/HeroSingle.d.ts +2 -1
- package/dist/render/components/HeroSingle.js +1 -1
- package/dist/render/components/ImageBlock.d.ts +4 -1
- package/dist/render/components/ImageBlock.js +1 -1
- package/dist/render/components/InBoxContext.d.ts +1 -0
- package/dist/render/components/InBoxContext.js +1 -1
- package/dist/render/components/IntroBleed.js +1 -1
- package/dist/render/components/LocationMap.js +1 -1
- package/dist/render/components/PartStyledKind.js +1 -1
- package/dist/render/components/PartStyledText.js +1 -1
- package/dist/render/components/PreviewHeaderContext.d.ts +9 -1
- package/dist/render/components/PreviewHeaderContext.js +1 -1
- package/dist/render/components/PublishedPartStylesContext.d.ts +4 -1
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/components/SectionAnimation.d.ts +8 -2
- package/dist/render/components/SectionAnimation.js +1 -1
- package/dist/render/components/SiteGutterFrame.d.ts +7 -1
- package/dist/render/components/SiteGutterFrame.js +1 -1
- package/dist/render/lib/animation/LoopTrack.d.ts +2 -2
- package/dist/render/lib/animation/LoopTrack.js +1 -1
- package/dist/render/lib/animation/part-motion.d.ts +21 -0
- package/dist/render/lib/animation/part-motion.js +1 -0
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/content/button-look.js +1 -1
- package/dist/render/lib/content/section-edge.d.ts +10 -0
- package/dist/render/lib/content/section-edge.js +1 -0
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Grid/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroSingle/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-head-looks.d.ts +1 -0
- package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +8 -0
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.d.ts +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-locations.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -0
- package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-strip.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
- package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
- package/dist/render/lib/document/hero-media-parts.d.ts +2 -2
- package/dist/render/lib/document/part-styles.d.ts +10 -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/section-anchor.js +1 -1
- package/dist/render/lib/document/passes/section-padding.js +1 -1
- package/dist/render/lib/document/passes/slots-start-afresh.js +1 -1
- package/dist/render/lib/sections/section-to-box.d.ts +5 -1
- package/dist/render/lib/sections/section-to-box.js +1 -1
- package/dist/render/lib/text-styles/site-text-styles.d.ts +16 -4
- package/dist/render/lib/text-styles/site-text-styles.js +2 -2
- package/package.json +3 -3
- package/dist/editor/lib/document/selected-host.d.ts +0 -2
- package/dist/editor/lib/document/selected-host.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hasWords as p}from"../../../sections/section-to-box.js";import{BLOCK_WIDTH_LIMIT as N}from"efficient-easel/draw";import{fluidToken as M,token as o}from"./section-head-looks.js";import{STRIP_BOX as R}from"../../../../../format/lib/sections/strip-shape.js";import{BUTTON as C,DIM as A,DROP_COMMON as l,DROP_SIDE_PADDING as d,INNER_BOX as n,leadLine as k,RIGHT_WORDS as P,SAME_KEYS as g,SECTION_BOX as c,SH_LINK as W,smallText as i,TEXT as a,wrapperPad as h,wrapperPadKeys as m}from"./section-to-box-row-parts.js";const r={textFit:"line",textFitPhone:"wrap"},f={minWidth:N.min},S=(e,t,s)=>({...i(e,{...t,...P}),props:{...a,align:"right",...r,...s}}),_={top:1,bottom:0},b=(e,t,s,H)=>({kind:"group",name:e,props:{...n,sectionPaddingBottom:t,sectionPaddingBottomPhone:s},parts:[H]}),T={widthFit:"fill",...f},w={top:100,bottom:60,topPhone:60,bottomPhone:40},U={...o("label",13),letterSpacing:.22,lineHeight:1.8},x={textStyle:"heading-1",...M("headingLarge",56,8,128),case:"upper",weight:500,lineHeight:.88,letterSpacing:-.04},E=e=>e.titleLevel===2,v=()=>({name:"Document Header",boxProps:e=>({...c,direction:"column",gap:0,sectionBorder:{bottom:1},...h(e,w)}),box:[...g,...m(w)],parts:[{kind:"group",name:"Header",props:{...n,direction:"row",align:"end",justify:"between",gap:40,gapPhone:16,share:"content",sectionPaddingBottom:32},parts:[b("Eyebrow",12,0,{...i("eyebrow",o("label",13)),props:{...a,...r}}),{kind:"text",key:"title",role:"heading",props:{...a,tag:"h1",...T},style:x,when:e=>!E(e)},{kind:"text",key:"title",role:"heading",props:{...a,tag:"h2",...T},style:x,when:E},{kind:"group",name:"Details",props:{...n,align:"stretch",gap:0,gapPhone:0,sectionPaddingBottom:12,sectionPaddingBottomPhone:0},parts:[{kind:"list",key:"meta",name:"Detail",flat:!0,parts:[k("label","value",U,r)]}]}]},{kind:"group",name:"Deck",props:{...n,sectionBorder:_,sectionPaddingTop:32},parts:[{kind:"text",key:"deck",props:{...A,maxWidth:760},style:{textStyle:"body-1",fontRole:"accent",...o("body",22,19),italic:!0,lineHeight:1.5}}]}],drop:{...l,...d,titleLevel:"read by the title part's `when`: 2 (set by lib/document/one-h1 on a later opener) makes the Text an h2, anything else an h1"}}),I={top:80,bottom:40,topPhone:60,bottomPhone:32},X={...o("label",13),letterSpacing:.18,lineHeight:1.8},O={...o("label",13),letterSpacing:.22,lineHeight:1.9},G=()=>({name:"Issue Header",boxProps:e=>({...c,direction:"column",gap:0,sectionBorder:{bottom:1},...h(e,I)}),box:[...g,...m(I)],parts:[{kind:"group",name:"Top",props:{...n,direction:"row",align:"end",justify:"between",gap:60,gapPhone:16,share:"content",sectionPaddingBottom:32},parts:[b("Eyebrow",14,14,i("eyebrow",o("label",14))),{kind:"group",name:"Issue",props:{...n,align:"end",gap:0,gapPhone:0,sectionPaddingBottom:14},parts:[{kind:"list",key:"issueMeta",name:"Issue line",flat:!0,parts:[k("lead","rest",X)]}]}]},{kind:"group",name:"Bottom",props:{...n,direction:"row",align:"start",justify:"between",gap:60,gapPhone:16,share:"content",sectionBorder:_,sectionPaddingTop:32},parts:[{kind:"text",key:"lead",props:{...a,maxWidth:720,...f},style:{textStyle:"body-1",fontRole:"heading3",...o("headingSmall",20),lineHeight:1.5,letterSpacing:-.005,paragraphSpacing:16}},{kind:"group",name:"In this issue",props:{...n,align:"stretch",gap:0},parts:[b("Heading",6,6,{kind:"text",key:"issueHeading",props:{...a,align:"right",...r},style:{textStyle:"body-1",fontRole:"heading",...o("body",18),weight:400,letterSpacing:-.01,lineHeight:1.9,...P}}),{kind:"group",name:"Lines",props:{...n,align:"stretch",gap:0},parts:[{kind:"list",key:"issueList",name:"Line",flat:!0,parts:[S("text",{color:"labels",...O})]}]},S("issueTotal",O)]}]}],drop:{...l,...d}}),B={top:24,bottom:24,topPhone:16,bottomPhone:16},u={color:"labels",...o("label",13),letterSpacing:.2},L=e=>(Array.isArray(e.items)?e.items:[]).filter(t=>t&&typeof t.label=="string"&&t.label.trim()!==""),y=(e,t)=>t!==void 0&&L(e).at(-1)===t,D=(e,t)=>t!==void 0&&L(e).includes(t),K=(e,t)=>D(e,t)&&!y(e,t)&&p(t?.href),j=()=>({name:"Breadcrumb",skip:e=>p(e.meta)?'a trailing note after "·" needs a second mark; none live':void 0,boxProps:e=>({...c,...R,gap:16,gapPhone:16,separator:"slash",sectionBorder:{bottom:1},...h(e,B)}),box:[...g,...m(B)],parts:[{kind:"list",key:"items",name:"Crumb",flat:!0,parts:[{kind:"button",key:"label",href:"href",variant:"ghost",when:K,props:{...C,...W,icon:"none"},style:u},{...i("label",u),when:(e,t)=>D(e,t)&&!y(e,t)&&!p(t?.href)},{...i("label",{...u,color:"text"}),when:y}]}],drop:{...l,...d,meta:"a node that stores a note is skipped (`skip`); an empty one draws nothing"}}),J={DocMasthead:v(),Masthead:G(),Breadcrumb:j()};export{J as PAGE_HEADER_SECTION_TO_BOX};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{phoneKey as
|
|
1
|
+
import{phoneKey as l}from"efficient-easel/draw";import{COUNT_KEY_PROP as g}from"../../../../../format/lib/content/block-sources.js";import{resolveSectionBackground as k,THEME_SECTION_BG as _}from"../../../../../format/lib/content/section-background.js";import{finiteNumber as T}from"../../../../../format/lib/finite-number.js";import{hasWords as s}from"../../../sections/section-to-box.js";import{DROP_COMMON as u,DROP_SIDE_PADDING as m,INNER_BOX as o,NUMBER_TEXT as f,SAME_KEYS as w,SECTION_BOX as S,TEXT as b,bandAccent as B,bandProps as O,bandWrites as A,fillFrom as E,innerPad as N,innerPadKeys as R,smallText as i,wrapperPad as H,wrapperPadKeys as I}from"./section-to-box-row-parts.js";import{fluidToken as M,headTree as v,token as n}from"./section-head-looks.js";import{SECTION_BG_BUILT_IN as C}from"../../../../../format/lib/document/blocks/general/section-bg-built-in.js";const p=e=>typeof e=="string"?e.trim():"";function y(e){const t=`${p(e.prefix)}${p(e.value)}`,a=p(e.suffix);return e.emphasizeAll===!0?t?`==_${t}_==`:"":`${t}${a?`==_${a}_==`:""}`}const d={kind:"block",type:"Text",props:{...f,_partStyles:{text:{textStyle:"heading-2",...M("headingMedium",56,7,96),weight:500,case:"none",lineHeight:.9,letterSpacing:-.04}}},box:[["value","text",(e,t)=>y(t)]],when:(e,t)=>t!==void 0&&typeof t.value=="string"&&y(t)!==""},P=e=>s(e?.supSuffix),c=e=>k(e.background,C.StatsParagraph),r=e=>c(e)===_,h=e=>({...e,sectionAccent:e.sectionAccent??0}),D=(e,t)=>r(e)?E("background")(e,t):{},F={name:"Stats with Text",skip:e=>c(e)&&c(e)!=="transparent"&&!r(e)?"it paints a colour of its own, not the section band":void 0,boxProps:(e,t)=>({...S,direction:"column",gap:60,gapPhone:60,sectionBorder:{bottom:1},...N(e,"StatsParagraph"),...r(e)?O(h(e),t):{}}),box:[...w.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,a)=>r(t)?B(e,h(t),a):e],...R("StatsParagraph")],site:(e,t)=>r(e.props)?A({props:h(e.props)},t):[],parts:[v("StatsParagraph"),{kind:"group",name:"Stats",props:{...o,gap:0},parts:[{kind:"list",key:"stats",name:"Stat",perRow:()=>4,rowName:"Stats row",rowProps:{...o,direction:"row",gap:0,share:"equal",phoneRow:2,[l("share")]:"content"},props:(e,t)=>({...o,justify:"between",gap:12,gapPhone:12,sectionHeightMode:"fixed",sectionHeightValue:242,sectionHeightUnit:"px",widthFitPhone:"fixed",widthPhone:800,sectionPaddingTop:48,sectionPaddingBottom:48,sectionPaddingLeft:32,sectionPaddingRight:32,sectionBorder:{top:1,right:1,bottom:1,left:1},...D(e,t)}),parts:[{...d,when:(e,t)=>!P(t)&&d.when(e,t)},{kind:"group",name:"Figure",props:{...o,direction:"row",align:"start",gap:32,gapPhone:32,share:"content",phoneRow:2,[l("share")]:"content"},when:(e,t)=>P(t),parts:[d,{kind:"text",key:"supSuffix",props:b,style:{textStyle:"body-5",...n("label",13),weight:500,color:"accent",letterSpacing:.18,lineHeight:1,padding:12}}]},{kind:"group",name:"Words",props:{...o,gap:4,gapPhone:4},parts:[{kind:"text",key:"label",props:b,style:{textStyle:"body-1",fontRole:"heading",...n("body",16),lineHeight:1.5,letterSpacing:-.01}},i("sub",{color:"labels",...n("label",12),lineHeight:1.5,letterSpacing:.24})]}]}]}],drop:{...u,...m,background:"the band is the Box's theme: the site's band preset (`sectionAccent`), or a declared band-preset write; none paints nothing, and any other colour is skipped",headPlacement:"needs a row per head placement: an own-box Stats with Text draws no head (its words sit in a Section Header above it), the row always draws the head"}},K=new Set(["value","label",g]),x={top:48,bottom:48,topPhone:48,bottomPhone:48},U={name:"Stats",skip:e=>s(e.dataSource)?"its figures come from a source":Array.isArray(e.items)&&e.items.some(t=>s(t?.[g]))?"a figure names a count, and each figure Text here is typed by hand until it is linked":Array.isArray(e.items)&&e.items.some(t=>Object.keys(t??{}).some(a=>!K.has(a)))?"a figure has a key no part here reads":Object.keys(e._partStyles??{}).some(t=>t!=="heading")?"a figure or a name has a style of its own, kept by kind, which no part here reads":void 0,boxProps:e=>({...S,direction:"column",gap:24,gapPhone:24,...H(e,x)}),box:[...w,...I(x)],parts:[i("heading",{color:"labels",...n("label",12),letterSpacing:.2}),{kind:"group",name:"Stats",props:{...o,gap:32,gapPhone:32},parts:[{kind:"list",key:"items",name:"Stat",perRow:e=>T(e.columns)??4,rowName:"Stats row",rowProps:{...o,direction:"row",gap:32,gapPhone:32,share:"equal",phoneRow:2},props:{...o,gap:8,gapPhone:8,sectionBorder:{top:1},sectionPaddingTop:20},parts:[{kind:"text",key:"value",props:f,style:{textStyle:"heading-2",...n("headingMedium",48,36),weight:500,case:"none",lineHeight:1,letterSpacing:-.03}},i("label",{color:"labels",...n("label",12),letterSpacing:.2})]}]}],drop:{...u,...m,columns:"the rows of N: one row Box per `columns` figures, which the Box draws",dataSource:"an empty source is typed figures, what the row draws; a sourced node is skipped (0 Hartes nodes)",dataSourceOptions:"read only with a source; a sourced node is skipped (0 Hartes nodes)",contained:"the Box draws the site frame now; each figure fills the Box's column",background:"needs a Box fill: a Box paints only its theme's page colour. 0 Hartes nodes store it (read-only, 2026-11-02)"}},z={StatsParagraph:F,Stats:U};export{z as STATS_SECTION_TO_BOX,y as figureWords};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mixHex as u}from"efficient-shell/format";import{resolveSectionAccent as r,SECTION_ACCENT_INHERIT as E}from"../../../../../format/lib/content/section-surface.js";import{parseLoopDirection as x}from"../../../../../format/lib/animation/index.js";import{parseTickerSeparator as i,SEPARATOR_GLYPH as f}from"../../../../../format/lib/sections/ticker-style.js";import{DIM as s,DROP_COMMON as a,DROP_SIDE_PADDING as l,fillFrom as b,SAME_KEYS as p,sectionPage as h,SECTION_BOX as c,TEXT as y,wrapperPad as d,wrapperPadKeys as m}from"./section-to-box-row-parts.js";import{SPEC_PAD as S,SPEC_STRIP as A,SPEC_TEXT as T,STRIP_BOX as _,TICKER_BARE_GAP as C,TICKER_DISPLAY as R,TICKER_PAD as D,TICKER_SMALL as O,TICKER_STRIP as B}from"../../../../../format/lib/sections/strip-shape.js";const k=e=>e.size==="display",g=(e,o)=>{const t=h(e,o),n=e.tone!=="plain"&&t?.text&&t.background?u(t.text,t.background,.3):null;return n?{color:n}:{}},N=(e,o)=>e.tone!=="plain"&&r(e.sectionAccent)===null?b("background")(e,o):{},I=(e,o)=>({kind:"list",key:"items",name:"Item",flat:!0,when:o,parts:[{kind:"text",key:"text",props:s,style:e,styleFrom:g}]}),K={name:"Scrolling Bar",boxProps:(e,o)=>({...c,..._,...B,...f[i(e.separator)]===""?C:{},...d(e,D),...N(e,o)}),box:[["scrollDirection","scrollDirection",e=>x(e)],["speed","loopDuration",(e,o)=>o.loopDuration!=null?o.loopDuration:e],["loopDuration","loopDuration",(e,o)=>e??o.speed],["loopDelay","loopDelay",e=>e],["separator","separator",e=>i(e)],["borders","sectionBorder",e=>e===!1?void 0:{top:1,bottom:1}],...p,["tone","sectionAccent",(e,o)=>r(o.sectionAccent)??E],...m(D)],parts:[I(O,e=>!k(e)),I(R,k)],drop:{...a,...l,join:"the band sitting inside its neighbour: absent on all 18 live Tickers (JJ 2026-10-27), and not the separator",size:"each item's Text style: Small → Body 5, Display → Heading 3"}},P=e=>e?.tone==="muted",w={name:"Spec Strip",boxProps:e=>({...c,..._,...A,...e.fill==="none"?{sectionBorder:{top:1}}:{},...d(e,S)}),box:[...p,...m(S)],parts:[{kind:"list",key:"cells",name:"Cell",flat:!0,parts:[{kind:"text",key:"text",props:y,style:T,when:(e,o)=>!P(o)},{kind:"text",key:"text",props:s,style:T,when:(e,o)=>P(o)}]}],drop:{...a,...l,fill:"None → no fill and a line on top. Dark band → the Box follows its theme: the old fixed `plate-band` colour has no home (no site write adds a theme preset since 8622589f); the merchant picks a dark theme on the Box"}},Y={Ticker:K,SpecStrip:w};export{Y as STRIP_SECTION_TO_BOX};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{BUTTON as g,DIM as s,bandAccent as f,bandIndex as S,bandWrites as _,DROP_COMMON as h,DROP_SIDE_PADDING as m,INNER_BOX as o,SAME_KEYS as b,SECTION_BOX as y,lineBorder as u,TEXT as l,innerPad as x,innerPadKeys as k}from"./section-to-box-row-parts.js";import{splitParagraphs as E}from"../../../../components/goldPhrases.js";import{TIMELINE_YEAR_BOX as I,TIMELINE_YEAR_HEAD as w}from"../../../../../format/lib/sections/timeline-year-shape.js";const B="jetbrains-mono",T="space-grotesk",i=(e,t,r={})=>({textStyle:"body-5",font:B,size:e,sizePhone:e,letterSpacing:t,lineHeight:1.5,weight:400,...r}),p=(e,t,r,c)=>({font:T,size:e,sizePhone:t,case:"upper",weight:500,letterSpacing:r,lineHeight:c}),a=(e,t,r,c={})=>({textStyle:"body-1",font:T,size:e,sizePhone:t,weight:400,case:"none",lineHeight:r,...c}),n=(e,t,r={})=>({kind:"text",key:e,props:l,style:t,...r}),P=(e,t)=>t?.future===!0,d=e=>E(typeof e?.body=="string"?e.body:""),O={name:"Milestone Timeline",boxProps:(e,t)=>{const r=S(e,t);return{...y,direction:"column",gap:60,sectionBorder:{bottom:1},...x(e,"TimelineTrack"),...r>=0?{sectionAccent:r}:{}}},box:[...b.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",f],...k("TimelineTrack")],parts:[{kind:"group",name:"Heading",props:{...o,direction:"row",align:"end",justify:"between",gap:40,share:"content",sectionPaddingBottom:32,sectionBorder:{bottom:1}},parts:[{kind:"group",name:"Title",props:{...o,direction:"row",align:"end",gap:40,share:"content"},parts:[n("eyebrow",i(13,.3,{case:"upper",color:"accent",padding:8}),{role:"eyebrow"}),n("title",{textStyle:"heading-2",...p(79,40,-.03,1)},{role:"heading"})]},n("intro",a(14,14,1.5),{props:{...s,align:"right",maxWidth:360}})]},{kind:"group",name:"Years",props:{...o,direction:"row",share:"equal",gap:0,line:!0},parts:[{kind:"list",key:"entries",name:"Year",props:{...o,...I},item:e=>({props:e.future===!0?{upcoming:!0}:{}}),parts:[{kind:"group",name:w.name,props:{...o,...w},parts:[n("date",i(13,.22,{color:"accent"}),{when:(e,t)=>!P(e,t)}),n("date",i(13,.22,{color:"labels"}),{when:P}),n("title",{textStyle:"heading-3",...p(20,20,-.02,1.1)},{role:"heading"})]},n("blurb",a(13,13,1.55),{props:s})]}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"ghost",props:(e,t)=>({...g,align:"right",...u(e,t)}),style:i(13,.3,{case:"upper"})}],site:_,drop:{...h,...m,background:"the band is the Box's theme: the site's band preset (`sectionAccent`), or a declared band-preset write (`lib/theme` `bandPresetIndex`)",headPlacement:"needs a row per head placement: an own-box Milestone Timeline draws no head (its words sit in a Section Header above it), the row always draws the head"}},A={name:"Story Timeline",skip:e=>{const t=typeof e.layout=="string"?e.layout:"split";return t==="split"?void 0:`display "${t}": not converted (0 live pages; Spine and Alternating are not offered, a Track story is not stored anywhere)`},boxProps:e=>({...y,direction:"row",share:"twoThree",gap:80,align:"start",...x(e,"Timeline")}),box:[...b,...k("Timeline")],parts:[{kind:"group",name:"Heading",props:{...o,gap:24},parts:[n("eyebrow",i(12,.3,{case:"upper",color:"accent"}),{role:"eyebrow"}),n("title",{textStyle:"heading-2",...p(72,40,-.03,.94)},{role:"heading"}),n("intro",a(14,14,1.6),{props:{...s,maxWidth:360}}),{kind:"group",name:"Picture",keepEmpty:!0,box:[["imageSrc","bgImage"]],props:{...o,sectionBorder:{top:1,right:1,bottom:1,left:1},darken:75,darkenStyle:"bottom",placement:"bottom-center",sectionHeightMode:"fixed",sectionHeightValue:667,sectionHeightUnit:"px",sectionHeightModePhone:"fixed",sectionHeightValuePhone:419,sectionHeightUnitPhone:"px",sectionPaddingTop:12,sectionPaddingBottom:12,sectionPaddingLeft:16,sectionPaddingRight:16,sectionPaddingTopPhone:12,sectionPaddingBottomPhone:12,sectionPaddingLeftPhone:16,sectionPaddingRightPhone:16},when:e=>typeof e.imageSrc=="string"&&e.imageSrc.trim()!=="",parts:[{kind:"group",name:"Caption",props:{...o,direction:"row",justify:"between",align:"center",gap:12,share:"content",phoneRow:2},parts:[n("imageCaption",i(11,.24,{case:"upper",color:"text"})),n("imageMeta",i(11,.24,{case:"upper",color:"accent"}),{props:{...l,align:"right"}})]}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"ghost",props:(e,t)=>({...g,...u(e,t)}),style:i(13,.3,{case:"upper"})}]},{kind:"group",name:"Chapters",props:{...o,gap:48,line:!1},parts:[{kind:"list",key:"entries",name:"Chapter",props:{...o,direction:"row",gap:24,share:"biggerRight",align:"start"},parts:[n("date",i(13,.24,{color:"accent"})),{kind:"group",name:"Words",props:{...o,gap:14},parts:[n("title",{textStyle:"heading-3",...p(24,20,-.02,1.5)},{role:"heading"}),{kind:"block",type:"Text",props:{...l,_partStyles:{text:a(17,16,1.6)}},box:[["body","text",(e,t)=>d(t)[0]??""]],when:(e,t)=>d(t).length>0},{kind:"block",type:"Text",props:{...s,_partStyles:{text:a(17,16,1.6,{paragraphSpacing:14})}},box:[["body","text",(e,t)=>d(t).slice(1).join(`
|
|
2
2
|
|
|
3
|
-
`)]],when:(e,t)=>
|
|
3
|
+
`)]],when:(e,t)=>d(t).length>1}]}]}]}],drop:{...h,...m,layout:"Split is the only display converted (see skip); the Box's own arrangement replaces it"}},R={TimelineTrack:O,Timeline:A};export{R as TIMELINE_SECTION_TO_BOX};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasWords as
|
|
1
|
+
import{hasWords as I,registerSectionToBox as n}from"../../../sections/section-to-box.js";import{BUTTON as g,DIM as m,DROP_COMMON as s,DROP_SIDE_PADDING as c,INNER_BOX as t,leadLine as H,SAME_KEYS as d,SECTION_BOX as p,lineBorder as A,TEXT as l,innerPad as S,innerPadKeys as f,smallText as P,wrapperPad as u,wrapperPadKeys as b}from"./section-to-box-row-parts.js";import{CARDS_SECTION_TO_BOX as R}from"./section-to-box-rows-cards.js";import{normalizeSiteGutter as L,normalizeSiteGutterPhone as C,siteGutterPhoneFollows as W}from"../../../../../format/lib/content/page-width.js";import{finiteNumber as D}from"../../../../../format/lib/finite-number.js";import{STATS_SECTION_TO_BOX as G}from"./section-to-box-rows-stats.js";import{LOGOS_SECTION_TO_BOX as X}from"./section-to-box-rows-logos.js";import{STRIP_SECTION_TO_BOX as M}from"./section-to-box-rows-strip.js";import{TIMELINE_SECTION_TO_BOX as F}from"./section-to-box-rows-timeline.js";import{LOCATIONS_SECTION_TO_BOX as z}from"./section-to-box-rows-locations.js";import{HEAD_ONLY_SECTION_TO_BOX as K}from"./section-to-box-rows-head.js";import{PAGE_HEADER_SECTION_TO_BOX as j}from"./section-to-box-rows-pageheader.js";import{fluidToken as U,headTree as w,token as r}from"./section-head-looks.js";const k={top:72,bottom:72,topPhone:72,bottomPhone:72},Y={name:"Editorial Text",boxProps:e=>({...p,direction:"column",gap:28,gapPhone:28,sectionBorder:{top:1},...u(e,k)}),box:[["topBorder","sectionBorder",e=>e===!1?void 0:{top:1}],...d,...b(k)],parts:[w("Prose"),{kind:"text",key:"body",props:m,style:{textStyle:"body-1",...r("body",16),lineHeight:1.7,paragraphSpacing:18}}],drop:{...s,...c,headPlacement:"needs a row per head placement: an own-box Prose draws no head (its words sit in a Section Header above it), the row always draws the head. 0 of 123 live nodes store it (the live export, 2026-10-24)"}},T={buttonPaddingTop:20,buttonPaddingBottom:20,buttonPaddingLeft:28,buttonPaddingRight:28},O=(e,o)=>o?.variant==="primary",_=(e,o)=>({kind:"list",key:"buttons",name:"Button",flat:!0,when:e,parts:[{kind:"button",key:"label",href:"href",when:O,variant:"primary",style:{letterSpacing:.3},props:{...g,...T,...o}},{kind:"button",key:"label",href:"href",when:(i,a)=>!O(i,a),variant:"ghost",style:{letterSpacing:.3},props:(i,a)=>({...g,...T,...o,...A(i,a)})}]}),h=e=>I(e.title),q={name:"Call-to-Action Heading",boxProps:e=>({...p,direction:"row",align:"center",justify:h(e)?"between":"end",gap:60,gapPhone:60,share:"content",sectionBorder:{bottom:1},...S(e,"TitleWithButtons")}),box:[...d,...f("TitleWithButtons")],parts:[{kind:"group",name:"Title",props:{...t,maxWidth:1e3,widthFitPhone:"fill"},parts:[{kind:"text",key:"title",role:"heading",props:l,style:{textStyle:"heading-1",...U("headingLarge",48,7,108),case:"upper",lineHeight:.94,letterSpacing:-.035}}]},{kind:"group",name:"Buttons",props:e=>({...t,gap:14,gapPhone:14,widthFitPhone:"fill",...h(e)?{minWidth:280,minWidthPhone:0}:{}}),parts:[_(h,{widthFit:"fill",iconPosition:"end"}),_(e=>!h(e),{})]}],drop:{...s,buttonsAlign:"moves the buttons only when there is no heading (4 of 128 live nodes), where the Box puts them at the end. 0 of 128 live nodes store it (the live export, 2026-10-24)",buttonsAlignPhone:"the phone's own side of `buttonsAlign`, read only with no heading; no old node stores it (it is new with the Phone view's Block alignment row), so nothing moves"}};function J(e){const{siteGutter:o,siteGutterPhone:i}=e.site??{},a=L(o),y=Math.min(20,C(i)??W(o));return{sectionPaddingLeft:a,sectionPaddingRight:a,sectionPaddingLeftPhone:y,sectionPaddingRightPhone:y}}const x={top:40,bottom:64,topPhone:24,bottomPhone:36},Q={name:"Section Header",boxProps:(e,o)=>({...p,direction:"column",gap:0,...u(e,x),...J(o)}),box:[...d,...b(x)],parts:[w("SectionHeader")],drop:{...s,...c,headStyle:"needs a row per head look: the row draws the standard look; the editorial, simple, statement, natural and essay looks are other layouts. 0 of 69 live nodes store it (the live export, 2026-10-24)",eyebrowLook:"read only by the simple, statement, natural and essay looks, which this row does not draw. 0 of 69 live nodes store it",rowGap:"read only by the natural look, which this row does not draw. 0 of 69 live nodes store it",descriptionSize:"read only by the natural look, which this row does not draw. 0 of 69 live nodes store it",numStyle:"Solid (the default; 4 of 69 live nodes store it) IS the eyebrow Text the row draws; Outlined (0 live) needs an outlined-number text look"}},B={...t,direction:"row",share:"bigLeft",gap:30},E={...t,sectionPaddingLeft:30,sectionPaddingLeftPhone:0},N=(e,o,i)=>({kind:"group",name:e,props:o,parts:[i]}),V={name:"Lead Text",boxProps:e=>({...p,direction:"column",gap:40,gapPhone:40,sectionBorder:{bottom:1},...S(e,"ParagraphsA")}),box:[...d,...f("ParagraphsA")],parts:[{kind:"group",name:"Numbers",props:{...B,gapPhone:24,sectionBorder:{bottom:1},sectionPaddingBottom:40,sectionPaddingBottomPhone:40},parts:[{kind:"group",name:"Eyebrow",props:{...t,sectionPaddingTop:5,sectionPaddingBottom:1,sectionPaddingTopPhone:5,sectionPaddingBottomPhone:1},parts:[P("eyebrow",{color:"labels",...r("label",12),letterSpacing:.24})]},N("Stats column",t,{kind:"group",name:"Stats",props:{...E,gap:0,gapPhone:0},parts:[{kind:"list",key:"stats",name:"Stat",flat:!0,parts:[H("value","label",{...r("label",13),letterSpacing:.18,lineHeight:1.8})]}]})]},{kind:"group",name:"Words",props:{...B,gapPhone:28},parts:[{kind:"group",name:"Lead",props:t,parts:[{kind:"group",name:"Measure",props:{...t,maxWidth:780},parts:[{kind:"text",key:"lead",props:l,style:{textStyle:"heading-3",...r("headingSmall",22,20),weight:400,case:"none",lineHeight:1.45,letterSpacing:-.005}}]}]},N("Note column",{...t,justify:"end",widthFit:"fill"},{kind:"group",name:"Founders",props:{...E,gap:8,gapPhone:8},parts:[{kind:"group",name:"Note",props:{...t,gap:6,gapPhone:6},parts:[{kind:"text",key:"foundersHeading",props:l,style:{textStyle:"body-1",fontRole:"heading",...r("body",18,16),weight:500,letterSpacing:-.01,lineHeight:1.7}},{kind:"text",key:"foundersBody",props:m,style:{textStyle:"body-5",fontRole:"heading",...r("body",14,12),lineHeight:1.7}}]},P("attribution",{...r("label",12,10),letterSpacing:.24,lineHeight:1.7})]})]}],drop:{...s}},v={top:24,bottom:24,topPhone:24,bottomPhone:24},Z={name:"Banner",boxProps:e=>({...p,direction:"column",gap:0,...u(e,v)}),box:[...d,"contained",...b(v)],parts:[{kind:"group",name:"Card",keepEmpty:!0,props:{...t,gap:28,placement:"top-left",darken:60,darkenStyle:"even",sectionBorder:{width:1},sectionPaddingTop:64,sectionPaddingBottom:64,sectionPaddingTopPhone:40,sectionPaddingBottomPhone:40,sectionPaddingLeft:40,sectionPaddingRight:40,sectionPaddingLeftPhone:24,sectionPaddingRightPhone:24},box:[["imageSrc","bgImage"],["overlay","darken",e=>Math.min(Math.max(D(e)??60,0),100)]],parts:[{kind:"group",name:"Words",props:{...t,gap:20},parts:[P("eyebrow"),{kind:"text",key:"title",role:"heading",props:{...l,maxWidth:680},style:{weight:500,lineHeight:1.05,letterSpacing:-.03,case:"none"}},{kind:"text",key:"body",props:{...m,maxWidth:680},style:{textStyle:"body-1",lineHeight:1.6},was:{size:16}}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"primary",props:g}]}],drop:{...s,...c}},$={Prose:Y,TitleWithButtons:q,SectionHeader:Q,ParagraphsA:V,Banner:Z};function me(){n($),n(G),n(X),n(R),n(M),n(F),n(z),n(K),n(j)}export{$ as GENERAL_SECTION_TO_BOX,me as registerGeneralSectionRows};
|
|
@@ -12,8 +12,8 @@ export declare const VIDEO_FILE_LABEL = "Video file";
|
|
|
12
12
|
export declare const VIDEO_FILE_PROMPT = "Upload a video file";
|
|
13
13
|
export declare function forMediaType(type: "image" | "video", fallback: "image" | "video"): {
|
|
14
14
|
readonly field: "mediaType";
|
|
15
|
-
readonly is: "
|
|
16
|
-
readonly default: "
|
|
15
|
+
readonly is: "video" | "image";
|
|
16
|
+
readonly default: "video" | "image";
|
|
17
17
|
};
|
|
18
18
|
export declare const HERO_MEDIA_PART_TYPES: ReadonlySet<string>;
|
|
19
19
|
export declare function inPart<F extends object>(part: HeroMediaPart, field: F): F;
|
|
@@ -94,6 +94,7 @@ export type StyledPartEl = PartEl & {
|
|
|
94
94
|
style: Record<string, string>;
|
|
95
95
|
readonly parentElement: StyledPartEl | null;
|
|
96
96
|
};
|
|
97
|
+
export declare function partLiftRules(holder: string): string[];
|
|
97
98
|
export type StyledPartStamp = {
|
|
98
99
|
element: StyledPartEl;
|
|
99
100
|
partId: string;
|
|
@@ -140,13 +141,21 @@ export type PublishedPartRule = {
|
|
|
140
141
|
textStyle?: string;
|
|
141
142
|
declarations: Record<string, string>;
|
|
142
143
|
phone?: Record<string, string>;
|
|
144
|
+
motion?: PublishedPartMotion;
|
|
145
|
+
};
|
|
146
|
+
export type PublishedPartMotion = {
|
|
147
|
+
hover: string;
|
|
148
|
+
entrance: {
|
|
149
|
+
desktop: unknown;
|
|
150
|
+
phone: unknown;
|
|
151
|
+
} | null;
|
|
143
152
|
};
|
|
144
153
|
export type PublishedPartSheet = {
|
|
145
154
|
rules: ReadonlyMap<string, PublishedPartRule>;
|
|
146
155
|
kindRules: ReadonlyMap<string, PublishedPartRule>;
|
|
147
156
|
drawn: ReadonlySet<string>;
|
|
148
157
|
};
|
|
149
|
-
export declare function publishedPartStyles(needles: readonly PartNeedle[], styles: PartStyles, scope: string, styleKeyOf?: (partKey: string) => string, drawsStyle?: (partKey: string) => boolean): PublishedPartSheet | null;
|
|
158
|
+
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;
|
|
150
159
|
export declare function isPartKindKey(key: string): boolean;
|
|
151
160
|
export declare function partRuleForKind(sheet: PublishedPartSheet | null, kind: string): PublishedPartRule | null;
|
|
152
161
|
export declare function partStyleCss(sheet: PublishedPartSheet): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as v,textStyleCaseOfCss as tt}from"efficient-easel/draw";import{parseHexColor as et}from"efficient-shell/format";import{FONT_OPTIONS as nt,fontOption as ot,fontRoleOf as E,SIZE_STEP_OF_ROLE as M}from"../../../format/lib/fonts.js";import{encodePartKey as rt}from"../../../format/lib/document/part-key.js";import{decodePartId as F,normalizePartText as N}from"./text-parts.js";import{COLOUR_TOKEN as L}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as it}from"../content/view-values.js";const $="_partStyles",st="data-sf-part-styled",j="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function m(t){return typeof t=="string"&&ct.test(t)}const H={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function at(t){if(!t)return null;for(const[e,n]of Object.entries(H))if(n===t)return e;return null}function se(t){if(m(t.textStyle))return t.textStyle;const e=E(t.role);return e?H[e]:void 0}const ft=[400,500,600,700],y=["left","center","right","justify"],D=5,C=1e3,lt=-5,ut=10,pt=0,dt=64,xt=2,K={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:pt,max:dt,step:xt}},ht=.05,gt=.01,St=["line","letter"],mt=.5,Pt=2.5,Tt=-1,bt=1,_t=0,Rt=400,At=[...new Set(Object.values(M))];function b(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function W(t){return b(t?.[$])??{}}function G(t,e){const n=W(t);return Object.hasOwn(n,e)?b(n[e])??{}:{}}function ce(t,e){return Object.values(G(t,e)).filter(n=>n!==void 0).length}function X(t,e,n){const o={...W(t)};if(Et(n).length?o[e]=n:delete o[e],!Object.keys(o).length){const{[$]:r,...i}=t;return i}return{...t,[$]:o}}function Et(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return St.includes(t)}const _=(t,e,n)=>Math.min(n,Math.max(e,t));function Ot(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:_(n,lt,ut)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(_(n,mt,Pt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(_(n,Tt,bt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:_(n,_t,Rt)}if(Object.hasOwn(K,t)){const{min:n,max:o}=K[t],r=Math.round(Number(e));return Number.isFinite(r)?_(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?E(e)?e:null:t==="sizeToken"?z(e)?e:null:t==="textStyle"?m(e)?e:null:t==="alignPhone"?y.includes(e)?e:null:e}const Nt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function w(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Nt){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!y.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!y.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!m(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!z(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!E(t.fontRole)&&n("fontRole"),e??t}function z(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,c=s=>typeof s=="number"&&Number.isFinite(s)&&s>0,p=s=>typeof s=="string"&&At.includes(s);return p(e)&&c(n)&&(o===void 0||p(o))&&(r===void 0||c(r))&&(i===void 0||$t(i,n))}function $t(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 U(t){return t?.pxPhone&&z(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function B({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 wt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function zt(t){const e=[];for(const[n,o]of wt)n===t?e.push(o):o===t&&e.push(n);return e}function ae(t,e,n,o){const r={...G(t,e)},i=o==null?null:Ot(n,o);if(i===null)delete r[n];else{r[n]=i;for(const c of zt(n))delete r[c]}return X(t,e,r)}function fe(t,e){return X(t,e,{})}function It(t){return tt(t)??"none"}function kt(t){return v(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 Mt(t,e){const n=E(t.role);return n||(e?.blockDrawsStyle?null:at(t.textStyle))}function le(t,e){return t==="Text"&&e==="text"}const Ft={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 Lt(t){const e=M[t],n=Ft[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function jt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ht+t.line*ht,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*gt,4)),e}const Ht=1,g="--sf-part-para";function Y(t){t=w(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=U(t.sizeToken);n&&(e.fontSize=B(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Dt(t,e){if(!e)return t;const n=w(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=U(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function O(t,e,n){t=w(t);const o=Mt(t,n),r=jt(t),i=t.size?`${t.size}px`:t.sizeToken?B(t.sizeToken):o?Lt(o):"";return{fontFamily:t.font?Gt(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`:"",[g]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:kt(t.case),textAlign:t.align??"",paddingTop:Z(t.padding),paddingBottom:Z(t.padding),color:Ct(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Ct=t=>t===void 0||t===""?"":Object.hasOwn(L,t)?L[t]:et(t)===t.toLowerCase()?t:"",Z=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function ue(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:Kt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(r)?P(r/n,4):0,align:Wt(t.textAlign),case:It(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Kt(t){return Number.isFinite(t)?ft.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Wt(t){for(const e of y)if(e===t)return e;return t==="end"?"right":"left"}function pe(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 Gt(t){const e=ot(t);return e?`var(${e.cssVar})`:""}function de(t,e,n,o){return!e||F(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function xe(t,e,n=()=>R,o=p=>p,r=Bt,i=!1,c=()=>!1){let p=0;for(const{element:s,partId:a}of t){const u=F(a)?.propKey;if(!u)continue;const f=o(u),d=Object.hasOwn(e,f)?b(e[f])??{}:{},l=O(Dt(d,i),R,{blockDrawsStyle:c(u)});m(d.textStyle)?s.setAttribute?.(j,d.textStyle):s.removeAttribute?.(j);const S=k.some(h=>s.style[h]);let x=!1;for(const[h,T]of Object.entries(l))Vt(s,h,T),T&&(x=!0);if(S||k.some(h=>l[h]))for(const h of Xt(s,r))for(const T of k)h.style[T]=l[T]??"";x&&(p+=1)}return p}function Xt(t,e){const n=N(t.textContent??""),o=[];let r=t;for(let i=0;i<Ut&&e(r);i+=1){const c=r.parentElement;if(!c||N(c.textContent??"")!==n)break;o.push(c),r=c}return o}const Ut=8;function Bt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const R={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Vt(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===g&&(n?r.setAttribute?.(J,""):r.removeAttribute?.(J))}const J="data-sf-part-para",Yt=Object.keys(O({},R)),I=new Set(["color","overflowWrap",g,"fontStyle"]),k=Yt.filter(t=>!I.has(t));function he(t,e,n,o=i=>i,r=()=>!1){const i=new Map;for(const s of t){const a=rt(s.key,s.row);for(const u of s.texts){const f=i.get(u);f?(f.keys.add(s.key),f.partKeys.add(a)):i.set(u,{keys:new Set([s.key]),partKeys:new Set([a])})}}const c=new Map;for(const s of Object.keys(e)){if(!Zt(s))continue;const a=b(e[s])??{},u=O(a,R),f=Y(a),d=m(a.textStyle)?a.textStyle:void 0;!Object.values(u).some(Boolean)&&!Object.keys(f).length&&!d||c.set(s,{stamp:Q(n,s),declarations:u,...Object.keys(f).length?{phone:f}:{},...d?{textStyle:d}:{}})}const p=new Map;for(const[s,{keys:a,partKeys:u}]of i){const f=u.size===1?[...u][0]:a.size===1?[...a][0]:null;if(!f)continue;const d=o(f);if(!Object.hasOwn(e,d))continue;const l=b(e[d])??{},S=O(l,R,{blockDrawsStyle:r(f)}),x=Y(l),A=m(l.textStyle)?l.textStyle:void 0;!Object.values(S).some(Boolean)&&!Object.keys(x).length&&!A||p.set(s,{stamp:Q(n,f),declarations:S,...Object.keys(x).length?{phone:x}:{},...A?{textStyle:A}:{}})}return p.size||c.size?{rules:p,kindRules:c,drawn:new Set(i.keys())}:null}function Zt(t){return t.startsWith("@")}function ge(t,e){return t?.kindRules.get(e)??null}function Q(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Se(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:c}=r;if(n.has(i))return;n.add(i);const p=Object.entries(c).filter(([,l])=>l!==""),s=l=>l.map(([S,x])=>`${Jt(S)}: ${x}`).join("; "),a=`[${st}="${i}"]`,u=p.filter(([l])=>!I.has(l)),f=p.filter(([l])=>I.has(l));u.length&&e.push(`${a}, *:has(> ${a}) { ${s(u)} }`),f.length&&e.push(`${a} { ${s(f)} }`),c[g]&&(e.push(`*:has(> ${a}) { ${g}: ${c[g]} }`),e.push(...qt(a,`*:has(> ${a})`)));const d=Object.entries(r.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${it} { ${a}, *:has(> ${a}) { ${s(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 q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{parseHexColor as Q}from"efficient-shell/format";import{FONT_OPTIONS as tt,fontOption as et,fontRoleOf as b,SIZE_STEP_OF_ROLE as M}from"../../../format/lib/fonts.js";import{encodePartKey as nt}from"../../../format/lib/document/part-key.js";import{decodePartId as F,normalizePartText as E}from"./text-parts.js";import{COLOUR_TOKEN as L}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as rt}from"../content/view-values.js";import{plainRecord as $,propsWithPartRecord as ot,readPartRecord as it,readPartRecords as st}from"../../../format/lib/document/part-records.js";const y="_partStyles",at="data-sf-part-styled",H="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function T(t){return typeof t=="string"&&ct.test(t)}const j={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function ft(t){if(!t)return null;for(const[e,n]of Object.entries(j))if(n===t)return e;return null}function ue(t){if(T(t.textStyle))return t.textStyle;const e=b(t.role);return e?j[e]:void 0}const lt=[400,500,600,700],_=["left","center","right","justify"],D=5,C=1e3,ut=-5,pt=10,dt=0,xt=64,ht=2,K={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:dt,max:xt,step:ht}},gt=.05,mt=.01,Pt=["line","letter"],St=.5,Tt=2.5,Rt=-1,bt=1,_t=0,At=400,Et=[...new Set(Object.values(M))];function $t(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 pe(t){return st(t,y)}function W(t,e){return it(t,y,e)}function de(t,e){return Object.values(W(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){return ot(t,y,e,yt(n).length?n:null)}function yt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Nt(t){return Pt.includes(t)}const R=(t,e,n)=>Math.min(n,Math.max(e,t));function Ot(t,e){if(Nt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:R(n,ut,pt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(R(n,St,Tt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(R(n,Rt,bt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:R(n,_t,At)}if(Object.hasOwn(K,t)){const{min:n,max:r}=K[t],o=Math.round(Number(e));return Number.isFinite(o)?R(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?b(e)?e:null:t==="sizeToken"?O(e)?e:null:t==="textStyle"?T(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const wt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function N(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of wt){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!T(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!O(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!b(t.fontRole)&&n("fontRole"),e??t}function O(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:r,pxPhone:o,fluid:i}=t,s=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,c=f=>typeof f=="string"&&Et.includes(f);return c(e)&&s(n)&&(r===void 0||c(r))&&(o===void 0||s(o))&&(i===void 0||zt(i,n))}function zt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:r,...o}=t;return Object.keys(o).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof r=="number"&&Number.isFinite(r)&&r>0&&r<=100}function X(t){return t?.pxPhone&&O(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function U({step:t,px:e,fluid:n}){const r=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,o=`var(--size-${t}, ${r})`;return t.startsWith("heading")?`min(${o}, var(--sf-heading-max,9999px))`:o}const It=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function kt(t){const e=[];for(const[n,r]of It)n===t?e.push(r):r===t&&e.push(n);return e}function xe(t,e,n,r){const o={...W(t,e)},i=r==null?null:Ot(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of kt(n))delete o[s]}return G(t,e,o)}function he(t,e){return G(t,e,{})}function Mt(t){return J(t)??"none"}function Ft(t){return q(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 Lt(t,e){const n=b(t.role);return n||(e?.blockDrawsStyle?null:ft(t.textStyle))}function ge(t,e){return t==="Text"&&e==="text"}const Ht={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 jt(t){const e=M[t],n=Ht[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Dt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ct+t.line*gt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*mt,4)),e}const Ct=1,m="--sf-part-para";function Kt(t){t=N(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=X(t.sizeToken);n&&(e.fontSize=U(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Wt(t,e){if(!e)return t;const n=N(t);let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone};else{const o=X(n.sizeToken);o&&(r={...r,size:void 0,sizeToken:o})}return n.alignPhone&&(r={...r,align:n.alignPhone}),r}function w(t,e,n){t=N(t);const r=Lt(t,n),o=Dt(t),i=t.size?`${t.size}px`:t.sizeToken?U(t.sizeToken):r?jt(r):"";return{fontFamily:t.font?vt(t.font):t.fontRole?`var(${v[t.fontRole]})`:r?`var(${v[r]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:o.lineHeight!==void 0?String(o.lineHeight):"",letterSpacing:o.letterSpacingEm!==void 0?`${o.letterSpacingEm}em`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Ft(t.case),textAlign:t.align??"",paddingTop:V(t.padding),paddingBottom:V(t.padding),color:Gt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Gt=t=>t===void 0||t===""?"":Object.hasOwn(L,t)?L[t]:Q(t)===t.toLowerCase()?t:"",V=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function me(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Xt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?P(r/n,3):1.2,letterEm:Number.isFinite(o)?P(o/n,4):0,align:Ut(t.textAlign),case:Mt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Xt(t){return Number.isFinite(t)?lt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Ut(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function Pe(t,e){const n=Y(t);if(!n)return"";for(const r of tt)if(Y(e(r.cssVar))===n)return r.key;return""}const Y=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function vt(t){const e=et(t);return e?`var(${e.cssVar})`:""}function Se(t,e,n,r){return!e||F(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function Te(t,e,n=()=>A,r=c=>c,o=Bt,i=!1,s=()=>!1){let c=0;for(const{element:f,partId:u}of t){const l=F(u)?.propKey;if(!l)continue;const p=r(l),d=Object.hasOwn(e,p)?$(e[p])??{}:{},a=w(Wt(d,i),A,{blockDrawsStyle:s(l)});T(d.textStyle)?f.setAttribute?.(H,d.textStyle):f.removeAttribute?.(H);const h=I.some(x=>f.style[x]);let g=!1;for(const[x,S]of Object.entries(a))Zt(f,x,S),S&&(g=!0);if(h||I.some(x=>a[x]))for(const x of Vt(f,o))for(const S of I)x.style[S]=a[S]??"";g&&(c+=1)}return c}function Vt(t,e){const n=E(t.textContent??""),r=[];let o=t;for(let i=0;i<Yt&&e(o);i+=1){const s=o.parentElement;if(!s||E(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Yt=8;function Bt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Zt(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const r=t.style;typeof r.setProperty=="function"?n?r.setProperty(e,n):r.removeProperty?.(e):r[e]=n;const o=t;e===m&&(n?o.setAttribute?.(B,""):o.removeAttribute?.(B))}const B="data-sf-part-para",qt=Object.keys(w({},A)),z=new Set(["color","overflowWrap",m,"fontStyle"]),I=qt.filter(t=>!z.has(t));function Re(t,e,n,r=c=>c,o=()=>!1,i=()=>null,s=[]){const c=new Map;for(const l of t){const p=nt(l.key,l.row);for(const d of l.texts){const a=c.get(d);a?(a.keys.add(l.key),a.partKeys.add(p)):c.set(d,{keys:new Set([l.key]),partKeys:new Set([p])})}}const f=new Map;for(const l of new Set([...Object.keys(e),...s])){if(!Jt(l))continue;const p=Z(n,l,$(e[l])??{},!1,i(l));p&&f.set(l,p)}const u=new Map;for(const[l,{keys:p,partKeys:d}]of c){const a=d.size===1?[...d][0]:p.size===1?[...p][0]:null;if(!a)continue;const h=r(a),g=i(h);if(!Object.hasOwn(e,h)&&!g)continue;const k=$(e[h])??{},x=Z(n,a,k,o(a),g);x&&u.set(l,x)}return u.size||f.size?{rules:u,kindRules:f,drawn:new Set(c.keys())}:null}function Z(t,e,n,r,o){const i=w(n,A,{blockDrawsStyle:r}),s=Kt(n),c=T(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(s).length&&!c&&!o?null:{stamp:Qt(t,e),declarations:i,...Object.keys(s).length?{phone:s}:{},...c?{textStyle:c}:{},...o?{motion:o}:{}}}function Jt(t){return t.startsWith("@")}function be(t,e){return t?.kindRules.get(e)??null}function Qt(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function _e(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const c=Object.entries(s).filter(([,a])=>a!==""),f=a=>a.map(([h,g])=>`${ee(h)}: ${g}`).join("; "),u=`[${at}="${i}"]`,l=c.filter(([a])=>!z.has(a)),p=c.filter(([a])=>z.has(a));l.length&&e.push(`${u}, *:has(> ${u}) { ${f(l)} }`),p.length&&e.push(`${u} { ${f(p)} }`),s[m]&&(e.push(`*:has(> ${u}) { ${m}: ${s[m]} }`),e.push(...te(u,`*:has(> ${u})`)));const d=Object.entries(o.phone??{}).filter(([,a])=>a!=="");d.length&&e.push(`@media ${rt} { ${u}, *:has(> ${u}) { ${f(d)} } }`),o.motion?.hover==="lift"&&e.push(...$t(`*:has(> ${u})`))};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
|
|
2
|
+
`)}function te(t,e){const n=`var(${m})`,r=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${r}:not(:first-child) { margin-top: ${n} }`,`${t} ${r}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const ee=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Ae(t,e){if(!t)return null;const n=E(e),r=t.rules.get(n);if(r)return r;if(n.length<ne||t.drawn.has(n))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(n)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const ne=8;export{_ as PART_ALIGNS,bt as PART_LETTER_EM_MAX,Rt as PART_LETTER_EM_MIN,mt as PART_LETTER_STEP,Tt as PART_LINE_HEIGHT_MAX,St as PART_LINE_HEIGHT_MIN,gt as PART_LINE_STEP,K as PART_MEASURED_TRACKS,pt as PART_NUDGE_MAX,ut as PART_NUDGE_MIN,xt as PART_PADDING_MAX,dt as PART_PADDING_MIN,ht as PART_PADDING_STEP,B as PART_PARAGRAPH_ATTR,At as PART_PARAGRAPH_MAX,_t as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Pt as PART_RELATIVE_PROPS,C as PART_SIZE_MAX,D as PART_SIZE_MIN,Et as PART_SIZE_STEPS,at as PART_STYLED_ATTR,y as PART_STYLES_PROP,qt as PART_STYLE_PROPERTIES,lt as PART_WEIGHTS,I as SHARED_PART_PROPERTIES,j as STYLE_ID_OF_ROLE,H as TEXT_STYLE_ATTR,Te as applyPartStyles,ge as blockDrawsTextStyle,ue as followedStyleOf,Jt as isPartKindKey,T as isTextStyleId,te as paragraphRules,Mt as partCaseOfTransform,Ft as partCaseTransform,Pe as partFontKeyOf,$t as partLiftRules,Kt as partPhoneDeclarations,be as partRuleForKind,Ae as partRuleForText,Dt as partSpacingOf,me as partStyleBase,de as partStyleCount,_e as partStyleCss,w as partStyleDeclarations,Wt as partStyleForScreen,Se as partStyleSource,xe as propsWithPartStyleValue,he as propsWithoutPartStyle,Re as publishedPartStyles,W as readPartStyle,pe as readPartStyles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as N}from"react/jsx-runtime";import{parseBlockWidthFit as
|
|
1
|
+
import{jsx as N}from"react/jsx-runtime";import{parseBlockWidthFit as R,phoneKey as o}from"efficient-easel/draw";import{blockSizeOf as z,blockSizeValuesOf as E}from"../../content/block-size.js";import{CellWrap as j}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as D,boxRowColumnsClass as C,boxShareClasses as P}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as K}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as A}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as L}from"../part-styles.js";import{addShowWhenFacts as G,withRowRules as h}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as X}from"./cell-width.js";import{findParentNode as Z}from"../../../../format/lib/document/passes/document-position.js";const v=new Set(["Text","Heading"]),U=new Set(["h1","h2","h3","h4","h5","h6"]);function m(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&U.has(e.tag)?!0:L(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},_={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},b={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]};function g(t,e,n){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},n??{field:t,is:e}]}]}}const O={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},M=[[["_gBlockSize","minWidth",o("minWidth"),"maxWidth",o("maxWidth")],c],[["widthFit"],_],[[o("widthFit")],b],[["width"],{all:[_,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[b,g("widthFit","fixed")]}]],W=[[["_gText","textFit",o("textFit")],c],[["minFont"],{all:[c,O]}],[[o("minFont")],{all:[c,g("textFit","shrink",O)]}]],u=(t,e)=>Z(e.appState,t.props?.id),x=t=>!!t&&typeof t.type=="string"&&A(t.type)!==null,k=t=>(t.type==="Flex"||t.type==="HeroGroup")&&K(t.type,t.props?.direction)==="row",B=t=>{const e=R(t);return e!==void 0&&e!=="fit"},V={blockOutsideBox:(t,e)=>!x(u(t,e)),boxSharesWidth:(t,e)=>{const n=u(t,e);return!x(n)||!k(n)?!1:C({...n.props,direction:"row"})!==""?!0:P(n.props?.share)!==""&&!B(t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const n=u(t,e);if(!x(n)||!k(n))return!1;const i=n.props?.phoneRow;return(Number(i)===2||Number(i)===3)&&!D(i,n.props?.[o("share")])&&!B(t.props?.[o("widthFit")]??t.props?.widthFit)}},Y=t=>/^_[gds][A-Z]/.test(t);function q(t,e,n){const i=Object.entries(t),r=i.findIndex(([l])=>l===e);if(r===-1)return null;let s=r+1;for(;s<i.length&&!Y(i[s][0]);)s++;return Object.fromEntries([...i.slice(0,s),...Object.entries(n),...i.slice(s)])}function T(t,e,n){const i=Object.entries(t);return Object.fromEntries([...i.slice(0,e),...Object.entries(n),...i.slice(e)])}function J(t,e,n){const i=Object.keys(e);if(i.includes("_dSize")){const{_gBlockSize:r,...s}=n;return T(e,i.indexOf("_dSize")+1,s)}return Q.has(t)&&i.includes("_gSpacing")?T(e,i.indexOf("_gSpacing"),n):{...e,...n}}const Q=new Set(["Text","Heading"]);function $(t,e){const{_gText:n,...i}=e;return q(t,"_gText",i)??{...t,...e}}function tt(t){const e=new WeakMap;return n=>{if(!n||!("textFit"in n))return n;let i=e.get(n);if(!i){i={...n};for(const r of["textFit",o("textFit")])r in i&&(i[r]=t[r]);e.set(n,i)}return i}}const ut={name:"blockSize",applies:(t,e,n)=>X.includes(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const i=v.has(e),{size:r,text:s}=n.blockSizeFields(i?{textFit:e==="Heading"?"shrink":"wrap"}:{});let l=J(e,t.fields??{},h(r,M));if(i){const a=h(s,W);if(l=$(l,a),e==="Text"){const y=h(n.blockSizeFields({textFit:"shrink"}).text,W),H=tt(y),p=t.resolveFields,I=(S,f)=>{const d=p?p(S,f):f.fields,w=F=>m(e,S?.props??{})?H(F??f.fields):F;return d instanceof Promise?d.then(w):w(d)};t.resolveFields=I}}t.fields=l,G(t,{...V,textWrapsByDefault:a=>!m(e,a.props??{})})},draw(t){et(t)}};function et(t){const e=t.render;t.render=n=>{const i=z(E(n)),r=e(n);return i===null?r:N(j,{className:i.className,...Object.keys(i.style).length?{style:i.style}:{},attrs:i.attrs,children:r})}}export{ut as blockSize,m as textShrinksByDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";import{CardRowDrawn as
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{CardRowDrawn as f}from"../../../components/CardRowContext.js";import{PublishedPartStyles as h}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as P}from"../part-styles.js";import{readPartMotions as p}from"../../animation/part-motion.js";import{partNeedles as y}from"../text-parts.js";const _={name:"clickableParts",applies:(a,e,s)=>typeof s?.render=="function",draw(a,e,s){const r=a,d=()=>r.textParts??r.fields,o=r.render,m=s.inspector?.PartAnchors;r.render=t=>{const i=P(t),c=p(t);return t.editor?.isEditing&&m?n(f,{type:e,props:t,children:l=>n(m,{needles:y(d(),l),styles:i,motions:c,type:e,children:o(t)})}):!Object.keys(i).length&&!Object.keys(c).length?o(t):n(f,{type:e,props:t,children:l=>n(h,{needles:y(d(),l),styles:i,motions:c,type:e,children:o(t)})})}}};export{_ as clickableParts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as t,Fragment as a}from"react/jsx-runtime";import{slugify as i}from"efficient-shell/format";import{useBoxCell as f,useFillsCell as u,useInBox as d}from"../../../components/InBoxContext.js";const h="!grow-0 !shrink-0 !basis-0",x="flex flex-col w-full min-w-0 [&>*]:grow";function c({anchor:n}){const s=i(typeof n=="string"?n:""),e=d();return s?o("span",{id:s,className:e?`sf-section-anchor ${h}`:"sf-section-anchor","aria-hidden":"true"}):null}function A({anchor:n,children:s}){const e=f()?.columnsRow===!0,r=u(),l=i(typeof n=="string"?n:"")!=="";return e&&!r&&l?t("div",{className:x,children:[o(c,{anchor:n}),s]}):t(a,{children:[o(c,{anchor:n}),s]})}const g={name:"sectionAnchor",applies:(n,s,e)=>s.isSection(n)&&!!e&&typeof e.render=="function",panel(n,s,e){const r=e.anchorFields;n.fields={...n.fields,...r()}},draw(n){n.defaultProps={...n.defaultProps,anchor:""};const s=n.render;n.render=e=>o(A,{anchor:e.anchor,children:s(e)})}};export{h as SECTION_ANCHOR_IN_BOX_CLASS,g as sectionAnchor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as _}from"react/jsx-runtime";import{isBackgroundBox as u}from"../../../../format/lib/content/box-background.js";import{SECTION_PAD_KEYS as S,padValuesOf as
|
|
1
|
+
import{jsx as _}from"react/jsx-runtime";import{isBackgroundBox as u}from"../../../../format/lib/content/box-background.js";import{SECTION_PAD_KEYS as S,padValuesOf as m,resolveSectionPadding as g,sectionPadAttrs as p}from"../../content/section-padding.js";import{sectionFillPassClass as T}from"../../../../format/lib/content/section-min-height.js";const l={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120},DetailRows:{top:100,bottom:100}},c=new Set(Object.keys(l)),P=new Set(["Flex","Text","Heading","ImageBlock"]),b=new Set(["Divider"]),I=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),f=new Set(["ProductGrid"]);function a(t,e,o=!1){const r=t.render;t.render=n=>{if(e?.(n))return r(n);const s=p(m(n,S,o)),i=r(n),d=T(n);return s?_("div",{className:d?`${s.className} ${d}`:s.className,style:s.style,children:i}):i}}const h={name:"sectionPadding",applies:(t,e,o)=>e.isSection(t)&&!I.has(t)&&!!o&&typeof o.render=="function",panel(t,e,o){c.has(e)||f.has(e)||(t.fields={...t.fields,...o.sidesPaddingFields({tablet:!0})})},draw(t,e){if(c.has(e)){const o=t.render,r=l[e];t.render=n=>{const s=g(n,r);return o({...n,padTop:s.top,padBottom:s.bottom})};return}if(f.has(e)){a(t);return}P.has(e)||b.has(e)||a(t,e==="Flex"?o=>u(o.bgImage):void 0,!0)}},A=["Heading","Text","ImageBlock"],D=["LogoBlock"],B={name:"blockPadding",applies:(t,e,o)=>(A.includes(t)||D.includes(t))&&!!o&&typeof o.render=="function",panel(t,e,o){t.fields={...t.fields,...o.sidesPaddingFields({tablet:!0})}},draw(t,e){P.has(e)||a(t,void 0,!0)}};export{b as PADS_ITS_OWN_SPACE,P as PAD_ON_ROOT,c as SECTION_PAD_INNER,l as SECTION_PAD_INNER_DEFAULTS,B as blockPadding,h as sectionPadding};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s}from"react/jsx-runtime";import{SlotsStartAfresh as l}from"../../../components/InBoxContext.js";import{NotASectionEdge as d}from"../../../components/SiteGutterFrame.js";const u=new Set(["Flex","Grid"]),i=t=>Object.entries(t.fields??{}).filter(([,e])=>e?.type==="slot").map(([e])=>e),a=new WeakMap;function h(t){const e=a.get(t);if(e)return e;const r=t,n=o=>s(d,{children:s(l,{children:s(r,{...o})})});return Object.assign(n,t),Object.defineProperty(n,"blockCount",{get:()=>t.blockCount,configurable:!0}),a.set(t,n),n}const b={name:"slotsStartAfresh",applies:(t,e,r)=>!u.has(t)&&typeof r?.render=="function"&&i(r).length>0,draw(t){const e=i(t),r=t.render;t.render=n=>{const o={...n};for(const c of e){const f=n[c];typeof f=="function"&&(o[c]=h(f))}return r(o)}}};export{b as slotsStartAfresh};
|
|
@@ -33,6 +33,8 @@ export type SiteFacts = {
|
|
|
33
33
|
deleted?: boolean;
|
|
34
34
|
themePresets?: readonly ThemeColors[] | null;
|
|
35
35
|
selectedPreset?: number | null;
|
|
36
|
+
siteGutter?: number | null;
|
|
37
|
+
siteGutterPhone?: number | null;
|
|
36
38
|
};
|
|
37
39
|
export type ConvertContext = {
|
|
38
40
|
site?: SiteFacts;
|
|
@@ -83,7 +85,8 @@ export type ListPart = {
|
|
|
83
85
|
item?: (item: Props, index: number, node: Props) => ListItemLook;
|
|
84
86
|
perRow?: (node: Props) => number;
|
|
85
87
|
rowName?: string;
|
|
86
|
-
rowProps?:
|
|
88
|
+
rowProps?: OwnProps;
|
|
89
|
+
rowFiller?: Props;
|
|
87
90
|
groups?: ListGroups;
|
|
88
91
|
};
|
|
89
92
|
export type ListGroups = {
|
|
@@ -109,6 +112,7 @@ type PartRowKind = {
|
|
|
109
112
|
key: string;
|
|
110
113
|
role?: TextRole;
|
|
111
114
|
style?: Props;
|
|
115
|
+
styleFrom?: (node: Props, ctx: ConvertContext) => Props;
|
|
112
116
|
props?: Props;
|
|
113
117
|
was?: {
|
|
114
118
|
size: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readHidable as U}from"efficient-easel/draw";import{BOX_TYPE as Z,CONTAINER_BLOCKS_SLOT as ee}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as te,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as oe}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as I}from"../../../format/lib/finite-number.js";import{bucketByGroup as se}from"../../../format/lib/locations-grid.js";import{normalizeTheme as V}from"../../../format/lib/theme.js";const j=Z,E=ee;function be(t){if(t.theme)return V(t.theme);const n=t.site?.themePresets;return n?V({selected:t.site?.selectedPreset??0,themes:[...n]}):void 0}function re(t,n){return n===0?`${t}~box`:`${t}~box-${n+1}`}const R={Flex:"the Box itself",Hero:"its slides hold Boxes of real blocks (Hero › Slide › Box)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function xe(t){for(const[n,i]of Object.entries(t)){if(n in R&&R[n]!==i)throw new Error(`lib/sections/section-to-box: "${n}" is already Box-native`);R[n]=i}}function ge(t){return R[t]}const Y=new Set(["id"]),_={},C=[];function $e(t){for(const[n,i]of Object.entries(t)){if(n in _&&_[n]!==i)throw new Error(`lib/sections/section-to-box: "${n}" already has a row`);_[n]=i}}function we(t){return _[t]}function Oe(){return Object.keys(_)}function Se(t){return t in _&&C.includes(t)}function Be(t){const n=oe[t];if(!n)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const i=[{kind:"text",key:n.num,role:"eyebrow"},{kind:"text",key:n.title,role:"heading"}];return n.description&&i.push({kind:"text",key:n.description,role:"body"}),n.headRows.includes("linkText")&&n.headRows.includes("linkHref")&&i.push({kind:"button",key:"linkText",href:"linkHref"}),i}const H=t=>U(t),Te=t=>H(t).text.trim()!=="";function ie(t){if(t.includes("=="))return t;const n=t.indexOf("/"),i=n===-1?t:t.slice(0,n),a=i.trim();if(!a)return t;const u=i.indexOf(a);return`${i.slice(0,u)}==${a}==${i.slice(u+a.length)}${n===-1?"":t.slice(n)}`}const ae=t=>t==="heading"?te():t==="eyebrow"?ne():{};function ce(t,n,i,a){const f={...t._partStyles?.text??{},...n??{},...i??{}};return(a==="center"||a==="right")&&f.align===void 0&&(f.align=a),Object.keys(f).length?{_partStyles:{text:f}}:{}}function fe(t,n){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const i=n[t.key];return{variant:typeof i=="string"&&Object.hasOwn(t.map,i)?t.map[i]:t.fallback}}function D(t,n,i,a,u={}){const f={...n};for(const h of t){const[m,S,P]=typeof h=="string"?[h,h,void 0]:h;if(i[m]===void 0)continue;const B=P?P(i[m],i,u):i[m];B===void 0?delete f[S]:f[S]=B,a(m,S,B===void 0)}return f}function de(t){const n=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),i=u=>{for(const f of u??[])n.add(typeof f=="string"?f:f[0])},a=u=>{for(const f of u)switch(f.kind){case"text":case"image":n.add(f.key),f.kind==="image"&&f.alt&&n.add(f.alt);break;case"button":n.add(f.key),n.add(f.href),typeof f.variant=="object"&&n.add(f.variant.key);break;case"list":n.add(f.key);break;case"group":case"block":i(f.box),a(f.parts??[]);break;case"core":f.keep!=="rest"&&f.keep.forEach(h=>n.add(h)),Object.keys(f.rename??{}).forEach(h=>n.add(h));for(const h of Object.values(f.slots??{}))for(const m of h)"kind"in m&&n.add(m.key);break}};for(const u of[t,...t.also??[]])i(u.box),a(u.parts);return n}function F(t,n,i={}){const a=t.props,u=n.skip?.(a);if(u!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:u};const f=String(a.id??t.type),h=[],m=[],S=[],P=new Set,B=(o,r)=>{h.push({key:o,home:r}),P.add(o)},X=a._partStyles??{},L=de(n);let q=0;const $=(o,r)=>({type:o,props:{...r,id:`${f}~${o}-${++q}`}}),K=(o,r,k,l,b,d,w)=>{if(b){for(const c of o??[]){const s=typeof c=="string"?c:c[0];k[s]!==void 0&&w(s,`nothing — the ${l} has no parts, so it is not drawn`)}return}const e=typeof r=="function"?r(a,i):r??{};return D(o??[],e,k,(c,s,x)=>w(c,x?`nothing — the old value draws nothing (${l}: no ${s})`:`${d}${l}: ${s}`),i)},M=o=>o.map(r=>{const k={...r.props??{}};for(const[l,b]of Object.entries(r.slots??{}))k[l]=M(b);return $(r.type,k)}),W=(o,r,k)=>{const l=Array.isArray(r[o.key])?r[o.key]:[],b=typeof o.props=="function"?o.props(a,i):o.props??{},d=l.map((s,x)=>{const p=s??{},y=o.item?.(p,x,a)??{},g=v(y.reverse?[...o.parts].reverse():o.parts,p,!1,`item ${x+1}: `);return o.flat?y.props?g.map(T=>({...T,props:{...T.props,...y.props,id:T.props.id}})):g:[$(j,{name:`${o.name} ${x+1}`,...b,...y.props??{},[E]:g})]});if(o.groups){const s=o.groups;return k(o.key,l.length?`one Box per item (${l.length}), in a Box per group`:"nothing — the list is empty"),se(l.map(x=>x??{}),s.of,s.of).map((x,p)=>{const y=x.items.map(O=>O.item),g=s.parts?v(s.parts,s.head?.(y,a)??{},!1,`group ${p+1}: `):[],T=x.items.map(O=>d[O.index]),A=s.perRow?.(y.length,a),N=Number.isInteger(A)&&A>=1?A:1,z=[];if(s.perRow&&N<T.length)for(let O=0;O*N<T.length;O++)z.push(T.slice(O*N,(O+1)*N).flat());return $(j,{name:`${s.name} ${p+1}`,...s.props??{},[E]:[...g,$(j,{name:`${s.itemsName} ${p+1}`,...s.itemsProps?.(y.length,a)??{},[E]:z.length?z.map((O,Q)=>$(j,{name:`${s.rowName??`${s.itemsName} row`} ${Q+1}`,...s.rowProps??{},[E]:O})):T.flat()})]})})}const w=o.perRow?.(a),e=o.perRow?Number.isInteger(w)&&w>=1?w:1:0;if(k(o.key,(l.length?o.flat?`each item's parts (${l.length} items), in order`:`one Box per item (${l.length}), its parts inside`:"nothing — the list is empty")+(e&&l.length?`, in rows of ${e}`:"")),!e)return d.flat();const c=[];for(let s=0;s*e<d.length;s++)c.push($(j,{name:`${o.rowName??`${o.name} row`} ${s+1}`,...o.rowProps??{},[E]:d.slice(s*e,(s+1)*e).flat()}));return c},v=(o,r,k,l)=>{const b=[],d=(e,c)=>k?B(e,c):void 0,w=e=>k?X[e]:void 0;for(const e of o)if(!(e.when&&!e.when(a,k?void 0:r)))switch(e.kind){case"text":{const c=H(r[e.key]);if(!c.text.trim()){d(e.key,"nothing — empty words draw nothing, so no block");break}const s=ae(e.role??"body"),{_partStyles:x,...p}=s,y=ce(s,e.style,w(e.key),e.props?.align);if(e.was&&k){const g=y._partStyles?.text??{};S.push({key:e.key,was:e.was,...typeof g.textStyle=="string"?{textStyle:g.textStyle}:{},...I(g.size)!==void 0?{size:I(g.size)}:{},...I(g.sizePhone)!==void 0?{sizePhone:I(g.sizePhone)}:{}})}b.push($("Text",{text:e.mark==="accentLead"?ie(c.text):c.text,...p,...e.props??{},...y,...c.hidden?{_hidden:!0}:{}})),d(e.key,`${l}Text block: its words${c.hidden?", hidden":""}`);break}case"button":{const c=H(r[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 s=typeof r[e.href]=="string"&&r[e.href]?r[e.href]:"#",x={...e.style??{},...w(e.key)??{}};b.push($("ButtonBlock",{label:c.text,href:s,...typeof e.props=="function"?e.props(r,i):e.props??{},...fe(e.variant,r),...Object.keys(x).length?{_partStyles:{label:x}}:{},...c.hidden?{_hidden:!0}:{}})),d(e.key,`${l}Button block: its words`),d(e.href,`${l}Button block: its link`),typeof e.variant=="object"&&d(e.variant.key,`${l}Button block: its Style`);break}case"image":{const c=r[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 s=e.alt&&typeof r[e.alt]=="string"?r[e.alt]:"";b.push($("ImageBlock",{src:c,alt:s,...e.props??{}})),d(e.key,`${l}Image block: its picture`),e.alt&&d(e.alt,`${l}Image block: its alt text`);break}case"list":{b.push(...W(e,r,d));break}case"group":{const c=v(e.parts,r,k,l),s=K(e.box,e.props,r,`${e.name} Box`,!c.length&&!e.keepEmpty,l,d);s&&b.push($(j,{name:e.name,...s,[E]:c}));break}case"block":{const c=e.parts?v(e.parts,r,k,l):[],s=K(e.box,e.props,r,`${e.type} block`,!!e.parts&&!c.length&&!e.keepEmpty,l,d);s&&b.push($(e.type,{...s,...e.slot?{[e.slot]:c}:{}}));break}case"core":{const c=e.as??t.type,s={headPlacement:"own-box",...e.props??{}},x=e.keep==="rest"?Object.keys(r).filter(p=>!L.has(p)&&!(p in s)):e.keep;for(const p of x)r[p]!==void 0&&(s[p]=r[p],d(p,`the ${c} block inside the Box`));if(e.keep==="rest"){for(const y of Object.keys(e.props??{}))r[y]!==void 0&&!L.has(y)&&d(y,`nothing — the ${c} block inside the Box has the row's own value`);r.headPlacement!==void 0&&d("headPlacement",`the ${c} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(X).filter(([y])=>!L.has(y)));Object.keys(p).length&&(s._partStyles=p)}for(const[p,y]of Object.entries(e.rename??{}))r[p]!==void 0&&(s[y]=r[p],d(p,`the ${c} block inside the Box: ${y}`));for(const[p,y]of Object.entries(e.slots??{}))s[p]=y.flatMap(g=>"kind"in g?W(g,r,d):M([g]));b.push($(c,s));break}}return b},J=(o,r)=>{const k=r===0?"Box":`${o.name} Box`,l=v(o.parts,a,!0,r===0?"":`${k}: `),b=typeof o.boxProps=="function"?o.boxProps(a,i):o.boxProps??{},d=D(o.box??[],b,a,(w,e,c)=>B(w,c?`nothing — the old value draws nothing (${k}: no ${e})`:`${k}: ${e}`),i);return{type:j,props:{name:o.name,...d,[E]:l,id:re(f,r)}}},G=[n,...n.also??[]].map(J);a._partStyles!==void 0&&B("_partStyles","each old part's style moved to its new part");for(const[o,r]of Object.entries(n.reads??{}))a[o]!==void 0&&B(o,r);for(const[o,r]of Object.entries(n.drop??{}))o in a&&(m.push({key:o,why:r}),P.add(o));for(const o of Object.keys(a))Y.has(o)||P.has(o)||m.push({key:o,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:h,dropped:m,siteWrites:[...n.site?.(t,i)??[]],restyled:S}}function _e(t,n=C,i={}){const a=t.content;if(!Array.isArray(a))return t;let u=!1;const f=a.flatMap(h=>{const m=h&&typeof h.type=="string"&&n.includes(h.type)?_[h.type]:void 0;if(!m)return[h];const S=F(h,m,i);return S.skipped!==void 0?[h]:(u=!0,S.nodes)});return u?{...t,content:f}:t}function je(t,n=C,i={}){if(!Array.isArray(t))return[];const a=[];return t.forEach((u,f)=>{const h=u&&typeof u.type=="string"&&n.includes(u.type)?_[u.type]:void 0;if(!h)return;const m=F(u,h,i);m.skipped===void 0&&a.push({index:f,node:m.node,nodes:m.nodes})}),a}export{E as SECTION_BOX_SLOT,j as SECTION_BOX_TYPE,C as SECTION_TO_BOX_ON,ge as boxNativeReason,F as convertSection,_e as convertSectionsInPage,be as convertTheme,Se as convertsToBox,Te as hasWords,Be as headParts,xe as registerBoxNativeSections,$e as registerSectionToBox,re as sectionBoxIdOf,je as sectionToBoxEdits,we as sectionToBoxRow,Oe as sectionToBoxTypes};
|
|
1
|
+
import{readHidable as Z}from"efficient-easel/draw";import{BOX_TYPE as ee,CONTAINER_BLOCKS_SLOT as te}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as oe,labelTextSeed as ne}from"../../../format/lib/document/text-seeds.js";import{SPLITTABLE_SECTIONS as se}from"../../../format/lib/sections/section-head-placement.js";import{finiteNumber as R}from"../../../format/lib/finite-number.js";import{bucketByGroup as re}from"../../../format/lib/locations-grid.js";import{normalizeTheme as V}from"../../../format/lib/theme.js";const _=ee,P=te;function ge(t){if(t.theme)return V(t.theme);const o=t.site?.themePresets;return o?V({selected:t.site?.selectedPreset??0,themes:[...o]}):void 0}function ie(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)",Divider:"one block with no text, picture or button",CustomHTML:"the HTML box is the whole section; it has no parts"};function xe(t){for(const[o,r]of Object.entries(t)){if(o in A&&A[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);A[o]=r}}function we(t){return A[t]}const Y=new Set(["id"]),j={},H=[];function $e(t){for(const[o,r]of Object.entries(t)){if(o in j&&j[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);j[o]=r}}function Oe(t){return j[t]}function Se(){return Object.keys(j)}function Be(t){return t in j&&H.includes(t)}function Te(t){const o=se[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const r=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&r.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&r.push({kind:"button",key:"linkText",href:"linkHref"}),r}const F=t=>Z(t),_e=t=>F(t).text.trim()!=="";function ae(t){if(t.includes("=="))return t;const o=t.indexOf("/"),r=o===-1?t:t.slice(0,o),i=r.trim();if(!i)return t;const h=r.indexOf(i);return`${r.slice(0,h)}==${i}==${r.slice(h+i.length)}${o===-1?"":t.slice(o)}`}const ce=t=>t==="heading"?oe():t==="eyebrow"?ne():{};function fe(t,o,r,i){const c={...t._partStyles?.text??{},...o??{},...r??{}};return(i==="center"||i==="right")&&c.align===void 0&&(c.align=i),Object.keys(c).length?{_partStyles:{text:c}}:{}}function le(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const r=o[t.key];return{variant:typeof r=="string"&&Object.hasOwn(t.map,r)?t.map[r]:t.fallback}}function D(t,o,r,i,h={}){const c={...o};for(const y of t){const[g,S,v]=typeof y=="string"?[y,y,void 0]:y;if(r[g]===void 0)continue;const B=v?v(r[g],r,h):r[g];B===void 0?delete c[S]:c[S]=B,i(g,S,B===void 0)}return c}function de(t){const o=new Set([...Y,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),r=h=>{for(const c of h??[])o.add(typeof c=="string"?c:c[0])},i=h=>{for(const c of h)switch(c.kind){case"text":case"image":o.add(c.key),c.kind==="image"&&c.alt&&o.add(c.alt);break;case"button":o.add(c.key),o.add(c.href),typeof c.variant=="object"&&o.add(c.variant.key);break;case"list":o.add(c.key);break;case"group":case"block":r(c.box),i(c.parts??[]);break;case"core":c.keep!=="rest"&&c.keep.forEach(y=>o.add(y)),Object.keys(c.rename??{}).forEach(y=>o.add(y));for(const y of Object.values(c.slots??{}))for(const g of y)"kind"in g&&o.add(g.key);break}};for(const h of[t,...t.also??[]])r(h.box),i(h.parts);return o}function q(t,o,r={}){const i=t.props,h=o.skip?.(i);if(h!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:h};const c=String(i.id??t.type),y=[],g=[],S=[],v=new Set,B=(n,s)=>{y.push({key:n,home:s}),v.add(n)},X=i._partStyles??{},L=de(o);let J=0;const w=(n,s)=>({type:n,props:{...s,id:`${c}~${n}-${++J}`}}),K=(n,s,b,u,x,l,$)=>{if(x){for(const a of n??[]){const p=typeof a=="string"?a:a[0];b[p]!==void 0&&$(p,`nothing — the ${u} has no parts, so it is not drawn`)}return}const e=typeof s=="function"?s(i,r):s??{};return D(n??[],e,b,(a,p,f)=>$(a,f?`nothing — the old value draws nothing (${u}: no ${p})`:`${l}${u}: ${p}`),r)},M=n=>n.map(s=>{const b={...s.props??{}};for(const[u,x]of Object.entries(s.slots??{}))b[u]=M(x);return w(s.type,b)}),W=(n,s,b)=>{const u=Array.isArray(s[n.key])?s[n.key]:[],x=typeof n.props=="function"?n.props(i,r):n.props??{},l=u.map((f,d)=>{const k=f??{},m=n.item?.(k,d,i)??{},E=N(m.reverse?[...n.parts].reverse():n.parts,k,!1,`item ${d+1}: `);return n.flat?m.props?E.map(T=>({...T,props:{...T.props,...m.props,id:T.props.id}})):E:[w(_,{name:`${n.name} ${d+1}`,...x,...m.props??{},[P]:E})]});if(n.groups){const f=n.groups;return b(n.key,u.length?`one Box per item (${u.length}), in a Box per group`:"nothing — the list is empty"),re(u.map(d=>d??{}),f.of,f.of).map((d,k)=>{const m=d.items.map(O=>O.item),E=f.parts?N(f.parts,f.head?.(m,i)??{},!1,`group ${k+1}: `):[],T=d.items.map(O=>l[O.index]),z=f.perRow?.(m.length,i),I=Number.isInteger(z)&&z>=1?z:1,C=[];if(f.perRow&&I<T.length)for(let O=0;O*I<T.length;O++)C.push(T.slice(O*I,(O+1)*I).flat());return w(_,{name:`${f.name} ${k+1}`,...f.props??{},[P]:[...E,w(_,{name:`${f.itemsName} ${k+1}`,...f.itemsProps?.(m.length,i)??{},[P]:C.length?C.map((O,U)=>w(_,{name:`${f.rowName??`${f.itemsName} row`} ${U+1}`,...f.rowProps??{},[P]:O})):T.flat()})]})})}const $=n.perRow?.(i),e=n.perRow?Number.isInteger($)&&$>=1?$:1:0;if(b(n.key,(u.length?n.flat?`each item's parts (${u.length} items), in order`:`one Box per item (${u.length}), its parts inside`:"nothing — the list is empty")+(e&&u.length?`, in rows of ${e}`:"")),!e)return l.flat();const a=typeof n.rowProps=="function"?n.rowProps(i,r):n.rowProps??{},p=[];for(let f=0;f*e<l.length;f++){const d=l.slice(f*e,(f+1)*e).flat(),k=n.rowFiller?e-l.slice(f*e,(f+1)*e).length:0;p.push(w(_,{name:`${n.rowName??`${n.name} row`} ${f+1}`,...a,[P]:[...d,...Array.from({length:k},(m,E)=>w(_,{name:`Empty ${E+1}`,...n.rowFiller,[P]:[]}))]}))}return p},N=(n,s,b,u)=>{const x=[],l=(e,a)=>b?B(e,a):void 0,$=e=>b?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(i,b?void 0:s)))switch(e.kind){case"text":{const a=F(s[e.key]);if(!a.text.trim()){l(e.key,"nothing — empty words draw nothing, so no block");break}const p=ce(e.role??"body"),{_partStyles:f,...d}=p,k=fe(p,e.styleFrom?{...e.style,...e.styleFrom(i,r)}:e.style,$(e.key),e.props?.align);if(e.was&&b){const m=k._partStyles?.text??{};S.push({key:e.key,was:e.was,...typeof m.textStyle=="string"?{textStyle:m.textStyle}:{},...R(m.size)!==void 0?{size:R(m.size)}:{},...R(m.sizePhone)!==void 0?{sizePhone:R(m.sizePhone)}:{}})}x.push(w("Text",{text:e.mark==="accentLead"?ae(a.text):a.text,...d,...e.props??{},...k,...a.hidden?{_hidden:!0}:{}})),l(e.key,`${u}Text block: its words${a.hidden?", hidden":""}`);break}case"button":{const a=F(s[e.key]);if(!a.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 p=typeof s[e.href]=="string"&&s[e.href]?s[e.href]:"#",f={...e.style??{},...$(e.key)??{}};x.push(w("ButtonBlock",{label:a.text,href:p,...typeof e.props=="function"?e.props(s,r):e.props??{},...le(e.variant,s),...Object.keys(f).length?{_partStyles:{label:f}}:{},...a.hidden?{_hidden:!0}:{}})),l(e.key,`${u}Button block: its words`),l(e.href,`${u}Button block: its link`),typeof e.variant=="object"&&l(e.variant.key,`${u}Button block: its Style`);break}case"image":{const a=s[e.key];if(typeof a!="string"||!a){l(e.key,"nothing — no picture, no block"),e.alt&&l(e.alt,"nothing — no picture to describe");break}const p=e.alt&&typeof s[e.alt]=="string"?s[e.alt]:"";x.push(w("ImageBlock",{src:a,alt:p,...e.props??{}})),l(e.key,`${u}Image block: its picture`),e.alt&&l(e.alt,`${u}Image block: its alt text`);break}case"list":{x.push(...W(e,s,l));break}case"group":{const a=N(e.parts,s,b,u),p=K(e.box,e.props,s,`${e.name} Box`,!a.length&&!e.keepEmpty,u,l);p&&x.push(w(_,{name:e.name,...p,[P]:a}));break}case"block":{const a=e.parts?N(e.parts,s,b,u):[],p=K(e.box,e.props,s,`${e.type} block`,!!e.parts&&!a.length&&!e.keepEmpty,u,l);p&&x.push(w(e.type,{...p,...e.slot?{[e.slot]:a}:{}}));break}case"core":{const a=e.as??t.type,p={headPlacement:"own-box",...e.props??{}},f=e.keep==="rest"?Object.keys(s).filter(d=>!L.has(d)&&!(d in p)):e.keep;for(const d of f)s[d]!==void 0&&(p[d]=s[d],l(d,`the ${a} block inside the Box`));if(e.keep==="rest"){for(const k of Object.keys(e.props??{}))s[k]!==void 0&&!L.has(k)&&l(k,`nothing — the ${a} block inside the Box has the row's own value`);s.headPlacement!==void 0&&l("headPlacement",`the ${a} block inside the Box: own-box`);const d=Object.fromEntries(Object.entries(X).filter(([k])=>!L.has(k)));Object.keys(d).length&&(p._partStyles=d)}for(const[d,k]of Object.entries(e.rename??{}))s[d]!==void 0&&(p[k]=s[d],l(d,`the ${a} block inside the Box: ${k}`));for(const[d,k]of Object.entries(e.slots??{}))p[d]=k.flatMap(m=>"kind"in m?W(m,s,l):M([m]));x.push(w(a,p));break}}return x},Q=(n,s)=>{const b=s===0?"Box":`${n.name} Box`,u=N(n.parts,i,!0,s===0?"":`${b}: `),x=typeof n.boxProps=="function"?n.boxProps(i,r):n.boxProps??{},l=D(n.box??[],x,i,($,e,a)=>B($,a?`nothing — the old value draws nothing (${b}: no ${e})`:`${b}: ${e}`),r);return{type:_,props:{name:n.name,...l,[P]:u,id:ie(c,s)}}},G=[o,...o.also??[]].map(Q);i._partStyles!==void 0&&B("_partStyles","each old part's style moved to its new part");for(const[n,s]of Object.entries(o.reads??{}))i[n]!==void 0&&B(n,s);for(const[n,s]of Object.entries(o.drop??{}))n in i&&(g.push({key:n,why:s}),v.add(n));for(const n of Object.keys(i))Y.has(n)||v.has(n)||g.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:y,dropped:g,siteWrites:[...o.site?.(t,r)??[]],restyled:S}}function Pe(t,o=H,r={}){const i=t.content;if(!Array.isArray(i))return t;let h=!1;const c=i.flatMap(y=>{const g=y&&typeof y.type=="string"&&o.includes(y.type)?j[y.type]:void 0;if(!g)return[y];const S=q(y,g,r);return S.skipped!==void 0?[y]:(h=!0,S.nodes)});return h?{...t,content:c}:t}function je(t,o=H,r={}){if(!Array.isArray(t))return[];const i=[];return t.forEach((h,c)=>{const y=h&&typeof h.type=="string"&&o.includes(h.type)?j[h.type]:void 0;if(!y)return;const g=q(h,y,r);g.skipped===void 0&&i.push({index:c,node:g.node,nodes:g.nodes})}),i}export{P as SECTION_BOX_SLOT,_ as SECTION_BOX_TYPE,H as SECTION_TO_BOX_ON,we as boxNativeReason,q as convertSection,Pe as convertSectionsInPage,ge as convertTheme,Be as convertsToBox,_e as hasWords,Te as headParts,xe as registerBoxNativeSections,$e as registerSectionToBox,ie as sectionBoxIdOf,je as sectionToBoxEdits,Oe as sectionToBoxRow,Se as sectionToBoxTypes};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type TextStyle, type TextStyleCase } from "efficient-easel/text-styles/model";
|
|
1
|
+
import { type TextStyle, type TextStyleCase, type TextStyleDevice } from "efficient-easel/text-styles/model";
|
|
2
2
|
import { type FontRole, type FontsValue } from "../../../format/lib/fonts.js";
|
|
3
|
+
import { viewRules } from "../content/view-values.js";
|
|
3
4
|
import { type PartStyle } from "../document/part-styles.js";
|
|
4
5
|
import { faceClassOf } from "../../../format/lib/text-style-face.js";
|
|
5
6
|
export { faceClassOf };
|
|
@@ -17,6 +18,15 @@ export type StoredTextStyleValues = {
|
|
|
17
18
|
letterCase?: TextStyleCase;
|
|
18
19
|
largestSize?: number;
|
|
19
20
|
sizePhone?: number;
|
|
21
|
+
sizeTablet?: number;
|
|
22
|
+
lineHeightTablet?: number;
|
|
23
|
+
lineHeightPhone?: number;
|
|
24
|
+
letterSpacingTablet?: number;
|
|
25
|
+
letterSpacingPhone?: number;
|
|
26
|
+
paragraphSpacingTablet?: number;
|
|
27
|
+
paragraphSpacingPhone?: number;
|
|
28
|
+
largestSizeTablet?: number;
|
|
29
|
+
largestSizePhone?: number;
|
|
20
30
|
};
|
|
21
31
|
export type StoredTextStyle = {
|
|
22
32
|
id: string;
|
|
@@ -31,16 +41,18 @@ export type OldSiteText = {
|
|
|
31
41
|
compression: string;
|
|
32
42
|
typography: Partial<ResolvedHeadingTypography> | Record<string, unknown>;
|
|
33
43
|
};
|
|
44
|
+
export declare function viewSizeOf(values: StoredTextStyleValues, desktopPx: number, view: TextStyleDevice, rules?: ReturnType<typeof viewRules>): number;
|
|
34
45
|
export declare function textStylesFromOld(old: OldSiteText): StoredTextStyle[];
|
|
35
46
|
export declare function storedTextStyles(value: unknown): StoredTextStyle[];
|
|
36
47
|
export declare function listToWrite(saved: unknown): StoredTextStyle[];
|
|
37
48
|
export declare function resolveTextStyles(saved: unknown, old: OldSiteText): StoredTextStyle[];
|
|
38
|
-
export declare function applyListChange({ saved, old, cur, next, sizeOf, }: {
|
|
49
|
+
export declare function applyListChange({ saved, old, cur, next, sizeOf, panelView, }: {
|
|
39
50
|
saved: unknown;
|
|
40
51
|
old: OldSiteText;
|
|
41
52
|
cur: readonly TextStyle[];
|
|
42
53
|
next: readonly TextStyle[];
|
|
43
54
|
sizeOf: (style: StoredTextStyle) => number;
|
|
55
|
+
panelView?: TextStyleDevice;
|
|
44
56
|
}): {
|
|
45
57
|
saved: StoredTextStyle[];
|
|
46
58
|
old: OldSiteText;
|
|
@@ -49,8 +61,8 @@ export declare function listChangePatch(next: {
|
|
|
49
61
|
saved: StoredTextStyle[];
|
|
50
62
|
old: OldSiteText;
|
|
51
63
|
}, prev: OldSiteText): SiteThemeRowPatch;
|
|
52
|
-
export declare function toPanelStyles(stored: readonly StoredTextStyle[], sizeOf: (s: StoredTextStyle) => number): TextStyle[];
|
|
53
|
-
export declare function fromPanelStyles(list: readonly TextStyle[], sizeOf: (s: StoredTextStyle) => number): StoredTextStyle[];
|
|
64
|
+
export declare function toPanelStyles(stored: readonly StoredTextStyle[], sizeOf: (s: StoredTextStyle) => number, device?: TextStyleDevice): TextStyle[];
|
|
65
|
+
export declare function fromPanelStyles(list: readonly TextStyle[], sizeOf: (s: StoredTextStyle) => number, device?: TextStyleDevice): StoredTextStyle[];
|
|
54
66
|
export type SiteTextSeed = {
|
|
55
67
|
fonts: FontsValue;
|
|
56
68
|
sizes: SizesValue;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defaultTextStyles as
|
|
2
|
-
`)}const
|
|
1
|
+
import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{parseHexColor as pe}from"efficient-shell/format";import{FONT_OPTIONS as fe,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as ue,TABLET_MEDIA as ge,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as he,TEXT_STYLE_ATTR as me,paragraphRules as Z,partSpacingOf as Se}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{compressionMetrics as ye,headingTypographyFromRow as be,normalizeHeadingCompression as E,normalizeSizes as Q}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as O}from"../../../format/lib/non-empty-string.js";const N=e=>e==="sentence"?"none":void 0,ee=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],T=["desktop","tablet","phone"],C=(e,t)=>t==="desktop"?e:t==="tablet"?de(e):ce(e),k=(e,t)=>t==="desktop"?e:le(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const xe=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function V(e){for(const[t,i,n]of xe)for(const o of T)if(e===k(t,o))return{key:C(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ee)e[i]!==void 0&&(t[i]=e[i]);return t}function M(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ee.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function ne(e){const t=e.fonts,i=e.sizes,n=e.typography,o=ye(e.compression),r={"heading-1":{font:O(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case),largestSize:v(n.maxPx)},"heading-2":{font:O(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case2)},"heading-3":{font:O(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case3)},"body-1":{font:O(t.body),size:v(i.body)},"body-5":{font:O(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function I(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>M({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return I(e)??[]}function te(e){return I(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function R(e,t){const i=ne(t),n=I(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},ie=["heading-1","heading-2","heading-3"];function Ve({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=ne(t),l=te(e),d=R(l,t),c=[],f=n.map(a=>{const S=i.find(m=>m.id===a.id),g=l.find(m=>m.id===a.id);if(!S||!g)return ze([a],o,r)[0];const p={...g.values},x=new Set(g.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(m=>JSON.stringify(y[m])!==JSON.stringify(_[m])),D=m=>V(m).spacing==="letter";z.sort((m,L)=>Number(D(m))-Number(D(L)));for(const m of z){const{key:L,view:ae,spacing:K}=V(m),$=L,P=y[m];if(P===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=w(P/100,3);else if(K==="letter"){const W={...d.find(A=>A.id===a.id)?.values??{}};for(const A of z)y[A]===void 0&&delete W[V(A).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),ae);p[$]=J?w(P/J,4):0}else p[$]=P}return M({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&ie.includes(a))&&E(u)!=="normal"){for(const a of ie){const S=f.find(p=>p.id===a);if(!S)continue;const g={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||g[p]===void 0&&!(S.auto??[]).includes(p)&&(g[p]=F(s,a)[p]);S.values=b(g)}u="normal"}return{saved:f,old:{...t,compression:u}}}function Me(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=E(e.old.compression)),i}const w=(e,t)=>Number(e.toFixed(t)),oe=(e,t)=>T.indexOf(e)<T.indexOf(t)?t:e;function Re(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of T){const l=C("lineHeight",s),d=n.values[l],c=n.values[C("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=w(d*100,1));const f=oe(s,i);c!==void 0&&(o[k("letterSpacing",s)]=w(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function ze(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of T)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=t({...s,values:{...s.values}});for(const c of T){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[C("lineHeight",c)]=w(f/100,3)),typeof u=="number"){const h=j(s.values,d,oe(c,i));l[C("letterSpacing",c)]=h?w(u/h,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:Q({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:E(e.heading_compression),typography:be(e)},i=e.text_styles??null,n=Array.isArray(i)?se(R(i,t),t):t;return{fonts:U(n.fonts),sizes:Q(n.sizes),compression:E(n.compression),typography:n.typography,textStyles:i}}function se(e,t){const i=h=>e.find(a=>a.id===h)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,f=t.typography,u=h=>h==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:t.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function De(e){const t=I(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=se(R(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function ve(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":pe(e)===e.toLowerCase()?e:null}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${me}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?fe.find(h=>h.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const h=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${h}px`)}const c=n.color!==void 0?ve(n.color):null;c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),i.kind==="body"&&l.push(...f);const u=re(n.letterCase);u&&i.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&u&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
|
|
2
|
+
`)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",ge],["phone",ue]]){const g=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&g.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&g.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&g.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&g.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&u&&g.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),g.length&&h.push(`@media ${S} { ${g.join(" ")} }`)}return h}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?he[e]:void 0}function ke(e){const t=Se(e);return b({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=te(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?M({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Ve as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ze as fromPanelStyles,Je as hasStyleChange,Me as listChangePatch,te as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,R as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,ne as textStylesFromOld,se as textStylesToOld,De as themeWithTextStyles,Re as toPanelStyles,j as viewSizeOf};
|