efficient-web-builder 47.2.0 → 48.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/editor/components/HeroPartPanel.js +1 -1
  3. package/dist/editor/components/HoverEffectField.d.ts +1 -0
  4. package/dist/editor/components/HoverEffectField.js +1 -1
  5. package/dist/editor/components/MediaUploadField.d.ts +9 -0
  6. package/dist/editor/components/MediaUploadField.js +1 -1
  7. package/dist/editor/components/PartSettingsPanel.d.ts +2 -1
  8. package/dist/editor/components/PartSettingsPanel.js +1 -1
  9. package/dist/editor/components/PreviewPartAnchors.d.ts +3 -1
  10. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  11. package/dist/editor/components/SameInEveryViewNote.d.ts +1 -0
  12. package/dist/editor/components/SameInEveryViewNote.js +1 -0
  13. package/dist/editor/components/SaveAsTemplateButton.d.ts +5 -0
  14. package/dist/editor/components/SaveAsTemplateButton.js +1 -0
  15. package/dist/editor/components/SiteFields.d.ts +4 -1
  16. package/dist/editor/components/SiteFields.js +1 -1
  17. package/dist/editor/components/SiteRestoreNotice.js +1 -1
  18. package/dist/editor/components/SiteTextStylesField.js +1 -1
  19. package/dist/editor/components/TickerSettingsPanel.js +1 -1
  20. package/dist/editor/components/VersionHistoryDrawer.js +1 -1
  21. package/dist/editor/components/WebsitePreviewButton.d.ts +2 -1
  22. package/dist/editor/components/WebsitePreviewButton.js +1 -1
  23. package/dist/editor/components/WebsiteScreenParts.js +1 -1
  24. package/dist/editor/components/usePartMotion.d.ts +10 -0
  25. package/dist/editor/components/usePartMotion.js +1 -0
  26. package/dist/editor/components/useSocialSettings.d.ts +2 -2
  27. package/dist/editor/lib/animation/AnimationDurationRow.js +1 -1
  28. package/dist/editor/lib/animation/fields.d.ts +1 -1
  29. package/dist/editor/lib/animation/fields.js +1 -1
  30. package/dist/editor/lib/animation/hover-fields.d.ts +1 -0
  31. package/dist/editor/lib/animation/hover-fields.js +1 -0
  32. package/dist/editor/lib/document/add-target.d.ts +2 -1
  33. package/dist/editor/lib/document/add-target.js +1 -1
  34. package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
  35. package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
  36. package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
  37. package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
  38. package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
  39. package/dist/editor/lib/document/build-config.js +1 -1
  40. package/dist/editor/lib/document/card-display-chips.js +1 -1
  41. package/dist/editor/lib/document/controls.d.ts +7 -3
  42. package/dist/editor/lib/document/controls.js +1 -1
  43. package/dist/editor/lib/document/field-groups.js +1 -1
  44. package/dist/editor/lib/document/geocode-resolve.d.ts +1 -0
  45. package/dist/editor/lib/document/geocode-resolve.js +1 -1
  46. package/dist/editor/lib/document/part-motion-canvas.d.ts +10 -0
  47. package/dist/editor/lib/document/part-motion-canvas.js +2 -0
  48. package/dist/format/lib/animation/hover.d.ts +5 -0
  49. package/dist/format/lib/animation/hover.js +1 -0
  50. package/dist/format/lib/content/box-layout.d.ts +8 -0
  51. package/dist/format/lib/content/box-layout.js +1 -1
  52. package/dist/format/lib/content/box-separator.js +1 -1
  53. package/dist/format/lib/content/card-template.d.ts +8 -0
  54. package/dist/format/lib/content/card-template.js +1 -1
  55. package/dist/format/lib/content/container-gap.d.ts +2 -1
  56. package/dist/format/lib/content/container-gap.js +1 -1
  57. package/dist/format/lib/document/easel-row-words.d.ts +1 -0
  58. package/dist/format/lib/document/easel-row-words.js +1 -1
  59. package/dist/format/lib/document/panel-tabs.d.ts +8 -0
  60. package/dist/format/lib/document/panel-tabs.js +1 -0
  61. package/dist/format/lib/document/part-records.d.ts +6 -0
  62. package/dist/format/lib/document/part-records.js +1 -0
  63. package/dist/format/lib/document/passes/registry-context.d.ts +1 -1
  64. package/dist/format/lib/document/passes/registry-context.js +1 -1
  65. package/dist/format/lib/document/passes/types.d.ts +2 -0
  66. package/dist/format/lib/document/section-groups.d.ts +1 -1
  67. package/dist/format/lib/editor-words-catalogue.d.ts +6 -0
  68. package/dist/format/lib/editor-words-catalogue.js +3 -3
  69. package/dist/format/lib/hero-ticker.d.ts +1 -0
  70. package/dist/format/lib/hero-ticker.js +1 -1
  71. package/dist/format/lib/sections/strip-shape.js +1 -1
  72. package/dist/render/components/CardRowContext.d.ts +3 -1
  73. package/dist/render/components/CardRowContext.js +1 -1
  74. package/dist/render/components/Flex.d.ts +3 -1
  75. package/dist/render/components/Flex.js +1 -1
  76. package/dist/render/components/Grid.d.ts +2 -1
  77. package/dist/render/components/Grid.js +1 -1
  78. package/dist/render/components/HeroGroup.d.ts +2 -1
  79. package/dist/render/components/HeroGroup.js +1 -1
  80. package/dist/render/components/HeroSection.d.ts +2 -1
  81. package/dist/render/components/HeroSection.js +1 -1
  82. package/dist/render/components/HeroSingle.d.ts +2 -1
  83. package/dist/render/components/HeroSingle.js +1 -1
  84. package/dist/render/components/PartStyledKind.js +1 -1
  85. package/dist/render/components/PartStyledText.js +1 -1
  86. package/dist/render/components/PublishedPartStylesContext.d.ts +4 -1
  87. package/dist/render/components/PublishedPartStylesContext.js +1 -1
  88. package/dist/render/components/SectionAnimation.d.ts +8 -2
  89. package/dist/render/components/SectionAnimation.js +1 -1
  90. package/dist/render/lib/animation/part-motion.d.ts +21 -0
  91. package/dist/render/lib/animation/part-motion.js +1 -0
  92. package/dist/render/lib/content/button-look.js +1 -1
  93. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  94. package/dist/render/lib/document/blocks/general/Grid/render.js +1 -1
  95. package/dist/render/lib/document/blocks/general/Hero/render.js +1 -1
  96. package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
  97. package/dist/render/lib/document/blocks/general/HeroSingle/render.js +1 -1
  98. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +3 -0
  99. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  100. package/dist/render/lib/document/blocks/general/section-to-box-rows-cards.js +1 -1
  101. package/dist/render/lib/document/blocks/general/section-to-box-rows-locations.js +1 -1
  102. package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.d.ts +2 -0
  103. package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -0
  104. package/dist/render/lib/document/blocks/general/section-to-box-rows.js +1 -1
  105. package/dist/render/lib/document/hero-media-parts.d.ts +2 -2
  106. package/dist/render/lib/document/part-styles.d.ts +10 -1
  107. package/dist/render/lib/document/part-styles.js +2 -2
  108. package/dist/render/lib/document/passes/clickable-parts.js +1 -1
  109. package/dist/render/lib/document/passes/section-padding.js +1 -1
  110. package/dist/render/lib/text-styles/site-text-styles.d.ts +16 -4
  111. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  112. package/package.json +3 -3
  113. package/dist/editor/lib/document/selected-host.d.ts +0 -2
  114. package/dist/editor/lib/document/selected-host.js +0 -1
@@ -1,2 +1,2 @@
1
- import{textStyleCaseCss as v,textStyleCaseOfCss as tt}from"efficient-easel/draw";import{parseHexColor as et}from"efficient-shell/format";import{FONT_OPTIONS as nt,fontOption as ot,fontRoleOf as E,SIZE_STEP_OF_ROLE as M}from"../../../format/lib/fonts.js";import{encodePartKey as rt}from"../../../format/lib/document/part-key.js";import{decodePartId as F,normalizePartText as N}from"./text-parts.js";import{COLOUR_TOKEN as L}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as it}from"../content/view-values.js";const $="_partStyles",st="data-sf-part-styled",j="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function m(t){return typeof t=="string"&&ct.test(t)}const H={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function at(t){if(!t)return null;for(const[e,n]of Object.entries(H))if(n===t)return e;return null}function se(t){if(m(t.textStyle))return t.textStyle;const e=E(t.role);return e?H[e]:void 0}const ft=[400,500,600,700],y=["left","center","right","justify"],D=5,C=1e3,lt=-5,ut=10,pt=0,dt=64,xt=2,K={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:pt,max:dt,step:xt}},ht=.05,gt=.01,St=["line","letter"],mt=.5,Pt=2.5,Tt=-1,bt=1,_t=0,Rt=400,At=[...new Set(Object.values(M))];function b(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function W(t){return b(t?.[$])??{}}function G(t,e){const n=W(t);return Object.hasOwn(n,e)?b(n[e])??{}:{}}function ce(t,e){return Object.values(G(t,e)).filter(n=>n!==void 0).length}function X(t,e,n){const o={...W(t)};if(Et(n).length?o[e]=n:delete o[e],!Object.keys(o).length){const{[$]:r,...i}=t;return i}return{...t,[$]:o}}function Et(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return St.includes(t)}const _=(t,e,n)=>Math.min(n,Math.max(e,t));function Ot(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:_(n,lt,ut)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(_(n,mt,Pt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(_(n,Tt,bt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:_(n,_t,Rt)}if(Object.hasOwn(K,t)){const{min:n,max:o}=K[t],r=Math.round(Number(e));return Number.isFinite(r)?_(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?E(e)?e:null:t==="sizeToken"?z(e)?e:null:t==="textStyle"?m(e)?e:null:t==="alignPhone"?y.includes(e)?e:null:e}const Nt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function w(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Nt){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!y.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!y.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!m(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!z(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!E(t.fontRole)&&n("fontRole"),e??t}function z(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,c=s=>typeof s=="number"&&Number.isFinite(s)&&s>0,p=s=>typeof s=="string"&&At.includes(s);return p(e)&&c(n)&&(o===void 0||p(o))&&(r===void 0||c(r))&&(i===void 0||$t(i,n))}function $t(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function U(t){return t?.pxPhone&&z(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function B({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const wt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function zt(t){const e=[];for(const[n,o]of wt)n===t?e.push(o):o===t&&e.push(n);return e}function ae(t,e,n,o){const r={...G(t,e)},i=o==null?null:Ot(n,o);if(i===null)delete r[n];else{r[n]=i;for(const c of zt(n))delete r[c]}return X(t,e,r)}function fe(t,e){return X(t,e,{})}function It(t){return tt(t)??"none"}function kt(t){return v(t)??""}const V={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Mt(t,e){const n=E(t.role);return n||(e?.blockDrawsStyle?null:at(t.textStyle))}function le(t,e){return t==="Text"&&e==="text"}const Ft={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function Lt(t){const e=M[t],n=Ft[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function jt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ht+t.line*ht,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*gt,4)),e}const Ht=1,g="--sf-part-para";function Y(t){t=w(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=U(t.sizeToken);n&&(e.fontSize=B(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Dt(t,e){if(!e)return t;const n=w(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=U(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function O(t,e,n){t=w(t);const o=Mt(t,n),r=jt(t),i=t.size?`${t.size}px`:t.sizeToken?B(t.sizeToken):o?Lt(o):"";return{fontFamily:t.font?Gt(t.font):t.fontRole?`var(${V[t.fontRole]})`:o?`var(${V[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[g]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:kt(t.case),textAlign:t.align??"",paddingTop:Z(t.padding),paddingBottom:Z(t.padding),color:Ct(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Ct=t=>t===void 0||t===""?"":Object.hasOwn(L,t)?L[t]:et(t)===t.toLowerCase()?t:"",Z=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function ue(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Kt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(r)?P(r/n,4):0,align:Wt(t.textAlign),case:It(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Kt(t){return Number.isFinite(t)?ft.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Wt(t){for(const e of y)if(e===t)return e;return t==="end"?"right":"left"}function pe(t,e){const n=q(t);if(!n)return"";for(const o of nt)if(q(e(o.cssVar))===n)return o.key;return""}const q=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Gt(t){const e=ot(t);return e?`var(${e.cssVar})`:""}function de(t,e,n,o){return!e||F(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function xe(t,e,n=()=>R,o=p=>p,r=Bt,i=!1,c=()=>!1){let p=0;for(const{element:s,partId:a}of t){const u=F(a)?.propKey;if(!u)continue;const f=o(u),d=Object.hasOwn(e,f)?b(e[f])??{}:{},l=O(Dt(d,i),R,{blockDrawsStyle:c(u)});m(d.textStyle)?s.setAttribute?.(j,d.textStyle):s.removeAttribute?.(j);const S=k.some(h=>s.style[h]);let x=!1;for(const[h,T]of Object.entries(l))Vt(s,h,T),T&&(x=!0);if(S||k.some(h=>l[h]))for(const h of Xt(s,r))for(const T of k)h.style[T]=l[T]??"";x&&(p+=1)}return p}function Xt(t,e){const n=N(t.textContent??""),o=[];let r=t;for(let i=0;i<Ut&&e(r);i+=1){const c=r.parentElement;if(!c||N(c.textContent??"")!==n)break;o.push(c),r=c}return o}const Ut=8;function Bt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const R={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Vt(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const r=t;e===g&&(n?r.setAttribute?.(J,""):r.removeAttribute?.(J))}const J="data-sf-part-para",Yt=Object.keys(O({},R)),I=new Set(["color","overflowWrap",g,"fontStyle"]),k=Yt.filter(t=>!I.has(t));function he(t,e,n,o=i=>i,r=()=>!1){const i=new Map;for(const s of t){const a=rt(s.key,s.row);for(const u of s.texts){const f=i.get(u);f?(f.keys.add(s.key),f.partKeys.add(a)):i.set(u,{keys:new Set([s.key]),partKeys:new Set([a])})}}const c=new Map;for(const s of Object.keys(e)){if(!Zt(s))continue;const a=b(e[s])??{},u=O(a,R),f=Y(a),d=m(a.textStyle)?a.textStyle:void 0;!Object.values(u).some(Boolean)&&!Object.keys(f).length&&!d||c.set(s,{stamp:Q(n,s),declarations:u,...Object.keys(f).length?{phone:f}:{},...d?{textStyle:d}:{}})}const p=new Map;for(const[s,{keys:a,partKeys:u}]of i){const f=u.size===1?[...u][0]:a.size===1?[...a][0]:null;if(!f)continue;const d=o(f);if(!Object.hasOwn(e,d))continue;const l=b(e[d])??{},S=O(l,R,{blockDrawsStyle:r(f)}),x=Y(l),A=m(l.textStyle)?l.textStyle:void 0;!Object.values(S).some(Boolean)&&!Object.keys(x).length&&!A||p.set(s,{stamp:Q(n,f),declarations:S,...Object.keys(x).length?{phone:x}:{},...A?{textStyle:A}:{}})}return p.size||c.size?{rules:p,kindRules:c,drawn:new Set(i.keys())}:null}function Zt(t){return t.startsWith("@")}function ge(t,e){return t?.kindRules.get(e)??null}function Q(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Se(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:c}=r;if(n.has(i))return;n.add(i);const p=Object.entries(c).filter(([,l])=>l!==""),s=l=>l.map(([S,x])=>`${Jt(S)}: ${x}`).join("; "),a=`[${st}="${i}"]`,u=p.filter(([l])=>!I.has(l)),f=p.filter(([l])=>I.has(l));u.length&&e.push(`${a}, *:has(> ${a}) { ${s(u)} }`),f.length&&e.push(`${a} { ${s(f)} }`),c[g]&&(e.push(`*:has(> ${a}) { ${g}: ${c[g]} }`),e.push(...qt(a,`*:has(> ${a})`)));const d=Object.entries(r.phone??{}).filter(([,l])=>l!=="");d.length&&e.push(`@media ${it} { ${a}, *:has(> ${a}) { ${s(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
2
- `)}function qt(t,e){const n=`var(${g})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const Jt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function me(t,e){if(!t)return null;const n=N(e),o=t.rules.get(n);if(o)return o;if(n.length<Qt||t.drawn.has(n))return null;let r=null;for(const[i,c]of t.rules)if(i.includes(n)){if(r&&r.stamp!==c.stamp)return null;r=c}return r}const Qt=8;export{y as PART_ALIGNS,bt as PART_LETTER_EM_MAX,Tt as PART_LETTER_EM_MIN,gt as PART_LETTER_STEP,Pt as PART_LINE_HEIGHT_MAX,mt as PART_LINE_HEIGHT_MIN,ht as PART_LINE_STEP,K as PART_MEASURED_TRACKS,ut as PART_NUDGE_MAX,lt as PART_NUDGE_MIN,dt as PART_PADDING_MAX,pt as PART_PADDING_MIN,xt as PART_PADDING_STEP,J as PART_PARAGRAPH_ATTR,Rt as PART_PARAGRAPH_MAX,_t as PART_PARAGRAPH_MIN,g as PART_PARAGRAPH_VAR,St as PART_RELATIVE_PROPS,C as PART_SIZE_MAX,D as PART_SIZE_MIN,At as PART_SIZE_STEPS,st as PART_STYLED_ATTR,$ as PART_STYLES_PROP,Yt as PART_STYLE_PROPERTIES,ft as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,H as STYLE_ID_OF_ROLE,j as TEXT_STYLE_ATTR,xe as applyPartStyles,le as blockDrawsTextStyle,se as followedStyleOf,Zt as isPartKindKey,m as isTextStyleId,qt as paragraphRules,It as partCaseOfTransform,kt as partCaseTransform,pe as partFontKeyOf,Y as partPhoneDeclarations,ge as partRuleForKind,me as partRuleForText,jt as partSpacingOf,ue as partStyleBase,ce as partStyleCount,Se as partStyleCss,O as partStyleDeclarations,Dt as partStyleForScreen,de as partStyleSource,ae as propsWithPartStyleValue,fe as propsWithoutPartStyle,he as publishedPartStyles,G as readPartStyle,W as readPartStyles};
1
+ import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{parseHexColor as Q}from"efficient-shell/format";import{FONT_OPTIONS as tt,fontOption as et,fontRoleOf as b,SIZE_STEP_OF_ROLE as M}from"../../../format/lib/fonts.js";import{encodePartKey as nt}from"../../../format/lib/document/part-key.js";import{decodePartId as F,normalizePartText as E}from"./text-parts.js";import{COLOUR_TOKEN as L}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as rt}from"../content/view-values.js";import{plainRecord as $,propsWithPartRecord as ot,readPartRecord as it,readPartRecords as st}from"../../../format/lib/document/part-records.js";const y="_partStyles",at="data-sf-part-styled",H="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function T(t){return typeof t=="string"&&ct.test(t)}const j={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function ft(t){if(!t)return null;for(const[e,n]of Object.entries(j))if(n===t)return e;return null}function ue(t){if(T(t.textStyle))return t.textStyle;const e=b(t.role);return e?j[e]:void 0}const lt=[400,500,600,700],_=["left","center","right","justify"],D=5,C=1e3,ut=-5,pt=10,dt=0,xt=64,ht=2,K={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:dt,max:xt,step:ht}},gt=.05,mt=.01,Pt=["line","letter"],St=.5,Tt=2.5,Rt=-1,bt=1,_t=0,At=400,Et=[...new Set(Object.values(M))];function $t(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function pe(t){return st(t,y)}function W(t,e){return it(t,y,e)}function de(t,e){return Object.values(W(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){return ot(t,y,e,yt(n).length?n:null)}function yt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Nt(t){return Pt.includes(t)}const R=(t,e,n)=>Math.min(n,Math.max(e,t));function Ot(t,e){if(Nt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:R(n,ut,pt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(R(n,St,Tt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(R(n,Rt,bt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:R(n,_t,At)}if(Object.hasOwn(K,t)){const{min:n,max:r}=K[t],o=Math.round(Number(e));return Number.isFinite(o)?R(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?b(e)?e:null:t==="sizeToken"?O(e)?e:null:t==="textStyle"?T(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const wt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function N(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of wt){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!T(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!O(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!b(t.fontRole)&&n("fontRole"),e??t}function O(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:r,pxPhone:o,fluid:i}=t,s=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,c=f=>typeof f=="string"&&Et.includes(f);return c(e)&&s(n)&&(r===void 0||c(r))&&(o===void 0||s(o))&&(i===void 0||zt(i,n))}function zt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:r,...o}=t;return Object.keys(o).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof r=="number"&&Number.isFinite(r)&&r>0&&r<=100}function X(t){return t?.pxPhone&&O(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function U({step:t,px:e,fluid:n}){const r=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,o=`var(--size-${t}, ${r})`;return t.startsWith("heading")?`min(${o}, var(--sf-heading-max,9999px))`:o}const It=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function kt(t){const e=[];for(const[n,r]of It)n===t?e.push(r):r===t&&e.push(n);return e}function xe(t,e,n,r){const o={...W(t,e)},i=r==null?null:Ot(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of kt(n))delete o[s]}return G(t,e,o)}function he(t,e){return G(t,e,{})}function Mt(t){return J(t)??"none"}function Ft(t){return q(t)??""}const v={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Lt(t,e){const n=b(t.role);return n||(e?.blockDrawsStyle?null:ft(t.textStyle))}function ge(t,e){return t==="Text"&&e==="text"}const Ht={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function jt(t){const e=M[t],n=Ht[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Dt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Ct+t.line*gt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*mt,4)),e}const Ct=1,m="--sf-part-para";function Kt(t){t=N(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=X(t.sizeToken);n&&(e.fontSize=U(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Wt(t,e){if(!e)return t;const n=N(t);let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone};else{const o=X(n.sizeToken);o&&(r={...r,size:void 0,sizeToken:o})}return n.alignPhone&&(r={...r,align:n.alignPhone}),r}function w(t,e,n){t=N(t);const r=Lt(t,n),o=Dt(t),i=t.size?`${t.size}px`:t.sizeToken?U(t.sizeToken):r?jt(r):"";return{fontFamily:t.font?vt(t.font):t.fontRole?`var(${v[t.fontRole]})`:r?`var(${v[r]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:o.lineHeight!==void 0?String(o.lineHeight):"",letterSpacing:o.letterSpacingEm!==void 0?`${o.letterSpacingEm}em`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Ft(t.case),textAlign:t.align??"",paddingTop:V(t.padding),paddingBottom:V(t.padding),color:Gt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Gt=t=>t===void 0||t===""?"":Object.hasOwn(L,t)?L[t]:Q(t)===t.toLowerCase()?t:"",V=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function me(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Xt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?P(r/n,3):1.2,letterEm:Number.isFinite(o)?P(o/n,4):0,align:Ut(t.textAlign),case:Mt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Xt(t){return Number.isFinite(t)?lt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Ut(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function Pe(t,e){const n=Y(t);if(!n)return"";for(const r of tt)if(Y(e(r.cssVar))===n)return r.key;return""}const Y=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function vt(t){const e=et(t);return e?`var(${e.cssVar})`:""}function Se(t,e,n,r){return!e||F(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function Te(t,e,n=()=>A,r=c=>c,o=Bt,i=!1,s=()=>!1){let c=0;for(const{element:f,partId:u}of t){const l=F(u)?.propKey;if(!l)continue;const p=r(l),d=Object.hasOwn(e,p)?$(e[p])??{}:{},a=w(Wt(d,i),A,{blockDrawsStyle:s(l)});T(d.textStyle)?f.setAttribute?.(H,d.textStyle):f.removeAttribute?.(H);const h=I.some(x=>f.style[x]);let g=!1;for(const[x,S]of Object.entries(a))Zt(f,x,S),S&&(g=!0);if(h||I.some(x=>a[x]))for(const x of Vt(f,o))for(const S of I)x.style[S]=a[S]??"";g&&(c+=1)}return c}function Vt(t,e){const n=E(t.textContent??""),r=[];let o=t;for(let i=0;i<Yt&&e(o);i+=1){const s=o.parentElement;if(!s||E(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Yt=8;function Bt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Zt(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const r=t.style;typeof r.setProperty=="function"?n?r.setProperty(e,n):r.removeProperty?.(e):r[e]=n;const o=t;e===m&&(n?o.setAttribute?.(B,""):o.removeAttribute?.(B))}const B="data-sf-part-para",qt=Object.keys(w({},A)),z=new Set(["color","overflowWrap",m,"fontStyle"]),I=qt.filter(t=>!z.has(t));function Re(t,e,n,r=c=>c,o=()=>!1,i=()=>null,s=[]){const c=new Map;for(const l of t){const p=nt(l.key,l.row);for(const d of l.texts){const a=c.get(d);a?(a.keys.add(l.key),a.partKeys.add(p)):c.set(d,{keys:new Set([l.key]),partKeys:new Set([p])})}}const f=new Map;for(const l of new Set([...Object.keys(e),...s])){if(!Jt(l))continue;const p=Z(n,l,$(e[l])??{},!1,i(l));p&&f.set(l,p)}const u=new Map;for(const[l,{keys:p,partKeys:d}]of c){const a=d.size===1?[...d][0]:p.size===1?[...p][0]:null;if(!a)continue;const h=r(a),g=i(h);if(!Object.hasOwn(e,h)&&!g)continue;const k=$(e[h])??{},x=Z(n,a,k,o(a),g);x&&u.set(l,x)}return u.size||f.size?{rules:u,kindRules:f,drawn:new Set(c.keys())}:null}function Z(t,e,n,r,o){const i=w(n,A,{blockDrawsStyle:r}),s=Kt(n),c=T(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(s).length&&!c&&!o?null:{stamp:Qt(t,e),declarations:i,...Object.keys(s).length?{phone:s}:{},...c?{textStyle:c}:{},...o?{motion:o}:{}}}function Jt(t){return t.startsWith("@")}function be(t,e){return t?.kindRules.get(e)??null}function Qt(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function _e(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const c=Object.entries(s).filter(([,a])=>a!==""),f=a=>a.map(([h,g])=>`${ee(h)}: ${g}`).join("; "),u=`[${at}="${i}"]`,l=c.filter(([a])=>!z.has(a)),p=c.filter(([a])=>z.has(a));l.length&&e.push(`${u}, *:has(> ${u}) { ${f(l)} }`),p.length&&e.push(`${u} { ${f(p)} }`),s[m]&&(e.push(`*:has(> ${u}) { ${m}: ${s[m]} }`),e.push(...te(u,`*:has(> ${u})`)));const d=Object.entries(o.phone??{}).filter(([,a])=>a!=="");d.length&&e.push(`@media ${rt} { ${u}, *:has(> ${u}) { ${f(d)} } }`),o.motion?.hover==="lift"&&e.push(...$t(`*:has(> ${u})`))};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
2
+ `)}function te(t,e){const n=`var(${m})`,r=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${r}:not(:first-child) { margin-top: ${n} }`,`${t} ${r}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const ee=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Ae(t,e){if(!t)return null;const n=E(e),r=t.rules.get(n);if(r)return r;if(n.length<ne||t.drawn.has(n))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(n)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const ne=8;export{_ as PART_ALIGNS,bt as PART_LETTER_EM_MAX,Rt as PART_LETTER_EM_MIN,mt as PART_LETTER_STEP,Tt as PART_LINE_HEIGHT_MAX,St as PART_LINE_HEIGHT_MIN,gt as PART_LINE_STEP,K as PART_MEASURED_TRACKS,pt as PART_NUDGE_MAX,ut as PART_NUDGE_MIN,xt as PART_PADDING_MAX,dt as PART_PADDING_MIN,ht as PART_PADDING_STEP,B as PART_PARAGRAPH_ATTR,At as PART_PARAGRAPH_MAX,_t as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Pt as PART_RELATIVE_PROPS,C as PART_SIZE_MAX,D as PART_SIZE_MIN,Et as PART_SIZE_STEPS,at as PART_STYLED_ATTR,y as PART_STYLES_PROP,qt as PART_STYLE_PROPERTIES,lt as PART_WEIGHTS,I as SHARED_PART_PROPERTIES,j as STYLE_ID_OF_ROLE,H as TEXT_STYLE_ATTR,Te as applyPartStyles,ge as blockDrawsTextStyle,ue as followedStyleOf,Jt as isPartKindKey,T as isTextStyleId,te as paragraphRules,Mt as partCaseOfTransform,Ft as partCaseTransform,Pe as partFontKeyOf,$t as partLiftRules,Kt as partPhoneDeclarations,be as partRuleForKind,Ae as partRuleForText,Dt as partSpacingOf,me as partStyleBase,de as partStyleCount,_e as partStyleCss,w as partStyleDeclarations,Wt as partStyleForScreen,Se as partStyleSource,xe as propsWithPartStyleValue,he as propsWithoutPartStyle,Re as publishedPartStyles,W as readPartStyle,pe as readPartStyles};
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{CardRowDrawn as m}from"../../../components/CardRowContext.js";import{PublishedPartStyles as y}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as h}from"../part-styles.js";import{partNeedles as f}from"../text-parts.js";const j={name:"clickableParts",applies:(o,t,s)=>typeof s?.render=="function",draw(o,t,s){const r=o,d=()=>r.textParts??r.fields,i=r.render,a=s.inspector?.PartAnchors;r.render=e=>{const c=h(e);return e.editor?.isEditing&&a?n(m,{type:t,props:e,children:l=>n(a,{needles:f(d(),l),styles:c,type:t,children:i(e)})}):Object.keys(c).length?n(m,{type:t,props:e,children:l=>n(y,{needles:f(d(),l),styles:c,type:t,children:i(e)})}):i(e)}}};export{j as clickableParts};
1
+ import{jsx as n}from"react/jsx-runtime";import{CardRowDrawn as f}from"../../../components/CardRowContext.js";import{PublishedPartStyles as h}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as P}from"../part-styles.js";import{readPartMotions as p}from"../../animation/part-motion.js";import{partNeedles as y}from"../text-parts.js";const _={name:"clickableParts",applies:(a,e,s)=>typeof s?.render=="function",draw(a,e,s){const r=a,d=()=>r.textParts??r.fields,o=r.render,m=s.inspector?.PartAnchors;r.render=t=>{const i=P(t),c=p(t);return t.editor?.isEditing&&m?n(f,{type:e,props:t,children:l=>n(m,{needles:y(d(),l),styles:i,motions:c,type:e,children:o(t)})}):!Object.keys(i).length&&!Object.keys(c).length?o(t):n(f,{type:e,props:t,children:l=>n(h,{needles:y(d(),l),styles:i,motions:c,type:e,children:o(t)})})}}};export{_ as clickableParts};
@@ -1 +1 @@
1
- import{jsx as _}from"react/jsx-runtime";import{isBackgroundBox as u}from"../../../../format/lib/content/box-background.js";import{SECTION_PAD_KEYS as S,padValuesOf as m,resolveSectionPadding as g,sectionPadAttrs as p}from"../../content/section-padding.js";import{sectionFillPassClass as T}from"../../../../format/lib/content/section-min-height.js";const l={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120},DetailRows:{top:100,bottom:100}},c=new Set(Object.keys(l)),P=new Set(["Flex","Text","Heading","ImageBlock"]),I=new Set(["Divider"]),A=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),f=new Set(["ProductGrid"]);function i(e,t,o=!1){const r=e.render;e.render=n=>{if(t?.(n))return r(n);const s=p(m(n,S,o)),a=r(n),d=T(n);return s?_("div",{className:d?`${s.className} ${d}`:s.className,style:s.style,children:a}):a}}const h={name:"sectionPadding",applies:(e,t,o)=>t.isSection(e)&&!A.has(e)&&!!o&&typeof o.render=="function",panel(e,t,o){c.has(t)||f.has(t)||(e.fields={...e.fields,...o.sidesPaddingFields()})},draw(e,t){if(c.has(t)){const o=e.render,r=l[t];e.render=n=>{const s=g(n,r);return o({...n,padTop:s.top,padBottom:s.bottom})};return}if(f.has(t)){i(e);return}P.has(t)||I.has(t)||i(e,t==="Flex"?o=>u(o.bgImage):void 0,!0)}},D=["Heading","Text","ImageBlock"],E=["LogoBlock"],B={name:"blockPadding",applies:(e,t,o)=>(D.includes(e)||E.includes(e))&&!!o&&typeof o.render=="function",panel(e,t,o){e.fields={...e.fields,...o.sidesPaddingFields()}},draw(e,t){P.has(t)||i(e,void 0,!0)}};export{I as PADS_ITS_OWN_SPACE,P as PAD_ON_ROOT,c as SECTION_PAD_INNER,l as SECTION_PAD_INNER_DEFAULTS,B as blockPadding,h as sectionPadding};
1
+ import{jsx as _}from"react/jsx-runtime";import{isBackgroundBox as u}from"../../../../format/lib/content/box-background.js";import{SECTION_PAD_KEYS as S,padValuesOf as m,resolveSectionPadding as g,sectionPadAttrs as p}from"../../content/section-padding.js";import{sectionFillPassClass as T}from"../../../../format/lib/content/section-min-height.js";const l={ParagraphsA:{top:60,bottom:80},StatsParagraph:{top:120,bottom:120},Timeline:{top:120,bottom:120},Footprint:{top:120,bottom:120},TimelineTrack:{top:120,bottom:120},TitleWithButtons:{top:140,bottom:140},ProcessSteps:{top:120,bottom:120},DetailRows:{top:100,bottom:100}},c=new Set(Object.keys(l)),P=new Set(["Flex","Text","Heading","ImageBlock"]),b=new Set(["Divider"]),I=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),f=new Set(["ProductGrid"]);function a(t,e,o=!1){const r=t.render;t.render=n=>{if(e?.(n))return r(n);const s=p(m(n,S,o)),i=r(n),d=T(n);return s?_("div",{className:d?`${s.className} ${d}`:s.className,style:s.style,children:i}):i}}const h={name:"sectionPadding",applies:(t,e,o)=>e.isSection(t)&&!I.has(t)&&!!o&&typeof o.render=="function",panel(t,e,o){c.has(e)||f.has(e)||(t.fields={...t.fields,...o.sidesPaddingFields({tablet:!0})})},draw(t,e){if(c.has(e)){const o=t.render,r=l[e];t.render=n=>{const s=g(n,r);return o({...n,padTop:s.top,padBottom:s.bottom})};return}if(f.has(e)){a(t);return}P.has(e)||b.has(e)||a(t,e==="Flex"?o=>u(o.bgImage):void 0,!0)}},A=["Heading","Text","ImageBlock"],D=["LogoBlock"],B={name:"blockPadding",applies:(t,e,o)=>(A.includes(t)||D.includes(t))&&!!o&&typeof o.render=="function",panel(t,e,o){t.fields={...t.fields,...o.sidesPaddingFields({tablet:!0})}},draw(t,e){P.has(e)||a(t,void 0,!0)}};export{b as PADS_ITS_OWN_SPACE,P as PAD_ON_ROOT,c as SECTION_PAD_INNER,l as SECTION_PAD_INNER_DEFAULTS,B as blockPadding,h as sectionPadding};
@@ -1,5 +1,6 @@
1
- import { type TextStyle, type TextStyleCase } from "efficient-easel/text-styles/model";
1
+ import { type TextStyle, type TextStyleCase, type TextStyleDevice } from "efficient-easel/text-styles/model";
2
2
  import { type FontRole, type FontsValue } from "../../../format/lib/fonts.js";
3
+ import { viewRules } from "../content/view-values.js";
3
4
  import { type PartStyle } from "../document/part-styles.js";
4
5
  import { faceClassOf } from "../../../format/lib/text-style-face.js";
5
6
  export { faceClassOf };
@@ -17,6 +18,15 @@ export type StoredTextStyleValues = {
17
18
  letterCase?: TextStyleCase;
18
19
  largestSize?: number;
19
20
  sizePhone?: number;
21
+ sizeTablet?: number;
22
+ lineHeightTablet?: number;
23
+ lineHeightPhone?: number;
24
+ letterSpacingTablet?: number;
25
+ letterSpacingPhone?: number;
26
+ paragraphSpacingTablet?: number;
27
+ paragraphSpacingPhone?: number;
28
+ largestSizeTablet?: number;
29
+ largestSizePhone?: number;
20
30
  };
21
31
  export type StoredTextStyle = {
22
32
  id: string;
@@ -31,16 +41,18 @@ export type OldSiteText = {
31
41
  compression: string;
32
42
  typography: Partial<ResolvedHeadingTypography> | Record<string, unknown>;
33
43
  };
44
+ export declare function viewSizeOf(values: StoredTextStyleValues, desktopPx: number, view: TextStyleDevice, rules?: ReturnType<typeof viewRules>): number;
34
45
  export declare function textStylesFromOld(old: OldSiteText): StoredTextStyle[];
35
46
  export declare function storedTextStyles(value: unknown): StoredTextStyle[];
36
47
  export declare function listToWrite(saved: unknown): StoredTextStyle[];
37
48
  export declare function resolveTextStyles(saved: unknown, old: OldSiteText): StoredTextStyle[];
38
- export declare function applyListChange({ saved, old, cur, next, sizeOf, }: {
49
+ export declare function applyListChange({ saved, old, cur, next, sizeOf, panelView, }: {
39
50
  saved: unknown;
40
51
  old: OldSiteText;
41
52
  cur: readonly TextStyle[];
42
53
  next: readonly TextStyle[];
43
54
  sizeOf: (style: StoredTextStyle) => number;
55
+ panelView?: TextStyleDevice;
44
56
  }): {
45
57
  saved: StoredTextStyle[];
46
58
  old: OldSiteText;
@@ -49,8 +61,8 @@ export declare function listChangePatch(next: {
49
61
  saved: StoredTextStyle[];
50
62
  old: OldSiteText;
51
63
  }, prev: OldSiteText): SiteThemeRowPatch;
52
- export declare function toPanelStyles(stored: readonly StoredTextStyle[], sizeOf: (s: StoredTextStyle) => number): TextStyle[];
53
- export declare function fromPanelStyles(list: readonly TextStyle[], sizeOf: (s: StoredTextStyle) => number): StoredTextStyle[];
64
+ export declare function toPanelStyles(stored: readonly StoredTextStyle[], sizeOf: (s: StoredTextStyle) => number, device?: TextStyleDevice): TextStyle[];
65
+ export declare function fromPanelStyles(list: readonly TextStyle[], sizeOf: (s: StoredTextStyle) => number, device?: TextStyleDevice): StoredTextStyle[];
54
66
  export type SiteTextSeed = {
55
67
  fonts: FontsValue;
56
68
  sizes: SizesValue;
@@ -1,2 +1,2 @@
1
- import{defaultTextStyles as A,textStyleCaseCss as Y}from"efficient-easel/text-styles/model";import{parseHexColor as G}from"efficient-shell/format";import{FONT_OPTIONS as U,normalizeFonts as I}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as Z,TEXT_STYLE_ATTR as q,paragraphRules as B,partSpacingOf as K}from"../document/part-styles.js";import{faceClassOf as L}from"../../../format/lib/text-style-face.js";import{compressionMetrics as Q,headingTypographyFromRow as ee,normalizeHeadingCompression as k,normalizeSizes as j}from"../../../format/lib/theme.js";import{finiteNumber as m}from"../../../format/lib/finite-number.js";import{nonEmptyString as _}from"../../../format/lib/non-empty-string.js";const H=e=>e==="sentence"?"none":void 0,F=["font","color","size","sizePhone","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function g(e){const i={};for(const n of F)e[n]!==void 0&&(i[n]=e[n]);return i}function T(e,i){const{auto:n,...t}=e,o=new Set(i??[]),r=F.filter(a=>o.has(a)&&e.values[a]===void 0);return r.length?{...t,auto:r}:t}function M(e){const i=e.fonts,n=e.sizes,t=e.typography,o=Q(e.compression),r={"heading-1":{font:_(i.heading),size:m(n.headingLarge),weight:m(t.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:H(t.case),largestSize:m(t.maxPx)},"heading-2":{font:_(i.heading2),size:m(n.headingMedium),weight:m(t.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:H(t.case2)},"heading-3":{font:_(i.heading3),size:m(n.headingSmall),weight:m(t.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:H(t.case3)},"body-1":{font:_(i.body),size:m(n.body)},"body-5":{font:_(i.label),size:m(n.label)}};return A().map(({id:a,kind:l,name:d})=>({id:a,kind:l,name:d,values:g(r[a]??{})}))}function C(e){return Array.isArray(e)&&e.every(n=>n&&typeof n=="object"&&typeof n.id=="string"&&(n.kind==="heading"||n.kind==="body")&&typeof n.name=="string")?e.map(n=>T({...n,values:g(n.values??{})},Array.isArray(n.auto)?n.auto:void 0)):null}function he(e){return C(e)??[]}function R(e){return C(e)??A().map(({id:i,kind:n,name:t})=>({id:i,kind:n,name:t,values:{}}))}function O(e,i){const n=M(i),t=C(e);return t?t.map(o=>{const r={...w(n,o.id)};for(const a of o.auto??[])delete r[a];return{...o,values:g({...r,...o.values})}}):n}const w=(e,i)=>e.find(n=>n.id===i)?.values??{},V=["heading-1","heading-2","heading-3"];function me({saved:e,old:i,cur:n,next:t,sizeOf:o}){const r=M(i),a=R(e),l=O(a,i),d=[],S=t.map(s=>{const c=n.find(f=>f.id===s.id),x=a.find(f=>f.id===s.id);if(!c||!x)return ne([s],o)[0];const u={...x.values},z=new Set(x.auto??[]),v=s.values,E=c.values,N=[...new Set([...Object.keys(v),...Object.keys(E)])].filter(f=>JSON.stringify(v[f])!==JSON.stringify(E[f]));N.sort((f,y)=>+(f==="letterSpacing")-+(y==="letterSpacing"));for(const f of N){const y=f==="lineSpacing"?"lineHeight":f,$=v[f];if($===void 0){delete u[y],w(r,s.id)[y]!==void 0&&(d.push([s.id,y]),z.add(y));continue}if(z.delete(y),f==="lineSpacing")u.lineHeight=b($/100,3);else if(f==="letterSpacing"){const J=l.find(W=>W.id===s.id),P=o({...s,values:g({...J?.values??{},...u})});u.letterSpacing=P?b($/P,4):0}else u[y]=$}return T({id:s.id,kind:s.kind,name:s.name,values:g(u)},z)});let p=i.compression;if(d.some(([s,c])=>(c==="lineHeight"||c==="letterSpacing")&&V.includes(s))&&k(p)!=="normal"){for(const s of V){const c=S.find(u=>u.id===s);if(!c)continue;const x={...c.values};for(const u of["lineHeight","letterSpacing"])d.some(([z,v])=>z===s&&v===u)||x[u]===void 0&&!(c.auto??[]).includes(u)&&(x[u]=w(r,s)[u]);c.values=g(x)}p="normal"}return{saved:S,old:{...i,compression:p}}}function ye(e,i){const n={text_styles:e.saved};return e.old.compression!==i.compression&&(n.heading_compression=k(e.old.compression)),n}const b=(e,i)=>Number(e.toFixed(i));function Se(e,i){return e.map(n=>{const{lineHeight:t,letterSpacing:o,...r}=n.values,a={...r};return t!==void 0&&(a.lineSpacing=b(t*100,1)),o!==void 0&&(a.letterSpacing=b(o*i(n),2)),{id:n.id,kind:n.kind,name:n.name,values:a}})}function ne(e,i){return e.map(n=>{const{lineSpacing:t,letterSpacing:o,...r}=n.values,a={id:n.id,kind:n.kind,name:n.name,values:g({...r})},l={...a.values};if(t!==void 0&&(l.lineHeight=b(t/100,3)),o!==void 0){const d=i({...a,values:{...a.values}});l.letterSpacing=d?b(o/d,4):0}return{...a,values:g(l)}})}function xe(e){const i={fonts:I({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:j({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:k(e.heading_compression),typography:ee(e)},n=e.text_styles??null,t=Array.isArray(n)?D(O(n,i),i):i;return{fonts:I(t.fonts),sizes:j(t.sizes),compression:k(t.compression),typography:t.typography,textStyles:n}}function D(e,i){const n=s=>e.find(c=>c.id===s)?.values??{},t=n("heading-1"),o=n("heading-2"),r=n("heading-3"),a=n("body-1"),l=n("body-5"),d=i.fonts,S=i.sizes,p=i.typography,h=s=>s==="none"?"sentence":"authored";return{fonts:{...d,heading:t.font??d.heading,heading2:o.font??t.font??d.heading2,heading3:r.font??t.font??d.heading3,body:a.font??d.body,label:l.font??d.label},sizes:{...S,headingLarge:t.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:a.size??null,label:l.size??null},compression:i.compression,typography:{...p,case:h(t.letterCase),weight:t.weight??null,maxPx:t.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:h(o.letterCase),case3:h(r.letterCase)}}}function be(e){const i=C(e.textStyles);if(!i||i.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const n={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},t=D(O(i,n),n);return{...e,fonts:t.fonts,sizes:t.sizes,headingCompression:t.compression,headingTypography:t.typography}}function te(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":G(e)===e.toLowerCase()?e:null}function ze(e){const i=[];for(const n of e){const t=n.values,o=`.${L(n)}`,r=`[${q}="${n.id}"]`,a=`${o}, ${r}`,l=[],d=t.font!==void 0?U.find(s=>s.key===t.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),t.size!==void 0){const s=t.largestSize!==void 0?Math.min(t.size,t.largestSize):t.size;l.push(`font-size: ${s}px`)}const S=t.color!==void 0?te(t.color):null;S&&l.push(`color: ${S}`),t.italic===!0&&l.push("font-style: italic"),t.weight!==void 0&&l.push(`font-weight: ${t.weight}`);const p=[];t.lineHeight!==void 0&&p.push(`line-height: ${t.lineHeight}`),t.letterSpacing!==void 0&&p.push(`letter-spacing: ${t.letterSpacing}em`),n.kind==="body"&&l.push(...p);const h=Y(t.letterCase);if(h&&n.kind==="body"&&l.push(`text-transform: ${h}`),t.paragraphSpacing&&l.push(`--sf-part-para: ${t.paragraphSpacing}px`),l.length&&i.push(`${a} { ${l.join("; ")} }`),n.kind==="heading"&&p.length&&i.push(`${a}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${p.join("; ")} }`),n.kind==="heading"&&h&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${h} }`),t.paragraphSpacing&&(i.push(`*:has(> ${r}) { --sf-part-para: ${t.paragraphSpacing}px }`),i.push(...B(`:is(${a})`,`*:has(> ${r})`))),t.sizePhone!==void 0){const s=ie[n.id],c=[`${a} { font-size: ${t.sizePhone}px }`];s&&c.push(`.sf-themed-content { --size-${s}: ${t.sizePhone}px !important }`),i.push(`@media ${X} { ${c.join(" ")} }`)}}return i.join(`
2
- `)}const ie={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function ve(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function _e(e){return e?Z[e]:void 0}function oe(e){const i=K(e);return g({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:i.lineHeight,letterSpacing:i.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function $e(e){return Object.keys(oe(e)).length>0}function ke({saved:e,old:i,styleId:n,values:t}){const o=R(e);return{saved:se(o,n,t),old:i}}function se(e,i,n){return e.map(t=>t.id===i?T({...t,values:g({...t.values,...n})},t.auto):t)}function Ce(e){const i=e.filter(n=>n.kind==="body").map(n=>Number(/^body-(\d+)$/.exec(n.id)?.[1])).filter(n=>Number.isInteger(n)&&n>0);return i.length?`body-${Math.max(...i)}`:"body-1"}export{ve as accentItalicCss,me as applyListChange,Ce as eyebrowStyleId,L as faceClassOf,ne as fromPanelStyles,$e as hasStyleChange,ye as listChangePatch,R as listToWrite,oe as partStyleToTextStyleValues,ke as pushIntoStyle,O as resolveTextStyles,se as setStyleValues,xe as siteTextFromRow,he as storedTextStyles,_e as styleIdOfRole,ze as textStylesCss,M as textStylesFromOld,D as textStylesToOld,be as themeWithTextStyles,Se as toPanelStyles};
1
+ import{defaultTextStyles as Y,textStyleCaseCss as re,textStyleViewKey as le}from"efficient-easel/text-styles/model";import{phoneKey as ce,resolveViewValue as B,tabletKey as de}from"efficient-easel/draw";import{parseHexColor as pe}from"efficient-shell/format";import{FONT_OPTIONS as fe,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as ue,TABLET_MEDIA as ge,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as he,TEXT_STYLE_ATTR as me,paragraphRules as Z,partSpacingOf as Se}from"../document/part-styles.js";import{faceClassOf as q}from"../../../format/lib/text-style-face.js";import{compressionMetrics as ye,headingTypographyFromRow as be,normalizeHeadingCompression as E,normalizeSizes as Q}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as O}from"../../../format/lib/non-empty-string.js";const N=e=>e==="sentence"?"none":void 0,ee=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],T=["desktop","tablet","phone"],C=(e,t)=>t==="desktop"?e:t==="tablet"?de(e):ce(e),k=(e,t)=>t==="desktop"?e:le(e,t);function j(e,t,i,n=X()){return B("textSize",t,e.sizeTablet,e.sizePhone,n)[i]}const xe=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function V(e){for(const[t,i,n]of xe)for(const o of T)if(e===k(t,o))return{key:C(i,o),view:o,spacing:n};return{key:e,view:"desktop",spacing:null}}function b(e){const t={};for(const i of ee)e[i]!==void 0&&(t[i]=e[i]);return t}function M(e,t){const{auto:i,...n}=e,o=new Set(t??[]),r=ee.filter(s=>o.has(s)&&e.values[s]===void 0);return r.length?{...n,auto:r}:n}function ne(e){const t=e.fonts,i=e.sizes,n=e.typography,o=ye(e.compression),r={"heading-1":{font:O(t.heading),size:v(i.headingLarge),weight:v(n.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case),largestSize:v(n.maxPx)},"heading-2":{font:O(t.heading2),size:v(i.headingMedium),weight:v(n.weight2),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case2)},"heading-3":{font:O(t.heading3),size:v(i.headingSmall),weight:v(n.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:N(n.case3)},"body-1":{font:O(t.body),size:v(i.body)},"body-5":{font:O(t.label),size:v(i.label)}};return Y().map(({id:s,kind:l,name:d})=>({id:s,kind:l,name:d,values:b(r[s]??{})}))}function I(e){return Array.isArray(e)&&e.every(i=>i&&typeof i=="object"&&typeof i.id=="string"&&(i.kind==="heading"||i.kind==="body")&&typeof i.name=="string")?e.map(i=>M({...i,values:b(i.values??{})},Array.isArray(i.auto)?i.auto:void 0)):null}function je(e){return I(e)??[]}function te(e){return I(e)??Y().map(({id:t,kind:i,name:n})=>({id:t,kind:i,name:n,values:{}}))}function R(e,t){const i=ne(t),n=I(e);return n?n.map(o=>{const r={...F(i,o.id)};for(const s of o.auto??[])delete r[s];return{...o,values:b({...r,...o.values})}}):i}const F=(e,t)=>e.find(i=>i.id===t)?.values??{},ie=["heading-1","heading-2","heading-3"];function Ve({saved:e,old:t,cur:i,next:n,sizeOf:o,panelView:r="desktop"}){const s=ne(t),l=te(e),d=R(l,t),c=[],f=n.map(a=>{const S=i.find(m=>m.id===a.id),g=l.find(m=>m.id===a.id);if(!S||!g)return ze([a],o,r)[0];const p={...g.values},x=new Set(g.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(m=>JSON.stringify(y[m])!==JSON.stringify(_[m])),D=m=>V(m).spacing==="letter";z.sort((m,L)=>Number(D(m))-Number(D(L)));for(const m of z){const{key:L,view:ae,spacing:K}=V(m),$=L,P=y[m];if(P===void 0){delete p[$],F(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=w(P/100,3);else if(K==="letter"){const W={...d.find(A=>A.id===a.id)?.values??{}};for(const A of z)y[A]===void 0&&delete W[V(A).key];const G=b({...W,...p}),J=j(G,o({...a,values:G}),ae);p[$]=J?w(P/J,4):0}else p[$]=P}return M({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let u=t.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&ie.includes(a))&&E(u)!=="normal"){for(const a of ie){const S=f.find(p=>p.id===a);if(!S)continue;const g={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||g[p]===void 0&&!(S.auto??[]).includes(p)&&(g[p]=F(s,a)[p]);S.values=b(g)}u="normal"}return{saved:f,old:{...t,compression:u}}}function Me(e,t){const i={text_styles:e.saved};return e.old.compression!==t.compression&&(i.heading_compression=E(e.old.compression)),i}const w=(e,t)=>Number(e.toFixed(t)),oe=(e,t)=>T.indexOf(e)<T.indexOf(t)?t:e;function Re(e,t,i="desktop"){return e.map(n=>{const o={...n.values},r=t(n);for(const s of T){const l=C("lineHeight",s),d=n.values[l],c=n.values[C("letterSpacing",s)];delete o[l],d!==void 0&&(o[k("lineSpacing",s)]=w(d*100,1));const f=oe(s,i);c!==void 0&&(o[k("letterSpacing",s)]=w(c*j(n.values,r,f),f===s?2:4))}return{id:n.id,kind:n.kind,name:n.name,values:o}})}function ze(e,t,i="desktop"){return e.map(n=>{const o=n.values,r={...o};for(const c of T)delete r[k("lineSpacing",c)],delete r[k("letterSpacing",c)];const s={id:n.id,kind:n.kind,name:n.name,values:b(r)},l={...s.values},d=t({...s,values:{...s.values}});for(const c of T){const f=o[k("lineSpacing",c)],u=o[k("letterSpacing",c)];if(typeof f=="number"&&(l[C("lineHeight",c)]=w(f/100,3)),typeof u=="number"){const h=j(s.values,d,oe(c,i));l[C("letterSpacing",c)]=h?w(u/h,4):0}}return{...s,values:b(l)}})}function Fe(e){const t={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0}),sizes:Q({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:E(e.heading_compression),typography:be(e)},i=e.text_styles??null,n=Array.isArray(i)?se(R(i,t),t):t;return{fonts:U(n.fonts),sizes:Q(n.sizes),compression:E(n.compression),typography:n.typography,textStyles:i}}function se(e,t){const i=h=>e.find(a=>a.id===h)?.values??{},n=i("heading-1"),o=i("heading-2"),r=i("heading-3"),s=i("body-1"),l=i("body-5"),d=t.fonts,c=t.sizes,f=t.typography,u=h=>h==="none"?"sentence":"authored";return{fonts:{...d,heading:n.font??d.heading,heading2:o.font??n.font??d.heading2,heading3:r.font??n.font??d.heading3,body:s.font??d.body,label:l.font??d.label},sizes:{...c,headingLarge:n.size??null,headingMedium:o.size??null,headingSmall:r.size??null,body:s.size??null,label:l.size??null},compression:t.compression,typography:{...f,case:u(n.letterCase),weight:n.weight??null,maxPx:n.largestSize??null,weight2:o.weight??null,weight3:r.weight??null,case2:u(o.letterCase),case3:u(r.letterCase)}}}function De(e){const t=I(e.textStyles);if(!t||t.every(o=>Object.keys(o.values).length===0&&!o.auto))return e;const i={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},n=se(R(t,i),i);return{...e,fonts:n.fonts,sizes:n.sizes,headingCompression:n.compression,headingTypography:n.typography}}function ve(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":pe(e)===e.toLowerCase()?e:null}function Ke(e){const t=[];for(const i of e){const n=i.values,o=`.${q(i)}`,r=`[${me}="${i.id}"]`,s=`${o}, ${r}`,l=[],d=n.font!==void 0?fe.find(h=>h.key===n.font)?.cssVar:void 0;if(d&&l.push(`font-family: var(${d})`),n.size!==void 0){const h=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;l.push(`font-size: ${h}px`)}const c=n.color!==void 0?ve(n.color):null;c&&l.push(`color: ${c}`),n.italic===!0&&l.push("font-style: italic"),n.weight!==void 0&&l.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),i.kind==="body"&&l.push(...f);const u=re(n.letterCase);u&&i.kind==="body"&&l.push(`text-transform: ${u}`),n.paragraphSpacing&&l.push(`--sf-part-para: ${n.paragraphSpacing}px`),l.length&&t.push(`${s} { ${l.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${s}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&u&&t.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${u} }`),n.paragraphSpacing&&(t.push(`*:has(> ${r}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...Z(`:is(${s})`,`*:has(> ${r})`))),t.push(...$e(i,s,o,r))}return t.join(`
2
+ `)}function $e(e,t,i,n){const o=e.values,r=H("textSize",o.size,o.sizeTablet,o.sizePhone),s=H("textSize",o.largestSize,o.largestSizeTablet,o.largestSizePhone),l=H("same",o.lineHeight,o.lineHeightTablet,o.lineHeightPhone),d=H("same",o.letterSpacing,o.letterSpacingTablet,o.letterSpacingPhone),c=H("spacing",o.paragraphSpacing,o.paragraphSpacingTablet,o.paragraphSpacingPhone),f=B("textSize",o.size,o.sizeTablet,o.sizePhone,X()),u=_e[e.id],h=[];for(const[a,S]of[["tablet",ge],["phone",ue]]){const g=[],p=[],x=f[a],y=s[a],_=r[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];l[a]!==void 0&&z.push(`line-height: ${l[a]}`),d[a]!==void 0&&z.push(`letter-spacing: ${d[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&g.push(`${t} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&g.push(`${t}, ${i}:is(h1, h2, h3, h4), ${n}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&g.push(`*:has(> ${n}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!o.paragraphSpacing&&g.push(...Z(`:is(${t})`,`*:has(> ${n})`)),_!==void 0&&u&&g.push(`.sf-themed-content { --size-${u}: ${_}px !important }`),g.length&&h.push(`@media ${S} { ${g.join(" ")} }`)}return h}const _e={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function We(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?he[e]:void 0}function ke(e){const t=Se(e);return b({font:e.font,color:e.color,size:e.size,weight:e.weight,italic:e.italic,lineHeight:t.lineHeight,letterSpacing:t.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function Je(e){return Object.keys(ke(e)).length>0}function Ye({saved:e,old:t,styleId:i,values:n}){const o=te(e);return{saved:Te(o,i,n),old:t}}function Te(e,t,i){return e.map(n=>n.id===t?M({...n,values:b({...n.values,...i})},n.auto):n)}function Be(e){const t=e.filter(i=>i.kind==="body").map(i=>Number(/^body-(\d+)$/.exec(i.id)?.[1])).filter(i=>Number.isInteger(i)&&i>0);return t.length?`body-${Math.max(...t)}`:"body-1"}export{We as accentItalicCss,Ve as applyListChange,Be as eyebrowStyleId,q as faceClassOf,ze as fromPanelStyles,Je as hasStyleChange,Me as listChangePatch,te as listToWrite,ke as partStyleToTextStyleValues,Ye as pushIntoStyle,R as resolveTextStyles,Te as setStyleValues,Fe as siteTextFromRow,je as storedTextStyles,Ge as styleIdOfRole,Ke as textStylesCss,ne as textStylesFromOld,se as textStylesToOld,De as themeWithTextStyles,Re as toPanelStyles,j as viewSizeOf};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "47.2.0",
3
+ "version": "48.0.0",
4
4
  "description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@tabler/icons-react": "^3.46.0",
56
- "efficient-easel": "^26.7.0",
56
+ "efficient-easel": "^27.0.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": "^26.12.0",
75
+ "efficient-easel": "^27.0.0",
76
76
  "efficient-shell": "^11.8.0",
77
77
  "esbuild": "^0.28.0",
78
78
  "happy-dom": "^20.14.5",
@@ -1,2 +0,0 @@
1
- import { useSelectedFields } from "efficient-easel/easel";
2
- export declare function useSelectedHost(): ReturnType<typeof useSelectedFields> | null;
@@ -1 +0,0 @@
1
- import{useSelectedFields as e}from"efficient-easel/easel";function r(){try{return e()}catch{return null}}export{r as useSelectedHost};