efficient-web-builder 43.0.0 → 44.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 (65) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/editor/components/CanvasPartsBridge.d.ts +1 -0
  3. package/dist/editor/components/CanvasPartsBridge.js +1 -1
  4. package/dist/editor/components/PreviewPartAnchors.js +1 -1
  5. package/dist/editor/components/PreviewThemeFrame.d.ts +1 -1
  6. package/dist/editor/components/PreviewThemeFrame.js +3 -19
  7. package/dist/editor/components/SectionTextPartBridge.js +1 -1
  8. package/dist/editor/components/StandaloneSectionEditor.js +1 -1
  9. package/dist/editor/components/StorefrontEditor.js +1 -1
  10. package/dist/editor/components/storefront-editor.css +16 -77
  11. package/dist/editor/lib/document/MarkupToolbar.d.ts +6 -2
  12. package/dist/editor/lib/document/MarkupToolbar.js +1 -1
  13. package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
  14. package/dist/editor/lib/document/controls.d.ts +1 -0
  15. package/dist/editor/lib/document/controls.js +1 -1
  16. package/dist/editor/lib/document/field-groups.js +1 -1
  17. package/dist/editor/lib/document/overrides.js +1 -1
  18. package/dist/editor/lib/document/part-anchors.d.ts +7 -0
  19. package/dist/editor/lib/document/part-anchors.js +1 -1
  20. package/dist/format/lib/editor-words-catalogue.d.ts +0 -1
  21. package/dist/format/lib/editor-words-catalogue.js +1 -1
  22. package/dist/format/lib/markup.d.ts +1 -0
  23. package/dist/format/lib/markup.js +2 -2
  24. package/dist/format/lib/popup/rules.d.ts +1 -1
  25. package/dist/format/lib/popup/rules.js +1 -1
  26. package/dist/render/components/BlockFrame.d.ts +1 -1
  27. package/dist/render/components/Btn.js +1 -1
  28. package/dist/render/components/ButtonBlock.js +1 -1
  29. package/dist/render/components/ContactLocations.js +3 -45
  30. package/dist/render/components/Divider.d.ts +1 -1
  31. package/dist/render/components/Divider.js +1 -1
  32. package/dist/render/components/Flex.d.ts +3 -9
  33. package/dist/render/components/Flex.js +1 -1
  34. package/dist/render/components/Heading.d.ts +1 -1
  35. package/dist/render/components/HeroGroup.d.ts +3 -9
  36. package/dist/render/components/HeroGroup.js +1 -1
  37. package/dist/render/components/HeroSection.js +1 -11
  38. package/dist/render/components/HeroSingle.js +1 -11
  39. package/dist/render/components/PreviewTickerContext.d.ts +3 -0
  40. package/dist/render/components/PreviewTickerContext.js +1 -1
  41. package/dist/render/components/SiteGutterFrame.d.ts +1 -1
  42. package/dist/render/components/SiteGutterFrame.js +1 -1
  43. package/dist/render/components/Text.d.ts +1 -1
  44. package/dist/render/lib/content/button-look.js +1 -0
  45. package/dist/{format → render}/lib/content/section-padding.d.ts +23 -5
  46. package/dist/render/lib/content/section-padding.js +1 -0
  47. package/dist/render/lib/content/view-values.d.ts +10 -0
  48. package/dist/render/lib/content/view-values.js +1 -0
  49. package/dist/render/lib/document/blocks/general/Divider/render.js +1 -1
  50. package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
  51. package/dist/render/lib/document/blocks/general/Heading/render.js +1 -1
  52. package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
  53. package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
  54. package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
  55. package/dist/render/lib/document/hero-media-parts.d.ts +2 -2
  56. package/dist/render/lib/document/part-styles.d.ts +0 -1
  57. package/dist/render/lib/document/part-styles.js +2 -2
  58. package/dist/render/lib/document/passes/section-padding.js +1 -1
  59. package/dist/render/lib/document/text-parts.d.ts +0 -2
  60. package/dist/render/lib/document/text-parts.js +1 -1
  61. package/dist/render/lib/text-styles/site-text-styles.js +2 -2
  62. package/package.json +1 -1
  63. package/dist/format/lib/content/button-look.js +0 -1
  64. package/dist/format/lib/content/section-padding.js +0 -1
  65. /package/dist/{format → render}/lib/content/button-look.d.ts +0 -0
@@ -1,11 +1 @@
1
- "use client";import{jsx as c,jsxs as R}from"react/jsx-runtime";import{useCallback as f,useEffect as h,useId as Oe,useRef as l,useState as k}from"react";import{markOverlayPortal as N}from"../../format/lib/document/overlay-portal.js";import Ce from"./Ticker.js";import{HeroSlideStyleContext as He}from"./HeroSlide.js";import Le from"./HeroArrows.js";import Ae from"./Reel.js";import{usePreviewTicker as Ne}from"./PreviewTickerContext.js";import{useReducedMotion as Ie}from"./useReducedMotion.js";import{CANVAS_ACCENT as Z}from"../../format/lib/canvas-accent.js";import{hasSectionHeight as Me,resolveSectionHeight as ee}from"../../format/lib/content/section-height.js";import{HEADER_HEIGHT_CSS as Pe}from"../lib/document/header-clearance.js";import{nextReel as De,normaliseHeroReelShape as Ve,reelShown as $e}from"../../format/lib/reel.js";import{arrowsShown as ze,arrowStep as Xe}from"../../format/lib/hero-arrows.js";import{swipeEnabled as Be,swipeStep as Ge}from"../../format/lib/hero-swipe.js";import{videoControlShown as je,videoHeld as Ye}from"../../format/lib/hero-video-control.js";import{HERO_SLIDER_GOTO_EVENT as I}from"efficient-easel/draw";import{say as te}from"../../format/lib/editor-words.js";import{markedChildren as re}from"../../format/lib/marked-children.js";import{DEFAULT_TICKER_ITEMS as qe}from"../../format/lib/hero-ticker.js";const Fe=`
2
- .hero-ticker-pick { cursor: pointer; }
3
- .hero-ticker-pick:hover {
4
- outline: 2px solid color-mix(in srgb, ${Z} 45%, transparent);
5
- outline-offset: -2px;
6
- }
7
- .hero-ticker-pick[data-selected] {
8
- outline: 2px solid ${Z};
9
- outline-offset: -2px;
10
- }
11
- `,Ke="Play video",Ue="Hold video",Je="flex h-7 cursor-pointer items-center gap-1.5 rounded-full border border-overlay-chrome/25 bg-overlay-scrim/80 px-[11px] font-mono text-[11px] leading-none tracking-[0.05em] text-overlay-fg",Qe=()=>te("item"),oe=new Map;function We(T,w){const p=T?.ownerDocument?.defaultView;if(p)return p.addEventListener(I,w),()=>p.removeEventListener(I,w)}function Ze({slides:T,alignment:w,textureOpacity:p,showTexture:ne,textureColor:se,phoneUpDown:ce,phoneSideways:ae,autoplay:M,autoplayInterval:O,showTicker:le,tickerItems:ie,heightDesktop:P,heightMobile:D,showPicker:ue,pickerShape:de,pickerPlacement:me,showArrows:fe,arrowsShape:he,arrowsPlacement:pe,editing:n}){const V=Me(P,D),ve=V?"h-[var(--sf-hero-h-m)] min-[720px]:h-[var(--sf-hero-h-d)]":"h-screen min-h-[680px]",be=V?{"--sf-hero-h-d":ee(P),"--sf-hero-h-m":ee(D)}:void 0,C=(ie??qe.map(e=>({text:e}))).map(e=>e?.text?.trim()?e.text:n?Qe():"").filter(Boolean),$=le!==!1,u=l(null),z=l(null),X=l(null),B=l(null),G=l(null),j=Oe(),E=l(j),[y,xe]=k([]),[ke,Y]=k(0),v=l(0),[q,F]=k(!1),[g,we]=k(!1),[K,Ee]=k(null),H=Ie(),{selectedHeroId:ye,select:U}=Ne(),S=f(()=>u.current?.querySelector(".hero-track")??null,[]),i=f((e,t=!1)=>{Y(e),v.current=e,oe.set(E.current,e);const r=u.current?.querySelector(".hero-track");if(r)if(t){const o=r.style.transition;r.style.transition="none",r.style.transform=`translateX(-${Math.max(0,e)*100}%)`,r.offsetHeight,r.style.transition=o}else r.style.transform=`translateX(-${Math.max(0,e)*100}%)`},[]);h(()=>{const e=u.current,t=e?.getAttribute("data-easel-block")||e?.closest("[data-easel-block]")?.getAttribute("data-easel-block")||j;E.current=t,Ee(t);const r=oe.get(t);typeof r=="number"&&(Y(r),v.current=r)},[]),h(()=>{const e=S();if(!e)return;const t=()=>{xe(o=>De(o,re(e,"data-slide-name")))};t();const r=new MutationObserver(t);return r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-slide-name","data-slide-process","data-slide-media"]}),()=>{r.disconnect()}},[S]),h(()=>{if(!n)return;const e=t=>{const r=t.detail;if(!r||typeof r.index!="number")return;const o=u.current,a=o?.getAttribute("data-easel-block")||o?.closest("[data-easel-block]")?.getAttribute("data-easel-block")||E.current;r.id&&r.id!==a||i(r.index,!0)};return We(u.current,e)},[n,i]);const s=y.length,d=Math.min(Math.max(ke,0),Math.max(0,s-1)),L=$e({shown:ue,count:s}),J=ze({shown:fe,count:s}),Q=je({editing:n,shown:d,slides:y}),ge=Ye({editing:n,playing:g,controlShown:Q}),_=Be({count:s,editing:n}),m=l(null),b=l(null),Se=f(e=>{if(m.current=null,b.current=null,!_||e.touches.length!==1)return;const t=e.touches[0];m.current={x:t.clientX,y:t.clientY},b.current={x:t.clientX,y:t.clientY}},[_]),_e=f(e=>{if(!m.current)return;if(e.touches.length!==1){m.current=null;return}const t=e.touches[0];b.current={x:t.clientX,y:t.clientY}},[]),Re=f(()=>{const e=m.current,t=b.current;if(m.current=null,b.current=null,!_||!e||!t)return;const r=Ge(t.x-e.x,t.y-e.y,v.current,s);r!==v.current&&i(r)},[_,s,i]);h(()=>{if(n||!M||q||H||s<=1)return;const t=Math.max(1,typeof O=="number"?O:6)*1e3,r=window.setTimeout(()=>i((d+1)%s),t);return()=>window.clearTimeout(r)},[n,M,O,q,H,s,d,i]),h(()=>{const e=[z.current,X.current,B.current].filter(Boolean),t=e.map(o=>N(o)),r=o=>{const a=o.target,x=a.closest("[data-hero-nav]"),W=x??a.closest("[data-idx]");if(!W)return;o.stopPropagation(),o.preventDefault();const A=x?Xe(x.dataset.heroNav,v.current,s):Number(W.dataset.idx);Number.isNaN(A)||(i(A,n),re(S(),"data-slide-name")[A]?.click())};return e.forEach(o=>o.addEventListener("click",r,{capture:!0})),()=>{t.forEach(o=>o?.()),e.forEach(o=>o.removeEventListener("click",r,{capture:!0}))}},[s,i,S,n]),h(()=>{if(!n)return;const e=G.current;if(!e)return;const t=N(e),r=o=>{o.stopPropagation(),o.preventDefault();const a=u.current,x=a?.getAttribute("data-easel-block")||a?.closest("[data-easel-block]")?.getAttribute("data-easel-block")||E.current;U(x)};return e.addEventListener("click",r,{capture:!0}),()=>{t?.(),e.removeEventListener("click",r,{capture:!0})}},[n,U,$,C.length]);const Te=f(e=>{if(!e)return;const t=N(e),r=o=>{o.stopPropagation(),o.preventDefault(),we(a=>!a)};return e.addEventListener("click",r,{capture:!0}),()=>{t?.(),e.removeEventListener("click",r,{capture:!0})}},[]);return c(He.Provider,{value:{alignment:w,textureOpacity:p,textureOn:ne,textureColor:se,quietVideo:ge,phoneUpDown:ce,phoneSideways:ae},children:R("div",{ref:u,className:`relative mx-[var(--sf-hero-bleed-m,calc(50%_-_50vw))] w-[var(--sf-hero-bleed-w,100vw)] ${ve} max-w-[var(--sf-hero-cap,none)] overflow-hidden`,style:be,onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),onTouchStart:Se,onTouchMove:_e,onTouchEnd:Re,children:[c(T,{className:"hero-track flex h-full [&>*]:h-full [&>*]:min-w-full [&>*]:shrink-0 [&>*]:basis-full",style:{transform:`translateX(-${d*100}%)`,transition:H?"none":"transform 600ms cubic-bezier(.22,.61,.36,1)"},minEmptyHeight:400}),Q&&c("div",{ref:Te,"data-hero-video-control":g?"playing":"held",className:"sf-hero-video-control absolute left-6 z-[7]",style:{top:`calc(${Pe} + 16px)`},children:R("button",{type:"button",className:Je,children:[c("span",{"aria-hidden":"true",children:g?"❚❚":"▶"}),te(g?Ue:Ke)]})}),(L||J)&&R("div",{className:"pointer-events-none absolute inset-y-0 left-[var(--sf-hero-chrome-x,var(--sf-site-gutter,40px))] right-[var(--sf-hero-chrome-x,var(--sf-site-gutter,40px))] z-[6] mx-auto max-w-[var(--sf-hero-chrome-cap,calc(var(--sf-site-width,1600px)_-_var(--sf-site-gutter,40px)*2))]",children:[L&&c(Ae,{ref:z,slides:y,active:d,shape:Ve(de),placement:me}),J&&c(Le,{ref:B,shape:he,placement:pe})]}),L&&c("div",{ref:X,className:"sf-hero-phone-dots absolute bottom-[80px] left-1/2 z-[6] hidden -translate-x-1/2 items-center gap-2",children:y.map((e,t)=>c("button",{type:"button","data-idx":t,"aria-label":`Go to slide ${t+1}`,className:`h-2 rounded-full transition-all motion-reduce:transition-none ${t===d?"w-5 bg-accent":"w-2 bg-white/45 hover:bg-white/70"}`},t))}),$&&C.length>0&&R("div",{ref:G,className:`sf-hero-ticker absolute inset-x-0 bottom-0 z-[5] border-t border-overlay-chrome/10 py-3.5${n?" hero-ticker-pick":""}`,"data-selected":n&&K!=null&&ye===K?"":void 0,style:{background:"rgba(10,10,10,.55)"},children:[n&&c("style",{children:Fe}),c(Ce,{items:C,backdrop:"dark-media"})]})]})})}export{I as HERO_SLIDER_GOTO_EVENT,Ue as HERO_VIDEO_HOLD_LABEL,Ke as HERO_VIDEO_PLAY_LABEL,Ze as default,We as subscribeSliderGoto};
1
+ "use client";import{jsx as c,jsxs as A}from"react/jsx-runtime";import{useCallback as f,useEffect as b,useId as ke,useRef as i,useState as g}from"react";import{markOverlayPortal as K}from"../../format/lib/document/overlay-portal.js";import ge from"./Ticker.js";import{HeroSlideStyleContext as _e}from"./HeroSlide.js";import Se from"./HeroArrows.js";import Re from"./Reel.js";import{TICKER_PART_ATTR as Te}from"./PreviewTickerContext.js";import{useReducedMotion as Oe}from"./useReducedMotion.js";import{hasSectionHeight as He,resolveSectionHeight as U}from"../../format/lib/content/section-height.js";import{HEADER_HEIGHT_CSS as Le}from"../lib/document/header-clearance.js";import{nextReel as Ae,normaliseHeroReelShape as Ne,reelShown as Ce}from"../../format/lib/reel.js";import{arrowsShown as Me,arrowStep as Pe}from"../../format/lib/hero-arrows.js";import{swipeEnabled as De,swipeStep as Ie}from"../../format/lib/hero-swipe.js";import{videoControlShown as Ve,videoHeld as $e}from"../../format/lib/hero-video-control.js";import{HERO_SLIDER_GOTO_EVENT as N}from"efficient-easel/draw";import{say as J}from"../../format/lib/editor-words.js";import{markedChildren as Q}from"../../format/lib/marked-children.js";import{DEFAULT_TICKER_ITEMS as ze}from"../../format/lib/hero-ticker.js";const Xe="Play video",Ge="Hold video",je="flex h-7 cursor-pointer items-center gap-1.5 rounded-full border border-overlay-chrome/25 bg-overlay-scrim/80 px-[11px] font-mono text-[11px] leading-none tracking-[0.05em] text-overlay-fg",Be=()=>J("item"),W=new Map;function Ye(_,x){const h=_?.ownerDocument?.defaultView;if(h)return h.addEventListener(N,x),()=>h.removeEventListener(N,x)}function qe({slides:_,alignment:x,textureOpacity:h,showTexture:Z,textureColor:ee,phoneUpDown:te,phoneSideways:re,autoplay:C,autoplayInterval:S,showTicker:oe,tickerItems:ne,heightDesktop:M,heightMobile:P,showPicker:se,pickerShape:ce,pickerPlacement:ae,showArrows:ie,arrowsShape:le,arrowsPlacement:ue,editing:n}){const D=He(M,P),de=D?"h-[var(--sf-hero-h-m)] min-[720px]:h-[var(--sf-hero-h-d)]":"h-screen min-h-[680px]",me=D?{"--sf-hero-h-d":U(M),"--sf-hero-h-m":U(P)}:void 0,I=(ne??ze.map(e=>({text:e}))).map(e=>e?.text?.trim()?e.text:n?Be():"").filter(Boolean),fe=oe!==!1,l=i(null),V=i(null),$=i(null),z=i(null),X=ke(),R=i(X),[w,he]=g([]),[pe,G]=g(0),p=i(0),[j,B]=g(!1),[y,ve]=g(!1),T=Oe(),E=f(()=>l.current?.querySelector(".hero-track")??null,[]),a=f((e,t=!1)=>{G(e),p.current=e,W.set(R.current,e);const r=l.current?.querySelector(".hero-track");if(r)if(t){const o=r.style.transition;r.style.transition="none",r.style.transform=`translateX(-${Math.max(0,e)*100}%)`,r.offsetHeight,r.style.transition=o}else r.style.transform=`translateX(-${Math.max(0,e)*100}%)`},[]);b(()=>{const e=l.current,t=e?.getAttribute("data-easel-block")||e?.closest("[data-easel-block]")?.getAttribute("data-easel-block")||X;R.current=t;const r=W.get(t);typeof r=="number"&&(G(r),p.current=r)},[]),b(()=>{const e=E();if(!e)return;const t=()=>{he(o=>Ae(o,Q(e,"data-slide-name")))};t();const r=new MutationObserver(t);return r.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-slide-name","data-slide-process","data-slide-media"]}),()=>{r.disconnect()}},[E]),b(()=>{if(!n)return;const e=t=>{const r=t.detail;if(!r||typeof r.index!="number")return;const o=l.current,m=o?.getAttribute("data-easel-block")||o?.closest("[data-easel-block]")?.getAttribute("data-easel-block")||R.current;r.id&&r.id!==m||a(r.index,!0)};return Ye(l.current,e)},[n,a]);const s=w.length,u=Math.min(Math.max(pe,0),Math.max(0,s-1)),O=Ce({shown:se,count:s}),Y=Me({shown:ie,count:s}),q=Ve({editing:n,shown:u,slides:w}),be=$e({editing:n,playing:y,controlShown:q}),k=De({count:s,editing:n}),d=i(null),v=i(null),xe=f(e=>{if(d.current=null,v.current=null,!k||e.touches.length!==1)return;const t=e.touches[0];d.current={x:t.clientX,y:t.clientY},v.current={x:t.clientX,y:t.clientY}},[k]),we=f(e=>{if(!d.current)return;if(e.touches.length!==1){d.current=null;return}const t=e.touches[0];v.current={x:t.clientX,y:t.clientY}},[]),ye=f(()=>{const e=d.current,t=v.current;if(d.current=null,v.current=null,!k||!e||!t)return;const r=Ie(t.x-e.x,t.y-e.y,p.current,s);r!==p.current&&a(r)},[k,s,a]);b(()=>{if(n||!C||j||T||s<=1)return;const t=Math.max(1,typeof S=="number"?S:6)*1e3,r=window.setTimeout(()=>a((u+1)%s),t);return()=>window.clearTimeout(r)},[n,C,S,j,T,s,u,a]),b(()=>{const e=[V.current,$.current,z.current].filter(Boolean),t=e.map(o=>K(o)),r=o=>{const m=o.target,H=m.closest("[data-hero-nav]"),F=H??m.closest("[data-idx]");if(!F)return;o.stopPropagation(),o.preventDefault();const L=H?Pe(H.dataset.heroNav,p.current,s):Number(F.dataset.idx);Number.isNaN(L)||(a(L,n),Q(E(),"data-slide-name")[L]?.click())};return e.forEach(o=>o.addEventListener("click",r,{capture:!0})),()=>{t.forEach(o=>o?.()),e.forEach(o=>o.removeEventListener("click",r,{capture:!0}))}},[s,a,E,n]);const Ee=f(e=>{if(!e)return;const t=K(e),r=o=>{o.stopPropagation(),o.preventDefault(),ve(m=>!m)};return e.addEventListener("click",r,{capture:!0}),()=>{t?.(),e.removeEventListener("click",r,{capture:!0})}},[]);return c(_e.Provider,{value:{alignment:x,textureOpacity:h,textureOn:Z,textureColor:ee,quietVideo:be,phoneUpDown:te,phoneSideways:re},children:A("div",{ref:l,className:`relative mx-[var(--sf-hero-bleed-m,calc(50%_-_50vw))] w-[var(--sf-hero-bleed-w,100vw)] ${de} max-w-[var(--sf-hero-cap,none)] overflow-hidden`,style:me,onMouseEnter:()=>B(!0),onMouseLeave:()=>B(!1),onTouchStart:xe,onTouchMove:we,onTouchEnd:ye,children:[c(_,{className:"hero-track flex h-full [&>*]:h-full [&>*]:min-w-full [&>*]:shrink-0 [&>*]:basis-full",style:{transform:`translateX(-${u*100}%)`,transition:T?"none":"transform 600ms cubic-bezier(.22,.61,.36,1)"},minEmptyHeight:400}),q&&c("div",{ref:Ee,"data-hero-video-control":y?"playing":"held",className:"sf-hero-video-control absolute left-6 z-[7]",style:{top:`calc(${Le} + 16px)`},children:A("button",{type:"button",className:je,children:[c("span",{"aria-hidden":"true",children:y?"❚❚":"▶"}),J(y?Ge:Xe)]})}),(O||Y)&&A("div",{className:"pointer-events-none absolute inset-y-0 left-[var(--sf-hero-chrome-x,var(--sf-site-gutter,40px))] right-[var(--sf-hero-chrome-x,var(--sf-site-gutter,40px))] z-[6] mx-auto max-w-[var(--sf-hero-chrome-cap,calc(var(--sf-site-width,1600px)_-_var(--sf-site-gutter,40px)*2))]",children:[O&&c(Re,{ref:V,slides:w,active:u,shape:Ne(ce),placement:ae}),Y&&c(Se,{ref:z,shape:le,placement:ue})]}),O&&c("div",{ref:$,className:"sf-hero-phone-dots absolute bottom-[80px] left-1/2 z-[6] hidden -translate-x-1/2 items-center gap-2",children:w.map((e,t)=>c("button",{type:"button","data-idx":t,"aria-label":`Go to slide ${t+1}`,className:`h-2 rounded-full transition-all motion-reduce:transition-none ${t===u?"w-5 bg-accent":"w-2 bg-white/45 hover:bg-white/70"}`},t))}),fe&&I.length>0&&c("div",{className:"sf-hero-ticker absolute inset-x-0 bottom-0 z-[5] border-t border-overlay-chrome/10 py-3.5",...n?{[Te]:""}:{},style:{background:"rgba(10,10,10,.55)"},children:c(ge,{items:I,backdrop:"dark-media"})})]})})}export{N as HERO_SLIDER_GOTO_EVENT,Ge as HERO_VIDEO_HOLD_LABEL,Xe as HERO_VIDEO_PLAY_LABEL,qe as default,Ye as subscribeSliderGoto};
@@ -1,11 +1 @@
1
- "use client";import{jsx as e,jsxs as p}from"react/jsx-runtime";import{useEffect as Z,useRef as C,useState as $}from"react";import I from"./HeroPoster.js";import{HeroVideoBackdrop as ee,HeroVideoPlayer as oe}from"./HeroVideoPlay.js";import{resolveMedia as l}from"../lib/media.js";import{hasSectionHeight as re,resolveSectionHeight as z}from"../../format/lib/content/section-height.js";import{DEFAULT_OVERLAY_COLOR as te,DEFAULT_OVERLAY_POSITION as se,overlayGradient as ne}from"../../format/lib/sections/hero-overlay.js";import{ON_MEDIA_INK_STYLE as ie}from"../../format/lib/content/ink.js";import{usePreviewHeroPart as ae}from"./PreviewHeroPartContext.js";import{CANVAS_ACCENT as M}from"../../format/lib/canvas-accent.js";import{HERO_PART_ATTR as ce,heroPartId as le,readHeroPartId as de}from"../lib/document/hero-media-parts.js";import{markOverlayPortal as me}from"../../format/lib/document/overlay-portal.js";import{hidableText as pe}from"efficient-easel/draw";import{normaliseVideoPlayback as ue,normaliseVideoSource as fe,parseYouTubeId as he}from"../../format/lib/hero-video.js";import{heroPictureCount as xe,normaliseMediaLayout as ve,resolvePhoneLayout as be}from"../../format/lib/hero-media-layout.js";const D=`
2
- .hero-part-pick { cursor: pointer; }
3
- .hero-part-pick:hover {
4
- outline: 2px solid color-mix(in srgb, ${M} 45%, transparent);
5
- outline-offset: -2px;
6
- }
7
- .hero-part-pick[data-selected] {
8
- outline: 2px solid ${M};
9
- outline-offset: -2px;
10
- }
11
- `;function ge({overlay:r=100,overlayColor:o=te,overlayPosition:y=se,mediaType:u="image",mediaSrc:i,poster:f,objectPosition:d,objectPositionPhone:m,tintColor:h="#000000",tintOpacity:n=0,heightDesktop:x,heightMobile:t,boxes:a,videoSource:k,youtubeUrl:v,videoPlayback:b,mediaLayout:T,mediaLayoutPhone:E,mediaImage2:F,objectPosition2:G,objectPosition2Phone:K,tintColor2:U="#000000",tintOpacity2:B=0,editing:s=!1}){const H=re(x,t),q=H?"h-[var(--sf-hero-h-m)] min-[720px]:h-[var(--sf-hero-h-d)]":"h-screen min-h-[680px]",J=H?{"--sf-hero-h-d":z(x),"--sf-hero-h-m":z(t)}:void 0,c=u==="video",A=c?l(i):void 0,R=c?l(f):l(i)??l(f),g=c&&fe(k)==="youtube",w=c&&ue(b)==="click",V=g?he(pe(v)):null,O=c&&!g&&!w,[L,Q]=$(!1),_=!L,W=C(null),X=u==="video"?"media":"image",P=ve(T),N=be(E,P),j=!c&&xe({mediaLayout:T,mediaLayoutPhone:E})>1;return p("section",{ref:W,className:`relative mx-[var(--sf-hero-bleed-m,calc(50%_-_50vw))] w-[var(--sf-hero-bleed-w,100vw)] ${q} max-w-[var(--sf-hero-cap,none)] overflow-hidden`,style:J,children:[j?p("div",{className:`absolute inset-0 z-[1] grid ${Pe[N]} ${ye[P]}`,"data-hero-layout":P,"data-hero-layout-phone":N,children:[s&&e("style",{children:D}),p(S,{part:"image",editing:s,className:"relative overflow-hidden",children:[e(I,{posterSrc:l(i),showVideo:!1,objectPosition:d,objectPositionPhone:m}),e(Y,{color:h,opacity:n})]}),p(S,{part:"image2",editing:s,className:`relative overflow-hidden${N==="one"?" max-[719px]:hidden":""}${P==="one"?" min-[720px]:hidden":""}`,children:[e(I,{posterSrc:l(F),showVideo:!1,objectPosition:G,objectPositionPhone:K}),e(Y,{color:U,opacity:B})]})]}):p(S,{part:X,editing:s,className:"absolute inset-0 z-[1]",children:[s&&e("style",{children:D}),e(I,{videoSrc:O?A:void 0,posterSrc:R,showVideo:O,objectPosition:d,objectPositionPhone:m}),g&&e(ee,{youTubeId:V,ownPoster:!!R,background:!w,editing:s})]}),w&&e(oe,{youTubeId:V,fileSrc:g?void 0:A,playing:L,onPlay:()=>Q(!0),editing:s}),_&&!j&&n>0&&e("div",{className:"pointer-events-none absolute inset-0 z-[2]",style:{background:h,opacity:Math.min(Math.max(n,0),100)/100}}),_&&e("div",{className:"pointer-events-none absolute inset-0 z-[2]",style:{background:ne(o,y),opacity:Math.min(Math.max(r,0),100)/100}}),_&&a&&e("div",{className:["sf-hero-group-layer absolute inset-0 z-[3] mx-auto","max-w-[var(--sf-site-width,1600px)]","px-[var(--sf-site-gutter,40px)] pt-[140px] pb-14",s?"sf-hero-group-layer-edit":""].filter(Boolean).join(" "),style:ie,children:e(a,{className:"sf-hero-group-zone",minEmptyHeight:160})})]})}const Pe={one:"max-[719px]:grid-cols-1 max-[719px]:grid-rows-1",side:"max-[719px]:grid-cols-2 max-[719px]:grid-rows-1",stacked:"max-[719px]:grid-cols-1 max-[719px]:grid-rows-2"},ye={one:"min-[720px]:grid-cols-1 min-[720px]:grid-rows-1",side:"min-[720px]:grid-cols-2 min-[720px]:grid-rows-1",stacked:"min-[720px]:grid-cols-1 min-[720px]:grid-rows-2"};function Y({color:r,opacity:o}){return o>0?e("div",{className:"pointer-events-none absolute inset-0 z-[2]",style:{background:r,opacity:Math.min(Math.max(o,0),100)/100}}):null}function S({part:r,editing:o,className:y,children:u}){const i=C(null),{selectedHeroPart:f,select:d}=ae(),[m,h]=$(null);Z(()=>{if(!o)return;const t=i.current;if(!t)return;const a=t.closest("[data-easel-block]")?.getAttribute("data-easel-block")??null;h(a);const k=me(t),v=b=>{a&&(b.stopPropagation(),b.preventDefault(),d(le(a,r)))};return t.addEventListener("click",v,{capture:!0}),()=>{k(),t.removeEventListener("click",v,{capture:!0})}},[o,r,d]);const n=de(f),x=o&&m!=null&&n?.nodeId===m&&(n.part===r||n.part==="media");return e("div",{ref:i,className:`${y}${o?" hero-part-pick":""}`,...o?{[ce]:r}:{},"data-selected":x?"":void 0,children:u})}export{ge as default};
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useRef as J,useState as Q}from"react";import x from"./HeroPoster.js";import{HeroVideoBackdrop as W,HeroVideoPlayer as X}from"./HeroVideoPlay.js";import{resolveMedia as i}from"../lib/media.js";import{hasSectionHeight as Z,resolveSectionHeight as O}from"../../format/lib/content/section-height.js";import{DEFAULT_OVERLAY_COLOR as ee,DEFAULT_OVERLAY_POSITION as oe,overlayGradient as re}from"../../format/lib/sections/hero-overlay.js";import{ON_MEDIA_INK_STYLE as se}from"../../format/lib/content/ink.js";import{HERO_PART_ATTR as ie}from"../lib/document/hero-media-parts.js";import{hidableText as te}from"efficient-easel/draw";import{normaliseVideoPlayback as ne,normaliseVideoSource as ae,parseYouTubeId as ce}from"../../format/lib/hero-video.js";import{heroPictureCount as le,normaliseMediaLayout as de,resolvePhoneLayout as me}from"../../format/lib/hero-media-layout.js";function pe({overlay:t=100,overlayColor:o=ee,overlayPosition:d=oe,mediaType:a="image",mediaSrc:m,poster:v,objectPosition:b,objectPositionPhone:y,tintColor:w="#000000",tintOpacity:p=0,heightDesktop:P,heightMobile:N,boxes:_,videoSource:A,youtubeUrl:L,videoPlayback:M,mediaLayout:T,mediaLayoutPhone:S,mediaImage2:D,objectPosition2:Y,objectPosition2Phone:$,tintColor2:C="#000000",tintOpacity2:F=0,editing:r=!1}){const k=Z(P,N),G=k?"h-[var(--sf-hero-h-m)] min-[720px]:h-[var(--sf-hero-h-d)]":"h-screen min-h-[680px]",K=k?{"--sf-hero-h-d":O(P),"--sf-hero-h-m":O(N)}:void 0,s=a==="video",H=s?i(m):void 0,V=s?i(v):i(m)??i(v),c=s&&ae(A)==="youtube",u=s&&ne(M)==="click",E=c?ce(te(L)):null,I=s&&!c&&!u,[R,U]=Q(!1),h=!R,B=J(null),q=a==="video"?"media":"image",l=de(T),f=me(S,l),j=!s&&le({mediaLayout:T,mediaLayoutPhone:S})>1;return n("section",{ref:B,className:`relative mx-[var(--sf-hero-bleed-m,calc(50%_-_50vw))] w-[var(--sf-hero-bleed-w,100vw)] ${G} max-w-[var(--sf-hero-cap,none)] overflow-hidden`,style:K,children:[j?n("div",{className:`absolute inset-0 z-[1] grid ${ue[f]} ${he[l]}`,"data-hero-layout":l,"data-hero-layout-phone":f,children:[n(g,{part:"image",editing:r,className:"relative overflow-hidden",children:[e(x,{posterSrc:i(m),showVideo:!1,objectPosition:b,objectPositionPhone:y}),e(z,{color:w,opacity:p})]}),n(g,{part:"image2",editing:r,className:`relative overflow-hidden${f==="one"?" max-[719px]:hidden":""}${l==="one"?" min-[720px]:hidden":""}`,children:[e(x,{posterSrc:i(D),showVideo:!1,objectPosition:Y,objectPositionPhone:$}),e(z,{color:C,opacity:F})]})]}):n(g,{part:q,editing:r,className:"absolute inset-0 z-[1]",children:[e(x,{videoSrc:I?H:void 0,posterSrc:V,showVideo:I,objectPosition:b,objectPositionPhone:y}),c&&e(W,{youTubeId:E,ownPoster:!!V,background:!u,editing:r})]}),u&&e(X,{youTubeId:E,fileSrc:c?void 0:H,playing:R,onPlay:()=>U(!0),editing:r}),h&&!j&&p>0&&e("div",{className:"pointer-events-none absolute inset-0 z-[2]",style:{background:w,opacity:Math.min(Math.max(p,0),100)/100}}),h&&e("div",{className:"pointer-events-none absolute inset-0 z-[2]",style:{background:re(o,d),opacity:Math.min(Math.max(t,0),100)/100}}),h&&_&&e("div",{className:["sf-hero-group-layer absolute inset-0 z-[3] mx-auto","max-w-[var(--sf-site-width,1600px)]","px-[var(--sf-site-gutter,40px)] pt-[140px] pb-14",r?"sf-hero-group-layer-edit":""].filter(Boolean).join(" "),style:se,children:e(_,{className:"sf-hero-group-zone",minEmptyHeight:160})})]})}const ue={one:"max-[719px]:grid-cols-1 max-[719px]:grid-rows-1",side:"max-[719px]:grid-cols-2 max-[719px]:grid-rows-1",stacked:"max-[719px]:grid-cols-1 max-[719px]:grid-rows-2"},he={one:"min-[720px]:grid-cols-1 min-[720px]:grid-rows-1",side:"min-[720px]:grid-cols-2 min-[720px]:grid-rows-1",stacked:"min-[720px]:grid-cols-1 min-[720px]:grid-rows-2"};function z({color:t,opacity:o}){return o>0?e("div",{className:"pointer-events-none absolute inset-0 z-[2]",style:{background:t,opacity:Math.min(Math.max(o,0),100)/100}}):null}function g({part:t,editing:o,className:d,children:a}){return e("div",{className:d,...o?{[ie]:t}:{},children:a})}export{pe as default};
@@ -2,3 +2,6 @@ export declare const TICKER_PART_LABEL = "Scrolling Bar";
2
2
  export declare const PreviewTickerProvider: ({ children }: {
3
3
  children: import("react").ReactNode;
4
4
  }) => import("react").JSX.Element, usePreviewTicker: () => import("efficient-easel/draw/client").PreviewIdSelection<"selectedHeroId">;
5
+ export declare const TICKER_PART_ATTR = "data-sf-hero-ticker";
6
+ export declare function tickerPartId(heroId: string): string;
7
+ export declare function readTickerPartId(id: string | null | undefined): string | null;
@@ -1 +1 @@
1
- "use client";import{createPreviewSelectionContext as e}from"efficient-easel/draw/client";const o="Scrolling Bar",{Provider:i,useSelection:t}=e("selectedHeroId");export{i as PreviewTickerProvider,o as TICKER_PART_LABEL,t as usePreviewTicker};
1
+ "use client";import{createPreviewSelectionContext as r}from"efficient-easel/draw/client";const c="Scrolling Bar",{Provider:i,useSelection:n}=r("selectedHeroId"),l="data-sf-hero-ticker";function s(e){return`${e}::ticker`}function u(e){return!e||!e.endsWith("::ticker")?null:e.slice(0,-8)||null}export{i as PreviewTickerProvider,l as TICKER_PART_ATTR,c as TICKER_PART_LABEL,u as readTickerPartId,s as tickerPartId,n as usePreviewTicker};
@@ -1,5 +1,5 @@
1
1
  import { type CSSProperties, type ReactNode } from "react";
2
- import { type PadValues } from "../../format/lib/content/section-padding.js";
2
+ import { type PadValues } from "../lib/content/section-padding.js";
3
3
  export declare function SplitBandAndColumn({ children }: {
4
4
  children?: ReactNode;
5
5
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as t}from"react/jsx-runtime";import{createContext as h,useContext as N}from"react";import{rootPadAttrs as j,wrapperPadAttrs as I}from"../../format/lib/content/section-padding.js";import{SECTION_BORDER_CLASS as w,SECTION_BORDER_SELF_CLASS as A}from"../../format/lib/content/borders.js";import{drawsSiteGutter as G}from"../../format/lib/content/site-gutter.js";const y=h(!1),d=h(!1);function b({children:o}){return t(d.Provider,{value:!0,children:o})}function L({contained:o,framedClass:O,fillClass:x,columnClass:R,style:m,tabLabel:_,pad:e,border:s,outerAttrs:r,children:f}){const B=N(y),v=N(d),a=G(o,B),n=a&&!v,i=e&&!n?j(e.values,e.frame):null,c=s&&!n?s:null,E=[n?O:x,i?.className,c?A:null].filter(Boolean).join(" "),P=i||c?{...m,...i?.style,...c}:m,u=a?t(y.Provider,{value:!0,children:f}):f,l=e&&n?I(e.values):null,S=r&&Object.keys(r).length>0?r:null,p=t("div",{...l?null:S,className:E,style:P,"data-tab-label":_,children:v?t(d.Provider,{value:!1,children:a?t("div",{className:R,children:u}):u}):u}),C=l?t("div",{...S,className:l.className,style:l.style,children:p}):p;return s&&n?t("div",{className:w,style:{display:"contents",...s},children:C}):C}export{b as SplitBandAndColumn,L as default};
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import{createContext as h,useContext as N}from"react";import{rootPadAttrs as j,wrapperPadAttrs as I}from"../lib/content/section-padding.js";import{SECTION_BORDER_CLASS as w,SECTION_BORDER_SELF_CLASS as A}from"../../format/lib/content/borders.js";import{drawsSiteGutter as G}from"../../format/lib/content/site-gutter.js";const y=h(!1),d=h(!1);function b({children:o}){return t(d.Provider,{value:!0,children:o})}function L({contained:o,framedClass:O,fillClass:x,columnClass:R,style:m,tabLabel:_,pad:e,border:s,outerAttrs:r,children:f}){const B=N(y),v=N(d),a=G(o,B),n=a&&!v,i=e&&!n?j(e.values,e.frame):null,c=s&&!n?s:null,E=[n?O:x,i?.className,c?A:null].filter(Boolean).join(" "),P=i||c?{...m,...i?.style,...c}:m,u=a?t(y.Provider,{value:!0,children:f}):f,l=e&&n?I(e.values):null,S=r&&Object.keys(r).length>0?r:null,p=t("div",{...l?null:S,className:E,style:P,"data-tab-label":_,children:v?t(d.Provider,{value:!1,children:a?t("div",{className:R,children:u}):u}):u}),C=l?t("div",{...S,className:l.className,style:l.style,children:p}):p;return s&&n?t("div",{className:w,style:{display:"contents",...s},children:C}):C}export{b as SplitBandAndColumn,L as default};
@@ -1,4 +1,4 @@
1
- import type { PadValues } from "../../format/lib/content/section-padding.js";
1
+ import type { PadValues } from "../lib/content/section-padding.js";
2
2
  import type { BlockAlign as Align } from "../../format/lib/content/block-align.js";
3
3
  type Tone = "default" | "dim";
4
4
  interface TextProps {
@@ -0,0 +1 @@
1
+ import{finiteNumber as s}from"../../../format/lib/finite-number.js";import{nonEmptyString as c}from"../../../format/lib/non-empty-string.js";import{padSideAttrs as g}from"./section-padding.js";const i={top:"buttonPaddingTop",right:"buttonPaddingRight",bottom:"buttonPaddingBottom",left:"buttonPaddingLeft"},y="px-6 py-4",x=4,d=t=>{const o=new RegExp(`\\bp${t}-(?:\\[(\\d+)px\\]|(\\d+))`).exec(y);if(!o)throw new Error(`BUTTON_PAD_CLASSES has no p${t}`);return o[1]!==void 0?Number(o[1]):Number(o[2])*x},B={top:d("y"),right:d("x"),bottom:d("y"),left:d("x")},b="var(--btn)",T=t=>t&&typeof t=="object"&&(s(t.width)!==void 0||c(t.color))?t:void 0,P=t=>Math.round(Math.min(Math.max(t,0),100));function S(t){const o=t.variant==="ghost",n=s(t.buttonFillOpacity),r=T(t.buttonBorder),e=c(t.buttonColor);return{fillOpacity:n!==void 0?P(n):o?0:100,border:{width:s(r?.width)??1,color:c(r?.color)??e??(o?"currentColor":b)},changed:n!==void 0||r!==void 0}}function $(t){const o=S(t);if(!o.changed)return null;const n=c(t.buttonColor)??b;return{background:o.fillOpacity===0?"transparent":o.fillOpacity===100?n:`color-mix(in srgb, ${n} ${o.fillOpacity}%, transparent)`,borderWidth:o.border.width,borderStyle:"solid",borderColor:o.border.color}}function A(t){const o={top:t[i.top],right:t[i.right],bottom:t[i.bottom],left:t[i.left]},n={top:t[`${i.top}Phone`],right:t[`${i.right}Phone`],bottom:t[`${i.bottom}Phone`],left:t[`${i.left}Phone`]},{classes:r,style:e}=g(o,n);return Object.keys(e).length?{className:r.join(" "),style:e}:null}const f="upper";function I(t,o,n){const r=t&&typeof t=="object"?t:{},e=c(r.textStyle),u=e?c(o?.find(h=>h?.id===e)?.name):void 0,l=e?/^(heading|body)-(\d+)$/.exec(e):null,p=e?u||(l?n.styleName({kind:l[1],n:Number(l[2])}):e):n.noStyle,{cases:a}=n,m=c(r.case)??f;return`${p} · ${a[m]??a[f]}`}export{B as BUTTON_PAD_BUILT_IN,y as BUTTON_PAD_CLASSES,i as BUTTON_PAD_KEYS,f as BUTTON_WORDS_BUILT_IN_CASE,b as SITE_BUTTON_FILL,S as buttonLook,A as buttonPadAttrs,$ as buttonPaint,I as buttonWordsSummary};
@@ -13,7 +13,15 @@ export declare const PAD_LEFT_PHONE_CLASS = "sf-pad-left-phone";
13
13
  export declare const PAD_RIGHT_PHONE_CLASS = "sf-pad-right-phone";
14
14
  export declare const PAD_LEFT_PHONE_VAR = "--sf-pad-l-phone";
15
15
  export declare const PAD_RIGHT_PHONE_VAR = "--sf-pad-r-phone";
16
- export declare function sectionPadAttrs(pt: unknown, pb: unknown, ptPhone: unknown, pbPhone: unknown, pl?: unknown, pr?: unknown, plPhone?: unknown, prPhone?: unknown): {
16
+ export declare const PAD_TOP_TABLET_CLASS = "sf-pad-top-tablet";
17
+ export declare const PAD_BOTTOM_TABLET_CLASS = "sf-pad-bottom-tablet";
18
+ export declare const PAD_LEFT_TABLET_CLASS = "sf-pad-left-tablet";
19
+ export declare const PAD_RIGHT_TABLET_CLASS = "sf-pad-right-tablet";
20
+ export declare const PAD_TOP_TABLET_VAR = "--sf-pad-t-tablet";
21
+ export declare const PAD_BOTTOM_TABLET_VAR = "--sf-pad-b-tablet";
22
+ export declare const PAD_LEFT_TABLET_VAR = "--sf-pad-l-tablet";
23
+ export declare const PAD_RIGHT_TABLET_VAR = "--sf-pad-r-tablet";
24
+ export declare function sectionPadAttrs(v: PadValues): {
17
25
  className: string;
18
26
  style: CSSProperties;
19
27
  } | null;
@@ -23,7 +31,7 @@ export type PadSides = {
23
31
  bottom?: unknown;
24
32
  left?: unknown;
25
33
  };
26
- export declare function padSideAttrs(inline: PadSides, phone: PadSides): {
34
+ export declare function padSideAttrs(inline: PadSides, phone: PadSides, tablet?: PadSides, desktop?: PadSides): {
27
35
  classes: string[];
28
36
  style: CSSProperties;
29
37
  };
@@ -44,14 +52,24 @@ export declare function resolveSectionPadding(props: SectionPaddingProps, fallba
44
52
  export type PadValues = {
45
53
  top?: unknown;
46
54
  bottom?: unknown;
47
- topPhone?: unknown;
48
- bottomPhone?: unknown;
49
55
  left?: unknown;
50
56
  right?: unknown;
57
+ topTablet?: unknown;
58
+ bottomTablet?: unknown;
59
+ leftTablet?: unknown;
60
+ rightTablet?: unknown;
61
+ topPhone?: unknown;
62
+ bottomPhone?: unknown;
51
63
  leftPhone?: unknown;
52
64
  rightPhone?: unknown;
53
65
  };
54
- export declare function padValuesOf(props: Record<string, unknown>): PadValues;
66
+ export declare const SECTION_PAD_KEYS: {
67
+ readonly top: "sectionPaddingTop";
68
+ readonly bottom: "sectionPaddingBottom";
69
+ readonly left: "sectionPaddingLeft";
70
+ readonly right: "sectionPaddingRight";
71
+ };
72
+ export declare function padValuesOf(props: Record<string, unknown>, keys?: Record<"top" | "bottom" | "left" | "right", string>, sides?: boolean): PadValues;
55
73
  export declare function wrapperPadAttrs(v: PadValues): {
56
74
  className: string;
57
75
  style: CSSProperties;
@@ -0,0 +1 @@
1
+ import{phoneKey as u,tabletKey as h}from"efficient-easel/draw";import{viewOverrides as g}from"./view-values.js";import{finiteNumber as p}from"../../../format/lib/finite-number.js";const z={min:10,max:200,step:10};function x(t,e){const o=p(t),n=p(e);if(!(o===void 0&&n===void 0))return{paddingTop:o,paddingBottom:n}}const O="sf-pad-top-phone",E="sf-pad-bottom-phone",S="--sf-pad-t-phone",L="--sf-pad-b-phone",D="sf-pad-left-phone",B="sf-pad-right-phone",N="--sf-pad-l-phone",R="--sf-pad-r-phone",H="sf-pad-top-tablet",C="sf-pad-bottom-tablet",V="sf-pad-left-tablet",y="sf-pad-right-tablet",I="--sf-pad-t-tablet",w="--sf-pad-b-tablet",G="--sf-pad-l-tablet",F="--sf-pad-r-tablet";function T(t){const e=x(t.top,t.bottom),o=K({left:t.left,right:t.right},{top:t.topPhone,bottom:t.bottomPhone,left:t.leftPhone,right:t.rightPhone},{top:t.topTablet,bottom:t.bottomTablet,left:t.leftTablet,right:t.rightTablet},{top:t.top,bottom:t.bottom,left:t.left,right:t.right});return e===void 0&&!o.classes.length&&!Object.keys(o.style).length?null:{className:["sf-section-pad",...o.classes].join(" "),style:{...e,...o.style}}}const M=[["top","paddingTop",[H,I],[O,S]],["bottom","paddingBottom",[C,w],[E,L]],["left","paddingLeft",[V,G],[D,N]],["right","paddingRight",[y,F],[B,R]]];function K(t,e,o={},n=t){const s={},d={},i=[];for(const[r,l,...a]of M){const f=p(t[r]);f!==void 0&&(s[l]=f);const P=g("spacing",p(n[r]),p(o[r]),p(e[r]));for(const[A,[b,m]]of[["tablet",a[0]],["phone",a[1]]]){const c=P[A];typeof c=="number"&&(i.push(b),d[m]=`${c}px`)}}return{classes:i,style:{...s,...d}}}function _(t,e,o){const n=p(t)??o,s=p(e);return n===void 0?s:s===void 0?n:n+s}function J(t,e={}){return{top:_(t.padTop,t.sectionPaddingTop,e.top),bottom:_(t.padBottom,t.sectionPaddingBottom,e.bottom)}}const $={top:"sectionPaddingTop",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft",right:"sectionPaddingRight"};function Q(t,e=$,o=!0){const n={};for(const s of o?["top","bottom","left","right"]:["top","bottom"])n[s]=t[e[s]],n[`${s}Tablet`]=t[h(e[s])],n[`${s}Phone`]=t[u(e[s])];return n}function U(t){return T(t)}function W(t,e){const o=n=>typeof n=="number"?n+e:void 0;return T({...t,top:o(t.top),bottom:o(t.bottom),topTablet:o(t.topTablet),bottomTablet:o(t.bottomTablet),topPhone:o(t.topPhone),bottomPhone:o(t.bottomPhone)})}export{E as PAD_BOTTOM_PHONE_CLASS,L as PAD_BOTTOM_PHONE_VAR,C as PAD_BOTTOM_TABLET_CLASS,w as PAD_BOTTOM_TABLET_VAR,D as PAD_LEFT_PHONE_CLASS,N as PAD_LEFT_PHONE_VAR,V as PAD_LEFT_TABLET_CLASS,G as PAD_LEFT_TABLET_VAR,B as PAD_RIGHT_PHONE_CLASS,R as PAD_RIGHT_PHONE_VAR,y as PAD_RIGHT_TABLET_CLASS,F as PAD_RIGHT_TABLET_VAR,O as PAD_TOP_PHONE_CLASS,S as PAD_TOP_PHONE_VAR,H as PAD_TOP_TABLET_CLASS,I as PAD_TOP_TABLET_VAR,z as SECTION_PADDING,$ as SECTION_PAD_KEYS,K as padSideAttrs,Q as padValuesOf,J as resolveSectionPadding,W as rootPadAttrs,T as sectionPadAttrs,x as sectionPadStyle,U as wrapperPadAttrs};
@@ -0,0 +1,10 @@
1
+ import { type AutoRule, type ViewValueKind } from "efficient-easel/draw";
2
+ export declare const RESPONSIVE_RULES: "v1" | "v2";
3
+ export declare function viewRules(): Record<ViewValueKind, AutoRule>;
4
+ export declare const TABLET_MEDIA = "(min-width: 720px) and (max-width: 1099.98px)";
5
+ export declare const PHONE_MEDIA = "(max-width: 719.98px)";
6
+ export interface ViewOverrides<T> {
7
+ tablet?: T;
8
+ phone?: T;
9
+ }
10
+ export declare function viewOverrides<T>(kind: ViewValueKind, desktop: T, tablet: T | null | undefined, phone: T | null | undefined, rules?: Record<ViewValueKind, AutoRule>): ViewOverrides<T>;
@@ -0,0 +1 @@
1
+ import{AUTO_RULES as u,FOLLOW_RULES as d,VIEW_DESKTOP_MIN as w,VIEW_TABLET_MIN as s,isAuto as I,resolveViewValue as L}from"efficient-easel/draw";const O="v1";function f(){return O==="v2"?u:d}const p=.02,A=`(min-width: ${s}px) and (max-width: ${w-p}px)`,S=`(max-width: ${s-p}px)`;function T(x,n,i,r,c=f()){const t=L(x,n,i,r,c),o={},E=(_,e)=>!I(_)||e!=null&&e!==n;return E(i,t.tablet)&&(o.tablet=t.tablet),E(r,t.phone)&&(o.phone=t.phone),o}export{S as PHONE_MEDIA,O as RESPONSIVE_RULES,A as TABLET_MEDIA,T as viewOverrides,f as viewRules};
@@ -1 +1 @@
1
- import{jsx as d}from"react/jsx-runtime";import c from"../../../../../components/Divider.js";import{padValuesOf as a}from"../../../../../../format/lib/content/section-padding.js";import{DividerMeta as m}from"../../../../../../format/lib/document/blocks/general/Divider/meta.js";const g={...m,render:e=>{const{spacing:i,contained:t,style:n,thickness:r,lengthPct:o,hideOnMobile:s}=e;return d(c,{spacing:i,contained:t,style:n,thickness:r,lengthPct:o,hideOnMobile:s===!0,pad:a(e)})}};export{g as DividerRender};
1
+ import{jsx as d}from"react/jsx-runtime";import c from"../../../../../components/Divider.js";import{padValuesOf as a}from"../../../../content/section-padding.js";import{DividerMeta as m}from"../../../../../../format/lib/document/blocks/general/Divider/meta.js";const g={...m,render:e=>{const{spacing:i,contained:t,style:n,thickness:r,lengthPct:o,hideOnMobile:s}=e;return d(c,{spacing:i,contained:t,style:n,thickness:r,lengthPct:o,hideOnMobile:s===!0,pad:a(e)})}};export{g as DividerRender};
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import t from"../../../../../components/Flex.js";import{sectionFillsHeight as a}from"../../../../../../format/lib/content/section-min-height.js";import{FlexMeta as i}from"../../../../../../format/lib/document/blocks/general/Flex/meta.js";const c={...i,render:e=>n(t,{direction:e.direction,label:e.label,tabShape:e.tabShape,gap:e.gap,justify:e.justify,align:e.align,wrap:e.wrap,share:e.share,phoneRow:e.phoneRow,blockSpacing:e.blockSpacing,bgImage:e.bgImage,bgImagePhone:e.bgImagePhone,darken:e.darken,darkenStyle:e.darkenStyle,placement:e.placement,padV2:e.padV2===!0,border:e.sectionBorder,borderPhone:e.sectionBorderPhone,padTop:e.sectionPaddingTop,padBottom:e.sectionPaddingBottom,padTopPhone:e.sectionPaddingTopPhone,padBottomPhone:e.sectionPaddingBottomPhone,padLeft:e.sectionPaddingLeft,padRight:e.sectionPaddingRight,padLeftPhone:e.sectionPaddingLeftPhone,padRightPhone:e.sectionPaddingRightPhone,contained:e.contained,fillHeight:a(e),shadow:e.shadow,content:e.content})};export{c as FlexRender};
1
+ import{jsx as a}from"react/jsx-runtime";import n from"../../../../../components/Flex.js";import{padValuesOf as t}from"../../../../content/section-padding.js";import{sectionFillsHeight as i}from"../../../../../../format/lib/content/section-min-height.js";import{FlexMeta as d}from"../../../../../../format/lib/document/blocks/general/Flex/meta.js";const h={...d,render:e=>a(n,{direction:e.direction,label:e.label,tabShape:e.tabShape,gap:e.gap,justify:e.justify,align:e.align,wrap:e.wrap,share:e.share,phoneRow:e.phoneRow,blockSpacing:e.blockSpacing,bgImage:e.bgImage,bgImagePhone:e.bgImagePhone,darken:e.darken,darkenStyle:e.darkenStyle,placement:e.placement,padV2:e.padV2===!0,border:e.sectionBorder,borderPhone:e.sectionBorderPhone,pad:t(e),contained:e.contained,fillHeight:i(e),shadow:e.shadow,content:e.content})};export{h as FlexRender};
@@ -1 +1 @@
1
- import{Fragment as d,jsx as t}from"react/jsx-runtime";import{padValuesOf as m}from"../../../../../../format/lib/content/section-padding.js";import f from"../../../../../components/Heading.js";import{hidableText as l,readHidable as p}from"efficient-easel/draw";import{PH as g}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as s}from"../../scaffold.js";import{HeadingMeta as x}from"../../../../../../format/lib/document/blocks/general/Heading/meta.js";const F={...x,render:e=>{const{text:r,level:i,align:a,contained:n,editor:o}=e;return p(r).hidden?t(d,{}):t(f,{text:s(l(r),g.heading,o)??"",level:i,align:a,contained:n,pad:m(e)})}};export{F as HeadingRender};
1
+ import{Fragment as d,jsx as t}from"react/jsx-runtime";import{padValuesOf as m}from"../../../../content/section-padding.js";import f from"../../../../../components/Heading.js";import{hidableText as l,readHidable as p}from"efficient-easel/draw";import{PH as g}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as s}from"../../scaffold.js";import{HeadingMeta as x}from"../../../../../../format/lib/document/blocks/general/Heading/meta.js";const F={...x,render:e=>{const{text:r,level:i,align:a,contained:n,editor:o}=e;return p(r).hidden?t(d,{}):t(f,{text:s(l(r),g.heading,o)??"",level:i,align:a,contained:n,pad:m(e)})}};export{F as HeadingRender};
@@ -1 +1 @@
1
- import{jsx as x}from"react/jsx-runtime";import G from"../../../../../components/HeroGroup.js";import{HeroGroupMeta as H}from"../../../../../../format/lib/document/blocks/general/HeroGroup/meta.js";const L={...H,render:({placement:o,nudgeX:e,nudgeY:n,width:t,gap:i,direction:d,justify:r,align:a,wrap:g,sectionPaddingTop:c,sectionPaddingBottom:s,sectionPaddingTopPhone:p,sectionPaddingBottomPhone:P,sectionPaddingLeft:m,sectionPaddingRight:f,sectionPaddingLeftPhone:h,sectionPaddingRightPhone:u,content:R,editor:j})=>x(G,{placement:o,nudgeX:e,nudgeY:n,width:t,gap:i,direction:d,justify:r,align:a,wrap:g,sectionPaddingTop:c,sectionPaddingBottom:s,sectionPaddingTopPhone:p,sectionPaddingBottomPhone:P,sectionPaddingLeft:m,sectionPaddingRight:f,sectionPaddingLeftPhone:h,sectionPaddingRightPhone:u,content:R,dragRef:j?.dragRef})};export{L as HeroGroupRender};
1
+ import{jsx as f}from"react/jsx-runtime";import c from"../../../../../components/HeroGroup.js";import{padValuesOf as s}from"../../../../content/section-padding.js";import{HeroGroupMeta as l}from"../../../../../../format/lib/document/blocks/general/HeroGroup/meta.js";const H={...l,render:e=>{const{placement:r,nudgeX:t,nudgeY:o,width:n,gap:a,direction:d,justify:i,align:p,wrap:u,content:g,editor:m}=e;return f(c,{placement:r,nudgeX:t,nudgeY:o,width:n,gap:a,direction:d,justify:i,align:p,wrap:u,pad:s(e),content:g,dragRef:m?.dragRef})}};export{H as HeroGroupRender};
@@ -1 +1 @@
1
- import{Fragment as g,jsx as o}from"react/jsx-runtime";import{CardRowValues as h}from"../../../../../components/CardRowContext.js";import{namedRowField as u}from"../../../../../../format/lib/content/card-template.js";import{padValuesOf as y}from"../../../../../../format/lib/content/section-padding.js";import S from"../../../../../components/Text.js";import{hidableText as d,readHidable as T}from"efficient-easel/draw";import{PH as m}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as b}from"../../scaffold.js";import{readPartStyle as w}from"../../../part-styles.js";import{TextMeta as F}from"../../../../../../format/lib/document/blocks/general/Text/meta.js";const W={...F,render:t=>{const{text:e,align:l,tone:f,tag:x,contained:s,editor:c}=t;if(T(e).hidden)return o(g,{});const a=w(t,"text").textStyle,p=a?.startsWith("heading-")?m.heading:m.body,i=r=>o(S,{text:b(r,p,c)??"",align:l,tone:f,tag:x,textStyle:a,contained:s,pad:y(t)}),n=u(t);return n?o(h,{fields:[n],children:([r])=>i(r??d(e))}):i(d(e))}};export{W as TextRender};
1
+ import{Fragment as g,jsx as o}from"react/jsx-runtime";import{CardRowValues as h}from"../../../../../components/CardRowContext.js";import{namedRowField as u}from"../../../../../../format/lib/content/card-template.js";import{padValuesOf as y}from"../../../../content/section-padding.js";import S from"../../../../../components/Text.js";import{hidableText as d,readHidable as T}from"efficient-easel/draw";import{PH as m}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as b}from"../../scaffold.js";import{readPartStyle as w}from"../../../part-styles.js";import{TextMeta as F}from"../../../../../../format/lib/document/blocks/general/Text/meta.js";const W={...F,render:t=>{const{text:e,align:l,tone:f,tag:x,contained:s,editor:c}=t;if(T(e).hidden)return o(g,{});const a=w(t,"text").textStyle,p=a?.startsWith("heading-")?m.heading:m.body,i=r=>o(S,{text:b(r,p,c)??"",align:l,tone:f,tag:x,textStyle:a,contained:s,pad:y(t)}),n=u(t);return n?o(h,{fields:[n],children:([r])=>i(r??d(e))}):i(d(e))}};export{W as TextRender};
@@ -1 +1 @@
1
- import{NESTED_BOX_PADDING as a}from"../../../../../format/lib/content/box-layout.js";import{resolveSectionPadding as r}from"../../../../../format/lib/content/section-padding.js";import{ButtonBlockMeta as p}from"../../../../../format/lib/document/blocks/general/ButtonBlock/meta.js";import{TextMeta as g}from"../../../../../format/lib/document/blocks/general/Text/meta.js";import{SECTION_PAD_INNER_DEFAULTS as P}from"../../passes/section-padding.js";import{finiteNumber as i}from"../../../../../format/lib/finite-number.js";import{hasWords as h}from"../../../sections/section-to-box.js";const{text:b,tag:N,...m}=g.defaultProps,s=m,O={...s,tone:"dim"},{label:A,href:M,...T}=p.defaultProps,I=T,c={justify:"start",align:"stretch",wrap:!1,blockSpacing:"gap",padV2:!0},k={...c,direction:"column",...a},v={...c,sectionAccent:0},C=["gridSpan","backgroundWidth","contentWidth","contentMax","widthMode","sectionHeightMode","sectionHeightValue","sectionHeightUnit","sectionHeightModePhone","sectionHeightValuePhone","sectionHeightUnitPhone","sectionCorners","sectionCornerSides","sectionBorder","sectionBorderPhone","sectionAccent","stickTop","stickTopDistance","stickTopPhone","stickTopDistancePhone","anchor","sectionAnimation","_hidden"],H={sectionSurface:"read by nothing in src/ (searched 2026-10-24): a retired theme key that draws nothing today, so dropping it changes nothing"},R=Object.fromEntries(["sectionPaddingLeft","sectionPaddingRight","sectionPaddingLeftPhone","sectionPaddingRightPhone"].map(o=>[o,"needs Box side padding outside its gutter: the old section added it outside its frame, a Box's side padding replaces the gutter. 0 live nodes store it (JJ's read-only export, 2026-10-24)"]));function x(o,t){const e=i(o.sectionPaddingTop)??0,n=i(o.sectionPaddingBottom)??0;return{sectionPaddingTop:e+t.top,sectionPaddingBottom:n+t.bottom,sectionPaddingTopPhone:(i(o.sectionPaddingTopPhone)??e)+t.topPhone,sectionPaddingBottomPhone:(i(o.sectionPaddingBottomPhone)??n)+t.bottomPhone}}const U=o=>["sectionPaddingTop","sectionPaddingBottom","sectionPaddingTopPhone","sectionPaddingBottomPhone"].map(t=>[t,t,(e,n)=>x(n,typeof o=="function"?o(n):o)[t]]);function d(o,t){const e=r(o,P[t]);return{sectionPaddingTop:e.top,sectionPaddingBottom:e.bottom}}const X=o=>[["padTop","sectionPaddingTop",(t,e)=>d(e,o).sectionPaddingTop],["padBottom","sectionPaddingBottom",(t,e)=>d(e,o).sectionPaddingBottom],["sectionPaddingTop","sectionPaddingTop",(t,e)=>d(e,o).sectionPaddingTop],["sectionPaddingBottom","sectionPaddingBottom",(t,e)=>d(e,o).sectionPaddingBottom]],f={kind:"heading-case-upper",styles:["heading-1","heading-2","heading-3"]},y=o=>t=>h(t.props[o])?[f]:[],G=(o,t)=>({kind:"text",key:o,role:"eyebrow",props:s,...t?{style:t}:{}});export{c as BOX,I as BUTTON,O as DIM,H as DROP_COMMON,R as DROP_SIDE_PADDING,f as HEADING_CASE_UPPER,k as INNER_BOX,C as SAME_KEYS,v as SECTION_BOX,s as TEXT,y as headingCaseOf,d as innerPad,X as innerPadKeys,G as smallText,x as wrapperPad,U as wrapperPadKeys};
1
+ import{NESTED_BOX_PADDING as a}from"../../../../../format/lib/content/box-layout.js";import{resolveSectionPadding as r}from"../../../content/section-padding.js";import{ButtonBlockMeta as p}from"../../../../../format/lib/document/blocks/general/ButtonBlock/meta.js";import{TextMeta as g}from"../../../../../format/lib/document/blocks/general/Text/meta.js";import{SECTION_PAD_INNER_DEFAULTS as P}from"../../passes/section-padding.js";import{finiteNumber as i}from"../../../../../format/lib/finite-number.js";import{hasWords as h}from"../../../sections/section-to-box.js";const{text:b,tag:N,...m}=g.defaultProps,s=m,O={...s,tone:"dim"},{label:A,href:M,...T}=p.defaultProps,I=T,c={justify:"start",align:"stretch",wrap:!1,blockSpacing:"gap",padV2:!0},k={...c,direction:"column",...a},v={...c,sectionAccent:0},C=["gridSpan","backgroundWidth","contentWidth","contentMax","widthMode","sectionHeightMode","sectionHeightValue","sectionHeightUnit","sectionHeightModePhone","sectionHeightValuePhone","sectionHeightUnitPhone","sectionCorners","sectionCornerSides","sectionBorder","sectionBorderPhone","sectionAccent","stickTop","stickTopDistance","stickTopPhone","stickTopDistancePhone","anchor","sectionAnimation","_hidden"],H={sectionSurface:"read by nothing in src/ (searched 2026-10-24): a retired theme key that draws nothing today, so dropping it changes nothing"},R=Object.fromEntries(["sectionPaddingLeft","sectionPaddingRight","sectionPaddingLeftPhone","sectionPaddingRightPhone"].map(o=>[o,"needs Box side padding outside its gutter: the old section added it outside its frame, a Box's side padding replaces the gutter. 0 live nodes store it (JJ's read-only export, 2026-10-24)"]));function x(o,t){const e=i(o.sectionPaddingTop)??0,n=i(o.sectionPaddingBottom)??0;return{sectionPaddingTop:e+t.top,sectionPaddingBottom:n+t.bottom,sectionPaddingTopPhone:(i(o.sectionPaddingTopPhone)??e)+t.topPhone,sectionPaddingBottomPhone:(i(o.sectionPaddingBottomPhone)??n)+t.bottomPhone}}const U=o=>["sectionPaddingTop","sectionPaddingBottom","sectionPaddingTopPhone","sectionPaddingBottomPhone"].map(t=>[t,t,(e,n)=>x(n,typeof o=="function"?o(n):o)[t]]);function d(o,t){const e=r(o,P[t]);return{sectionPaddingTop:e.top,sectionPaddingBottom:e.bottom}}const X=o=>[["padTop","sectionPaddingTop",(t,e)=>d(e,o).sectionPaddingTop],["padBottom","sectionPaddingBottom",(t,e)=>d(e,o).sectionPaddingBottom],["sectionPaddingTop","sectionPaddingTop",(t,e)=>d(e,o).sectionPaddingTop],["sectionPaddingBottom","sectionPaddingBottom",(t,e)=>d(e,o).sectionPaddingBottom]],f={kind:"heading-case-upper",styles:["heading-1","heading-2","heading-3"]},y=o=>t=>h(t.props[o])?[f]:[],G=(o,t)=>({kind:"text",key:o,role:"eyebrow",props:s,...t?{style:t}:{}});export{c as BOX,I as BUTTON,O as DIM,H as DROP_COMMON,R as DROP_SIDE_PADDING,f as HEADING_CASE_UPPER,k as INNER_BOX,C as SAME_KEYS,v as SECTION_BOX,s as TEXT,y as headingCaseOf,d as innerPad,X as innerPadKeys,G as smallText,x as wrapperPad,U as wrapperPadKeys};
@@ -12,8 +12,8 @@ export declare const VIDEO_FILE_LABEL = "Video file";
12
12
  export declare const VIDEO_FILE_PROMPT = "Upload a video file";
13
13
  export declare function forMediaType(type: "image" | "video", fallback: "image" | "video"): {
14
14
  readonly field: "mediaType";
15
- readonly is: "video" | "image";
16
- readonly default: "video" | "image";
15
+ readonly is: "image" | "video";
16
+ readonly default: "image" | "video";
17
17
  };
18
18
  export declare const HERO_MEDIA_PART_TYPES: ReadonlySet<string>;
19
19
  export declare function inPart<F extends object>(part: HeroMediaPart, field: F): F;
@@ -110,7 +110,6 @@ export declare function partSpacingOf(style: PartStyle): {
110
110
  letterSpacingEm?: number;
111
111
  };
112
112
  export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
113
- export declare const PART_PHONE_MAX_CSS = "(max-width: 719.98px)";
114
113
  export declare function partPhoneDeclarations(style: PartStyle): Record<string, string>;
115
114
  export declare function partStyleForScreen(style: PartStyle, phone: boolean): PartStyle;
116
115
  export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase, options?: PartDeclarationOptions): Record<string, string>;
@@ -1,2 +1,2 @@
1
- import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{FONT_OPTIONS as Q,FONT_ROLES as O,fontOption as v,SIZE_STEP_OF_ROLE as tt}from"../../../format/lib/fonts.js";import{encodePartKey as et}from"../../../format/lib/document/part-key.js";import{decodePartId as H,normalizePartText as N}from"./text-parts.js";import{COLOUR_TOKEN as F}from"../../../format/lib/word-styles.js";const w="_partStyles",nt="data-sf-part-styled",L="data-sf-text-style",rt=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&rt.test(t)}const z={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function ot(t){if(!t)return null;for(const[e,n]of Object.entries(z))if(n===t)return e;return null}function ne(t){if(g(t.textStyle))return t.textStyle;const e=t.role&&O.includes(t.role)?t.role:null;return e?z[e]:void 0}const it=[400,500,600,700],k=["left","center","right","justify"],j=5,D=1e3,st=-5,at=10,ct=0,lt=64,ft=2,ut=120,E=1280,pt=10,C={size:{min:j,max:D,step:1},sizePhone:{min:j,max:D,step:1},padding:{min:ct,max:lt,step:ft},width:{min:ut,max:E,step:pt}},dt=.05,xt=.01,ht=["line","letter"],St=.5,gt=2.5,mt=-1,Pt=1,Tt=0,_t=400;function T(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function W(t){return T(t?.[w])??{}}function K(t,e){const n=W(t);return Object.hasOwn(n,e)?T(n[e])??{}:{}}function re(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){const r={...W(t)};if(At(n).length?r[e]=n:delete r[e],!Object.keys(r).length){const{[w]:o,...i}=t;return i}return{...t,[w]:r}}function At(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function bt(t){return ht.includes(t)}const _=(t,e,n)=>Math.min(n,Math.max(e,t));function Rt(t,e){if(bt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:_(n,st,at)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?m(_(n,St,gt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?m(_(n,mt,Pt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:_(n,Tt,_t)}if(Object.hasOwn(C,t)){const{min:n,max:r}=C[t],o=Math.round(Number(e));return Number.isFinite(o)?_(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"?O.includes(String(e))?e:null:t==="textStyle"?g(e)?e:null:e}const Et=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding","width"];function X(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of Et){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!k.includes(t.align)&&n("align"),t.textStyle!==void 0&&!g(t.textStyle)&&n("textStyle"),e??t}const yt=[["font","role"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ot(t){const e=[];for(const[n,r]of yt)n===t?e.push(r):r===t&&e.push(n);return e}function oe(t,e,n,r){const o={...K(t,e)},i=r==null?null:Rt(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of Ot(n))delete o[s]}return G(t,e,o)}function ie(t,e){return G(t,e,{})}function Nt(t){return J(t)??"none"}function wt(t){return q(t)??""}const It={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 $t(t,e){const n=t.role;return n&&O.includes(n)?n:e?.blockDrawsStyle?null:ot(t.textStyle)}function se(t,e){return t==="Text"&&e==="text"}const Mt={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 Ht(t){const e=tt[t],n=Mt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ft(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=m(Lt+t.line*dt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=m(t.letter*xt,4)),e}const Lt=1,A="--sf-part-para",zt="(max-width: 719.98px)";function U(t){return t=X(t),typeof t.sizePhone=="number"&&t.sizePhone>0?{fontSize:`${t.sizePhone}px`}:{}}function kt(t,e){return e&&typeof t.sizePhone=="number"&&t.sizePhone>0?{...t,size:t.sizePhone}:t}function y(t,e,n){t=X(t);const r=$t(t,n),o=Ft(t),i=t.size?`${t.size}px`:r?Ht(r):"";return{fontFamily:t.font?Wt(t.font):r?`var(${It[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`:"",[A]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:wt(t.case),textAlign:t.align??"",paddingTop:I(t.padding),paddingBottom:I(t.padding),maxWidth:I(t.width),color:jt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const jt=t=>t===void 0||t===""?"":Object.hasOwn(F,t)?F[t]:B.test(t)?t:"",B=/^#[0-9a-fA-F]{6}$/;function ae(t){return B.test(t)}const I=t=>t===void 0?"":`${t}px`,m=(t,e)=>Number(t.toFixed(e));function ce(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop),s=Number.parseFloat(t.maxWidth);return{fontKey:e,sizePx:n,weight:Dt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?m(r/n,3):1.2,letterEm:Number.isFinite(o)?m(o/n,4):0,align:Ct(t.textAlign),case:Nt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0,widthPx:Number.isFinite(s)&&s<E?Math.round(s):E}}function Dt(t){return Number.isFinite(t)?it.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Ct(t){for(const e of k)if(e===t)return e;return t==="end"?"right":"left"}function le(t,e){const n=V(t);if(!n)return"";for(const r of Q)if(V(e(r.cssVar))===n)return r.key;return""}const V=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Wt(t){const e=v(t);return e?`var(${e.cssVar})`:""}function fe(t,e,n,r){return!e||H(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function ue(t,e,n=()=>b,r=d=>d,o=Xt,i=!1,s=()=>!1){let d=0;for(const{element:a,partId:c}of t){const u=H(c)?.propKey;if(!u)continue;const l=r(u),p=Object.hasOwn(e,l)?T(e[l])??{}:{},f=y(kt(p,i),b,{blockDrawsStyle:s(u)});g(p.textStyle)?a.setAttribute?.(L,p.textStyle):a.removeAttribute?.(L);const S=M.some(h=>a.style[h]);let x=!1;for(const[h,P]of Object.entries(f))Ut(a,h,P),P&&(x=!0);if(S||M.some(h=>f[h]))for(const h of Kt(a,o))for(const P of M)h.style[P]=f[P]??"";x&&(d+=1)}return d}function Kt(t,e){const n=N(t.textContent??""),r=[];let o=t;for(let i=0;i<Gt&&e(o);i+=1){const s=o.parentElement;if(!s||N(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Gt=8;function Xt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const b={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:E};function Ut(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===A&&(n?o.setAttribute?.(Y,""):o.removeAttribute?.(Y))}const Y="data-sf-part-para",Bt=Object.keys(y({},b)),$=new Set(["color","overflowWrap",A,"fontStyle"]),M=Bt.filter(t=>!$.has(t));function pe(t,e,n,r=i=>i,o=()=>!1){const i=new Map;for(const a of t){const c=et(a.key,a.row);for(const u of a.texts){const l=i.get(u);l?(l.keys.add(a.key),l.partKeys.add(c)):i.set(u,{keys:new Set([a.key]),partKeys:new Set([c])})}}const s=new Map;for(const a of Object.keys(e)){if(!Vt(a))continue;const c=T(e[a])??{},u=y(c,b),l=U(c),p=g(c.textStyle)?c.textStyle:void 0;!Object.values(u).some(Boolean)&&!Object.keys(l).length&&!p||s.set(a,{stamp:Z(n,a),declarations:u,...Object.keys(l).length?{phone:l}:{},...p?{textStyle:p}:{}})}const d=new Map;for(const[a,{keys:c,partKeys:u}]of i){const l=u.size===1?[...u][0]:c.size===1?[...c][0]:null;if(!l)continue;const p=r(l);if(!Object.hasOwn(e,p))continue;const f=T(e[p])??{},S=y(f,b,{blockDrawsStyle:o(l)}),x=U(f),R=g(f.textStyle)?f.textStyle:void 0;!Object.values(S).some(Boolean)&&!Object.keys(x).length&&!R||d.set(a,{stamp:Z(n,l),declarations:S,...Object.keys(x).length?{phone:x}:{},...R?{textStyle:R}:{}})}return d.size||s.size?{rules:d,kindRules:s,drawn:new Set(i.keys())}:null}function Vt(t){return t.startsWith("@")}function de(t,e){return t?.kindRules.get(e)??null}function Z(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function xe(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const d=Object.entries(s).filter(([,f])=>f!==""),a=f=>f.map(([S,x])=>`${Zt(S)}: ${x}`).join("; "),c=`[${nt}="${i}"]`,u=d.filter(([f])=>!$.has(f)),l=d.filter(([f])=>$.has(f));u.length&&e.push(`${c}, *:has(> ${c}) { ${a(u)} }`),l.length&&e.push(`${c} { ${a(l)} }`),s[A]&&e.push(...Yt(c));const p=Object.entries(o.phone??{}).filter(([,f])=>f!=="");p.length&&e.push(`@media ${zt} { ${c}, *:has(> ${c}) { ${a(p)} } }`)};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
2
- `)}function Yt(t){const e=`var(${A})`,n=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${e} }`,`${t} ${n}:not(:first-child) { margin-top: ${e} }`,`${t} ${n}:not(:last-child) { margin-bottom: ${e} }`]}const Zt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function he(t,e){if(!t)return null;const n=N(e),r=t.rules.get(n);if(r)return r;if(n.length<qt||t.drawn.has(n))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(n)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const qt=8;export{k as PART_ALIGNS,Pt as PART_LETTER_EM_MAX,mt as PART_LETTER_EM_MIN,xt as PART_LETTER_STEP,gt as PART_LINE_HEIGHT_MAX,St as PART_LINE_HEIGHT_MIN,dt as PART_LINE_STEP,C as PART_MEASURED_TRACKS,at as PART_NUDGE_MAX,st as PART_NUDGE_MIN,lt as PART_PADDING_MAX,ct as PART_PADDING_MIN,ft as PART_PADDING_STEP,Y as PART_PARAGRAPH_ATTR,_t as PART_PARAGRAPH_MAX,Tt as PART_PARAGRAPH_MIN,A as PART_PARAGRAPH_VAR,zt as PART_PHONE_MAX_CSS,ht as PART_RELATIVE_PROPS,D as PART_SIZE_MAX,j as PART_SIZE_MIN,nt as PART_STYLED_ATTR,w as PART_STYLES_PROP,Bt as PART_STYLE_PROPERTIES,it as PART_WEIGHTS,E as PART_WIDTH_MAX,ut as PART_WIDTH_MIN,pt as PART_WIDTH_STEP,M as SHARED_PART_PROPERTIES,z as STYLE_ID_OF_ROLE,L as TEXT_STYLE_ATTR,ue as applyPartStyles,se as blockDrawsTextStyle,ne as followedStyleOf,ae as isHexColour,Vt as isPartKindKey,g as isTextStyleId,Yt as paragraphRules,Nt as partCaseOfTransform,wt as partCaseTransform,le as partFontKeyOf,U as partPhoneDeclarations,de as partRuleForKind,he as partRuleForText,Ft as partSpacingOf,ce as partStyleBase,re as partStyleCount,xe as partStyleCss,y as partStyleDeclarations,kt as partStyleForScreen,fe as partStyleSource,oe as propsWithPartStyleValue,ie as propsWithoutPartStyle,pe as publishedPartStyles,K as readPartStyle,W as readPartStyles};
1
+ import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{FONT_OPTIONS as Q,FONT_ROLES as O,fontOption as v,SIZE_STEP_OF_ROLE as tt}from"../../../format/lib/fonts.js";import{encodePartKey as et}from"../../../format/lib/document/part-key.js";import{decodePartId as H,normalizePartText as N}from"./text-parts.js";import{COLOUR_TOKEN as F}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as nt}from"../content/view-values.js";const w="_partStyles",rt="data-sf-part-styled",L="data-sf-text-style",ot=/^(heading|body)-[1-7]$/;function S(t){return typeof t=="string"&&ot.test(t)}const z={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function it(t){if(!t)return null;for(const[e,n]of Object.entries(z))if(n===t)return e;return null}function re(t){if(S(t.textStyle))return t.textStyle;const e=t.role&&O.includes(t.role)?t.role:null;return e?z[e]:void 0}const st=[400,500,600,700],k=["left","center","right","justify"],D=5,j=1e3,at=-5,ct=10,lt=0,ft=64,ut=2,pt=120,E=1280,dt=10,W={size:{min:D,max:j,step:1},sizePhone:{min:D,max:j,step:1},padding:{min:lt,max:ft,step:ut},width:{min:pt,max:E,step:dt}},xt=.05,ht=.01,gt=["line","letter"],St=.5,mt=2.5,Pt=-1,Tt=1,_t=0,bt=400;function T(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function C(t){return T(t?.[w])??{}}function K(t,e){const n=C(t);return Object.hasOwn(n,e)?T(n[e])??{}:{}}function oe(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){const r={...C(t)};if(At(n).length?r[e]=n:delete r[e],!Object.keys(r).length){const{[w]:o,...i}=t;return i}return{...t,[w]:r}}function At(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Rt(t){return gt.includes(t)}const _=(t,e,n)=>Math.min(n,Math.max(e,t));function Et(t,e){if(Rt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:_(n,at,ct)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?m(_(n,St,mt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?m(_(n,Pt,Tt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:_(n,_t,bt)}if(Object.hasOwn(W,t)){const{min:n,max:r}=W[t],o=Math.round(Number(e));return Number.isFinite(o)?_(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"?O.includes(String(e))?e:null:t==="textStyle"?S(e)?e:null:e}const yt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding","width"];function X(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of yt){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!k.includes(t.align)&&n("align"),t.textStyle!==void 0&&!S(t.textStyle)&&n("textStyle"),e??t}const Ot=[["font","role"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Nt(t){const e=[];for(const[n,r]of Ot)n===t?e.push(r):r===t&&e.push(n);return e}function ie(t,e,n,r){const o={...K(t,e)},i=r==null?null:Et(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of Nt(n))delete o[s]}return G(t,e,o)}function se(t,e){return G(t,e,{})}function wt(t){return J(t)??"none"}function It(t){return q(t)??""}const $t={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=t.role;return n&&O.includes(n)?n:e?.blockDrawsStyle?null:it(t.textStyle)}function ae(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 Ft(t){const e=tt[t],n=Ht[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Lt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=m(zt+t.line*xt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=m(t.letter*ht,4)),e}const zt=1,b="--sf-part-para";function U(t){return t=X(t),typeof t.sizePhone=="number"&&t.sizePhone>0?{fontSize:`${t.sizePhone}px`}:{}}function kt(t,e){return e&&typeof t.sizePhone=="number"&&t.sizePhone>0?{...t,size:t.sizePhone}:t}function y(t,e,n){t=X(t);const r=Mt(t,n),o=Lt(t),i=t.size?`${t.size}px`:r?Ft(r):"";return{fontFamily:t.font?Ct(t.font):r?`var(${$t[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`:"",[b]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:It(t.case),textAlign:t.align??"",paddingTop:I(t.padding),paddingBottom:I(t.padding),maxWidth:I(t.width),color:Dt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Dt=t=>t===void 0||t===""?"":Object.hasOwn(F,t)?F[t]:B.test(t)?t:"",B=/^#[0-9a-fA-F]{6}$/;function ce(t){return B.test(t)}const I=t=>t===void 0?"":`${t}px`,m=(t,e)=>Number(t.toFixed(e));function le(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop),s=Number.parseFloat(t.maxWidth);return{fontKey:e,sizePx:n,weight:jt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?m(r/n,3):1.2,letterEm:Number.isFinite(o)?m(o/n,4):0,align:Wt(t.textAlign),case:wt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0,widthPx:Number.isFinite(s)&&s<E?Math.round(s):E}}function jt(t){return Number.isFinite(t)?st.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Wt(t){for(const e of k)if(e===t)return e;return t==="end"?"right":"left"}function fe(t,e){const n=V(t);if(!n)return"";for(const r of Q)if(V(e(r.cssVar))===n)return r.key;return""}const V=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ct(t){const e=v(t);return e?`var(${e.cssVar})`:""}function ue(t,e,n,r){return!e||H(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function pe(t,e,n=()=>A,r=d=>d,o=Xt,i=!1,s=()=>!1){let d=0;for(const{element:a,partId:c}of t){const u=H(c)?.propKey;if(!u)continue;const l=r(u),p=Object.hasOwn(e,l)?T(e[l])??{}:{},f=y(kt(p,i),A,{blockDrawsStyle:s(u)});S(p.textStyle)?a.setAttribute?.(L,p.textStyle):a.removeAttribute?.(L);const g=M.some(h=>a.style[h]);let x=!1;for(const[h,P]of Object.entries(f))Ut(a,h,P),P&&(x=!0);if(g||M.some(h=>f[h]))for(const h of Kt(a,o))for(const P of M)h.style[P]=f[P]??"";x&&(d+=1)}return d}function Kt(t,e){const n=N(t.textContent??""),r=[];let o=t;for(let i=0;i<Gt&&e(o);i+=1){const s=o.parentElement;if(!s||N(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Gt=8;function Xt(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,widthPx:E};function Ut(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===b&&(n?o.setAttribute?.(Y,""):o.removeAttribute?.(Y))}const Y="data-sf-part-para",Bt=Object.keys(y({},A)),$=new Set(["color","overflowWrap",b,"fontStyle"]),M=Bt.filter(t=>!$.has(t));function de(t,e,n,r=i=>i,o=()=>!1){const i=new Map;for(const a of t){const c=et(a.key,a.row);for(const u of a.texts){const l=i.get(u);l?(l.keys.add(a.key),l.partKeys.add(c)):i.set(u,{keys:new Set([a.key]),partKeys:new Set([c])})}}const s=new Map;for(const a of Object.keys(e)){if(!Vt(a))continue;const c=T(e[a])??{},u=y(c,A),l=U(c),p=S(c.textStyle)?c.textStyle:void 0;!Object.values(u).some(Boolean)&&!Object.keys(l).length&&!p||s.set(a,{stamp:Z(n,a),declarations:u,...Object.keys(l).length?{phone:l}:{},...p?{textStyle:p}:{}})}const d=new Map;for(const[a,{keys:c,partKeys:u}]of i){const l=u.size===1?[...u][0]:c.size===1?[...c][0]:null;if(!l)continue;const p=r(l);if(!Object.hasOwn(e,p))continue;const f=T(e[p])??{},g=y(f,A,{blockDrawsStyle:o(l)}),x=U(f),R=S(f.textStyle)?f.textStyle:void 0;!Object.values(g).some(Boolean)&&!Object.keys(x).length&&!R||d.set(a,{stamp:Z(n,l),declarations:g,...Object.keys(x).length?{phone:x}:{},...R?{textStyle:R}:{}})}return d.size||s.size?{rules:d,kindRules:s,drawn:new Set(i.keys())}:null}function Vt(t){return t.startsWith("@")}function xe(t,e){return t?.kindRules.get(e)??null}function Z(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function he(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const d=Object.entries(s).filter(([,f])=>f!==""),a=f=>f.map(([g,x])=>`${Zt(g)}: ${x}`).join("; "),c=`[${rt}="${i}"]`,u=d.filter(([f])=>!$.has(f)),l=d.filter(([f])=>$.has(f));u.length&&e.push(`${c}, *:has(> ${c}) { ${a(u)} }`),l.length&&e.push(`${c} { ${a(l)} }`),s[b]&&e.push(...Yt(c));const p=Object.entries(o.phone??{}).filter(([,f])=>f!=="");p.length&&e.push(`@media ${nt} { ${c}, *:has(> ${c}) { ${a(p)} } }`)};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
2
+ `)}function Yt(t){const e=`var(${b})`,n=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${e} }`,`${t} ${n}:not(:first-child) { margin-top: ${e} }`,`${t} ${n}:not(:last-child) { margin-bottom: ${e} }`]}const Zt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function ge(t,e){if(!t)return null;const n=N(e),r=t.rules.get(n);if(r)return r;if(n.length<qt||t.drawn.has(n))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(n)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const qt=8;export{k as PART_ALIGNS,Tt as PART_LETTER_EM_MAX,Pt as PART_LETTER_EM_MIN,ht as PART_LETTER_STEP,mt as PART_LINE_HEIGHT_MAX,St as PART_LINE_HEIGHT_MIN,xt as PART_LINE_STEP,W as PART_MEASURED_TRACKS,ct as PART_NUDGE_MAX,at as PART_NUDGE_MIN,ft as PART_PADDING_MAX,lt as PART_PADDING_MIN,ut as PART_PADDING_STEP,Y as PART_PARAGRAPH_ATTR,bt as PART_PARAGRAPH_MAX,_t as PART_PARAGRAPH_MIN,b as PART_PARAGRAPH_VAR,gt as PART_RELATIVE_PROPS,j as PART_SIZE_MAX,D as PART_SIZE_MIN,rt as PART_STYLED_ATTR,w as PART_STYLES_PROP,Bt as PART_STYLE_PROPERTIES,st as PART_WEIGHTS,E as PART_WIDTH_MAX,pt as PART_WIDTH_MIN,dt as PART_WIDTH_STEP,M as SHARED_PART_PROPERTIES,z as STYLE_ID_OF_ROLE,L as TEXT_STYLE_ATTR,pe as applyPartStyles,ae as blockDrawsTextStyle,re as followedStyleOf,ce as isHexColour,Vt as isPartKindKey,S as isTextStyleId,Yt as paragraphRules,wt as partCaseOfTransform,It as partCaseTransform,fe as partFontKeyOf,U as partPhoneDeclarations,xe as partRuleForKind,ge as partRuleForText,Lt as partSpacingOf,le as partStyleBase,oe as partStyleCount,he as partStyleCss,y as partStyleDeclarations,kt as partStyleForScreen,ue as partStyleSource,ie as propsWithPartStyleValue,se as propsWithoutPartStyle,de as publishedPartStyles,K as readPartStyle,C as readPartStyles};
@@ -1 +1 @@
1
- import{jsx as f}from"react/jsx-runtime";import{isBackgroundBox as _}from"../../../../format/lib/content/box-background.js";import{resolveSectionPadding as h,sectionPadAttrs as r}from"../../../../format/lib/content/section-padding.js";const P={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(P)),l=new Set(["Flex","Text","Heading"]),u=new Set(["Divider"]),T=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),g=new Set(["ProductGrid"]);function a(t,n,o=!1){const d=t.render;t.render=e=>{if(n?.(e))return d(e);const i=o?r(e.sectionPaddingTop,e.sectionPaddingBottom,e.sectionPaddingTopPhone,e.sectionPaddingBottomPhone,e.sectionPaddingLeft,e.sectionPaddingRight,e.sectionPaddingLeftPhone,e.sectionPaddingRightPhone):r(e.sectionPaddingTop,e.sectionPaddingBottom,e.sectionPaddingTopPhone,e.sectionPaddingBottomPhone),s=d(e);return i?f("div",{className:i.className,style:i.style,children:s}):s}}const A={name:"sectionPadding",applies:(t,n,o)=>n.isSection(t)&&!T.has(t)&&!!o&&typeof o.render=="function",panel(t,n,o){c.has(n)||g.has(n)||(t.fields={...t.fields,...o.sidesPaddingFields()})},draw(t,n){if(c.has(n)){const o=t.render,d=P[n];t.render=e=>{const i=h(e,d);return o({...e,padTop:i.top,padBottom:i.bottom})};return}if(g.has(n)){a(t);return}l.has(n)||u.has(n)||a(t,n==="Flex"?o=>_(o.bgImage):void 0,!0)}},S=["Heading","Text"],m=["LogoBlock"],D={name:"blockPadding",applies:(t,n,o)=>(S.includes(t)||m.includes(t))&&!!o&&typeof o.render=="function",panel(t,n,o){t.fields={...t.fields,...o.sidesPaddingFields()}},draw(t,n){l.has(n)||a(t,void 0,!0)}};export{u as PADS_ITS_OWN_SPACE,l as PAD_ON_ROOT,c as SECTION_PAD_INNER,P as SECTION_PAD_INNER_DEFAULTS,D as blockPadding,A as sectionPadding};
1
+ import{jsx as _}from"react/jsx-runtime";import{isBackgroundBox as f}from"../../../../format/lib/content/box-background.js";import{SECTION_PAD_KEYS as u,padValuesOf as S,resolveSectionPadding as p,sectionPadAttrs as T}from"../../content/section-padding.js";const d={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}},l=new Set(Object.keys(d)),c=new Set(["Flex","Text","Heading"]),g=new Set(["Divider"]),m=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),P=new Set(["ProductGrid"]);function i(t,e,n=!1){const s=t.render;t.render=o=>{if(e?.(o))return s(o);const r=T(S(o,u,n)),a=s(o);return r?_("div",{className:r.className,style:r.style,children:a}):a}}const I={name:"sectionPadding",applies:(t,e,n)=>e.isSection(t)&&!m.has(t)&&!!n&&typeof n.render=="function",panel(t,e,n){l.has(e)||P.has(e)||(t.fields={...t.fields,...n.sidesPaddingFields()})},draw(t,e){if(l.has(e)){const n=t.render,s=d[e];t.render=o=>{const r=p(o,s);return n({...o,padTop:r.top,padBottom:r.bottom})};return}if(P.has(e)){i(t);return}c.has(e)||g.has(e)||i(t,e==="Flex"?n=>f(n.bgImage):void 0,!0)}},A=["Heading","Text"],D=["LogoBlock"],N={name:"blockPadding",applies:(t,e,n)=>(A.includes(t)||D.includes(t))&&!!n&&typeof n.render=="function",panel(t,e,n){t.fields={...t.fields,...n.sidesPaddingFields()}},draw(t,e){c.has(e)||i(t,void 0,!0)}};export{g as PADS_ITS_OWN_SPACE,c as PAD_ON_ROOT,l as SECTION_PAD_INNER,d as SECTION_PAD_INNER_DEFAULTS,N as blockPadding,I as sectionPadding};
@@ -5,7 +5,6 @@ export declare const PART_ATTR = "data-sf-part";
5
5
  export declare const REGION_PART_ATTR = "data-sf-region-part";
6
6
  export declare const PART_ROW_ATTR = "data-sf-part-row";
7
7
  export declare function encodePartRow(key: string, index: number): string;
8
- export declare const PART_SELECTED_ATTR = "data-sf-part-selected";
9
8
  export declare const PART_KIND_ATTR = "data-sf-part-kind";
10
9
  export declare const PART_STYLE_OWNER_ATTR = "data-sf-part-style-owner";
11
10
  export declare const PART_STYLE_KIND_ATTR = "data-sf-part-style-kind";
@@ -23,7 +22,6 @@ export type PartNeedle = {
23
22
  row?: PartRow;
24
23
  };
25
24
  export { decodePartId, encodePartId };
26
- export declare function partOpenOn(selectedPartId: string | null, nodeId: string): boolean;
27
25
  export declare function normalizePartText(value: string): string;
28
26
  export declare function holdsAuthoredText(field: unknown): boolean;
29
27
  export declare function partLabel(field: Record<string, unknown>, key: string): string;
@@ -1 +1 @@
1
- import{decodePartId as m,encodePartId as P}from"efficient-easel/draw";import{stripMarkup as R}from"../../../format/lib/markup.js";import{LINK_FIELD_MARKER as A,SCAFFOLD_FIELD_MARKER as y,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as _}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as g}from"efficient-easel/draw";import{isStructuralTextProp as b}from"../../../format/lib/document/neutralization-contracts.js";import{fieldInOwnBox as L}from"../../../format/lib/document/own-box.js";import{partRowTexts as S}from"./part-rows.js";import{nonEmptyString as I}from"../../../format/lib/non-empty-string.js";const W="data-sf-part",$="data-sf-region-part",G="data-sf-part-row";function q(e,t){return`${e}[${t}]`}const J="data-sf-part-selected",Q="data-sf-part-kind",j="data-sf-part-style-owner",N="data-sf-part-style-kind";function U(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(N);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-easel-block"))return null}return null}const h=2;function V(e,t){if(!e)return!1;const r=m(e);return!!r?.propKey&&r.nodeId===t}function E(e){return R(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=_(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[A]){if(e.type==="text"||e.type==="textarea"){const s=I(t);s&&r.push(s);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function Z(e){if(!e||typeof e!="object")return!1;const t=e;return t[A]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function v(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||b(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[y]!==void 0&&l(o,o[y],i);const c=w(o,n),a=new Set;for(const{row:T,text:f}of S(o,t?.[n])){const d=E(f);d.length<h||(a.add(d),r.push({key:n,label:c,texts:[d],row:T}))}const p=new Set(a),x=[];for(const T of i){const f=E(T);f.length<h||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const K=g;function O(e,t){if(!t||typeof t!="object"||b(e)||L(t))return null;const r=t[u];return!r||!K.includes(r.control)?null:r}function tt(e,t){const r=O(e,t);return r!==null&&r.identifier!==!0}function et(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=O(n,s);if(!o)continue;const{text:i,hidden:c}=_(t?.[n]),a=i||o.placeholder||"",p=R(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{W as PART_ATTR,Q as PART_KIND_ATTR,G as PART_ROW_ATTR,J as PART_SELECTED_ATTR,N as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,$ as REGION_PART_ATTR,m as decodePartId,P as encodePartId,q as encodePartRow,O as entryPartMetaOf,tt as fieldDrawsEntryRow,Z as holdsAuthoredText,E as normalizePartText,F as partHeadLabel,w as partLabel,v as partNeedles,V as partOpenOn,U as partStyleOwnerOf,et as sectionTextParts};
1
+ import{decodePartId as O,encodePartId as P}from"efficient-easel/draw";import{stripMarkup as m}from"../../../format/lib/markup.js";import{LINK_FIELD_MARKER as R,SCAFFOLD_FIELD_MARKER as A,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as y}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as g}from"efficient-easel/draw";import{isStructuralTextProp as _}from"../../../format/lib/document/neutralization-contracts.js";import{fieldInOwnBox as L}from"../../../format/lib/document/own-box.js";import{partRowTexts as I}from"./part-rows.js";import{nonEmptyString as S}from"../../../format/lib/non-empty-string.js";const W="data-sf-part",$="data-sf-region-part",G="data-sf-part-row";function q(e,t){return`${e}[${t}]`}const J="data-sf-part-kind",j="data-sf-part-style-owner",N="data-sf-part-style-kind";function Q(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(j),n=t.getAttribute(N);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-easel-block"))return null}return null}const b=2;function h(e){return m(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=y(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[R]){if(e.type==="text"||e.type==="textarea"){const s=S(t);s&&r.push(s);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function U(e){if(!e||typeof e!="object")return!1;const t=e;return t[R]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function w(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function F(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function V(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||_(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[A]!==void 0&&l(o,o[A],i);const c=w(o,n),a=new Set;for(const{row:T,text:f}of I(o,t?.[n])){const d=h(f);d.length<b||(a.add(d),r.push({key:n,label:c,texts:[d],row:T}))}const p=new Set(a),x=[];for(const T of i){const f=h(T);f.length<b||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const K=g;function E(e,t){if(!t||typeof t!="object"||_(e)||L(t))return null;const r=t[u];return!r||!K.includes(r.control)?null:r}function Z(e,t){const r=E(e,t);return r!==null&&r.identifier!==!0}function v(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=E(n,s);if(!o)continue;const{text:i,hidden:c}=y(t?.[n]),a=i||o.placeholder||"",p=m(a).replace(/\s+/gu," ").trim();r.push({key:n,label:F(w(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{W as PART_ATTR,J as PART_KIND_ATTR,G as PART_ROW_ATTR,N as PART_STYLE_KIND_ATTR,j as PART_STYLE_OWNER_ATTR,$ as REGION_PART_ATTR,O as decodePartId,P as encodePartId,q as encodePartRow,E as entryPartMetaOf,Z as fieldDrawsEntryRow,U as holdsAuthoredText,h as normalizePartText,F as partHeadLabel,w as partLabel,V as partNeedles,Q as partStyleOwnerOf,v as sectionTextParts};
@@ -1,2 +1,2 @@
1
- import{defaultTextStyles as N,textStyleCaseCss as X}from"efficient-easel/text-styles/model";import{FONT_OPTIONS as Y,normalizeFonts as I}from"../../../format/lib/fonts.js";import{PART_PHONE_MAX_CSS as G,STYLE_ID_OF_ROLE as U,TEXT_STYLE_ATTR as Z,partSpacingOf as q}from"../document/part-styles.js";import{faceClassOf as L}from"../../../format/lib/text-style-face.js";import{compressionMetrics as B,headingTypographyFromRow as K,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 T=e=>e==="sentence"?"none":void 0,F=["font","color","size","sizePhone","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function p(e){const i={};for(const n of F)e[n]!==void 0&&(i[n]=e[n]);return i}function H(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 R(e){const i=e.fonts,n=e.sizes,t=e.typography,o=B(e.compression),r={"heading-1":{font:_(i.heading),size:m(n.headingLarge),weight:m(t.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:T(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:T(t.case2)},"heading-3":{font:_(i.heading3),size:m(n.headingSmall),weight:m(t.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:T(t.case3)},"body-1":{font:_(i.body),size:m(n.body)},"body-5":{font:_(i.label),size:m(n.label)}};return N().map(({id:a,kind:l,name:d})=>({id:a,kind:l,name:d,values:p(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=>H({...n,values:p(n.values??{})},Array.isArray(n.auto)?n.auto:void 0)):null}function fe(e){return C(e)??[]}function M(e){return C(e)??N().map(({id:i,kind:n,name:t})=>({id:i,kind:n,name:t,values:{}}))}function O(e,i){const n=R(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:p({...r,...o.values})}}):n}const w=(e,i)=>e.find(n=>n.id===i)?.values??{},V=["heading-1","heading-2","heading-3"];function ge({saved:e,old:i,cur:n,next:t,sizeOf:o}){const r=R(i),a=M(e),l=O(a,i),d=[],S=t.map(s=>{const c=n.find(f=>f.id===s.id),b=a.find(f=>f.id===s.id);if(!c||!b)return Q([s],o)[0];const u={...b.values},z=new Set(b.auto??[]),v=s.values,P=c.values,A=[...new Set([...Object.keys(v),...Object.keys(P)])].filter(f=>JSON.stringify(v[f])!==JSON.stringify(P[f]));A.sort((f,y)=>+(f==="letterSpacing")-+(y==="letterSpacing"));for(const f of A){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=x($/100,3);else if(f==="letterSpacing"){const J=l.find(W=>W.id===s.id),E=o({...s,values:p({...J?.values??{},...u})});u.letterSpacing=E?x($/E,4):0}else u[y]=$}return H({id:s.id,kind:s.kind,name:s.name,values:p(u)},z)});let g=i.compression;if(d.some(([s,c])=>(c==="lineHeight"||c==="letterSpacing")&&V.includes(s))&&k(g)!=="normal"){for(const s of V){const c=S.find(u=>u.id===s);if(!c)continue;const b={...c.values};for(const u of["lineHeight","letterSpacing"])d.some(([z,v])=>z===s&&v===u)||b[u]===void 0&&!(c.auto??[]).includes(u)&&(b[u]=w(r,s)[u]);c.values=p(b)}g="normal"}return{saved:S,old:{...i,compression:g}}}function pe(e,i){const n={text_styles:e.saved};return e.old.compression!==i.compression&&(n.heading_compression=k(e.old.compression)),n}const x=(e,i)=>Number(e.toFixed(i));function he(e,i){return e.map(n=>{const{lineHeight:t,letterSpacing:o,...r}=n.values,a={...r};return t!==void 0&&(a.lineSpacing=x(t*100,1)),o!==void 0&&(a.letterSpacing=x(o*i(n),2)),{id:n.id,kind:n.kind,name:n.name,values:a}})}function Q(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:p({...r})},l={...a.values};if(t!==void 0&&(l.lineHeight=x(t/100,3)),o!==void 0){const d=i({...a,values:{...a.values}});l.letterSpacing=d?x(o/d,4):0}return{...a,values:p(l)}})}function me(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:K(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,g=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:{...g,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 ye(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 ee(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":/^#[0-9a-f]{6}$/i.test(e)?e:null}function ne(e){const i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:first-child) { margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:last-child) { margin-bottom: var(--sf-part-para) }`]}function Se(e){const i=[];for(const n of e){const t=n.values,o=`.${L(n)}`,r=`[${Z}="${n.id}"]`,a=`${o}, ${r}`,l=[],d=t.font!==void 0?Y.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?ee(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 g=[];t.lineHeight!==void 0&&g.push(`line-height: ${t.lineHeight}`),t.letterSpacing!==void 0&&g.push(`letter-spacing: ${t.letterSpacing}em`),n.kind==="body"&&l.push(...g);const h=X(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"&&g.length&&i.push(`${a}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${g.join("; ")} }`),n.kind==="heading"&&h&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${h} }`),t.paragraphSpacing&&i.push(...ne(`:is(${a})`)),t.sizePhone!==void 0){const s=te[n.id],c=[`${a} { font-size: ${t.sizePhone}px }`];s&&c.push(`.sf-themed-content { --size-${s}: ${t.sizePhone}px !important }`),i.push(`@media ${G} { ${c.join(" ")} }`)}}return i.join(`
2
- `)}const te={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function be(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function xe(e){return e?U[e]:void 0}function ie(e){const i=q(e);return p({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 ze(e){return Object.keys(ie(e)).length>0}function ve({saved:e,old:i,styleId:n,values:t}){const o=M(e);return{saved:oe(o,n,t),old:i}}function oe(e,i,n){return e.map(t=>t.id===i?H({...t,values:p({...t.values,...n})},t.auto):t)}function _e(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{be as accentItalicCss,ge as applyListChange,_e as eyebrowStyleId,L as faceClassOf,Q as fromPanelStyles,ze as hasStyleChange,pe as listChangePatch,M as listToWrite,ie as partStyleToTextStyleValues,ve as pushIntoStyle,O as resolveTextStyles,oe as setStyleValues,me as siteTextFromRow,fe as storedTextStyles,xe as styleIdOfRole,Se as textStylesCss,R as textStylesFromOld,D as textStylesToOld,ye as themeWithTextStyles,he as toPanelStyles};
1
+ import{defaultTextStyles as A,textStyleCaseCss as Y}from"efficient-easel/text-styles/model";import{FONT_OPTIONS as G,normalizeFonts as I}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as U}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as X,TEXT_STYLE_ATTR as Z,partSpacingOf as q}from"../document/part-styles.js";import{faceClassOf as L}from"../../../format/lib/text-style-face.js";import{compressionMetrics as B,headingTypographyFromRow as K,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 T=e=>e==="sentence"?"none":void 0,F=["font","color","size","sizePhone","weight","italic","lineHeight","letterSpacing","paragraphSpacing","letterCase","largestSize"];function p(e){const i={};for(const n of F)e[n]!==void 0&&(i[n]=e[n]);return i}function H(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=B(e.compression),r={"heading-1":{font:_(i.heading),size:m(n.headingLarge),weight:m(t.weight),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:T(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:T(t.case2)},"heading-3":{font:_(i.heading3),size:m(n.headingSmall),weight:m(t.weight3),lineHeight:o.lineHeight,letterSpacing:o.letterSpacing,letterCase:T(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:p(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=>H({...n,values:p(n.values??{})},Array.isArray(n.auto)?n.auto:void 0)):null}function ge(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:p({...r,...o.values})}}):n}const w=(e,i)=>e.find(n=>n.id===i)?.values??{},V=["heading-1","heading-2","heading-3"];function pe({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(u=>u.id===s.id),b=a.find(u=>u.id===s.id);if(!c||!b)return Q([s],o)[0];const f={...b.values},z=new Set(b.auto??[]),v=s.values,E=c.values,N=[...new Set([...Object.keys(v),...Object.keys(E)])].filter(u=>JSON.stringify(v[u])!==JSON.stringify(E[u]));N.sort((u,y)=>+(u==="letterSpacing")-+(y==="letterSpacing"));for(const u of N){const y=u==="lineSpacing"?"lineHeight":u,$=v[u];if($===void 0){delete f[y],w(r,s.id)[y]!==void 0&&(d.push([s.id,y]),z.add(y));continue}if(z.delete(y),u==="lineSpacing")f.lineHeight=x($/100,3);else if(u==="letterSpacing"){const J=l.find(W=>W.id===s.id),P=o({...s,values:p({...J?.values??{},...f})});f.letterSpacing=P?x($/P,4):0}else f[y]=$}return H({id:s.id,kind:s.kind,name:s.name,values:p(f)},z)});let g=i.compression;if(d.some(([s,c])=>(c==="lineHeight"||c==="letterSpacing")&&V.includes(s))&&k(g)!=="normal"){for(const s of V){const c=S.find(f=>f.id===s);if(!c)continue;const b={...c.values};for(const f of["lineHeight","letterSpacing"])d.some(([z,v])=>z===s&&v===f)||b[f]===void 0&&!(c.auto??[]).includes(f)&&(b[f]=w(r,s)[f]);c.values=p(b)}g="normal"}return{saved:S,old:{...i,compression:g}}}function he(e,i){const n={text_styles:e.saved};return e.old.compression!==i.compression&&(n.heading_compression=k(e.old.compression)),n}const x=(e,i)=>Number(e.toFixed(i));function me(e,i){return e.map(n=>{const{lineHeight:t,letterSpacing:o,...r}=n.values,a={...r};return t!==void 0&&(a.lineSpacing=x(t*100,1)),o!==void 0&&(a.letterSpacing=x(o*i(n),2)),{id:n.id,kind:n.kind,name:n.name,values:a}})}function Q(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:p({...r})},l={...a.values};if(t!==void 0&&(l.lineHeight=x(t/100,3)),o!==void 0){const d=i({...a,values:{...a.values}});l.letterSpacing=d?x(o/d,4):0}return{...a,values:p(l)}})}function ye(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:K(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,g=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:{...g,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 Se(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 ee(e){return e==="accent"?"var(--accent)":e==="text"?"var(--fg)":e==="labels"?"var(--fg-dim)":/^#[0-9a-f]{6}$/i.test(e)?e:null}function ne(e){const i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:first-child) { margin-top: var(--sf-part-para) }`,`${e} ${i}:not(:last-child) { margin-bottom: var(--sf-part-para) }`]}function be(e){const i=[];for(const n of e){const t=n.values,o=`.${L(n)}`,r=`[${Z}="${n.id}"]`,a=`${o}, ${r}`,l=[],d=t.font!==void 0?G.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?ee(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 g=[];t.lineHeight!==void 0&&g.push(`line-height: ${t.lineHeight}`),t.letterSpacing!==void 0&&g.push(`letter-spacing: ${t.letterSpacing}em`),n.kind==="body"&&l.push(...g);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"&&g.length&&i.push(`${a}, ${o}:is(h1, h2, h3, h4), ${r}:is(h1, h2, h3, h4) { ${g.join("; ")} }`),n.kind==="heading"&&h&&i.push(`${r}, ${o}:is(h1, h2, h3, h4) { text-transform: ${h} }`),t.paragraphSpacing&&i.push(...ne(`:is(${a})`)),t.sizePhone!==void 0){const s=te[n.id],c=[`${a} { font-size: ${t.sizePhone}px }`];s&&c.push(`.sf-themed-content { --size-${s}: ${t.sizePhone}px !important }`),i.push(`@media ${U} { ${c.join(" ")} }`)}}return i.join(`
2
+ `)}const te={"heading-1":"headingLarge","heading-2":"headingMedium","heading-3":"headingSmall","body-1":"body","body-5":"label"};function xe(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function ze(e){return e?X[e]:void 0}function ie(e){const i=q(e);return p({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 ve(e){return Object.keys(ie(e)).length>0}function _e({saved:e,old:i,styleId:n,values:t}){const o=R(e);return{saved:oe(o,n,t),old:i}}function oe(e,i,n){return e.map(t=>t.id===i?H({...t,values:p({...t.values,...n})},t.auto):t)}function $e(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{xe as accentItalicCss,pe as applyListChange,$e as eyebrowStyleId,L as faceClassOf,Q as fromPanelStyles,ve as hasStyleChange,he as listChangePatch,R as listToWrite,ie as partStyleToTextStyleValues,_e as pushIntoStyle,O as resolveTextStyles,oe as setStyleValues,ye as siteTextFromRow,ge as storedTextStyles,ze as styleIdOfRole,be as textStylesCss,M as textStylesFromOld,D as textStylesToOld,Se as themeWithTextStyles,me as toPanelStyles};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "43.0.0",
3
+ "version": "44.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",
@@ -1 +0,0 @@
1
- import{finiteNumber as s}from"../finite-number.js";import{nonEmptyString as c}from"../non-empty-string.js";import{padSideAttrs as g}from"./section-padding.js";const i={top:"buttonPaddingTop",right:"buttonPaddingRight",bottom:"buttonPaddingBottom",left:"buttonPaddingLeft"},y="px-6 py-4",x=4,d=t=>{const o=new RegExp(`\\bp${t}-(?:\\[(\\d+)px\\]|(\\d+))`).exec(y);if(!o)throw new Error(`BUTTON_PAD_CLASSES has no p${t}`);return o[1]!==void 0?Number(o[1]):Number(o[2])*x},B={top:d("y"),right:d("x"),bottom:d("y"),left:d("x")},b="var(--btn)",T=t=>t&&typeof t=="object"&&(s(t.width)!==void 0||c(t.color))?t:void 0,P=t=>Math.round(Math.min(Math.max(t,0),100));function S(t){const o=t.variant==="ghost",n=s(t.buttonFillOpacity),r=T(t.buttonBorder),e=c(t.buttonColor);return{fillOpacity:n!==void 0?P(n):o?0:100,border:{width:s(r?.width)??1,color:c(r?.color)??e??(o?"currentColor":b)},changed:n!==void 0||r!==void 0}}function $(t){const o=S(t);if(!o.changed)return null;const n=c(t.buttonColor)??b;return{background:o.fillOpacity===0?"transparent":o.fillOpacity===100?n:`color-mix(in srgb, ${n} ${o.fillOpacity}%, transparent)`,borderWidth:o.border.width,borderStyle:"solid",borderColor:o.border.color}}function A(t){const o={top:t[i.top],right:t[i.right],bottom:t[i.bottom],left:t[i.left]},n={top:t[`${i.top}Phone`],right:t[`${i.right}Phone`],bottom:t[`${i.bottom}Phone`],left:t[`${i.left}Phone`]},{classes:r,style:e}=g(o,n);return Object.keys(e).length?{className:r.join(" "),style:e}:null}const f="upper";function I(t,o,n){const r=t&&typeof t=="object"?t:{},e=c(r.textStyle),u=e?c(o?.find(h=>h?.id===e)?.name):void 0,l=e?/^(heading|body)-(\d+)$/.exec(e):null,p=e?u||(l?n.styleName({kind:l[1],n:Number(l[2])}):e):n.noStyle,{cases:a}=n,m=c(r.case)??f;return`${p} · ${a[m]??a[f]}`}export{B as BUTTON_PAD_BUILT_IN,y as BUTTON_PAD_CLASSES,i as BUTTON_PAD_KEYS,f as BUTTON_WORDS_BUILT_IN_CASE,b as SITE_BUTTON_FILL,S as buttonLook,A as buttonPadAttrs,$ as buttonPaint,I as buttonWordsSummary};
@@ -1 +0,0 @@
1
- import{finiteNumber as s}from"../finite-number.js";const E={min:10,max:200,step:10};function u(t,e){const o=s(t),n=s(e);if(!(o===void 0&&n===void 0))return{paddingTop:o,paddingBottom:n}}const g="sf-pad-top-phone",l="sf-pad-bottom-phone",_="--sf-pad-t-phone",m="--sf-pad-b-phone",A="sf-pad-left-phone",x="sf-pad-right-phone",O="--sf-pad-l-phone",T="--sf-pad-r-phone";function a(t,e,o,n,i,r,P,c){const p=u(t,e),d=S({left:i,right:r},{top:o,bottom:n,left:P,right:c});return p===void 0&&!d.classes.length&&!Object.keys(d.style).length?null:{className:["sf-section-pad",...d.classes].join(" "),style:{...p,...d.style}}}const b=[["top","paddingTop",g,_],["bottom","paddingBottom",l,m],["left","paddingLeft",A,O],["right","paddingRight",x,T]];function S(t,e){const o={},n={},i=[];for(const[r,P,c,p]of b){const d=s(t[r]);d!==void 0&&(o[P]=d);const f=s(e[r]);f!==void 0&&(i.push(c),n[p]=`${f}px`)}return{classes:i,style:{...o,...n}}}function h(t,e,o){const n=s(t)??o,i=s(e);return n===void 0?i:i===void 0?n:n+i}function N(t,e={}){return{top:h(t.padTop,t.sectionPaddingTop,e.top),bottom:h(t.padBottom,t.sectionPaddingBottom,e.bottom)}}function H(t){return{top:t.sectionPaddingTop,bottom:t.sectionPaddingBottom,topPhone:t.sectionPaddingTopPhone,bottomPhone:t.sectionPaddingBottomPhone,left:t.sectionPaddingLeft,right:t.sectionPaddingRight,leftPhone:t.sectionPaddingLeftPhone,rightPhone:t.sectionPaddingRightPhone}}function L(t){return a(t.top,t.bottom,t.topPhone,t.bottomPhone,t.left,t.right,t.leftPhone,t.rightPhone)}function R(t,e){const o=n=>typeof n=="number"?n+e:void 0;return a(o(t.top),o(t.bottom),o(t.topPhone),o(t.bottomPhone),t.left,t.right,t.leftPhone,t.rightPhone)}export{l as PAD_BOTTOM_PHONE_CLASS,m as PAD_BOTTOM_PHONE_VAR,A as PAD_LEFT_PHONE_CLASS,O as PAD_LEFT_PHONE_VAR,x as PAD_RIGHT_PHONE_CLASS,T as PAD_RIGHT_PHONE_VAR,g as PAD_TOP_PHONE_CLASS,_ as PAD_TOP_PHONE_VAR,E as SECTION_PADDING,S as padSideAttrs,H as padValuesOf,N as resolveSectionPadding,R as rootPadAttrs,a as sectionPadAttrs,u as sectionPadStyle,L as wrapperPadAttrs};