efficient-web-builder 45.0.0 → 47.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.
Files changed (122) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +6 -0
  3. package/dist/editor/components/ApplyCornersToSiblings.d.ts +1 -3
  4. package/dist/editor/components/ApplyCornersToSiblings.js +1 -1
  5. package/dist/editor/components/PagesPanel.js +1 -1
  6. package/dist/editor/components/PartSettingsPanel.js +1 -1
  7. package/dist/editor/components/SectionThumbnail.js +1 -1
  8. package/dist/editor/components/StorefrontEditor.js +1 -1
  9. package/dist/editor/components/WebsiteScreenParts.js +1 -1
  10. package/dist/editor/components/useSectionToBoxPass.d.ts +8 -1
  11. package/dist/editor/components/useSectionToBoxPass.js +1 -1
  12. package/dist/editor/components/useSocialSettings.d.ts +2 -2
  13. package/dist/editor/lib/animation/entrance-fields.js +1 -1
  14. package/dist/editor/lib/document/ColourControl.d.ts +4 -7
  15. package/dist/editor/lib/document/ColourControl.js +1 -1
  16. package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
  17. package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/general/Eyebrow/fields.js +1 -1
  19. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  20. package/dist/editor/lib/document/blocks/general/Grid/fields.js +1 -1
  21. package/dist/editor/lib/document/blocks/general/Heading/fields.js +1 -1
  22. package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
  23. package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
  24. package/dist/editor/lib/document/blocks/general/HeroSingle/fields.js +1 -1
  25. package/dist/editor/lib/document/blocks/general/LogoBlock/fields.js +1 -1
  26. package/dist/editor/lib/document/blocks/general/Split/fields.js +1 -1
  27. package/dist/editor/lib/document/blocks/general/Text/fields.js +1 -1
  28. package/dist/editor/lib/document/blocks/general/TitleWithButtons/fields.js +1 -1
  29. package/dist/editor/lib/document/blocks/shared-fields.d.ts +0 -1
  30. package/dist/editor/lib/document/blocks/shared-fields.js +1 -1
  31. package/dist/editor/lib/document/box-fields.d.ts +6 -1
  32. package/dist/editor/lib/document/box-fields.js +1 -1
  33. package/dist/editor/lib/document/canvas-typing.js +1 -1
  34. package/dist/editor/lib/document/consent-words-field.d.ts +1 -2
  35. package/dist/editor/lib/document/consent-words-field.js +1 -1
  36. package/dist/editor/lib/document/controls.d.ts +7 -60
  37. package/dist/editor/lib/document/controls.js +1 -1
  38. package/dist/editor/lib/document/part-panel-rows.js +1 -1
  39. package/dist/editor/lib/document/passes/inspector.js +1 -1
  40. package/dist/editor/lib/sections/city-presets.d.ts +4 -0
  41. package/dist/editor/lib/sections/city-presets.js +1 -0
  42. package/dist/editor/lib/sections/text-layouts.d.ts +1 -1
  43. package/dist/editor/lib/sections/text-layouts.js +1 -1
  44. package/dist/format/lib/content/block-align.d.ts +2 -0
  45. package/dist/format/lib/content/block-align.js +1 -1
  46. package/dist/format/lib/content/section-corners.d.ts +2 -4
  47. package/dist/format/lib/content/section-corners.js +1 -1
  48. package/dist/format/lib/document/box-footer.js +1 -1
  49. package/dist/format/lib/document/easel-row-words.d.ts +6 -0
  50. package/dist/format/lib/document/easel-row-words.js +1 -0
  51. package/dist/format/lib/document/passes/types.d.ts +2 -1
  52. package/dist/format/lib/editor-words-catalogue.d.ts +4 -6
  53. package/dist/format/lib/editor-words-catalogue.js +3 -3
  54. package/dist/format/lib/source-rules/one-alignment-row.d.ts +9 -0
  55. package/dist/format/lib/source-rules/one-alignment-row.js +7 -0
  56. package/dist/format/lib/theme.d.ts +4 -0
  57. package/dist/format/lib/theme.js +4 -4
  58. package/dist/render/components/ButtonBlock.d.ts +3 -0
  59. package/dist/render/components/ButtonBlock.js +1 -1
  60. package/dist/render/components/Eyebrow.d.ts +2 -1
  61. package/dist/render/components/Eyebrow.js +1 -1
  62. package/dist/render/components/Flex.js +1 -1
  63. package/dist/render/components/Grid.d.ts +2 -1
  64. package/dist/render/components/Grid.js +1 -1
  65. package/dist/render/components/Heading.d.ts +2 -4
  66. package/dist/render/components/Heading.js +1 -1
  67. package/dist/render/components/HeroGroup.d.ts +2 -1
  68. package/dist/render/components/HeroGroup.js +1 -1
  69. package/dist/render/components/InBoxContext.d.ts +23 -1
  70. package/dist/render/components/InBoxContext.js +1 -1
  71. package/dist/render/components/LogoBlock.d.ts +1 -0
  72. package/dist/render/components/LogoBlock.js +1 -1
  73. package/dist/render/components/PreviewHeaderContext.d.ts +11 -1
  74. package/dist/render/components/PreviewHeaderContext.js +1 -1
  75. package/dist/render/components/SectionAnimation.js +1 -1
  76. package/dist/render/components/Split.d.ts +2 -1
  77. package/dist/render/components/Split.js +1 -1
  78. package/dist/render/components/Text.d.ts +3 -2
  79. package/dist/render/components/Text.js +1 -1
  80. package/dist/render/components/TitleWithButtons.d.ts +2 -1
  81. package/dist/render/components/TitleWithButtons.js +1 -1
  82. package/dist/render/lib/content/block-size.d.ts +19 -0
  83. package/dist/render/lib/content/block-size.js +1 -0
  84. package/dist/render/lib/content/button-look.d.ts +6 -6
  85. package/dist/render/lib/content/button-look.js +1 -1
  86. package/dist/render/lib/document/blocks/general/ButtonBlock/render.js +1 -1
  87. package/dist/render/lib/document/blocks/general/Eyebrow/render.js +1 -1
  88. package/dist/render/lib/document/blocks/general/Grid/render.js +1 -1
  89. package/dist/render/lib/document/blocks/general/Heading/render.js +1 -1
  90. package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
  91. package/dist/render/lib/document/blocks/general/LocationMap/render.js +1 -1
  92. package/dist/render/lib/document/blocks/general/LogoBlock/render.js +1 -1
  93. package/dist/render/lib/document/blocks/general/Split/render.js +1 -1
  94. package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
  95. package/dist/render/lib/document/blocks/general/TitleWithButtons/render.js +1 -1
  96. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  97. package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.d.ts +1 -1
  98. package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
  99. package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
  100. package/dist/render/lib/document/page-render.js +1 -1
  101. package/dist/render/lib/document/part-styles.d.ts +1 -0
  102. package/dist/render/lib/document/part-styles.js +2 -2
  103. package/dist/render/lib/document/passes/block-size.js +1 -1
  104. package/dist/render/lib/document/passes/index.js +1 -1
  105. package/dist/render/lib/document/passes/section-height.js +1 -1
  106. package/dist/render/lib/document/passes/section-sticky.js +1 -1
  107. package/dist/render/lib/document/passes/section-theme.js +1 -1
  108. package/dist/render/lib/document/passes/slots-start-afresh.d.ts +2 -0
  109. package/dist/render/lib/document/passes/slots-start-afresh.js +1 -0
  110. package/dist/render/lib/document/text-parts.d.ts +4 -0
  111. package/dist/render/lib/document/text-parts.js +1 -1
  112. package/dist/render/lib/media.d.ts +0 -1
  113. package/dist/render/lib/media.js +1 -1
  114. package/dist/render/lib/sections/section-to-box.d.ts +5 -3
  115. package/dist/render/lib/sections/section-to-box.js +1 -1
  116. package/package.json +3 -3
  117. package/dist/editor/components/DuplicatePageDialog.d.ts +0 -10
  118. package/dist/editor/components/DuplicatePageDialog.js +0 -1
  119. package/dist/editor/lib/page-copy.d.ts +0 -6
  120. package/dist/editor/lib/page-copy.js +0 -1
  121. package/dist/format/lib/content/block-size.d.ts +0 -59
  122. package/dist/format/lib/content/block-size.js +0 -1
@@ -1,3 +1,3 @@
1
- import{BUTTON as g,DIM as s,bandAccent as S,bandIndex as _,bandPage as E,bandWrites as I,DROP_COMMON as h,DROP_SIDE_PADDING as m,INNER_BOX as i,SAME_KEYS as b,SECTION_BOX as y,TEXT as l,headingCaseOf as u,innerPad as x,innerPadKeys as k}from"./section-to-box-row-parts.js";import{splitParagraphs as B}from"../../../../components/goldPhrases.js";import{TIMELINE_YEAR_BOX as O,TIMELINE_YEAR_HEAD as w}from"../../../../../format/lib/sections/timeline-year-shape.js";const A="jetbrains-mono",P="space-grotesk",r=(e,t,o={})=>({textStyle:"body-5",font:A,size:e,sizePhone:e,letterSpacing:t,lineHeight:1.5,weight:400,...o}),p=(e,t,o,d)=>({font:P,size:e,sizePhone:t,case:"upper",weight:500,letterSpacing:o,lineHeight:d}),a=(e,t,o,d={})=>({textStyle:"body-1",font:P,size:e,sizePhone:t,weight:400,case:"none",lineHeight:o,...d}),n=(e,t,o={})=>({kind:"text",key:e,props:l,style:t,...o}),T=(e,t)=>t?.future===!0,f=(e,t)=>{const o=t.site?.themePresets?.[E(e.sectionAccent,t)]?.line;return o?{buttonBorder:{width:1,color:o}}:{}},c=e=>B(typeof e?.body=="string"?e.body:""),H={name:"Milestone Timeline",boxProps:(e,t)=>{const o=_(e,t);return{...y,direction:"column",gap:60,sectionBorder:{bottom:1},...x(e,"TimelineTrack"),...o>=0?{sectionAccent:o}:{}}},box:[...b.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",S],...k("TimelineTrack")],parts:[{kind:"group",name:"Heading",props:{...i,direction:"row",align:"end",justify:"between",gap:40,share:"content",sectionPaddingBottom:32,sectionBorder:{bottom:1}},parts:[{kind:"group",name:"Title",props:{...i,direction:"row",align:"end",gap:40,share:"content"},parts:[n("eyebrow",r(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:{...i,direction:"row",share:"equal",gap:0,line:!0},parts:[{kind:"list",key:"entries",name:"Year",props:{...i,...O},item:e=>({props:e.future===!0?{upcoming:!0}:{}}),parts:[{kind:"group",name:w.name,props:{...i,...w},parts:[n("date",r(13,.22,{color:"accent"}),{when:(e,t)=>!T(e,t)}),n("date",r(13,.22,{color:"labels"}),{when:T}),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",...f(e,t)}),style:r(13,.3,{case:"upper"})}],site:(e,t)=>[...u("title")(e),...I(e,t)],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"}},M={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:{...i,gap:24},parts:[n("eyebrow",r(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:{...i,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:{...i,direction:"row",justify:"between",align:"center",gap:12,share:"content",phoneRow:2},parts:[n("imageCaption",r(11,.24,{case:"upper",color:"text"})),n("imageMeta",r(11,.24,{case:"upper",color:"accent"}),{props:{...l,align:"right"}})]}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"ghost",props:(e,t)=>({...g,...f(e,t)}),style:r(13,.3,{case:"upper"})}]},{kind:"group",name:"Chapters",props:{...i,gap:48,line:!1},parts:[{kind:"list",key:"entries",name:"Chapter",props:{...i,direction:"row",gap:24,share:"biggerRight",align:"start"},parts:[n("date",r(13,.24,{color:"accent"})),{kind:"group",name:"Words",props:{...i,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)=>c(t)[0]??""]],when:(e,t)=>c(t).length>0},{kind:"block",type:"Text",props:{...s,_partStyles:{text:a(17,16,1.6,{paragraphSpacing:14})}},box:[["body","text",(e,t)=>c(t).slice(1).join(`
1
+ import{convertTheme as S}from"../../../sections/section-to-box.js";import{BUTTON as g,DIM as s,bandAccent as _,bandIndex as E,bandPage as I,bandWrites as B,DROP_COMMON as h,DROP_SIDE_PADDING as m,INNER_BOX as i,SAME_KEYS as b,SECTION_BOX as y,TEXT as l,headingCaseOf as u,innerPad as x,innerPadKeys as k}from"./section-to-box-row-parts.js";import{splitParagraphs as O}from"../../../../components/goldPhrases.js";import{TIMELINE_YEAR_BOX as A,TIMELINE_YEAR_HEAD as w}from"../../../../../format/lib/sections/timeline-year-shape.js";const H="jetbrains-mono",T="space-grotesk",r=(e,t,o={})=>({textStyle:"body-5",font:H,size:e,sizePhone:e,letterSpacing:t,lineHeight:1.5,weight:400,...o}),p=(e,t,o,d)=>({font:T,size:e,sizePhone:t,case:"upper",weight:500,letterSpacing:o,lineHeight:d}),a=(e,t,o,d={})=>({textStyle:"body-1",font:T,size:e,sizePhone:t,weight:400,case:"none",lineHeight:o,...d}),n=(e,t,o={})=>({kind:"text",key:e,props:l,style:t,...o}),P=(e,t)=>t?.future===!0,f=(e,t)=>{const o=S(t)?.themes[I(e.sectionAccent,t)]?.line;return o?{buttonBorder:{width:1,color:o}}:{}},c=e=>O(typeof e?.body=="string"?e.body:""),M={name:"Milestone Timeline",boxProps:(e,t)=>{const o=E(e,t);return{...y,direction:"column",gap:60,sectionBorder:{bottom:1},...x(e,"TimelineTrack"),...o>=0?{sectionAccent:o}:{}}},box:[...b.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",_],...k("TimelineTrack")],parts:[{kind:"group",name:"Heading",props:{...i,direction:"row",align:"end",justify:"between",gap:40,share:"content",sectionPaddingBottom:32,sectionBorder:{bottom:1}},parts:[{kind:"group",name:"Title",props:{...i,direction:"row",align:"end",gap:40,share:"content"},parts:[n("eyebrow",r(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:{...i,direction:"row",share:"equal",gap:0,line:!0},parts:[{kind:"list",key:"entries",name:"Year",props:{...i,...A},item:e=>({props:e.future===!0?{upcoming:!0}:{}}),parts:[{kind:"group",name:w.name,props:{...i,...w},parts:[n("date",r(13,.22,{color:"accent"}),{when:(e,t)=>!P(e,t)}),n("date",r(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",...f(e,t)}),style:r(13,.3,{case:"upper"})}],site:(e,t)=>[...u("title")(e),...B(e,t)],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"}},N={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:{...i,gap:24},parts:[n("eyebrow",r(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:{...i,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:{...i,direction:"row",justify:"between",align:"center",gap:12,share:"content",phoneRow:2},parts:[n("imageCaption",r(11,.24,{case:"upper",color:"text"})),n("imageMeta",r(11,.24,{case:"upper",color:"accent"}),{props:{...l,align:"right"}})]}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"ghost",props:(e,t)=>({...g,...f(e,t)}),style:r(13,.3,{case:"upper"})}]},{kind:"group",name:"Chapters",props:{...i,gap:48,line:!1},parts:[{kind:"list",key:"entries",name:"Chapter",props:{...i,direction:"row",gap:24,share:"biggerRight",align:"start"},parts:[n("date",r(13,.24,{color:"accent"})),{kind:"group",name:"Words",props:{...i,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)=>c(t)[0]??""]],when:(e,t)=>c(t).length>0},{kind:"block",type:"Text",props:{...s,_partStyles:{text:a(17,16,1.6,{paragraphSpacing:14})}},box:[["body","text",(e,t)=>c(t).slice(1).join(`
2
2
 
3
- `)]],when:(e,t)=>c(t).length>1}]}]}]}],site:u("title"),drop:{...h,...m,layout:"Split is the only display converted (see skip); the Box's own arrangement replaces it"}},v={TimelineTrack:H,Timeline:M};export{v as TIMELINE_SECTION_TO_BOX};
3
+ `)]],when:(e,t)=>c(t).length>1}]}]}]}],site:u("title"),drop:{...h,...m,layout:"Split is the only display converted (see skip); the Box's own arrangement replaces it"}},L={TimelineTrack:M,Timeline:N};export{L as TIMELINE_SECTION_TO_BOX};
@@ -1 +1 @@
1
- import{hasWords as x,registerSectionToBox as o}from"../../../sections/section-to-box.js";import{BUTTON as m,DIM as d,DROP_COMMON as n,DROP_SIDE_PADDING as p,INNER_BOX as t,SAME_KEYS as r,SECTION_BOX as i,TEXT as s,headingCaseOf as O,innerPad as c,innerPadKeys as y,smallText as a,wrapperPad as l,wrapperPadKeys as h}from"./section-to-box-row-parts.js";import{CARDS_SECTION_TO_BOX as T}from"./section-to-box-rows-cards.js";import{finiteNumber as f}from"../../../../../format/lib/finite-number.js";import{STATS_SECTION_TO_BOX as _}from"./section-to-box-rows-stats.js";import{LOGOS_SECTION_TO_BOX as B}from"./section-to-box-rows-logos.js";import{STRIP_SECTION_TO_BOX as N}from"./section-to-box-rows-strip.js";import{TIMELINE_SECTION_TO_BOX as E}from"./section-to-box-rows-timeline.js";import{LOCATIONS_SECTION_TO_BOX as H}from"./section-to-box-rows-locations.js";import{HEAD_ONLY_SECTION_TO_BOX as I}from"./section-to-box-rows-head.js";import{headTree as b}from"./section-head-looks.js";const u={top:72,bottom:72,topPhone:72,bottomPhone:72},v={name:"Editorial Text",boxProps:e=>({...i,direction:"column",gap:28,sectionBorder:{top:1},...l(e,u)}),box:[["topBorder","sectionBorder",e=>e===!1?void 0:{top:1}],...r,...h(u)],parts:[b("Prose"),{kind:"text",key:"body",props:{...d,maxWidth:680},style:{textStyle:"body-1",lineHeight:1.7,paragraphSpacing:18},was:{size:16}}],drop:{...n,...p,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 (JJ's export, 2026-10-24)"}},C={buttonPaddingTop:20,buttonPaddingBottom:20,buttonPaddingLeft:28,buttonPaddingRight:28},S=(e,k)=>({kind:"list",key:"buttons",name:"Button",flat:!0,when:e,parts:[{kind:"button",key:"label",href:"href",variant:{key:"variant",map:{primary:"primary",outline:"ghost"},fallback:"ghost"},style:{letterSpacing:.3},props:{...m,...C,...k}}]}),g=e=>x(e.title),A={name:"Call-to-Action Heading",boxProps:e=>({...i,direction:"row",align:"center",justify:g(e)?"between":"end",gap:60,share:"content",sectionBorder:{bottom:1},...c(e,"TitleWithButtons")}),box:[...r,...y("TitleWithButtons")],parts:[{kind:"group",name:"Title",props:t,parts:[{kind:"text",key:"title",role:"heading",props:{...s,maxWidth:1e3},style:{textStyle:"heading-1",lineHeight:.94,letterSpacing:-.035}}]},{kind:"group",name:"Buttons",props:{...t,gap:14},parts:[S(g,{widthFit:"fill",iconPosition:"end"}),S(e=>!g(e),{})]}],site:O("title"),drop:{...n,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 (JJ's export, 2026-10-24)"}},P={top:40,bottom:64,topPhone:24,bottomPhone:36},W={name:"Section Header",boxProps:e=>({...i,direction:"column",gap:0,...l(e,P)}),box:[...r,...h(P)],parts:[b("SectionHeader")],drop:{...n,...p,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 (JJ's 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"}},R={name:"Lead Text",boxProps:e=>({...i,direction:"column",gap:40,sectionBorder:{bottom:1},...c(e,"ParagraphsA")}),box:[...r,...y("ParagraphsA")],parts:[{kind:"group",name:"Numbers",props:{...t,direction:"row",justify:"between",gap:60,share:"content",sectionBorder:{bottom:1},sectionPaddingBottom:40},parts:[a("eyebrow",{color:"labels",letterSpacing:.24}),{kind:"group",name:"Stats",props:{...t,align:"end"},parts:[{kind:"list",key:"stats",name:"Stat",props:{...t,direction:"row",share:"content",justify:"end",gap:8},parts:[a("value",{color:"text",letterSpacing:.18,lineHeight:1.8}),a("label",{color:"labels",letterSpacing:.18,lineHeight:1.8})]}]}]},{kind:"group",name:"Words",props:{...t,direction:"row",align:"end",gap:60,share:"bigLeft"},parts:[{kind:"text",key:"lead",props:{...s,maxWidth:780},style:{textStyle:"body-1",lineHeight:1.45,letterSpacing:-.005,paragraphSpacing:0},was:{size:22,sizePhone:20}},{kind:"group",name:"Founders",props:{...t,gap:8},parts:[{kind:"group",name:"Note",props:{...t,gap:6},parts:[{kind:"text",key:"foundersHeading",props:s,style:{textStyle:"body-1",weight:500,letterSpacing:-.01,lineHeight:1.7},was:{size:18,sizePhone:16}},{kind:"text",key:"foundersBody",props:d,style:{textStyle:"body-5",lineHeight:1.7},was:{size:14,sizePhone:12}}]},a("attribution",{letterSpacing:.24,lineHeight:1.7})]}]}],drop:{...n}},w={top:24,bottom:24,topPhone:24,bottomPhone:24},L={name:"Banner",boxProps:e=>({...i,direction:"column",gap:0,...l(e,w)}),box:[...r,"contained",...h(w)],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(f(e)??60,0),100)]],parts:[{kind:"group",name:"Words",props:{...t,gap:20},parts:[a("eyebrow"),{kind:"text",key:"title",role:"heading",props:{...s,maxWidth:680},style:{weight:500,lineHeight:1.05,letterSpacing:-.03,case:"none"}},{kind:"text",key:"body",props:{...d,maxWidth:680},style:{textStyle:"body-1",lineHeight:1.6},was:{size:16}}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"primary",props:m}]}],drop:{...n,...p}},X={Prose:v,TitleWithButtons:A,SectionHeader:W,ParagraphsA:R,Banner:L};function Q(){o(X),o(_),o(B),o(T),o(N),o(E),o(H),o(I)}export{X as GENERAL_SECTION_TO_BOX,Q as registerGeneralSectionRows};
1
+ import{hasWords as x,registerSectionToBox as o}from"../../../sections/section-to-box.js";import{BUTTON as m,DIM as d,DROP_COMMON as n,DROP_SIDE_PADDING as p,INNER_BOX as t,SAME_KEYS as i,SECTION_BOX as r,TEXT as s,headingCaseOf as O,innerPad as c,innerPadKeys as y,smallText as a,wrapperPad as l,wrapperPadKeys as h}from"./section-to-box-row-parts.js";import{CARDS_SECTION_TO_BOX as T}from"./section-to-box-rows-cards.js";import{finiteNumber as f}from"../../../../../format/lib/finite-number.js";import{STATS_SECTION_TO_BOX as B}from"./section-to-box-rows-stats.js";import{LOGOS_SECTION_TO_BOX as _}from"./section-to-box-rows-logos.js";import{STRIP_SECTION_TO_BOX as N}from"./section-to-box-rows-strip.js";import{TIMELINE_SECTION_TO_BOX as E}from"./section-to-box-rows-timeline.js";import{LOCATIONS_SECTION_TO_BOX as H}from"./section-to-box-rows-locations.js";import{HEAD_ONLY_SECTION_TO_BOX as I}from"./section-to-box-rows-head.js";import{headTree as b}from"./section-head-looks.js";const u={top:72,bottom:72,topPhone:72,bottomPhone:72},v={name:"Editorial Text",boxProps:e=>({...r,direction:"column",gap:28,sectionBorder:{top:1},...l(e,u)}),box:[["topBorder","sectionBorder",e=>e===!1?void 0:{top:1}],...i,...h(u)],parts:[b("Prose"),{kind:"text",key:"body",props:{...d,maxWidth:680},style:{textStyle:"body-1",lineHeight:1.7,paragraphSpacing:18},was:{size:16}}],drop:{...n,...p,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 (JJ's export, 2026-10-24)"}},A={buttonPaddingTop:20,buttonPaddingBottom:20,buttonPaddingLeft:28,buttonPaddingRight:28},w=(e,k)=>({kind:"list",key:"buttons",name:"Button",flat:!0,when:e,parts:[{kind:"button",key:"label",href:"href",variant:{key:"variant",map:{primary:"primary",outline:"ghost"},fallback:"ghost"},style:{letterSpacing:.3},props:{...m,...A,...k}}]}),g=e=>x(e.title),C={name:"Call-to-Action Heading",boxProps:e=>({...r,direction:"row",align:"center",justify:g(e)?"between":"end",gap:60,share:"content",sectionBorder:{bottom:1},...c(e,"TitleWithButtons")}),box:[...i,...y("TitleWithButtons")],parts:[{kind:"group",name:"Title",props:t,parts:[{kind:"text",key:"title",role:"heading",props:{...s,maxWidth:1e3},style:{textStyle:"heading-1",lineHeight:.94,letterSpacing:-.035}}]},{kind:"group",name:"Buttons",props:{...t,gap:14},parts:[w(g,{widthFit:"fill",iconPosition:"end"}),w(e=>!g(e),{})]}],site:O("title"),drop:{...n,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 (JJ's 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"}},S={top:40,bottom:64,topPhone:24,bottomPhone:36},W={name:"Section Header",boxProps:e=>({...r,direction:"column",gap:0,...l(e,S)}),box:[...i,...h(S)],parts:[b("SectionHeader")],drop:{...n,...p,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 (JJ's 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"}},R={name:"Lead Text",boxProps:e=>({...r,direction:"column",gap:40,sectionBorder:{bottom:1},...c(e,"ParagraphsA")}),box:[...i,...y("ParagraphsA")],parts:[{kind:"group",name:"Numbers",props:{...t,direction:"row",justify:"between",gap:60,share:"content",sectionBorder:{bottom:1},sectionPaddingBottom:40},parts:[a("eyebrow",{color:"labels",letterSpacing:.24}),{kind:"group",name:"Stats",props:{...t,align:"end"},parts:[{kind:"list",key:"stats",name:"Stat",props:{...t,direction:"row",share:"content",justify:"end",gap:8},parts:[a("value",{color:"text",letterSpacing:.18,lineHeight:1.8}),a("label",{color:"labels",letterSpacing:.18,lineHeight:1.8})]}]}]},{kind:"group",name:"Words",props:{...t,direction:"row",align:"end",gap:60,share:"bigLeft"},parts:[{kind:"text",key:"lead",props:{...s,maxWidth:780},style:{textStyle:"body-1",lineHeight:1.45,letterSpacing:-.005,paragraphSpacing:0},was:{size:22,sizePhone:20}},{kind:"group",name:"Founders",props:{...t,gap:8},parts:[{kind:"group",name:"Note",props:{...t,gap:6},parts:[{kind:"text",key:"foundersHeading",props:s,style:{textStyle:"body-1",weight:500,letterSpacing:-.01,lineHeight:1.7},was:{size:18,sizePhone:16}},{kind:"text",key:"foundersBody",props:d,style:{textStyle:"body-5",lineHeight:1.7},was:{size:14,sizePhone:12}}]},a("attribution",{letterSpacing:.24,lineHeight:1.7})]}]}],drop:{...n}},P={top:24,bottom:24,topPhone:24,bottomPhone:24},L={name:"Banner",boxProps:e=>({...r,direction:"column",gap:0,...l(e,P)}),box:[...i,"contained",...h(P)],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(f(e)??60,0),100)]],parts:[{kind:"group",name:"Words",props:{...t,gap:20},parts:[a("eyebrow"),{kind:"text",key:"title",role:"heading",props:{...s,maxWidth:680},style:{weight:500,lineHeight:1.05,letterSpacing:-.03,case:"none"}},{kind:"text",key:"body",props:{...d,maxWidth:680},style:{textStyle:"body-1",lineHeight:1.6},was:{size:16}}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"primary",props:m}]}],drop:{...n,...p}},X={Prose:v,TitleWithButtons:C,SectionHeader:W,ParagraphsA:R,Banner:L};function Q(){o(X),o(B),o(_),o(T),o(N),o(E),o(H),o(I)}export{X as GENERAL_SECTION_TO_BOX,Q as registerGeneralSectionRows};
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{Render as m}from"efficient-easel/render";import{capHeroGroups as a}from"../../../format/lib/document/cap-hero-groups.js";import{oneH1 as i}from"../../../format/lib/document/one-h1.js";import{migrateLegacyPageData as n}from"./migrate-legacy.js";import{migrateRenamedProps as p}from"../../../format/lib/document/renamed-props.js";import{convertSectionsInPage as f}from"../sections/section-to-box.js";import{registerGeneralSectionRows as s}from"./blocks/general/section-to-box-rows.js";function c({config:r,data:e,metadata:o}){return s(),t(m,{config:r,metadata:o,data:i(a(f(p(n(e)))))})}export{c as default};
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import{Render as m}from"efficient-easel/render";import{capHeroGroups as i}from"../../../format/lib/document/cap-hero-groups.js";import{oneH1 as a}from"../../../format/lib/document/one-h1.js";import{migrateLegacyPageData as n}from"./migrate-legacy.js";import{migrateRenamedProps as f}from"../../../format/lib/document/renamed-props.js";import{convertSectionsInPage as p,SECTION_TO_BOX_ON as s}from"../sections/section-to-box.js";import{siteThemeOf as c}from"../../../format/lib/theme.js";import{registerGeneralSectionRows as g}from"./blocks/general/section-to-box-rows.js";function d({config:e,data:o,metadata:r}){return g(),t(m,{config:e,metadata:r,data:a(i(p(f(n(o)),s,{theme:c(r)})))})}export{d as default};
@@ -77,6 +77,7 @@ export type PartStyle = {
77
77
  color?: string;
78
78
  italic?: boolean;
79
79
  sizePhone?: number;
80
+ alignPhone?: PartAlign;
80
81
  };
81
82
  export type PartStyleBase = {
82
83
  fontKey: 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 rt,fontRoleOf as E,SIZE_STEP_OF_ROLE as I}from"../../../format/lib/fonts.js";import{encodePartKey as ot}from"../../../format/lib/document/part-key.js";import{decodePartId as k,normalizePartText as O}from"./text-parts.js";import{COLOUR_TOKEN as M}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as it}from"../content/view-values.js";const N="_partStyles",st="data-sf-part-styled",F="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function m(t){return typeof t=="string"&&ct.test(t)}const L={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(L))if(n===t)return e;return null}function se(t){if(m(t.textStyle))return t.textStyle;const e=E(t.role);return e?L[e]:void 0}const ft=[400,500,600,700],j=["left","center","right","justify"],H=5,D=1e3,lt=-5,ut=10,pt=0,dt=64,xt=2,C={size:{min:H,max:D,step:1},sizePhone:{min:H,max:D,step:1},padding:{min:pt,max:dt,step:xt}},ht=.05,St=.01,gt=["line","letter"],mt=.5,Pt=2.5,Tt=-1,bt=1,_t=0,Rt=400,At=[...new Set(Object.values(I))];function b(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function K(t){return b(t?.[N])??{}}function W(t,e){const n=K(t);return Object.hasOwn(n,e)?b(n[e])??{}:{}}function ce(t,e){return Object.values(W(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){const r={...K(t)};if(Et(n).length?r[e]=n:delete r[e],!Object.keys(r).length){const{[N]:o,...i}=t;return i}return{...t,[N]:r}}function Et(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return gt.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(C,t)){const{min:n,max:r}=C[t],o=Math.round(Number(e));return Number.isFinite(o)?_(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?E(e)?e:null:t==="sizeToken"?$(e)?e:null:t==="textStyle"?m(e)?e:null:e}const Nt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function X(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of Nt){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!j.includes(t.align)&&n("align"),t.textStyle!==void 0&&!m(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!$(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!E(t.fontRole)&&n("fontRole"),e??t}function $(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:r,pxPhone:o,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)&&(r===void 0||p(r))&&(o===void 0||c(o))&&(i===void 0||$t(i,n))}function $t(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 U(t){return t?.pxPhone&&$(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function B({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 wt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function zt(t){const e=[];for(const[n,r]of wt)n===t?e.push(r):r===t&&e.push(n);return e}function ae(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 c of zt(n))delete o[c]}return G(t,e,o)}function fe(t,e){return G(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=I[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*St,4)),e}const Ht=1,S="--sf-part-para";function Y(t){if(t=X(t),typeof t.sizePhone=="number"&&t.sizePhone>0)return{fontSize:`${t.sizePhone}px`};const e=U(t.sizeToken);return e?{fontSize:B(e)}:{}}function Dt(t,e){if(!e)return t;if(typeof t.sizePhone=="number"&&t.sizePhone>0)return{...t,size:t.sizePhone};const n=U(t.sizeToken);return n?{...t,size:void 0,sizeToken:n}:t}function y(t,e,n){t=X(t);const r=Mt(t,n),o=jt(t),i=t.size?`${t.size}px`:t.sizeToken?B(t.sizeToken):r?Lt(r):"";return{fontFamily:t.font?Gt(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`:"",[S]: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(M,t)?M[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,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Kt(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: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 j)if(e===t)return e;return t==="end"?"right":"left"}function pe(t,e){const n=q(t);if(!n)return"";for(const r of nt)if(q(e(r.cssVar))===n)return r.key;return""}const q=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Gt(t){const e=rt(t);return e?`var(${e.cssVar})`:""}function de(t,e,n,r){return!e||k(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function xe(t,e,n=()=>R,r=p=>p,o=Bt,i=!1,c=()=>!1){let p=0;for(const{element:s,partId:a}of t){const u=k(a)?.propKey;if(!u)continue;const f=r(u),d=Object.hasOwn(e,f)?b(e[f])??{}:{},l=y(Dt(d,i),R,{blockDrawsStyle:c(u)});m(d.textStyle)?s.setAttribute?.(F,d.textStyle):s.removeAttribute?.(F);const g=z.some(h=>s.style[h]);let x=!1;for(const[h,T]of Object.entries(l))Vt(s,h,T),T&&(x=!0);if(g||z.some(h=>l[h]))for(const h of Xt(s,o))for(const T of z)h.style[T]=l[T]??"";x&&(p+=1)}return p}function Xt(t,e){const n=O(t.textContent??""),r=[];let o=t;for(let i=0;i<Ut&&e(o);i+=1){const c=o.parentElement;if(!c||O(c.textContent??"")!==n)break;r.push(c),o=c}return r}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 r=t.style;typeof r.setProperty=="function"?n?r.setProperty(e,n):r.removeProperty?.(e):r[e]=n;const o=t;e===S&&(n?o.setAttribute?.(J,""):o.removeAttribute?.(J))}const J="data-sf-part-para",Yt=Object.keys(y({},R)),w=new Set(["color","overflowWrap",S,"fontStyle"]),z=Yt.filter(t=>!w.has(t));function he(t,e,n,r=i=>i,o=()=>!1){const i=new Map;for(const s of t){const a=ot(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=y(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=r(f);if(!Object.hasOwn(e,d))continue;const l=b(e[d])??{},g=y(l,R,{blockDrawsStyle:o(f)}),x=Y(l),A=m(l.textStyle)?l.textStyle:void 0;!Object.values(g).some(Boolean)&&!Object.keys(x).length&&!A||p.set(s,{stamp:Q(n,f),declarations:g,...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 Se(t,e){return t?.kindRules.get(e)??null}function Q(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function ge(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:c}=o;if(n.has(i))return;n.add(i);const p=Object.entries(c).filter(([,l])=>l!==""),s=l=>l.map(([g,x])=>`${Jt(g)}: ${x}`).join("; "),a=`[${st}="${i}"]`,u=p.filter(([l])=>!w.has(l)),f=p.filter(([l])=>w.has(l));u.length&&e.push(`${a}, *:has(> ${a}) { ${s(u)} }`),f.length&&e.push(`${a} { ${s(f)} }`),c[S]&&(e.push(`*:has(> ${a}) { ${S}: ${c[S]} }`),e.push(...qt(a,`*:has(> ${a})`)));const d=Object.entries(o.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${it} { ${a}, *:has(> ${a}) { ${s(d)} } }`)};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
2
- `)}function qt(t,e){const n=`var(${S})`,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 Jt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function me(t,e){if(!t)return null;const n=O(e),r=t.rules.get(n);if(r)return r;if(n.length<Qt||t.drawn.has(n))return null;let o=null;for(const[i,c]of t.rules)if(i.includes(n)){if(o&&o.stamp!==c.stamp)return null;o=c}return o}const Qt=8;export{j as PART_ALIGNS,bt as PART_LETTER_EM_MAX,Tt as PART_LETTER_EM_MIN,St as PART_LETTER_STEP,Pt as PART_LINE_HEIGHT_MAX,mt as PART_LINE_HEIGHT_MIN,ht as PART_LINE_STEP,C as PART_MEASURED_TRACKS,ut as PART_NUDGE_MAX,lt as PART_NUDGE_MIN,dt as PART_PADDING_MAX,pt as PART_PADDING_MIN,xt as PART_PADDING_STEP,J as PART_PARAGRAPH_ATTR,Rt as PART_PARAGRAPH_MAX,_t as PART_PARAGRAPH_MIN,S as PART_PARAGRAPH_VAR,gt as PART_RELATIVE_PROPS,D as PART_SIZE_MAX,H as PART_SIZE_MIN,At as PART_SIZE_STEPS,st as PART_STYLED_ATTR,N as PART_STYLES_PROP,Yt as PART_STYLE_PROPERTIES,ft as PART_WEIGHTS,z as SHARED_PART_PROPERTIES,L as STYLE_ID_OF_ROLE,F as TEXT_STYLE_ATTR,xe as applyPartStyles,le as blockDrawsTextStyle,se as followedStyleOf,Zt as isPartKindKey,m as isTextStyleId,qt as paragraphRules,It as partCaseOfTransform,kt as partCaseTransform,pe as partFontKeyOf,Y as partPhoneDeclarations,Se as partRuleForKind,me as partRuleForText,jt as partSpacingOf,ue as partStyleBase,ce as partStyleCount,ge as partStyleCss,y as partStyleDeclarations,Dt as partStyleForScreen,de as partStyleSource,ae as propsWithPartStyleValue,fe as propsWithoutPartStyle,he as publishedPartStyles,W as readPartStyle,K as readPartStyles};
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 qt(t,e){const n=`var(${g})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const Jt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function me(t,e){if(!t)return null;const n=N(e),o=t.rules.get(n);if(o)return o;if(n.length<Qt||t.drawn.has(n))return null;let r=null;for(const[i,c]of t.rules)if(i.includes(n)){if(r&&r.stamp!==c.stamp)return null;r=c}return r}const Qt=8;export{y as PART_ALIGNS,bt as PART_LETTER_EM_MAX,Tt as PART_LETTER_EM_MIN,gt as PART_LETTER_STEP,Pt as PART_LINE_HEIGHT_MAX,mt as PART_LINE_HEIGHT_MIN,ht as PART_LINE_STEP,K as PART_MEASURED_TRACKS,ut as PART_NUDGE_MAX,lt as PART_NUDGE_MIN,dt as PART_PADDING_MAX,pt as PART_PADDING_MIN,xt as PART_PADDING_STEP,J as PART_PARAGRAPH_ATTR,Rt as PART_PARAGRAPH_MAX,_t as PART_PARAGRAPH_MIN,g as PART_PARAGRAPH_VAR,St as PART_RELATIVE_PROPS,C as PART_SIZE_MAX,D as PART_SIZE_MIN,At as PART_SIZE_STEPS,st as PART_STYLED_ATTR,$ as PART_STYLES_PROP,Yt as PART_STYLE_PROPERTIES,ft as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,H as STYLE_ID_OF_ROLE,j as TEXT_STYLE_ATTR,xe as applyPartStyles,le as blockDrawsTextStyle,se as followedStyleOf,Zt as isPartKindKey,m as isTextStyleId,qt as paragraphRules,It as partCaseOfTransform,kt as partCaseTransform,pe as partFontKeyOf,Y as partPhoneDeclarations,ge as partRuleForKind,me as partRuleForText,jt as partSpacingOf,ue as partStyleBase,ce as partStyleCount,Se as partStyleCss,O as partStyleDeclarations,Dt as partStyleForScreen,de as partStyleSource,ae as propsWithPartStyleValue,fe as propsWithoutPartStyle,he as publishedPartStyles,G as readPartStyle,W as readPartStyles};
@@ -1 +1 @@
1
- import{jsx as H}from"react/jsx-runtime";import{phoneKey as o}from"efficient-easel/draw";import{BLOCK_SIZE_KEYS as N,blockSizeOf as z,parseBlockWidthFit as R}from"../../../../format/lib/content/block-size.js";import{boxPhoneRowFits as j,boxShareClasses as D}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as K}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as P}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as C}from"../part-styles.js";import{addShowWhenFacts as A,withRowRules as h}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as L}from"./cell-width.js";import{findParentNode as v}from"../../../../format/lib/document/passes/document-position.js";const Z=new Set(["Text","Heading"]),G=new Set(["h1","h2","h3","h4","h5","h6"]);function _(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&G.has(e.tag)?!0:C(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},m={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},g={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]};function O(t,e,n){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},n??{field:t,is:e}]}]}}const b={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},X=[[["_gBlockSize","minWidth",o("minWidth"),"maxWidth",o("maxWidth")],c],[["widthFit"],m],[[o("widthFit")],g],[["width"],{all:[m,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[g,O("widthFit","fixed")]}]],k=[[["_gText","textFit",o("textFit")],c],[["minFont"],{all:[c,b]}],[[o("minFont")],{all:[c,O("textFit","shrink",b)]}]],u=(t,e)=>v(e.appState,t.props?.id),x=t=>!!t&&typeof t.type=="string"&&P(t.type)!==null,B=t=>(t.type==="Flex"||t.type==="HeroGroup")&&K(t.type,t.props?.direction)==="row",W=t=>{const e=R(t);return e!==void 0&&e!=="fit"},U={blockOutsideBox:(t,e)=>!x(u(t,e)),boxSharesWidth:(t,e)=>{const n=u(t,e);return x(n)&&B(n)&&D(n.props?.share)!==""&&!W(t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const n=u(t,e);if(!x(n)||!B(n))return!1;const i=n.props?.phoneRow;return(Number(i)===2||Number(i)===3)&&!j(i,n.props?.[o("share")])&&!W(t.props?.[o("widthFit")]??t.props?.widthFit)}},Y=t=>/^_[gds][A-Z]/.test(t);function M(t,e,n){const i=Object.entries(t),s=i.findIndex(([l])=>l===e);if(s===-1)return null;let r=s+1;for(;r<i.length&&!Y(i[r][0]);)r++;return Object.fromEntries([...i.slice(0,r),...Object.entries(n),...i.slice(r)])}function T(t,e,n){const i=Object.entries(t);return Object.fromEntries([...i.slice(0,e),...Object.entries(n),...i.slice(e)])}function V(t,e,n){const i=Object.keys(e);if(i.includes("_dSize")){const{_gBlockSize:s,...r}=n;return T(e,i.indexOf("_dSize")+1,r)}return q.has(t)&&i.includes("_gSpacing")?T(e,i.indexOf("_gSpacing"),n):{...e,...n}}const q=new Set(["Text","Heading"]);function J(t,e){const{_gText:n,...i}=e;return M(t,"_gText",i)??{...t,...e}}function Q(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 s of["textFit",o("textFit")])s in i&&(i[s]=t[s]);e.set(n,i)}return i}}const dt={name:"blockSize",applies:(t,e,n)=>L.includes(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const i=Z.has(e),{size:s,text:r}=n.blockSizeFields(i?{textFit:e==="Heading"?"shrink":"wrap"}:{});let l=V(e,t.fields??{},h(s,X));if(i){const f=h(r,k);if(l=J(l,f),e==="Text"){const y=h(n.blockSizeFields({textFit:"shrink"}).text,k),E=Q(y),p=t.resolveFields,I=(S,a)=>{const d=p?p(S,a):a.fields,w=F=>_(e,S?.props??{})?E(F??a.fields):F;return d instanceof Promise?d.then(w):w(d)};t.resolveFields=I}}t.fields=l,A(t,{...U,textWrapsByDefault:f=>!_(e,f.props??{})})},draw(t){tt(t)}};function $(t){const e={};for(const n of N){const i=t[n],s=t[o(n)];(i!==void 0||s!==void 0)&&(e[n]={desktop:i,phone:s})}return e}function tt(t){const e=t.render;t.render=n=>{const i=z($(n)),s=e(n);return i===null?s:H("div",{className:i.className,...Object.keys(i.style).length?{style:i.style}:{},...i.attrs,children:s})}}export{dt as blockSize,_ as textShrinksByDefault};
1
+ import{jsx as H}from"react/jsx-runtime";import{BLOCK_SIZE_KEYS as N,parseBlockWidthFit as z,phoneKey as o}from"efficient-easel/draw";import{blockSizeOf as R}from"../../content/block-size.js";import{CellWrap as j}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as D,boxShareClasses as K}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as C}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as P}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as A}from"../part-styles.js";import{addShowWhenFacts as L,withRowRules as h}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as Z}from"./cell-width.js";import{findParentNode as v}from"../../../../format/lib/document/passes/document-position.js";const G=new Set(["Text","Heading"]),X=new Set(["h1","h2","h3","h4","h5","h6"]);function _(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&X.has(e.tag)?!0:A(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},m={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},g={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]};function O(t,e,n){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},n??{field:t,is:e}]}]}}const b={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},U=[[["_gBlockSize","minWidth",o("minWidth"),"maxWidth",o("maxWidth")],c],[["widthFit"],m],[[o("widthFit")],g],[["width"],{all:[m,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[g,O("widthFit","fixed")]}]],W=[[["_gText","textFit",o("textFit")],c],[["minFont"],{all:[c,b]}],[[o("minFont")],{all:[c,O("textFit","shrink",b)]}]],u=(t,e)=>v(e.appState,t.props?.id),x=t=>!!t&&typeof t.type=="string"&&P(t.type)!==null,k=t=>(t.type==="Flex"||t.type==="HeroGroup")&&C(t.type,t.props?.direction)==="row",B=t=>{const e=z(t);return e!==void 0&&e!=="fit"},Y={blockOutsideBox:(t,e)=>!x(u(t,e)),boxSharesWidth:(t,e)=>{const n=u(t,e);return x(n)&&k(n)&&K(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)}},M=t=>/^_[gds][A-Z]/.test(t);function V(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&&!M(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 q(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 J.has(t)&&i.includes("_gSpacing")?T(e,i.indexOf("_gSpacing"),n):{...e,...n}}const J=new Set(["Text","Heading"]);function Q(t,e){const{_gText:n,...i}=e;return V(t,"_gText",i)??{...t,...e}}function $(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)=>Z.includes(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const i=G.has(e),{size:r,text:s}=n.blockSizeFields(i?{textFit:e==="Heading"?"shrink":"wrap"}:{});let l=q(e,t.fields??{},h(r,U));if(i){const f=h(s,W);if(l=Q(l,f),e==="Text"){const y=h(n.blockSizeFields({textFit:"shrink"}).text,W),E=$(y),p=t.resolveFields,I=(S,a)=>{const d=p?p(S,a):a.fields,w=F=>_(e,S?.props??{})?E(F??a.fields):F;return d instanceof Promise?d.then(w):w(d)};t.resolveFields=I}}t.fields=l,L(t,{...Y,textWrapsByDefault:f=>!_(e,f.props??{})})},draw(t){et(t)}};function tt(t){const e={};for(const n of N){const i=t[n],r=t[o(n)];(i!==void 0||r!==void 0)&&(e[n]={desktop:i,phone:r})}return e}function et(t){const e=t.render;t.render=n=>{const i=R(tt(n)),r=e(n);return i===null?r:H(j,{className:i.className,...Object.keys(i.style).length?{style:i.style}:{},attrs:i.attrs,children:r})}}export{ut as blockSize,_ as textShrinksByDefault};
@@ -1 +1 @@
1
- import{catalogueLabel as m}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cellWidth as s}from"./cell-width.js";import{clickableParts as p}from"./clickable-parts.js";import{cardCorners as c,sectionCorners as f}from"./corners.js";import{emptyHeadings as a}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as l}from"../../../../format/lib/document/passes/show-when-rows.js";import{hiddenNodes as d}from"../../../../format/lib/document/passes/hidden-nodes.js";import{mediaValues as h}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as u}from"./section-anchor.js";import{blockEntrance as g,sectionAnimation as S}from"./section-animation.js";import{sectionHeight as b}from"./section-height.js";import{cardSticky as w,sectionSticky as P}from"./section-sticky.js";import{sectionBorder as k}from"./borders.js";import{blockPadding as A,sectionPadding as C}from"./section-padding.js";import{sectionTheme as W,slideTheme as y}from"./section-theme.js";import{buttonAlignInRow as B,containedWidth as G,sectionWidth as E}from"./section-width.js";import{blockGroups as H,sectionGroups as L}from"../../../../format/lib/document/passes/settings-groups.js";import{openSlotDisallow as R,sectionGroupAllow as T}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as io}from"../../../../format/lib/document/passes/registry-context.js";const z=[h,T,R,C,f,k,c,A,g,s,E,G,B,b,u,W,S,P,w,y,n,L,H,l,a,p,d,m];function $(r,e,o){const i=e;for(const t of z)t.applies(r,o,i)&&(o.inspector&&t.panel?.(i,r,o.inspector,o),t.draw?.(i,r,o));return e}export{z as BLOCK_PASSES,$ as applyBlockPasses,io as registryPassContext};
1
+ import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cellWidth as s}from"./cell-width.js";import{clickableParts as p}from"./clickable-parts.js";import{cardCorners as c,sectionCorners as f}from"./corners.js";import{emptyHeadings as a}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as l}from"../../../../format/lib/document/passes/show-when-rows.js";import{hiddenNodes as d}from"../../../../format/lib/document/passes/hidden-nodes.js";import{mediaValues as h}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as u}from"./section-anchor.js";import{blockEntrance as S,sectionAnimation as g}from"./section-animation.js";import{sectionHeight as b}from"./section-height.js";import{cardSticky as w,sectionSticky as A}from"./section-sticky.js";import{sectionBorder as P}from"./borders.js";import{blockPadding as k,sectionPadding as C}from"./section-padding.js";import{sectionTheme as W,slideTheme as y}from"./section-theme.js";import{buttonAlignInRow as B,containedWidth as G,sectionWidth as E}from"./section-width.js";import{blockGroups as H,sectionGroups as L}from"../../../../format/lib/document/passes/settings-groups.js";import{slotsStartAfresh as R}from"./slots-start-afresh.js";import{openSlotDisallow as T,sectionGroupAllow as z}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as mo}from"../../../../format/lib/document/passes/registry-context.js";const D=[R,h,z,T,C,f,P,c,k,S,s,E,G,B,b,u,W,g,A,w,y,n,L,H,l,a,p,d,e];function ro(r,m,o){const t=m;for(const i of D)i.applies(r,o,t)&&(o.inspector&&i.panel?.(t,r,o.inspector,o),i.draw?.(t,r,o));return m}export{D as BLOCK_PASSES,ro as applyBlockPasses,mo as registryPassContext};
@@ -1 +1 @@
1
- import{jsx as M}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as s,SECTION_MIN_HEIGHT_EXCLUDED as P,hasPhoneHeight as x,resolvePhoneHeight as E,resolveSectionMinHeight as _,sectionMinHeightAttrs as v}from"../../../../format/lib/content/section-min-height.js";import{shownForOption as r,withRowRules as F}from"../../../../format/lib/document/show-when-attach.js";const I=[[["sectionHeightValue"],r("sectionHeightMode",s,"auto",["fixed","screen"])],[["sectionHeightUnit"],r("sectionHeightMode",s,"auto",["fixed"])],[["sectionHeightValuePhone"],r("sectionHeightModePhone",s,"auto",["fixed","screen"])],[["sectionHeightUnitPhone"],r("sectionHeightModePhone",s,"auto",["fixed"])]],p={name:"sectionHeight",applies:(e,n,t)=>n.isSection(e)&&!P.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const i=t.heightFields;e.fields={...e.fields,...F(i(),I)};const c=e.resolveFields;e.resolveFields=(u,H)=>{const o=c?c(u,H):H.fields,h=u?.props??{},g=_(h),l=x(h)?E(h):null;return o&&typeof o.then=="function"?o.then(f=>d(a(f,g),l)):d(a(o,g),l)}},draw(e){const n=e.render;e.render=t=>{const i=v(t);return i?M("div",{className:i.className,style:i.style,children:n(t)}):n(t)}}};function a(e,n){if(!e||!("sectionHeightMode"in e)||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValue;return i&&(t.sectionHeightValue={...i,unit:n.unit}),t}function d(e,n){if(!e||!("sectionHeightModePhone"in e)||!n||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValuePhone;return i&&(t.sectionHeightValuePhone={...i,unit:n.unit}),t}export{p as sectionHeight};
1
+ import{jsx as M}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as s,SECTION_MIN_HEIGHT_EXCLUDED as P,hasPhoneHeight as x,resolvePhoneHeight as E,resolveSectionMinHeight as _,sectionMinHeightAttrs as F}from"../../../../format/lib/content/section-min-height.js";import{CellWrap as m}from"../../../components/InBoxContext.js";import{shownForOption as r,withRowRules as p}from"../../../../format/lib/document/show-when-attach.js";const v=[[["sectionHeightValue"],r("sectionHeightMode",s,"auto",["fixed","screen"])],[["sectionHeightUnit"],r("sectionHeightMode",s,"auto",["fixed"])],[["sectionHeightValuePhone"],r("sectionHeightModePhone",s,"auto",["fixed","screen"])],[["sectionHeightUnitPhone"],r("sectionHeightModePhone",s,"auto",["fixed"])]],O={name:"sectionHeight",applies:(e,n,t)=>n.isSection(e)&&!P.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const i=t.heightFields;e.fields={...e.fields,...p(i(),v)};const c=e.resolveFields;e.resolveFields=(u,H)=>{const o=c?c(u,H):H.fields,h=u?.props??{},l=_(h),g=x(h)?E(h):null;return o&&typeof o.then=="function"?o.then(f=>d(a(f,l),g)):d(a(o,l),g)}},draw(e){const n=e.render;e.render=t=>{const i=F(t);return i?M(m,{className:i.className,style:i.style,children:n(t)}):n(t)}}};function a(e,n){if(!e||!("sectionHeightMode"in e)||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValue;return i&&(t.sectionHeightValue={...i,unit:n.unit}),t}function d(e,n){if(!e||!("sectionHeightModePhone"in e)||!n||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValuePhone;return i&&(t.sectionHeightValuePhone={...i,unit:n.unit}),t}export{O as sectionHeight};
@@ -1 +1 @@
1
- import{jsx as c}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as a,sectionStickAttrs as d}from"../../../../format/lib/content/section-sticky.js";import{withRowRules as l}from"../../../../format/lib/document/show-when-attach.js";import{CARD_BLOCK_KEYS as f}from"./corners.js";const T=o("sectionSticky",(e,s,t)=>s.isSection(e)&&!a.has(e)&&!!t&&typeof t.render=="function"),m=o("cardSticky",(e,s,t)=>f.includes(e)&&!!t&&typeof t.render=="function");function o(e,s){return{name:e,applies:s,panel(t,n,i){t.fields={...t.fields,...l(i.stickFields(),k)}},draw(t){const n=t.render;t.render=i=>{const r=d(i);return r?c("div",{className:r.className,style:r.style,children:n(i)}):n(i)}}}}const k=[[["stickTopDistance"],{field:"stickTop",is:!0}],[["stickTopDistancePhone"],{field:"stickTopPhone",is:!0}]];export{m as cardSticky,T as sectionSticky};
1
+ import{jsx as o}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as a,sectionStickAttrs as l}from"../../../../format/lib/content/section-sticky.js";import{withRowRules as d}from"../../../../format/lib/document/show-when-attach.js";import{SlotsStartAfresh as f}from"../../../components/InBoxContext.js";import{CARD_BLOCK_KEYS as S}from"./corners.js";const T=c("sectionSticky",(e,s,t)=>s.isSection(e)&&!a.has(e)&&!!t&&typeof t.render=="function"),p=c("cardSticky",(e,s,t)=>S.includes(e)&&!!t&&typeof t.render=="function");function c(e,s){return{name:e,applies:s,panel(t,r,i){t.fields={...t.fields,...d(i.stickFields(),k)}},draw(t){const r=t.render;t.render=i=>{const n=l(i);return n?o("div",{className:n.className,style:n.style,children:o(f,{children:r(i)})}):r(i)}}}}const k=[[["stickTopDistance"],{field:"stickTop",is:!0}],[["stickTopDistancePhone"],{field:"stickTopPhone",is:!0}]];export{p as cardSticky,T as sectionSticky};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{SECTION_THEME_EXCLUDED as a,SECTION_THEME_NESTED_READING as r,nestedAccentValue as d,sectionThemeWrap as E}from"../../../../format/lib/content/section-surface.js";const f={name:"sectionTheme",applies:(e,t,s)=>t.isSection(e)&&!a.has(e)&&!!s&&typeof s.render=="function",panel(e,t,s){const{sectionThemeFields:i,SECTION_THEME_FOLLOW_LABEL:n}=s,c=r.has(t);e.fields={...e.fields,...c?i(d,n):i()}},draw(e,t){const s=r.has(t),i=e.render;e.render=n=>{const c=E(s?{...n,sectionAccent:d(n.sectionAccent)}:n),l=i(n);return c?o("div",{className:c.className,style:c.style,children:l}):l}}},h={name:"slideTheme",applies:e=>e==="HeroSlide",panel(e,t,s){const{sectionThemeFields:i,BLOCK_THEME_FOLLOW_LABEL:n}=s;e?.fields&&(e.fields={...e.fields,...i(d,n)})}};export{f as sectionTheme,h as slideTheme};
1
+ import{jsx as a}from"react/jsx-runtime";import{CellWrap as d}from"../../../components/InBoxContext.js";import{SECTION_THEME_EXCLUDED as E,SECTION_THEME_NESTED_READING as o,nestedAccentValue as l,sectionThemeWrap as T}from"../../../../format/lib/content/section-surface.js";const h={name:"sectionTheme",applies:(e,t,s)=>t.isSection(e)&&!E.has(e)&&!!s&&typeof s.render=="function",panel(e,t,s){const{sectionThemeFields:i,SECTION_THEME_FOLLOW_LABEL:n}=s,r=o.has(t);e.fields={...e.fields,...r?i(l,n):i()}},draw(e,t){const s=o.has(t),i=e.render;e.render=n=>{const r=T(s?{...n,sectionAccent:l(n.sectionAccent)}:n),c=i(n);return r?a(d,{className:r.className,style:r.style,children:c}):c}}},L={name:"slideTheme",applies:e=>e==="HeroSlide",panel(e,t,s){const{sectionThemeFields:i,BLOCK_THEME_FOLLOW_LABEL:n}=s;e?.fields&&(e.fields={...e.fields,...i(l,n)})}};export{h as sectionTheme,L as slideTheme};
@@ -0,0 +1,2 @@
1
+ import type { BlockPass } from "../../../../format/lib/document/passes/types.js";
2
+ export declare const slotsStartAfresh: BlockPass;
@@ -0,0 +1 @@
1
+ import{jsx as f}from"react/jsx-runtime";import{SlotsStartAfresh as l}from"../../../components/InBoxContext.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 d(t){const e=a.get(t);if(e)return e;const r=t,n=s=>f(l,{children:f(r,{...s})});return Object.assign(n,t),Object.defineProperty(n,"blockCount",{get:()=>t.blockCount,configurable:!0}),a.set(t,n),n}const y={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 s={...n};for(const o of e){const c=n[o];typeof c=="function"&&(s[o]=d(c))}return r(s)}}};export{y as slotsStartAfresh};
@@ -27,6 +27,10 @@ export declare function holdsAuthoredText(field: unknown): boolean;
27
27
  export declare function partLabel(field: Record<string, unknown>, key: string): string;
28
28
  export declare function partHeadLabel(label: string): string;
29
29
  export declare function partNeedles(fields: Record<string, unknown> | undefined, props: Record<string, unknown> | undefined): PartNeedle[];
30
+ export declare function canTypeOnCanvas(part: {
31
+ offPage: boolean;
32
+ hidden: boolean;
33
+ }): boolean;
30
34
  export type SectionTextPart = {
31
35
  key: string;
32
36
  label: string;
@@ -1 +1 @@
1
- import{decodePartId as O,encodePartId as P}from"efficient-easel/draw";import{stripMarkup as m}from"../../../format/lib/markup.js";import{LINK_FIELD_MARKER as R,SCAFFOLD_FIELD_MARKER as A,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as y}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as g}from"efficient-easel/draw";import{isStructuralTextProp as _}from"../../../format/lib/document/neutralization-contracts.js";import{fieldInOwnBox as L}from"../../../format/lib/document/own-box.js";import{partRowTexts as I}from"./part-rows.js";import{nonEmptyString as S}from"../../../format/lib/non-empty-string.js";const W="data-sf-part",$="data-sf-region-part",G="data-sf-part-row";function q(e,t){return`${e}[${t}]`}const J="data-sf-part-kind",j="data-sf-part-style-owner",N="data-sf-part-style-kind";function Q(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(N);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-easel-block"))return null}return null}const b=2;function h(e){return m(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=y(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[R]){if(e.type==="text"||e.type==="textarea"){const s=S(t);s&&r.push(s);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function U(e){if(!e||typeof e!="object")return!1;const t=e;return t[R]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function V(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||_(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[A]!==void 0&&l(o,o[A],i);const c=w(o,n),a=new Set;for(const{row:T,text:f}of I(o,t?.[n])){const d=h(f);d.length<b||(a.add(d),r.push({key:n,label:c,texts:[d],row:T}))}const p=new Set(a),x=[];for(const T of i){const f=h(T);f.length<b||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const K=g;function E(e,t){if(!t||typeof t!="object"||_(e)||L(t))return null;const r=t[u];return!r||!K.includes(r.control)?null:r}function Z(e,t){const r=E(e,t);return r!==null&&r.identifier!==!0}function v(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=E(n,s);if(!o)continue;const{text:i,hidden:c}=y(t?.[n]),a=i||o.placeholder||"",p=m(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{W as PART_ATTR,J as PART_KIND_ATTR,G as PART_ROW_ATTR,N as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,$ as REGION_PART_ATTR,O as decodePartId,P as encodePartId,q as encodePartRow,E as entryPartMetaOf,Z as fieldDrawsEntryRow,U as holdsAuthoredText,h as normalizePartText,F as partHeadLabel,w as partLabel,V as partNeedles,Q as partStyleOwnerOf,v as sectionTextParts};
1
+ import{decodePartId as g,encodePartId as O}from"efficient-easel/draw";import{stripMarkup as m}from"../../../format/lib/markup.js";import{LINK_FIELD_MARKER as R,SCAFFOLD_FIELD_MARKER as y,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as A}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as E}from"efficient-easel/draw";import{isStructuralTextProp as _}from"../../../format/lib/document/neutralization-contracts.js";import{fieldInOwnBox as L}from"../../../format/lib/document/own-box.js";import{partRowTexts as I}from"./part-rows.js";import{nonEmptyString as S}from"../../../format/lib/non-empty-string.js";const $="data-sf-part",G="data-sf-region-part",q="data-sf-part-row";function J(e,t){return`${e}[${t}]`}const Q="data-sf-part-kind",j="data-sf-part-style-owner",N="data-sf-part-style-kind";function U(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(N);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-easel-block"))return null}return null}const b=2;function h(e){return m(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const s of t){const c=s?.[o];typeof c=="string"&&r.push(c)}return}const{text:i}=A(t);i?r.push(i):n.placeholder&&r.push(n.placeholder);return}if(!e[R]){if(e.type==="text"||e.type==="textarea"){const i=S(t);i&&r.push(i);return}if(e.arrayFields&&Array.isArray(t)){for(const i of t)for(const[o,s]of Object.entries(e.arrayFields))l(s,i?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[i,o]of Object.entries(e.objectFields))l(o,t[i],r)}}function V(e){if(!e||typeof e!="object")return!1;const t=e;return t[R]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function Z(e,t){if(!e)return[];const r=[];for(const[n,i]of Object.entries(e)){if(!i||typeof i!="object"||_(n))continue;const o=i,s=[];l(o,t?.[n],s),!s.length&&o[y]!==void 0&&l(o,o[y],s);const c=w(o,n),a=new Set;for(const{row:d,text:f}of I(o,t?.[n])){const T=h(f);T.length<b||(a.add(T),r.push({key:n,label:c,texts:[T],row:d}))}const p=new Set(a),x=[];for(const d of s){const f=h(d);f.length<b||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}function K(e){return!e.offPage&&!e.hidden}const k=E;function P(e,t){if(!t||typeof t!="object"||_(e)||L(t))return null;const r=t[u];return!r||!k.includes(r.control)?null:r}function v(e,t){const r=P(e,t);return r!==null&&r.identifier!==!0}function tt(e,t){if(!e)return[];const r=[];for(const[n,i]of Object.entries(e)){const o=P(n,i);if(!o)continue;const{text:s,hidden:c}=A(t?.[n]);if(K({offPage:o.offPage===!0,hidden:!!c}))continue;const a=s||o.placeholder||"",p=m(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(i,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{$ as PART_ATTR,Q as PART_KIND_ATTR,q as PART_ROW_ATTR,N as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,G as REGION_PART_ATTR,K as canTypeOnCanvas,g as decodePartId,O as encodePartId,J as encodePartRow,P as entryPartMetaOf,v as fieldDrawsEntryRow,V as holdsAuthoredText,h as normalizePartText,F as partHeadLabel,w as partLabel,Z as partNeedles,U as partStyleOwnerOf,tt as sectionTextParts};
@@ -5,5 +5,4 @@ export declare const efficientMediaResolve: (ref: string) => string | null;
5
5
  export declare function absolutizeApiUrl(url: string | null | undefined): string | null;
6
6
  export declare function isExternalMediaUrl(src: string): boolean;
7
7
  export declare function resolveMedia(src?: string): string | undefined;
8
- export declare function mediaThumb(url: string, width?: number): string;
9
8
  export declare function hasAv1Variant(src?: string): boolean;
@@ -1 +1 @@
1
- import{currentEaselSession as u}from"efficient-easel/screen/lib/session";const i=process.env.NEXT_PUBLIC_MEDIA_URL?.replace(/\/+$/,"");function o(e,t){const n=u().hostBackend?.media.resolve;if(!(!n||n===a))return n(e,t)??e}function d(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function f(e){return o(e)??s(e)}function s(e){return!i||d(e)?e:i+e.replace(/^\/media/,"")}const a=e=>s(e),c=process.env.NEXT_PUBLIC_API_URL??"";function p(e){if(!e)return null;const t=o(e);return t!==void 0?t:e.startsWith("/")?`${c}${e}`:e}function m(e){return/^https?:\/\//i.test(e)&&!(i&&e.startsWith(i+"/"))}function _(e){if(!e)return;const t=o(e);return t!==void 0?t:e.startsWith("/media/")?f(e):e}function v(e,t=384){const n=o(e,{width:t});if(n!==void 0)return n;const r=p(e)??e;return/\.svg(\?|$)/i.test(r)||i?r:`/_next/image?url=${encodeURIComponent(r)}&w=${t}&q=75`}const l="/videos/products/";function E(e){return!!e&&e.includes(l)}export{p as absolutizeApiUrl,s as efficientMedia,a as efficientMediaResolve,E as hasAv1Variant,d as isAbsoluteUrl,m as isExternalMediaUrl,f as media,v as mediaThumb,_ as resolveMedia};
1
+ import{currentEaselSession as o}from"efficient-easel/screen/lib/session";const n=process.env.NEXT_PUBLIC_MEDIA_URL?.replace(/\/+$/,"");function i(e){const t=o().hostBackend?.media.resolve;if(!(!t||t===d))return t(e)??e}function s(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function u(e){return i(e)??r(e)}function r(e){return!n||s(e)?e:n+e.replace(/^\/media/,"")}const d=e=>r(e),f=process.env.NEXT_PUBLIC_API_URL??"";function p(e){if(!e)return null;const t=i(e);return t!==void 0?t:e.startsWith("/")?`${f}${e}`:e}function l(e){return/^https?:\/\//i.test(e)&&!(n&&e.startsWith(n+"/"))}function x(e){if(!e)return;const t=i(e);return t!==void 0?t:e.startsWith("/media/")?u(e):e}const a="/videos/products/";function E(e){return!!e&&e.includes(a)}export{p as absolutizeApiUrl,r as efficientMedia,d as efficientMediaResolve,E as hasAv1Variant,s as isAbsoluteUrl,l as isExternalMediaUrl,u as media,x as resolveMedia};
@@ -1,5 +1,5 @@
1
1
  import type { StoredTextStyle } from "../text-styles/site-text-styles.js";
2
- import type { ThemeColors } from "../../../format/lib/theme.js";
2
+ import { type ThemeColors, type ThemeValue } from "../../../format/lib/theme.js";
3
3
  type Props = Record<string, unknown>;
4
4
  export type SectionNode = {
5
5
  type: string;
@@ -36,7 +36,9 @@ export type SiteFacts = {
36
36
  };
37
37
  export type ConvertContext = {
38
38
  site?: SiteFacts;
39
+ theme?: ThemeValue;
39
40
  };
41
+ export declare function convertTheme(ctx: ConvertContext): ThemeValue | undefined;
40
42
  export type Restyled = {
41
43
  key: string;
42
44
  was: {
@@ -178,11 +180,11 @@ export declare const hasWords: (v: unknown) => boolean;
178
180
  export declare function convertSection(node: SectionNode, row: SectionToBoxRow, ctx?: ConvertContext): SectionConversion;
179
181
  export declare function convertSectionsInPage<D extends {
180
182
  content?: unknown;
181
- }>(data: D, on?: readonly string[]): D;
183
+ }>(data: D, on?: readonly string[], ctx?: ConvertContext): D;
182
184
  export type SectionToBoxEdit = {
183
185
  index: number;
184
186
  node: SectionNode;
185
187
  nodes: SectionNode[];
186
188
  };
187
- export declare function sectionToBoxEdits(content: unknown, on?: readonly string[]): SectionToBoxEdit[];
189
+ export declare function sectionToBoxEdits(content: unknown, on?: readonly string[], ctx?: ConvertContext): SectionToBoxEdit[];
188
190
  export {};
@@ -1 +1 @@
1
- import{readHidable as Q}from"efficient-easel/draw";import{BOX_TYPE as U,CONTAINER_BLOCKS_SLOT as Z}from"../../../format/lib/document/container-blocks.js";import{headingTextSeed as ee,labelTextSeed as te}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 ne}from"../../../format/lib/locations-grid.js";const _=U,j=Z;function se(t,o){return o===0?`${t}~box`:`${t}~box-${o+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 ke(t){for(const[o,r]of Object.entries(t)){if(o in R&&R[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" is already Box-native`);R[o]=r}}function be(t){return R[t]}const V=new Set(["id"]),T={},C=[];function me(t){for(const[o,r]of Object.entries(t)){if(o in T&&T[o]!==r)throw new Error(`lib/sections/section-to-box: "${o}" already has a row`);T[o]=r}}function xe(t){return T[t]}function ge(){return Object.keys(T)}function $e(t){return t in T&&C.includes(t)}function we(t){const o=oe[t];if(!o)throw new Error(`lib/sections/section-to-box: "${t}" has no head row in SPLITTABLE_SECTIONS`);const r=[{kind:"text",key:o.num,role:"eyebrow"},{kind:"text",key:o.title,role:"heading"}];return o.description&&r.push({kind:"text",key:o.description,role:"body"}),o.headRows.includes("linkText")&&o.headRows.includes("linkHref")&&r.push({kind:"button",key:"linkText",href:"linkHref"}),r}const H=t=>Q(t),Oe=t=>H(t).text.trim()!=="";function ie(t){if(t.includes("=="))return t;const o=t.indexOf("/"),r=o===-1?t:t.slice(0,o),a=r.trim();if(!a)return t;const y=r.indexOf(a);return`${r.slice(0,y)}==${a}==${r.slice(y+a.length)}${o===-1?"":t.slice(o)}`}const re=t=>t==="heading"?ee():t==="eyebrow"?te():{};function ae(t,o,r){const y={...t._partStyles?.text??{},...o??{},...r??{}};return Object.keys(y).length?{_partStyles:{text:y}}:{}}function ce(t,o){if(t===void 0)return{};if(typeof t=="string")return{variant:t};const r=o[t.key];return{variant:typeof r=="string"&&Object.hasOwn(t.map,r)?t.map[r]:t.fallback}}function Y(t,o,r,a,y={}){const c={...o};for(const h of t){const[g,E,P]=typeof h=="string"?[h,h,void 0]:h;if(r[g]===void 0)continue;const S=P?P(r[g],r,y):r[g];S===void 0?delete c[E]:c[E]=S,a(g,E,S===void 0)}return c}function fe(t){const o=new Set([...V,"headPlacement","_partStyles",...Object.keys(t.drop??{}),...Object.keys(t.reads??{})]),r=y=>{for(const c of y??[])o.add(typeof c=="string"?c:c[0])},a=y=>{for(const c of y)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),a(c.parts??[]);break;case"core":c.keep!=="rest"&&c.keep.forEach(h=>o.add(h)),Object.keys(c.rename??{}).forEach(h=>o.add(h));for(const h of Object.values(c.slots??{}))for(const g of h)"kind"in g&&o.add(g.key);break}};for(const y of[t,...t.also??[]])r(y.box),a(y.parts);return o}function D(t,o,r={}){const a=t.props,y=o.skip?.(a);if(y!==void 0)return{node:t,nodes:[t],carried:[],dropped:[],siteWrites:[],restyled:[],skipped:y};const c=String(a.id??t.type),h=[],g=[],E=[],P=new Set,S=(n,i)=>{h.push({key:n,home:i}),P.add(n)},X=a._partStyles??{},L=fe(o);let F=0;const $=(n,i)=>({type:n,props:{...i,id:`${c}~${n}-${++F}`}}),K=(n,i,k,l,b,d,w)=>{if(b){for(const f of n??[]){const s=typeof f=="string"?f:f[0];k[s]!==void 0&&w(s,`nothing — the ${l} has no parts, so it is not drawn`)}return}const e=typeof i=="function"?i(a,r):i??{};return Y(n??[],e,k,(f,s,m)=>w(f,m?`nothing — the old value draws nothing (${l}: no ${s})`:`${d}${l}: ${s}`),r)},M=n=>n.map(i=>{const k={...i.props??{}};for(const[l,b]of Object.entries(i.slots??{}))k[l]=M(b);return $(i.type,k)}),W=(n,i,k)=>{const l=Array.isArray(i[n.key])?i[n.key]:[],b=typeof n.props=="function"?n.props(a,r):n.props??{},d=l.map((s,m)=>{const p=s??{},u=n.item?.(p,m,a)??{},x=v(u.reverse?[...n.parts].reverse():n.parts,p,!1,`item ${m+1}: `);return n.flat?u.props?x.map(B=>({...B,props:{...B.props,...u.props,id:B.props.id}})):x:[$(_,{name:`${n.name} ${m+1}`,...b,...u.props??{},[j]:x})]});if(n.groups){const s=n.groups;return k(n.key,l.length?`one Box per item (${l.length}), in a Box per group`:"nothing — the list is empty"),ne(l.map(m=>m??{}),s.of,s.of).map((m,p)=>{const u=m.items.map(O=>O.item),x=s.parts?v(s.parts,s.head?.(u,a)??{},!1,`group ${p+1}: `):[],B=m.items.map(O=>d[O.index]),A=s.perRow?.(u.length,a),N=Number.isInteger(A)&&A>=1?A:1,z=[];if(s.perRow&&N<B.length)for(let O=0;O*N<B.length;O++)z.push(B.slice(O*N,(O+1)*N).flat());return $(_,{name:`${s.name} ${p+1}`,...s.props??{},[j]:[...x,$(_,{name:`${s.itemsName} ${p+1}`,...s.itemsProps?.(u.length,a)??{},[j]:z.length?z.map((O,J)=>$(_,{name:`${s.rowName??`${s.itemsName} row`} ${J+1}`,...s.rowProps??{},[j]:O})):B.flat()})]})})}const w=n.perRow?.(a),e=n.perRow?Number.isInteger(w)&&w>=1?w:1:0;if(k(n.key,(l.length?n.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 f=[];for(let s=0;s*e<d.length;s++)f.push($(_,{name:`${n.rowName??`${n.name} row`} ${s+1}`,...n.rowProps??{},[j]:d.slice(s*e,(s+1)*e).flat()}));return f},v=(n,i,k,l)=>{const b=[],d=(e,f)=>k?S(e,f):void 0,w=e=>k?X[e]:void 0;for(const e of n)if(!(e.when&&!e.when(a,k?void 0:i)))switch(e.kind){case"text":{const f=H(i[e.key]);if(!f.text.trim()){d(e.key,"nothing — empty words draw nothing, so no block");break}const s=re(e.role??"body"),{_partStyles:m,...p}=s,u=ae(s,e.style,w(e.key));if(e.was&&k){const x=u._partStyles?.text??{};E.push({key:e.key,was:e.was,...typeof x.textStyle=="string"?{textStyle:x.textStyle}:{},...I(x.size)!==void 0?{size:I(x.size)}:{},...I(x.sizePhone)!==void 0?{sizePhone:I(x.sizePhone)}:{}})}b.push($("Text",{text:e.mark==="accentLead"?ie(f.text):f.text,...p,...e.props??{},...u,...f.hidden?{_hidden:!0}:{}})),d(e.key,`${l}Text block: its words${f.hidden?", hidden":""}`);break}case"button":{const f=H(i[e.key]);if(!f.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 i[e.href]=="string"&&i[e.href]?i[e.href]:"#",m={...e.style??{},...w(e.key)??{}};b.push($("ButtonBlock",{label:f.text,href:s,...typeof e.props=="function"?e.props(i,r):e.props??{},...ce(e.variant,i),...Object.keys(m).length?{_partStyles:{label:m}}:{},...f.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 f=i[e.key];if(typeof f!="string"||!f){d(e.key,"nothing — no picture, no block"),e.alt&&d(e.alt,"nothing — no picture to describe");break}const s=e.alt&&typeof i[e.alt]=="string"?i[e.alt]:"";b.push($("ImageBlock",{src:f,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,i,d));break}case"group":{const f=v(e.parts,i,k,l),s=K(e.box,e.props,i,`${e.name} Box`,!f.length&&!e.keepEmpty,l,d);s&&b.push($(_,{name:e.name,...s,[j]:f}));break}case"block":{const f=e.parts?v(e.parts,i,k,l):[],s=K(e.box,e.props,i,`${e.type} block`,!!e.parts&&!f.length&&!e.keepEmpty,l,d);s&&b.push($(e.type,{...s,...e.slot?{[e.slot]:f}:{}}));break}case"core":{const f=e.as??t.type,s={headPlacement:"own-box",...e.props??{}},m=e.keep==="rest"?Object.keys(i).filter(p=>!L.has(p)&&!(p in s)):e.keep;for(const p of m)i[p]!==void 0&&(s[p]=i[p],d(p,`the ${f} block inside the Box`));if(e.keep==="rest"){for(const u of Object.keys(e.props??{}))i[u]!==void 0&&!L.has(u)&&d(u,`nothing — the ${f} block inside the Box has the row's own value`);i.headPlacement!==void 0&&d("headPlacement",`the ${f} block inside the Box: own-box`);const p=Object.fromEntries(Object.entries(X).filter(([u])=>!L.has(u)));Object.keys(p).length&&(s._partStyles=p)}for(const[p,u]of Object.entries(e.rename??{}))i[p]!==void 0&&(s[u]=i[p],d(p,`the ${f} block inside the Box: ${u}`));for(const[p,u]of Object.entries(e.slots??{}))s[p]=u.flatMap(x=>"kind"in x?W(x,i,d):M([x]));b.push($(f,s));break}}return b},q=(n,i)=>{const k=i===0?"Box":`${n.name} Box`,l=v(n.parts,a,!0,i===0?"":`${k}: `),b=typeof n.boxProps=="function"?n.boxProps(a,r):n.boxProps??{},d=Y(n.box??[],b,a,(w,e,f)=>S(w,f?`nothing — the old value draws nothing (${k}: no ${e})`:`${k}: ${e}`),r);return{type:_,props:{name:n.name,...d,[j]:l,id:se(c,i)}}},G=[o,...o.also??[]].map(q);a._partStyles!==void 0&&S("_partStyles","each old part's style moved to its new part");for(const[n,i]of Object.entries(o.reads??{}))a[n]!==void 0&&S(n,i);for(const[n,i]of Object.entries(o.drop??{}))n in a&&(g.push({key:n,why:i}),P.add(n));for(const n of Object.keys(a))V.has(n)||P.has(n)||g.push({key:n,why:"not in the row — not carried"});return{node:G[0],nodes:G,carried:h,dropped:g,siteWrites:[...o.site?.(t,r)??[]],restyled:E}}function Se(t,o=C){const r=t.content;if(!Array.isArray(r))return t;let a=!1;const y=r.flatMap(c=>{const h=c&&typeof c.type=="string"&&o.includes(c.type)?T[c.type]:void 0;if(!h)return[c];const g=D(c,h);return g.skipped!==void 0?[c]:(a=!0,g.nodes)});return a?{...t,content:y}:t}function Be(t,o=C){if(!Array.isArray(t))return[];const r=[];return t.forEach((a,y)=>{const c=a&&typeof a.type=="string"&&o.includes(a.type)?T[a.type]:void 0;if(!c)return;const h=D(a,c);h.skipped===void 0&&r.push({index:y,node:h.node,nodes:h.nodes})}),r}export{j as SECTION_BOX_SLOT,_ as SECTION_BOX_TYPE,C as SECTION_TO_BOX_ON,be as boxNativeReason,D as convertSection,Se as convertSectionsInPage,$e as convertsToBox,Oe as hasWords,we as headParts,ke as registerBoxNativeSections,me as registerSectionToBox,se as sectionBoxIdOf,Be as sectionToBoxEdits,xe as sectionToBoxRow,ge as sectionToBoxTypes};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "45.0.0",
3
+ "version": "47.0.0",
4
4
  "description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@tabler/icons-react": "^3.46.0",
56
- "efficient-easel": "^24.1.0",
56
+ "efficient-easel": "^26.7.0",
57
57
  "efficient-shell": "^11.8.0",
58
58
  "isomorphic-dompurify": "^3.18.0",
59
59
  "next": ">=16",
@@ -72,7 +72,7 @@
72
72
  "@types/node": "^20",
73
73
  "@types/react": "^19",
74
74
  "@types/react-dom": "^19",
75
- "efficient-easel": "^24.1.0",
75
+ "efficient-easel": "^26.7.0",
76
76
  "efficient-shell": "^11.8.0",
77
77
  "esbuild": "^0.28.0",
78
78
  "happy-dom": "^20.14.5",
@@ -1,10 +0,0 @@
1
- import type { DuplicatePageInput, EditorPageRow } from "../../format/lib/web-backend.js";
2
- interface Props {
3
- source: EditorPageRow | null;
4
- taken: ReadonlySet<string>;
5
- duplicate: (row: EditorPageRow, input: DuplicatePageInput) => Promise<EditorPageRow>;
6
- onClose: () => void;
7
- onDuplicated: (copy: EditorPageRow) => void;
8
- }
9
- export default function DuplicatePageDialog({ source, taken, duplicate, onClose, onDuplicated }: Props): import("react").JSX.Element;
10
- export {};
@@ -1 +0,0 @@
1
- "use client";import{jsx as l,jsxs as S,Fragment as L}from"react/jsx-runtime";import{useId as C,useState as i}from"react";import{Button as F,Dialog as R,FormField as T,Input as k,Stack as U}from"efficient-shell/ui";import{copySuggestion as _,urlHandleTaken as K}from"../lib/page-copy.js";import{slugify as w}from"efficient-shell/format";import{say as n}from"../../format/lib/editor-words.js";function z({source:t,taken:h,duplicate:x,onClose:f,onDuplicated:I}){const g=C(),m=C(),[j,B]=i(null),[r,p]=i(""),[a,d]=i(""),[E,y]=i(!1),[o,v]=i(!1),[b,u]=i(null);if(t!==j&&(B(t),t)){const e=_(t,h);p(e.title),d(e.slug),y(!1),u(null)}const s=K(a,h),D=!!(t&&r.trim()&&a&&!s&&!o),c=async()=>{if(!(!t||!D)){v(!0),u(null);try{const e=await x(t,{title:r.trim(),slug:a});I(e)}catch{u(n("Couldn’t duplicate the page — please retry."))}finally{v(!1)}}};return l(R,{open:t!==null,onClose:()=>{o||f()},size:"sm",title:n("Duplicate “{name}”",{name:t?.label??""}),description:n("The copy is a draft and stays hidden until you publish it. It opens in the editor."),footer:S(L,{children:[l(F,{variant:"secondary",onClick:f,disabled:o,children:n("Cancel")}),l(F,{onClick:()=>{c()},disabled:!D,loading:o,children:n("Duplicate page")})]}),children:S(U,{gap:4,children:[l(T,{label:n("Title"),htmlFor:g,error:b??void 0,children:l(k,{id:g,value:r,invalid:!!b,onChange:e=>{p(e.target.value),E||d(w(e.target.value))},onKeyDown:e=>{e.key==="Enter"&&c()}})}),l(T,{label:n("URL handle"),htmlFor:m,hint:s?void 0:n("URL: /{slug}",{slug:a}),error:s?n("Another page uses this URL handle."):void 0,children:l(k,{id:m,value:a,invalid:s,onChange:e=>{y(!0),d(w(e.target.value))},onKeyDown:e=>{e.key==="Enter"&&c()}})})]})})}export{z as default};
@@ -1,6 +0,0 @@
1
- import type { DuplicatePageInput, EditorPageRow } from "../../format/lib/web-backend.js";
2
- export declare function canDuplicatePage(row: Pick<EditorPageRow, "kind">): boolean;
3
- export declare function uniqueSlug(base: string, taken: ReadonlySet<string>): string;
4
- export declare function urlHandleTaken(slug: string, taken: ReadonlySet<string>): boolean;
5
- export declare function copySuggestion(row: Pick<EditorPageRow, "label" | "slug">, taken: ReadonlySet<string>): DuplicatePageInput;
6
- export declare function usePageDuplicate(): ((row: EditorPageRow, input: DuplicatePageInput) => Promise<EditorPageRow>) | undefined;
@@ -1 +0,0 @@
1
- "use client";import{useEaselSession as i}from"efficient-easel/screen/lib/session-context";import{useScreenDocument as r}from"efficient-easel/screen/components/ScreenDocumentContext";import{slugify as c}from"efficient-shell/format";import{backendOf as a}from"./website-session.js";const l=new Set(["normal","dynamic"]);function S(e){return!e.kind||l.has(e.kind)}function p(e,t){const n=c(e)||"page";if(!t.has(n))return n;let s=2;for(;t.has(`${n}-${s}`);)s+=1;return`${n}-${s}`}function D(e,t){return t.has(e)}function $(e,t){return{title:`${e.label||e.slug} copy`,slug:p(`${e.slug}-copy`,t)}}function h(){const e=i(),{siteId:t,templateId:n}=r(),s=a(e).pages;if(!(!s.duplicate||n))return(u,o)=>s.duplicate(u.id,{...o,...t?{siteId:t}:{}})}export{S as canDuplicatePage,$ as copySuggestion,p as uniqueSlug,D as urlHandleTaken,h as usePageDuplicate};
@@ -1,59 +0,0 @@
1
- export declare const BLOCK_SIZE_CLASS = "sf-block-size";
2
- export declare const BLOCK_WIDTH_FIT_POINTS: readonly [{
3
- readonly label: "Fit content";
4
- readonly value: "fit";
5
- }, {
6
- readonly label: "Fill";
7
- readonly value: "fill";
8
- }, {
9
- readonly label: "Fixed";
10
- readonly value: "fixed";
11
- }];
12
- export type BlockWidthFit = (typeof BLOCK_WIDTH_FIT_POINTS)[number]["value"];
13
- export declare const BLOCK_WIDTH_FIT_DEFAULT: BlockWidthFit;
14
- export declare function parseBlockWidthFit(value: unknown): BlockWidthFit | undefined;
15
- export declare const BLOCK_FIXED_WIDTH: {
16
- readonly min: 40;
17
- readonly max: 2000;
18
- readonly step: 10;
19
- readonly fallback: 480;
20
- };
21
- export declare const BLOCK_WIDTH_LIMIT: {
22
- readonly min: 40;
23
- readonly max: 2000;
24
- readonly step: 10;
25
- };
26
- export declare const TEXT_FIT_POINTS: readonly [{
27
- readonly label: "Wrap";
28
- readonly value: "wrap";
29
- }, {
30
- readonly label: "Shrink to fit";
31
- readonly value: "shrink";
32
- }];
33
- export type TextFit = (typeof TEXT_FIT_POINTS)[number]["value"];
34
- export declare function parseTextFit(value: unknown): TextFit | undefined;
35
- export declare const TEXT_FIT_MIN_FONT: {
36
- readonly min: 8;
37
- readonly max: 120;
38
- readonly step: 1;
39
- readonly fallback: 16;
40
- };
41
- export declare const TEXT_FIT_ATTR: {
42
- readonly fit: "data-fit";
43
- readonly fitPhone: "data-fit-phone";
44
- readonly min: "data-fit-min";
45
- readonly minPhone: "data-fit-min-phone";
46
- };
47
- export declare const BLOCK_SIZE_KEYS: readonly ["widthFit", "width", "minWidth", "maxWidth", "textFit", "minFont"];
48
- export type BlockSizeKey = (typeof BLOCK_SIZE_KEYS)[number];
49
- export type BlockSizeTwin = {
50
- desktop?: unknown;
51
- phone?: unknown;
52
- };
53
- export type BlockSizeValues = Partial<Record<BlockSizeKey, BlockSizeTwin>>;
54
- export type BlockSize = {
55
- className: string;
56
- style: Record<string, string>;
57
- attrs: Record<string, string>;
58
- };
59
- export declare function blockSizeOf(values: BlockSizeValues): BlockSize | null;
@@ -1 +0,0 @@
1
- const u="sf-block-size",W=[{label:"Fit content",value:"fit"},{label:"Fill",value:"fill"},{label:"Fixed",value:"fixed"}],E="fit";function b(t){return W.some(n=>n.value===t)?t:void 0}const S={min:40,max:2e3,step:10,fallback:480},P={min:40,max:2e3,step:10},L=[{label:"Wrap",value:"wrap"},{label:"Shrink to fit",value:"shrink"}];function k(t){return L.some(n=>n.value===t)?t:void 0}const g={min:8,max:120,step:1,fallback:16},p={fit:"data-fit",fitPhone:"data-fit-phone",min:"data-fit-min",minPhone:"data-fit-min-phone"},B=["widthFit","width","minWidth","maxWidth","textFit","minFont"],s=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0,O={desktop:{fill:"min-[800px]:w-full min-[800px]:[.flex-row>&]:grow",fixed:"min-[800px]:w-[min(var(--sf-bw),100%)] min-[800px]:basis-auto! min-[800px]:grow-0! min-[800px]:shrink-0"},phone:{fill:"max-[800px]:w-full",fixed:"max-[800px]:w-[min(var(--sf-bw-p),100%)] max-[800px]:basis-auto! max-[800px]:grow-0! max-[800px]:shrink-0"}},C={desktop:"--sf-bw",phone:"--sf-bw-p"},D={minWidth:{desktop:["--sf-bmin","min-[800px]:min-w-[var(--sf-bmin)]"],phone:["--sf-bmin-p","max-[800px]:min-w-[var(--sf-bmin-p)]"]},maxWidth:{desktop:["--sf-bmax","min-[800px]:max-w-[var(--sf-bmax)]"],phone:["--sf-bmax-p","max-[800px]:max-w-[var(--sf-bmax-p)]"]}};function K(t){const n=[],f={},o={},x=b(t.widthFit?.desktop),T=b(t.widthFit?.phone)??x,d=s(t.width?.desktop),w=s(t.width?.phone)??d;for(const[e,i,m]of[["desktop",x,d],["phone",T,w]])!i||i==="fit"||(n.push(O[e][i]),i==="fixed"&&(f[C[e]]=`${m??S.fallback}px`));for(const e of["minWidth","maxWidth"]){const i=s(t[e]?.desktop),m=s(t[e]?.phone)??i;for(const[F,l]of[["desktop",i],["phone",m]]){if(l===void 0)continue;const[_,I]=D[e][F];f[_]=`${l}px`,n.push(I)}}const a=k(t.textFit?.desktop),c=k(t.textFit?.phone),h=s(t.minFont?.desktop),r=s(t.minFont?.phone);return a&&(o[p.fit]=a),c&&(o[p.fitPhone]=c),h!==void 0&&(o[p.min]=String(h)),r!==void 0&&(o[p.minPhone]=String(r)),n.length===0&&Object.keys(o).length===0?null:{className:[u,...n].join(" "),style:f,attrs:o}}export{S as BLOCK_FIXED_WIDTH,u as BLOCK_SIZE_CLASS,B as BLOCK_SIZE_KEYS,E as BLOCK_WIDTH_FIT_DEFAULT,W as BLOCK_WIDTH_FIT_POINTS,P as BLOCK_WIDTH_LIMIT,p as TEXT_FIT_ATTR,g as TEXT_FIT_MIN_FONT,L as TEXT_FIT_POINTS,K as blockSizeOf,b as parseBlockWidthFit,k as parseTextFit};