efficient-web-builder 11.0.1 → 11.0.3

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 11.0.3 - 2026-10-14
4
+
5
+ - **The live page now draws a text in the site's own size, like the editor**
6
+ (found in the layered-rebuild samples). A text pointed at a site text style
7
+ (for example Heading 1) took the site's size from Site styles > Text sizes
8
+ in the editor, but the published page always drew the built-in size. Both
9
+ now write one size, `var(--size-<step>, <built-in>)`, from one function
10
+ (`followedStepSize` in `lib/puck/part-styles`), so the browser picks the
11
+ site's size when it is set and the built-in when it is not. A site that sets
12
+ no size draws exactly what it drew before. Guard:
13
+ `scripts/test-part-size-follows-site-sizes.tsx` (new);
14
+ `scripts/test-part-follows-style.tsx` §5 now checks the new shape.
15
+
16
+ ## 11.0.2 - 2026-10-14
17
+
18
+ - **Copy style copies a Post card's Darken and Darken style** (GG: Copy style
19
+ copies every look row). The two rows had no group, so they were in the
20
+ Content part, which Copy style never copies. They now have their own
21
+ "Image tint" group (Design), like HeroSingle's and the Hero slide's tint.
22
+ They still show only in the Cover layout. Only rows move, no key changes.
23
+ Guards: `scripts/test-copy-style-takes-every-look.tsx` now lets through
24
+ only a closed list (IntroBleed's button colours, which leave with the
25
+ samples work); `scripts/test-no-setting-lost.tsx` lists the two rows as the
26
+ one look that moved from Content to Design (`CONTENT_LOOK_TO_DESIGN`).
27
+
3
28
  ## 11.0.1 - 2026-10-14
4
29
 
5
30
  Three bugs from 11.0.0 (the two-tab move), found in the storefront-blocks bump.
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{BOX_DARKEN as t,BOX_DARKEN_STYLES as n}from"../../../../content/box-background.js";import{POST_CARD_HEIGHT as o,POST_CARD_LAYOUT_FALLBACK as g,POST_CARD_LAYOUTS as u}from"../../../../../components/PostCard.js";import k from"../../../../../components/BlogPostSource.js";import{HeightIcon as x,ImageIcon as y,LayoutIcon as C,OpacityIcon as S,StylesIcon as _}from"efficient-easel/icons";import{linkField as h,placementField as A,select as c,slider as m,sourceField as D,text as l,textarea as d,toggle as L,upload as O}from"../../../controls.js";import{POSTCARD_PH as r}from"./render.js";const E={fields:{source:D(k),image:O("Cover image","image/*"),title:d("Heading",r.title),excerpt:d("Excerpt",r.excerpt),href:h("Link"),category:l("Category",r.category),date:l("Date",r.date),readLabel:l("Read time",r.readLabel),layout:c("Card layout",e(C,{}),u,g),showCover:L("Show cover image",!0,e(y,{})),placement:A("Text position",{stacking:!1}),darken:m("Darken",e(S,{}),t.min,t.max,t.step,t.fallback,t.unit),darkenStyle:c("Darken style",e(_,{}),n,n[0].value),minHeight:m("Card height",e(x,{}),o.min,o.max,o.step,o.fallback,o.unit)},resolveFields:(p,{fields:f})=>{const s=p.props,a={...f};if(s.layout!=="cover")for(const i of["placement","darken","darkenStyle","minHeight"])delete a[i];else delete a.showCover;if(s.source?.slug)for(const i of["image","title","excerpt","href"])delete a[i];return a}};export{E as PostCardFields};
1
+ import{jsx as e}from"react/jsx-runtime";import{BOX_DARKEN as t,BOX_DARKEN_STYLES as s}from"../../../../content/box-background.js";import{POST_CARD_HEIGHT as o,POST_CARD_LAYOUT_FALLBACK as f,POST_CARD_LAYOUTS as u}from"../../../../../components/PostCard.js";import _ from"../../../../../components/BlogPostSource.js";import{HeightIcon as k,ImageIcon as x,LayoutIcon as y,OpacityIcon as C,StylesIcon as S}from"efficient-easel/icons";import{group as T,linkField as h,placementField as A,select as m,slider as c,sourceField as D,text as l,textarea as p,toggle as L,upload as O}from"../../../controls.js";import{POSTCARD_PH as r}from"./render.js";const b={fields:{source:D(_),image:O("Cover image","image/*"),title:p("Heading",r.title),excerpt:p("Excerpt",r.excerpt),href:h("Link"),category:l("Category",r.category),date:l("Date",r.date),readLabel:l("Read time",r.readLabel),layout:m("Card layout",e(y,{}),u,f),showCover:L("Show cover image",!0,e(x,{})),placement:A("Text position",{stacking:!1}),minHeight:c("Card height",e(k,{}),o.min,o.max,o.step,o.fallback,o.unit),_gTint:T("Image tint"),darken:c("Darken",e(C,{}),t.min,t.max,t.step,t.fallback,t.unit),darkenStyle:m("Darken style",e(S,{}),s,s[0].value)},resolveFields:(d,{fields:g})=>{const n=d.props,a={...g};if(n.layout!=="cover")for(const i of["placement","darken","darkenStyle","minHeight","_gTint"])delete a[i];else delete a.showCover;if(n.source?.slug)for(const i of["image","title","excerpt","href"])delete a[i];return a}};export{b as PostCardFields};
@@ -95,7 +95,7 @@ export declare function partSpacingOf(style: PartStyle): {
95
95
  letterSpacingEm?: number;
96
96
  };
97
97
  export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
98
- export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase, statedSteps?: ReadonlySet<string>): Record<string, string>;
98
+ export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase): Record<string, string>;
99
99
  export declare function isHexColour(value: string): boolean;
100
100
  export type MeasuredPartStyle = {
101
101
  fontSize: string;
@@ -1,2 +1,2 @@
1
- import{FONT_OPTIONS as K,FONT_ROLES as M,fontOption as G,SIZE_STEP_OF_ROLE as R}from"../fonts.js";import{encodePartKey as X}from"./part-key.js";import{decodePartId as F,normalizePartText as b}from"./text-parts.js";import{COLOUR_TOKEN as H}from"../word-styles.js";const E="_partStyles",V="data-sf-part-styled",U=["none","upper","lower"],B=[400,500,600,700],Z=["left","center","right","justify"],Y=5,q=1e3,v=-5,J=10,Q=0,tt=64,et=2,nt=120,T=1280,rt=10,$={size:{min:Y,max:q,step:1},padding:{min:Q,max:tt,step:et},width:{min:nt,max:T,step:rt}},ot=.05,it=.01,st=["line","letter"],at=.5,ct=2.5,lt=-1,ft=1,ut=0,pt=400,w={none:"none",upper:"uppercase",lower:"lowercase"};function P(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function L(t){return P(t?.[E])??{}}function j(t,e){const n=L(t);return Object.hasOwn(n,e)?P(n[e])??{}:{}}function Xt(t,e){return Object.values(j(t,e)).filter(n=>n!==void 0).length}function k(t,e,n){const r={...L(t)};if(dt(n).length?r[e]=n:delete r[e],!Object.keys(r).length){const{[E]:o,...i}=t;return i}return{...t,[E]:r}}function dt(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function xt(t){return st.includes(t)}const h=(t,e,n)=>Math.min(n,Math.max(e,t));function mt(t,e){if(xt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:h(n,v,J)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?m(h(n,at,ct),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?m(h(n,lt,ft),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:h(n,ut,pt)}if(Object.hasOwn($,t)){const{min:n,max:r}=$[t],o=Math.round(Number(e));return Number.isFinite(o)?h(o,n,r):null}return t==="role"?M.includes(String(e))?e:null:e}const gt=[["font","role"],["line","lineHeight"],["letter","letterSpacing"]];function Pt(t){const e=[];for(const[n,r]of gt)n===t?e.push(r):r===t&&e.push(n);return e}function Vt(t,e,n,r){const o={...j(t,e)},i=r==null?null:mt(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of Pt(n))delete o[s]}return k(t,e,o)}function Ut(t,e){return k(t,e,{})}function ht(t){for(const e of U)if(w[e]===t)return e;return"none"}function _t(t){return!t||!Object.hasOwn(w,t)?"":w[t]}const At={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 Tt(t){const e=t.role;return e&&M.includes(e)?e:null}const St={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(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=m(bt+t.line*ot,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=m(t.letter*it,4)),e}const bt=1,_="--sf-part-para";function S(t,e,n){const r=Tt(t),o=Rt(t),i=t.size?`${t.size}px`:r?n?.has(R[r])?`var(--size-${R[r]})`:St[R[r]]??"":"";return{fontFamily:t.font?Ot(t.font):r?`var(${At[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`:"",[_]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:_t(t.case),textAlign:t.align??"",paddingTop:N(t.padding),paddingBottom:N(t.padding),maxWidth:N(t.width),color:Et(t.color)}}const Et=t=>t===void 0||t===""?"":Object.hasOwn(H,t)?H[t]:W.test(t)?t:"",W=/^#[0-9a-fA-F]{6}$/;function Bt(t){return W.test(t)}const N=t=>t===void 0?"":`${t}px`,m=(t,e)=>Number(t.toFixed(e));function Zt(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:wt(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:Nt(t.textAlign),case:ht(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0,widthPx:Number.isFinite(s)&&s<T?Math.round(s):T}}function wt(t){return Number.isFinite(t)?B.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Nt(t){for(const e of Z)if(e===t)return e;return t==="end"?"right":"left"}function Yt(t,e){const n=D(t);if(!n)return"";for(const r of K)if(D(e(r.cssVar))===n)return r.key;return""}const D=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ot(t){const e=G(t);return e?`var(${e.cssVar})`:""}function qt(t,e,n,r){return!e||F(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function yt(t){const e=new Set,n=t;if(typeof window>"u"||!n?.ownerDocument)return e;const r=window.getComputedStyle(n);for(const o of It)r.getPropertyValue(`--size-${o}`).trim()&&e.add(o);return e}const It=["headingLarge","headingMedium","headingSmall","accent","body","label"];function vt(t,e,n=()=>A,r=i=>i,o=Ht){let i=0;for(const{element:s,partId:a}of t){const l=F(a)?.propKey;if(!l)continue;const c=r(l),f=Object.hasOwn(e,c)?P(e[c])??{}:{},p=S(f,A,yt(s)),u=y.some(x=>s.style[x]);let d=!1;for(const[x,g]of Object.entries(p))$t(s,x,g),g&&(d=!0);if(u||y.some(x=>p[x]))for(const x of Mt(s,o))for(const g of y)x.style[g]=p[g]??"";d&&(i+=1)}return i}function Mt(t,e){const n=b(t.textContent??""),r=[];let o=t;for(let i=0;i<Ft&&e(o);i+=1){const s=o.parentElement;if(!s||b(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Ft=8;function Ht(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:T};function $t(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===_&&(n?o.setAttribute?.(C,""):o.removeAttribute?.(C))}const C="data-sf-part-para",Lt=Object.keys(S({},A)),O=new Set(["color","overflowWrap",_]),y=Lt.filter(t=>!O.has(t));function Jt(t,e,n,r=o=>o){const o=new Map;for(const a of t){const l=X(a.key,a.row);for(const c of a.texts){const f=o.get(c);f?(f.keys.add(a.key),f.partKeys.add(l)):o.set(c,{keys:new Set([a.key]),partKeys:new Set([l])})}}const i=new Map;for(const a of Object.keys(e)){if(!jt(a))continue;const l=P(e[a])??{},c=S(l,A);Object.values(c).some(Boolean)&&i.set(a,{stamp:z(n,a),declarations:c})}const s=new Map;for(const[a,{keys:l,partKeys:c}]of o){const f=c.size===1?[...c][0]:l.size===1?[...l][0]:null;if(!f)continue;const p=r(f);if(!Object.hasOwn(e,p))continue;const u=P(e[p])??{},d=S(u,A);Object.values(d).some(Boolean)&&s.set(a,{stamp:z(n,f),declarations:d})}return s.size||i.size?{rules:s,kindRules:i,drawn:new Set(o.keys())}:null}function jt(t){return t.startsWith("@")}function Qt(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 te(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const a=Object.entries(s).filter(([,u])=>u!==""),l=u=>u.map(([d,I])=>`${Wt(d)}: ${I}`).join("; "),c=`[${V}="${i}"]`,f=a.filter(([u])=>!O.has(u)),p=a.filter(([u])=>O.has(u));f.length&&e.push(`${c}, *:has(> ${c}) { ${l(f)} }`),p.length&&e.push(`${c} { ${l(p)} }`),s[_]&&e.push(...kt(c))};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
2
- `)}function kt(t){const e=`var(${_})`,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 Wt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function ee(t,e){if(!t)return null;const n=b(e),r=t.rules.get(n);if(r)return r;if(n.length<Dt||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 Dt=8;export{Z as PART_ALIGNS,U as PART_CASES,ft as PART_LETTER_EM_MAX,lt as PART_LETTER_EM_MIN,it as PART_LETTER_STEP,ct as PART_LINE_HEIGHT_MAX,at as PART_LINE_HEIGHT_MIN,ot as PART_LINE_STEP,$ as PART_MEASURED_TRACKS,J as PART_NUDGE_MAX,v as PART_NUDGE_MIN,tt as PART_PADDING_MAX,Q as PART_PADDING_MIN,et as PART_PADDING_STEP,C as PART_PARAGRAPH_ATTR,pt as PART_PARAGRAPH_MAX,ut as PART_PARAGRAPH_MIN,_ as PART_PARAGRAPH_VAR,st as PART_RELATIVE_PROPS,q as PART_SIZE_MAX,Y as PART_SIZE_MIN,V as PART_STYLED_ATTR,E as PART_STYLES_PROP,Lt as PART_STYLE_PROPERTIES,B as PART_WEIGHTS,T as PART_WIDTH_MAX,nt as PART_WIDTH_MIN,rt as PART_WIDTH_STEP,y as SHARED_PART_PROPERTIES,vt as applyPartStyles,Bt as isHexColour,jt as isPartKindKey,kt as paragraphRules,ht as partCaseOfTransform,_t as partCaseTransform,Yt as partFontKeyOf,Qt as partRuleForKind,ee as partRuleForText,Rt as partSpacingOf,Zt as partStyleBase,Xt as partStyleCount,te as partStyleCss,S as partStyleDeclarations,qt as partStyleSource,Vt as propsWithPartStyleValue,Ut as propsWithoutPartStyle,Jt as publishedPartStyles,j as readPartStyle,L as readPartStyles};
1
+ import{FONT_OPTIONS as C,FONT_ROLES as I,fontOption as K,SIZE_STEP_OF_ROLE as G}from"../fonts.js";import{encodePartKey as X}from"./part-key.js";import{decodePartId as M,normalizePartText as S}from"./text-parts.js";import{COLOUR_TOKEN as $}from"../word-styles.js";const b="_partStyles",U="data-sf-part-styled",V=["none","upper","lower"],B=[400,500,600,700],Y=["left","center","right","justify"],Z=5,v=1e3,q=-5,J=10,Q=0,tt=64,nt=2,et=120,T=1280,rt=10,H={size:{min:Z,max:v,step:1},padding:{min:Q,max:tt,step:nt},width:{min:et,max:T,step:rt}},ot=.05,it=.01,st=["line","letter"],ct=.5,at=2.5,lt=-1,ft=1,ut=0,pt=400,E={none:"none",upper:"uppercase",lower:"lowercase"};function g(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function F(t){return g(t?.[b])??{}}function L(t,n){const e=F(t);return Object.hasOwn(e,n)?g(e[n])??{}:{}}function Gt(t,n){return Object.values(L(t,n)).filter(e=>e!==void 0).length}function j(t,n,e){const r={...F(t)};if(dt(e).length?r[n]=e:delete r[n],!Object.keys(r).length){const{[b]:o,...i}=t;return i}return{...t,[b]:r}}function dt(t){return Object.entries(t).filter(([,n])=>n!==void 0)}function xt(t){return st.includes(t)}const h=(t,n,e)=>Math.min(e,Math.max(n,t));function mt(t,n){if(xt(t)){const e=Math.round(Number(n));return!Number.isFinite(e)||e===0?null:h(e,q,J)}if(t==="lineHeight"){const e=Number(n);return Number.isFinite(e)?m(h(e,ct,at),3):null}if(t==="letterSpacing"){const e=Number(n);return Number.isFinite(e)?m(h(e,lt,ft),4):null}if(t==="paragraphSpacing"){const e=Math.round(Number(n));return!Number.isFinite(e)||e<=0?null:h(e,ut,pt)}if(Object.hasOwn(H,t)){const{min:e,max:r}=H[t],o=Math.round(Number(n));return Number.isFinite(o)?h(o,e,r):null}return t==="role"?I.includes(String(n))?n:null:n}const Pt=[["font","role"],["line","lineHeight"],["letter","letterSpacing"]];function gt(t){const n=[];for(const[e,r]of Pt)e===t?n.push(r):r===t&&n.push(e);return n}function Xt(t,n,e,r){const o={...L(t,n)},i=r==null?null:mt(e,r);if(i===null)delete o[e];else{o[e]=i;for(const s of gt(e))delete o[s]}return j(t,n,o)}function Ut(t,n){return j(t,n,{})}function ht(t){for(const n of V)if(E[n]===t)return n;return"none"}function At(t){return!t||!Object.hasOwn(E,t)?"":E[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 Tt(t){const n=t.role;return n&&I.includes(n)?n:null}const Rt={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 St(t){const n=G[t],e=Rt[n];return e?`var(--size-${n}, ${e})`:`var(--size-${n})`}function bt(t){const n={};return typeof t.lineHeight=="number"?n.lineHeight=t.lineHeight:t.line&&(n.lineHeight=m(Et+t.line*ot,3)),typeof t.letterSpacing=="number"?n.letterSpacingEm=t.letterSpacing:t.letter&&(n.letterSpacingEm=m(t.letter*it,4)),n}const Et=1,A="--sf-part-para";function R(t,n){const e=Tt(t),r=bt(t),o=t.size?`${t.size}px`:e?St(e):"";return{fontFamily:t.font?yt(t.font):e?`var(${_t[e]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:o,minWidth:o?"0":"",overflowWrap:o?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[A]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:At(t.case),textAlign:t.align??"",paddingTop:N(t.padding),paddingBottom:N(t.padding),maxWidth:N(t.width),color:Nt(t.color)}}const Nt=t=>t===void 0||t===""?"":Object.hasOwn($,t)?$[t]:k.test(t)?t:"",k=/^#[0-9a-fA-F]{6}$/;function Vt(t){return k.test(t)}const N=t=>t===void 0?"":`${t}px`,m=(t,n)=>Number(t.toFixed(n));function Bt(t,n){const e=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:n,sizePx:e,weight:Ot(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?m(r/e,3):1.2,letterEm:Number.isFinite(o)?m(o/e,4):0,align:wt(t.textAlign),case:ht(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0,widthPx:Number.isFinite(s)&&s<T?Math.round(s):T}}function Ot(t){return Number.isFinite(t)?B.reduce((n,e)=>Math.abs(e-t)<Math.abs(n-t)?e:n):400}function wt(t){for(const n of Y)if(n===t)return n;return t==="end"?"right":"left"}function Yt(t,n){const e=W(t);if(!e)return"";for(const r of C)if(W(n(r.cssVar))===e)return r.key;return""}const W=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function yt(t){const n=K(t);return n?`var(${n.cssVar})`:""}function Zt(t,n,e,r){return!n||M(n)?.nodeId!==t?null:e.find(i=>r(i.getAttribute("class")))??e[0]??null}function vt(t,n,e=()=>_,r=i=>i,o=$t){let i=0;for(const{element:s,partId:c}of t){const l=M(c)?.propKey;if(!l)continue;const a=r(l),f=Object.hasOwn(n,a)?g(n[a])??{}:{},p=R(f,_),u=w.some(x=>s.style[x]);let d=!1;for(const[x,P]of Object.entries(p))Ht(s,x,P),P&&(d=!0);if(u||w.some(x=>p[x]))for(const x of It(s,o))for(const P of w)x.style[P]=p[P]??"";d&&(i+=1)}return i}function It(t,n){const e=S(t.textContent??""),r=[];let o=t;for(let i=0;i<Mt&&n(o);i+=1){const s=o.parentElement;if(!s||S(s.textContent??"")!==e)break;r.push(s),o=s}return r}const Mt=8;function $t(t){const n=t;return typeof window>"u"||!n?.ownerDocument?!1:window.getComputedStyle(n).display==="inline"}const _={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:T};function Ht(t,n,e){if(!n.startsWith("--")){t.style[n]=e;return}const r=t.style;typeof r.setProperty=="function"?e?r.setProperty(n,e):r.removeProperty?.(n):r[n]=e;const o=t;n===A&&(e?o.setAttribute?.(z,""):o.removeAttribute?.(z))}const z="data-sf-part-para",Ft=Object.keys(R({},_)),O=new Set(["color","overflowWrap",A]),w=Ft.filter(t=>!O.has(t));function qt(t,n,e,r=o=>o){const o=new Map;for(const c of t){const l=X(c.key,c.row);for(const a of c.texts){const f=o.get(a);f?(f.keys.add(c.key),f.partKeys.add(l)):o.set(a,{keys:new Set([c.key]),partKeys:new Set([l])})}}const i=new Map;for(const c of Object.keys(n)){if(!Lt(c))continue;const l=g(n[c])??{},a=R(l,_);Object.values(a).some(Boolean)&&i.set(c,{stamp:D(e,c),declarations:a})}const s=new Map;for(const[c,{keys:l,partKeys:a}]of o){const f=a.size===1?[...a][0]:l.size===1?[...l][0]:null;if(!f)continue;const p=r(f);if(!Object.hasOwn(n,p))continue;const u=g(n[p])??{},d=R(u,_);Object.values(d).some(Boolean)&&s.set(c,{stamp:D(e,f),declarations:d})}return s.size||i.size?{rules:s,kindRules:i,drawn:new Set(o.keys())}:null}function Lt(t){return t.startsWith("@")}function Jt(t,n){return t?.kindRules.get(n)??null}function D(t,n){const e=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${e(t)}~${e(n)}`}function Qt(t){const n=[],e=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(e.has(i))return;e.add(i);const c=Object.entries(s).filter(([,u])=>u!==""),l=u=>u.map(([d,y])=>`${kt(d)}: ${y}`).join("; "),a=`[${U}="${i}"]`,f=c.filter(([u])=>!O.has(u)),p=c.filter(([u])=>O.has(u));f.length&&n.push(`${a}, *:has(> ${a}) { ${l(f)} }`),p.length&&n.push(`${a} { ${l(p)} }`),s[A]&&n.push(...jt(a))};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return n.join(`
2
+ `)}function jt(t){const n=`var(${A})`,e=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${e}:not(:first-child) { margin-top: ${n} }`,`${t} ${e}:not(:last-child) { margin-bottom: ${n} }`]}const kt=t=>t.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);function tn(t,n){if(!t)return null;const e=S(n),r=t.rules.get(e);if(r)return r;if(e.length<Wt||t.drawn.has(e))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(e)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const Wt=8;export{Y as PART_ALIGNS,V as PART_CASES,ft as PART_LETTER_EM_MAX,lt as PART_LETTER_EM_MIN,it as PART_LETTER_STEP,at as PART_LINE_HEIGHT_MAX,ct as PART_LINE_HEIGHT_MIN,ot as PART_LINE_STEP,H as PART_MEASURED_TRACKS,J as PART_NUDGE_MAX,q as PART_NUDGE_MIN,tt as PART_PADDING_MAX,Q as PART_PADDING_MIN,nt as PART_PADDING_STEP,z as PART_PARAGRAPH_ATTR,pt as PART_PARAGRAPH_MAX,ut as PART_PARAGRAPH_MIN,A as PART_PARAGRAPH_VAR,st as PART_RELATIVE_PROPS,v as PART_SIZE_MAX,Z as PART_SIZE_MIN,U as PART_STYLED_ATTR,b as PART_STYLES_PROP,Ft as PART_STYLE_PROPERTIES,B as PART_WEIGHTS,T as PART_WIDTH_MAX,et as PART_WIDTH_MIN,rt as PART_WIDTH_STEP,w as SHARED_PART_PROPERTIES,vt as applyPartStyles,Vt as isHexColour,Lt as isPartKindKey,jt as paragraphRules,ht as partCaseOfTransform,At as partCaseTransform,Yt as partFontKeyOf,Jt as partRuleForKind,tn as partRuleForText,bt as partSpacingOf,Bt as partStyleBase,Gt as partStyleCount,Qt as partStyleCss,R as partStyleDeclarations,Zt as partStyleSource,Xt as propsWithPartStyleValue,Ut as propsWithoutPartStyle,qt as publishedPartStyles,L as readPartStyle,F as readPartStyles};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "11.0.1",
3
+ "version": "11.0.3",
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",