efficient-web-builder 74.0.0 → 74.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/editor/components/PreviewPartAnchors.d.ts +2 -1
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/lib/document/controls.d.ts +2 -0
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/own-pad-fields.d.ts +7 -1
- package/dist/editor/lib/document/own-pad-fields.js +1 -1
- package/dist/format/lib/content/borders.d.ts +2 -1
- package/dist/format/lib/content/borders.js +1 -1
- package/dist/format/lib/document/blocks/block-types.d.ts +1 -0
- package/dist/format/lib/document/passes/types.d.ts +4 -2
- package/dist/format/lib/editor-words-catalogue.d.ts +2 -0
- package/dist/format/lib/editor-words-catalogue.js +1 -1
- package/dist/format/lib/sections/strip-shape.d.ts +1 -0
- package/dist/format/lib/sections/strip-shape.js +1 -1
- package/dist/format/lib/theme.d.ts +2 -1
- package/dist/format/lib/theme.js +3 -3
- package/dist/render/components/Breadcrumb.d.ts +4 -1
- package/dist/render/components/Breadcrumb.js +1 -1
- package/dist/render/components/PhoneMenuTools.d.ts +3 -1
- package/dist/render/components/PhoneMenuTools.js +1 -1
- package/dist/render/components/PublishedPartStylesContext.d.ts +2 -1
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/components/SpecStrip.d.ts +4 -1
- package/dist/render/components/SpecStrip.js +1 -1
- package/dist/render/lib/content/section-padding.d.ts +24 -14
- package/dist/render/lib/content/section-padding.js +1 -1
- package/dist/render/lib/document/blocks/general/Breadcrumb/render.js +1 -1
- package/dist/render/lib/document/blocks/general/SpecStrip/render.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.d.ts +1 -0
- package/dist/render/lib/document/blocks/general/section-to-box-row-parts.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-pageheader.js +1 -1
- package/dist/render/lib/document/blocks/general/section-to-box-rows-strip.js +1 -1
- package/dist/render/lib/document/part-styles.d.ts +7 -4
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/clickable-parts.js +1 -1
- package/dist/render/lib/document/passes/section-padding.d.ts +2 -1
- package/dist/render/lib/document/passes/section-padding.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{storedUnit as
|
|
1
|
+
import{storedUnit as v}from"../../../format/lib/content/css-length.js";import{VIEW_TIERS as D,phoneKey as k,resolveViewValue as tt,tabletKey as H,viewKeyAt as p}from"efficient-easel/draw";import{ownEntry as ot}from"../../../format/lib/own-entry.js";import{SECTION_PAD_UNIT_KEY as M,SITE_SIDE as et,VIEW_ABOVE as nt,convertLength as j,isLengthUnit as st,isSiteSide as G,sideLengthAt as it,sideValueAt as rt,withLength as O}from"efficient-easel/screen/lib/content/length-units";import{siteSideRoom as K}from"../../../format/lib/content/page-width.js";import{viewRules as dt}from"../../../format/lib/content/view-overrides.js";import{EDGE_LINE_ATTRS as at}from"../../../format/lib/content/view-lines.js";import{finiteNumber as c}from"../../../format/lib/finite-number.js";const Y={min:10,max:200,step:10};function pt(t,e,o,i=0){const n=c(t),r=c(e);if(n===void 0&&r===void 0)return;const s=x(o),d=a=>a===void 0?void 0:s==="px"?a:O(a,s,i);return{paddingTop:d(n),paddingBottom:d(r)}}const x=t=>v(t),L=(t,e)=>typeof t=="object"?t[e]:t??0,ct={top:"top",bottom:"bottom"};function lt(t,e,o,i){const n=c(t),r=c(e);if(n===void 0&&r===void 0)return;const s=x(o),d=(a,u)=>a===void 0?void 0:s==="px"?a:O(a,s,u);return{paddingTop:d(n,i("top","desktop")),paddingBottom:d(r,i("bottom","desktop"))}}const ft="sf-pad-top-phone",ut="sf-pad-bottom-phone",mt="--sf-pad-t-phone",bt="--sf-pad-b-phone",Tt="sf-pad-left-phone",_t="sf-pad-right-phone",At="--sf-pad-l-phone",Pt="--sf-pad-r-phone",ht="sf-pad-top-tablet",xt="sf-pad-bottom-tablet",gt="sf-pad-left-tablet",Et="sf-pad-right-tablet",St="--sf-pad-t-tablet",Dt="--sf-pad-b-tablet",Ot="--sf-pad-l-tablet",Lt="--sf-pad-r-tablet",w="sf-section-pad";function R(t){const e={desktop:t.unit,tablet:t.unitTablet,phone:t.unitPhone},o=t.totals?.length||typeof t.frame=="object"?(r,s)=>t.totals?.includes(p(r,s))?0:L(t.frame,s):t.frame,i=typeof o=="function"?lt(t.top,t.bottom,t.unit,o):pt(t.top,t.bottom,t.unit,o),n=wt({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},e,o,t.sideSpace);return i===void 0&&!n.classes.length&&!Object.keys(n.style).length?null:{className:[w,...n.classes].join(" "),style:{...i,...n.style}}}const Nt=t=>G(t)?t:c(t),Bt=[["top","paddingTop",[ht,St],[ft,mt]],["bottom","paddingBottom",[xt,Dt],[ut,bt]],["left","paddingLeft",[gt,Ot],[Tt,At]],["right","paddingRight",[Et,Lt],[_t,Pt]]];function I(t,e,o){return!st(e)||e==="px"?t:j(t,"px",e,o,{min:0,max:Y.max,step:1})}const U=t=>{const e=nt[t];return e?[t,...U(e)]:[t]},N=Object.fromEntries(D.map(t=>[t,U(t)]));function yt(t,e,o,i={},n=0){const r={desktop:!0,tablet:e!==void 0,mobile:o!==void 0},s=(_,m,A)=>{if(m==="px")return`${_}px`;const l=N[A].find(E=>r[E])??"desktop",f=O(_,m,L(n,l));return typeof f=="number"?`${f}px`:f},d={n:t,[H("n")]:e,[k("n")]:o,u:i.desktop,[H("u")]:i.tablet,[k("u")]:i.phone},a=tt("spacing",c(t),c(e),c(o),dt()),u=(_,m,A)=>{if(rt(d,{side:"n"},_,"side",["side"])?.value===et)return K().value;const l=it(d,{side:"n"},"u",_,"side");if(!l)return;const f=m!==null&&!A&&l.unit==="px"&&typeof a[m]=="number";return s(f?a[m]:l.value,l.unit,_)},b=u("desktop",null,!0),P={},T=u("tablet","tablet",e!==void 0);T!==void 0&&(e!==void 0||T!==b)&&(P.tablet=T);const h=u("mobile","phone",o!==void 0);return h!==void 0&&(o!==void 0||h!==b)&&(P.phone=h),P}function wt(t,e,o={},i=t,n={},r=0,s="box"){const d={},a={},u=[],b=K(s);let P=!1;for(const[T,h,..._]of Bt){const m=T==="left"||T==="right"?Nt:c,A=m(t[T]),l=ot(ct,T),f=l?typeof r=="function"?{desktop:r(l,"desktop"),tablet:r(l,"tablet"),mobile:r(l,"mobile")}:r:0,E=typeof f=="object"?f.desktop:f;G(A)?(d[h]=b.value,P=!0):A!==void 0&&(d[h]=x(n.desktop)==="px"?A:O(A,x(n.desktop),E));const g=yt(m(i[T]),m(o[T]),m(e[T]),n,f);for(const[S,[Q,Z]]of[["tablet",_[0]],["phone",_[1]]]){const y=g[S];y!==void 0&&(u.push(Q),a[Z]=y,y===b.value&&(P=!0))}}return P&&u.push(...b.className.split(" ")),{classes:u,style:{...d,...a}}}function W(t,e,o){const i=c(t)??o,n=c(e);return i===void 0?n:n===void 0?i:i+n}function Xt(t,e={}){return{top:W(t.padTop,t.sectionPaddingTop,e.top),bottom:W(t.padBottom,t.sectionPaddingBottom,e.bottom)}}const $={top:"padTop",bottom:"padBottom",left:"padLeft",right:"padRight"},C="padUnit";function Rt(t,e){const o=t[C],i=(n,r,s)=>{const d=c(n)??(s===void 0?void 0:I(s,o,"desktop")),a=c(r);return a===void 0?d:(d??0)+I(a,o,"desktop")};return{top:i(t.padTop,t.sectionPaddingTop,e.top),bottom:i(t.padBottom,t.sectionPaddingBottom,e.bottom)}}function qt(t,e,o={}){const i=Rt(t,e),n={...It(t,$,!0,C),top:i.top,bottom:i.bottom};o.noTop&&Object.assign(n,{top:0,topTablet:void 0,topPhone:void 0});const r=R(n),s=r?r.className.split(" ").filter(d=>d!==w):[];return{...s.length?{className:s.join(" ")}:{},style:r?.style??{}}}const B={top:"sectionPaddingTop",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft",right:"sectionPaddingRight"},zt=[...["top","bottom","left","right"].map(t=>[$[t],B[t]]),[C,M]].flatMap(([t,e])=>[[t,e],...["tablet","mobile"].map(o=>[p(t,o),p(e,o)])]);function It(t,e=B,o=!0,i=e===B?M:void 0){const n={};if(i){t[i]!==void 0&&(n.unit=t[i]);for(const s of["tablet","mobile"])t[p(i,s)]!==void 0&&(n[p("unit",s)]=t[p(i,s)])}for(const s of o?["top","bottom","left","right"]:["top","bottom"]){n[s]=t[e[s]];for(const d of["tablet","mobile"])n[p(s,d)]=t[p(e[s],d)]}const r=t[Ct];if(Array.isArray(r)){const s=X.flatMap(d=>D.filter(a=>r.includes(p(e[d],a))).map(a=>p(d,a)));s.length&&(n.totals=s)}return n}const Ct="padTotal",X=["top","bottom"];function Jt(t=B){return X.flatMap(e=>D.map(o=>p(t[e],o)))}const V=16,F=24,Vt={text:V,heading:F,line:0},q={all:{12:"py-3",16:"py-4",24:"py-6"},edge:{12:"max-view-wide:py-3"}},Ft={[V]:q.all[V],[F]:q.all[F],[Vt.line]:""};function Qt(t,e){return{className:Ft[e]??"",...t?{pad:{values:t,frame:e}}:{}}}const Zt=t=>({desktop:t.top,tablet:t.top,mobile:t.topPhone});function vt(t,e){if(!e)return{root:J(t.values,t.frame),outer:null};if(!t.values.totals?.length)return{root:null,outer:z(t.values)};const o=t.values,{top:i,bottom:n,topTablet:r,bottomTablet:s,topPhone:d,bottomPhone:a,left:u,right:b,leftTablet:P,rightTablet:T,leftPhone:h,rightPhone:_,...m}=o,A={...m,top:i,bottom:n,topTablet:r,bottomTablet:s,topPhone:d,bottomPhone:a},l=J(t.drawsFrame?kt(A,t.frame):A,t.frame),f=l&&t.drawsFrame?{...l,className:l.className.split(" ").filter(g=>g!==w).join(" ")}:l,E=["tablet","mobile"].some(g=>["top","bottom"].some(S=>typeof o[p(S,g)]=="number"&&!o.totals?.includes(p(S,g))));return{root:f&&t.edge&&f.className&&!E?{...f,attrs:at}:f,outer:z({...m,totals:void 0,left:u,right:b,leftTablet:P,rightTablet:T,leftPhone:h,rightPhone:_})}}function kt(t,e){const o=r=>L(e,r),i={...t},n=[...t.totals??[]];for(const r of D)for(const s of["top","bottom"]){if(N[r].some(a=>c(t[p(s,a)])!==void 0))continue;const d=N[r][1];d&&o(d)===o(r)||(i[p(s,r)]=I(o(r),t[p("unit",r)],r),n.push(p(s,r)))}return{...i,totals:n}}function Ht(t,e){const o={...t};for(const i of["tablet","mobile"]){const n=p("unit",i),r=["top","bottom","left","right"].some(s=>c(t[p(s,i)])!==void 0);for(const s of["top","bottom"]){if(c(o[p(s,i)])!==void 0)continue;const d=N[i].slice(1).find(b=>c(o[p(s,b)])!==void 0);if(!d||e[d]===e[i]||t.totals?.includes(p(s,d)))continue;const a=c(o[p(s,d)]),u=x(o[p("unit",d)]);if(r){const b=x(o[n]);o[p(s,i)]=u===b?a:j(a,u,b,i,{min:0,max:Y.max,step:1})}else o[p(s,i)]=a,o[n]=o[p("unit",d)]}}return o}function z(t){return R(t)}function J(t,e){const o=typeof e=="object"?Ht(t,e):t,i=r=>L(e,r),n=(r,s,d,a)=>typeof r!="number"?void 0:x(s)==="px"&&!o.totals?.includes(d)?r+i(a):r;return R({...o,frame:e,top:n(o.top,o.unit,"top","desktop"),bottom:n(o.bottom,o.unit,"bottom","desktop"),topTablet:n(o.topTablet,o.unitTablet,"topTablet","tablet"),bottomTablet:n(o.bottomTablet,o.unitTablet,"bottomTablet","tablet"),topPhone:n(o.topPhone,o.unitPhone,"topPhone","mobile"),bottomPhone:n(o.bottomPhone,o.unitPhone,"bottomPhone","mobile")})}export{$ as BAND_PAD_KEYS,C as BAND_PAD_UNIT_KEY,zt as BAND_TO_SECTION_PAD,Vt as BLOCK_PAD_FRAME,Ft as FRAME_CLASS,F as HEADING_PAD_FRAME,ut as PAD_BOTTOM_PHONE_CLASS,bt as PAD_BOTTOM_PHONE_VAR,xt as PAD_BOTTOM_TABLET_CLASS,Dt as PAD_BOTTOM_TABLET_VAR,Tt as PAD_LEFT_PHONE_CLASS,At as PAD_LEFT_PHONE_VAR,gt as PAD_LEFT_TABLET_CLASS,Ot as PAD_LEFT_TABLET_VAR,_t as PAD_RIGHT_PHONE_CLASS,Pt as PAD_RIGHT_PHONE_VAR,Et as PAD_RIGHT_TABLET_CLASS,Lt as PAD_RIGHT_TABLET_VAR,ft as PAD_TOP_PHONE_CLASS,mt as PAD_TOP_PHONE_VAR,ht as PAD_TOP_TABLET_CLASS,St as PAD_TOP_TABLET_VAR,Ct as PAD_TOTAL_KEY,q as PY_CLASS,Y as SECTION_PADDING,w as SECTION_PAD_CLASS,B as SECTION_PAD_KEYS,V as TEXT_PAD_FRAME,qt as bandPadAttrs,Rt as bandTopBottom,L as frameAt,vt as framePadAttrs,Qt as ownPadOf,I as padDefaultIn,wt as padSideAttrs,Nt as padSideValue,Jt as padTotalKeys,It as padValuesOf,Xt as resolveSectionPadding,J as rootPadAttrs,R as sectionPadAttrs,pt as sectionPadStyle,yt as sideViewLengths,Zt as tierFramesOf,z as wrapperPadAttrs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import n from"../../../../../components/Breadcrumb.js";import{CardRowDrawn as f}from"../../../../../components/CardRowContext.js";import{namedRowField as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import n,{crumbPad as c}from"../../../../../components/Breadcrumb.js";import{CardRowDrawn as f}from"../../../../../components/CardRowContext.js";import{namedRowField as s}from"../../../../../../format/lib/content/card-template.js";import{phRows as u,phHide as b}from"../../scaffold.js";import{say as i}from"../../../../../../format/lib/editor-words.js";import{BreadcrumbMeta as p,BREADCRUMB_PH as l}from"../../../../../../format/lib/document/blocks/general/Breadcrumb/meta.js";const B=()=>[{label:i("Home"),href:"/"},{label:i("Section"),href:""}],H={...p,render:r=>{const{items:a,meta:d,editor:t}=r,m=e=>o(n,{items:u(a,B(),t),current:typeof e=="string"?e:void 0,meta:b(d,l.meta,t),editing:t?.isEditing,pad:c(r)});return s(r)?o(f,{type:"Breadcrumb",props:r,children:e=>m(e.currentCrumb)}):m()}};export{H as BreadcrumbRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import t,{specPad as r}from"../../../../../components/SpecStrip.js";import{SpecStripMeta as l}from"../../../../../../format/lib/document/blocks/general/SpecStrip/meta.js";const o={...l,render:e=>i(t,{cells:e.cells,fill:e.fill,editing:e.editor?.isEditing,pad:r(e)})};export{o as SpecStripRender};
|
|
@@ -12,6 +12,7 @@ export declare const FOLLOW_THE_BOX: Props;
|
|
|
12
12
|
export declare const SAME_KEYS: readonly BoxEntry[];
|
|
13
13
|
export declare const DROP_COMMON: Readonly<Record<string, string>>;
|
|
14
14
|
export declare const DROP_SIDE_PADDING: Readonly<Record<string, string>>;
|
|
15
|
+
export declare const DROP_PAD_TOTALS: Readonly<Record<string, string>>;
|
|
15
16
|
export type OwnPad = {
|
|
16
17
|
top: number;
|
|
17
18
|
bottom: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SECTION_CSS_KEY as
|
|
1
|
+
import{SECTION_CSS_KEY as j}from"../../../../../format/lib/content/section-css.js";import{siteLengthHeld as z,storedUnit as S}from"../../../../../format/lib/content/css-length.js";import{SECTION_WIDTH_KEYS as J}from"../../../../../format/lib/content/section-width.js";import{CELL_SPAN_KEYS as q}from"../../../../../format/lib/content/grid-span.js";import{BLOCK_LENGTH_KEYS as K,blockLengthUnitKey as Q}from"../../../content/block-size.js";import{viewStoreKeys as Z}from"../../../../../format/lib/animation/views.js";import{BOX as tt,INNER_BOX as D,LABEL_FACE as w,TEXT as G,boxPadding as ot,fillSlot as I,token as et}from"../../../../../format/lib/document/seed-parts.js";import{ENTRANCE_STORE_KEYS as nt,LEGACY_ENTRANCE_KEY as it}from"../../../animation/entrance.js";import{SCROLL_STORE_KEYS as rt}from"../../../../../format/lib/animation/scroll.js";import{SECTION_PIN_KEYS as st}from"../../../../../format/lib/content/section-sticky.js";import{SECTION_CORNERS_ROW as dt}from"../../../../../format/lib/content/section-corners.js";import{SECTION_BORDER_UNIT_KEYS as ct}from"../../../../../format/lib/content/borders.js";import{CARD_HOVER_KEYS as R}from"../../../../../format/lib/animation/hover.js";import{COUNT_KEY_PROP as at}from"../../../../../format/lib/content/block-sources.js";import{SITE_GUTTER as pt,SITE_GUTTER_PHONE as lt,normalizeSiteGutter as mt,normalizeSiteGutterPhone as gt,siteGutterPhoneFollows as ht}from"../../../../../format/lib/content/page-width.js";import{BAND_TO_SECTION_PAD as Y,PAD_TOTAL_KEY as U,SECTION_PAD_KEYS as L,bandTopBottom as ft}from"../../../content/section-padding.js";import{ButtonBlockMeta as ut}from"../../../../../format/lib/document/blocks/general/ButtonBlock/meta.js";import{innerPaddingFallback as Pt}from"../../passes/section-padding.js";import{finiteNumber as P}from"../../../../../format/lib/finite-number.js";import{convertTheme as B,hasWords as bt}from"../../../sections/section-to-box.js";import{THEME_SECTION_BG as Tt}from"../../../../../format/lib/content/section-background.js";import{fillSlotOfInk as M}from"../../../../../format/lib/document/part-inks.js";import{parseHexColor as _t}from"efficient-shell/format";import{convertLength as xt}from"efficient-easel/screen/lib/content/length-units";import{viewKeyAt as v}from"efficient-easel/draw";import{bandPresetIndex as Et,surfacePresetIndex as Ot,surfaceTwoTone as St}from"../../../../../format/lib/theme.js";import{VIEW_HIDE_KEYS as Bt}from"../../../../../format/lib/content/view-hide-class.js";import{tierOfView as Nt}from"../../../../../format/lib/content/view-tier.js";const a=(t,o,e,n)=>o===e?t:xt(t,o,e,n,{min:0,max:200,step:4});import{BOX as Go,DIM as Yo,INNER_BOX as Mo,TEXT as vo}from"../../../../../format/lib/document/seed-parts.js";const lo={textFit:"line",textFitPhone:"wrap"},Ct={...G,[at]:""},{label:mo,href:go,...At}=ut.defaultProps,ho=At,fo={buttonFillOpacity:0,buttonBorder:{width:0},buttonPaddingTop:0,buttonPaddingRight:0,buttonPaddingBottom:0,buttonPaddingLeft:0},uo={...tt,sectionAccent:0},Po={sectionAccent:-1},bo=[...q,"sectionHeightMode","sectionHeightValue","sectionHeightUnit","sectionHeightModeTablet","sectionHeightValueTablet","sectionHeightUnitTablet","sectionHeightModePhone","sectionHeightValuePhone","sectionHeightUnitPhone","sectionCorners","sectionCornerSides","sectionBorder","sectionBorderTablet","sectionBorderPhone","sectionAccent",dt.unitKey,...ct,...st,"anchor",it,...Bt,j,...nt,...rt,...Z(["widthFit",...K,...K.map(Q)]),...Object.values(J)],f="a section width key, ignored since efficient-web-builder 45 (an old key; a section's own width has new keys, lib/content/section-width), so dropping it changes nothing",To={sectionSurface:"read by nothing in src/ (searched 2026-10-24): a retired theme key that draws nothing today, so dropping it changes nothing",widthMode:f,fullWidth:f,pageWidth:f,backgroundWidth:f,contentWidth:f,contentMax:f},_o=Object.fromEntries(["sectionPaddingLeft","sectionPaddingRight","sectionPaddingLeftTablet","sectionPaddingRightTablet","sectionPaddingLeftPhone","sectionPaddingRightPhone"].map(t=>[t,"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)"])),xo={[U]:"read by `wrapperPad`: a value named here is drawn as it is, so the section's own px is not added; the Box's padding is the total"};function kt(t,o){const e=P(t.sectionPaddingTop)??0,n=P(t.sectionPaddingBottom)??0,i=P(t.sectionPaddingTopTablet),r=P(t.sectionPaddingBottomTablet),l=S(t.sectionPaddingUnit),m=S(t.sectionPaddingUnitTablet),g=S(t.sectionPaddingUnitPhone),b=Array.isArray(t[U])?t[U]:[],p=(s,u)=>b.includes(s)?0:u,T=(s,u,E,O,A,h)=>{const H=P(t[s]);if(H!==void 0)return H+a(p(s,h),"px",g,"mobile");const k=O===void 0?{n:A,unit:l,key:E}:{n:O,unit:m,key:u};return a(k.n,k.unit,g,"mobile")+a(p(k.key,h),"px",g,"mobile")},_=(s,u,E,O,A,h)=>E!==void 0?{[s]:E+a(p(s,h??A),"px",m,"tablet")}:h===void 0?{}:{[s]:a(O,l,m,"tablet")+a(p(u,h),"px",m,"tablet")},x=s=>({desktop:L[s],tablet:v(L[s],"tablet"),phone:v(L[s],"mobile")}),d=x("top"),c=x("bottom");return{[d.desktop]:e+a(p(d.desktop,o.top),"px",l,"desktop"),[c.desktop]:n+a(p(c.desktop,o.bottom),"px",l,"desktop"),..._(d.tablet,d.desktop,i,e,o.top,o.topTablet),..._(c.tablet,c.desktop,r,n,o.bottom,o.bottomTablet),[d.phone]:T(d.phone,d.tablet,d.desktop,i,e,o.topPhone),[c.phone]:T(c.phone,c.tablet,c.desktop,r,n,o.bottomPhone)}}const Eo=t=>[...["sectionPaddingTop","sectionPaddingBottom","sectionPaddingTopTablet","sectionPaddingBottomTablet","sectionPaddingTopPhone","sectionPaddingBottomPhone"].map(o=>[o,o,(e,n)=>kt(n,typeof t=="function"?t(n):t)[o]]),["sectionPaddingUnit","sectionPaddingUnit"],["sectionPaddingUnitTablet","sectionPaddingUnitTablet"],["sectionPaddingUnitPhone","sectionPaddingUnitPhone"]];function y(t,o){const e={};for(const[i,r]of Y)t[i]!==void 0&&(e[r]=t[i]);const n=ft(t,Pt(o));return{...e,sectionPaddingTop:n.top,sectionPaddingBottom:n.bottom}}const Oo=t=>[...Y.map(([o,e])=>[o,e,(n,i)=>y(i,t)[e]]),["sectionPaddingTop","sectionPaddingTop",(o,e)=>y(e,t).sectionPaddingTop],["sectionPaddingBottom","sectionPaddingBottom",(o,e)=>y(e,t).sectionPaddingBottom]],It={kind:"heading-case-upper",styles:["heading-1","heading-2","heading-3"]},So=t=>o=>bt(o.props[t])?[It]:[],Rt=(t,o)=>({kind:"text",key:t,role:"eyebrow",props:G,...o?{style:o}:{}}),Bo=t=>({kind:"group",name:"Chip",props:{...D,...I("main"),...ot(6,14)},parts:[Rt(t,{color:"background",...et("label",12),weight:600,letterSpacing:.16})]}),W=t=>t.background!=="transparent",Ut=(t,o)=>{const[e,n]=[t,o].map(i=>typeof i=="string"?i.trim():"");return e?n?`[${e} ]{color=text}${n}`:`[${e}]{color=text}`:n},F={align:"right",alignPhone:"left"},Lt=(t,o,e)=>{const n=i=>Ut(i[t],i[o]);return{kind:"block",type:"Text",when:(i,r)=>r!==void 0&&n(r)!=="",box:[[t,"text",(i,r)=>n(r)],[o,"text",(i,r)=>n(r)]],props:e}},No=(t,o,e,n={})=>Lt(t,o,{...Ct,...F,...n,_partStyles:{text:{...w,color:"labels",...e,case:w.case,...F}}}),N=(t,o)=>typeof t=="number"&&Number.isInteger(t)&&t>=0?t:B(o)?.selected??0,X="var(--site-surface-2)",V=(t,o)=>B(o)?.themes[N(t.sectionAccent??0,o)],yt=(t,o)=>(e,n)=>{if(!o?.(e,n))return I(t);const i=V(e,n)?.[t];return i?{fillColor:i}:{}},Co=(t,o)=>C(t,o)>=0,$=t=>t.startsWith("#")&&_t(t)!==null,Ao=(t,o,e)=>{const n=t?.trim();if(n&&$(n))return{fillColor:n};const i=M(n);if(i)return I(i);const r=n===X?V(o,e):void 0;return r?{fillColor:St(r)}:{}},ko=t=>{const o=t?.trim();return!o||o==="transparent"||o===Tt||M(o)||o===X||$(o)?void 0:"it paints a colour that no Box Fill can hold"},C=(t,o)=>{const e=B(o)?.themes;return e&&W(t)?Et(e,N(t.sectionAccent,o)):-1},Io=(t,o,e)=>{const n=C(o,e);return n>=0?n:t},Ro=(t,o)=>{const e=B(o)?.themes,n=e?Ot(e,N(t,o)):-1;return n>=0?n:t},Uo=(t,o)=>{const e=C(t,o);return e>=0?{sectionAccent:e}:{}},Lo=(t,o)=>W(t.props)&&C(t.props,o)<0?[{kind:"band-preset",page:N(t.props.sectionAccent,o)}]:[],yo=(t,{view:o="desktop",to:e="px",maxPx:n=1/0}={})=>{const{siteGutter:i,siteGutterUnit:r,siteGutterPhone:l,siteGutterPhoneUnit:m}=t.site??{},g=Nt(o),b=(T,_,x)=>{const d=S(_),c=z(T,d,"spacing",x);return c===null?null:a(c,d,"px",g)},p=o==="desktop"?b(i,r,pt)??mt(i):b(l,m,lt)??gt(l)??ht(i,r);return a(Math.min(n,p),"px",e,g)},Ht=Object.fromEntries(["Top","Right","Bottom","Left","TopPhone","RightPhone","BottomPhone","LeftPhone"].map(t=>[`sectionPadding${t}`,0])),Ho=t=>({top:0,right:0,bottom:0,left:0,...t}),Ko=(t,o,e,n=[])=>({kind:"group",name:t,keepEmpty:!0,props:(i,r)=>({...D,...Ht,...yt("surface")(i,r),...typeof e=="function"?e(i,r):e}),box:[[o,"bgImage"],R.kind,R.duration,R.delay],parts:n});export{lo as AUTO_COLUMN,Go as BOX,ho as BUTTON,Yo as DIM,To as DROP_COMMON,xo as DROP_PAD_TOTALS,_o as DROP_SIDE_PADDING,Po as FOLLOW_THE_BOX,It as HEADING_CASE_UPPER,Mo as INNER_BOX,Ht as NO_PAD,Ct as NUMBER_TEXT,F as RIGHT_WORDS,bo as SAME_KEYS,uo as SECTION_BOX,fo as SH_LINK,vo as TEXT,Io as bandAccent,C as bandIndex,N as bandPage,Uo as bandProps,Lo as bandWrites,yt as fillFrom,ko as fillNoBoxHolds,Bo as filledChip,So as headingCaseOf,y as innerPad,Oo as innerPadKeys,No as leadLine,Lt as leadText,Ho as lineSides,Ut as numberAndUnit,Co as onBandPreset,Ao as ownFill,Ko as pictureCell,V as sectionPage,yo as siteGutterOf,Rt as smallText,Ro as surfaceAccent,kt as wrapperPad,Eo as wrapperPadKeys};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hasWords as
|
|
1
|
+
import{hasWords as p}from"../../../sections/section-to-box.js";import{BLOCK_WIDTH_LIMIT as N}from"efficient-easel/draw";import{fluidToken as R,token as o}from"./section-head-looks.js";import{CRUMB_PAD as _,STRIP_BOX as C}from"../../../../../format/lib/sections/strip-shape.js";import{PH as i,phAccentAsMarks as W}from"../../../../../format/lib/document/blocks/placeholders.js";import{DOC_MASTHEAD_PH as d}from"../../../../../format/lib/document/blocks/general/DocMasthead/meta.js";import{PAGE_TITLE_LEVEL_PROP as U,pageTitleDemoted as f}from"../../../../../format/lib/document/one-h1.js";import{AUTO_COLUMN as s,BUTTON as v,DIM as G,DROP_COMMON as g,DROP_PAD_TOTALS as X,DROP_SIDE_PADDING as c,INNER_BOX as a,leadLine as S,RIGHT_WORDS as T,SAME_KEYS as h,SECTION_BOX as m,SH_LINK as K,smallText as r,TEXT as n,wrapperPad as b,wrapperPadKeys as u}from"./section-to-box-row-parts.js";const E={minWidth:N.min},w=(e,t,l)=>({...r(e,{...t,...T}),props:{...n,align:"right",...s,...l}}),I={top:1,bottom:0},k=(e,t,l,M)=>({kind:"group",name:e,props:{...a,sectionPaddingBottom:t,sectionPaddingBottomPhone:l},parts:[M]}),O={widthFit:"fill",...E},x={top:100,bottom:60,topPhone:60,bottomPhone:40},j={...o("label",13),letterSpacing:.22,lineHeight:1.8},B={textStyle:"heading-1",...R("headingLarge",56,8,128),case:"upper",weight:500,lineHeight:.88,letterSpacing:-.04},V=()=>({name:"Page Header",boxProps:e=>({...m,direction:"column",gap:0,sectionBorder:{bottom:1},...b(e,x)}),box:[...h,...u(x)],parts:[{kind:"group",name:"Header",props:{...a,direction:"row",align:"end",justify:"between",gap:40,gapPhone:16,share:"content",sectionPaddingBottom:32},parts:[k("Eyebrow",12,0,{...r("eyebrow",o("label",13)),props:{...n,...s}}),{kind:"text",key:"title",role:"heading",props:{...n,tag:"h1",...O},style:B,mark:"accentItalic",when:e=>!f(e)},{kind:"text",key:"title",role:"heading",props:{...n,tag:"h2",...O},style:B,mark:"accentItalic",when:f},{kind:"group",name:"Details",props:{...a,align:"stretch",gap:0,gapPhone:0,sectionPaddingBottom:12,sectionPaddingBottomPhone:0},parts:[{kind:"list",key:"meta",name:"Detail",flat:!0,parts:[S("label","value",j,s)]}]}]},{kind:"group",name:"Deck",props:{...a,maxWidth:760,sectionBorder:I,sectionPaddingTop:28},parts:[{kind:"text",key:"deck",props:G,style:{textStyle:"body-1",fontRole:"accent",...o("body",22,19),italic:!0,lineHeight:1.5}}]}],drop:{...g,...c,[U]:"read by the title part's `when`: 2 (set by lib/document/one-h1 on a later opener) makes the Text an h2, anything else an h1"}}),ne=()=>({eyebrow:d.eyebrow,title:W(d.title),deck:d.deck,meta:[{label:i.label,value:i.value},{label:i.label,value:i.value}]}),D={top:80,bottom:40,topPhone:60,bottomPhone:32},Y={...o("label",13),letterSpacing:.18,lineHeight:1.8},H={...o("label",13),letterSpacing:.22,lineHeight:1.9},F=()=>({name:"Issue Header",boxProps:e=>({...m,direction:"column",gap:0,sectionBorder:{bottom:1},...b(e,D)}),box:[...h,...u(D)],parts:[{kind:"group",name:"Top",props:{...a,direction:"row",align:"end",justify:"between",gap:60,gapPhone:16,share:"content",sectionPaddingBottom:32},parts:[k("Eyebrow",14,14,r("eyebrow",o("label",14))),{kind:"group",name:"Issue",props:{...a,align:"end",gap:0,gapPhone:0,sectionPaddingBottom:14},parts:[{kind:"list",key:"issueMeta",name:"Issue line",flat:!0,parts:[S("lead","rest",Y)]}]}]},{kind:"group",name:"Bottom",props:{...a,direction:"row",align:"start",justify:"between",gap:60,gapPhone:16,share:"content",sectionBorder:I,sectionPaddingTop:32},parts:[{kind:"text",key:"lead",props:{...n,maxWidth:720,...E},style:{textStyle:"body-1",fontRole:"heading3",...o("headingSmall",20),lineHeight:1.5,letterSpacing:-.005,paragraphSpacing:16}},{kind:"group",name:"In this issue",props:{...a,align:"stretch",gap:0},parts:[k("Heading",6,6,{kind:"text",key:"issueHeading",props:{...n,align:"right",...s},style:{textStyle:"body-1",fontRole:"heading",...o("body",18),weight:400,letterSpacing:-.01,lineHeight:1.9,...T}}),{kind:"group",name:"Lines",props:{...a,align:"stretch",gap:0},parts:[{kind:"list",key:"issueList",name:"Line",flat:!0,parts:[w("text",{color:"labels",...H})]}]},w("issueTotal",H)]}]}],drop:{...g,...c}}),P={color:"labels",...o("label",13),letterSpacing:.2},L=e=>(Array.isArray(e.items)?e.items:[]).filter(t=>t&&typeof t.label=="string"&&t.label.trim()!==""),y=(e,t)=>t!==void 0&&L(e).at(-1)===t,A=(e,t)=>t!==void 0&&L(e).includes(t),q=(e,t)=>A(e,t)&&!y(e,t)&&p(t?.href),z=()=>({name:"Breadcrumb",skip:e=>p(e.meta)?'a trailing note after "·" needs a second mark; none live':void 0,boxProps:e=>({...m,...C,wrap:"wrap",gap:16,gapPhone:16,separator:"slash",sectionBorder:{bottom:1},...b(e,_)}),box:[...h,...u(_)],parts:[{kind:"list",key:"items",name:"Crumb",flat:!0,parts:[{kind:"button",key:"label",href:"href",variant:"ghost",when:q,props:{...v,...K,icon:"none"},style:P},{...r("label",P),when:(e,t)=>A(e,t)&&!y(e,t)&&!p(t?.href)},{...r("label",{...P,color:"text"}),when:y}]}],drop:{...g,...c,meta:"a node that stores a note is skipped (`skip`); an empty one draws nothing",...X}}),re={DocMasthead:V(),Masthead:F(),Breadcrumb:z()};export{re as PAGE_HEADER_SECTION_TO_BOX,ne as pageHeaderPressStarter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mixHex as
|
|
1
|
+
import{mixHex as u}from"efficient-shell/format";import{resolveSectionAccent as r,SECTION_ACCENT_INHERIT as A}from"../../../../../format/lib/content/section-surface.js";import{parseLoopDirection as x}from"../../../../../format/lib/animation/index.js";import{parseTickerSeparator as i,SEPARATOR_GLYPH as E}from"../../../../../format/lib/sections/ticker-style.js";import{tickerJoinSide as y}from"../../../../../format/lib/sections/ticker-join.js";import{convertTheme as R}from"../../../sections/section-to-box.js";import{darkBandIndex as h}from"../../../../../format/lib/theme.js";import{DIM as s,DROP_COMMON as a,DROP_PAD_TOTALS as C,DROP_SIDE_PADDING as l,fillFrom as b,SAME_KEYS as c,sectionPage as O,SECTION_BOX as p,TEXT as B,wrapperPad as d,wrapperPadKeys as m}from"./section-to-box-row-parts.js";import{SPEC_PAD as T,SPEC_STRIP as g,SPEC_TEXT as S,STRIP_BOX as _,TICKER_BARE_GAP as N,TICKER_DISPLAY as K,TICKER_PAD as D,TICKER_SMALL as L,TICKER_STRIP as M}from"../../../../../format/lib/sections/strip-shape.js";const f=e=>e.size==="display",w=(e,t)=>{const o=O(e,t),n=e.tone!=="plain"&&o?.text&&o.background?u(o.text,o.background,.3):null;return n?{color:n}:{}},X=(e,t)=>e.tone!=="plain"&&r(e.sectionAccent)===null?b("background")(e,t):{},I=(e,t)=>({kind:"list",key:"items",name:"Item",flat:!0,when:t,parts:[{kind:"text",key:"text",props:s,style:e,styleFrom:w}]}),H={name:"Scrolling Bar",boxProps:(e,t)=>({...p,..._,...M,...E[i(e.separator)]===""?N:{},...d(e,D),...X(e,t)}),box:[["scrollDirection","scrollDirection",e=>x(e)],["speed","loopDuration",(e,t)=>t.loopDuration!=null?t.loopDuration:e],["loopDuration","loopDuration",(e,t)=>e??t.speed],["loopDelay","loopDelay",e=>e],["separator","separator",e=>i(e)],["join","join",e=>y(e)??void 0],["borders","sectionBorder",e=>e===!1?void 0:{top:1,bottom:1}],...c,["tone","sectionAccent",(e,t)=>r(t.sectionAccent)??A],...m(D)],parts:[I(L,e=>!f(e)),I(K,f)],drop:{...a,...l,size:"each item's Text style: Small → Body 5, Display → Heading 3"}},P=e=>e?.tone==="muted",k=e=>h(R(e)),F={name:"Spec Strip",boxProps:(e,t)=>({...p,..._,...g,...e.fill==="none"?{sectionBorder:{top:1}}:{sectionAccent:k(t)},...d(e,T)}),box:[...c.filter(e=>e!=="sectionAccent"),["sectionAccent","sectionAccent",(e,t,o)=>t.fill==="none"?e:k(o)],...m(T)],parts:[{kind:"list",key:"cells",name:"Cell",flat:!0,parts:[{kind:"text",key:"text",props:B,style:S,when:(e,t)=>!P(t)},{kind:"text",key:"text",props:s,style:S,when:(e,t)=>P(t)}]}],drop:{...a,...l,...C,fill:"None → no fill and a line on top. Dark band (the default) → the Box's theme is the site's first dark preset that is not its page (lib/theme `darkBandIndex`; Theme 2 with no site theme): the old fixed `plate-band` colour, as a theme"}},V={Ticker:H,SpecStrip:F};export{V as STRIP_SECTION_TO_BOX};
|
|
@@ -129,15 +129,18 @@ export declare function partCaseOfTransform(transform: string | null | undefined
|
|
|
129
129
|
export declare function partCaseTransform(value: TextStyleCase | undefined): string;
|
|
130
130
|
export type PartDeclarationOptions = {
|
|
131
131
|
blockDrawsStyle?: boolean;
|
|
132
|
+
sizeCap?: boolean;
|
|
132
133
|
};
|
|
134
|
+
export declare const PART_SIZE_CAP_VAR = "--sf-part-size-cap";
|
|
135
|
+
export declare function blockCapsPartSize(caps: Readonly<Record<string, true>> | undefined, partKey: string): boolean;
|
|
133
136
|
export declare function blockDrawsTextStyle(type: string | undefined, partKey: string): boolean;
|
|
134
137
|
export declare function partSpacingOf(style: PartStyle): {
|
|
135
138
|
lineHeight?: number;
|
|
136
139
|
letterSpacingEm?: number;
|
|
137
140
|
};
|
|
138
141
|
export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
|
|
139
|
-
export declare function partPhoneDeclarations(style: PartStyle): Record<string, string>;
|
|
140
|
-
export declare function partTabletDeclarations(style: PartStyle): Record<string, string>;
|
|
142
|
+
export declare function partPhoneDeclarations(style: PartStyle, options?: PartDeclarationOptions): Record<string, string>;
|
|
143
|
+
export declare function partTabletDeclarations(style: PartStyle, options?: PartDeclarationOptions): Record<string, string>;
|
|
141
144
|
export declare function partAlignFollowed(style: PartStyle, screen: PartScreen): PartAlign | undefined;
|
|
142
145
|
export type PartScreen = ViewTier;
|
|
143
146
|
export declare function partStyleForScreen(style: PartStyle, screen: PartScreen): PartStyle;
|
|
@@ -169,7 +172,7 @@ export declare function partStyleSource<E extends {
|
|
|
169
172
|
getAttribute(name: string): string | null;
|
|
170
173
|
}>(nodeId: string, selectedPartId: string | null, selectedElements: readonly E[], declaresStyle: (className: string | null) => boolean): E | null;
|
|
171
174
|
export declare function storedPartStyle(styles: PartStyles, styleKey: string): PartStyle;
|
|
172
|
-
export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, screen?: PartScreen, drawsStyle?: (partKey: string) => boolean): number;
|
|
175
|
+
export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, screen?: PartScreen, drawsStyle?: (partKey: string) => boolean, capsSize?: (partKey: string) => boolean): number;
|
|
173
176
|
export declare function regionSheetStyle(style: PartStyle | undefined | null): PartStyle | null;
|
|
174
177
|
export declare function regionCanvasDeclarations(style: PartStyle | undefined | null, screen: PartScreen): {
|
|
175
178
|
fontFamily?: string;
|
|
@@ -216,7 +219,7 @@ export type PublishedPartSheet = {
|
|
|
216
219
|
kindRules: ReadonlyMap<string, PublishedPartRule>;
|
|
217
220
|
drawn: ReadonlySet<string>;
|
|
218
221
|
};
|
|
219
|
-
export declare function publishedPartStyles(needles: readonly PartNeedle[], styles: PartStyles, scope: string, styleKeyOf?: (partKey: string) => string, drawsStyle?: (partKey: string) => boolean, motionOf?: (styleKey: string) => PublishedPartMotion | null, motionKeys?: readonly string[]): PublishedPartSheet | null;
|
|
222
|
+
export declare function publishedPartStyles(needles: readonly PartNeedle[], styles: PartStyles, scope: string, styleKeyOf?: (partKey: string) => string, drawsStyle?: (partKey: string) => boolean, motionOf?: (styleKey: string) => PublishedPartMotion | null, motionKeys?: readonly string[], capsSize?: (partKey: string) => boolean): PublishedPartSheet | null;
|
|
220
223
|
export declare function isPartKindKey(key: string): boolean;
|
|
221
224
|
export declare function partRuleForKind(sheet: PublishedPartSheet | null, kind: string): PublishedPartRule | null;
|
|
222
225
|
export declare function viewMediaOf(inBox: boolean): {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as ut,textStyleCaseOfCss as pt,viewKeyAt as B}from"efficient-easel/draw";import{FONT_OPTIONS as dt,fontOption as gt,fontRoleOf as w,SIZE_STEP_OF_ROLE as I}from"../../../format/lib/fonts.js";import{encodePartKey as X}from"../../../format/lib/document/part-key.js";import{decodePartId as Y,normalizePartText as F}from"./text-parts.js";import{partInkCss as xt}from"../../../format/lib/document/part-inks.js";import{regionStyle as ht}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as St,EDGE_TABLET_MEDIA as bt,PHONE_MEDIA as mt,TABLET_MEDIA as Tt,viewOverrides as Pt}from"../content/view-values.js";import{plainRecord as y,propsWithPartRecord as zt,readPartRecord as _t,readPartRecords as At}from"../../../format/lib/document/part-records.js";import{isLengthUnit as M}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as _,storedUnit as Rt}from"../../../format/lib/content/css-length.js";import{hasOwnEntry as N,ownEntry as V}from"../../../format/lib/own-entry.js";const L="_partStyles",Et="data-sf-part-styled",Z="data-sf-text-style",wt=/^(heading|body)-[1-7]$/;function b(t){return typeof t=="string"&&wt.test(t)}const q={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function Nt(t){if(!t)return null;for(const[e,n]of Object.entries(q))if(n===t)return e;return null}function Ue(t){if(b(t.textStyle))return t.textStyle;const e=w(t.role);return e?q[e]:void 0}const Ot=[400,500,600,700],R=["left","center","right","justify"],D=5,H=1e3,$t=-5,kt=10,It=0,Ft=64,yt=2,J={size:{min:D,max:H,step:1},sizeTablet:{min:D,max:H,step:1},sizePhone:{min:D,max:H,step:1},padding:{min:It,max:Ft,step:yt}},Mt=.05,Lt=.01,Dt=["line","letter"],Ht=.5,Ut=2.5,jt=-1,Ct=1,vt=0,Kt=400,Wt=[...new Set(Object.values(I))];function je(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Ce(t){return At(t,L)}function Q(t,e){return _t(t,L,e)}function ve(t,e){return Object.values(Q(t,e)).filter(n=>n!==void 0).length}function tt(t,e,n){return zt(t,L,e,Gt(n).length?n:null)}function Gt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function Bt(t){return Dt.includes(t)}const E=(t,e,n)=>Math.min(n,Math.max(e,t)),Xt=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function U(t){const e=B("sizeUnit",t),n=Xt.find(o=>o===e);if(!n)throw new Error(`a part stores no unit key ${e}`);return n}const m={size:U("desktop"),sizeTablet:U("tablet"),sizePhone:U("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},et=Object.values(m);function h(t,e){return Rt(t[m[e]])}function Yt(t,e,n={}){if(et.includes(t))return M(e)&&e!=="px"?e:null;if(N(m,t)&&h(n,t)!=="px"){const o=P(Number(e),2);return!Number.isFinite(o)||o<0||o===0&&t!=="padding"?null:o}if(Bt(t)){const o=Math.round(Number(e));return!Number.isFinite(o)||o===0?null:E(o,$t,kt)}if(t==="lineHeight"){const o=Number(e);return Number.isFinite(o)?P(E(o,Ht,Ut),3):null}if(t==="letterSpacing"){const o=Number(e);return Number.isFinite(o)?P(E(o,jt,Ct),4):null}if(t==="paragraphSpacing"){const o=Math.round(Number(e));return!Number.isFinite(o)||o<=0?null:E(o,vt,Kt)}if(N(J,t)){const{min:o,max:i}=J[t],r=Math.round(Number(e));return Number.isFinite(r)?E(r,o,i):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?w(e)?e:null:t==="sizeToken"?j(e)?e:null:t==="textStyle"?b(e)?e:null:t==="alignPhone"||t==="alignTablet"?R.includes(e)?e:null:e}const Vt=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function A(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Vt){const i=t[o];i!==void 0&&!(typeof i=="number"&&Number.isFinite(i))&&n(o)}t.align!==void 0&&!R.includes(t.align)&&n("align"),t.alignTablet!==void 0&&!R.includes(t.alignTablet)&&n("alignTablet"),t.alignPhone!==void 0&&!R.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!b(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!j(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!w(t.fontRole)&&n("fontRole");for(const o of et)t[o]!==void 0&&!M(t[o])&&n(o);return e??t}function j(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:i,fluid:r}=t,c=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,a=l=>typeof l=="string"&&Wt.includes(l);return a(e)&&c(n)&&(o===void 0||a(o))&&(i===void 0||c(i))&&(r===void 0||Zt(r,n))}function Zt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...i}=t;return Object.keys(i).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function C(t){return t?.pxPhone&&j(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function nt({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,i=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${i}, var(--sf-heading-max,9999px))`:i}const qt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Jt(t){const e=[];for(const[n,o]of qt)n===t?e.push(o):o===t&&e.push(n);return e}function Ke(t,e,n,o){const i={...Q(t,e)},r=o==null?null:Yt(n,o,i);if(r===null)delete i[n];else{i[n]=r;for(const c of Jt(n))delete i[c]}return tt(t,e,i)}function We(t,e){return tt(t,e,{})}function Qt(t){return pt(t)??"none"}function te(t){return ut(t)??""}const ot={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 ee(t,e){const n=w(t.role);return n||(e?.blockDrawsStyle?null:Nt(t.textStyle))}function Ge(t,e){return t==="Text"&&e==="text"}const ne={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 oe(t){const e=I[t],n=V(ne,e);return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function ie(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(re+t.line*Mt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Lt,4)),e}const re=1,T="--sf-part-para";function ae(t){t=A(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=_(t.sizePhone,h(t,"sizePhone"));else{const o=C(t.sizeToken);if(o)e.fontSize=nt(o);else{const i=$(t);i!==void 0&&(e.fontSize=_(i,h(t,"sizeTablet")))}}const n=t.alignPhone??O(t);return n&&(e.textAlign=n),e}function O(t){return t.alignTablet&&t.alignTablet!==t.align?t.alignTablet:void 0}function $(t){const n=t.sizeTablet!==void 0&&h(t,"sizeTablet")!==h(t,"size")?t.sizeTablet:Pt("textSize",t.size,t.sizeTablet,void 0).tablet;return n&&n>0?n:void 0}function se(t){const e=A(t),n={},o=$(e);o!==void 0&&(n.fontSize=_(o,h(e,"sizeTablet")));const i=O(e);return i&&(n.textAlign=i),n}function Be(t,e){if(e==="desktop")return;const n=A(t);return(e==="mobile"?O(n):void 0)??n.align}function fe(t,e){if(e==="desktop")return t;const n=A(t),o=$(n),i=O(n);if(e==="tablet"){let a=t;return o!==void 0&&(a={...a,size:o,sizeUnit:n[m.sizeTablet]}),i&&(a={...a,align:i}),a}let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone,sizeUnit:n[m.sizePhone]};else{const a=C(n.sizeToken);a?r={...r,size:void 0,sizeToken:a}:o!==void 0&&(r={...r,size:o,sizeUnit:n[m.sizeTablet]})}const c=n.alignPhone??i;return c&&(r={...r,align:c}),r}function v(t,e,n){return K(fe(t,e),k,n)}function ce(t){return B("size",t)}function Xe(t,e){if(e==="desktop")return null;const n=A(t);if(e==="mobile"){if(C(n.sizeToken))return null;const o=$(n);if(o!==void 0)return{px:o,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function it(t,e){const n=ce(e);if(!N(t,n))return t;const o={...t};return delete o[n],o}function Ye(t,e,n){const o=v(it(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function K(t,e,n){t=A(t);const o=ee(t,n),i=ie(t),r=t.size?_(t.size,h(t,"size")):t.sizeToken?nt(t.sizeToken):o?oe(o):"";return{fontFamily:t.font?de(t.font):t.fontRole?`var(${ot[t.fontRole]})`:o?`var(${ot[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:i.lineHeight!==void 0?String(i.lineHeight):"",letterSpacing:i.letterSpacingEm!==void 0?`${i.letterSpacingEm}em`:"",[T]:t.paragraphSpacing?_(t.paragraphSpacing,h(t,"paragraphSpacing")):"",textTransform:te(t.case),textAlign:t.align??"",paddingTop:rt(t.padding,h(t,"padding")),paddingBottom:rt(t.padding,h(t,"padding")),color:le(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const le=t=>xt(t),rt=(t,e)=>t===void 0?"":_(t,e),P=(t,e)=>Number(t.toFixed(e));function Ve(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.letterSpacing),r=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:ue(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(i)?P(i/n,4):0,align:pe(t.textAlign),case:Qt(t.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function ue(t){return Number.isFinite(t)?Ot.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function pe(t){for(const e of R)if(e===t)return e;return t==="end"?"right":"left"}function Ze(t,e){const n=at(t);if(!n)return"";for(const o of dt)if(at(e(o.cssVar))===n)return o.key;return""}const at=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function de(t){const e=gt(t);return e?`var(${e.cssVar})`:""}function qe(t,e,n,o){return!e||Y(e)?.nodeId!==t?null:n.find(r=>o(r.getAttribute("class")))??n[0]??null}function ge(t,e){return y(V(t,e))??{}}function Je(t,e,n=()=>k,o=a=>a,i=Se,r="desktop",c=()=>!1){let a=0;for(const{element:l,partId:S}of t){const g=Y(S)?.propKey;if(!g)continue;const s=ge(e,o(g)),f=v(s,r,{blockDrawsStyle:c(g)});b(s.textStyle)?l.setAttribute?.(Z,s.textStyle):l.removeAttribute?.(Z);const d=G.some(x=>l.style[x]);let p=!1;for(const[x,u]of Object.entries(f))Te(l,x,u),u&&(p=!0);if(d||G.some(x=>f[x]))for(const x of xe(l,i))for(const u of G)x.style[u]=f[u]??"";p&&(a+=1)}return a}function xe(t,e){const n=F(t.textContent??""),o=[];let i=t;for(let r=0;r<he&&e(i);r+=1){const c=i.parentElement;if(!c||F(c.textContent??"")!==n)break;o.push(c),i=c}return o}const he=8;function Se(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const k={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function be(t){if(!t||typeof t!="object")return null;const e={};b(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizeTablet=="number"&&t.sizeTablet>0&&(e.sizeTablet=t.sizeTablet),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone);for(const n of["size","sizeTablet","sizePhone"]){const o=m[n];e[n]!==void 0&&M(t[o])&&(e[o]=t[o])}return Object.keys(e).length?e:null}function me(t,e){const n=be(t);if(!n)return{};const o=v(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function Qe(t){return b(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function tn(t,e,n){if(!t||typeof t!="object")return{};const o=ht(t.role,e,I)??{},i=e.sized?me(it(t,n),n):{};return{...o,...i}}function en(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function Te(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const i=t;e===T&&(n?i.setAttribute?.(st,""):i.removeAttribute?.(st))}const st="data-sf-part-para",Pe=Object.keys(K({},k)),W=new Set(["color","overflowWrap",T,"fontStyle"]),G=Pe.filter(t=>!W.has(t));function nn(t,e,n,o=a=>a,i=()=>!1,r=()=>null,c=[]){const a=new Map;for(const s of t){const f=X(s.key,s.row);for(const d of s.texts){const p=a.get(d);p?(p.keys.add(s.key),p.partKeys.add(f)):a.set(d,{keys:new Set([s.key]),partKeys:new Set([f])})}}const l=new Map;for(const s of new Set([...Object.keys(e),...c])){if(!ze(s))continue;const f=ft(n,s,y(e[s])??{},!1,r(s));f&&l.set(s,f)}const S=s=>{const f=o(s),d=r(f);if(!N(e,f)&&!d)return null;const p=y(e[f])??{};return ft(n,s,p,i(s),d)},g=new Map;for(const[s,{keys:f,partKeys:d}]of a){const p=d.size===1?[...d][0]:f.size===1?[...f][0]:null;if(!p)continue;const z=S(p);z&&g.set(s,z)}for(const s of t){if(!s.keyed)continue;const f=S(X(s.key,s.row));f&&l.set(s.key,f)}return g.size||l.size?{rules:g,kindRules:l,drawn:new Set(a.keys())}:null}function ft(t,e,n,o,i){const r=K(n,k,{blockDrawsStyle:o}),c=se(n),a=ae(n),l=b(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(c).length&&!Object.keys(a).length&&!l&&!i?null:{stamp:_e(t,e),declarations:r,...Object.keys(c).length?{tablet:c}:{},...Object.keys(a).length?{phone:a}:{},...l?{textStyle:l}:{},...i?{motion:i}:{}}}function ze(t){return t.startsWith("@")}function on(t,e){return t?.kindRules.get(e)??null}function _e(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Ae(t){return t?{tablet:bt,phone:St}:{tablet:Tt,phone:mt}}function rn(t,{inBox:e=!1}={}){const{tablet:n,phone:o}=Ae(e),i=[],r=new Set,c=a=>{const{stamp:l,declarations:S}=a;if(r.has(l))return;r.add(l);const g=Object.entries(S).filter(([,u])=>u!==""),s=u=>u.map(([ct,lt])=>`${Ee(ct)}: ${lt}`).join("; "),f=`[${Et}="${l}"]`,d=g.filter(([u])=>!W.has(u)),p=g.filter(([u])=>W.has(u));d.length&&i.push(`${f}, *:has(> ${f}) { ${s(d)} }`),p.length&&i.push(`${f} { ${s(p)} }`),S[T]&&(i.push(`*:has(> ${f}) { ${T}: ${S[T]} }`),i.push(...Re(f,`*:has(> ${f})`)));const z=Object.entries(a.tablet??{}).filter(([,u])=>u!=="");z.length&&i.push(`@media ${n} { ${f}, *:has(> ${f}) { ${s(z)} } }`);const x=Object.entries(a.phone??{}).filter(([,u])=>u!=="");x.length&&i.push(`@media ${o} { ${f}, *:has(> ${f}) { ${s(x)} } }`)};for(const a of t.rules.values())c(a);for(const a of t.kindRules.values())c(a);return i.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as pe,textStyleCaseOfCss as de,viewKeyAt as Y}from"efficient-easel/draw";import{FONT_OPTIONS as ge,fontOption as xe,fontRoleOf as $,SIZE_STEP_OF_ROLE as F}from"../../../format/lib/fonts.js";import{encodePartKey as V}from"../../../format/lib/document/part-key.js";import{decodePartId as Z,normalizePartText as y}from"./text-parts.js";import{partInkCss as he}from"../../../format/lib/document/part-inks.js";import{regionStyle as Se}from"../../../format/lib/sections/text-regions.js";import{EDGE_PHONE_MEDIA as be,EDGE_TABLET_MEDIA as me,PHONE_MEDIA as Te,TABLET_MEDIA as Pe,viewOverrides as ze}from"../content/view-values.js";import{plainRecord as M,propsWithPartRecord as _e,readPartRecord as Ae,readPartRecords as Re}from"../../../format/lib/document/part-records.js";import{isLengthUnit as L}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as A,storedUnit as Ee}from"../../../format/lib/content/css-length.js";import{hasOwnEntry as k,ownEntry as q}from"../../../format/lib/own-entry.js";const D="_partStyles",we="data-sf-part-styled",J="data-sf-text-style",$e=/^(heading|body)-[1-7]$/;function m(e){return typeof e=="string"&&$e.test(e)}const Q={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function ke(e){if(!e)return null;for(const[t,n]of Object.entries(Q))if(n===e)return t;return null}function Ct(e){if(m(e.textStyle))return e.textStyle;const t=$(e.role);return t?Q[t]:void 0}const Ne=[400,500,600,700],E=["left","center","right","justify"],H=5,U=1e3,Oe=-5,Ie=10,Fe=0,ye=64,Me=2,ee={size:{min:H,max:U,step:1},sizeTablet:{min:H,max:U,step:1},sizePhone:{min:H,max:U,step:1},padding:{min:Fe,max:ye,step:Me}},Le=.05,De=.01,He=["line","letter"],Ue=.5,je=2.5,Ce=-1,ve=1,We=0,Ge=400,Ke=[...new Set(Object.values(F))];function vt(e){return[`${e} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${e}:hover, ${e}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function Wt(e){return Re(e,D)}function te(e,t){return Ae(e,D,t)}function Gt(e,t){return Object.values(te(e,t)).filter(n=>n!==void 0).length}function ne(e,t,n){return _e(e,D,t,Be(n).length?n:null)}function Be(e){return Object.entries(e).filter(([,t])=>t!==void 0)}function Xe(e){return He.includes(e)}const w=(e,t,n)=>Math.min(n,Math.max(t,e)),Ye=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function j(e){const t=Y("sizeUnit",e),n=Ye.find(i=>i===t);if(!n)throw new Error(`a part stores no unit key ${t}`);return n}const T={size:j("desktop"),sizeTablet:j("tablet"),sizePhone:j("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},ie=Object.values(T);function h(e,t){return Ee(e[T[t]])}function Ve(e,t,n={}){if(ie.includes(e))return L(t)&&t!=="px"?t:null;if(k(T,e)&&h(n,e)!=="px"){const i=z(Number(t),2);return!Number.isFinite(i)||i<0||i===0&&e!=="padding"?null:i}if(Xe(e)){const i=Math.round(Number(t));return!Number.isFinite(i)||i===0?null:w(i,Oe,Ie)}if(e==="lineHeight"){const i=Number(t);return Number.isFinite(i)?z(w(i,Ue,je),3):null}if(e==="letterSpacing"){const i=Number(t);return Number.isFinite(i)?z(w(i,Ce,ve),4):null}if(e==="paragraphSpacing"){const i=Math.round(Number(t));return!Number.isFinite(i)||i<=0?null:w(i,We,Ge)}if(k(ee,e)){const{min:i,max:o}=ee[e],r=Math.round(Number(t));return Number.isFinite(r)?w(r,i,o):null}return e==="italic"?typeof t=="boolean"?t:null:e==="role"||e==="fontRole"?$(t)?t:null:e==="sizeToken"?C(t)?t:null:e==="textStyle"?m(t)?t:null:e==="alignPhone"||e==="alignTablet"?E.includes(t)?t:null:t}const Ze=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function R(e){let t=null;const n=i=>{t??={...e},delete t[i]};for(const i of Ze){const o=e[i];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(i)}e.align!==void 0&&!E.includes(e.align)&&n("align"),e.alignTablet!==void 0&&!E.includes(e.alignTablet)&&n("alignTablet"),e.alignPhone!==void 0&&!E.includes(e.alignPhone)&&n("alignPhone"),e.textStyle!==void 0&&!m(e.textStyle)&&n("textStyle"),e.sizeToken!==void 0&&!C(e.sizeToken)&&n("sizeToken"),e.fontRole!==void 0&&!$(e.fontRole)&&n("fontRole");for(const i of ie)e[i]!==void 0&&!L(e[i])&&n(i);return t??e}function C(e){if(!e||typeof e!="object")return!1;const{step:t,px:n,stepPhone:i,pxPhone:o,fluid:r}=e,f=c=>typeof c=="number"&&Number.isFinite(c)&&c>0,s=c=>typeof c=="string"&&Ke.includes(c);return s(t)&&f(n)&&(i===void 0||s(i))&&(o===void 0||f(o))&&(r===void 0||qe(r,n))}function qe(e,t){if(!e||typeof e!="object"||Array.isArray(e))return!1;const{minPx:n,vw:i,...o}=e;return Object.keys(o).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<t&&typeof i=="number"&&Number.isFinite(i)&&i>0&&i<=100}function v(e){return e?.pxPhone&&C(e)?{step:e.stepPhone??e.step,px:e.pxPhone}:null}function oe({step:e,px:t,fluid:n}){const i=n?`clamp(${n.minPx}px, ${n.vw}vw, ${t}px)`:`${t}px`,o=`var(--size-${e}, ${i})`;return e.startsWith("heading")?`min(${o}, var(--sf-heading-max,9999px))`:o}const Je=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Qe(e){const t=[];for(const[n,i]of Je)n===e?t.push(i):i===e&&t.push(n);return t}function Kt(e,t,n,i){const o={...te(e,t)},r=i==null?null:Ve(n,i,o);if(r===null)delete o[n];else{o[n]=r;for(const f of Qe(n))delete o[f]}return ne(e,t,o)}function Bt(e,t){return ne(e,t,{})}function et(e){return de(e)??"none"}function tt(e){return pe(e)??""}const re={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 nt(e,t){const n=$(e.role);return n||(t?.blockDrawsStyle?null:ke(e.textStyle))}const it="--sf-part-size-cap";function W(e,t){return e&&t?.sizeCap?`min(${e}, var(${it}, ${e}))`:e}function Xt(e,t){return e?.[t]===!0}function Yt(e,t){return e==="Text"&&t==="text"}const ot={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 rt(e){const t=F[e],n=q(ot,t);return n?`var(--size-${t}, ${n})`:`var(--size-${t})`}function at(e){const t={};return typeof e.lineHeight=="number"?t.lineHeight=e.lineHeight:e.line&&(t.lineHeight=z(st+e.line*Le,3)),typeof e.letterSpacing=="number"?t.letterSpacingEm=e.letterSpacing:e.letter&&(t.letterSpacingEm=z(e.letter*De,4)),t}const st=1,P="--sf-part-para";function ft(e,t){e=R(e);const n={};if(typeof e.sizePhone=="number"&&e.sizePhone>0)n.fontSize=A(e.sizePhone,h(e,"sizePhone"));else{const o=v(e.sizeToken);if(o)n.fontSize=oe(o);else{const r=O(e);r!==void 0&&(n.fontSize=A(r,h(e,"sizeTablet")))}}n.fontSize&&(n.fontSize=W(n.fontSize,t));const i=e.alignPhone??N(e);return i&&(n.textAlign=i),n}function N(e){return e.alignTablet&&e.alignTablet!==e.align?e.alignTablet:void 0}function O(e){const n=e.sizeTablet!==void 0&&h(e,"sizeTablet")!==h(e,"size")?e.sizeTablet:ze("textSize",e.size,e.sizeTablet,void 0).tablet;return n&&n>0?n:void 0}function ct(e,t){const n=R(e),i={},o=O(n);o!==void 0&&(i.fontSize=W(A(o,h(n,"sizeTablet")),t));const r=N(n);return r&&(i.textAlign=r),i}function Vt(e,t){if(t==="desktop")return;const n=R(e);return(t==="mobile"?N(n):void 0)??n.align}function lt(e,t){if(t==="desktop")return e;const n=R(e),i=O(n),o=N(n);if(t==="tablet"){let s=e;return i!==void 0&&(s={...s,size:i,sizeUnit:n[T.sizeTablet]}),o&&(s={...s,align:o}),s}let r=e;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone,sizeUnit:n[T.sizePhone]};else{const s=v(n.sizeToken);s?r={...r,size:void 0,sizeToken:s}:i!==void 0&&(r={...r,size:i,sizeUnit:n[T.sizeTablet]})}const f=n.alignPhone??o;return f&&(r={...r,align:f}),r}function G(e,t,n){return K(lt(e,t),I,n)}function ut(e){return Y("size",e)}function Zt(e,t){if(t==="desktop")return null;const n=R(e);if(t==="mobile"){if(v(n.sizeToken))return null;const i=O(n);if(i!==void 0)return{px:i,view:"tablet"}}return typeof n.size=="number"&&n.size>0?{px:n.size,view:"desktop"}:null}function ae(e,t){const n=ut(t);if(!k(e,n))return e;const i={...e};return delete i[n],i}function qt(e,t,n){const i=G(ae(e,t),t,n);return{fontFamily:i.fontFamily,fontSize:i.fontSize}}function K(e,t,n){e=R(e);const i=nt(e,n),o=at(e),r=W(e.size?A(e.size,h(e,"size")):e.sizeToken?oe(e.sizeToken):i?rt(i):"",n);return{fontFamily:e.font?xt(e.font):e.fontRole?`var(${re[e.fontRole]})`:i?`var(${re[i]})`:"",fontWeight:e.weight?String(e.weight):"",fontSize:r,minWidth:r?"0":"",overflowWrap:r?"break-word":"",lineHeight:o.lineHeight!==void 0?String(o.lineHeight):"",letterSpacing:o.letterSpacingEm!==void 0?`${o.letterSpacingEm}em`:"",[P]:e.paragraphSpacing?A(e.paragraphSpacing,h(e,"paragraphSpacing")):"",textTransform:tt(e.case),textAlign:e.align??"",paddingTop:se(e.padding,h(e,"padding")),paddingBottom:se(e.padding,h(e,"padding")),color:pt(e.color),fontStyle:e.italic===!0?"italic":e.italic===!1?"normal":""}}const pt=e=>he(e),se=(e,t)=>e===void 0?"":A(e,t),z=(e,t)=>Number(e.toFixed(t));function Jt(e,t){const n=Number.parseFloat(e.fontSize)||16,i=Number.parseFloat(e.lineHeight),o=Number.parseFloat(e.letterSpacing),r=Number.parseFloat(e.paddingTop);return{fontKey:t,sizePx:n,weight:dt(Number.parseInt(e.fontWeight,10)),lineRatio:Number.isFinite(i)?z(i/n,3):1.2,letterEm:Number.isFinite(o)?z(o/n,4):0,align:gt(e.textAlign),case:et(e.textTransform),paddingPx:Number.isFinite(r)?Math.round(r):0}}function dt(e){return Number.isFinite(e)?Ne.reduce((t,n)=>Math.abs(n-e)<Math.abs(t-e)?n:t):400}function gt(e){for(const t of E)if(t===e)return t;return e==="end"?"right":"left"}function Qt(e,t){const n=fe(e);if(!n)return"";for(const i of ge)if(fe(t(i.cssVar))===n)return i.key;return""}const fe=e=>(e.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function xt(e){const t=xe(e);return t?`var(${t.cssVar})`:""}function en(e,t,n,i){return!t||Z(t)?.nodeId!==e?null:n.find(r=>i(r.getAttribute("class")))??n[0]??null}function ht(e,t){return M(q(e,t))??{}}function tn(e,t,n=()=>I,i=c=>c,o=mt,r="desktop",f=()=>!1,s=()=>!1){let c=0;for(const{element:p,partId:S}of e){const g=Z(S)?.propKey;if(!g)continue;const a=ht(t,i(g)),l=G(a,r,{blockDrawsStyle:f(g),sizeCap:s(g)});m(a.textStyle)?p.setAttribute?.(J,a.textStyle):p.removeAttribute?.(J);const x=X.some(u=>p.style[u]);let d=!1;for(const[u,b]of Object.entries(l))zt(p,u,b),b&&(d=!0);if(x||X.some(u=>l[u]))for(const u of St(p,o))for(const b of X)u.style[b]=l[b]??"";d&&(c+=1)}return c}function St(e,t){const n=y(e.textContent??""),i=[];let o=e;for(let r=0;r<bt&&t(o);r+=1){const f=o.parentElement;if(!f||y(f.textContent??"")!==n)break;i.push(f),o=f}return i}const bt=8;function mt(e){const t=e;return typeof window>"u"||!t?.ownerDocument?!1:window.getComputedStyle(t).display==="inline"}const I={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Tt(e){if(!e||typeof e!="object")return null;const t={};m(e.textStyle)&&(t.textStyle=e.textStyle),typeof e.size=="number"&&e.size>0&&(t.size=e.size),typeof e.sizeTablet=="number"&&e.sizeTablet>0&&(t.sizeTablet=e.sizeTablet),typeof e.sizePhone=="number"&&e.sizePhone>0&&(t.sizePhone=e.sizePhone);for(const n of["size","sizeTablet","sizePhone"]){const i=T[n];t[n]!==void 0&&L(e[i])&&(t[i]=e[i])}return Object.keys(t).length?t:null}function Pt(e,t){const n=Tt(e);if(!n)return{};const i=G(n,t);return{...i.fontFamily?{fontFamily:i.fontFamily}:{},...i.fontSize?{fontSize:i.fontSize}:{}}}function nn(e){return m(e?.textStyle)||!!e?.role||typeof e?.size=="number"&&e.size>0}function on(e,t,n){if(!e||typeof e!="object")return{};const i=Se(e.role,t,F)??{},o=t.sized?Pt(ae(e,n),n):{};return{...i,...o}}function rn(e,t,n){n.fontFamily&&e.fontFamily===n.fontFamily&&(e.fontFamily=t.fontFamily),n.fontSize&&e.fontSize===n.fontSize&&(e.fontSize=t.fontSize)}function zt(e,t,n){if(!t.startsWith("--")){e.style[t]=n;return}const i=e.style;typeof i.setProperty=="function"?n?i.setProperty(t,n):i.removeProperty?.(t):i[t]=n;const o=e;t===P&&(n?o.setAttribute?.(ce,""):o.removeAttribute?.(ce))}const ce="data-sf-part-para",_t=Object.keys(K({},I)),B=new Set(["color","overflowWrap",P,"fontStyle"]),X=_t.filter(e=>!B.has(e));function an(e,t,n,i=c=>c,o=()=>!1,r=()=>null,f=[],s=()=>!1){const c=new Map;for(const a of e){const l=V(a.key,a.row);for(const x of a.texts){const d=c.get(x);d?(d.keys.add(a.key),d.partKeys.add(l)):c.set(x,{keys:new Set([a.key]),partKeys:new Set([l])})}}const p=new Map;for(const a of new Set([...Object.keys(t),...f])){if(!At(a))continue;const l=le(n,a,M(t[a])??{},{blockDrawsStyle:!1},r(a));l&&p.set(a,l)}const S=a=>{const l=i(a),x=r(l);if(!k(t,l)&&!x)return null;const d=M(t[l])??{};return le(n,a,d,{blockDrawsStyle:o(a),sizeCap:s(a)},x)},g=new Map;for(const[a,{keys:l,partKeys:x}]of c){const d=x.size===1?[...x][0]:l.size===1?[...l][0]:null;if(!d)continue;const _=S(d);_&&g.set(a,_)}for(const a of e){if(!a.keyed)continue;const l=S(V(a.key,a.row));l&&p.set(a.key,l)}return g.size||p.size?{rules:g,kindRules:p,drawn:new Set(c.keys())}:null}function le(e,t,n,i,o){const r=K(n,I,i),f=ct(n,i),s=ft(n,i),c=m(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(f).length&&!Object.keys(s).length&&!c&&!o?null:{stamp:Rt(e,t),declarations:r,...Object.keys(f).length?{tablet:f}:{},...Object.keys(s).length?{phone:s}:{},...c?{textStyle:c}:{},...o?{motion:o}:{}}}function At(e){return e.startsWith("@")}function sn(e,t){return e?.kindRules.get(t)??null}function Rt(e,t){const n=i=>i.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(e)}~${n(t)}`}function Et(e){return e?{tablet:me,phone:be}:{tablet:Pe,phone:Te}}function fn(e,{inBox:t=!1}={}){const{tablet:n,phone:i}=Et(t),o=[],r=new Set,f=s=>{const{stamp:c,declarations:p}=s;if(r.has(c))return;r.add(c);const S=Object.entries(p).filter(([,u])=>u!==""),g=u=>u.map(([b,ue])=>`${$t(b)}: ${ue}`).join("; "),a=`[${we}="${c}"]`,l=S.filter(([u])=>!B.has(u)),x=S.filter(([u])=>B.has(u));l.length&&o.push(`${a}, *:has(> ${a}) { ${g(l)} }`),x.length&&o.push(`${a} { ${g(x)} }`),p[P]&&(o.push(`*:has(> ${a}) { ${P}: ${p[P]} }`),o.push(...wt(a,`*:has(> ${a})`)));const d=Object.entries(s.tablet??{}).filter(([,u])=>u!=="");d.length&&o.push(`@media ${n} { ${a}, *:has(> ${a}) { ${g(d)} } }`);const _=Object.entries(s.phone??{}).filter(([,u])=>u!=="");_.length&&o.push(`@media ${i} { ${a}, *:has(> ${a}) { ${g(_)} } }`)};for(const s of e.rules.values())f(s);for(const s of e.kindRules.values())f(s);return o.join(`
|
|
2
|
+
`)}function wt(e,t){const n=`var(${P})`,i=":is([data-sf-bullet], [data-sf-number])";return[`${e} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${e} ${i}:not(:first-child) { margin-top: ${n} }`,`${e} ${i}:not(:last-child) { margin-bottom: ${n} }`,`:is(${t}) + :is(${t}) { margin-top: ${n} }`]}const $t=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function cn(e,t){if(!e)return null;const n=y(t),i=e.rules.get(n);if(i)return i;if(n.length<kt||e.drawn.has(n))return null;let o=null;for(const[r,f]of e.rules)if(r.includes(n)){if(o&&o.stamp!==f.stamp)return null;o=f}return o}const kt=8;export{E as PART_ALIGNS,ve as PART_LETTER_EM_MAX,Ce as PART_LETTER_EM_MIN,De as PART_LETTER_STEP,je as PART_LINE_HEIGHT_MAX,Ue as PART_LINE_HEIGHT_MIN,Le as PART_LINE_STEP,ee as PART_MEASURED_TRACKS,Ie as PART_NUDGE_MAX,Oe as PART_NUDGE_MIN,ye as PART_PADDING_MAX,Fe as PART_PADDING_MIN,Me as PART_PADDING_STEP,ce as PART_PARAGRAPH_ATTR,Ge as PART_PARAGRAPH_MAX,We as PART_PARAGRAPH_MIN,P as PART_PARAGRAPH_VAR,He as PART_RELATIVE_PROPS,it as PART_SIZE_CAP_VAR,U as PART_SIZE_MAX,H as PART_SIZE_MIN,Ke as PART_SIZE_STEPS,we as PART_STYLED_ATTR,D as PART_STYLES_PROP,_t as PART_STYLE_PROPERTIES,T as PART_UNIT_KEY_OF,Ne as PART_WEIGHTS,X as SHARED_PART_PROPERTIES,Q as STYLE_ID_OF_ROLE,J as TEXT_STYLE_ATTR,tn as applyPartStyles,Xt as blockCapsPartSize,Yt as blockDrawsTextStyle,Ct as followedStyleOf,At as isPartKindKey,m as isTextStyleId,wt as paragraphRules,Vt as partAlignFollowed,G as partCanvasDeclarations,et as partCaseOfTransform,tt as partCaseTransform,Qt as partFontKeyOf,vt as partLiftRules,ft as partPhoneDeclarations,sn as partRuleForKind,cn as partRuleForText,qt as partShownDeclarations,ut as partSizeBoxOf,Zt as partSizeFollowed,at as partSpacingOf,Jt as partStyleBase,Gt as partStyleCount,fn as partStyleCss,K as partStyleDeclarations,lt as partStyleForScreen,en as partStyleSource,ae as partStyleWithoutSizeBox,ct as partTabletDeclarations,Kt as propsWithPartStyleValue,Bt as propsWithoutPartStyle,an as publishedPartStyles,te as readPartStyle,Wt as readPartStyles,Pt as regionCanvasDeclarations,rn as regionCanvasRestore,nn as regionHasOwnLook,Tt as regionSheetStyle,on as regionShownDeclarations,ht as storedPartStyle,Et as viewMediaOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import{CardRowDrawn as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{CardRowDrawn as P}from"../../../components/CardRowContext.js";import{PublishedPartStyles as h}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as y}from"../part-styles.js";import{readPartMotions as _}from"../../animation/part-motion.js";import{partNeedles as x}from"../text-parts.js";import{CARD_LIST_TYPE as C,HOST_PART_TYPE as T,rowPartByKey as b}from"../../../../format/lib/content/card-template.js";import{BOX_TYPE as u}from"../../../../format/lib/document/container-blocks.js";const R={name:"clickableParts",applies:(o,e,a)=>typeof a?.render=="function"&&o!==C&&o!==T,draw(o,e,a){const r=o,p=()=>r.textParts??r.fields,d=r.partSizeCaps,c=r.render,m=a.inspector?.PartAnchors,f=(t,s)=>x(p(),s,n=>b(e,t,n));r.render=t=>{const s=y(t),n=_(t);return t.editor?.isEditing&&m?i(P,{type:e,props:t,children:l=>i(m,{needles:f(t,l),styles:s,motions:n,type:e,sizeCaps:d,children:c(t)})}):!Object.keys(s).length&&!Object.keys(n).length?c(t):i(P,{type:e,props:t,children:l=>i(h,{needles:f(t,l),styles:s,motions:n,type:e,atEdge:e===u,sizeCaps:d,children:c(t)})})}}};export{R as clickableParts};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TierFrames } from "../../content/section-padding.js";
|
|
1
2
|
import type { BlockPass } from "../../../../format/lib/document/passes/types.js";
|
|
2
3
|
type InnerPadding = {
|
|
3
4
|
top: number;
|
|
@@ -13,7 +14,7 @@ export declare const ownPairDefault: (key: string) => InnerPadding | undefined;
|
|
|
13
14
|
export declare const PAD_ON_ROOT: ReadonlySet<string>;
|
|
14
15
|
export declare const PADS_ITS_OWN_SPACE: ReadonlySet<string>;
|
|
15
16
|
export declare const sectionPadding: BlockPass;
|
|
16
|
-
export declare const OWN_PAD_FRAME: Readonly<Record<string, (props: Record<string, unknown>) => number>>;
|
|
17
|
+
export declare const OWN_PAD_FRAME: Readonly<Record<string, (props: Record<string, unknown>) => number | TierFrames>>;
|
|
17
18
|
export declare const OWN_PAD_LABEL: Readonly<Record<string, string>>;
|
|
18
19
|
export declare function withPadTotals(props: Record<string, unknown>, changed: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
|
|
19
20
|
export declare function olderPadNote(props: Record<string, unknown>, frame: number): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as b}from"react/jsx-runtime";import{HideTaker as N}from"../../../components/ViewHideRoot.js";import{LineChoice as p}from"../../../components/InBoxContext.js";import{isBackgroundBox as I}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as C}from"../../../../format/lib/content/box-side-space.js";import{BAND_PAD_KEYS as _,BAND_PAD_UNIT_KEY as F,BLOCK_PAD_FRAME as P,PAD_TOTAL_KEY as c,SECTION_PAD_KEYS as L,framePadAttrs as R,padTotalKeys as B,padValuesOf as K,sectionPadAttrs as H,tierFramesOf as D}from"../../content/section-padding.js";import{readPartStyle as W}from"../part-styles.js";import{CRUMB_PAD as y,SPEC_PAD as v}from"../../../../format/lib/sections/strip-shape.js";import{say as Y}from"../../../../format/lib/editor-words.js";import{sectionFillPassClass as h}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as j,drawsCopiesInTheBox as M}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as f}from"../../../../format/lib/own-entry.js";const E={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}},dt=new Set(Object.keys(E));function S(t,e){return e?.innerPadding??f(E,t)}const lt=t=>S(t)??{},ft=t=>f({DetailRows:{top:100,bottom:100}},t),O=new Set(["Flex","Text","Heading","ImageBlock","ButtonBlock"]),U=new Set(["Divider"]),$=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),T=new Set(["ProductGrid"]);function A(t,e,n=!1,o){const i=t.render;t.render=r=>{if(e?.(r))return i(r);const d={...K(r,L,n),sideSpace:C(r.sideSpace)},a=o?R({values:d,frame:o(r)},!0).outer:H(d),s=i(r);if(!a)return s;const l=u=>b(N,{className:u?`${a.className} ${u}`:a.className,style:a.style,children:s}),g=h(r,{atSectionLine:!0}),x=h(r);return g===x?l(g):b(p,{line:"by-box",draw:u=>l(u?x:g)})}}const ct={name:"sectionPadding",applies:(t,e,n)=>e.isSection(t)&&!$.has(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const o=S(e,t);if(o){t.fields={...t.fields,...n.sidesPaddingFields({keys:_,unitKey:F,fallback:o,tablet:!0,siteSide:!0})};return}if(T.has(e))return;const i=[_.top,_.bottom].filter(d=>t.fields!=null&&d in t.fields);if(i.length)throw new Error(`section-padding: ${e} declares its own ${i.join(" / ")} row; declare \`innerPadding: { top, bottom }\` in its meta and the one Padding row draws on its band`);const r=f(m,e);if(r){w(t,e,n,r);return}t.fields={...t.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(t,e){if(!S(e,t)){if(T.has(e)){A(t);return}O.has(e)||U.has(e)||A(t,e==="Flex"?n=>I(n.bgImage):j.has(e)?n=>M(e,n):void 0,!0,f(m,e))}}},V=["Heading","Text","ImageBlock","ButtonBlock"],X=["LogoBlock"],m={Text:t=>W(t,"text").textStyle?.startsWith("heading-")?P.heading:P.text,Heading:()=>P.heading,ButtonBlock:()=>P.text,Breadcrumb:()=>D(y),SpecStrip:()=>D(v)},k={ButtonBlock:"Outer padding"};function G(t,e){const n=t[c],o=Array.isArray(n)?n.filter(s=>typeof s=="string"):[],i=B().filter(s=>e?.[s]);if(!i.length)return t;const r=[...o.filter(s=>!i.includes(s)),...i.filter(s=>typeof t[s]=="number")];if(r.length===o.length&&r.every((s,l)=>s===o[l]))return t;const{[c]:d,...a}=t;return r.length?{...a,[c]:r}:a}function q(t,e){if(e<=0)return null;const n=Array.isArray(t[c])?t[c]:[];return B().some(i=>typeof t[i]=="number"&&!n.includes(i))?Y("plus {n} px (older setting)",{n:e}):null}function w(t,e,n,o){t.fields={...t.fields,...n.ownPaddingFields?.(o,q,f(k,e))??n.sidesPaddingFields({tablet:!0,siteSide:!0})};const i=t.resolveData;t.resolveData=(r,d)=>{const a=r.props??{},s=d?.trigger==="replace"?G(a,d.changed):a,l=s===a?r:{...r,props:s};return i?i(l,d):l}}const ut={name:"blockPadding",applies:(t,e,n)=>(V.includes(t)||X.includes(t))&&!!n&&typeof n.render=="function",panel(t,e,n){const o=f(m,e);if(!o){t.fields={...t.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})};return}w(t,e,n,o)},draw(t,e){O.has(e)||A(t,void 0,!0)}};export{m as OWN_PAD_FRAME,k as OWN_PAD_LABEL,U as PADS_ITS_OWN_SPACE,O as PAD_ON_ROOT,dt as SECTION_PAD_INNER,E as SECTION_PAD_INNER_DEFAULTS,ut as blockPadding,lt as innerPaddingFallback,q as olderPadNote,ft as ownPairDefault,ct as sectionPadding,G as withPadTotals};
|