efficient-web-builder 73.1.0 → 74.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 (136) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/editor/components/CustomHtmlCodeWindow.d.ts +11 -0
  3. package/dist/editor/components/CustomHtmlCodeWindow.js +20 -0
  4. package/dist/editor/components/SectionThemePicker.d.ts +3 -2
  5. package/dist/editor/components/SectionThemePicker.js +1 -1
  6. package/dist/editor/components/SiteTextStylesField.d.ts +2 -1
  7. package/dist/editor/components/SiteTextStylesField.js +1 -1
  8. package/dist/editor/components/SlotChildRows.js +1 -1
  9. package/dist/editor/components/StandaloneSectionEditor.js +1 -1
  10. package/dist/editor/components/StorefrontEditor.js +1 -1
  11. package/dist/editor/components/TickerSettingsPanel.js +1 -1
  12. package/dist/editor/components/WebsiteSettingsPanel.d.ts +2 -0
  13. package/dist/editor/components/WebsiteSettingsPanel.js +1 -1
  14. package/dist/editor/components/storefront-editor.css +111 -0
  15. package/dist/editor/components/useHostDocumentBridge.js +1 -1
  16. package/dist/editor/lib/document/blocks/general/CustomHTML/fields.d.ts +6 -0
  17. package/dist/editor/lib/document/blocks/general/CustomHTML/fields.js +1 -0
  18. package/dist/editor/lib/document/blocks/general/Footprint/fields.js +1 -1
  19. package/dist/editor/lib/document/blocks/general/Hero/fields.js +1 -1
  20. package/dist/editor/lib/document/blocks/general/HeroSingle/fields.js +1 -1
  21. package/dist/editor/lib/document/blocks/general/index.js +1 -1
  22. package/dist/editor/lib/document/blocks/hero-shared-fields.d.ts +5 -0
  23. package/dist/editor/lib/document/blocks/hero-shared-fields.js +1 -1
  24. package/dist/editor/lib/document/controls.js +1 -1
  25. package/dist/editor/lib/document/custom-html-preview.d.ts +12 -0
  26. package/dist/editor/lib/document/custom-html-preview.js +1 -0
  27. package/dist/editor/lib/document/footer-blocks.js +1 -1
  28. package/dist/editor/lib/document/own-pad-fields.d.ts +5 -0
  29. package/dist/editor/lib/document/own-pad-fields.js +1 -0
  30. package/dist/editor/lib/document/passes/inspector.js +1 -1
  31. package/dist/editor/lib/editor-document-adapter.js +1 -1
  32. package/dist/format/lib/animation/hover.js +1 -1
  33. package/dist/format/lib/animation/loop.js +1 -1
  34. package/dist/format/lib/content/accordion-row-style.d.ts +3 -1
  35. package/dist/format/lib/content/accordion-row-style.js +1 -1
  36. package/dist/format/lib/content/box-layout.js +1 -1
  37. package/dist/format/lib/content/box-shape.d.ts +1 -1
  38. package/dist/format/lib/content/button-icon.d.ts +3 -1
  39. package/dist/format/lib/content/button-icon.js +1 -1
  40. package/dist/format/lib/content/card-place.d.ts +3 -1
  41. package/dist/format/lib/content/card-place.js +1 -1
  42. package/dist/format/lib/content/chat-launcher.js +1 -1
  43. package/dist/format/lib/content/container-direction.js +1 -1
  44. package/dist/format/lib/content/footprint.d.ts +22 -0
  45. package/dist/format/lib/content/footprint.js +1 -1
  46. package/dist/format/lib/content/image-fit.js +1 -1
  47. package/dist/format/lib/content/image-text-rows.d.ts +5 -2
  48. package/dist/format/lib/content/image-text-rows.js +1 -1
  49. package/dist/format/lib/content/list-number.js +1 -1
  50. package/dist/format/lib/content/list-position.js +1 -1
  51. package/dist/format/lib/content/text-tag.js +1 -1
  52. package/dist/format/lib/document/blocks/general/Footprint/card-seed.js +1 -1
  53. package/dist/format/lib/document/blocks/general/text-part-shapes.json +0 -6
  54. package/dist/format/lib/document/box-footer.js +1 -1
  55. package/dist/format/lib/document/custom-html-place.d.ts +19 -0
  56. package/dist/format/lib/document/custom-html-place.js +7 -0
  57. package/dist/format/lib/document/left-view.js +1 -1
  58. package/dist/format/lib/document/mockup-variant-fields.js +1 -1
  59. package/dist/format/lib/document/part-inks.d.ts +1 -0
  60. package/dist/format/lib/document/part-inks.js +1 -1
  61. package/dist/format/lib/document/passes/types.d.ts +1 -0
  62. package/dist/format/lib/document/section-groups.js +1 -1
  63. package/dist/format/lib/editor-words-catalogue.d.ts +28 -0
  64. package/dist/format/lib/editor-words-catalogue.js +5 -5
  65. package/dist/format/lib/hero-arrows.js +1 -1
  66. package/dist/format/lib/hero-group-placement.js +1 -1
  67. package/dist/format/lib/hero-media-layout.js +1 -1
  68. package/dist/format/lib/hero-phone-stack.d.ts +12 -0
  69. package/dist/format/lib/hero-phone-stack.js +1 -1
  70. package/dist/format/lib/hero-video.js +1 -1
  71. package/dist/format/lib/reel.js +1 -1
  72. package/dist/format/lib/sections/divider-style.js +1 -1
  73. package/dist/format/lib/sections/hero-overlay.js +1 -1
  74. package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
  75. package/dist/format/lib/sections/intro-bleed-layout.js +1 -1
  76. package/dist/format/lib/sections/logo-look.js +1 -1
  77. package/dist/format/lib/sections/product-card-style.js +1 -1
  78. package/dist/format/lib/sections/section-eyebrow-look.js +1 -1
  79. package/dist/format/lib/sections/section-head-placement.d.ts +3 -1
  80. package/dist/format/lib/sections/section-head-placement.js +1 -1
  81. package/dist/format/lib/sections/section-head-style.js +1 -1
  82. package/dist/format/lib/sections/section-number-style.js +1 -1
  83. package/dist/format/lib/sections/ticker-style.js +1 -1
  84. package/dist/format/lib/text-style-face.d.ts +6 -0
  85. package/dist/format/lib/text-style-face.js +2 -1
  86. package/dist/format/lib/theme.d.ts +2 -1
  87. package/dist/format/lib/theme.js +4 -4
  88. package/dist/render/components/BoxTabPaneContext.d.ts +2 -3
  89. package/dist/render/components/BoxTabs.js +1 -1
  90. package/dist/render/components/ButtonBlock.d.ts +2 -0
  91. package/dist/render/components/ButtonBlock.js +1 -1
  92. package/dist/render/components/DealerFinder.d.ts +7 -1
  93. package/dist/render/components/DealerFinder.js +1 -1
  94. package/dist/render/components/Footprint.d.ts +6 -2
  95. package/dist/render/components/Footprint.js +1 -1
  96. package/dist/render/components/Heading.d.ts +1 -1
  97. package/dist/render/components/Heading.js +1 -1
  98. package/dist/render/components/HeroSection.d.ts +4 -1
  99. package/dist/render/components/HeroSection.js +1 -1
  100. package/dist/render/components/HeroSingle.d.ts +4 -1
  101. package/dist/render/components/HeroSingle.js +1 -1
  102. package/dist/render/components/HeroSlide.d.ts +3 -0
  103. package/dist/render/components/HeroSlide.js +1 -1
  104. package/dist/render/components/SideListLayout.d.ts +8 -2
  105. package/dist/render/components/SideListLayout.js +1 -1
  106. package/dist/render/components/SiteGutterFrame.js +1 -1
  107. package/dist/render/components/Text.d.ts +1 -1
  108. package/dist/render/components/Text.js +1 -1
  109. package/dist/render/lib/content/section-padding.d.ts +36 -2
  110. package/dist/render/lib/content/section-padding.js +1 -1
  111. package/dist/render/lib/document/blocks/general/ButtonBlock/render.js +1 -1
  112. package/dist/render/lib/document/blocks/general/CustomHTML/render.js +1 -1
  113. package/dist/render/lib/document/blocks/general/Footprint/render.js +1 -1
  114. package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
  115. package/dist/render/lib/document/blocks/general/HeroSingle/render.js +1 -1
  116. package/dist/render/lib/document/blocks/general/LocationMap/render.js +1 -1
  117. package/dist/render/lib/document/blocks/general/LogoBlock/render.js +1 -1
  118. package/dist/render/lib/document/blocks/general/section-head-looks.js +2 -2
  119. package/dist/render/lib/document/blocks/general/section-to-box-rows-editorial.js +1 -1
  120. package/dist/render/lib/document/blocks/general/section-to-box-rows-logos.js +1 -1
  121. package/dist/render/lib/document/custom-css.d.ts +8 -2
  122. package/dist/render/lib/document/custom-css.js +3 -2
  123. package/dist/render/lib/document/header-clearance.js +1 -1
  124. package/dist/render/lib/document/header-ink.js +1 -1
  125. package/dist/render/lib/document/passes/section-padding.d.ts +4 -0
  126. package/dist/render/lib/document/passes/section-padding.js +1 -1
  127. package/dist/render/lib/document/sanitize.d.ts +4 -1
  128. package/dist/render/lib/document/sanitize.js +1 -1
  129. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  130. package/dist/routine-index.json +1 -0
  131. package/dist/value-index.json +1 -0
  132. package/package.json +29 -7
  133. package/dist/format/lib/document/blocks/general/CustomHTML/fields.d.ts +0 -2
  134. package/dist/format/lib/document/blocks/general/CustomHTML/fields.js +0 -1
  135. package/dist/format/lib/parse-option.d.ts +0 -3
  136. package/dist/format/lib/parse-option.js +0 -1
@@ -1 +1 @@
1
- import{hasWords as s}from"../../../sections/section-to-box.js";import{DIM as L,DROP_COMMON as g,DROP_SIDE_PADDING as h,INNER_BOX as r,SAME_KEYS as P,SECTION_BOX as f,TEXT as a,smallText as O,wrapperPad as i,wrapperPadKeys as _}from"./section-to-box-row-parts.js";import{finiteNumber as x}from"../../../../../format/lib/finite-number.js";import{markBoxProps as w,token as A}from"../../../../../format/lib/document/seed-parts.js";import{LOGOS_PH as R,logosScaffoldItems as B}from"../../../../../format/lib/document/blocks/general/Logos/meta.js";import{logosCardSeed as b}from"../../../../../format/lib/document/blocks/general/Logos/card-seed.js";import{PAYMENT_PH as N,paymentScaffoldAssurances as C,paymentScaffoldBadges as I}from"../../../../../format/lib/document/blocks/general/PaymentBadges/meta.js";import{BLOCK_SOURCE_OPTIONS_PROP as n,BLOCK_SOURCE_PROP as t}from"../../../../../format/lib/content/block-sources.js";import{CARD_TEMPLATE_SLOT as k}from"../../../../../format/lib/content/card-template.js";import{BLOCK_ALIGN_BOX_WORD as M,legacyBlockAlignOf as D}from"../../../../../format/lib/content/block-align.js";import{FOOTER_PAYMENT_SEED as H}from"../../../../../format/lib/content/footer.js";import{CELL_SPAN_KEYS as K}from"../../../../../format/lib/content/grid-span.js";import{SECTION_ACCENT_INHERIT as X}from"../../../../../format/lib/content/section-surface.js";import{FOOTER_MARK_SIZES as v,FOOTER_TEXT_PX as z}from"../../../../../format/lib/document/box-footer.js";import{phoneKey as d,readHidable as F}from"efficient-easel/draw";const l={contained:!1},p=(o,e)=>({logos:[{kind:"list",key:o,name:"Logo",flat:!0,parts:[{kind:"block",type:"LogoBlock",box:["src",[e,"alt"]],when:(U,m)=>s(m?.src)||s(m?.[e])}]}]}),c=o=>{const e=x(o.bandPadding)??40;return{top:e,bottom:e,topPhone:e,bottomPhone:e}},G={...O("heading",{color:"labels",letterSpacing:.2}),props:{...a,align:"center"}},Y={name:"Logos",boxProps:o=>({...f,direction:"column",gap:32,...i(o,c(o))}),box:[...P,..._(c),["bandPadding","sectionPaddingTop",(o,e)=>i(e,c(e)).sectionPaddingTop]],parts:[G,{kind:"core",keep:["columns","logoHeight","grayscale"],rename:{logosPerRow:"columns"},props:l,slots:p("items","alt")}],drop:{...g,...h,contained:"the Box draws the site frame now; the Logos block inside it fills the Box's column (`contained: false`)",headPlacement:"a Logos band has no split head (not in SPLITTABLE_SECTIONS): no stored node can hold one, and the converted block stores own-box"}},j={kind:"group",name:"Mark",keepEmpty:!0,parts:[],props:w(4,"main",{sectionCorners:2})},E={top:24,bottom:24,topPhone:24,bottomPhone:24},W={name:"Payment Methods",boxProps:o=>({...f,direction:"column",...i(o,E)}),box:[...P,..._(E)],parts:[{kind:"group",name:"Methods",props:{...r,align:"center",gap:20,gapPhone:20,sectionBorder:{top:1,bottom:1},sectionPaddingTop:32,sectionPaddingBottom:32},parts:[{...O("heading",{color:"labels"}),props:{...a,align:"center"}},{kind:"core",keep:[],as:"Logos",derive:{reads:[t,n],props:o=>s(o[t])?{[t]:o[t],...o[n]!==void 0?{[n]:o[n]}:{}}:{}},props:{...l,look:"cards",grayscale:!1},slots:o=>({...p("badges","label"),...s(o[t])?{[k]:[b()]}:{}})},{kind:"group",name:"Reassurance",props:{...r,direction:"row",wrap:!0,justify:"center",gap:24,gapPhone:24,phoneRow:2,[d("share")]:"content"},parts:[{kind:"list",key:"assurances",name:"Line",of:o=>(Array.isArray(o.assurances)?o.assurances:[]).filter(e=>s(e?.text)),props:{...r,direction:"row",align:"center",gap:8,gapPhone:8,phoneRow:2,[d("share")]:"content"},item:o=>F(o.text).hidden?{props:{_hidden:!0}}:{},parts:[j,{kind:"text",key:"text",props:{...a,align:"center"},style:{...A("label",13),color:"labels",lineHeight:1.5}}]}]}]}],drop:{...g,...h,contained:"the Box draws the site frame now; the Logos block inside it fills the Box's column (`contained: false`)"}},S=o=>D(o.align)??"left",T=o=>o.size==="md"?"md":"sm",y=12,u={name:"Payment logos",boxProps:o=>({...r,direction:"row",wrap:!0,align:"center",justify:M[S(o)],gap:y,gapPhone:y,phoneRow:2,[d("share")]:"content"}),box:[...K],parts:[{kind:"text",key:"lead",props:L,styleFrom:o=>({size:z[T(o)],lineHeight:1.5})},{kind:"core",keep:[],as:"Logos",derive:{reads:[t,n],props:o=>({logoHeight:v[T(o)].mark,align:S(o),...s(o[t])?{[t]:o[t],...o[n]!==void 0?{[n]:o[n]}:{}}:{}})},props:{...l,look:"marks",grayscale:!1,sectionAccent:X},slots:o=>({...p("methods","label"),...s(o[t])?{[k]:[b()]}:{}})}],drop:{size:"read as the wall's Logo height (S 16, M 20) and the lead's size (the footer size table, 12 / 13)",align:"read as the Box's justify and the wall's own Alignment (start is left, end is right)",editing:"the editor's preview flag, never a stored setting: the editor tells every block it is editing"}},po={Logos:Y,PaymentBadges:W,FooterPayment:u,PaymentLogosBlock:u},co=()=>({heading:R.heading,items:B()}),mo=()=>({heading:N.heading,badges:I(),assurances:C()}),go=()=>({...H,methods:[]});export{po as LOGOS_SECTION_TO_BOX,go as footerPaymentPressStarter,co as logosPressStarter,mo as paymentPressStarter};
1
+ import{hasWords as n}from"../../../sections/section-to-box.js";import{DIM as L,DROP_COMMON as g,DROP_SIDE_PADDING as h,INNER_BOX as r,SAME_KEYS as P,SECTION_BOX as f,TEXT as a,smallText as O,wrapperPad as i,wrapperPadKeys as _}from"./section-to-box-row-parts.js";import{finiteNumber as x}from"../../../../../format/lib/finite-number.js";import{markBoxProps as w,token as A}from"../../../../../format/lib/document/seed-parts.js";import{LOGOS_PH as R,logosScaffoldItems as B}from"../../../../../format/lib/document/blocks/general/Logos/meta.js";import{logosCardSeed as b}from"../../../../../format/lib/document/blocks/general/Logos/card-seed.js";import{PAYMENT_PH as N,paymentScaffoldAssurances as C,paymentScaffoldBadges as I}from"../../../../../format/lib/document/blocks/general/PaymentBadges/meta.js";import{BLOCK_SOURCE_OPTIONS_PROP as s,BLOCK_SOURCE_PROP as t}from"../../../../../format/lib/content/block-sources.js";import{CARD_TEMPLATE_SLOT as k}from"../../../../../format/lib/content/card-template.js";import{BLOCK_ALIGN_BOX_WORD as M,legacyBlockAlignOf as D}from"../../../../../format/lib/content/block-align.js";import{FOOTER_PAYMENT_SEED as H}from"../../../../../format/lib/content/footer.js";import{CELL_SPAN_KEYS as K}from"../../../../../format/lib/content/grid-span.js";import{SECTION_ACCENT_INHERIT as X}from"../../../../../format/lib/content/section-surface.js";import{FOOTER_MARK_SIZES as v,FOOTER_TEXT_PX as z}from"../../../../../format/lib/document/box-footer.js";import{phoneKey as d,readHidable as F}from"efficient-easel/draw";import{parseOption as G}from"efficient-shell/format";const l={contained:!1},p=(o,e)=>({logos:[{kind:"list",key:o,name:"Logo",flat:!0,parts:[{kind:"block",type:"LogoBlock",box:["src",[e,"alt"]],when:(Z,m)=>n(m?.src)||n(m?.[e])}]}]}),c=o=>{const e=x(o.bandPadding)??40;return{top:e,bottom:e,topPhone:e,bottomPhone:e}},Y={...O("heading",{color:"labels",letterSpacing:.2}),props:{...a,align:"center"}},j={name:"Logos",boxProps:o=>({...f,direction:"column",gap:32,...i(o,c(o))}),box:[...P,..._(c),["bandPadding","sectionPaddingTop",(o,e)=>i(e,c(e)).sectionPaddingTop]],parts:[Y,{kind:"core",keep:["columns","logoHeight","grayscale"],rename:{logosPerRow:"columns"},props:l,slots:p("items","alt")}],drop:{...g,...h,contained:"the Box draws the site frame now; the Logos block inside it fills the Box's column (`contained: false`)",headPlacement:"a Logos band has no split head (not in SPLITTABLE_SECTIONS): no stored node can hold one, and the converted block stores own-box"}},W={kind:"group",name:"Mark",keepEmpty:!0,parts:[],props:w(4,"main",{sectionCorners:2})},E={top:24,bottom:24,topPhone:24,bottomPhone:24},U={name:"Payment Methods",boxProps:o=>({...f,direction:"column",...i(o,E)}),box:[...P,..._(E)],parts:[{kind:"group",name:"Methods",props:{...r,align:"center",gap:20,gapPhone:20,sectionBorder:{top:1,bottom:1},sectionPaddingTop:32,sectionPaddingBottom:32},parts:[{...O("heading",{color:"labels"}),props:{...a,align:"center"}},{kind:"core",keep:[],as:"Logos",derive:{reads:[t,s],props:o=>n(o[t])?{[t]:o[t],...o[s]!==void 0?{[s]:o[s]}:{}}:{}},props:{...l,look:"cards",grayscale:!1},slots:o=>({...p("badges","label"),...n(o[t])?{[k]:[b()]}:{}})},{kind:"group",name:"Reassurance",props:{...r,direction:"row",wrap:!0,justify:"center",gap:24,gapPhone:24,phoneRow:2,[d("share")]:"content"},parts:[{kind:"list",key:"assurances",name:"Line",of:o=>(Array.isArray(o.assurances)?o.assurances:[]).filter(e=>n(e?.text)),props:{...r,direction:"row",align:"center",gap:8,gapPhone:8,phoneRow:2,[d("share")]:"content"},item:o=>F(o.text).hidden?{props:{_hidden:!0}}:{},parts:[W,{kind:"text",key:"text",props:{...a,align:"center"},style:{...A("label",13),color:"labels",lineHeight:1.5}}]}]}]}],drop:{...g,...h,contained:"the Box draws the site frame now; the Logos block inside it fills the Box's column (`contained: false`)"}},S=o=>D(o.align)??"left",T=o=>G(["sm","md"],"sm",o.size),y=12,u={name:"Payment logos",boxProps:o=>({...r,direction:"row",wrap:!0,align:"center",justify:M[S(o)],gap:y,gapPhone:y,phoneRow:2,[d("share")]:"content"}),box:[...K],parts:[{kind:"text",key:"lead",props:L,styleFrom:o=>({size:z[T(o)],lineHeight:1.5})},{kind:"core",keep:[],as:"Logos",derive:{reads:[t,s],props:o=>({logoHeight:v[T(o)].mark,align:S(o),...n(o[t])?{[t]:o[t],...o[s]!==void 0?{[s]:o[s]}:{}}:{}})},props:{...l,look:"marks",grayscale:!1,sectionAccent:X},slots:o=>({...p("methods","label"),...n(o[t])?{[k]:[b()]}:{}})}],drop:{size:"read as the wall's Logo height (S 16, M 20) and the lead's size (the footer size table, 12 / 13)",align:"read as the Box's justify and the wall's own Alignment (start is left, end is right)",editing:"the editor's preview flag, never a stored setting: the editor tells every block it is editing"}},mo={Logos:j,PaymentBadges:U,FooterPayment:u,PaymentLogosBlock:u},go=()=>({heading:R.heading,items:B()}),ho=()=>({heading:N.heading,badges:I(),assurances:C()}),Po=()=>({...H,methods:[]});export{mo as LOGOS_SECTION_TO_BOX,Po as footerPaymentPressStarter,go as logosPressStarter,ho as paymentPressStarter};
@@ -1,9 +1,15 @@
1
1
  import { SECTION_CSS_SCOPE_ATTR } from "../../../format/lib/content/section-css.js";
2
2
  export declare const CUSTOM_HTML_SCOPE_ATTR = "data-sf-custom-html";
3
3
  export type CssScopeAttr = typeof CUSTOM_HTML_SCOPE_ATTR | typeof SECTION_CSS_SCOPE_ATTR;
4
+ export declare function customHtmlIdPrefix(id: string): string;
4
5
  export declare function customHtmlScope(id: string, attr?: CssScopeAttr): string;
5
- export declare function scopeCustomCss(css: string, id: string, attr?: CssScopeAttr): string;
6
- export declare function splitCustomHtml(html: string): {
6
+ export declare function scopeCustomCss(css: string, id: string, attr?: CssScopeAttr, ownIds?: ReadonlySet<string>): string;
7
+ export declare function splitCustomHtml(html: string, id?: string): {
7
8
  css: string;
8
9
  markup: string;
10
+ ids: ReadonlySet<string>;
11
+ };
12
+ export declare function customHtmlDrawn(html: string, id: string): {
13
+ scoped: boolean;
14
+ inner: string;
9
15
  };
@@ -1,2 +1,3 @@
1
- import w from"isomorphic-dompurify";import C from"postcss";import d from"postcss-selector-parser";import{sanitizeHtml as O}from"./sanitize.js";import{styleElementText as g}from"../../../format/lib/document/style-text.js";const p="data-sf-custom-html",E=/^[A-Za-z][\w-]*$/;function _(n,t=p){return`[${t}="${n}"]`}const v=new Set(["media","supports","container"]),h=new Set(["behavior","-moz-binding"]),T=/expression\s*\(|javascript:|vbscript:/i,A=/^[a-z][a-z0-9+.-]*:/i,$=new Set(["none","initial","inherit","unset","revert","revert-layer","default","auto","normal","ease","ease-in","ease-out","ease-in-out","linear","step-start","step-end","infinite","reverse","alternate","alternate-reverse","forwards","backwards","both","running","paused"]);function N(n){return n.replace(/\\([0-9a-f]{1,6})\s?|\\(.)/gi,(t,o,r)=>o?String.fromCodePoint(Math.min(+`0x${o}`,1114111)||65533):r??"")}function y(n){const t=n.trim();return t.startsWith("//")?!0:A.test(t)&&!/^https:\/\//i.test(t)}const S=/\/\*[\s\S]*?(?:\*\/|$)/g;function R(n,t){const o=N(t.replace(S,"")).replace(S,"");if(T.test(o))return!1;for(const r of o.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/gi))if(y(r[2]))return!1;if(n.startsWith("--")||/(?:image-set|image|src)\(/i.test(o)){for(const r of o.matchAll(/(['"])(.*?)\1/g))if(y(r[2]))return!1}return!0}function L(n){const t=n.find(o=>o.type==="combinator");return t?t.value.trim()||" ":null}function x(n,t){let o;try{o=d().astSync(n)}catch{return null}const r=[];for(const a of o.nodes){const l=a.nodes;if(l.length===0)return null;let f=!1;if(a.walkNesting(()=>{f=!0}),f)continue;const i=l[0],s=i.type==="tag"&&/^(html|body)$/i.test(i.value)||i.type==="pseudo"&&i.value.toLowerCase()===":root",e=i.type==="universal",u=L(l.slice(1));if((s||e)&&(u==="~"||u==="+"))e&&r.push(`${t} ${String(a).trim()}`);else if(s||e){const c=l.slice(1).map(String).join("").trimEnd();r.push(c?t+c:e?`${t} *`:t)}else{if(i.type==="combinator"&&/^[~+]$/.test(i.value.trim()))continue;r.push(`${t} ${String(a).trim()}`)}}return r.length?r.join(", "):null}function I(n,t,o=p){if(!E.test(t))return"";let r;try{r=C.parse(n)}catch{return""}const a=_(t,o),l=new Map;r.walkComments(s=>{s.remove()});const f=s=>{for(const e of[...s.nodes??[]])e.type==="atrule"?v.has(e.name.toLowerCase())&&e.nodes?f(e):e.remove():e.type==="rule"&&e.remove()},i=s=>{for(const e of[...s.nodes??[]])if(e.type==="atrule"){const u=e.name.toLowerCase();if(/^(-[a-z]+-)?keyframes$/.test(u)){const c=e.params.trim();if(!/^[A-Za-z_][\w-]*$/.test(c)||$.has(c.toLowerCase()))e.remove();else{const m=`${c}-${t}`;l.set(c,m),e.params=m}}else v.has(u)&&e.nodes?i(e):e.remove()}else if(e.type==="rule"){const u=x(e.selector,a);u===null?e.remove():(e.selector=u,f(e))}else e.type==="decl"&&e.remove()};return i(r),r.walkDecls(s=>{if(h.has(s.prop.toLowerCase())||!R(s.prop,s.raws.value?.raw??s.value)){s.remove();return}l.size>0&&/^(-[a-z]+-)?animation(-name)?$/i.test(s.prop)&&(s.value=s.value.replace(/(?<![\w-])[A-Za-z_][\w-]*(?![\w(-])/g,e=>l.get(e)??e))}),r.walkAtRules(s=>{s.nodes&&s.nodes.length===0&&s.remove()}),g(r.toString()).trim()}const D={ALLOWED_TAGS:["style","#text"],ALLOWED_ATTR:[],KEEP_CONTENT:!1,FORBID_CONTENTS:[],FORCE_BODY:!0,RETURN_DOM_FRAGMENT:!0};function F(n){const t=O(n);if(!/<style/i.test(n))return{css:"",markup:t};const o=w.sanitize(n,D).querySelectorAll("style");return{css:Array.from(o,a=>a.textContent??"").join(`
2
- `),markup:t}}export{p as CUSTOM_HTML_SCOPE_ATTR,_ as customHtmlScope,I as scopeCustomCss,F as splitCustomHtml};
1
+ import g from"isomorphic-dompurify";import E from"postcss";import _ from"postcss-selector-parser";import{sanitizeHtml as h,sectionIds as $}from"./sanitize.js";import{faceClassBaseCss as T}from"../../../format/lib/text-style-face.js";import{styleElementText as A}from"../../../format/lib/document/style-text.js";const w="data-sf-custom-html",v=/^[A-Za-z][\w-]*$/;function d(n){return v.test(n)?`${n}-`:""}function S(n,e=w){return`[${e}="${n}"]`}const y=new Set(["media","supports","container"]),x=new Set(["behavior","-moz-binding"]),N=/expression\s*\(|javascript:|vbscript:/i,R=/^[a-z][a-z0-9+.-]*:/i,D=new Set(["none","initial","inherit","unset","revert","revert-layer","default","auto","normal","ease","ease-in","ease-out","ease-in-out","linear","step-start","step-end","infinite","reverse","alternate","alternate-reverse","forwards","backwards","both","running","paused"]);function L(n){return n.replace(/\\([0-9a-f]{1,6})\s?|\\(.)/gi,(e,r,o)=>r?String.fromCodePoint(Math.min(+`0x${r}`,1114111)||65533):o??"")}function C(n){const e=n.trim();return e.startsWith("//")?!0:R.test(e)&&!/^https:\/\//i.test(e)}const O=/\/\*[\s\S]*?(?:\*\/|$)/g;function P(n,e){const r=L(e.replace(O,"")).replace(O,"");if(N.test(r))return!1;for(const o of r.matchAll(/url\(\s*(['"]?)(.*?)\1\s*\)/gi))if(C(o[2]))return!1;if(n.startsWith("--")||/(?:image-set|image|src)\(/i.test(r)){for(const o of r.matchAll(/(['"])(.*?)\1/g))if(C(o[2]))return!1}return!0}function b(n){const e=n.find(r=>r.type==="combinator");return e?e.value.trim()||" ":null}function k(n,e,r="",o=new Set){let a;try{a=_().astSync(n)}catch{return null}const l=[];for(const i of a.nodes){const u=i.nodes;if(u.length===0)return null;let p=!1;if(i.walkNesting(()=>{p=!0}),p)continue;r&&i.walkIds(f=>{o.has(f.value)&&(f.value=r+f.value)});const s=u[0],t=s.type==="tag"&&/^(html|body)$/i.test(s.value)||s.type==="pseudo"&&s.value.toLowerCase()===":root",c=s.type==="universal",m=b(u.slice(1));if((t||c)&&(m==="~"||m==="+"))c&&l.push(`${e} ${String(i).trim()}`);else if(t||c){const f=u.slice(1).map(String).join("").trimEnd();l.push(f?e+f:c?`${e} *`:e)}else{if(s.type==="combinator"&&/^[~+]$/.test(s.value.trim()))continue;l.push(`${e} ${String(i).trim()}`)}}return l.length?l.join(", "):null}function z(n,e,r=w,o=new Set){if(!v.test(e))return"";let a;try{a=E.parse(n)}catch{return""}const l=S(e,r),i=new Map;a.walkComments(s=>{s.remove()});const u=s=>{for(const t of[...s.nodes??[]])t.type==="atrule"?y.has(t.name.toLowerCase())&&t.nodes?u(t):t.remove():t.type==="rule"&&t.remove()},p=s=>{for(const t of[...s.nodes??[]])if(t.type==="atrule"){const c=t.name.toLowerCase();if(/^(-[a-z]+-)?keyframes$/.test(c)){const m=t.params.trim();if(!/^[A-Za-z_][\w-]*$/.test(m)||D.has(m.toLowerCase()))t.remove();else{const f=`${m}-${e}`;i.set(m,f),t.params=f}}else y.has(c)&&t.nodes?p(t):t.remove()}else if(t.type==="rule"){const c=k(t.selector,l,r===w?d(e):"",o);c===null?t.remove():(t.selector=c,u(t))}else t.type==="decl"&&t.remove()};return p(a),a.walkDecls(s=>{if(x.has(s.prop.toLowerCase())||!P(s.prop,s.raws.value?.raw??s.value)){s.remove();return}i.size>0&&/^(-[a-z]+-)?animation(-name)?$/i.test(s.prop)&&(s.value=s.value.replace(/(?<![\w-])[A-Za-z_][\w-]*(?![\w(-])/g,t=>i.get(t)??t))}),a.walkAtRules(s=>{s.nodes&&s.nodes.length===0&&s.remove()}),A(a.toString()).trim()}const M={ALLOWED_TAGS:["style","#text"],ALLOWED_ATTR:[],KEEP_CONTENT:!1,FORBID_CONTENTS:[],FORCE_BODY:!0,RETURN_DOM_FRAGMENT:!0};function I(n,e=""){const r=h(n,{idPrefix:d(e)});if(!/<style/i.test(n))return{css:"",markup:r,ids:new Set};const o=$(n),a=g.sanitize(n,M).querySelectorAll("style");return{css:Array.from(a,i=>i.textContent??"").join(`
2
+ `),markup:r,ids:o}}function U(n,e){const{css:r,markup:o,ids:a}=I(n,e),l=r?z(r,e,void 0,a):"",u=[v.test(e)?T(S(e),o):"",l].filter(Boolean).join(`
3
+ `);return u?{scoped:!0,inner:`<style>${u}</style>${o}`}:{scoped:!1,inner:o}}export{w as CUSTOM_HTML_SCOPE_ATTR,U as customHtmlDrawn,d as customHtmlIdPrefix,S as customHtmlScope,z as scopeCustomCss,I as splitCustomHtml};
@@ -1 +1 @@
1
- import{HEADER_TYPE as o,FOOTER_TYPE as a}from"efficient-easel/draw";const E=new Set(["Hero","HeroSingle","IntroBleed"]),n={min:56,max:140,default:88},A={min:0,max:120,step:2,default:32},H=`var(--sf-header-h, ${n.default}px)`,s="--sf-header-set-h",d="--sf-header-h",l=`var(${s}, ${n.default}px)`,T="sf-header-clearance",R="sf-sticky-underheader";function c(e){return e?.find(t=>t?.type&&t.type!==o)??null}function p(e){const t=c(e)?.type;return!t||!E.has(t)}function D(e){return!p(e)}function P(e){return!!e?.some(t=>t?.type===o)}function h(e){return!e||e.length===0?!1:!e.some(t=>t?.type===o||t?.type===a)}const u=["auto","shared","own"],_="auto",S="topSpace",C="data-top-space";function f(e){return u.includes(e)?e:_}function x(e,t){const r=f(e?.props?.[S]);return r==="own"?!0:r==="shared"?!1:p(t)}function m(e,t){return x(e,t)?"own":null}export{_ as DEFAULT_TOP_SPACE,E as FULLBLEED_LEAD_SECTIONS,T as HEADER_CLEARANCE_CLASS,d as HEADER_DRAWN_HEIGHT_VAR,H as HEADER_HEIGHT_CSS,n as HEADER_HEIGHT_PX,A as HEADER_MENU_GAP_PX,l as HEADER_SET_HEIGHT_CSS,s as HEADER_SET_HEIGHT_VAR,R as STICKY_UNDERHEADER_CLASS,C as TOP_SPACE_ATTR,u as TOP_SPACE_MODES,S as TOP_SPACE_PROP,h as isStandaloneSectionDocument,c as leadSection,p as pageClearsHeader,P as pageHasHeaderSection,D as pageLeadsWithFullBleed,x as pageTakesTopSpace,f as resolveTopSpace,m as topSpaceMarker};
1
+ import{HEADER_TYPE as o,FOOTER_TYPE as a}from"efficient-easel/draw";import{parseOption as E}from"efficient-shell/format";const s=new Set(["Hero","HeroSingle","IntroBleed"]),n={min:56,max:140,default:88},d={min:0,max:120,step:2,default:32},l=`var(--sf-header-h, ${n.default}px)`,_="--sf-header-set-h",T="--sf-header-h",R=`var(${_}, ${n.default}px)`,D="sf-header-clearance",P="sf-sticky-underheader";function c(e){return e?.find(t=>t?.type&&t.type!==o)??null}function p(e){const t=c(e)?.type;return!t||!s.has(t)}function h(e){return!p(e)}function C(e){return!!e?.some(t=>t?.type===o)}function m(e){return!e||e.length===0?!1:!e.some(t=>t?.type===o||t?.type===a)}const u=["auto","shared","own"],S="auto",f="topSpace",O="data-top-space";function i(e){return E(u,S,e)}function x(e,t){const r=i(e?.props?.[f]);return r==="own"?!0:r==="shared"?!1:p(t)}function L(e,t){return x(e,t)?"own":null}export{S as DEFAULT_TOP_SPACE,s as FULLBLEED_LEAD_SECTIONS,D as HEADER_CLEARANCE_CLASS,T as HEADER_DRAWN_HEIGHT_VAR,l as HEADER_HEIGHT_CSS,n as HEADER_HEIGHT_PX,d as HEADER_MENU_GAP_PX,R as HEADER_SET_HEIGHT_CSS,_ as HEADER_SET_HEIGHT_VAR,P as STICKY_UNDERHEADER_CLASS,O as TOP_SPACE_ATTR,u as TOP_SPACE_MODES,f as TOP_SPACE_PROP,m as isStandaloneSectionDocument,c as leadSection,p as pageClearsHeader,C as pageHasHeaderSection,h as pageLeadsWithFullBleed,x as pageTakesTopSpace,i as resolveTopSpace,L as topSpaceMarker};
@@ -1 +1 @@
1
- import{parseIntroBleedLayout as o}from"../../../format/lib/sections/intro-bleed-layout.js";import{leadSection as n,pageLeadsWithFullBleed as a}from"./header-clearance.js";const c="data-lead-ink",E="data-header-ink",I=["auto","light","dark"],l="auto";function d(e){return e.type==="IntroBleed"?o(e.props?.layout)!=="stacked":!0}function u(e){const t=n(e);return t&&a(e)&&d(t)?"light":null}function i(e){return e==="light"||e==="dark"?e:l}function k(e,t){const r=i(e);return r==="auto"?u(t):r}export{l as DEFAULT_HEADER_INK,c as HEADER_INK_ATTR,I as HEADER_INK_MODES,E as HEADER_INK_OVERRIDE_ATTR,u as leadSectionInk,k as resolveHeaderInk,i as resolveHeaderInkMode};
1
+ import{parseIntroBleedLayout as r}from"../../../format/lib/sections/intro-bleed-layout.js";import{leadSection as n,pageLeadsWithFullBleed as a}from"./header-clearance.js";import{parseOption as l}from"efficient-shell/format";const _="data-lead-ink",f="data-header-ink",u=["auto","light","dark"],d="auto";function i(e){return e.type==="IntroBleed"?r(e.props?.layout)!=="stacked":!0}function p(e){const t=n(e);return t&&a(e)&&i(t)?"light":null}function s(e){return l(u,d,e)}function k(e,t){const o=s(e);return o==="auto"?p(t):o}export{d as DEFAULT_HEADER_INK,_ as HEADER_INK_ATTR,u as HEADER_INK_MODES,f as HEADER_INK_OVERRIDE_ATTR,p as leadSectionInk,k as resolveHeaderInk,s as resolveHeaderInkMode};
@@ -13,5 +13,9 @@ export declare const ownPairDefault: (key: string) => InnerPadding | undefined;
13
13
  export declare const PAD_ON_ROOT: ReadonlySet<string>;
14
14
  export declare const PADS_ITS_OWN_SPACE: ReadonlySet<string>;
15
15
  export declare const sectionPadding: BlockPass;
16
+ export declare const OWN_PAD_FRAME: Readonly<Record<string, (props: Record<string, unknown>) => number>>;
17
+ export declare const OWN_PAD_LABEL: Readonly<Record<string, string>>;
18
+ export declare function withPadTotals(props: Record<string, unknown>, changed: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
19
+ export declare function olderPadNote(props: Record<string, unknown>, frame: number): string | null;
16
20
  export declare const blockPadding: BlockPass;
17
21
  export {};
@@ -1 +1 @@
1
- import{jsx as _}from"react/jsx-runtime";import{HideTaker as E}from"../../../components/ViewHideRoot.js";import{LineChoice as w}from"../../../components/InBoxContext.js";import{isBackgroundBox as T}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as D}from"../../../../format/lib/content/box-side-space.js";import{BAND_PAD_KEYS as d,BAND_PAD_UNIT_KEY as I,SECTION_PAD_KEYS as x,padValuesOf as A,sectionPadAttrs as N}from"../../content/section-padding.js";import{sectionFillPassClass as S}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as O,drawsCopiesInTheBox as h}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as m}from"../../../../format/lib/own-entry.js";const g={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120}},V=new Set(Object.keys(g));function l(e,t){return t?.innerPadding??m(g,e)}const X=e=>l(e)??{},v=e=>m({DetailRows:{top:100,bottom:100}},e),b=new Set(["Flex","Text","Heading","ImageBlock"]),B=new Set(["Divider"]),C=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),p=new Set(["ProductGrid"]);function c(e,t,n=!1){const r=e.render;e.render=i=>{if(t?.(i))return r(i);const o=N({...A(i,x,n),sideSpace:D(i.sideSpace)}),f=r(i);if(!o)return f;const P=a=>_(E,{className:a?`${o.className} ${a}`:o.className,style:o.style,children:f}),s=S(i,{atSectionLine:!0}),u=S(i);return s===u?P(s):_(w,{line:"by-box",draw:a=>P(a?u:s)})}}const y={name:"sectionPadding",applies:(e,t,n)=>t.isSection(e)&&!C.has(e)&&!!n&&typeof n.render=="function",panel(e,t,n){const r=l(t,e);if(r){e.fields={...e.fields,...n.sidesPaddingFields({keys:d,unitKey:I,fallback:r,tablet:!0,siteSide:!0})};return}if(p.has(t))return;const i=[d.top,d.bottom].filter(o=>e.fields!=null&&o in e.fields);if(i.length)throw new Error(`section-padding: ${t} declares its own ${i.join(" / ")} row; declare \`innerPadding: { top, bottom }\` in its meta and the one Padding row draws on its band`);e.fields={...e.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(e,t){if(!l(t,e)){if(p.has(t)){c(e);return}b.has(t)||B.has(t)||c(e,t==="Flex"?n=>T(n.bgImage):O.has(t)?n=>h(t,n):void 0,!0)}}},F=["Heading","Text","ImageBlock"],L=["LogoBlock"],G={name:"blockPadding",applies:(e,t,n)=>(F.includes(e)||L.includes(e))&&!!n&&typeof n.render=="function",panel(e,t,n){e.fields={...e.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(e,t){b.has(t)||c(e,void 0,!0)}};export{B as PADS_ITS_OWN_SPACE,b as PAD_ON_ROOT,V as SECTION_PAD_INNER,g as SECTION_PAD_INNER_DEFAULTS,G as blockPadding,X as innerPaddingFallback,v as ownPairDefault,y as sectionPadding};
1
+ import{jsx as A}from"react/jsx-runtime";import{HideTaker as D}from"../../../components/ViewHideRoot.js";import{LineChoice as E}from"../../../components/InBoxContext.js";import{isBackgroundBox as T}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as w}from"../../../../format/lib/content/box-side-space.js";import{BAND_PAD_KEYS as g,BAND_PAD_UNIT_KEY as O,BLOCK_PAD_FRAME as u,PAD_TOTAL_KEY as c,SECTION_PAD_KEYS as p,padTotalKeys as x,padValuesOf as N,sectionPadAttrs as I}from"../../content/section-padding.js";import{readPartStyle as C}from"../part-styles.js";import{say as F}from"../../../../format/lib/editor-words.js";import{sectionFillPassClass as b}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as L,drawsCopiesInTheBox as R}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as P}from"../../../../format/lib/own-entry.js";const m={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120}},tt=new Set(Object.keys(m));function _(t,e){return e?.innerPadding??P(m,t)}const et=t=>_(t)??{},nt=t=>P({DetailRows:{top:100,bottom:100}},t),h=new Set(["Flex","Text","Heading","ImageBlock","ButtonBlock"]),y=new Set(["Divider"]),K=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),B=new Set(["ProductGrid"]);function S(t,e,n=!1){const s=t.render;t.render=o=>{if(e?.(o))return s(o);const i=I({...N(o,p,n),sideSpace:w(o.sideSpace)}),d=s(o);if(!i)return d;const a=f=>A(D,{className:f?`${i.className} ${f}`:i.className,style:i.style,children:d}),r=b(o,{atSectionLine:!0}),l=b(o);return r===l?a(r):A(E,{line:"by-box",draw:f=>a(f?l:r)})}}const ot={name:"sectionPadding",applies:(t,e,n)=>e.isSection(t)&&!K.has(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const s=_(e,t);if(s){t.fields={...t.fields,...n.sidesPaddingFields({keys:g,unitKey:O,fallback:s,tablet:!0,siteSide:!0})};return}if(B.has(e))return;const o=[g.top,g.bottom].filter(i=>t.fields!=null&&i in t.fields);if(o.length)throw new Error(`section-padding: ${e} declares its own ${o.join(" / ")} row; declare \`innerPadding: { top, bottom }\` in its meta and the one Padding row draws on its band`);t.fields={...t.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(t,e){if(!_(e,t)){if(B.has(e)){S(t);return}h.has(e)||y.has(e)||S(t,e==="Flex"?n=>T(n.bgImage):L.has(e)?n=>R(e,n):void 0,!0)}}},H=["Heading","Text","ImageBlock","ButtonBlock"],W=["LogoBlock"],v={Text:t=>C(t,"text").textStyle?.startsWith("heading-")?u.heading:u.text,Heading:()=>u.heading,ButtonBlock:()=>u.text},Y={ButtonBlock:"Outer padding"};function j(t,e){const n=t[c],s=Array.isArray(n)?n.filter(r=>typeof r=="string"):[],o=x().filter(r=>e?.[r]);if(!o.length)return t;const i=[...s.filter(r=>!o.includes(r)),...o.filter(r=>typeof t[r]=="number")];if(i.length===s.length&&i.every((r,l)=>r===s[l]))return t;const{[c]:d,...a}=t;return i.length?{...a,[c]:i}:a}function k(t,e){if(e<=0)return null;const n=Array.isArray(t[c])?t[c]:[];return x().some(o=>typeof t[o]=="number"&&!n.includes(o))?F("plus {n} px (older setting)",{n:e}):null}const rt={name:"blockPadding",applies:(t,e,n)=>(H.includes(t)||W.includes(t))&&!!n&&typeof n.render=="function",panel(t,e,n){const s=P(v,e);if(!s){t.fields={...t.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})};return}t.fields={...t.fields,...n.ownPaddingFields?.(s,k,P(Y,e))??n.sidesPaddingFields({tablet:!0,siteSide:!0})};const o=t.resolveData;t.resolveData=(i,d)=>{const a=i.props??{},r=d?.trigger==="replace"?j(a,d.changed):a,l=r===a?i:{...i,props:r};return o?o(l,d):l}},draw(t,e){h.has(e)||S(t,void 0,!0)}};export{v as OWN_PAD_FRAME,Y as OWN_PAD_LABEL,y as PADS_ITS_OWN_SPACE,h as PAD_ON_ROOT,tt as SECTION_PAD_INNER,m as SECTION_PAD_INNER_DEFAULTS,rt as blockPadding,et as innerPaddingFallback,k as olderPadNote,nt as ownPairDefault,ot as sectionPadding,j as withPadTotals};
@@ -1,2 +1,5 @@
1
- export declare function sanitizeHtml(html: string): string;
1
+ export declare function sanitizeHtml(html: string, opts?: {
2
+ idPrefix?: string;
3
+ }): string;
4
+ export declare function sectionIds(html: string): ReadonlySet<string>;
2
5
  export declare function sanitizeHtmlFragment(html: string): DocumentFragment;
@@ -1 +1 @@
1
- import e from"isomorphic-dompurify";e.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener noreferrer")});const r={ALLOWED_TAGS:["p","br","hr","span","div","section","article","header","footer","h1","h2","h3","h4","h5","h6","strong","em","b","i","u","small","sup","sub","mark","ul","ol","li","blockquote","a","img","picture","source","figure","figcaption","video","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["href","title","alt","src","srcset","sizes","class","style","target","rel","width","height","loading","poster","controls"],ALLOW_DATA_ATTR:!1};function a(t){return e.sanitize(t,r)}function o(t){return e.sanitize(t,{...r,RETURN_DOM_FRAGMENT:!0})}export{a as sanitizeHtml,o as sanitizeHtmlFragment};
1
+ import n from"isomorphic-dompurify";n.addHook("afterSanitizeAttributes",t=>{if(t.tagName==="A"&&t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener noreferrer"),!r)return;for(const i of u){const s=t.getAttribute?.(i);if(s==null)continue;const c=a=>i==="id"||l.has(a);t.setAttribute(i,s.trim().split(/\s+/).filter(Boolean).map(a=>c(a)?r+a:a).join(" "))}const e=t.tagName==="A"?t.getAttribute("href"):null;e&&e.startsWith("#")&&l.has(e.slice(1))&&t.setAttribute("href",`#${r}${e.slice(1)}`)});const u=["id","popovertarget","aria-controls","aria-labelledby","aria-describedby"];let r="",l=new Set;const o={ALLOWED_TAGS:["p","br","hr","span","div","section","article","header","footer","h1","h2","h3","h4","h5","h6","strong","em","b","i","u","small","sup","sub","mark","ul","ol","li","blockquote","a","img","picture","source","figure","figcaption","video","table","thead","tbody","tr","th","td"],ALLOWED_ATTR:["href","title","alt","src","srcset","sizes","class","style","target","rel","width","height","loading","poster","controls"],ALLOW_DATA_ATTR:!1},f={...o,ALLOWED_TAGS:[...o.ALLOWED_TAGS,"button","details","summary"],ALLOWED_ATTR:[...o.ALLOWED_ATTR,"id","type","popover","popovertarget","popovertargetaction","open","aria-controls","aria-labelledby","aria-describedby"]};function b(t,e={}){const i=e.idPrefix&&/^[A-Za-z][\w-]*$/.test(e.idPrefix)?e.idPrefix:"";l=i?A(t):new Set,r=i;try{return n.sanitize(t,r?f:o)}finally{r="",l=new Set}}function A(t){const e=new Set,i=r;r="";try{const s=n.sanitize(t,{...f,RETURN_DOM_FRAGMENT:!0});for(const c of Array.from(s.querySelectorAll("[id]")))for(const a of(c.getAttribute("id")??"").trim().split(/\s+/))a&&e.add(a)}finally{r=i}return e}function p(t){return n.sanitize(t,{...o,RETURN_DOM_FRAGMENT:!0})}export{b as sanitizeHtml,p as sanitizeHtmlFragment,A as sectionIds};
@@ -1,2 +1,2 @@
1
- import{defaultTextStyles as Y,textStyleCaseCss as le}from"efficient-easel/text-styles/model";import{resolveViewValue as B}from"efficient-easel/draw";import{viewKey as w}from"../../../format/lib/animation/views.js";import{FONT_OPTIONS as ce,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as de,TABLET_MEDIA as pe,viewOverrides as C,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as fe,TEXT_STYLE_ATTR as ue,paragraphRules as Z,partSpacingOf as ge}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Q,partInkCss as he}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as me,headingTypographyFromRow as Se,normalizeHeadingCompression as I,normalizeSizes as ee}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as P}from"../../../format/lib/non-empty-string.js";const L=e=>e==="sentence"?"none":void 0,ne=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],H=["desktop","tablet","phone"],k=(e,i)=>w(e,i);function j(e,i,t,n=X()){return B("textSize",i,e.sizeTablet,e.sizePhone,n)[t]}const ye=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function M(e){for(const[i,t,n]of ye)for(const o of H)if(e===k(i,o))return{key:w(t,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const i={};for(const t of ne)e[t]!==void 0&&(i[t]=e[t]);return i}function R(e,i){const{auto:t,...n}=e,o=new Set(i??[]),r=ne.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function te(e){const i=e.fonts,t=e.sizes,n=e.typography,o=me(e.compression),r={"heading-1":{font:P(i.heading),size:v(t.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case),largestSize:v(n.maxPx)},"heading-2":{font:P(i.heading2),size:v(t.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case2)},"heading-3":{font:P(i.heading3),size:v(t.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:L(n.case3)},"body-1":{font:P(i.body),size:v(t.body)},"body-5":{font:P(i.label),size:v(t.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function N(e){return Array.isArray(e)&&e.every(t=>t&&typeof t=="object"&&typeof t.id=="string"&&(t.kind==="heading"||t.kind==="body")&&typeof t.name=="string")?e.map(t=>R({...t,values:b(t.values??{})},Array.isArray(t.auto)?t.auto:void 0)):null}function Ne(e){return N(e)??[]}function ie(e){return N(e)??Y().map(({id:i,kind:t,name:n})=>({id:i,kind:t,name:n,values:{}}))}function V(e,i){const t=te(i),n=N(e);return n?n.map(o=>{const r={...F(t,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):t}const F=(e,i)=>e.find(t=>t.id===i)?.values??{},oe=["heading-1","heading-2","heading-3"];function Le({saved:e,old:i,cur:t,next:n,sizeOf:o,panelView:r="desktop"}){const s=te(i),l=ie(e),d=V(l,i),c=[],f=n.map(a=>{const S=t.find(g=>g.id===a.id),h=l.find(g=>g.id===a.id);if(!S||!h){const g=be([a],o,r)[0],T=g.values.color;return T===void 0?g:{...g,values:{...g.values,color:Q(T)}}}const p={...h.values},x=new Set(h.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(g=>JSON.stringify(y[g])!==JSON.stringify(_[g])),D=g=>M(g).spacing==="letter";z.sort((g,T)=>Number(D(g))-Number(D(T)));for(const g of z){const{key:T,view:re,spacing:K}=M(g),$=T,A=y[g];if(A===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=O(A/100,3);else if(K==="letter"){const W={...d.find(E=>E.id===a.id)?.values??{}};for(const E of z)y[E]===void 0&&delete W[M(E).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),re);p[$]=J?O(A/J,4):0}else p[$]=A}return R({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=i.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&oe.includes(a))&&I(u)!=="normal"){for(const a of oe){const S=f.find(p=>p.id===a);if(!S)continue;const h={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||h[p]===void 0&&!(S.auto??[]).includes(p)&&(h[p]=F(s,a)[p]);S.values=b(h)}u="normal"}return{saved:f,old:{...i,compression:u}}}function je(e,i){const t={text_styles:e.saved};return e.old.compression!==i.compression&&(t.heading_compression=I(e.old.compression)),t}const O=(e,i)=>Number(e.toFixed(i)),se=(e,i)=>H.indexOf(e)<H.indexOf(i)?i:e;function Me(e,i,t="desktop"){return e.map(n=>{const o={...n.values},r=i(n);for(const s of H){const l=w("lineHeight",s),d=n.values[l],c=n.values[w("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=O(d*100,1));const f=se(s,t);c!==void 0&&(o[k("letterSpacing",s)]=O(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function be(e,i,t="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of H)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=i({...s,values:{...s.values}});for(const c of H){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[w("lineHeight",c)]=O(f/100,3)),typeof u=="number"){const m=j(s.values,d,se(c,t));l[w("letterSpacing",c)]=m?O(u/m,4):0}}return{...s,values:b(l)}})}function Re(e){const i={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:ee({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:I(e.heading_compression),typography:Se(e)},t=e.text_styles??null,n=Array.isArray(t)?ae(V(t,i),i):i;return{fonts:U(n.fonts),sizes:ee(n.sizes),compression:I(n.compression),typography:n.typography,textStyles:t}}function ae(e,i){const t=m=>e.find(a=>a.id===m)?.values??{},n=t("heading-1"),o=t("heading-2"),r=t("heading-3"),s=t("body-1"),l=t("body-5"),d=i.fonts,c=i.sizes,f=i.typography,u=m=>m==="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:i.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 Ve(e){const i=N(e.textStyles);if(!i||i.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=ae(V(i,t),t);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function Fe(e){const i=[];for(const t of e){const n=t.values,o=`.${q(t)}`,r=`[${ue}="${t.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?ce.find(m=>m.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const m=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${m}px`)}const c=he(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`),t.kind==="body"&&l.push(...f);const u=le(n.letterCase);u&&t.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&i.push(`${s} { ${l.join("; ")} }`),t.kind==="heading"&&f.length&&i.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),t.kind==="heading"&&u&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(i.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),i.push(...Z(`:is(${s})`,`*:has(> ${r})`))),i.push(...xe(t,s,o,r))}return i.join(`
2
- `)}function xe(e,i,t,n){const o=e.values,r=C("textSize",o.size,o.sizeTablet,o.sizePhone),s=C("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=C("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=C("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=C("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=ze[e.id],m=[];for(const[a,S]of[["tablet",pe],["phone",de]]){const h=[],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&&h.push(`${i} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&h.push(`${i}, ${t}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&h.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&h.push(...Z(`:is(${i})`,`*:has(> ${n})`)),_!==void 0&&u&&h.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),h.length&&m.push(`@media ${S} { ${h.join(" ")} }`)}return m}const ze={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function De(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ke(e){return e?fe[e]:void 0}function ve(e){const i=ge(e);return b({font:e.font,color:e.color===void 0?void 0:Q(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function We(e){return Object.keys(ve(e)).length>0}function Ge({saved:e,old:i,styleId:t,values:n}){const o=ie(e);return{saved:$e(o,t,n),old:i}}function $e(e,i,t){return e.map(n=>n.id===i?R({...n,values:b({...n.values,...t})},n.auto):n)}function Je(e){const i=e.filter(t=>t.kind==="body").map(t=>Number(/^body-(\d+)$/.exec(t.id)?.[1])).filter(t=>Number.isInteger(t)&&t>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{De as accentItalicCss,Le as applyListChange,Je as eyebrowStyleId,q as faceClassOf,be as fromPanelStyles,We as hasStyleChange,je as listChangePatch,ie as listToWrite,ve as partStyleToTextStyleValues,Ge as pushIntoStyle,V as resolveTextStyles,$e as setStyleValues,Re as siteTextFromRow,Ne as storedTextStyles,Ke as styleIdOfRole,Fe as textStylesCss,te as textStylesFromOld,ae as textStylesToOld,Ve as themeWithTextStyles,Me as toPanelStyles,j as viewSizeOf};
1
+ import{defaultTextStyles as Y,textStyleCaseCss as le}from"efficient-easel/text-styles/model";import{resolveViewValue as Z}from"efficient-easel/draw";import{viewKey as w}from"../../../format/lib/animation/views.js";import{FONT_OPTIONS as ce,normalizeFonts as B}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as de,TABLET_MEDIA as pe,viewOverrides as H,viewRules as U}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as fe,TEXT_STYLE_ATTR as ue,paragraphRules as X,partSpacingOf as ge}from"../document/part-styles.js";import{FACE_SIZE as he,faceClassOf as q}from"../../../format/lib/text-style-face.js";import{partColourName as Q,partInkCss as me}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as Se,headingTypographyFromRow as ye,normalizeHeadingCompression as I,normalizeSizes as ee}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as P}from"../../../format/lib/non-empty-string.js";const j=e=>e==="sentence"?"none":void 0,ne=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],O=["desktop","tablet","phone"],k=(e,i)=>w(e,i);function L(e,i,t,n=U()){return Z("textSize",i,e.sizeTablet,e.sizePhone,n)[t]}const xe=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function R(e){for(const[i,t,n]of xe)for(const s of O)if(e===k(i,s))return{key:w(t,s),view:s,spacing:n};return{key:e,view:"desktop",spacing:null}}function x(e){const i={};for(const t of ne)e[t]!==void 0&&(i[t]=e[t]);return i}function F(e,i){const{auto:t,...n}=e,s=new Set(i??[]),r=ne.filter(o=>s.has(o)&&e.values[o]===void 0);return r.length?{...n,auto:r}:n}function te(e){const i=e.fonts,t=e.sizes,n=e.typography,s=Se(e.compression),r={"heading-1":{font:P(i.heading),size:v(t.headingLarge),weight:v(n.weight),lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,letterCase:j(n.case),largestSize:v(n.maxPx)},"heading-2":{font:P(i.heading2),size:v(t.headingMedium),weight:v(n.weight2),lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,letterCase:j(n.case2)},"heading-3":{font:P(i.heading3),size:v(t.headingSmall),weight:v(n.weight3),lineHeight:s.lineHeight,letterSpacing:s.letterSpacing,letterCase:j(n.case3)},"body-1":{font:P(i.body),size:v(t.body)},"body-5":{font:P(i.label),size:v(t.label)}};return Y().map(({id:o,kind:l,name:d})=>({id:o,kind:l,name:d,values:x(r[o]??{})}))}function N(e){return Array.isArray(e)&&e.every(t=>t&&typeof t=="object"&&typeof t.id=="string"&&(t.kind==="heading"||t.kind==="body")&&typeof t.name=="string")?e.map(t=>F({...t,values:x(t.values??{})},Array.isArray(t.auto)?t.auto:void 0)):null}function je(e){return N(e)??[]}function ie(e){return N(e)??Y().map(({id:i,kind:t,name:n})=>({id:i,kind:t,name:n,values:{}}))}function M(e,i){const t=te(i),n=N(e);return n?n.map(s=>{const r={...V(t,s.id)};for(const o of s.auto??[])delete r[o];return{...s,values:x({...r,...s.values})}}):t}const V=(e,i)=>e.find(t=>t.id===i)?.values??{},se=["heading-1","heading-2","heading-3"];function Le({saved:e,old:i,cur:t,next:n,sizeOf:s,panelView:r="desktop"}){const o=te(i),l=ie(e),d=M(l,i),c=[],f=n.map(a=>{const S=t.find(g=>g.id===a.id),h=l.find(g=>g.id===a.id);if(!S||!h){const g=be([a],s,r)[0],T=g.values.color;return T===void 0?g:{...g,values:{...g.values,color:Q(T)}}}const p={...h.values},b=new Set(h.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(g=>JSON.stringify(y[g])!==JSON.stringify(_[g])),D=g=>R(g).spacing==="letter";z.sort((g,T)=>Number(D(g))-Number(D(T)));for(const g of z){const{key:T,view:re,spacing:K}=R(g),$=T,E=y[g];if(E===void 0){delete p[$],V(o,a.id)[$]!==void 0&&(c.push([a.id,$]),b.add($));continue}if(b.delete($),K==="line")p[$]=C(E/100,3);else if(K==="letter"){const W={...d.find(A=>A.id===a.id)?.values??{}};for(const A of z)y[A]===void 0&&delete W[R(A).key];const G=x({...W,...p}),J=L(G,s({...a,values:G}),re);p[$]=J?C(E/J,4):0}else p[$]=E}return F({id:a.id,kind:a.kind,name:a.name,values:x(p)},b)});let u=i.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&se.includes(a))&&I(u)!=="normal"){for(const a of se){const S=f.find(p=>p.id===a);if(!S)continue;const h={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([b,y])=>b===a&&y===p)||h[p]===void 0&&!(S.auto??[]).includes(p)&&(h[p]=V(o,a)[p]);S.values=x(h)}u="normal"}return{saved:f,old:{...i,compression:u}}}function Re(e,i){const t={text_styles:e.saved};return e.old.compression!==i.compression&&(t.heading_compression=I(e.old.compression)),t}const C=(e,i)=>Number(e.toFixed(i)),oe=(e,i)=>O.indexOf(e)<O.indexOf(i)?i:e;function Fe(e,i,t="desktop"){return e.map(n=>{const s={...n.values},r=i(n);for(const o of O){const l=w("lineHeight",o),d=n.values[l],c=n.values[w("letterSpacing",o)];delete s[l],d!==void 0&&(s[k("lineSpacing",o)]=C(d*100,1));const f=oe(o,t);c!==void 0&&(s[k("letterSpacing",o)]=C(c*L(n.values,r,f),f===o?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:s}})}function be(e,i,t="desktop"){return e.map(n=>{const s=n.values,r={...s};for(const c of O)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const o={id:n.id,kind:n.kind,name:n.name,values:x(r)},l={...o.values},d=i({...o,values:{...o.values}});for(const c of O){const f=s[k("lineSpacing",c)],u=s[k("letterSpacing",c)];if(typeof f=="number"&&(l[w("lineHeight",c)]=C(f/100,3)),typeof u=="number"){const m=L(o.values,d,oe(c,t));l[w("letterSpacing",c)]=m?C(u/m,4):0}}return{...o,values:x(l)}})}function Me(e){const i={fonts:B({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:ee({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:I(e.heading_compression),typography:ye(e)},t=e.text_styles??null,n=Array.isArray(t)?ae(M(t,i),i):i;return{fonts:B(n.fonts),sizes:ee(n.sizes),compression:I(n.compression),typography:n.typography,textStyles:t}}function ae(e,i){const t=m=>e.find(a=>a.id===m)?.values??{},n=t("heading-1"),s=t("heading-2"),r=t("heading-3"),o=t("body-1"),l=t("body-5"),d=i.fonts,c=i.sizes,f=i.typography,u=m=>m==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:s.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:o.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:s.size??null,headingSmall:r.size??null,body:o.size??null,label:l.size??null},compression:i.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:s.weight??null,weight3:r.weight??null,case2:u(s.letterCase),case3:u(r.letterCase)}}}function Ve(e){const i=N(e.textStyles);if(!i||i.every(s=>Object.keys(s.values).length===0&&!s.auto))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=ae(M(i,t),t);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function De(e){const i=[];for(const t of e){const n=t.values,s=`.${q(t)}`,r=`[${ue}="${t.id}"]`,o=`${s}, ${r}`,l=[],d=n.font!==void 0?ce.find(m=>m.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const m=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${m}px`)}const c=me(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`),t.kind==="body"&&l.push(...f);const u=le(n.letterCase);u&&t.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&i.push(`${o} { ${l.join("; ")} }`),t.kind==="heading"&&f.length&&i.push(`${o}, ${s}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),t.kind==="heading"&&u&&i.push(`${r}, ${s}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(i.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),i.push(...X(`:is(${o})`,`*:has(> ${r})`))),i.push(...ze(t,o,s,r))}return i.join(`
2
+ `)}function ze(e,i,t,n){const s=e.values,r=H("textSize",s.size,s.sizeTablet,s.sizePhone),o=H("textSize",s.largestSize,s.largestSizeTablet,s.largestSizePhone),l=H("same",s.lineHeight,s.lineHeightTablet,s.lineHeightPhone),d=H("same",s.letterSpacing,s.letterSpacingTablet,s.letterSpacingPhone),c=H("spacing",s.paragraphSpacing,s.paragraphSpacingTablet,s.paragraphSpacingPhone),f=Z("textSize",s.size,s.sizeTablet,s.sizePhone,U()),u=ve[e.id],m=[];for(const[a,S]of[["tablet",pe],["phone",de]]){const h=[],p=[],b=f[a],y=o[a],_=r[a]===void 0&&y===void 0||b===void 0?void 0:y===void 0?b:Math.min(b,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&&h.push(`${i} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&h.push(`${i}, ${t}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&h.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!s.paragraphSpacing&&h.push(...X(`:is(${i})`,`*:has(> ${n})`)),_!==void 0&&u&&h.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),h.length&&m.push(`@media ${S} { ${h.join(" ")} }`)}return m}const ve=Object.fromEntries(Object.entries(he).map(([e,{step:i}])=>[e,i]));function Ke(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function We(e){return e?fe[e]:void 0}function $e(e){const i=ge(e);return x({font:e.font,color:e.color===void 0?void 0:Q(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Ge(e){return Object.keys($e(e)).length>0}function Je({saved:e,old:i,styleId:t,values:n}){const s=ie(e);return{saved:_e(s,t,n),old:i}}function _e(e,i,t){return e.map(n=>n.id===i?F({...n,values:x({...n.values,...t})},n.auto):n)}function Ye(e){const i=e.filter(t=>t.kind==="body").map(t=>Number(/^body-(\d+)$/.exec(t.id)?.[1])).filter(t=>Number.isInteger(t)&&t>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{Ke as accentItalicCss,Le as applyListChange,Ye as eyebrowStyleId,q as faceClassOf,be as fromPanelStyles,Ge as hasStyleChange,Re as listChangePatch,ie as listToWrite,$e as partStyleToTextStyleValues,Je as pushIntoStyle,M as resolveTextStyles,_e as setStyleValues,Me as siteTextFromRow,je as storedTextStyles,We as styleIdOfRole,De as textStylesCss,te as textStylesFromOld,ae as textStylesToOld,Ve as themeWithTextStyles,Fe as toPanelStyles,L as viewSizeOf};