efficient-web-builder 74.7.0 → 74.8.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 +29 -0
- package/dist/editor/components/CustomHtmlCodeWindow.js +3 -3
- package/dist/editor/components/DuplicateToPageMenu.js +1 -1
- package/dist/editor/components/PagesPanel.js +1 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/PreviewPartAnchors.d.ts +2 -2
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/components/SectionTextPartBridge.js +1 -1
- package/dist/editor/components/SiteAccentField.js +1 -1
- package/dist/editor/components/SiteTextStylesField.d.ts +2 -0
- package/dist/editor/components/SiteTextStylesField.js +1 -1
- package/dist/editor/components/StandaloneSectionEditor.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/components/storefront-editor.css +5 -5
- package/dist/editor/components/useSocialSettings.d.ts +2 -2
- package/dist/editor/lib/content/section-one-padding.d.ts +31 -0
- package/dist/editor/lib/content/section-one-padding.js +1 -0
- package/dist/editor/lib/document/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/document/box-fields.d.ts +1 -1
- package/dist/editor/lib/document/page-root.js +2 -2
- package/dist/format/lib/content/box-shape.d.ts +1 -1
- package/dist/format/lib/document/blocks/block-types.d.ts +2 -0
- package/dist/format/lib/document/passes/types.d.ts +2 -0
- package/dist/format/lib/document/style-text.d.ts +2 -0
- package/dist/format/lib/document/style-text.js +1 -1
- package/dist/format/lib/fonts.d.ts +43 -7
- package/dist/format/lib/fonts.js +1 -1
- package/dist/format/lib/site-font-faces.d.ts +9 -0
- package/dist/format/lib/site-font-faces.js +2 -0
- package/dist/format/lib/site-theme-row.d.ts +29 -1
- package/dist/format/lib/site-theme-row.js +1 -0
- package/dist/format/lib/sized-image.js +1 -1
- package/dist/format/lib/source-rules/one-dropdown.js +3 -3
- package/dist/format/lib/source-rules/page-picture-place.js +3 -3
- package/dist/format/lib/source-rules/published-mounts.js +38 -38
- package/dist/format/lib/source-rules/shape-rows-use-the-picker.js +2 -2
- package/dist/format/lib/source-rules/support/element-call.d.ts +5 -0
- package/dist/format/lib/source-rules/support/element-call.js +1 -0
- package/dist/format/lib/word-styles.d.ts +7 -6
- package/dist/format/lib/word-styles.js +1 -1
- package/dist/render/components/HeroPictures.d.ts +2 -2
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/components/SiteFontsContext.d.ts +11 -0
- package/dist/render/components/SiteFontsContext.js +2 -0
- package/dist/render/lib/content/section-own-pads.d.ts +2 -2
- package/dist/render/lib/content/section-own-pads.js +1 -1
- package/dist/render/lib/document/part-styles.d.ts +7 -5
- package/dist/render/lib/document/part-styles.js +2 -2
- 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/render/lib/text-styles/site-text-styles.d.ts +3 -3
- package/dist/render/lib/text-styles/site-text-styles.js +2 -2
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isRuleSource as
|
|
2
|
-
`),
|
|
1
|
+
import{isRuleSource as k,ruleChecks as S}from"./rule.js";import{elementOf as P}from"./support/element-call.js";const w=new Set(["Select","SettingsSelect","FieldSelect"]);function g(t,n){const i=t.createSourceFile(n.path,n.text,t.ScriptTarget.Latest,!0,t.ScriptKind.TSX),r=[],p=[],c=e=>i.getLineAndCharacterOfPosition(e.getStart(i)).line+1,d=e=>{let s=e;for(;s&&(t.isAsExpression(s)||t.isSatisfiesExpression(s)||t.isParenthesizedExpression(s));)s=s.expression;return s},a=e=>e?t.isStringLiteralLike(e)?e.text:e.getText(i):"(no label)",f=e=>e.name&&(t.isIdentifier(e.name)||t.isStringLiteralLike(e.name))?e.name.text:void 0,x=(e,s)=>{for(const o of e.properties)if(f(o)===s){if(t.isPropertyAssignment(o))return o.initializer;if(t.isShorthandPropertyAssignment(o))return o.name}},h=e=>{const s=e.parent;return t.isCallExpression(s)&&t.isIdentifier(s.expression)&&s.expression.text==="describedAs"&&s.arguments[1]===e},m=e=>{if(t.isCallExpression(e)){const s=e.arguments[0];(t.isIdentifier(e.expression)&&e.expression.text==="select"||t.isPropertyAccessExpression(e.expression)&&e.expression.name.text==="select")&&e.arguments.length>=2&&s&&!t.isObjectLiteralExpression(s)&&r.push(`${n.path}|${a(s)}`);const l=e.arguments[1],u=P(t,e);u&&t.isIdentifier(u)&&u.text==="IconPicker"&&l&&t.isObjectLiteralExpression(l)&&l.properties.some(b=>f(b)==="emptyValue")&&p.push(c(l))}if(t.isImportSpecifier(e)&&e.propertyName&&(e.propertyName.text==="select"||e.propertyName.text==="IconPicker")&&r.push(`${n.path}|alias ${e.name.text}`),t.isBindingElement(e)&&e.propertyName&&t.isIdentifier(e.propertyName)&&e.propertyName.text==="select"&&r.push(`${n.path}|alias ${e.name.getText(i)}`),(t.isJsxOpeningElement(e)||t.isJsxSelfClosingElement(e))&&w.has(e.tagName.getText(i))){const s=e.attributes.properties.find(l=>t.isJsxAttribute(l)&&l.name.getText(i)==="label"),o=s&&t.isJsxAttribute(s)?s.initializer:void 0;r.push(`${n.path}|<${e.tagName.getText(i)}> ${o?a(t.isJsxExpression(o)?o.expression:o):"(no label)"}`)}if(t.isObjectLiteralExpression(e))for(const s of["type","kind"]){const o=d(x(e,s));o&&t.isStringLiteralLike(o)&&o.text==="select"&&!h(e)&&r.push(`${n.path}|${a(x(e,"label"))}`)}t.isJsxAttribute(e)&&e.name.getText(i)==="emptyValue"&&e.parent.parent.tagName.getText(i)==="IconPicker"&&p.push(c(e)),t.isJsxSpreadAttribute(e)&&e.parent.parent.tagName.getText(i)==="IconPicker"&&p.push(c(e)),t.forEachChild(e,m)};return m(i),{selects:r,emptyValues:p}}function y(t){const n=new Map;for(const i of t)n.set(i,(n.get(i)??0)+1);return n}function $(t,n,i){const{check:r,report:p}=S("shape rows use the picker");{const e=['const a = select("Corner shape", icon, options);','const b = { type: "select", label: "Card shape", options };','const c = { type: "select" as const, label: LABEL, options };',"const d = select(item);",'const e = iconPickerRow("Corner shape", icon, options, "a");','const f = <IconPicker label="x" emptyValue="none" options={o} />;','const g = <IconPicker label="x" options={o} />;','const h = <Other emptyValue="none" />;','// select("A comment", icon) is not a use','const i = select(say("Said"), icon, options);',"const j = select(LABELS.x, icon, options);","const k = select(`A ${b}`, icon, options);",'const l = { "type": "select", label, options };',"const m = select({ index }, other);",'import { select as pick } from "x";','const n = createElement(IconPicker<V>, { label: "x", emptyValue: "none" });','const o = createElement(IconPicker, { label: "x" });','const p = rows.select("By a member", icon, options);',"const { select: q } = rows;",'const r = { type: "select" satisfies string, label: "Satisfied", options };','const s = { kind: "select", label: "A kind", options };','const t = <SettingsSelect label="Hand drawn" options={o} />;',"const u = <FieldSelect value={v} options={o} />;",'const v = <IconPicker label="x" {...rest} />;','import { IconPicker as Pick } from "x";','const w = describedAs(field, { type: "select", label: "Described" });',"const x = rows.select(item);"].join(`
|
|
2
|
+
`),s=g(t,{path:"f.tsx",text:e});r("R1 finds the builder and both field forms, and nothing else",JSON.stringify(s.selects)===JSON.stringify(["f.tsx|Corner shape","f.tsx|Card shape","f.tsx|LABEL",'f.tsx|say("Said")',"f.tsx|LABELS.x","f.tsx|`A ${b}`","f.tsx|label","f.tsx|alias pick","f.tsx|By a member","f.tsx|alias q","f.tsx|Satisfied","f.tsx|A kind","f.tsx|<SettingsSelect> Hand drawn","f.tsx|<FieldSelect> (no label)","f.tsx|alias Pick"]),JSON.stringify(s.selects)),r("R2 finds emptyValue on an IconPicker only, in both forms, and a spread",JSON.stringify(s.emptyValues)==="[6,16,24]",JSON.stringify(s.emptyValues))}const c=n.filter(e=>/\.tsx?$/.test(e.path)&&!e.path.endsWith(".d.ts")&&!k(e.path)),d=[],a=[];for(const e of c){const s=g(t,e);d.push(...s.selects),s.emptyValues.forEach(o=>a.push(`${e.path}:${o}`))}const f=y(d),x=y(i.selectRows),h=[...f].filter(([e,s])=>s>(x.get(e)??0)).map(([e])=>e).sort(),m=[...x].filter(([e,s])=>s>(f.get(e)??0)).map(([e])=>e);return r("R1 every select row is on the repository's list",h.length===0,`${h.join(", ")}: a row that picks between shapes uses iconPickerRow or shapePickerRow; a row that picks words joins the list`),r("R1 every name on the list is still a select row",m.length===0,`${m.join(", ")}: remove the entry`),r("R2 no IconPicker takes emptyValue",a.length===0,`${a.join(", ")}: use pickerNoneIcon, so the closed word has the size of every other`),r(`walked the source (${c.length} TS/TSX files, at least ${i.minFiles})`,c.length>=i.minFiles),p()}export{$ as shapeRowsUseThePicker};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as TS from "typescript";
|
|
2
|
+
export declare const ELEMENT_FACTORIES: ReadonlySet<string>;
|
|
3
|
+
export declare const ELEMENT_FACTORY_PATTERN = "(?:createElement|\\bh|_?jsxs?|_?jsxDEV)";
|
|
4
|
+
export declare function factoryCall(ts: typeof TS, call: TS.CallExpression): boolean;
|
|
5
|
+
export declare function elementOf(ts: typeof TS, call: TS.CallExpression): TS.Expression | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=new Set(["createElement","h","jsx","jsxs","jsxDEV","_jsx","_jsxs","_jsxDEV"]),o="(?:createElement|\\bh|_?jsxs?|_?jsxDEV)";function r(s,n){const e=n.expression;if(s.isIdentifier(e))return e.text;if(s.isPropertyAccessExpression(e))return e.name.text}function t(s,n){const e=r(s,n);return e!==void 0&&i.has(e)}function x(s,n){if(!t(s,n))return;let e=n.arguments[0];for(;e;)if(s.isParenthesizedExpression(e)||s.isAsExpression(e)||s.isNonNullExpression(e)||s.isSatisfiesExpression(e))e=e.expression;else if(s.isExpressionWithTypeArguments(e))e=e.expression;else break;return e}export{i as ELEMENT_FACTORIES,o as ELEMENT_FACTORY_PATTERN,x as elementOf,t as factoryCall};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FontRegistry } from "./fonts.js";
|
|
1
2
|
export declare const WORD_STYLES: readonly ["highlight", "strong", "quiet"];
|
|
2
3
|
export type WordStyleName = (typeof WORD_STYLES)[number];
|
|
3
4
|
export declare const WORD_STYLE_LABELS: Record<WordStyleName, string>;
|
|
@@ -40,14 +41,14 @@ export declare const WORD_STYLE_TEXT_GAP_MIN = -0.1;
|
|
|
40
41
|
export declare const WORD_STYLE_TEXT_GAP_MAX = 0.5;
|
|
41
42
|
export declare const WORD_STYLE_GAP_PRECISION = 3;
|
|
42
43
|
export declare const DEFAULT_WORD_STYLES: Record<WordStyleName, ResolvedWordStyle>;
|
|
43
|
-
export declare function normalizeWordStyle(v?: WordStyleValue | null): ResolvedWordStyle;
|
|
44
|
-
export declare function normalizeWordStyles(v?: Partial<Record<WordStyleName, WordStyleValue | null>> | null): Record<WordStyleName, ResolvedWordStyle>;
|
|
45
|
-
export declare function wordStyleIsDefault(name: WordStyleName, v?: WordStyleValue | null): boolean;
|
|
46
|
-
export declare function wordStyleTokens(v?: Partial<Record<WordStyleName, WordStyleValue | null>> | null): Record<string, string>;
|
|
44
|
+
export declare function normalizeWordStyle(v?: WordStyleValue | null, registry?: FontRegistry): ResolvedWordStyle;
|
|
45
|
+
export declare function normalizeWordStyles(v?: Partial<Record<WordStyleName, WordStyleValue | null>> | null, registry?: FontRegistry): Record<WordStyleName, ResolvedWordStyle>;
|
|
46
|
+
export declare function wordStyleIsDefault(name: WordStyleName, v?: WordStyleValue | null, registry?: FontRegistry): boolean;
|
|
47
|
+
export declare function wordStyleTokens(v?: Partial<Record<WordStyleName, WordStyleValue | null>> | null, registry?: FontRegistry): Record<string, string>;
|
|
47
48
|
export interface WordStylesRow {
|
|
48
49
|
word_styles?: Partial<Record<string, WordStyleValue | null>> | null;
|
|
49
50
|
}
|
|
50
|
-
export declare function wordStylesFromRow(row?: WordStylesRow | null): Record<WordStyleName, ResolvedWordStyle>;
|
|
51
|
-
export declare function wordStylesToRow(v?: Partial<Record<WordStyleName, WordStyleValue | null>> | null): {
|
|
51
|
+
export declare function wordStylesFromRow(row?: WordStylesRow | null, registry?: FontRegistry): Record<WordStyleName, ResolvedWordStyle>;
|
|
52
|
+
export declare function wordStylesToRow(v?: Partial<Record<WordStyleName, WordStyleValue | null>> | null, registry?: FontRegistry): {
|
|
52
53
|
word_styles: Record<WordStyleName, ResolvedWordStyle>;
|
|
53
54
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{POOL_FONT_REGISTRY as s}from"./fonts.js";const c=["highlight","strong","quiet"],G={highlight:"Highlight",strong:"Bold",quiet:"Quiet"},E={highlight:{kind:"wordHighlight",delimiter:"@@"},strong:{kind:"wordStrong",delimiter:"++"},quiet:{kind:"wordQuiet",delimiter:"^^"}},Y=Object.fromEntries(c.map(t=>[E[t].kind,t])),N="data-sf-ws",T=["accent","text","labels"],g={accent:"var(--accent)",text:"var(--fg)",labels:"var(--fg-dim)"},h=80,O=120,m=100,R=900,L=.5,w=3,y=-.1,W=.5,b=3,u={font:null,size:null,weight:null,bold:null,italic:null,lineGap:null,textGap:null,colour:null},f={highlight:{...u},strong:{...u},quiet:{...u}};function p(t,e,l){return typeof t!="number"||!Number.isFinite(t)?null:Math.round(Math.min(Math.max(t,e),l))}function d(t,e,l){if(typeof t!="number"||!Number.isFinite(t))return null;const o=10**b;return Math.round(Math.min(Math.max(t,e),l)*o)/o}function S(t){return typeof t=="boolean"?t:null}function x(t,e=s){const l=typeof t?.font=="string"&&e.byKey.has(t.font)?t.font:null,o=typeof t?.colour=="string"&&T.includes(t.colour)?t.colour:null;return{font:l,size:p(t?.size,h,O),weight:p(t?.weight,m,R),bold:S(t?.bold),italic:S(t?.italic),lineGap:d(t?.lineGap,L,w),textGap:d(t?.textGap,y,W),colour:o}}function a(t,e=s){const l={};for(const o of c)l[o]=t&&o in t&&t[o]?x(t[o],e):{...f[o]};return l}function I(t,e,l=s){const o=x(e,l),r=f[t];return Object.keys(r).every(n=>o[n]===r[n])}function M(t,e=s){const l=a(t,e),o={};for(const r of c){const n=l[r],i=`--sf-ws-${r}`;if(n.font){const _=e.byKey.get(n.font);_&&(o[`${i}-font`]=`var(${_.cssVar})`)}n.size!==null&&(o[`${i}-size`]=`${n.size/100}em`),n.weight!==null&&(o[`${i}-weight`]=String(n.weight)),n.bold!==null&&(o[`${i}-weight-bold`]=n.bold?"700":"400"),n.italic!==null&&(o[`${i}-style`]=n.italic?"italic":"normal"),n.lineGap!==null&&(o[`${i}-line`]=String(n.lineGap)),n.textGap!==null&&(o[`${i}-track`]=`${n.textGap}em`),n.colour!==null&&(o[`${i}-color`]=g[n.colour])}return o}function A(t,e=s){const l=t?.word_styles??void 0,o={};for(const r of c)l&&r in l&&(o[r]=l[r]??null);return a(o,e)}function $(t,e=s){return{word_styles:a(t,e)}}export{g as COLOUR_TOKEN,f as DEFAULT_WORD_STYLES,c as WORD_STYLES,N as WORD_STYLE_ATTR,Y as WORD_STYLE_BY_KIND,T as WORD_STYLE_COLOURS,b as WORD_STYLE_GAP_PRECISION,G as WORD_STYLE_LABELS,w as WORD_STYLE_LINE_GAP_MAX,L as WORD_STYLE_LINE_GAP_MIN,E as WORD_STYLE_MARKS,O as WORD_STYLE_SIZE_MAX,h as WORD_STYLE_SIZE_MIN,W as WORD_STYLE_TEXT_GAP_MAX,y as WORD_STYLE_TEXT_GAP_MIN,R as WORD_STYLE_WEIGHT_MAX,m as WORD_STYLE_WEIGHT_MIN,x as normalizeWordStyle,a as normalizeWordStyles,I as wordStyleIsDefault,M as wordStyleTokens,A as wordStylesFromRow,$ as wordStylesToRow};
|
|
@@ -16,8 +16,8 @@ export declare function heroMediaReading(p: {
|
|
|
16
16
|
onClick: boolean;
|
|
17
17
|
youTubeId: string | null;
|
|
18
18
|
backgroundFile: boolean;
|
|
19
|
-
desktopLayout: "
|
|
20
|
-
phoneLayout: "
|
|
19
|
+
desktopLayout: "side" | "one" | "stacked";
|
|
20
|
+
phoneLayout: "side" | "one" | "stacked";
|
|
21
21
|
twoPictures: boolean;
|
|
22
22
|
};
|
|
23
23
|
export declare function heroPartEntrance(partMotion: Record<string, unknown> | undefined, part: HeroMediaPart): Readonly<Record<import("../../format/lib/animation/views.js").MotionView, import("efficient-shell/ui").EntranceValue>> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as y,jsx as p,jsxs as O}from"react/jsx-runtime";import{createContext as x,useContext as S,useEffect as k,useId as F,useMemo as A,useRef as M}from"react";import{armEntrance as j}from"efficient-shell/format";import{blockCapsPartSize as D,blockDrawsTextStyle as K,partRuleForKind as E,partRuleForText as L,partStyleCss as N,publishedPartStyles as I}from"../lib/document/part-styles.js";import{useViewWidth as $}from"./SectionAnimation.js";import{useDrawsAtEdge as B}from"./InBoxContext.js";import{styleKeyForPart as H}from"../../format/lib/sections/section-text-kinds.js";import{NO_MOTIONS as J,PART_LIFT_ATTR as b,drawPartEntrance as W,drawPartScroll as Y,ensurePartLiftSheet as V,firstOnPage as R,partBoxOf as q,partMotionDrawn as z,partMoves as G}from"../lib/animation/part-motion.js";import{cssHash as Q,styleElementText as U}from"../../format/lib/document/style-text.js";import{useFontRegistry as X}from"./SiteFontsContext.js";const P=x(null),T=x(null),_=x(null);function ae({needles:t,styles:r,motions:o=J,type:n,atEdge:e=!1,sizeCaps:d,children:i}){const a=F(),h=B(e?"edge":"by-box"),f=JSON.stringify([a,t,r,o,n,d]),s=X(),m=A(()=>{const c=Object.keys(o).filter(l=>G(o[l]));return I(t,r,a,l=>H(n,l),l=>K(n,l),l=>c.includes(l)?z(o[l]):null,c,l=>D(d,l),s)},[f,s]);if(!m)return p(y,{children:i});const u=N(m,{inBox:h});return O(y,{children:[u&&p("style",{href:`${Z}${a}-${Q(u)}`,precedence:w,dangerouslySetInnerHTML:{__html:U(u)}}),p(P.Provider,{value:m,children:i})]})}const g=new WeakMap;function v(t,r){const o=R(r.filter(e=>e.arm)),n=r.some(e=>e.entering)?void 0:R(r.filter(e=>e.scroll));for(const e of r)e!==o&&e.undo&&(e.undo(),e.undo=void 0),e!==n&&e.undoScroll&&(e.undoScroll(),e.undoScroll=void 0);o?.arm&&!o.undo&&(o.undo=o.arm()),n?.scroll&&!n.undoScroll&&(n.undoScroll=n.scroll()),r.some(e=>e.lift)?(V(t.ownerDocument),t.setAttribute(b,"")):t.removeAttribute(b)}function de(t){const r=M(null),o=t?.motion?.entrance??null,n=t?.motion?.scroll??null,e=t?.motion?.hover==="lift",d=$(r,o!==null||n!==null),i=o?o[d]:null,a=n&&n[d].effect!=="none"?n[d]:null,h=JSON.stringify([i,a]);return k(()=>{const f=r.current,s=q(f?.parentElement??null);if(!o&&!n&&!e||!f||!s)return;const m=i?()=>{const l=W(s,i),C=j(s);return()=>{C?.(),l()}}:null,u=g.get(s)??[];g.set(s,u);const c={element:f,arm:m,entering:i!==null&&i.kind!=="none",scroll:a?()=>Y(s,a):null,lift:e};return u.push(c),v(s,u),()=>{const l=u.indexOf(c);l<0||(u.splice(l,1),c.undo?.(),c.undo=void 0,c.undoScroll?.(),c.undoScroll=void 0,v(s,u),u.length||g.delete(s))}},[h,e]),r}const w="sf-part-styles",Z=`${w}-`;function fe(t){const r=S(P),o=S(T),n=L(r,t);return n&&n.stamp!==o?n:null}function me(t){return E(S(P),t)}function pe({stamp:t,children:r}){return p(T.Provider,{value:t,children:r})}function Se({children:t}){const r=S(P);return p(_.Provider,{value:r,children:t})}function Pe(t){return E(S(_),t)}export{pe as ClaimedStamp,w as PART_STYLES_PRECEDENCE,ae as PublishedPartStyles,Se as SharedPartKinds,de as usePartEntrance,me as usePublishedPartKindRule,fe as usePublishedPartRule,Pe as usePublishedSharedKindRule};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type FontRegistry, type SiteFont } from "../../format/lib/fonts.js";
|
|
3
|
+
export declare function SiteFontsProvider({ siteFonts, children, }: {
|
|
4
|
+
siteFonts: readonly SiteFont[] | null | undefined;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare function useFontRegistry(): FontRegistry;
|
|
8
|
+
export declare function SiteFontFaces({ usedKeys, preload }: {
|
|
9
|
+
usedKeys: Iterable<string>;
|
|
10
|
+
preload?: boolean;
|
|
11
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as i,Fragment as m,jsxs as u}from"react/jsx-runtime";import{createContext as p,useContext as F,useMemo as x}from"react";import{POOL_FONT_REGISTRY as _,fontRegistry as d}from"../../format/lib/fonts.js";import{siteFontFaces as g}from"../../format/lib/site-font-faces.js";import{cssHash as h}from"../../format/lib/document/style-text.js";const a=p(_);function v({siteFonts:t,children:r}){const o=x(()=>d(t),[t]);return i(a.Provider,{value:o,children:r})}function j(){return F(a)}const f="sf-site-fonts";function R({usedKeys:t,preload:r=!0}){const o=j(),n=g(o,t),c=Object.entries(n.vars),s=[n.css,c.length?`:root { ${c.map(([e,l])=>`${e}: ${l}`).join("; ")} }`:""].filter(Boolean).join(`
|
|
2
|
+
`);return s?u(m,{children:[(r?n.preload:[]).map(e=>i("link",{rel:"preload",as:"font",type:"font/woff2",href:e.url,crossOrigin:""},e.id)),i("style",{href:`${f}-${h(s)}`,precedence:f,dangerouslySetInnerHTML:{__html:s}})]}):null}export{R as SiteFontFaces,v as SiteFontsProvider,j as useFontRegistry};
|
|
@@ -22,12 +22,12 @@ export declare const SERIES_OWN: OwnPad;
|
|
|
22
22
|
export declare const STATS_OWN: OwnPad;
|
|
23
23
|
type Props = Record<string, unknown>;
|
|
24
24
|
export declare const logosBandOwn: (props: Props) => OwnPad;
|
|
25
|
-
type SectionOwnPad = {
|
|
25
|
+
export type SectionOwnPad = {
|
|
26
26
|
readonly frame: (props: Props) => OwnFrame;
|
|
27
27
|
readonly edge?: boolean;
|
|
28
28
|
};
|
|
29
29
|
export declare const SECTION_OWN_PADS: Readonly<Record<string, SectionOwnPad>>;
|
|
30
|
-
export declare function sectionRootPad(type: string, props: Props): RootPadAttrs | null;
|
|
30
|
+
export declare function sectionRootPad(type: string, props: Props, ownPad?: SectionOwnPad): RootPadAttrs | null;
|
|
31
31
|
export declare function withRootPad(className: string, pad: RootPadAttrs | null | undefined, style?: CSSProperties): {
|
|
32
32
|
className: string;
|
|
33
33
|
style?: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{framePadAttrs as f,padValuesOf as _,SECTION_PAD_KEYS as d}from"./section-padding.js";import{parseSectionHeadPlacement as i}from"../../../format/lib/sections/section-head-placement.js";import{parseSectionHeadStyle as N}from"../../../format/lib/sections/section-head-style.js";import{readHidable as T}from"efficient-easel/draw";import{TICKER_PAD as S}from"../../../format/lib/sections/strip-shape.js";import{finiteNumber as A}from"../../../format/lib/finite-number.js";import{ownEntry as l}from"../../../format/lib/own-entry.js";const E={top:24,bottom:24,topPhone:24,bottomPhone:24},u={top:72,bottom:72,topPhone:72,bottomPhone:72},s={top:100,bottom:100,topPhone:60,bottomPhone:60},x={top:120,bottom:120,topPhone:70,bottomPhone:70},W={top:24,bottom:24,topPhone:24,bottomPhone:24},D=40,C={top:120,bottom:120,topTablet:80,bottomTablet:80,topPhone:80,bottomPhone:80},R={top:24,bottom:24,topPhone:24,bottomPhone:24},g={top:24,bottom:24,topPhone:24,bottomPhone:24},I={top:84,bottom:84,topPhone:84,bottomPhone:84},B={top:48,bottom:48,topPhone:48,bottomPhone:48},M={top:80,bottom:80,topPhone:60,bottomPhone:60},y={top:100,bottom:60,topPhone:60,bottomPhone:40},L={top:60,bottom:60,topPhone:40,bottomPhone:40},F={top:80,bottom:80,topTablet:60,bottomTablet:60,topPhone:60,bottomPhone:60},H={top:76,bottom:76,topPhone:76,bottomPhone:76},G={top:76,bottom:76,topPhone:76,bottomPhone:76},P={top:80,bottom:40,topPhone:60,bottomPhone:32},h={top:76,bottom:76,topPhone:76,bottomPhone:76},k={top:72,bottom:72,topPhone:72,bottomPhone:72},Y={top:40,bottom:64,topPhone:24,bottomPhone:36},w={top:120,bottom:120,topPhone:80,bottomPhone:80,topTablet:80,bottomTablet:80},K={top:48,bottom:48,topPhone:48,bottomPhone:48},U=o=>{const t=A(o.bandPadding)??D;return{top:t,bottom:t,topPhone:t,bottomPhone:t}},c=(o,t,n)=>({desktop:o,tablet:t,mobile:n}),p=o=>i(o.headPlacement)==="own-box",e=(o,t)=>({top:c(o.top,t?.top??o.topTablet??o.top,o.topPhone),bottom:c(o.bottom,t?.bottom??o.bottomTablet??o.bottom,o.bottomPhone)}),O=o=>({top:o.topPhone,bottom:o.bottomPhone}),
|
|
1
|
+
import{framePadAttrs as f,padValuesOf as _,SECTION_PAD_KEYS as d}from"./section-padding.js";import{parseSectionHeadPlacement as i}from"../../../format/lib/sections/section-head-placement.js";import{parseSectionHeadStyle as N}from"../../../format/lib/sections/section-head-style.js";import{readHidable as T}from"efficient-easel/draw";import{TICKER_PAD as S}from"../../../format/lib/sections/strip-shape.js";import{finiteNumber as A}from"../../../format/lib/finite-number.js";import{ownEntry as l}from"../../../format/lib/own-entry.js";const E={top:24,bottom:24,topPhone:24,bottomPhone:24},u={top:72,bottom:72,topPhone:72,bottomPhone:72},s={top:100,bottom:100,topPhone:60,bottomPhone:60},x={top:120,bottom:120,topPhone:70,bottomPhone:70},W={top:24,bottom:24,topPhone:24,bottomPhone:24},D=40,C={top:120,bottom:120,topTablet:80,bottomTablet:80,topPhone:80,bottomPhone:80},R={top:24,bottom:24,topPhone:24,bottomPhone:24},g={top:24,bottom:24,topPhone:24,bottomPhone:24},I={top:84,bottom:84,topPhone:84,bottomPhone:84},B={top:48,bottom:48,topPhone:48,bottomPhone:48},M={top:80,bottom:80,topPhone:60,bottomPhone:60},y={top:100,bottom:60,topPhone:60,bottomPhone:40},L={top:60,bottom:60,topPhone:40,bottomPhone:40},F={top:80,bottom:80,topTablet:60,bottomTablet:60,topPhone:60,bottomPhone:60},H={top:76,bottom:76,topPhone:76,bottomPhone:76},G={top:76,bottom:76,topPhone:76,bottomPhone:76},P={top:80,bottom:40,topPhone:60,bottomPhone:32},h={top:76,bottom:76,topPhone:76,bottomPhone:76},k={top:72,bottom:72,topPhone:72,bottomPhone:72},Y={top:40,bottom:64,topPhone:24,bottomPhone:36},w={top:120,bottom:120,topPhone:80,bottomPhone:80,topTablet:80,bottomTablet:80},K={top:48,bottom:48,topPhone:48,bottomPhone:48},U=o=>{const t=A(o.bandPadding)??D;return{top:t,bottom:t,topPhone:t,bottomPhone:t}},c=(o,t,n)=>({desktop:o,tablet:t,mobile:n}),p=o=>i(o.headPlacement)==="own-box",e=(o,t)=>({top:c(o.top,t?.top??o.topTablet??o.top,o.topPhone),bottom:c(o.bottom,t?.bottom??o.bottomTablet??o.bottom,o.bottomPhone)}),O=o=>({top:o.topPhone,bottom:o.bottomPhone}),m=o=>t=>p(t)?{top:0,bottom:o.bottom}:o,V=(o,t)=>{const n=T(o[t]);return n.hidden?!1:!!n.text||o.editor?.isEditing===!0},j={Banner:{frame:()=>e(E)},Cards:{frame:m(e(u))},Chart:{frame:()=>e(h)},ContactLocations:{frame:()=>e(s,O(s))},Countdown:{frame:()=>e(B)},DocBody:{frame:()=>e(M)},DocMasthead:{frame:()=>e(y)},DocMetaCards:{frame:()=>e(L)},FAQ:{frame:o=>{const t=p(o)||!["num","title","linkText"].some(r=>V(o,r)),n=e(x);return t?{top:0,bottom:n.bottom}:n},edge:!0},FeaturedCover:{frame:()=>e(F)},Grid:{frame:()=>e(W)},Integrations:{frame:()=>e(H)},KeyFeatures:{frame:()=>e(G)},Logos:{frame:o=>p(o)?0:e(U(o))},LongRead:{frame:m(e(C))},Masthead:{frame:()=>e(P,O(P))},Mockup:{frame:()=>e(h)},OrderSummary:{frame:()=>e(R)},PaymentBadges:{frame:()=>e(g)},Prose:{frame:m(e(k))},SectionHeader:{frame:o=>{const t=e(Y);return N(o.headStyle)==="standard"?t:{top:t.top,bottom:0}},edge:!0},Series:{frame:m(e(w))},Stats:{frame:()=>e(K)},Testimonials:{frame:m(e(I))},Ticker:{frame:()=>e(S),edge:!0}};function oo(o,t,n){const r=l(j,o)??n;return r?f({values:_(t,d,!0),frame:r.frame(t),drawsFrame:!0,edge:r.edge},!0).root:null}const v=/^(?:[^\s]*:)?p[ytb]-/;function to(o,t,n){if(!t)return n?{className:o,style:n}:{className:o};const r=o.split(/\s+/).filter(b=>b&&!v.test(b)),a={...n,...t.style};return{className:[...r,t.className].filter(Boolean).join(" "),...Object.keys(a).length?{style:a}:{},...t.attrs}}export{E as BANNER_OWN,u as CARDS_OWN,s as CONTACT_LOCATIONS_OWN,B as COUNTDOWN_OWN,M as DOC_BODY_OWN,y as DOC_MASTHEAD_OWN,L as DOC_META_CARDS_OWN,x as FAQ_OWN,F as FEATURED_COVER_OWN,H as INTEGRATIONS_OWN,G as KEY_FEATURES_OWN,C as LONG_READ_OWN,P as MASTHEAD_OWN,g as PAYMENT_BADGES_OWN,h as PROOF_OWN,k as PROSE_OWN,Y as SECTION_HEADER_OWN,j as SECTION_OWN_PADS,w as SERIES_OWN,K as STATS_OWN,U as logosBandOwn,oo as sectionRootPad,to as withRootPad};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TextStyleCase, type ViewTier } from "efficient-easel/draw";
|
|
2
|
-
import { type FontRole } from "../../../format/lib/fonts.js";
|
|
2
|
+
import { type FontRegistry, type FontRole } from "../../../format/lib/fonts.js";
|
|
3
3
|
import type { PartEl } from "../../../editor/lib/document/part-anchors.js";
|
|
4
4
|
import { type PartNeedle } from "./text-parts.js";
|
|
5
5
|
import { type TextRegion } from "../../../format/lib/sections/text-regions.js";
|
|
@@ -130,6 +130,7 @@ export declare function partCaseTransform(value: TextStyleCase | undefined): str
|
|
|
130
130
|
export type PartDeclarationOptions = {
|
|
131
131
|
blockDrawsStyle?: boolean;
|
|
132
132
|
sizeCap?: boolean;
|
|
133
|
+
fonts?: FontRegistry;
|
|
133
134
|
};
|
|
134
135
|
export declare const PART_SIZE_CAP_VAR = "--sf-part-size-cap";
|
|
135
136
|
export declare function blockCapsPartSize(caps: Readonly<Record<string, true>> | undefined, partKey: string): boolean;
|
|
@@ -167,21 +168,22 @@ export type MeasuredPartStyle = {
|
|
|
167
168
|
paddingTop: string;
|
|
168
169
|
};
|
|
169
170
|
export declare function partStyleBase(measured: MeasuredPartStyle, fontKey: string): PartStyleBase;
|
|
170
|
-
export declare function partFontKeyOf(family: string, resolve: (cssVar: string) => string): string;
|
|
171
|
+
export declare function partFontKeyOf(family: string, resolve: (cssVar: string) => string, registry?: FontRegistry): string;
|
|
171
172
|
export declare function partStyleSource<E extends {
|
|
172
173
|
getAttribute(name: string): string | null;
|
|
173
174
|
}>(nodeId: string, selectedPartId: string | null, selectedElements: readonly E[], declaresStyle: (className: string | null) => boolean): E | null;
|
|
174
175
|
export declare function storedPartStyle(styles: PartStyles, styleKey: string): PartStyle;
|
|
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;
|
|
176
|
+
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, fonts?: FontRegistry): number;
|
|
176
177
|
export declare function regionSheetStyle(style: PartStyle | undefined | null): PartStyle | null;
|
|
177
178
|
export declare function regionCanvasDeclarations(style: PartStyle | undefined | null, screen: PartScreen, options?: {
|
|
178
179
|
sizeCap?: boolean;
|
|
180
|
+
fonts?: FontRegistry;
|
|
179
181
|
}): {
|
|
180
182
|
fontFamily?: string;
|
|
181
183
|
fontSize?: string;
|
|
182
184
|
};
|
|
183
185
|
export declare function regionHasOwnLook(style: PartStyle | undefined | null): boolean;
|
|
184
|
-
export declare function regionShownDeclarations(style: PartStyle | undefined | null, region: TextRegion, screen: PartScreen): ShownDeclarations;
|
|
186
|
+
export declare function regionShownDeclarations(style: PartStyle | undefined | null, region: TextRegion, screen: PartScreen, fonts?: FontRegistry): ShownDeclarations;
|
|
185
187
|
export declare function regionCanvasRestore(style: {
|
|
186
188
|
fontFamily: string;
|
|
187
189
|
fontSize: string;
|
|
@@ -221,7 +223,7 @@ export type PublishedPartSheet = {
|
|
|
221
223
|
kindRules: ReadonlyMap<string, PublishedPartRule>;
|
|
222
224
|
drawn: ReadonlySet<string>;
|
|
223
225
|
};
|
|
224
|
-
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;
|
|
226
|
+
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, fonts?: FontRegistry): PublishedPartSheet | null;
|
|
225
227
|
export declare function isPartKindKey(key: string): boolean;
|
|
226
228
|
export declare function partRuleForKind(sheet: PublishedPartSheet | null, kind: string): PublishedPartRule | null;
|
|
227
229
|
export declare function viewMediaOf(inBox: boolean): {
|
|
@@ -1,2 +1,2 @@
|
|
|
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 jt(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,C=1e3,Oe=-5,Ie=10,Fe=0,ye=64,Me=2,ee={size:{min:H,max:C,step:1},sizeTablet:{min:H,max:C,step:1},sizePhone:{min:H,max:C,step:1},padding:{min:Fe,max:ye,step:Me}},Le=.05,De=.01,He=["line","letter"],Ce=.5,Ue=2.5,je=-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 U(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:U("desktop"),sizeTablet:U("tablet"),sizePhone:U("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,Ce,Ue),3):null}if(e==="letterSpacing"){const i=Number(t);return Number.isFinite(i)?z(w(i,je,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"?j(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&&!j(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 j(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&&j(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,n){const i=Tt(e);if(!i)return{};const o=G(i,t,n?.sizeCap?{sizeCap:!0}:void 0);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.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,sizeCap:s(a)},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(${
|
|
1
|
+
import{textStyleCaseCss as de,textStyleCaseOfCss as ge,viewKeyAt as Z}from"efficient-easel/draw";import{POOL_FONT_REGISTRY as k,fontOption as xe,fontRoleOf as N,SIZE_STEP_OF_ROLE as M}from"../../../format/lib/fonts.js";import{encodePartKey as q}from"../../../format/lib/document/part-key.js";import{decodePartId as J,normalizePartText as L}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 D,propsWithPartRecord as _e,readPartRecord as Ae,readPartRecords as Re}from"../../../format/lib/document/part-records.js";import{isLengthUnit as H}from"efficient-easel/screen/lib/content/length-units";import{cssLengthOf as R,storedUnit as Ee}from"../../../format/lib/content/css-length.js";import{hasOwnEntry as O,ownEntry as Q}from"../../../format/lib/own-entry.js";const C="_partStyles",we="data-sf-part-styled",ee="data-sf-text-style",$e=/^(heading|body)-[1-7]$/;function P(e){return typeof e=="string"&&$e.test(e)}const te={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(te))if(n===e)return t;return null}function jt(e){if(P(e.textStyle))return e.textStyle;const t=N(e.role);return t?te[t]:void 0}const Ne=[400,500,600,700],w=["left","center","right","justify"],U=5,j=1e3,Oe=-5,Ie=10,Fe=0,ye=64,Me=2,ne={size:{min:U,max:j,step:1},sizeTablet:{min:U,max:j,step:1},sizePhone:{min:U,max:j,step:1},padding:{min:Fe,max:ye,step:Me}},Le=.05,De=.01,He=["line","letter"],Ce=.5,Ue=2.5,je=-1,ve=1,Ge=0,We=400,Ke=[...new Set(Object.values(M))];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 Gt(e){return Re(e,C)}function ie(e,t){return Ae(e,C,t)}function Wt(e,t){return Object.values(ie(e,t)).filter(n=>n!==void 0).length}function oe(e,t,n){return _e(e,C,t,Be(n).length?n:null)}function Be(e){return Object.entries(e).filter(([,t])=>t!==void 0)}function Ye(e){return He.includes(e)}const $=(e,t,n)=>Math.min(n,Math.max(t,e)),Xe=["sizeUnit","sizeUnitTablet","sizeUnitPhone"];function v(e){const t=Z("sizeUnit",e),n=Xe.find(i=>i===t);if(!n)throw new Error(`a part stores no unit key ${t}`);return n}const z={size:v("desktop"),sizeTablet:v("tablet"),sizePhone:v("mobile"),paragraphSpacing:"paragraphSpacingUnit",padding:"paddingUnit"},re=Object.values(z);function S(e,t){return Ee(e[z[t]])}function Ve(e,t,n={}){if(re.includes(e))return H(t)&&t!=="px"?t:null;if(O(z,e)&&S(n,e)!=="px"){const i=A(Number(t),2);return!Number.isFinite(i)||i<0||i===0&&e!=="padding"?null:i}if(Ye(e)){const i=Math.round(Number(t));return!Number.isFinite(i)||i===0?null:$(i,Oe,Ie)}if(e==="lineHeight"){const i=Number(t);return Number.isFinite(i)?A($(i,Ce,Ue),3):null}if(e==="letterSpacing"){const i=Number(t);return Number.isFinite(i)?A($(i,je,ve),4):null}if(e==="paragraphSpacing"){const i=Math.round(Number(t));return!Number.isFinite(i)||i<=0?null:$(i,Ge,We)}if(O(ne,e)){const{min:i,max:o}=ne[e],r=Math.round(Number(t));return Number.isFinite(r)?$(r,i,o):null}return e==="italic"?typeof t=="boolean"?t:null:e==="role"||e==="fontRole"?N(t)?t:null:e==="sizeToken"?G(t)?t:null:e==="textStyle"?P(t)?t:null:e==="alignPhone"||e==="alignTablet"?w.includes(t)?t:null:t}const Ze=["weight","size","sizeTablet","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function E(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&&!w.includes(e.align)&&n("align"),e.alignTablet!==void 0&&!w.includes(e.alignTablet)&&n("alignTablet"),e.alignPhone!==void 0&&!w.includes(e.alignPhone)&&n("alignPhone"),e.textStyle!==void 0&&!P(e.textStyle)&&n("textStyle"),e.sizeToken!==void 0&&!G(e.sizeToken)&&n("sizeToken"),e.fontRole!==void 0&&!N(e.fontRole)&&n("fontRole");for(const i of re)e[i]!==void 0&&!H(e[i])&&n(i);return t??e}function G(e){if(!e||typeof e!="object")return!1;const{step:t,px:n,stepPhone:i,pxPhone:o,fluid:r}=e,f=l=>typeof l=="number"&&Number.isFinite(l)&&l>0,s=l=>typeof l=="string"&&Ke.includes(l);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 W(e){return e?.pxPhone&&G(e)?{step:e.stepPhone??e.step,px:e.pxPhone}:null}function ae({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={...ie(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 oe(e,t,o)}function Bt(e,t){return oe(e,t,{})}function et(e){return ge(e)??"none"}function tt(e){return de(e)??""}const se={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=N(e.role);return n||(t?.blockDrawsStyle?null:ke(e.textStyle))}const it="--sf-part-size-cap";function K(e,t){return e&&t?.sizeCap?`min(${e}, var(${it}, ${e}))`:e}function Yt(e,t){return e?.[t]===!0}function Xt(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=M[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=A(st+e.line*Le,3)),typeof e.letterSpacing=="number"?t.letterSpacingEm=e.letterSpacing:e.letter&&(t.letterSpacingEm=A(e.letter*De,4)),t}const st=1,_="--sf-part-para";function ft(e,t){e=E(e);const n={};if(typeof e.sizePhone=="number"&&e.sizePhone>0)n.fontSize=R(e.sizePhone,S(e,"sizePhone"));else{const o=W(e.sizeToken);if(o)n.fontSize=ae(o);else{const r=F(e);r!==void 0&&(n.fontSize=R(r,S(e,"sizeTablet")))}}n.fontSize&&(n.fontSize=K(n.fontSize,t));const i=e.alignPhone??I(e);return i&&(n.textAlign=i),n}function I(e){return e.alignTablet&&e.alignTablet!==e.align?e.alignTablet:void 0}function F(e){const n=e.sizeTablet!==void 0&&S(e,"sizeTablet")!==S(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=E(e),i={},o=F(n);o!==void 0&&(i.fontSize=K(R(o,S(n,"sizeTablet")),t));const r=I(n);return r&&(i.textAlign=r),i}function Vt(e,t){if(t==="desktop")return;const n=E(e);return(t==="mobile"?I(n):void 0)??n.align}function lt(e,t){if(t==="desktop")return e;const n=E(e),i=F(n),o=I(n);if(t==="tablet"){let s=e;return i!==void 0&&(s={...s,size:i,sizeUnit:n[z.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[z.sizePhone]};else{const s=W(n.sizeToken);s?r={...r,size:void 0,sizeToken:s}:i!==void 0&&(r={...r,size:i,sizeUnit:n[z.sizeTablet]})}const f=n.alignPhone??o;return f&&(r={...r,align:f}),r}function B(e,t,n){return Y(lt(e,t),y,n)}function ut(e){return Z("size",e)}function Zt(e,t){if(t==="desktop")return null;const n=E(e);if(t==="mobile"){if(W(n.sizeToken))return null;const i=F(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 fe(e,t){const n=ut(t);if(!O(e,n))return e;const i={...e};return delete i[n],i}function qt(e,t,n){const i=B(fe(e,t),t,n);return{fontFamily:i.fontFamily,fontSize:i.fontSize}}function Y(e,t,n){e=E(e);const i=nt(e,n),o=at(e),r=K(e.size?R(e.size,S(e,"size")):e.sizeToken?ae(e.sizeToken):i?rt(i):"",n);return{fontFamily:e.font?xt(e.font,n?.fonts):e.fontRole?`var(${se[e.fontRole]})`:i?`var(${se[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`:"",[_]:e.paragraphSpacing?R(e.paragraphSpacing,S(e,"paragraphSpacing")):"",textTransform:tt(e.case),textAlign:e.align??"",paddingTop:ce(e.padding,S(e,"padding")),paddingBottom:ce(e.padding,S(e,"padding")),color:pt(e.color),fontStyle:e.italic===!0?"italic":e.italic===!1?"normal":""}}const pt=e=>he(e),ce=(e,t)=>e===void 0?"":R(e,t),A=(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)?A(i/n,3):1.2,letterEm:Number.isFinite(o)?A(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 w)if(t===e)return t;return e==="end"?"right":"left"}function Qt(e,t,n=k){const i=le(e);if(!i)return"";for(const o of n.options)if(le(t(o.cssVar))===i)return o.key;return""}const le=e=>(e.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function xt(e,t=k){const n=xe(e,t);return n?`var(${n.cssVar})`:""}function en(e,t,n,i){return!t||J(t)?.nodeId!==e?null:n.find(r=>i(r.getAttribute("class")))??n[0]??null}function ht(e,t){return D(Q(e,t))??{}}function tn(e,t,n=()=>y,i=p=>p,o=mt,r="desktop",f=()=>!1,s=()=>!1,l=k){let p=0;for(const{element:x,partId:b}of e){const u=J(b)?.propKey;if(!u)continue;const a=ht(t,i(u)),c=B(a,r,{blockDrawsStyle:f(u),sizeCap:s(u),fonts:l});P(a.textStyle)?x.setAttribute?.(ee,a.textStyle):x.removeAttribute?.(ee);const h=V.some(m=>x.style[m]);let g=!1;for(const[m,T]of Object.entries(c))zt(x,m,T),T&&(g=!0);if(h||V.some(m=>c[m]))for(const m of St(x,o))for(const T of V)m.style[T]=c[T]??"";g&&(p+=1)}return p}function St(e,t){const n=L(e.textContent??""),i=[];let o=e;for(let r=0;r<bt&&t(o);r+=1){const f=o.parentElement;if(!f||L(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 y={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={};P(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=z[n];t[n]!==void 0&&H(e[i])&&(t[i]=e[i])}return Object.keys(t).length?t:null}function Pt(e,t,n){const i=Tt(e);if(!i)return{};const o=B(i,t,{...n?.sizeCap?{sizeCap:!0}:{},...n?.fonts?{fonts:n.fonts}:{}});return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function nn(e){return P(e?.textStyle)||!!e?.role||typeof e?.size=="number"&&e.size>0}function on(e,t,n,i){if(!e||typeof e!="object")return{};const o=Se(e.role,t,M)??{},r=t.sized?Pt(fe(e,n),n,i?{fonts:i}:void 0):{};return{...o,...r}}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===_&&(n?o.setAttribute?.(ue,""):o.removeAttribute?.(ue))}const ue="data-sf-part-para",_t=Object.keys(Y({},y)),X=new Set(["color","overflowWrap",_,"fontStyle"]),V=_t.filter(e=>!X.has(e));function an(e,t,n,i=p=>p,o=()=>!1,r=()=>null,f=[],s=()=>!1,l=k){const p=new Map;for(const a of e){const c=q(a.key,a.row);for(const h of a.texts){const g=p.get(h);g?(g.keys.add(a.key),g.partKeys.add(c)):p.set(h,{keys:new Set([a.key]),partKeys:new Set([c])})}}const x=new Map;for(const a of new Set([...Object.keys(t),...f])){if(!At(a))continue;const c=pe(n,a,D(t[a])??{},{blockDrawsStyle:!1,sizeCap:s(a),fonts:l},r(a));c&&x.set(a,c)}const b=a=>{const c=i(a),h=r(c);if(!O(t,c)&&!h)return null;const g=D(t[c])??{};return pe(n,a,g,{blockDrawsStyle:o(a),sizeCap:s(a),fonts:l},h)},u=new Map;for(const[a,{keys:c,partKeys:h}]of p){const g=h.size===1?[...h][0]:c.size===1?[...c][0]:null;if(!g)continue;const d=b(g);d&&u.set(a,d)}for(const a of e){if(!a.keyed)continue;const c=b(q(a.key,a.row));c&&x.set(a.key,c)}return u.size||x.size?{rules:u,kindRules:x,drawn:new Set(p.keys())}:null}function pe(e,t,n,i,o){const r=Y(n,y,i),f=ct(n,i),s=ft(n,i),l=P(n.textStyle)?n.textStyle:void 0;return!Object.values(r).some(Boolean)&&!Object.keys(f).length&&!Object.keys(s).length&&!l&&!o?null:{stamp:Rt(e,t),declarations:r,...Object.keys(f).length?{tablet:f}:{},...Object.keys(s).length?{phone:s}:{},...l?{textStyle:l}:{},...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:l,declarations:p}=s;if(r.has(l))return;r.add(l);const x=Object.entries(p).filter(([,d])=>d!==""),b=d=>d.map(([m,T])=>`${$t(m)}: ${T}`).join("; "),u=`[${we}="${l}"]`,a=x.filter(([d])=>!X.has(d)),c=x.filter(([d])=>X.has(d));a.length&&o.push(`${u}, *:has(> ${u}) { ${b(a)} }`),c.length&&o.push(`${u} { ${b(c)} }`),p[_]&&(o.push(`*:has(> ${u}) { ${_}: ${p[_]} }`),o.push(...wt(u,`*:has(> ${u})`)));const h=Object.entries(s.tablet??{}).filter(([,d])=>d!=="");h.length&&o.push(`@media ${n} { ${u}, *:has(> ${u}) { ${b(h)} } }`);const g=Object.entries(s.phone??{}).filter(([,d])=>d!=="");g.length&&o.push(`@media ${i} { ${u}, *:has(> ${u}) { ${b(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(${_})`,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=L(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{w as PART_ALIGNS,ve as PART_LETTER_EM_MAX,je as PART_LETTER_EM_MIN,De as PART_LETTER_STEP,Ue as PART_LINE_HEIGHT_MAX,Ce as PART_LINE_HEIGHT_MIN,Le as PART_LINE_STEP,ne 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,ue as PART_PARAGRAPH_ATTR,We as PART_PARAGRAPH_MAX,Ge as PART_PARAGRAPH_MIN,_ as PART_PARAGRAPH_VAR,He as PART_RELATIVE_PROPS,it as PART_SIZE_CAP_VAR,j as PART_SIZE_MAX,U as PART_SIZE_MIN,Ke as PART_SIZE_STEPS,we as PART_STYLED_ATTR,C as PART_STYLES_PROP,_t as PART_STYLE_PROPERTIES,z as PART_UNIT_KEY_OF,Ne as PART_WEIGHTS,V as SHARED_PART_PROPERTIES,te as STYLE_ID_OF_ROLE,ee as TEXT_STYLE_ATTR,tn as applyPartStyles,Yt as blockCapsPartSize,Xt as blockDrawsTextStyle,jt as followedStyleOf,At as isPartKindKey,P as isTextStyleId,wt as paragraphRules,Vt as partAlignFollowed,B 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,Wt as partStyleCount,fn as partStyleCss,Y as partStyleDeclarations,lt as partStyleForScreen,en as partStyleSource,fe as partStyleWithoutSizeBox,ct as partTabletDeclarations,Kt as propsWithPartStyleValue,Bt as propsWithoutPartStyle,an as publishedPartStyles,ie as readPartStyle,Gt as readPartStyles,Pt as regionCanvasDeclarations,rn as regionCanvasRestore,nn as regionHasOwnLook,Tt as regionSheetStyle,on as regionShownDeclarations,ht as storedPartStyle,Et as viewMediaOf};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type OwnFrame } from "../../content/section-padding.js";
|
|
2
|
-
import type { BlockPass } from "../../../../format/lib/document/passes/types.js";
|
|
2
|
+
import type { BlockPass, PassBlock } from "../../../../format/lib/document/passes/types.js";
|
|
3
3
|
type InnerPadding = {
|
|
4
4
|
top: number;
|
|
5
5
|
bottom: number;
|
|
@@ -15,6 +15,7 @@ export declare const PAD_ON_ROOT: ReadonlySet<string>;
|
|
|
15
15
|
export declare const PADS_ITS_OWN_SPACE: ReadonlySet<string>;
|
|
16
16
|
export declare const sectionPadding: BlockPass;
|
|
17
17
|
export declare const OWN_PAD_FRAME: Readonly<Record<string, (props: Record<string, unknown>) => OwnFrame>>;
|
|
18
|
+
export declare function ownFrameOf(key: string, comp: Pick<PassBlock, "ownPad"> | undefined): ((props: Record<string, unknown>) => OwnFrame) | undefined;
|
|
18
19
|
export declare const OWN_PAD_LABEL: Readonly<Record<string, string>>;
|
|
19
20
|
export declare function withPadTotals(props: Record<string, unknown>, changed: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
|
|
20
21
|
export declare function olderPadNote(props: Record<string, unknown>, frame: number, side?: "top" | "bottom"): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as g}from"react/jsx-runtime";import{SideOnceClass as
|
|
1
|
+
import{jsx as g}from"react/jsx-runtime";import{SideOnceClass as C}from"../../../components/SideSpaceOnce.js";import{HideTaker as F}from"../../../components/ViewHideRoot.js";import{LineChoice as L}from"../../../components/InBoxContext.js";import{isBackgroundBox as R}from"../../../../format/lib/content/box-background.js";import{boxSideSpaceOf as W}from"../../../../format/lib/content/box-side-space.js";import{SECTION_OWN_PADS as y}from"../../content/section-own-pads.js";import{BAND_PAD_KEYS as m,BAND_PAD_UNIT_KEY as K,BLOCK_PAD_FRAME as P,PAD_TOTAL_KEY as f,SECTION_PAD_KEYS as x,framePadAttrs as H,padTotalKeys as S,padValuesOf as j,sectionPadAttrs as v,tierFramesOf as h}from"../../content/section-padding.js";import{readPartStyle as Y}from"../part-styles.js";import{CRUMB_PAD as M,SPEC_PAD as U}from"../../../../format/lib/sections/strip-shape.js";import{say as $}from"../../../../format/lib/editor-words.js";import{sectionFillPassClass as D}from"../../../../format/lib/content/section-min-height.js";import{COPIES_IN_THE_BOX as k,drawsCopiesInTheBox as V}from"../../../../format/lib/content/copies-in-box.js";import{ownEntry as c}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}},_t=new Set(Object.keys(E));function A(t,e){return e?.innerPadding??c(E,t)}const gt=t=>A(t)??{},mt=t=>c({DetailRows:{top:100,bottom:100}},t),B=new Set(["Flex","Text","Heading","ImageBlock","ButtonBlock"]),X=new Set(["Divider"]),G=new Set(["Hero","HeroSingle","IntroBleed","CategoryBar","DocTabs"]),T=new Set(["ProductGrid"]);function O(t,e,n=!1,o){const a=t.render;t.render=r=>{if(e?.(r))return a(r);const s={...j(r,x,n),sideSpace:W(r.sideSpace)},d=o?H({values:s,frame:o(r)},!0).outer:v(s),i=a(r);if(!d)return i;const l=u=>g(C,{className:u?`${d.className} ${u}`:d.className,children:I=>g(F,{className:I,style:d.style,children:i})}),_=D(r,{atSectionLine:!0}),b=D(r);return _===b?l(_):g(L,{line:"by-box",draw:u=>l(u?b:_)})}}const St={name:"sectionPadding",applies:(t,e,n)=>e.isSection(t)&&!G.has(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const o=A(e,t);if(o){t.fields={...t.fields,...n.sidesPaddingFields({keys:m,unitKey:K,fallback:o,tablet:!0,siteSide:!0})};return}if(T.has(e))return;const a=[m.top,m.bottom].filter(s=>t.fields!=null&&s in t.fields);if(a.length)throw new Error(`section-padding: ${e} declares its own ${a.join(" / ")} row; declare \`innerPadding: { top, bottom }\` in its meta and the one Padding row draws on its band`);const r=N(e,t);if(r){p(t,e,n,r);return}t.fields={...t.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})}},draw(t,e){if(!A(e,t)){if(T.has(e)){O(t);return}B.has(e)||X.has(e)||O(t,e==="Flex"?n=>R(n.bgImage):k.has(e)?n=>V(e,n):void 0,!0,N(e,t))}}},q=["Heading","Text","ImageBlock","ButtonBlock"],z=["LogoBlock"],w={Text:t=>Y(t,"text").textStyle?.startsWith("heading-")?P.heading:P.text,Heading:()=>P.heading,ButtonBlock:()=>P.text,Breadcrumb:()=>h(M),SpecStrip:()=>h(U),...Object.fromEntries(Object.entries(y).map(([t,e])=>[t,e.frame]))};function N(t,e){return c(w,t)??e?.ownPad?.frame}const J={ButtonBlock:"Outer padding"};function Q(t,e){const n=t[f],o=Array.isArray(n)?n.filter(i=>typeof i=="string"):[],a=S().filter(i=>e?.[i]);if(!a.length)return t;const r=[...o.filter(i=>!a.includes(i)),...a.filter(i=>typeof t[i]=="number")];if(r.length===o.length&&r.every((i,l)=>i===o[l]))return t;const{[f]:s,...d}=t;return r.length?{...d,[f]:r}:d}function Z(t,e,n){if(e<=0)return null;const o=Array.isArray(t[f])?t[f]:[];return(n?S().filter(s=>s.startsWith(x[n])):S()).some(s=>typeof t[s]=="number"&&!o.includes(s))?$("plus {n} px (older setting)",{n:e}):null}function p(t,e,n,o){t.fields={...t.fields,...n.ownPaddingFields?.(o,Z,c(J,e))??n.sidesPaddingFields({tablet:!0,siteSide:!0})};const a=t.resolveData;t.resolveData=(r,s)=>{const d=r.props??{},i=s?.trigger==="replace"?Q(d,s.changed):d,l=i===d?r:{...r,props:i};return a?a(l,s):l}}const At={name:"blockPadding",applies:(t,e,n)=>(q.includes(t)||z.includes(t))&&!!n&&typeof n.render=="function",panel(t,e,n){const o=c(w,e);if(!o){t.fields={...t.fields,...n.sidesPaddingFields({tablet:!0,siteSide:!0})};return}p(t,e,n,o)},draw(t,e){B.has(e)||O(t,void 0,!0)}};export{w as OWN_PAD_FRAME,J as OWN_PAD_LABEL,X as PADS_ITS_OWN_SPACE,B as PAD_ON_ROOT,_t as SECTION_PAD_INNER,E as SECTION_PAD_INNER_DEFAULTS,At as blockPadding,gt as innerPaddingFallback,Z as olderPadNote,N as ownFrameOf,mt as ownPairDefault,St as sectionPadding,Q as withPadTotals};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TextStyle, type TextStyleCase, type TextStyleDevice } from "efficient-easel/text-styles/model";
|
|
2
|
-
import { type FontRole, type FontsValue } from "../../../format/lib/fonts.js";
|
|
2
|
+
import { type FontRegistry, type FontRole, type FontsValue } from "../../../format/lib/fonts.js";
|
|
3
3
|
import { viewRules } from "../content/view-values.js";
|
|
4
4
|
import { type PartStyle } from "../document/part-styles.js";
|
|
5
5
|
import { faceClassOf } from "../../../format/lib/text-style-face.js";
|
|
@@ -70,7 +70,7 @@ export type SiteTextSeed = {
|
|
|
70
70
|
typography: ResolvedHeadingTypography;
|
|
71
71
|
textStyles: unknown;
|
|
72
72
|
};
|
|
73
|
-
export declare function siteTextFromRow(row: Partial<SiteThemeRow
|
|
73
|
+
export declare function siteTextFromRow(row: Partial<SiteThemeRow>, registry?: FontRegistry): SiteTextSeed;
|
|
74
74
|
export declare function textStylesToOld(list: readonly StoredTextStyle[], prev: OldSiteText): OldSiteText;
|
|
75
75
|
export declare function themeWithTextStyles<T extends {
|
|
76
76
|
fonts?: unknown;
|
|
@@ -79,7 +79,7 @@ export declare function themeWithTextStyles<T extends {
|
|
|
79
79
|
headingTypography?: unknown;
|
|
80
80
|
textStyles?: unknown;
|
|
81
81
|
}>(theme: T): T;
|
|
82
|
-
export declare function textStylesCss(list: readonly StoredTextStyle[]): string;
|
|
82
|
+
export declare function textStylesCss(list: readonly StoredTextStyle[], registry?: FontRegistry): string;
|
|
83
83
|
export declare function accentItalicCss(italic: boolean | null | undefined): string;
|
|
84
84
|
export declare function styleIdOfRole(role: FontRole | null | undefined): string | undefined;
|
|
85
85
|
export declare function partStyleToTextStyleValues(style: PartStyle): StoredTextStyleValues;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{defaultTextStyles as
|
|
2
|
-
`)}function ze(e,
|
|
1
|
+
import{defaultTextStyles as J,textStyleCaseCss as ce}from"efficient-easel/text-styles/model";import{resolveViewValue as Z}from"efficient-easel/draw";import{viewKey as w}from"../../../format/lib/animation/views.js";import{POOL_FONT_REGISTRY as B,normalizeFonts as U}from"../../../format/lib/fonts.js";import{PHONE_MEDIA as de,TABLET_MEDIA as pe,viewOverrides as H,viewRules as X}from"../content/view-values.js";import{STYLE_ID_OF_ROLE as fe,TEXT_STYLE_ATTR as ue,paragraphRules as q,partSpacingOf as ge}from"../document/part-styles.js";import{FACE_SIZE as he,faceClassOf as Q}from"../../../format/lib/text-style-face.js";import{partColourName as ee,partInkCss as me}from"../../../format/lib/document/part-inks.js";import{compressionMetrics as Se,headingTypographyFromRow as ye,normalizeHeadingCompression as I,normalizeSizes as ne}from"../../../format/lib/theme.js";import{finiteNumber as v}from"../../../format/lib/finite-number.js";import{nonEmptyString as P}from"../../../format/lib/non-empty-string.js";const N=e=>e==="sentence"?"none":void 0,te=["font","color","size","sizeTablet","sizePhone","weight","italic","lineHeight","lineHeightTablet","lineHeightPhone","letterSpacing","letterSpacingTablet","letterSpacingPhone","paragraphSpacing","paragraphSpacingTablet","paragraphSpacingPhone","letterCase","largestSize","largestSizeTablet","largestSizePhone"],O=["desktop","tablet","phone"],k=(e,o)=>w(e,o);function L(e,o,t,i=X()){return Z("textSize",o,e.sizeTablet,e.sizePhone,i)[t]}const be=[["lineSpacing","lineHeight","line"],["letterSpacing","letterSpacing","letter"]];function R(e){for(const[o,t,i]of be)for(const n of O)if(e===k(o,n))return{key:w(t,n),view:n,spacing:i};return{key:e,view:"desktop",spacing:null}}function b(e){const o={};for(const t of te)e[t]!==void 0&&(o[t]=e[t]);return o}function F(e,o){const{auto:t,...i}=e,n=new Set(o??[]),l=te.filter(s=>n.has(s)&&e.values[s]===void 0);return l.length?{...i,auto:l}:i}function ie(e){const o=e.fonts,t=e.sizes,i=e.typography,n=Se(e.compression),l={"heading-1":{font:P(o.heading),size:v(t.headingLarge),weight:v(i.weight),lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,letterCase:N(i.case),largestSize:v(i.maxPx)},"heading-2":{font:P(o.heading2),size:v(t.headingMedium),weight:v(i.weight2),lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,letterCase:N(i.case2)},"heading-3":{font:P(o.heading3),size:v(t.headingSmall),weight:v(i.weight3),lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,letterCase:N(i.case3)},"body-1":{font:P(o.body),size:v(t.body)},"body-5":{font:P(o.label),size:v(t.label)}};return J().map(({id:s,kind:d,name:r})=>({id:s,kind:d,name:r,values:b(l[s]??{})}))}function j(e){return Array.isArray(e)&&e.every(t=>t&&typeof t=="object"&&typeof t.id=="string"&&(t.kind==="heading"||t.kind==="body")&&typeof t.name=="string")?e.map(t=>F({...t,values:b(t.values??{})},Array.isArray(t.auto)?t.auto:void 0)):null}function Ne(e){return j(e)??[]}function oe(e){return j(e)??J().map(({id:o,kind:t,name:i})=>({id:o,kind:t,name:i,values:{}}))}function M(e,o){const t=ie(o),i=j(e);return i?i.map(n=>{const l={...V(t,n.id)};for(const s of n.auto??[])delete l[s];return{...n,values:b({...l,...n.values})}}):t}const V=(e,o)=>e.find(t=>t.id===o)?.values??{},se=["heading-1","heading-2","heading-3"];function Le({saved:e,old:o,cur:t,next:i,sizeOf:n,panelView:l="desktop"}){const s=ie(o),d=oe(e),r=M(d,o),c=[],g=i.map(a=>{const S=t.find(u=>u.id===a.id),m=d.find(u=>u.id===a.id);if(!S||!m){const u=xe([a],n,l)[0],T=u.values.color;return T===void 0?u:{...u,values:{...u.values,color:ee(T)}}}const p={...m.values},x=new Set(m.auto??[]),y=a.values,_=S.values,z=[...new Set([...Object.keys(y),...Object.keys(_)])].filter(u=>JSON.stringify(y[u])!==JSON.stringify(_[u])),D=u=>R(u).spacing==="letter";z.sort((u,T)=>Number(D(u))-Number(D(T)));for(const u of z){const{key:T,view:le,spacing:K}=R(u),$=T,E=y[u];if(E===void 0){delete p[$],V(s,a.id)[$]!==void 0&&(c.push([a.id,$]),x.add($));continue}if(x.delete($),K==="line")p[$]=C(E/100,3);else if(K==="letter"){const G={...r.find(A=>A.id===a.id)?.values??{}};for(const A of z)y[A]===void 0&&delete G[R(A).key];const W=b({...G,...p}),Y=L(W,n({...a,values:W}),le);p[$]=Y?C(E/Y,4):0}else p[$]=E}return F({id:a.id,kind:a.kind,name:a.name,values:b(p)},x)});let f=o.compression;if(c.some(([a,S])=>(S==="lineHeight"||S==="letterSpacing")&&se.includes(a))&&I(f)!=="normal"){for(const a of se){const S=g.find(p=>p.id===a);if(!S)continue;const m={...S.values};for(const p of["lineHeight","letterSpacing"])c.some(([x,y])=>x===a&&y===p)||m[p]===void 0&&!(S.auto??[]).includes(p)&&(m[p]=V(s,a)[p]);S.values=b(m)}f="normal"}return{saved:g,old:{...o,compression:f}}}function Re(e,o){const t={text_styles:e.saved};return e.old.compression!==o.compression&&(t.heading_compression=I(e.old.compression)),t}const C=(e,o)=>Number(e.toFixed(o)),ae=(e,o)=>O.indexOf(e)<O.indexOf(o)?o:e;function Fe(e,o,t="desktop"){return e.map(i=>{const n={...i.values},l=o(i);for(const s of O){const d=w("lineHeight",s),r=i.values[d],c=i.values[w("letterSpacing",s)];delete n[d],r!==void 0&&(n[k("lineSpacing",s)]=C(r*100,1));const g=ae(s,t);c!==void 0&&(n[k("letterSpacing",s)]=C(c*L(i.values,l,g),g===s?2:4))}return{id:i.id,kind:i.kind,name:i.name,values:n}})}function xe(e,o,t="desktop"){return e.map(i=>{const n=i.values,l={...n};for(const c of O)delete l[k("lineSpacing",c)],delete l[k("letterSpacing",c)];const s={id:i.id,kind:i.kind,name:i.name,values:b(l)},d={...s.values},r=o({...s,values:{...s.values}});for(const c of O){const g=n[k("lineSpacing",c)],f=n[k("letterSpacing",c)];if(typeof g=="number"&&(d[w("lineHeight",c)]=C(g/100,3)),typeof f=="number"){const h=L(s.values,r,ae(c,t));d[w("letterSpacing",c)]=h?C(f/h,4):0}}return{...s,values:b(d)}})}function Me(e,o=B){const t={fonts:U({heading:e.heading_font??void 0,heading2:e.heading_2_font??void 0,heading3:e.heading_3_font??void 0,body:e.body_font??void 0,accent:e.accent_font??void 0,label:e.label_font??void 0},o),sizes:ne({headingLarge:e.heading_size_large_px,headingMedium:e.heading_size_medium_px,headingSmall:e.heading_size_small_px,accent:e.accent_size_px,body:e.body_size_px,label:e.label_size_px}),compression:I(e.heading_compression),typography:ye(e)},i=e.text_styles??null,n=Array.isArray(i)?re(M(i,t),t):t;return{fonts:U(n.fonts,o),sizes:ne(n.sizes),compression:I(n.compression),typography:n.typography,textStyles:i}}function re(e,o){const t=h=>e.find(a=>a.id===h)?.values??{},i=t("heading-1"),n=t("heading-2"),l=t("heading-3"),s=t("body-1"),d=t("body-5"),r=o.fonts,c=o.sizes,g=o.typography,f=h=>h==="none"?"sentence":"authored";return{fonts:{...r,heading:i.font??r.heading,heading2:n.font??i.font??r.heading2,heading3:l.font??i.font??r.heading3,body:s.font??r.body,label:d.font??r.label},sizes:{...c,headingLarge:i.size??null,headingMedium:n.size??null,headingSmall:l.size??null,body:s.size??null,label:d.size??null},compression:o.compression,typography:{...g,case:f(i.letterCase),weight:i.weight??null,maxPx:i.largestSize??null,weight2:n.weight??null,weight3:l.weight??null,case2:f(n.letterCase),case3:f(l.letterCase)}}}function Ve(e){const o=j(e.textStyles);if(!o||o.every(n=>Object.keys(n.values).length===0&&!n.auto))return e;const t={fonts:e.fonts??{},sizes:e.sizes??{},compression:String(e.headingCompression??"normal"),typography:e.headingTypography??{}},i=re(M(o,t),t);return{...e,fonts:i.fonts,sizes:i.sizes,headingCompression:i.compression,headingTypography:i.typography}}function De(e,o=B){const t=[];for(const i of e){const n=i.values,l=`.${Q(i)}`,s=`[${ue}="${i.id}"]`,d=`${l}, ${s}`,r=[],c=n.font!==void 0?o.byKey.get(n.font)?.cssVar:void 0;if(c&&r.push(`font-family: var(${c})`),n.size!==void 0){const a=n.largestSize!==void 0?Math.min(n.size,n.largestSize):n.size;r.push(`font-size: ${a}px`)}const g=me(n.color);g&&r.push(`color: ${g}`),n.italic===!0&&r.push("font-style: italic"),n.weight!==void 0&&r.push(`font-weight: ${n.weight}`);const f=[];n.lineHeight!==void 0&&f.push(`line-height: ${n.lineHeight}`),n.letterSpacing!==void 0&&f.push(`letter-spacing: ${n.letterSpacing}em`),i.kind==="body"&&r.push(...f);const h=ce(n.letterCase);h&&i.kind==="body"&&r.push(`text-transform: ${h}`),n.paragraphSpacing&&r.push(`--sf-part-para: ${n.paragraphSpacing}px`),r.length&&t.push(`${d} { ${r.join("; ")} }`),i.kind==="heading"&&f.length&&t.push(`${d}, ${l}:is(h1, h2, h3, h4), ${s}:is(h1, h2, h3, h4) { ${f.join("; ")} }`),i.kind==="heading"&&h&&t.push(`${s}, ${l}:is(h1, h2, h3, h4) { text-transform: ${h} }`),n.paragraphSpacing&&(t.push(`*:has(> ${s}) { --sf-part-para: ${n.paragraphSpacing}px }`),t.push(...q(`:is(${d})`,`*:has(> ${s})`))),t.push(...ze(i,d,l,s))}return t.join(`
|
|
2
|
+
`)}function ze(e,o,t,i){const n=e.values,l=H("textSize",n.size,n.sizeTablet,n.sizePhone),s=H("textSize",n.largestSize,n.largestSizeTablet,n.largestSizePhone),d=H("same",n.lineHeight,n.lineHeightTablet,n.lineHeightPhone),r=H("same",n.letterSpacing,n.letterSpacingTablet,n.letterSpacingPhone),c=H("spacing",n.paragraphSpacing,n.paragraphSpacingTablet,n.paragraphSpacingPhone),g=Z("textSize",n.size,n.sizeTablet,n.sizePhone,X()),f=ve[e.id],h=[];for(const[a,S]of[["tablet",pe],["phone",de]]){const m=[],p=[],x=g[a],y=s[a],_=l[a]===void 0&&y===void 0||x===void 0?void 0:y===void 0?x:Math.min(x,y);_!==void 0&&p.push(`font-size: ${_}px`);const z=[];d[a]!==void 0&&z.push(`line-height: ${d[a]}`),r[a]!==void 0&&z.push(`letter-spacing: ${r[a]}em`),e.kind==="body"&&p.push(...z),c[a]!==void 0&&p.push(`--sf-part-para: ${c[a]}px`),p.length&&m.push(`${o} { ${p.join("; ")} }`),e.kind==="heading"&&z.length&&m.push(`${o}, ${t}:is(h1, h2, h3, h4), ${i}:is(h1, h2, h3, h4) { ${z.join("; ")} }`),c[a]!==void 0&&m.push(`*:has(> ${i}) { --sf-part-para: ${c[a]}px }`),c[a]!==void 0&&!n.paragraphSpacing&&m.push(...q(`:is(${o})`,`*:has(> ${i})`)),_!==void 0&&f&&m.push(`.sf-themed-content { --size-${f}: ${_}px !important }`),m.length&&h.push(`@media ${S} { ${m.join(" ")} }`)}return h}const ve=Object.fromEntries(Object.entries(he).map(([e,{step:o}])=>[e,o]));function Ke(e){return e!==!0&&e!==!1?"":`em.text-accent { font-style: ${e?"italic":"normal"} }`}function Ge(e){return e?fe[e]:void 0}function $e(e){const o=ge(e);return b({font:e.font,color:e.color===void 0?void 0:ee(e.color),size:e.size,weight:e.weight,italic:e.italic,lineHeight:o.lineHeight,letterSpacing:o.letterSpacingEm,paragraphSpacing:e.paragraphSpacing,letterCase:e.case})}function We(e){return Object.keys($e(e)).length>0}function Ye({saved:e,old:o,styleId:t,values:i}){const n=oe(e);return{saved:_e(n,t,i),old:o}}function _e(e,o,t){return e.map(i=>i.id===o?F({...i,values:b({...i.values,...t})},i.auto):i)}function Je(e){const o=e.filter(t=>t.kind==="body").map(t=>Number(/^body-(\d+)$/.exec(t.id)?.[1])).filter(t=>Number.isInteger(t)&&t>0);return o.length?`body-${Math.max(...o)}`:"body-1"}export{Ke as accentItalicCss,Le as applyListChange,Je as eyebrowStyleId,Q as faceClassOf,xe as fromPanelStyles,We as hasStyleChange,Re as listChangePatch,oe as listToWrite,$e as partStyleToTextStyleValues,Ye as pushIntoStyle,M as resolveTextStyles,_e as setStyleValues,Me as siteTextFromRow,Ne as storedTextStyles,Ge as styleIdOfRole,De as textStylesCss,ie as textStylesFromOld,re as textStylesToOld,Ve as themeWithTextStyles,Fe as toPanelStyles,L as viewSizeOf};
|