efficient-web-builder 50.0.0 → 52.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/README.md +1 -1
- package/dist/editor/components/BlogPostSource.js +1 -1
- package/dist/editor/components/HeroPartPanel.js +1 -1
- package/dist/editor/components/MediaUploadField.js +1 -1
- package/dist/editor/components/PartTextBox.js +1 -1
- package/dist/editor/components/PreviewPartStyleContext.d.ts +2 -2
- package/dist/editor/components/SectionEditor.js +1 -1
- package/dist/editor/components/SiteTextStylesField.d.ts +2 -1
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/components/ThemeCard.js +1 -1
- package/dist/editor/components/WebsiteScreenParts.js +1 -1
- package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
- package/dist/editor/components/storefront-editor.css +13 -45
- package/dist/editor/components/usePartMotion.d.ts +1 -1
- package/dist/editor/components/usePartTypingDeps.d.ts +2 -0
- package/dist/editor/components/usePartTypingDeps.js +1 -0
- package/dist/editor/lib/animation/entrance-fields.js +1 -1
- package/dist/editor/lib/animation/fields.d.ts +1 -1
- package/dist/editor/lib/animation/fields.js +1 -1
- package/dist/editor/lib/animation/hover-fields.d.ts +7 -1
- package/dist/editor/lib/animation/hover-fields.js +1 -1
- package/dist/editor/lib/document/ColourControl.d.ts +11 -8
- package/dist/editor/lib/document/ColourControl.js +1 -1
- package/dist/editor/lib/document/blocks/general/Cards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroSlide/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/ImageBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/PostCard/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Series/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/StatsParagraph/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/blocks/hero-shared-fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
- package/dist/editor/lib/document/canvas-typing.d.ts +1 -0
- package/dist/editor/lib/document/canvas-typing.js +1 -1
- package/dist/editor/lib/document/card-copy-rows.d.ts +12 -0
- package/dist/editor/lib/document/card-copy-rows.js +1 -0
- package/dist/editor/lib/document/controls.d.ts +15 -4
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/darken-fields.d.ts +4 -0
- package/dist/editor/lib/document/darken-fields.js +1 -0
- package/dist/editor/lib/document/overrides.js +1 -1
- package/dist/editor/lib/document/passes/inspector.js +1 -1
- package/dist/format/components/stored-pick-row.d.ts +8 -0
- package/dist/format/components/stored-pick-row.js +1 -0
- package/dist/format/lib/animation/hover.d.ts +32 -1
- package/dist/format/lib/animation/hover.js +1 -1
- package/dist/format/lib/content/borders.d.ts +4 -2
- package/dist/format/lib/content/borders.js +1 -1
- package/dist/format/lib/content/box-layout.d.ts +11 -0
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/box-shape.d.ts +2 -1
- package/dist/format/lib/content/box-shape.js +1 -1
- package/dist/format/lib/content/button-icon.d.ts +1 -1
- package/dist/format/lib/content/button-icon.js +1 -1
- package/dist/format/lib/content/card-state.d.ts +8 -0
- package/dist/format/lib/content/card-state.js +1 -0
- package/dist/format/lib/content/card-template.d.ts +6 -0
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/image-treatment.d.ts +23 -4
- package/dist/format/lib/content/image-treatment.js +1 -1
- package/dist/format/lib/content/section-background.d.ts +10 -3
- package/dist/format/lib/content/section-background.js +1 -1
- package/dist/format/lib/content/section-min-height.d.ts +17 -1
- package/dist/format/lib/content/section-min-height.js +1 -1
- package/dist/format/lib/content/section-sticky.d.ts +9 -0
- package/dist/format/lib/content/section-sticky.js +1 -1
- package/dist/format/lib/document/blocks/general/Hero/meta.js +1 -1
- package/dist/format/lib/document/blocks/general/HeroSingle/meta.js +1 -1
- package/dist/format/lib/document/box-footer.js +1 -1
- package/dist/format/lib/document/card-template-layers.d.ts +1 -1
- package/dist/format/lib/document/card-template-layers.js +1 -1
- package/dist/format/lib/document/easel-row-words.d.ts +1 -0
- package/dist/format/lib/document/easel-row-words.js +1 -1
- package/dist/format/lib/document/part-inks.d.ts +5 -10
- package/dist/format/lib/document/part-inks.js +1 -1
- package/dist/format/lib/document/passes/card-template-on-insert.d.ts +2 -0
- package/dist/format/lib/document/passes/card-template-on-insert.js +1 -0
- package/dist/format/lib/document/passes/types.d.ts +7 -0
- package/dist/format/lib/document/section-catalog.js +2 -2
- package/dist/format/lib/document/show-when-attach.d.ts +2 -1
- package/dist/format/lib/document/show-when-attach.js +1 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +9 -5
- package/dist/format/lib/editor-words-catalogue.js +4 -4
- package/dist/format/lib/sections/hero-overlay.js +1 -1
- package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
- package/dist/format/lib/source-rules/panel-rows-use-the-shared-row.d.ts +4 -0
- package/dist/format/lib/source-rules/panel-rows-use-the-shared-row.js +37 -20
- package/dist/format/lib/source-rules/support/part-slider-call-sites.d.ts +0 -1
- package/dist/format/lib/source-rules/support/part-slider-call-sites.js +6 -6
- package/dist/format/lib/text-styles/site-text-colours.d.ts +11 -0
- package/dist/format/lib/text-styles/site-text-colours.js +1 -0
- package/dist/format/lib/theme.d.ts +1 -0
- package/dist/format/lib/theme.js +3 -3
- package/dist/format/lib/word-styles.d.ts +0 -1
- package/dist/format/lib/word-styles.js +1 -1
- package/dist/render/components/ButtonBlock.d.ts +2 -1
- package/dist/render/components/ButtonBlock.js +1 -1
- package/dist/render/components/CardRowContext.d.ts +5 -2
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/ContactLocations.d.ts +3 -1
- package/dist/render/components/ContactLocations.js +2 -2
- package/dist/render/components/Flex.d.ts +6 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/HeroPictures.d.ts +10 -0
- package/dist/render/components/HeroPictures.js +1 -1
- package/dist/render/components/HeroSingle.js +1 -1
- package/dist/render/components/HeroSlide.js +1 -1
- package/dist/render/components/ImageBlock.d.ts +6 -1
- package/dist/render/components/ImageBlock.js +1 -1
- package/dist/render/components/Manifesto.d.ts +3 -1
- package/dist/render/components/Manifesto.js +1 -1
- package/dist/render/components/PhotoHoverSheet.d.ts +4 -0
- package/dist/render/components/PhotoHoverSheet.js +1 -0
- package/dist/render/components/PictureWash.d.ts +6 -0
- package/dist/render/components/PictureWash.js +1 -0
- package/dist/render/components/Placeholder.js +1 -1
- package/dist/render/components/PostCard.js +1 -1
- package/dist/render/components/Split.d.ts +3 -1
- package/dist/render/components/Split.js +1 -1
- package/dist/render/components/Text.d.ts +2 -2
- package/dist/render/components/Text.js +1 -1
- package/dist/render/components/goldPhrases.js +2 -2
- package/dist/render/lib/animation/part-motion.js +2 -2
- package/dist/render/lib/content/block-size.d.ts +1 -0
- package/dist/render/lib/content/block-size.js +1 -1
- package/dist/render/lib/content/box-shared-columns.js +1 -1
- package/dist/render/lib/document/blocks/general/Cards/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ContactLocations/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/ImageBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Manifesto/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Split/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +2 -0
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-locations.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-stats.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-timeline.js +2 -2
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/block-size.js +1 -1
- package/dist/render/lib/document/passes/borders.js +1 -1
- package/dist/render/lib/document/passes/index.js +1 -1
- package/dist/render/lib/document/passes/section-animation.js +1 -1
- package/dist/render/lib/document/passes/section-height.js +1 -1
- package/dist/render/lib/document/passes/section-sticky.js +1 -1
- package/dist/render/lib/document/show-when.d.ts +1 -1
- package/dist/render/lib/document/show-when.js +1 -1
- package/dist/render/lib/text-styles/site-text-styles.js +2 -2
- package/package.json +4 -4
- package/dist/editor/components/PartInkControl.d.ts +0 -7
- package/dist/editor/components/PartInkControl.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{phoneKey as
|
|
1
|
+
import{phoneKey as h}from"efficient-easel/draw";import{COUNT_KEY_PROP as g}from"../../../../../format/lib/content/block-sources.js";import{resolveSectionBackground as u,THEME_SECTION_BG as T}from"../../../../../format/lib/content/section-background.js";import{finiteNumber as B}from"../../../../../format/lib/finite-number.js";import{hasWords as s}from"../../../sections/section-to-box.js";import{DROP_COMMON as m,DROP_SIDE_PADDING as f,INNER_BOX as o,NUMBER_TEXT as w,SAME_KEYS as S,SECTION_BOX as b,TEXT as y,bandAccent as O,bandProps as A,bandWrites as E,fillFrom as N,innerPad as R,innerPadKeys as H,smallText as i,wrapperPad as I,wrapperPadKeys as v}from"./section-to-box-row-parts.js";import{fluidToken as M,headTree as F,token as n}from"./section-head-looks.js";import{SECTION_BG_BUILT_IN as P}from"../../../../../format/lib/document/blocks/general/section-bg-built-in.js";const p=e=>typeof e=="string"?e.trim():"";function k(e){const t=`${p(e.prefix)}${p(e.value)}`,a=p(e.suffix);return e.emphasizeAll===!0?t?`==_${t}_==`:"":`${t}${a?`==_${a}_==`:""}`}const d={kind:"block",type:"Text",props:{...w,_partStyles:{text:{textStyle:"heading-2",...M("headingMedium",56,7,96),weight:500,case:"none",lineHeight:.9,letterSpacing:-.04}}},box:[["value","text",(e,t)=>k(t)]],when:(e,t)=>t!==void 0&&typeof t.value=="string"&&k(t)!==""},x=e=>s(e?.supSuffix),c=e=>u(e.background,P.StatsParagraph),r=e=>c(e)===T,l=e=>({...e,sectionAccent:e.sectionAccent??0}),C=(e,t)=>r(e)?N("background")(e,t):{},D={name:"Stats with Text",skip:e=>c(e)&&c(e)!=="transparent"&&!r(e)?"it paints a colour of its own, not the section band":void 0,boxProps:(e,t)=>({...b,direction:"column",gap:60,gapPhone:60,sectionBorder:{bottom:1},...R(e,"StatsParagraph"),...r(e)?A(l(e),t):{}}),box:[...S.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,a)=>r(t)?O(e,l(t),a):e],...H("StatsParagraph")],site:(e,t)=>r(e.props)?E({props:l(e.props)},t):[],parts:[F("StatsParagraph"),{kind:"group",name:"Stats",props:{...o,gap:0},parts:[{kind:"list",key:"stats",name:"Stat",perRow:()=>4,rowName:"Stats row",rowProps:{...o,direction:"row",gap:0,share:"equal",phoneRow:2,[h("share")]:"content"},props:(e,t)=>({...o,justify:"between",gap:12,gapPhone:12,sectionHeightMode:"fixed",sectionHeightValue:242,sectionHeightUnit:"px",widthFitPhone:"fixed",widthPhone:800,sectionPaddingTop:48,sectionPaddingBottom:48,sectionPaddingLeft:32,sectionPaddingRight:32,sectionBorder:{top:1,right:1,bottom:1,left:1},...C(e,t)}),parts:[{...d,when:(e,t)=>!x(t)&&d.when(e,t)},{kind:"group",name:"Figure",props:{...o,direction:"row",align:"start",gap:32,gapPhone:32,share:"content",phoneRow:2,[h("share")]:"content"},when:(e,t)=>x(t),parts:[d,{kind:"text",key:"supSuffix",props:y,style:{textStyle:"body-5",...n("label",13),weight:500,color:"accent",letterSpacing:.18,lineHeight:1,padding:12}}]},{kind:"group",name:"Words",props:{...o,gap:4,gapPhone:4},parts:[{kind:"text",key:"label",props:y,style:{textStyle:"body-1",fontRole:"heading",...n("body",16),lineHeight:1.5,letterSpacing:-.01}},i("sub",{color:"labels",...n("label",12),lineHeight:1.5,letterSpacing:.24})]}]}]}],drop:{...m,...f,background:"the band is the Box's theme: the site's band preset (`sectionAccent`), or a declared band-preset write; none paints nothing, and any other colour is skipped",headPlacement:"needs a row per head placement: an own-box Stats with Text draws no head (its words sit in a Section Header above it), the row always draws the head"}},K=new Set(["value","label",g]),_={top:48,bottom:48,topPhone:48,bottomPhone:48},U=e=>{const t=u(typeof e.background=="string"?e.background:void 0,P.Stats);return!!t&&t!=="transparent"},$={name:"Stats",skip:e=>U(e)?"it paints a colour inside its padding, and a Box paints its Fill over the padding too":s(e.dataSource)?"its figures come from a source":Array.isArray(e.items)&&e.items.some(t=>s(t?.[g]))?"a figure names a count, and each figure Text here is typed by hand until it is linked":Array.isArray(e.items)&&e.items.some(t=>Object.keys(t??{}).some(a=>!K.has(a)))?"a figure has a key no part here reads":Object.keys(e._partStyles??{}).some(t=>t!=="heading")?"a figure or a name has a style of its own, kept by kind, which no part here reads":void 0,boxProps:e=>({...b,direction:"column",gap:24,gapPhone:24,...I(e,_)}),box:[...S,...v(_)],parts:[i("heading",{color:"labels",...n("label",12),letterSpacing:.2}),{kind:"group",name:"Stats",props:{...o,gap:32,gapPhone:32},parts:[{kind:"list",key:"items",name:"Stat",perRow:e=>B(e.columns)??4,rowName:"Stats row",rowProps:{...o,direction:"row",gap:32,gapPhone:32,share:"equal",phoneRow:2},props:{...o,gap:8,gapPhone:8,sectionBorder:{top:1},sectionPaddingTop:20},parts:[{kind:"text",key:"value",props:w,style:{textStyle:"heading-2",...n("headingMedium",48,36),weight:500,case:"none",lineHeight:1,letterSpacing:-.03}},i("label",{color:"labels",...n("label",12),letterSpacing:.2})]}]}],drop:{...m,...f,columns:"the rows of N: one row Box per `columns` figures, which the Box draws",dataSource:"an empty source is typed figures, what the row draws; a sourced node is skipped (0 Hartes nodes)",dataSourceOptions:"read only with a source; a sourced node is skipped (0 Hartes nodes)",contained:"the Box draws the site frame now; each figure fills the Box's column",background:"only no fill reaches here: a node that paints a colour is skipped"}},V={StatsParagraph:D,Stats:$};export{V as STATS_SECTION_TO_BOX,k as figureWords};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{BUTTON as
|
|
1
|
+
import{resolveSectionBackground as E,THEME_SECTION_BG as I}from"../../../../../format/lib/content/section-background.js";import{SECTION_BG_BUILT_IN as P}from"../../../../../format/lib/document/blocks/general/section-bg-built-in.js";import{BUTTON as m,DIM as s,bandAccent as B,bandIndex as N,bandWrites as O,fillNoBoxHolds as H,ownFill as M,DROP_COMMON as b,DROP_SIDE_PADDING as u,INNER_BOX as r,SAME_KEYS as y,SECTION_BOX as k,lineBorder as x,TEXT as l,innerPad as T,innerPadKeys as w}from"./section-to-box-row-parts.js";import{splitParagraphs as A}from"../../../../components/goldPhrases.js";import{TIMELINE_YEAR_BOX as C,TIMELINE_YEAR_HEAD as f}from"../../../../../format/lib/sections/timeline-year-shape.js";import{boxPadding as v}from"../../../../../format/lib/document/seed-parts.js";const D="jetbrains-mono",S="space-grotesk",i=(e,t,n={})=>({textStyle:"body-5",font:D,size:e,sizePhone:e,letterSpacing:t,lineHeight:1.5,weight:400,...n}),p=(e,t,n,d)=>({font:S,size:e,sizePhone:t,case:"upper",weight:500,letterSpacing:n,lineHeight:d}),a=(e,t,n,d={})=>({textStyle:"body-1",font:S,size:e,sizePhone:t,weight:400,case:"none",lineHeight:n,...d}),o=(e,t,n={})=>({kind:"text",key:e,props:l,style:t,...n}),_=(e,t)=>t?.future===!0,c=e=>A(typeof e?.body=="string"?e.body:""),g=e=>E(typeof e.background=="string"?e.background:void 0,P.TimelineTrack),h=e=>g(e)===I?e:{...e,background:"transparent"},R={name:"Milestone Timeline",skip:e=>H(g(e)),boxProps:(e,t)=>{const n=N(h(e),t);return{...k,direction:"column",gap:60,sectionBorder:{bottom:1},...T(e,"TimelineTrack"),...M(g(e),e,t),...n>=0?{sectionAccent:n}:{}}},box:[...y.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,n)=>B(e,h(t),n)],...w("TimelineTrack")],parts:[{kind:"group",name:"Heading",props:{...r,direction:"row",align:"end",justify:"between",gap:40,share:"content",sectionPaddingBottom:32,sectionBorder:{bottom:1}},parts:[{kind:"group",name:"Title",props:{...r,direction:"row",align:"end",gap:40,share:"content"},parts:[o("eyebrow",i(13,.3,{case:"upper",color:"accent",padding:8}),{role:"eyebrow"}),o("title",{textStyle:"heading-2",...p(79,40,-.03,1)},{role:"heading"})]},o("intro",a(14,14,1.5),{props:{...s,align:"right",maxWidth:360}})]},{kind:"group",name:"Years",props:{...r,direction:"row",share:"equal",gap:0,line:!0},parts:[{kind:"list",key:"entries",name:"Year",props:{...r,...C},item:e=>({props:e.future===!0?{upcoming:!0}:{}}),parts:[{kind:"group",name:f.name,props:{...r,...f},parts:[o("date",i(13,.22,{color:"accent"}),{when:(e,t)=>!_(e,t)}),o("date",i(13,.22,{color:"labels"}),{when:_}),o("title",{textStyle:"heading-3",...p(20,20,-.02,1.1)},{role:"heading"})]},o("blurb",a(13,13,1.55),{props:s})]}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"ghost",props:(e,t)=>({...m,align:"right",...x(e,t)}),style:i(13,.3,{case:"upper"})}],site:(e,t)=>O({props:h(e.props)},t),drop:{...b,...u,background:"another colour is the Box's Fill, or a skip if no Fill holds it; 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"}},Y={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=>({...k,direction:"row",share:"twoThree",gap:80,align:"start",...T(e,"Timeline")}),box:[...y,...w("Timeline")],parts:[{kind:"group",name:"Heading",props:{...r,gap:24},parts:[o("eyebrow",i(12,.3,{case:"upper",color:"accent"}),{role:"eyebrow"}),o("title",{textStyle:"heading-2",...p(72,40,-.03,.94)},{role:"heading"}),o("intro",a(14,14,1.6),{props:{...s,maxWidth:360}}),{kind:"group",name:"Picture",keepEmpty:!0,box:[["imageSrc","bgImage"]],props:{...r,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",...v(12,16)},when:e=>typeof e.imageSrc=="string"&&e.imageSrc.trim()!=="",parts:[{kind:"group",name:"Caption",props:{...r,direction:"row",justify:"between",align:"center",gap:12,share:"content",phoneRow:2},parts:[o("imageCaption",i(11,.24,{case:"upper",color:"text"})),o("imageMeta",i(11,.24,{case:"upper",color:"accent"}),{props:{...l,align:"right"}})]}]},{kind:"button",key:"ctaText",href:"ctaHref",variant:"ghost",props:(e,t)=>({...m,...x(e,t)}),style:i(13,.3,{case:"upper"})}]},{kind:"group",name:"Chapters",props:{...r,gap:48,line:!1},parts:[{kind:"list",key:"entries",name:"Chapter",props:{...r,direction:"row",gap:24,share:"biggerRight",align:"start"},parts:[o("date",i(13,.24,{color:"accent"})),{kind:"group",name:"Words",props:{...r,gap:14},parts:[o("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}]}]}]}],drop:{...
|
|
3
|
+
`)]],when:(e,t)=>c(t).length>1}]}]}]}],drop:{...b,...u,layout:"Split is the only display converted (see skip); the Box's own arrangement replaces it"}},G={TimelineTrack:R,Timeline:Y};export{G as TIMELINE_SECTION_TO_BOX};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as J,textStyleCaseOfCss as Q}from"efficient-easel/draw";import{parseHexColor as tt}from"efficient-shell/format";import{FONT_OPTIONS as et,fontOption as nt,fontRoleOf as R,SIZE_STEP_OF_ROLE as z}from"../../../format/lib/fonts.js";import{encodePartKey as ot}from"../../../format/lib/document/part-key.js";import{decodePartId as L,normalizePartText as E}from"./text-parts.js";import{COLOUR_TOKEN as M}from"../../../format/lib/word-styles.js";import{regionStyle as rt}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as it}from"../content/view-values.js";import{plainRecord as O,propsWithPartRecord as at,readPartRecord as st,readPartRecords as ft}from"../../../format/lib/document/part-records.js";const $="_partStyles",ct="data-sf-part-styled",H="data-sf-text-style",ut=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&ut.test(t)}const j={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function lt(t){if(!t)return null;for(const[e,n]of Object.entries(j))if(n===t)return e;return null}function Se(t){if(g(t.textStyle))return t.textStyle;const e=R(t.role);return e?j[e]:void 0}const pt=[400,500,600,700],_=["left","center","right","justify"],D=5,C=1e3,dt=-5,xt=10,ht=0,St=64,gt=2,W={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:ht,max:St,step:gt}},mt=.05,Pt=.01,Tt=["line","letter"],bt=.5,Rt=2.5,_t=-1,At=1,zt=0,Et=400,Ot=[...new Set(Object.values(z))];function ge(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function me(t){return ft(t,$)}function K(t,e){return st(t,$,e)}function Pe(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){return at(t,$,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Tt.includes(t)}const b=(t,e,n)=>Math.min(n,Math.max(e,t));function wt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:b(n,dt,xt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(b(n,bt,Rt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(b(n,_t,At),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:b(n,zt,Et)}if(Object.hasOwn(W,t)){const{min:n,max:o}=W[t],r=Math.round(Number(e));return Number.isFinite(r)?b(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?R(e)?e:null:t==="sizeToken"?w(e)?e:null:t==="textStyle"?g(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Nt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function y(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&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!g(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!w(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!R(t.fontRole)&&n("fontRole"),e??t}function w(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,a=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,s=f=>typeof f=="string"&&Ot.includes(f);return s(e)&&a(n)&&(o===void 0||s(o))&&(r===void 0||a(r))&&(i===void 0||It(i,n))}function It(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 v(t){return t?.pxPhone&&w(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function X({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 Ft=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function kt(t){const e=[];for(const[n,o]of Ft)n===t?e.push(o):o===t&&e.push(n);return e}function Te(t,e,n,o){const r={...K(t,e)},i=o==null?null:wt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const a of kt(n))delete r[a]}return G(t,e,r)}function be(t,e){return G(t,e,{})}function Lt(t){return Q(t)??"none"}function Mt(t){return J(t)??""}const B={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 Ht(t,e){const n=R(t.role);return n||(e?.blockDrawsStyle?null:lt(t.textStyle))}function Re(t,e){return t==="Text"&&e==="text"}const jt={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 Dt(t){const e=z[t],n=jt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ct(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Wt+t.line*mt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Pt,4)),e}const Wt=1,m="--sf-part-para";function Kt(t){t=y(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=v(t.sizeToken);n&&(e.fontSize=X(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Gt(t,e){if(!e)return t;const n=y(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=v(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function N(t,e,n){return I(Gt(t,e),A,n)}function U(t,e){const n=e?"sizePhone":"size";if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function _e(t,e,n){const o=N(U(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function I(t,e,n){t=y(t);const o=Ht(t,n),r=Ct(t),i=t.size?`${t.size}px`:t.sizeToken?X(t.sizeToken):o?Dt(o):"";return{fontFamily:t.font?Ut(t.font):t.fontRole?`var(${B[t.fontRole]})`:o?`var(${B[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`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Mt(t.case),textAlign:t.align??"",paddingTop:V(t.padding),paddingBottom:V(t.padding),color:vt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const vt=t=>t===void 0||t===""?"":Object.hasOwn(M,t)?M[t]:tt(t)===t.toLowerCase()?t:"",V=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Ae(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:Xt(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:Bt(t.textAlign),case:Lt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Xt(t){return Number.isFinite(t)?pt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Bt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function ze(t,e){const n=Y(t);if(!n)return"";for(const o of et)if(Y(e(o.cssVar))===n)return o.key;return""}const Y=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ut(t){const e=nt(t);return e?`var(${e.cssVar})`:""}function Ee(t,e,n,o){return!e||L(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Vt(t,e){return Object.hasOwn(t,e)?O(t[e])??{}:{}}function Oe(t,e,n=()=>A,o=s=>s,r=qt,i=!1,a=()=>!1){let s=0;for(const{element:f,partId:p}of t){const c=L(p)?.propKey;if(!c)continue;const l=Vt(e,o(c)),d=N(l,i,{blockDrawsStyle:a(c)});g(l.textStyle)?f.setAttribute?.(H,l.textStyle):f.removeAttribute?.(H);const u=k.some(x=>f.style[x]);let h=!1;for(const[x,S]of Object.entries(d))te(f,x,S),S&&(h=!0);if(u||k.some(x=>d[x]))for(const x of Yt(f,r))for(const S of k)x.style[S]=d[S]??"";h&&(s+=1)}return s}function Yt(t,e){const n=E(t.textContent??""),o=[];let r=t;for(let i=0;i<Zt&&e(r);i+=1){const a=r.parentElement;if(!a||E(a.textContent??"")!==n)break;o.push(a),r=a}return o}const Zt=8;function qt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Jt(t){if(!t||typeof t!="object")return null;const e={};return g(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function Qt(t,e){const n=Jt(t);if(!n)return{};const o=N(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function $e(t){return g(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function ye(t,e,n){if(!t||typeof t!="object")return{};const o=rt(t.role,e,z)??{},r=e.sized?Qt(U(t,n),n):{};return{...o,...r}}function we(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function te(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===m&&(n?r.setAttribute?.(Z,""):r.removeAttribute?.(Z))}const Z="data-sf-part-para",ee=Object.keys(I({},A)),F=new Set(["color","overflowWrap",m,"fontStyle"]),k=ee.filter(t=>!F.has(t));function Ne(t,e,n,o=s=>s,r=()=>!1,i=()=>null,a=[]){const s=new Map;for(const c of t){const l=ot(c.key,c.row);for(const d of c.texts){const u=s.get(d);u?(u.keys.add(c.key),u.partKeys.add(l)):s.set(d,{keys:new Set([c.key]),partKeys:new Set([l])})}}const f=new Map;for(const c of new Set([...Object.keys(e),...a])){if(!ne(c))continue;const l=q(n,c,O(e[c])??{},!1,i(c));l&&f.set(c,l)}const p=new Map;for(const[c,{keys:l,partKeys:d}]of s){const u=d.size===1?[...d][0]:l.size===1?[...l][0]:null;if(!u)continue;const h=o(u),T=i(h);if(!Object.hasOwn(e,h)&&!T)continue;const x=O(e[h])??{},S=q(n,u,x,r(u),T);S&&p.set(c,S)}return p.size||f.size?{rules:p,kindRules:f,drawn:new Set(s.keys())}:null}function q(t,e,n,o,r){const i=I(n,A,{blockDrawsStyle:o}),a=Kt(n),s=g(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(a).length&&!s&&!r?null:{stamp:oe(t,e),declarations:i,...Object.keys(a).length?{phone:a}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ne(t){return t.startsWith("@")}function Ie(t,e){return t?.kindRules.get(e)??null}function oe(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Fe(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:a}=r;if(n.has(i))return;n.add(i);const s=Object.entries(a).filter(([,u])=>u!==""),f=u=>u.map(([h,T])=>`${ie(h)}: ${T}`).join("; "),p=`[${ct}="${i}"]`,c=s.filter(([u])=>!F.has(u)),l=s.filter(([u])=>F.has(u));c.length&&e.push(`${p}, *:has(> ${p}) { ${f(c)} }`),l.length&&e.push(`${p} { ${f(l)} }`),a[m]&&(e.push(`*:has(> ${p}) { ${m}: ${a[m]} }`),e.push(...re(p,`*:has(> ${p})`)));const d=Object.entries(r.phone??{}).filter(([,u])=>u!=="");d.length&&e.push(`@media ${it} { ${p}, *:has(> ${p}) { ${f(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{FONT_OPTIONS as Q,fontOption as tt,fontRoleOf as R,SIZE_STEP_OF_ROLE as z}from"../../../format/lib/fonts.js";import{encodePartKey as et}from"../../../format/lib/document/part-key.js";import{decodePartId as M,normalizePartText as E}from"./text-parts.js";import{partInkCss as nt}from"../../../format/lib/document/part-inks.js";import{regionStyle as ot}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as rt}from"../content/view-values.js";import{plainRecord as $,propsWithPartRecord as it,readPartRecord as at,readPartRecords as st}from"../../../format/lib/document/part-records.js";const y="_partStyles",ft="data-sf-part-styled",L="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function g(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 lt(t){if(!t)return null;for(const[e,n]of Object.entries(H))if(n===t)return e;return null}function xe(t){if(g(t.textStyle))return t.textStyle;const e=R(t.role);return e?H[e]:void 0}const ut=[400,500,600,700],_=["left","center","right","justify"],j=5,D=1e3,pt=-5,dt=10,xt=0,ht=64,St=2,C={size:{min:j,max:D,step:1},sizePhone:{min:j,max:D,step:1},padding:{min:xt,max:ht,step:St}},gt=.05,mt=.01,Pt=["line","letter"],Tt=.5,bt=2.5,Rt=-1,_t=1,At=0,zt=400,Et=[...new Set(Object.values(z))];function he(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Se(t){return st(t,y)}function v(t,e){return at(t,y,e)}function ge(t,e){return Object.values(v(t,e)).filter(n=>n!==void 0).length}function W(t,e,n){return it(t,y,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Pt.includes(t)}const b=(t,e,n)=>Math.min(n,Math.max(e,t));function Nt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:b(n,pt,dt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(b(n,Tt,bt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(b(n,Rt,_t),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:b(n,At,zt)}if(Object.hasOwn(C,t)){const{min:n,max:o}=C[t],r=Math.round(Number(e));return Number.isFinite(r)?b(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?R(e)?e:null:t==="sizeToken"?O(e)?e:null:t==="textStyle"?g(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Ot=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function N(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Ot){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!g(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!O(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!R(t.fontRole)&&n("fontRole"),e??t}function O(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,a=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,s=f=>typeof f=="string"&&Et.includes(f);return s(e)&&a(n)&&(o===void 0||s(o))&&(r===void 0||a(r))&&(i===void 0||wt(i,n))}function wt(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 G(t){return t?.pxPhone&&O(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function K({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 It=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ft(t){const e=[];for(const[n,o]of It)n===t?e.push(o):o===t&&e.push(n);return e}function me(t,e,n,o){const r={...v(t,e)},i=o==null?null:Nt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const a of Ft(n))delete r[a]}return W(t,e,r)}function Pe(t,e){return W(t,e,{})}function kt(t){return J(t)??"none"}function Mt(t){return q(t)??""}const X={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Lt(t,e){const n=R(t.role);return n||(e?.blockDrawsStyle?null:lt(t.textStyle))}function Te(t,e){return t==="Text"&&e==="text"}const Ht={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function jt(t){const e=z[t],n=Ht[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Dt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ct+t.line*gt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*mt,4)),e}const Ct=1,m="--sf-part-para";function vt(t){t=N(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=G(t.sizeToken);n&&(e.fontSize=K(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Wt(t,e){if(!e)return t;const n=N(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=G(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function w(t,e,n){return I(Wt(t,e),A,n)}function B(t,e){const n=e?"sizePhone":"size";if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function be(t,e,n){const o=w(B(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function I(t,e,n){t=N(t);const o=Lt(t,n),r=Dt(t),i=t.size?`${t.size}px`:t.sizeToken?K(t.sizeToken):o?jt(o):"";return{fontFamily:t.font?Bt(t.font):t.fontRole?`var(${X[t.fontRole]})`:o?`var(${X[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`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Mt(t.case),textAlign:t.align??"",paddingTop:U(t.padding),paddingBottom:U(t.padding),color:Gt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Gt=t=>nt(t),U=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Re(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:Xt(t.textAlign),case:kt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Kt(t){return Number.isFinite(t)?ut.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Xt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function _e(t,e){const n=V(t);if(!n)return"";for(const o of Q)if(V(e(o.cssVar))===n)return o.key;return""}const V=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Bt(t){const e=tt(t);return e?`var(${e.cssVar})`:""}function Ae(t,e,n,o){return!e||M(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Ut(t,e){return Object.hasOwn(t,e)?$(t[e])??{}:{}}function ze(t,e,n=()=>A,o=s=>s,r=Zt,i=!1,a=()=>!1){let s=0;for(const{element:f,partId:p}of t){const c=M(p)?.propKey;if(!c)continue;const u=Ut(e,o(c)),d=w(u,i,{blockDrawsStyle:a(c)});g(u.textStyle)?f.setAttribute?.(L,u.textStyle):f.removeAttribute?.(L);const l=k.some(x=>f.style[x]);let h=!1;for(const[x,S]of Object.entries(d))Qt(f,x,S),S&&(h=!0);if(l||k.some(x=>d[x]))for(const x of Vt(f,r))for(const S of k)x.style[S]=d[S]??"";h&&(s+=1)}return s}function Vt(t,e){const n=E(t.textContent??""),o=[];let r=t;for(let i=0;i<Yt&&e(r);i+=1){const a=r.parentElement;if(!a||E(a.textContent??"")!==n)break;o.push(a),r=a}return o}const Yt=8;function Zt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function qt(t){if(!t||typeof t!="object")return null;const e={};return g(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function Jt(t,e){const n=qt(t);if(!n)return{};const o=w(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Ee(t){return g(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function $e(t,e,n){if(!t||typeof t!="object")return{};const o=ot(t.role,e,z)??{},r=e.sized?Jt(B(t,n),n):{};return{...o,...r}}function ye(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function Qt(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===m&&(n?r.setAttribute?.(Y,""):r.removeAttribute?.(Y))}const Y="data-sf-part-para",te=Object.keys(I({},A)),F=new Set(["color","overflowWrap",m,"fontStyle"]),k=te.filter(t=>!F.has(t));function Ne(t,e,n,o=s=>s,r=()=>!1,i=()=>null,a=[]){const s=new Map;for(const c of t){const u=et(c.key,c.row);for(const d of c.texts){const l=s.get(d);l?(l.keys.add(c.key),l.partKeys.add(u)):s.set(d,{keys:new Set([c.key]),partKeys:new Set([u])})}}const f=new Map;for(const c of new Set([...Object.keys(e),...a])){if(!ee(c))continue;const u=Z(n,c,$(e[c])??{},!1,i(c));u&&f.set(c,u)}const p=new Map;for(const[c,{keys:u,partKeys:d}]of s){const l=d.size===1?[...d][0]:u.size===1?[...u][0]:null;if(!l)continue;const h=o(l),T=i(h);if(!Object.hasOwn(e,h)&&!T)continue;const x=$(e[h])??{},S=Z(n,l,x,r(l),T);S&&p.set(c,S)}return p.size||f.size?{rules:p,kindRules:f,drawn:new Set(s.keys())}:null}function Z(t,e,n,o,r){const i=I(n,A,{blockDrawsStyle:o}),a=vt(n),s=g(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(a).length&&!s&&!r?null:{stamp:ne(t,e),declarations:i,...Object.keys(a).length?{phone:a}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ee(t){return t.startsWith("@")}function Oe(t,e){return t?.kindRules.get(e)??null}function ne(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function we(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:a}=r;if(n.has(i))return;n.add(i);const s=Object.entries(a).filter(([,l])=>l!==""),f=l=>l.map(([h,T])=>`${re(h)}: ${T}`).join("; "),p=`[${ft}="${i}"]`,c=s.filter(([l])=>!F.has(l)),u=s.filter(([l])=>F.has(l));c.length&&e.push(`${p}, *:has(> ${p}) { ${f(c)} }`),u.length&&e.push(`${p} { ${f(u)} }`),a[m]&&(e.push(`*:has(> ${p}) { ${m}: ${a[m]} }`),e.push(...oe(p,`*:has(> ${p})`)));const d=Object.entries(r.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${rt} { ${p}, *:has(> ${p}) { ${f(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
|
|
2
|
+
`)}function oe(t,e){const n=`var(${m})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const re=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Ie(t,e){if(!t)return null;const n=E(e),o=t.rules.get(n);if(o)return o;if(n.length<ie||t.drawn.has(n))return null;let r=null;for(const[i,a]of t.rules)if(i.includes(n)){if(r&&r.stamp!==a.stamp)return null;r=a}return r}const ie=8;export{_ as PART_ALIGNS,_t as PART_LETTER_EM_MAX,Rt as PART_LETTER_EM_MIN,mt as PART_LETTER_STEP,bt as PART_LINE_HEIGHT_MAX,Tt as PART_LINE_HEIGHT_MIN,gt as PART_LINE_STEP,C as PART_MEASURED_TRACKS,dt as PART_NUDGE_MAX,pt as PART_NUDGE_MIN,ht as PART_PADDING_MAX,xt as PART_PADDING_MIN,St as PART_PADDING_STEP,Y as PART_PARAGRAPH_ATTR,zt as PART_PARAGRAPH_MAX,At as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Pt as PART_RELATIVE_PROPS,D as PART_SIZE_MAX,j as PART_SIZE_MIN,Et as PART_SIZE_STEPS,ft as PART_STYLED_ATTR,y as PART_STYLES_PROP,te as PART_STYLE_PROPERTIES,ut as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,H as STYLE_ID_OF_ROLE,L as TEXT_STYLE_ATTR,ze as applyPartStyles,Te as blockDrawsTextStyle,xe as followedStyleOf,ee as isPartKindKey,g as isTextStyleId,oe as paragraphRules,w as partCanvasDeclarations,kt as partCaseOfTransform,Mt as partCaseTransform,_e as partFontKeyOf,he as partLiftRules,vt as partPhoneDeclarations,Oe as partRuleForKind,Ie as partRuleForText,be as partShownDeclarations,Dt as partSpacingOf,Re as partStyleBase,ge as partStyleCount,we as partStyleCss,I as partStyleDeclarations,Wt as partStyleForScreen,Ae as partStyleSource,B as partStyleWithoutSizeBox,me as propsWithPartStyleValue,Pe as propsWithoutPartStyle,Ne as publishedPartStyles,v as readPartStyle,Se as readPartStyles,Jt as regionCanvasDeclarations,ye as regionCanvasRestore,Ee as regionHasOwnLook,qt as regionSheetStyle,$e as regionShownDeclarations,Ut as storedPartStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as C}from"react/jsx-runtime";import{parseBlockWidthFit as D,phoneKey as s,tabletKey as l}from"efficient-easel/draw";import{blockSizeOf as j,blockSizeValuesOf as K}from"../../content/block-size.js";import{CellWrap as P}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as A,boxRowColumnsClass as W,boxShareClasses as g,boxShareTabletOf as L,boxTabletColumnsClass as G}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as X}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as Z}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as v}from"../part-styles.js";import{addShowWhenFacts as U,withRowRules as x}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as M}from"./cell-width.js";import{findParentNode as V}from"../../../../format/lib/document/passes/document-position.js";const Y=new Set(["Text","Heading"]),q=new Set(["h1","h2","h3","h4","h5","h6"]);function O(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&q.has(e.tag)?!0:v(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},T={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},B={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]},k={all:[c,{not:{context:"boxSharesWidthTablet",is:!0}}]};function J(t,e){return{any:[{field:l(t),is:e},{all:[{field:l(t),set:!1},{field:t,is:e}]}]}}function y(t,e,i){return{any:[{field:s(t),is:e},{all:[{field:s(t),set:!1},i??{field:t,is:e}]}]}}const H={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},Q=[[["_gBlockSize","minWidth",l("minWidth"),s("minWidth"),"maxWidth",l("maxWidth"),s("maxWidth")],c],[["widthFit"],T],[[l("widthFit")],k],[[s("widthFit")],B],[["width"],{all:[T,{field:"widthFit",is:"fixed"}]}],[[l("width")],{all:[k,J("widthFit","fixed")]}],[[s("width")],{all:[B,y("widthFit","fixed")]}]],I=[[["_gText","textFit",s("textFit")],c],[["minFont"],{all:[c,H]}],[[s("minFont")],{all:[c,y("textFit","shrink",H)]}]],f=(t,e)=>V(e.appState,t.props?.id),h=t=>!!t&&typeof t.type=="string"&&Z(t.type)!==null,S=t=>(t.type==="Flex"||t.type==="HeroGroup")&&X(t.type,t.props?.direction)==="row",w=t=>{const e=D(t);return e!==void 0&&e!=="fit"},$={blockOutsideBox:(t,e)=>!h(f(t,e)),boxSharesWidth:(t,e)=>{const i=f(t,e);return!h(i)||!S(i)?!1:W({...i.props,direction:"row"})!==""?!0:g(i.props?.share)!==""&&!w(t.props?.widthFit)},boxSharesWidthTablet:(t,e)=>{const i=f(t,e);if(!h(i)||!S(i))return!1;if(G(i.props?.[l("columns")])!==""||W({...i.props,direction:"row"})!=="")return!0;const n=L(i.props?.[l("share")])??i.props?.share;return g(n)!==""&&!w(t.props?.[l("widthFit")]??t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const i=f(t,e);if(!h(i)||!S(i))return!1;const n=i.props?.phoneRow;return(Number(n)===2||Number(n)===3)&&!A(n,i.props?.[s("share")])&&!w(t.props?.[s("widthFit")]??t.props?.widthFit)}},tt=t=>/^_[gds][A-Z]/.test(t);function et(t,e,i){const n=Object.entries(t),r=n.findIndex(([a])=>a===e);if(r===-1)return null;let o=r+1;for(;o<n.length&&!tt(n[o][0]);)o++;return Object.fromEntries([...n.slice(0,o),...Object.entries(i),...n.slice(o)])}function N(t,e,i){const n=Object.entries(t);return Object.fromEntries([...n.slice(0,e),...Object.entries(i),...n.slice(e)])}function it(t,e,i){const n=Object.keys(e);if(n.includes("_dSize")){const{_gBlockSize:r,...o}=i;return N(e,n.indexOf("_dSize")+1,o)}return nt.has(t)&&n.includes("_gSpacing")?N(e,n.indexOf("_gSpacing"),i):{...e,...i}}const nt=new Set(["Text","Heading"]);function rt(t,e){const{_gText:i,...n}=e;return et(t,"_gText",n)??{...t,...e}}function st(t){const e=new WeakMap;return i=>{if(!i||!("textFit"in i))return i;let n=e.get(i);if(!n){n={...i};for(const r of["textFit",s("textFit")])r in n&&(n[r]=t[r]);e.set(i,n)}return n}}const bt={name:"blockSize",applies:(t,e,i)=>M.includes(t)&&!!i&&typeof i.render=="function",panel(t,e,i){const n=Y.has(e),{text:r}=i.blockSizeFields(n?{textFit:e==="Heading"?"shrink":"wrap"}:{}),{size:o}=i.blockSizeFields({tablet:!0});let a=it(e,t.fields??{},x(o,Q));if(n){const d=x(r,I);if(a=rt(a,d),e==="Text"){const z=x(i.blockSizeFields({textFit:"shrink"}).text,I),E=st(z),b=t.resolveFields,R=(F,u)=>{const p=b?b(F,u):u.fields,m=_=>O(e,F?.props??{})?E(_??u.fields):_;return p instanceof Promise?p.then(m):m(p)};t.resolveFields=R}}t.fields=a,U(t,{...$,textWrapsByDefault:d=>!O(e,d.props??{})})},draw(t){ot(t)}};function ot(t){const e=t.render;t.render=i=>{const n=j(K(i)),r=e(i);return n===null?r:C(P,{className:n.className,...Object.keys(n.style).length?{style:n.style}:{},attrs:n.attrs,children:r})}}export{bt as blockSize,O as textShrinksByDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import{SECTION_BORDER_CLASS as d,sectionBorderStyle as c}from"../../../../format/lib/content/borders.js";import{PAD_ON_ROOT as a}from"./section-padding.js";const m={name:"sectionBorder",applies:(e,
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{SECTION_BORDER_CLASS as d,sectionBorderStyle as c}from"../../../../format/lib/content/borders.js";import{PAD_ON_ROOT as a}from"./section-padding.js";const m={name:"sectionBorder",applies:(e,o,r)=>o.isSection(e)&&!!r&&typeof r.render=="function",draw(e,o){if(a.has(o))return;const r=e.render;e.render=n=>{const t=c(n.sectionBorder,n.sectionBorderPhone,n.sectionBorderTablet),s=r(n);return t?i("div",{className:d,style:{display:"contents",...t},children:s}):s}}};export{m as sectionBorder};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{
|
|
1
|
+
import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cardTemplateOnInsert as s}from"../../../../format/lib/document/passes/card-template-on-insert.js";import{cellWidth as p}from"./cell-width.js";import{clickableParts as c}from"./clickable-parts.js";import{cardCorners as f,sectionCorners as a}from"./corners.js";import{emptyHeadings as l}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as d}from"../../../../format/lib/document/passes/show-when-rows.js";import{hiddenNodes as h}from"../../../../format/lib/document/passes/hidden-nodes.js";import{mediaValues as u}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as S}from"./section-anchor.js";import{blockEntrance as g,sectionAnimation as b}from"./section-animation.js";import{sectionHeight as w}from"./section-height.js";import{cardSticky as A,sectionSticky as P}from"./section-sticky.js";import{sectionBorder as k}from"./borders.js";import{blockPadding as C,sectionPadding as W}from"./section-padding.js";import{sectionTheme as y,slideTheme as B}from"./section-theme.js";import{buttonAlignInRow as G,containedWidth as T,sectionWidth as E}from"./section-width.js";import{blockGroups as H,sectionGroups as I}from"../../../../format/lib/document/passes/settings-groups.js";import{slotsStartAfresh as L}from"./slots-start-afresh.js";import{openSlotDisallow as O,sectionGroupAllow as R}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as no}from"../../../../format/lib/document/passes/registry-context.js";const z=[L,u,R,O,W,a,k,f,C,g,p,E,T,G,w,S,y,b,P,A,B,n,I,H,d,l,c,h,e,s];function io(r,m,o){const t=m;for(const i of z)i.applies(r,o,t)&&(o.inspector&&i.panel?.(t,r,o.inspector,o),i.draw?.(t,r,o));return m}export{z as BLOCK_PASSES,io as applyBlockPasses,no as registryPassContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as d}from"react/jsx-runtime";import{SectionAnimation as m}from"../../../components/SectionAnimation.js";import{ENTRANCE_EXCLUDED as E,entranceDrawn as f}from"../../animation/entrance.js";import{CARD_HOVER_SECTIONS as l,PICTURE_HOVER_BLOCKS as p}from"../../../../format/lib/animation/hover.js";import{BOX_TYPE as _}from"../../../../format/lib/document/container-blocks.js";const r=Object.fromEntries(p.map(n=>[n,"picture"])),b={[_]:"box",Ticker:"marquee",...Object.fromEntries(l.map(n=>[n,"cards"])),...r},a=(n,e)=>!E.has(n)&&!!e&&typeof e.render=="function";function c(n,e,o,t){n.fields={...n.fields,...o.animationTabFields(e,t)}}function s(n){const e=n,o=e.render;e.render=t=>{const i=f(t);return i?d(m,{desktop:i.desktop,phone:i.phone,editing:!!t.editor?.isEditing,children:o(t)}):o(t)}}const C={name:"sectionAnimation",applies:(n,e,o)=>e.isSection(n)&&a(n,o),panel:(n,e,o)=>c(n,b[e]??"section",o,e),draw:n=>s(n)},I={name:"blockEntrance",applies:(n,e,o)=>!e.isSection(n)&&a(n,o),panel:(n,e,o)=>c(n,r[e]??"block",o,e),draw:n=>s(n)};export{I as blockEntrance,C as sectionAnimation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as v}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as u,SECTION_MIN_HEIGHT_EXCLUDED as E,hasPhoneHeight as _,hasTabletHeight as F,resolvePhoneHeight as T,resolveTabletHeight as w,resolveSectionMinHeight as x,sectionMinHeightAttrs as I}from"../../../../format/lib/content/section-min-height.js";import{CellWrap as M}from"../../../components/InBoxContext.js";import{phoneKey as S,tabletKey as a}from"efficient-easel/draw";import{shownByUsedValue as H,shownForOption as V,withRowRules as b}from"../../../../format/lib/document/show-when-attach.js";const N=(()=>{const e=n=>[[n],[a(n),n],[S(n),a(n),n]],i=n=>({field:n,in:u}),t=n=>r=>V(r,u,"auto",n),[o,s]=[e("sectionHeightValue"),e("sectionHeightUnit")];return e("sectionHeightMode").flatMap((n,r)=>[[[o[r][0]],H(n,i,t(["fixed","screen"]))],[[s[r][0]],H(n,i,t(["fixed"]))]])})(),P={name:"sectionHeight",applies:(e,i,t)=>i.isSection(e)&&!E.has(e)&&!!t&&typeof t.render=="function",panel(e,i,t){const o=t.heightFields;e.fields={...e.fields,...b(o(),N)};const s=e.resolveFields;e.resolveFields=(n,r)=>{const h=s?s(n,r):r.fields,c=n?.props??{},f=x(c),d=F(c)?w(c):null,p=_(c)?T(c):null,l=m=>g(g(O(m,f),"sectionHeightValueTablet",d),"sectionHeightValuePhone",p);return h&&typeof h.then=="function"?h.then(l):l(h)}},draw(e){const i=e.render;e.render=t=>{const o=I(t);return o?v(M,{className:o.className,style:o.style,children:i(t)}):i(t)}}};function O(e,i){if(!e||!("sectionHeightMode"in e)||i.mode==="auto")return e;const t={...e},o=t.sectionHeightValue;return o&&(t.sectionHeightValue={...o,unit:i.unit}),t}function g(e,i,t){if(!e||!(i in e)||!t||t.mode==="auto")return e;const o={...e},s=o[i];return s&&(o[i]={...s,unit:t.unit}),o}export{P as sectionHeight};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as l,sectionStickAttrs as d}from"../../../../format/lib/content/section-sticky.js";import{shownByUsedValue as c,withRowRules as f}from"../../../../format/lib/document/show-when-attach.js";import{SlotsStartAfresh as k}from"../../../components/InBoxContext.js";import{CARD_BLOCK_KEYS as T}from"./corners.js";const m=a("sectionSticky",(e,s,t)=>s.isSection(e)&&!l.has(e)&&!!t&&typeof t.render=="function"),C=a("cardSticky",(e,s,t)=>T.includes(e)&&!!t&&typeof t.render=="function");function a(e,s){return{name:e,applies:s,panel(t,o,i){t.fields={...t.fields,...f(i.stickFields(),S)}},draw(t){const o=t.render;t.render=i=>{const n=d(i);return n?r("div",{className:n.className,style:n.style,children:r(k,{children:o(i)})}):o(i)}}}}const S=(()=>{const e=t=>({field:t,in:[!0,!1]}),s=t=>({field:t,is:!0});return[[["stickTopDistance"],s("stickTop")],[["stickTopDistanceTablet"],c(["stickTopTablet","stickTop"],e,s)],[["stickTopDistancePhone"],c(["stickTopPhone","stickTopTablet","stickTop"],e,s)]]})();export{C as cardSticky,m as sectionSticky};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ShowWhenContext, type ShowWhenRule } from "efficient-shell/format";
|
|
2
2
|
import type { SlotConfigView, TreeItem } from "efficient-easel/draw";
|
|
3
3
|
export type { ShowWhenRule, ShowWhenContext };
|
|
4
|
-
export { showWhenOf, shownForOption, truthy, withRowRules, withRowsShownWhen, withShowWhen, type RowRule, type WithShowWhen } from "../../../format/lib/document/show-when-attach.js";
|
|
4
|
+
export { showWhenOf, shownByUsedValue, shownForOption, truthy, withRowRules, withRowsShownWhen, withShowWhen, type RowRule, type WithShowWhen } from "../../../format/lib/document/show-when-attach.js";
|
|
5
5
|
export declare function visibleFields<T extends Record<string, unknown>>(fields: T, values: Readonly<Record<string, unknown>> | null | undefined, context: ShowWhenContext): T;
|
|
6
6
|
export type ShowWhenSelector = {
|
|
7
7
|
index: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isShown as
|
|
1
|
+
import{isShown as f,lazyShowWhenContext as a}from"efficient-shell/format";import{isEditorOnDynamicPage as h}from"../../../format/lib/document/editor-page-context.js";import{parentOfSelection as u}from"./selection-parent.js";import{showWhenOf as C,shownByUsedValue as b,shownForOption as g,truthy as R,withRowRules as j,withRowsShownWhen as v,withShowWhen as A}from"../../../format/lib/document/show-when-attach.js";import{showWhenOf as c}from"../../../format/lib/document/show-when-attach.js";function x(t,o,e){let r=!1;const n={};for(const[s,i]of Object.entries(t))f(c(i),o??{},e)?n[s]=i:r=!0;return r?n:t}function m(t,o,e,r){const n=u(o,e,r);return{device:t,parentType:n?.item.type,parent:n?.item.props}}function p(t,o){if(!t||typeof t!="object")return!1;const e=t;if(typeof e.context=="string"&&(e.context===o||e.context.startsWith(`${o}.`)))return!0;if("not"in e)return p(e.not,o);for(const r of[e.all,e.any])if(Array.isArray(r)&&r.some(n=>p(n,o)))return!0;return!1}function W(t,o={}){return a({parentType:()=>t.parent?.type??void 0,parent:()=>t.parent?.props??void 0,dynamicPage:()=>h(),root:()=>t.appState?.data?.root?.props,...o})}export{p as readsContext,W as resolverContext,m as showWhenContext,C as showWhenOf,b as shownByUsedValue,g as shownForOption,R as truthy,x as visibleFields,j as withRowRules,v as withRowsShownWhen,A as withShowWhen};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{
|
|
2
|
-
`)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",
|
|
1
|
+
import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{FONT_OPTIONS as pe,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as fe,TABLET_MEDIA as ue,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as ge,TEXT_STYLE_ATTR as he,paragraphRules as Z,partSpacingOf as me}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Se,partInkCss as ye}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as be,headingTypographyFromRow as xe,normalizeHeadingCompression as A,normalizeSizes as Q}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as O}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ee=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],T=["desktop","tablet","phone"],C=(e,t)=>t==="desktop"?e:t==="tablet"?de(e):ce(e),k=(e,t)=>t==="desktop"?e:le(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const ze=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[t,i,n]of ze)for(const o of T)if(e===k(t,o))return{key:C(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ee)e[i]!==void 0&&(t[i]=e[i]);return t}function R(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ee.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function ne(e){const t=e.fonts,i=e.sizes,n=e.typography,o=be(e.compression),r={"heading-1":{font:O(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:O(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:O(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:O(t.body),size:v(i.body)},"body-5":{font:O(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function E(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>R({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return E(e)??[]}function te(e){return E(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function V(e,t){const i=ne(t),n=E(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},ie=["heading-1","heading-2","heading-3"];function Me({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=ne(t),l=te(e),d=V(l,t),c=[],f=n.map(a=>{const S=i.find(m=>m.id===a.id),g=l.find(m=>m.id===a.id);if(!S||!g)return ve([a],o,r)[0];const p={...g.values},x=new Set(g.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(m=>JSON.stringify(y[m])!==JSON.stringify(_[m])),D=m=>M(m).spacing==="letter";z.sort((m,N)=>Number(D(m))-Number(D(N)));for(const m of z){const{key:N,view:ae,spacing:K}=M(m),$=N,P=y[m];if(P===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=w(P/100,3);else if(K==="letter"){const W={...d.find(I=>I.id===a.id)?.values??{}};for(const I of z)y[I]===void 0&&delete W[M(I).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),ae);p[$]=J?w(P/J,4):0}else p[$]=P}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&ie.includes(a))&&A(u)!=="normal"){for(const a of ie){const S=f.find(p=>p.id===a);if(!S)continue;const g={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||g[p]===void 0&&!(S.auto??[]).includes(p)&&(g[p]=F(s,a)[p]);S.values=b(g)}u="normal"}return{saved:f,old:{...t,compression:u}}}function Re(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=A(e.old.compression)),i}const w=(e,t)=>Number(e.toFixed(t)),oe=(e,t)=>T.indexOf(e)<T.indexOf(t)?t:e;function Ve(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of T){const l=C("lineHeight",s),d=n.values[l],c=n.values[C("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=w(d*100,1));const f=oe(s,i);c!==void 0&&(o[k("letterSpacing",s)]=w(c*j(n.values,r,f),f===s?2:4))}return typeof n.values.color=="string"&&(o.color=Se(n.values.color)),{id:n.id,kind:n.kind,name:n.name,values:o}})}function ve(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of T)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=t({...s,values:{...s.values}});for(const c of T){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[C("lineHeight",c)]=w(f/100,3)),typeof u=="number"){const h=j(s.values,d,oe(c,i));l[C("letterSpacing",c)]=h?w(u/h,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:Q({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:A(e.heading_compression),typography:xe(e)},i=e.text_styles??null,n=Array.isArray(i)?se(V(i,t),t):t;return{fonts:U(n.fonts),sizes:Q(n.sizes),compression:A(n.compression),typography:n.typography,textStyles:i}}function se(e,t){const i=h=>e.find(a=>a.id===h)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,f=t.typography,u=h=>h==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:t.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function De(e){const t=E(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=se(V(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${he}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?pe.find(h=>h.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const h=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${h}px`)}const c=ye(n.color);c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),i.kind==="body"&&l.push(...f);const u=re(n.letterCase);u&&i.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&u&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
|
|
2
|
+
`)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",ue],["phone",fe]]){const g=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&g.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&g.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&g.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&g.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&u&&g.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),g.length&&h.push(`@media ${S} { ${g.join(" ")} }`)}return h}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?ge[e]:void 0}function ke(e){const t=me(e);return b({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=te(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?R({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Me as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ve as fromPanelStyles,Je as hasStyleChange,Re as listChangePatch,te as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,V as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,ne as textStylesFromOld,se as textStylesToOld,De as themeWithTextStyles,Ve as toPanelStyles,j as viewSizeOf};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "52.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",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/eff-erp/efficient-web-builder.git"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@tabler/icons-react": "^3.46.0",
|
|
56
|
-
"efficient-easel": "^27.
|
|
56
|
+
"efficient-easel": "^27.3.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": "^27.
|
|
75
|
+
"efficient-easel": "^27.3.0",
|
|
76
76
|
"efficient-shell": "^11.8.0",
|
|
77
77
|
"esbuild": "^0.28.0",
|
|
78
78
|
"happy-dom": "^20.14.5",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PartInk } from "../../format/lib/document/part-inks.js";
|
|
2
|
-
export declare function PartInkControl({ value, label, colors, onChange, }: {
|
|
3
|
-
value: string | null;
|
|
4
|
-
label: string;
|
|
5
|
-
colors: readonly PartInk[];
|
|
6
|
-
onChange: (next: string | null) => void;
|
|
7
|
-
}): import("react").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as n}from"react/jsx-runtime";import{parseHexColor as c}from"efficient-shell/format";import{ColorSwatch as f,Tooltip as k}from"efficient-shell/ui";import{say as s}from"../../format/lib/editor-words.js";import{AnyColourSwatch as u}from"../lib/document/ColourControl.js";function v({value:t,label:i,colors:p,onChange:m}){const d=t===null,a=t||void 0,r=p.find(e=>e.key===a),l=r?r.value:a&&c(a)===a.toLowerCase()?a:void 0;return n("div",{className:"sf-part-ink",children:[n("div",{className:"sf-part-ink-top",children:[o("span",{className:"sf-part-ink-label",children:s(i)}),o("span",{className:"sf-part-ink-read",children:l?l.toUpperCase():d?s("Mixed"):s("Follows the style")})]}),n("div",{className:"sf-part-ink-swatches",role:"group","aria-label":s(i),children:[p.map(e=>o(k,{content:`${s(e.name)} · ${e.value.toUpperCase()}`,children:o(f,{color:e.value,"aria-label":s(e.name),size:"sm",selected:a===e.key,onClick:()=>m(a===e.key?null:e.key)})},e.key)),u({value:r?"":(l??"").toLowerCase(),label:"Any color",onChange:m})]})]})}export{v as PartInkControl};
|