efficient-web-builder 49.0.0 → 49.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- 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.d.ts +3 -1
- package/dist/editor/components/SectionTextPartBridge.js +1 -1
- package/dist/editor/lib/animation/hover-fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
- package/dist/editor/lib/document/card-display-chips.d.ts +2 -1
- package/dist/editor/lib/document/card-display-chips.js +1 -1
- package/dist/editor/lib/document/mirror-cards-field.d.ts +20 -0
- package/dist/editor/lib/document/mirror-cards-field.js +1 -0
- package/dist/format/lib/content/box-layout.d.ts +2 -0
- package/dist/format/lib/content/box-layout.js +1 -1
- package/dist/format/lib/content/card-template.d.ts +2 -0
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/content/mirror-cards.d.ts +32 -0
- package/dist/format/lib/content/mirror-cards.js +1 -0
- package/dist/format/lib/editor-words-catalogue.d.ts +8 -0
- package/dist/format/lib/editor-words-catalogue.js +4 -4
- package/dist/format/lib/sections/faq-text-regions.js +1 -1
- package/dist/format/lib/sections/section-text-regions.d.ts +1 -0
- package/dist/format/lib/sections/section-text-regions.js +1 -1
- package/dist/format/lib/sections/text-regions.d.ts +2 -0
- package/dist/format/lib/sections/text-regions.js +1 -1
- package/dist/render/components/CardRowContext.d.ts +1 -0
- package/dist/render/components/CardRowContext.js +1 -1
- package/dist/render/components/FAQ.js +1 -1
- package/dist/render/components/Flex.d.ts +6 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/MirrorContext.d.ts +3 -0
- package/dist/render/components/MirrorContext.js +1 -0
- package/dist/render/components/SiteGutterFrame.d.ts +1 -0
- package/dist/render/components/SiteGutterFrame.js +1 -1
- package/dist/render/components/Text.d.ts +2 -1
- package/dist/render/components/Text.js +1 -1
- package/dist/render/components/TextRegionRun.d.ts +7 -0
- package/dist/render/components/TextRegionRun.js +1 -0
- package/dist/render/lib/content/box-shared-columns.d.ts +31 -0
- package/dist/render/lib/content/box-shared-columns.js +1 -0
- package/dist/render/lib/document/blocks/general/Flex/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/document/editing-bridges.d.ts +2 -0
- package/dist/render/lib/document/part-styles.d.ts +26 -0
- package/dist/render/lib/document/part-styles.js +2 -2
- package/dist/render/lib/document/passes/section-width.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as T}from"react/jsx-runtime";import{createContext as
|
|
1
|
+
"use client";import{jsx as e,Fragment as T}from"react/jsx-runtime";import{createContext as f,useContext as t}from"react";import{rootPadAttrs as k,wrapperPadAttrs as q}from"../lib/content/section-padding.js";import{SECTION_BORDER_CLASS as z,SECTION_BORDER_SELF_CLASS as H}from"../../format/lib/content/borders.js";import{drawsSiteGutter as J}from"../../format/lib/content/site-gutter.js";const i=f(!1);function Y(){return t(i)}function Z({children:n}){return e(i.Provider,{value:!0,children:n})}const S=f(!1);function $({children:n}){return e(S.Provider,{value:!0,children:n})}const x=f(!1);function b({atTop:n,nested:r}){return e(T,{children:t(x)?r:n})}const c=f(void 0);function ee({children:n}){return e(c.Provider,{value:null,children:n})}function ne(){return t(c)===void 0&&!t(x)&&!t(i)}function te(){return t(c)??null}function K({contained:n,framedClass:r,fillClass:j,columnClass:w,style:C,tabLabel:y,pad:o,border:u,outerAttrs:m,box:g=!1,edge:A=!1,outerStyle:a,bleed:N=!1,children:P}){const F=t(i),B=t(S),d=J(n,F),s=d&&!B,v=o&&!s?k(o.values,o.frame):null,p=u&&!s?u:null,G=[s?r:j,v?.className,p?H:null].filter(Boolean).join(" "),E=M(N&&s,v||p?{...C,...v?.style,...p}:C),L=t(c),D=g&&A&&L===void 0?{gutter:d,...o?{pad:o.values}:{}}:null,R=g?e(x.Provider,{value:!0,children:e(c.Provider,{value:D,children:P})}):P,h=d?e(i.Provider,{value:!0,children:R}):R,l=o&&s?q(o.values):null,I=m&&Object.keys(m).length>0?m:null,O=e("div",{...l?null:I,className:G,style:l||!a?E:{...E,...a},"data-tab-label":y,children:B?e(S.Provider,{value:!1,children:d&&!N?e("div",{className:w,children:h}):h}):h}),_=l?e("div",{...I,className:l.className,style:a?{...l.style,...a}:l.style,children:O}):O;return u&&s?e("div",{className:z,style:{display:"contents",...u},children:_}):_}function M(n,r){return n?{...r,paddingLeft:0,paddingRight:0}:r}export{Z as InsideSiteColumn,b as NestedBoxChoice,ee as NotASectionEdge,$ as SplitBandAndColumn,K as default,Y as useInsideSiteGutter,te as useSectionEdge,ne as useSectionRoot};
|
|
@@ -14,7 +14,8 @@ interface TextProps {
|
|
|
14
14
|
textStyle?: string;
|
|
15
15
|
contained: boolean;
|
|
16
16
|
hero?: boolean;
|
|
17
|
+
partAlign?: unknown;
|
|
17
18
|
}
|
|
18
19
|
export declare function headingLevelOfStyle(id: string): HeadingLevel;
|
|
19
|
-
export default function Text({ text, number, align, alignPhone, tone, contained, hero, pad, tag, textStyle, ownWidth }: TextProps): import("react").JSX.Element;
|
|
20
|
+
export default function Text({ text, number, align, alignPhone, tone, contained, hero, pad, tag, textStyle, ownWidth, partAlign }: TextProps): import("react").JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as S}from"react/jsx-runtime";import g from"./BlockFrame.js";import{renderGold as c,renderHeadline as E,splitParagraphs as _}from"./goldPhrases.js";import{headingLook as k}from"./Heading.js";import{alignPhoneClass as w}from"../../format/lib/content/block-align.js";import{textTagOf as O}from"../../format/lib/content/text-tag.js";import{KICKER_NUMBER_ATTR as j,kickerLead as z}from"../lib/content/page-contents.js";import{isTextStyleId as I}from"../lib/document/part-styles.js";import{faceClassOf as y}from"../../format/lib/text-style-face.js";import{useMirroredCopy as R}from"./MirrorContext.js";import{mirroredTextClasses as $}from"../../format/lib/content/mirror-cards.js";const l={bodyUpTo800:"max-view-wide:text-[length:var(--size-body,14px)]",bodySmall:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,17px)]",label:"text-[length:var(--size-label,13px)]"},b=e=>e?` ${e}`:"";function A(e,s){const t=w("place",e,s);return t?` ${t}`:""}const M={left:"text-left",center:"text-left mx-auto",right:"text-left ml-auto"},U=`max-w-[380px] ${l.bodySmall} leading-[1.5] opacity-80 ${l.bodyUpTo800}`,B={default:"text-fg",dim:"text-fg-dim"};function G(e){return String(Math.min(Number(e.slice(8)),6))}function H({text:e,number:s,align:t,alignPhone:T,tone:N,contained:f,hero:v=!1,pad:n,tag:C,textStyle:p,ownWidth:L=!1,partAlign:x}){const h=R();if(v)return r("p",{className:U,children:c(e)});const i=s?r("span",{[j]:"",children:z(s)}):void 0,a=I(p)?p:void 0,u=`${a?`${y({id:a})} `:""}${L?"":"max-w-[680px] "}whitespace-pre-line ${a==="body-5"?l.label:l.bodyLarge} leading-[1.7] ${M[t]}${A(t,T)} ${B[N]}${b($(h,t,x))}`,d=O(C);if(a?.startsWith("heading-")){const m=G(a),o=k(m,y({id:a}));return r(g,{contained:f,className:"py-6",pad:n?{values:n,frame:24}:void 0,children:S(d,{className:`${o.className}${b($(h,void 0,x))}`,style:o.style,children:[i,E(e.trim(),!1)]})})}return r(g,{contained:f,className:"py-4",pad:n?{values:n,frame:16}:void 0,children:d==="p"?_(e).map((m,o)=>r("p",{className:u,children:c(m,!1,o===0?i:void 0)},o)):r(d,{className:u,children:c(e.trim(),!1,i)})})}export{H as default,G as headingLevelOfStyle};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type PartStyles } from "../lib/document/part-styles.js";
|
|
3
|
+
export default function TextRegionRun({ region, partStyles, children, }: {
|
|
4
|
+
region: string;
|
|
5
|
+
partStyles: PartStyles | undefined;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{Fragment as o,jsx as r}from"react/jsx-runtime";import m from"./PartStyledKind.js";import{regionSheetStyle as a}from"../lib/document/part-styles.js";import{textRegionPartKey as f}from"../../format/lib/sections/text-regions.js";function d({region:n,partStyles:i,children:t}){const e=f(n);return a(i?.[e])?r(m,{kind:e,children:t}):r(o,{children:t})}export{d as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const SHARED_COLUMNS_KEY = "sharedColumns";
|
|
2
|
+
export declare const SHARED_COLUMNS_OFF = "own";
|
|
3
|
+
export declare const SHARED_COLUMNS_LABEL = "Row columns";
|
|
4
|
+
export declare const SHARED_COLUMNS_POINTS: readonly [{
|
|
5
|
+
readonly value: "own";
|
|
6
|
+
readonly label: "Each row";
|
|
7
|
+
}, {
|
|
8
|
+
readonly value: "shared";
|
|
9
|
+
readonly label: "Shared";
|
|
10
|
+
}];
|
|
11
|
+
export declare const SHARED_COLUMNS_PHONE_POINTS: readonly [{
|
|
12
|
+
readonly value: "own";
|
|
13
|
+
readonly label: "Each row";
|
|
14
|
+
}, {
|
|
15
|
+
readonly value: "scroll";
|
|
16
|
+
readonly label: "Shared, scroll";
|
|
17
|
+
}];
|
|
18
|
+
export declare function sharedColumnsFits(props: Record<string, unknown>): boolean;
|
|
19
|
+
export declare function sharedColumnsDrawn(props: Record<string, unknown>): {
|
|
20
|
+
desktop: boolean;
|
|
21
|
+
phone: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function sharedColumnsClasses(sides: {
|
|
24
|
+
desktop: boolean;
|
|
25
|
+
phone: boolean;
|
|
26
|
+
}, n: number): string;
|
|
27
|
+
export declare const SHARED_PLAIN_ATTR = "data-sf-shared-plain";
|
|
28
|
+
export declare function sharedColumnsCss(sides: {
|
|
29
|
+
desktop: boolean;
|
|
30
|
+
phone: boolean;
|
|
31
|
+
}, n: number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{REPEAT_ATTRIBUTE as l,phoneKey as f,tabletKey as b}from"efficient-easel/draw";import{parseLoop as C}from"../../../format/lib/animation/loop.js";import{finiteNumber as S}from"../../../format/lib/finite-number.js";import{isBackgroundBox as _}from"../../../format/lib/content/box-background.js";import{isStripBox as g}from"../../../format/lib/content/box-separator.js";import{BOX_ALIGN_CLASS as r,boxRowColumnsClass as x,boxRowTabletColumnsClass as E}from"../../../format/lib/content/box-layout.js";const i="sharedColumns",c="shared",$="own",u="scroll",U="Row columns",M=[{value:$,label:"Each row"},{value:c,label:"Shared"}],B=[{value:$,label:"Each row"},{value:u,label:"Shared, scroll"}],O="(width >= 800px)",N="(width < 800px)";function A(t){const o={direction:t.direction,separator:t.separator,loop:C(t.loop),line:t.line};return o.direction==="row"&&!g(o.direction,o.separator)&&o.loop!=="scroll"&&o.line!==!0&&!_(typeof t.bgImage=="string"?t.bgImage:void 0)&&x({...o,columns:t.columns})===""&&E({...o,columnsTablet:t[b("columns")]})===""}function R(t){return Array.isArray(t)?t.filter(o=>typeof o?.type=="string").length:S(t?.blockCount)??0}function K(t){return A(t)&&a(R(t.content))>0?y(t[i],t[f(i)]):{desktop:!1,phone:!1}}const a=t=>Number.isInteger(t)&&t>0?t:0,d=t=>`sf-shared-cols-${t}`,m=t=>`sf-shared-cols-phone-${t}`;function y(t,o){return{desktop:t===c,phone:o===u}}function F(t,o){const n=a(o);return n?`${t.desktop?` ${d(n)}`:""}${t.phone?` ${m(n)}`:""}`:""}function p(t){const o=`[${l}]`;return`:has(> ${o} ${t}):not(:has(> ${o} ${o} ${t}))`}function h(t,o,n=""){const e=p(t);return`${e}{display:grid;grid-template-columns:${o};column-gap:0${n}}${e}>:not(:has(${t})):not(${t}){grid-column:1/-1}${e} :has(${t}),${e} ${t}{display:grid;grid-template-columns:subgrid;grid-column:1/-1;min-width:0}`}const L="data-sf-shared-plain";function H(t){const o=`[${l}]`,n=`[${L}]`,e=p(t)+`:not(:has(> :not(${o}) > :not(${n}) ${t})):not(:has(> ${o} > * > :not(${n}) ${t})):not(:has(:not(${n}) > :not(${n}) > ${t}))`,s=`${e}>:not(style):not(:has(${t})):not(${t})`;return`${e}{display:table;width:100%;border-collapse:collapse}${e}>:has(${t}),${e}>${o}>:has(${t}),${e} ${n}:has(${t}),${e} ${n}>:has(${t}){display:contents}${e} ${t}{display:table-row}${e} ${t}>*{display:table-cell;width:auto;vertical-align:top}${e} ${t}.${r.center}>*{vertical-align:middle}${e} ${t}.${r.end}>*{vertical-align:bottom}${s}{display:table-caption;caption-side:bottom}${s}:has(~ ${o}){caption-side:top}`}function w(t,o){const n=a(o);if(!n)return"";let e="";if(t.desktop){const s=`.${d(n)}`;e+=`@media ${O}{${h(s,`repeat(${n},auto)`)}${H(s)}}`}return t.phone&&(e+=`@media ${N}{${h(`.${m(n)}`,`repeat(${n},minmax(max-content,auto))`,";overflow-x:auto")}}`),e}export{i as SHARED_COLUMNS_KEY,U as SHARED_COLUMNS_LABEL,$ as SHARED_COLUMNS_OFF,B as SHARED_COLUMNS_PHONE_POINTS,M as SHARED_COLUMNS_POINTS,L as SHARED_PLAIN_ATTR,F as sharedColumnsClasses,w as sharedColumnsCss,K as sharedColumnsDrawn,A as sharedColumnsFits};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import{phoneKey as o,tabletKey as l}from"efficient-easel/draw";import{sharedColumnsDrawn as c}from"../../../../content/box-shared-columns.js";import{CountRowsContext as d,NO_COUNTS as r}from"../../../../../components/CountRowsContext.js";import m from"../../../../../components/Flex.js";import{loopDelayOf as h,loopSecondsOf as g,parseLoop as u,parseLoopDirection as b}from"../../../../../../format/lib/animation/index.js";import{COUNTS_SOURCE as f,declaredBlockSource as S,servedRows as x}from"../../../../../../format/lib/content/block-sources.js";import{padValuesOf as w}from"../../../../content/section-padding.js";import{sectionFillsHeight as y}from"../../../../../../format/lib/content/section-min-height.js";import{FlexMeta as C}from"../../../../../../format/lib/document/blocks/general/Flex/meta.js";const T={...C,render:e=>{const i=n(m,{direction:e.direction,label:e.label,tabShape:e.tabShape,gap:e.gap,gapPhone:e[o("gap")],gapTablet:e[l("gap")],justify:e.justify,align:e.align,wrap:e.wrap,share:e.share,sharePhone:e[o("share")],wrapPhone:e[o("wrap")],phoneRow:e.phoneRow,columns:e.columns,columnsTablet:e[l("columns")],separator:e.separator,blockSpacing:e.blockSpacing,bgImage:e.bgImage,bgImagePhone:e.bgImagePhone,darken:e.darken,darkenStyle:e.darkenStyle,placement:e.placement,padV2:e.padV2===!0,border:e.sectionBorder,borderPhone:e.sectionBorderPhone,pad:w(e),contained:e.contained,fillHeight:y(e),shadow:e.shadow,loop:u(e.loop),scrollDirection:b(e.scrollDirection),loopSeconds:g({loopDuration:e.loopDuration}),loopDelay:h({loopDelay:e.loopDelay}),editing:!!e.editor?.isEditing,fillColor:e.fillColor,line:e.line,upcoming:e.upcoming,link:e.link,boxShape:e.boxShape,boxShapePhone:e[o("boxShape")],jumpHighlight:e.jumpHighlight,anchor:e.anchor,sharedSides:c(e),boxId:typeof e.id=="string"?e.id:void 0,mirrorCards:e.mirrorCards,content:e.content}),a=S(e),t=a?a===f?x(e):r:null;return n(d.Provider,{value:t,children:i})}};export{T as FlexRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as w,jsx as r}from"react/jsx-runtime";import{CardRowDrawn as y}from"../../../../../components/CardRowContext.js";import{CountDrawn as P}from"../../../../../components/CountRowsContext.js";import{KickerNumberDrawn as R}from"../../../../../components/PageContentsContext.js";import{KICKER_NUMBER_PROP as S}from"../../../../content/page-contents.js";import{namedRowField as T}from"../../../../../../format/lib/content/card-template.js";import{blockSetsItsWidth as k,blockSizeValuesOf as C}from"../../../../content/block-size.js";import{linkedCount as K}from"../../../../../../format/lib/content/count-numbers.js";import{padValuesOf as _}from"../../../../content/section-padding.js";import D from"../../../../../components/Text.js";import{hidableText as i,readHidable as F}from"efficient-easel/draw";import{PH as l}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as O}from"../../scaffold.js";import{readPartStyle as W}from"../../../part-styles.js";import{TextMeta as j}from"../../../../../../format/lib/document/blocks/general/Text/meta.js";const Q={...j,render:t=>{const{text:n,align:f,alignPhone:c,tone:h,tag:g,contained:x,editor:u}=t;if(F(n).hidden)return r(w,{});const{textStyle:m,align:s}=W(t,"text"),p=m?.startsWith("heading-")?l.heading:l.body,o=(e,a)=>r(D,{text:O(e,p,u)??"",number:a,align:f,alignPhone:c,tone:h,tag:g,textStyle:m,partAlign:s,ownWidth:k(C(t)),contained:x,pad:_(t)}),b=T(t),d=K(t);if(d)return r(P,{countKey:d,children:e=>o(e??i(n))});if(!b){const e=t[S];return typeof e=="string"?o(i(n),e):r(R,{id:t.id,children:a=>o(i(n),a)})}return r(y,{type:"Text",props:t,children:e=>o(i(e.text))})}};export{Q as TextRender};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import type { PartStyles } from "./part-styles.js";
|
|
2
3
|
export type SectionTextPartsProps = {
|
|
3
4
|
nodeId: string;
|
|
4
5
|
sectionType: string;
|
|
6
|
+
partStyles?: PartStyles;
|
|
5
7
|
children: ReactNode;
|
|
6
8
|
};
|
|
7
9
|
export type EditingBridges = {
|
|
@@ -2,6 +2,7 @@ import { type TextStyleCase } from "efficient-easel/draw";
|
|
|
2
2
|
import { 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
|
+
import { type TextRegion } from "../../../format/lib/sections/text-regions.js";
|
|
5
6
|
export declare const PART_STYLES_PROP = "_partStyles";
|
|
6
7
|
export declare const PART_STYLED_ATTR = "data-sf-part-styled";
|
|
7
8
|
export declare const TEXT_STYLE_ATTR = "data-sf-text-style";
|
|
@@ -117,6 +118,13 @@ export declare function partSpacingOf(style: PartStyle): {
|
|
|
117
118
|
export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
|
|
118
119
|
export declare function partPhoneDeclarations(style: PartStyle): Record<string, string>;
|
|
119
120
|
export declare function partStyleForScreen(style: PartStyle, phone: boolean): PartStyle;
|
|
121
|
+
export declare function partCanvasDeclarations(style: PartStyle, phone: boolean, options?: PartDeclarationOptions): Record<string, string>;
|
|
122
|
+
export declare function partStyleWithoutSizeBox(style: PartStyle, phone: boolean): PartStyle;
|
|
123
|
+
export type ShownDeclarations = {
|
|
124
|
+
fontFamily?: string;
|
|
125
|
+
fontSize?: string;
|
|
126
|
+
};
|
|
127
|
+
export declare function partShownDeclarations(style: PartStyle, phone: boolean, options?: PartDeclarationOptions): ShownDeclarations;
|
|
120
128
|
export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase, options?: PartDeclarationOptions): Record<string, string>;
|
|
121
129
|
export type MeasuredPartStyle = {
|
|
122
130
|
fontSize: string;
|
|
@@ -132,7 +140,25 @@ export declare function partFontKeyOf(family: string, resolve: (cssVar: string)
|
|
|
132
140
|
export declare function partStyleSource<E extends {
|
|
133
141
|
getAttribute(name: string): string | null;
|
|
134
142
|
}>(nodeId: string, selectedPartId: string | null, selectedElements: readonly E[], declaresStyle: (className: string | null) => boolean): E | null;
|
|
143
|
+
export declare function storedPartStyle(styles: PartStyles, styleKey: string): PartStyle;
|
|
135
144
|
export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, phone?: boolean, drawsStyle?: (partKey: string) => boolean): number;
|
|
145
|
+
export declare function regionSheetStyle(style: PartStyle | undefined | null): PartStyle | null;
|
|
146
|
+
export declare function regionCanvasDeclarations(style: PartStyle | undefined | null, phone: boolean): {
|
|
147
|
+
fontFamily?: string;
|
|
148
|
+
fontSize?: string;
|
|
149
|
+
};
|
|
150
|
+
export declare function regionHasOwnLook(style: PartStyle | undefined | null): boolean;
|
|
151
|
+
export declare function regionShownDeclarations(style: PartStyle | undefined | null, region: TextRegion, phone: boolean): ShownDeclarations;
|
|
152
|
+
export declare function regionCanvasRestore(style: {
|
|
153
|
+
fontFamily: string;
|
|
154
|
+
fontSize: string;
|
|
155
|
+
}, prior: {
|
|
156
|
+
fontFamily: string;
|
|
157
|
+
fontSize: string;
|
|
158
|
+
}, painted: {
|
|
159
|
+
fontFamily?: string;
|
|
160
|
+
fontSize?: string;
|
|
161
|
+
}): void;
|
|
136
162
|
export declare const PART_PARAGRAPH_ATTR = "data-sf-part-para";
|
|
137
163
|
export declare const PART_STYLE_PROPERTIES: readonly string[];
|
|
138
164
|
export declare const SHARED_PART_PROPERTIES: readonly string[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{parseHexColor as Q}from"efficient-shell/format";import{FONT_OPTIONS as tt,fontOption as et,fontRoleOf as b,SIZE_STEP_OF_ROLE as M}from"../../../format/lib/fonts.js";import{encodePartKey as nt}from"../../../format/lib/document/part-key.js";import{decodePartId as F,normalizePartText as E}from"./text-parts.js";import{COLOUR_TOKEN as L}from"../../../format/lib/word-styles.js";import{PHONE_MEDIA as rt}from"../content/view-values.js";import{plainRecord as $,propsWithPartRecord as ot,readPartRecord as it,readPartRecords as st}from"../../../format/lib/document/part-records.js";const y="_partStyles",at="data-sf-part-styled",H="data-sf-text-style",ct=/^(heading|body)-[1-7]$/;function T(t){return typeof t=="string"&&ct.test(t)}const j={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function ft(t){if(!t)return null;for(const[e,n]of Object.entries(j))if(n===t)return e;return null}function le(t){if(T(t.textStyle))return t.textStyle;const e=b(t.role);return e?j[e]:void 0}const lt=[400,500,600,700],_=["left","center","right","justify"],D=5,C=1e3,ut=-5,pt=10,dt=0,xt=64,ht=2,K={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:dt,max:xt,step:ht}},gt=.05,Pt=.01,mt=["line","letter"],St=.5,Tt=2.5,Rt=-1,bt=1,_t=0,At=400,Et=[...new Set(Object.values(M))];function ue(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function pe(t){return st(t,y)}function W(t,e){return it(t,y,e)}function de(t,e){return Object.values(W(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){return ot(t,y,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return mt.includes(t)}const R=(t,e,n)=>Math.min(n,Math.max(e,t));function Nt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:R(n,ut,pt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?m(R(n,St,Tt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?m(R(n,Rt,bt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:R(n,_t,At)}if(Object.hasOwn(K,t)){const{min:n,max:r}=K[t],o=Math.round(Number(e));return Number.isFinite(o)?R(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?b(e)?e:null:t==="sizeToken"?O(e)?e:null:t==="textStyle"?T(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Ot=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function N(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of Ot){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!T(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!O(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!b(t.fontRole)&&n("fontRole"),e??t}function O(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:r,pxPhone:o,fluid:i}=t,s=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,c=f=>typeof f=="string"&&Et.includes(f);return c(e)&&s(n)&&(r===void 0||c(r))&&(o===void 0||s(o))&&(i===void 0||wt(i,n))}function wt(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:r,...o}=t;return Object.keys(o).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof r=="number"&&Number.isFinite(r)&&r>0&&r<=100}function X(t){return t?.pxPhone&&O(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function U({step:t,px:e,fluid:n}){const r=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,o=`var(--size-${t}, ${r})`;return t.startsWith("heading")?`min(${o}, var(--sf-heading-max,9999px))`:o}const zt=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function It(t){const e=[];for(const[n,r]of zt)n===t?e.push(r):r===t&&e.push(n);return e}function xe(t,e,n,r){const o={...W(t,e)},i=r==null?null:Nt(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of It(n))delete o[s]}return G(t,e,o)}function he(t,e){return G(t,e,{})}function kt(t){return J(t)??"none"}function Mt(t){return q(t)??""}const V={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function Ft(t,e){const n=b(t.role);return n||(e?.blockDrawsStyle?null:ft(t.textStyle))}function ge(t,e){return t==="Text"&&e==="text"}const Lt={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function Ht(t){const e=M[t],n=Lt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function jt(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=m(Dt+t.line*gt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=m(t.letter*Pt,4)),e}const Dt=1,P="--sf-part-para";function Ct(t){t=N(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=X(t.sizeToken);n&&(e.fontSize=U(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Kt(t,e){if(!e)return t;const n=N(t);let r=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)r={...r,size:n.sizePhone};else{const o=X(n.sizeToken);o&&(r={...r,size:void 0,sizeToken:o})}return n.alignPhone&&(r={...r,align:n.alignPhone}),r}function w(t,e,n){t=N(t);const r=Ft(t,n),o=jt(t),i=t.size?`${t.size}px`:t.sizeToken?U(t.sizeToken):r?Ht(r):"";return{fontFamily:t.font?Ut(t.font):t.fontRole?`var(${V[t.fontRole]})`:r?`var(${V[r]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:o.lineHeight!==void 0?String(o.lineHeight):"",letterSpacing:o.letterSpacingEm!==void 0?`${o.letterSpacingEm}em`:"",[P]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Mt(t.case),textAlign:t.align??"",paddingTop:Y(t.padding),paddingBottom:Y(t.padding),color:Wt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const Wt=t=>t===void 0||t===""?"":Object.hasOwn(L,t)?L[t]:Q(t)===t.toLowerCase()?t:"",Y=t=>t===void 0?"":`${t}px`,m=(t,e)=>Number(t.toFixed(e));function Pe(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Gt(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:Xt(t.textAlign),case:kt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Gt(t){return Number.isFinite(t)?lt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Xt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function me(t,e){const n=v(t);if(!n)return"";for(const r of tt)if(v(e(r.cssVar))===n)return r.key;return""}const v=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ut(t){const e=et(t);return e?`var(${e.cssVar})`:""}function Se(t,e,n,r){return!e||F(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function Te(t,e,n=()=>A,r=c=>c,o=vt,i=!1,s=()=>!1){let c=0;for(const{element:f,partId:u}of t){const l=F(u)?.propKey;if(!l)continue;const p=r(l),d=Object.hasOwn(e,p)?$(e[p])??{}:{},a=w(Kt(d,i),A,{blockDrawsStyle:s(l)});T(d.textStyle)?f.setAttribute?.(H,d.textStyle):f.removeAttribute?.(H);const h=I.some(x=>f.style[x]);let g=!1;for(const[x,S]of Object.entries(a))Bt(f,x,S),S&&(g=!0);if(h||I.some(x=>a[x]))for(const x of Vt(f,o))for(const S of I)x.style[S]=a[S]??"";g&&(c+=1)}return c}function Vt(t,e){const n=E(t.textContent??""),r=[];let o=t;for(let i=0;i<Yt&&e(o);i+=1){const s=o.parentElement;if(!s||E(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Yt=8;function vt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Bt(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===P&&(n?o.setAttribute?.(B,""):o.removeAttribute?.(B))}const B="data-sf-part-para",Zt=Object.keys(w({},A)),z=new Set(["color","overflowWrap",P,"fontStyle"]),I=Zt.filter(t=>!z.has(t));function Re(t,e,n,r=c=>c,o=()=>!1,i=()=>null,s=[]){const c=new Map;for(const l of t){const p=nt(l.key,l.row);for(const d of l.texts){const a=c.get(d);a?(a.keys.add(l.key),a.partKeys.add(p)):c.set(d,{keys:new Set([l.key]),partKeys:new Set([p])})}}const f=new Map;for(const l of new Set([...Object.keys(e),...s])){if(!qt(l))continue;const p=Z(n,l,$(e[l])??{},!1,i(l));p&&f.set(l,p)}const u=new Map;for(const[l,{keys:p,partKeys:d}]of c){const a=d.size===1?[...d][0]:p.size===1?[...p][0]:null;if(!a)continue;const h=r(a),g=i(h);if(!Object.hasOwn(e,h)&&!g)continue;const k=$(e[h])??{},x=Z(n,a,k,o(a),g);x&&u.set(l,x)}return u.size||f.size?{rules:u,kindRules:f,drawn:new Set(c.keys())}:null}function Z(t,e,n,r,o){const i=w(n,A,{blockDrawsStyle:r}),s=Ct(n),c=T(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(s).length&&!c&&!o?null:{stamp:Jt(t,e),declarations:i,...Object.keys(s).length?{phone:s}:{},...c?{textStyle:c}:{},...o?{motion:o}:{}}}function qt(t){return t.startsWith("@")}function be(t,e){return t?.kindRules.get(e)??null}function Jt(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function _e(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const c=Object.entries(s).filter(([,a])=>a!==""),f=a=>a.map(([h,g])=>`${te(h)}: ${g}`).join("; "),u=`[${at}="${i}"]`,l=c.filter(([a])=>!z.has(a)),p=c.filter(([a])=>z.has(a));l.length&&e.push(`${u}, *:has(> ${u}) { ${f(l)} }`),p.length&&e.push(`${u} { ${f(p)} }`),s[P]&&(e.push(`*:has(> ${u}) { ${P}: ${s[P]} }`),e.push(...Qt(u,`*:has(> ${u})`)));const d=Object.entries(o.phone??{}).filter(([,a])=>a!=="");d.length&&e.push(`@media ${rt} { ${u}, *:has(> ${u}) { ${f(d)} } }`)};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as J,textStyleCaseOfCss as Q}from"efficient-easel/draw";import{parseHexColor as tt}from"efficient-shell/format";import{FONT_OPTIONS as et,fontOption as nt,fontRoleOf as R,SIZE_STEP_OF_ROLE as z}from"../../../format/lib/fonts.js";import{encodePartKey as ot}from"../../../format/lib/document/part-key.js";import{decodePartId as L,normalizePartText as E}from"./text-parts.js";import{COLOUR_TOKEN as M}from"../../../format/lib/word-styles.js";import{regionStyle as rt}from"../../../format/lib/sections/text-regions.js";import{PHONE_MEDIA as it}from"../content/view-values.js";import{plainRecord as O,propsWithPartRecord as at,readPartRecord as st,readPartRecords as ft}from"../../../format/lib/document/part-records.js";const $="_partStyles",ct="data-sf-part-styled",H="data-sf-text-style",ut=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&ut.test(t)}const j={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function lt(t){if(!t)return null;for(const[e,n]of Object.entries(j))if(n===t)return e;return null}function Se(t){if(g(t.textStyle))return t.textStyle;const e=R(t.role);return e?j[e]:void 0}const pt=[400,500,600,700],_=["left","center","right","justify"],D=5,C=1e3,dt=-5,xt=10,ht=0,St=64,gt=2,W={size:{min:D,max:C,step:1},sizePhone:{min:D,max:C,step:1},padding:{min:ht,max:St,step:gt}},mt=.05,Pt=.01,Tt=["line","letter"],bt=.5,Rt=2.5,_t=-1,At=1,zt=0,Et=400,Ot=[...new Set(Object.values(z))];function ge(t){return[`${t} { transition: translate var(--page-motion-hover-duration) var(--page-ease-media) var(--page-motion-hover-delay) }`,`${t}:hover, ${t}:active { translate: 0 calc(-1 * var(--page-hover-lift)) }`]}function me(t){return ft(t,$)}function K(t,e){return st(t,$,e)}function Pe(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){return at(t,$,e,$t(n).length?n:null)}function $t(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function yt(t){return Tt.includes(t)}const b=(t,e,n)=>Math.min(n,Math.max(e,t));function wt(t,e){if(yt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:b(n,dt,xt)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?P(b(n,bt,Rt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?P(b(n,_t,At),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:b(n,zt,Et)}if(Object.hasOwn(W,t)){const{min:n,max:o}=W[t],r=Math.round(Number(e));return Number.isFinite(r)?b(r,n,o):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"||t==="fontRole"?R(e)?e:null:t==="sizeToken"?w(e)?e:null:t==="textStyle"?g(e)?e:null:t==="alignPhone"?_.includes(e)?e:null:e}const Nt=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding"];function y(t){let e=null;const n=o=>{e??={...t},delete e[o]};for(const o of Nt){const r=t[o];r!==void 0&&!(typeof r=="number"&&Number.isFinite(r))&&n(o)}return t.align!==void 0&&!_.includes(t.align)&&n("align"),t.alignPhone!==void 0&&!_.includes(t.alignPhone)&&n("alignPhone"),t.textStyle!==void 0&&!g(t.textStyle)&&n("textStyle"),t.sizeToken!==void 0&&!w(t.sizeToken)&&n("sizeToken"),t.fontRole!==void 0&&!R(t.fontRole)&&n("fontRole"),e??t}function w(t){if(!t||typeof t!="object")return!1;const{step:e,px:n,stepPhone:o,pxPhone:r,fluid:i}=t,a=f=>typeof f=="number"&&Number.isFinite(f)&&f>0,s=f=>typeof f=="string"&&Ot.includes(f);return s(e)&&a(n)&&(o===void 0||s(o))&&(r===void 0||a(r))&&(i===void 0||It(i,n))}function It(t,e){if(!t||typeof t!="object"||Array.isArray(t))return!1;const{minPx:n,vw:o,...r}=t;return Object.keys(r).length===0&&typeof n=="number"&&Number.isFinite(n)&&n>0&&n<e&&typeof o=="number"&&Number.isFinite(o)&&o>0&&o<=100}function v(t){return t?.pxPhone&&w(t)?{step:t.stepPhone??t.step,px:t.pxPhone}:null}function X({step:t,px:e,fluid:n}){const o=n?`clamp(${n.minPx}px, ${n.vw}vw, ${e}px)`:`${e}px`,r=`var(--size-${t}, ${o})`;return t.startsWith("heading")?`min(${r}, var(--sf-heading-max,9999px))`:r}const Ft=[["font","role"],["font","fontRole"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function kt(t){const e=[];for(const[n,o]of Ft)n===t?e.push(o):o===t&&e.push(n);return e}function Te(t,e,n,o){const r={...K(t,e)},i=o==null?null:wt(n,o);if(i===null)delete r[n];else{r[n]=i;for(const a of kt(n))delete r[a]}return G(t,e,r)}function be(t,e){return G(t,e,{})}function Lt(t){return Q(t)??"none"}function Mt(t){return J(t)??""}const B={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 Ht(t,e){const n=R(t.role);return n||(e?.blockDrawsStyle?null:lt(t.textStyle))}function Re(t,e){return t==="Text"&&e==="text"}const jt={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 Dt(t){const e=z[t],n=jt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ct(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=P(Wt+t.line*mt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=P(t.letter*Pt,4)),e}const Wt=1,m="--sf-part-para";function Kt(t){t=y(t);const e={};if(typeof t.sizePhone=="number"&&t.sizePhone>0)e.fontSize=`${t.sizePhone}px`;else{const n=v(t.sizeToken);n&&(e.fontSize=X(n))}return t.alignPhone&&(e.textAlign=t.alignPhone),e}function Gt(t,e){if(!e)return t;const n=y(t);let o=t;if(typeof n.sizePhone=="number"&&n.sizePhone>0)o={...o,size:n.sizePhone};else{const r=v(n.sizeToken);r&&(o={...o,size:void 0,sizeToken:r})}return n.alignPhone&&(o={...o,align:n.alignPhone}),o}function N(t,e,n){return I(Gt(t,e),A,n)}function U(t,e){const n=e?"sizePhone":"size";if(!Object.hasOwn(t,n))return t;const o={...t};return delete o[n],o}function _e(t,e,n){const o=N(U(t,e),e,n);return{fontFamily:o.fontFamily,fontSize:o.fontSize}}function I(t,e,n){t=y(t);const o=Ht(t,n),r=Ct(t),i=t.size?`${t.size}px`:t.sizeToken?X(t.sizeToken):o?Dt(o):"";return{fontFamily:t.font?Ut(t.font):t.fontRole?`var(${B[t.fontRole]})`:o?`var(${B[o]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:r.lineHeight!==void 0?String(r.lineHeight):"",letterSpacing:r.letterSpacingEm!==void 0?`${r.letterSpacingEm}em`:"",[m]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:Mt(t.case),textAlign:t.align??"",paddingTop:V(t.padding),paddingBottom:V(t.padding),color:vt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const vt=t=>t===void 0||t===""?"":Object.hasOwn(M,t)?M[t]:tt(t)===t.toLowerCase()?t:"",V=t=>t===void 0?"":`${t}px`,P=(t,e)=>Number(t.toFixed(e));function Ae(t,e){const n=Number.parseFloat(t.fontSize)||16,o=Number.parseFloat(t.lineHeight),r=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop);return{fontKey:e,sizePx:n,weight:Xt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(o)?P(o/n,3):1.2,letterEm:Number.isFinite(r)?P(r/n,4):0,align:Bt(t.textAlign),case:Lt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0}}function Xt(t){return Number.isFinite(t)?pt.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Bt(t){for(const e of _)if(e===t)return e;return t==="end"?"right":"left"}function ze(t,e){const n=Y(t);if(!n)return"";for(const o of et)if(Y(e(o.cssVar))===n)return o.key;return""}const Y=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Ut(t){const e=nt(t);return e?`var(${e.cssVar})`:""}function Ee(t,e,n,o){return!e||L(e)?.nodeId!==t?null:n.find(i=>o(i.getAttribute("class")))??n[0]??null}function Vt(t,e){return Object.hasOwn(t,e)?O(t[e])??{}:{}}function Oe(t,e,n=()=>A,o=s=>s,r=qt,i=!1,a=()=>!1){let s=0;for(const{element:f,partId:p}of t){const c=L(p)?.propKey;if(!c)continue;const l=Vt(e,o(c)),d=N(l,i,{blockDrawsStyle:a(c)});g(l.textStyle)?f.setAttribute?.(H,l.textStyle):f.removeAttribute?.(H);const u=k.some(x=>f.style[x]);let h=!1;for(const[x,S]of Object.entries(d))te(f,x,S),S&&(h=!0);if(u||k.some(x=>d[x]))for(const x of Yt(f,r))for(const S of k)x.style[S]=d[S]??"";h&&(s+=1)}return s}function Yt(t,e){const n=E(t.textContent??""),o=[];let r=t;for(let i=0;i<Zt&&e(r);i+=1){const a=r.parentElement;if(!a||E(a.textContent??"")!==n)break;o.push(a),r=a}return o}const Zt=8;function qt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const A={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0};function Jt(t){if(!t||typeof t!="object")return null;const e={};return g(t.textStyle)&&(e.textStyle=t.textStyle),typeof t.size=="number"&&t.size>0&&(e.size=t.size),typeof t.sizePhone=="number"&&t.sizePhone>0&&(e.sizePhone=t.sizePhone),Object.keys(e).length?e:null}function Qt(t,e){const n=Jt(t);if(!n)return{};const o=N(n,e);return{...o.fontFamily?{fontFamily:o.fontFamily}:{},...o.fontSize?{fontSize:o.fontSize}:{}}}function $e(t){return g(t?.textStyle)||!!t?.role||typeof t?.size=="number"&&t.size>0}function ye(t,e,n){if(!t||typeof t!="object")return{};const o=rt(t.role,e,z)??{},r=e.sized?Qt(U(t,n),n):{};return{...o,...r}}function we(t,e,n){n.fontFamily&&t.fontFamily===n.fontFamily&&(t.fontFamily=e.fontFamily),n.fontSize&&t.fontSize===n.fontSize&&(t.fontSize=e.fontSize)}function te(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const o=t.style;typeof o.setProperty=="function"?n?o.setProperty(e,n):o.removeProperty?.(e):o[e]=n;const r=t;e===m&&(n?r.setAttribute?.(Z,""):r.removeAttribute?.(Z))}const Z="data-sf-part-para",ee=Object.keys(I({},A)),F=new Set(["color","overflowWrap",m,"fontStyle"]),k=ee.filter(t=>!F.has(t));function Ne(t,e,n,o=s=>s,r=()=>!1,i=()=>null,a=[]){const s=new Map;for(const c of t){const l=ot(c.key,c.row);for(const d of c.texts){const u=s.get(d);u?(u.keys.add(c.key),u.partKeys.add(l)):s.set(d,{keys:new Set([c.key]),partKeys:new Set([l])})}}const f=new Map;for(const c of new Set([...Object.keys(e),...a])){if(!ne(c))continue;const l=q(n,c,O(e[c])??{},!1,i(c));l&&f.set(c,l)}const p=new Map;for(const[c,{keys:l,partKeys:d}]of s){const u=d.size===1?[...d][0]:l.size===1?[...l][0]:null;if(!u)continue;const h=o(u),T=i(h);if(!Object.hasOwn(e,h)&&!T)continue;const x=O(e[h])??{},S=q(n,u,x,r(u),T);S&&p.set(c,S)}return p.size||f.size?{rules:p,kindRules:f,drawn:new Set(s.keys())}:null}function q(t,e,n,o,r){const i=I(n,A,{blockDrawsStyle:o}),a=Kt(n),s=g(n.textStyle)?n.textStyle:void 0;return!Object.values(i).some(Boolean)&&!Object.keys(a).length&&!s&&!r?null:{stamp:oe(t,e),declarations:i,...Object.keys(a).length?{phone:a}:{},...s?{textStyle:s}:{},...r?{motion:r}:{}}}function ne(t){return t.startsWith("@")}function Ie(t,e){return t?.kindRules.get(e)??null}function oe(t,e){const n=o=>o.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function Fe(t){const e=[],n=new Set,o=r=>{const{stamp:i,declarations:a}=r;if(n.has(i))return;n.add(i);const s=Object.entries(a).filter(([,u])=>u!==""),f=u=>u.map(([h,T])=>`${ie(h)}: ${T}`).join("; "),p=`[${ct}="${i}"]`,c=s.filter(([u])=>!F.has(u)),l=s.filter(([u])=>F.has(u));c.length&&e.push(`${p}, *:has(> ${p}) { ${f(c)} }`),l.length&&e.push(`${p} { ${f(l)} }`),a[m]&&(e.push(`*:has(> ${p}) { ${m}: ${a[m]} }`),e.push(...re(p,`*:has(> ${p})`)));const d=Object.entries(r.phone??{}).filter(([,u])=>u!=="");d.length&&e.push(`@media ${it} { ${p}, *:has(> ${p}) { ${f(d)} } }`)};for(const r of t.rules.values())o(r);for(const r of t.kindRules.values())o(r);return e.join(`
|
|
2
|
+
`)}function re(t,e){const n=`var(${m})`,o=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${n} }`,`${t} ${o}:not(:first-child) { margin-top: ${n} }`,`${t} ${o}:not(:last-child) { margin-bottom: ${n} }`,`:is(${e}) + :is(${e}) { margin-top: ${n} }`]}const ie=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function ke(t,e){if(!t)return null;const n=E(e),o=t.rules.get(n);if(o)return o;if(n.length<ae||t.drawn.has(n))return null;let r=null;for(const[i,a]of t.rules)if(i.includes(n)){if(r&&r.stamp!==a.stamp)return null;r=a}return r}const ae=8;export{_ as PART_ALIGNS,At as PART_LETTER_EM_MAX,_t as PART_LETTER_EM_MIN,Pt as PART_LETTER_STEP,Rt as PART_LINE_HEIGHT_MAX,bt as PART_LINE_HEIGHT_MIN,mt as PART_LINE_STEP,W as PART_MEASURED_TRACKS,xt as PART_NUDGE_MAX,dt as PART_NUDGE_MIN,St as PART_PADDING_MAX,ht as PART_PADDING_MIN,gt as PART_PADDING_STEP,Z as PART_PARAGRAPH_ATTR,Et as PART_PARAGRAPH_MAX,zt as PART_PARAGRAPH_MIN,m as PART_PARAGRAPH_VAR,Tt as PART_RELATIVE_PROPS,C as PART_SIZE_MAX,D as PART_SIZE_MIN,Ot as PART_SIZE_STEPS,ct as PART_STYLED_ATTR,$ as PART_STYLES_PROP,ee as PART_STYLE_PROPERTIES,pt as PART_WEIGHTS,k as SHARED_PART_PROPERTIES,j as STYLE_ID_OF_ROLE,H as TEXT_STYLE_ATTR,Oe as applyPartStyles,Re as blockDrawsTextStyle,Se as followedStyleOf,ne as isPartKindKey,g as isTextStyleId,re as paragraphRules,N as partCanvasDeclarations,Lt as partCaseOfTransform,Mt as partCaseTransform,ze as partFontKeyOf,ge as partLiftRules,Kt as partPhoneDeclarations,Ie as partRuleForKind,ke as partRuleForText,_e as partShownDeclarations,Ct as partSpacingOf,Ae as partStyleBase,Pe as partStyleCount,Fe as partStyleCss,I as partStyleDeclarations,Gt as partStyleForScreen,Ee as partStyleSource,U as partStyleWithoutSizeBox,Te as propsWithPartStyleValue,be as propsWithoutPartStyle,Ne as publishedPartStyles,K as readPartStyle,me as readPartStyles,Qt as regionCanvasDeclarations,we as regionCanvasRestore,$e as regionHasOwnLook,Jt as regionSheetStyle,ye as regionShownDeclarations,Vt as storedPartStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as u}from"react/jsx-runtime";import{resolveContainerDirection as S}from"../../../../format/lib/content/container-direction.js";import{HERO_BACKGROUND_VAR as v,HERO_CHROME_CAP_VAR as A,HERO_CHROME_INSET_VAR as B,SITE_WIDTH_CAP as f,centredCap as I,heroBackgroundTokens as W}from"../../../../format/lib/content/page-width.js";import{SECTION_WIDTH_FAMILY as y,hasWidthFamily as g,resolveWidth as C,siteWidthsOf as G}from"../../../../format/lib/content/section-width.js";import{boxGutterOf as b,boxPlaceOf as F,isFrameContainer as T,siteDrawsGutter as H}from"../../../../format/lib/content/site-gutter.js";import{getEditorSiteContentWidth as P}from"../../../../format/lib/document/editor-site-widths.js";import{NestedBoxChoice as D,SplitBandAndColumn as M}from"../../../components/SiteGutterFrame.js";import{FRAME as m}from"../../../components/BlockFrame.js";import{sectionFillPassClass as k}from"../../../../format/lib/content/section-min-height.js";import{parentCapsWidth as V}from"../../../../format/lib/sections/section-head-placement.js";import{addShowWhenFacts as p,withRowsShownWhen as h}from"../../../../format/lib/document/show-when-attach.js";import{findParentNode as j,isNestedNode as L}from"../../../../format/lib/document/passes/document-position.js";const N="--sf-sw-site",U="--sf-sw-content",K="--sf-bg-cap",Y="contents [--sf-site-width:var(--sf-sw-content)] max-view-wide:[--sf-site-width:var(--sf-sw-site)]";function O(t,e){return t==="full"&&e!=="content"?"100vw":null}function E(t,e){return e===null?t:u("div",{className:"contents",style:{[N]:f},children:u("div",{className:Y,style:{[U]:e},children:t})})}const $="--sf-content-cap",q="contents max-view-wide:[--sf-content-cap:none]";function z(t,e){return t==="full"||e==="content"?null:`var(${N})`}function J(t,e){return e===null?t:u("div",{className:"contents",style:{[N]:f},children:u("div",{className:q,style:{[$]:e},children:t})})}const _=(t,e,n="")=>t==="content"?u("div",{className:n||void 0,style:I(f),children:e}):e;function x(t,e,n,o,i){return n==="full"?_(o,t({...e,contained:!1}),i):o==="content"?t({...e,contained:!0}):u(M,{children:t({...e,contained:!0})})}function Q(t,e){const n=y[e],o=t.render;t.render=i=>{const s=G(i),r=s.content??"content";if(n==="hero"){const d=s.background,l=E(o(i),O(r,d));return d==="full"?u("div",{style:{[v]:"none",[B]:"initial",[A]:"initial"},children:l}):d==="content"?u("div",{style:W(!0),children:l}):l}const c=s.background??"full",a=k(i);if(n==="scrollOver"){const d=o({...i,fullWidth:r==="full"});return c==="content"?u("div",{className:"contents",style:{[K]:f},children:d}):d}switch(n){case"both":return _(c,J(o(i),z(r,c)),a);case"contained":{const d=x(o,i,r,c,a);if(!T(e))return d;const l=b(i),w=l===void 0?r:l?"content":"full";return w===r?d:u(D,{atTop:d,nested:x(o,i,w,c,a)})}case"contentColumn":case"contentFull":case"productGrid":{const l=o({...i,widthMode:r==="full"?"full":"page"});return n==="productGrid"?c==="content"?u("div",{className:a?`${m} ${a}`:m,children:l}):l:_(c,l,a)}default:return _(c,E(o(i),O(r,c)),a)}}}const wt={name:"sectionWidth",applies:(t,e,n)=>g(t)&&!!n&&typeof n.render=="function",panel(t,e,n){if(!T(e))return;const o=n.boxGutterFields();t.fields=R(e,t,{...t.fields,...o},Object.keys(o))},draw(t,e){Q(t,e)}};function X(t,e){if(!t||!("widthMode"in t))return t;const n={...t},o=n.widthMode;return o&&(n.widthMode={...o,currentValue:e.mode,inherited:e.inherited}),n}const Z=new Set(["Heading","Text","ImageBlock","ButtonBlock"]),Ct={name:"containedWidth",applies:(t,e,n)=>Z.has(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const o=n.widthField;t.fields=R(e,t,{...t.fields,...o("page")});const i=t.resolveFields;t.resolveFields=(s,r)=>{const c=i?i(s,r):r.fields,a=C(s?.props??{},"page"),d=l=>X(l,a);return c&&typeof c.then=="function"?c.then(d):d(c)}},draw(t){const e=t.render;t.render=n=>{const{mode:o}=C(n,"page");return e({...n,contained:o!=="full"})}}},tt={not:{context:"inHeroGroupRow",is:!0}},Tt={name:"buttonAlignInRow",applies:t=>t==="ButtonBlock",panel(t){const e=t;e.fields=h(e.fields??{},["align"],tt),p(e,{inHeroGroupRow:(n,o)=>{const i=j(o.appState,n.props?.id);return!!i&&i.type==="HeroGroup"&&S("HeroGroup",i.props?.direction)==="row"}})}};function et(t){return Object.values(t).some(e=>!!e&&typeof e=="object"&&e.type==="slot")}const nt={any:[]},ot={all:[{context:"
|
|
1
|
+
import{jsx as u}from"react/jsx-runtime";import{resolveContainerDirection as S}from"../../../../format/lib/content/container-direction.js";import{HERO_BACKGROUND_VAR as v,HERO_CHROME_CAP_VAR as A,HERO_CHROME_INSET_VAR as B,SITE_WIDTH_CAP as f,centredCap as I,heroBackgroundTokens as W}from"../../../../format/lib/content/page-width.js";import{SECTION_WIDTH_FAMILY as y,hasWidthFamily as g,resolveWidth as C,siteWidthsOf as G}from"../../../../format/lib/content/section-width.js";import{boxGutterOf as b,boxPlaceOf as F,isFrameContainer as T,siteDrawsGutter as H}from"../../../../format/lib/content/site-gutter.js";import{getEditorSiteContentWidth as P}from"../../../../format/lib/document/editor-site-widths.js";import{NestedBoxChoice as D,SplitBandAndColumn as M}from"../../../components/SiteGutterFrame.js";import{FRAME as m}from"../../../components/BlockFrame.js";import{sectionFillPassClass as k}from"../../../../format/lib/content/section-min-height.js";import{parentCapsWidth as V}from"../../../../format/lib/sections/section-head-placement.js";import{addShowWhenFacts as p,withRowsShownWhen as h}from"../../../../format/lib/document/show-when-attach.js";import{findParentNode as j,isNestedNode as L}from"../../../../format/lib/document/passes/document-position.js";const N="--sf-sw-site",U="--sf-sw-content",K="--sf-bg-cap",Y="contents [--sf-site-width:var(--sf-sw-content)] max-view-wide:[--sf-site-width:var(--sf-sw-site)]";function O(t,e){return t==="full"&&e!=="content"?"100vw":null}function E(t,e){return e===null?t:u("div",{className:"contents",style:{[N]:f},children:u("div",{className:Y,style:{[U]:e},children:t})})}const $="--sf-content-cap",q="contents max-view-wide:[--sf-content-cap:none]";function z(t,e){return t==="full"||e==="content"?null:`var(${N})`}function J(t,e){return e===null?t:u("div",{className:"contents",style:{[N]:f},children:u("div",{className:q,style:{[$]:e},children:t})})}const _=(t,e,n="")=>t==="content"?u("div",{className:n||void 0,style:I(f),children:e}):e;function x(t,e,n,o,i){return n==="full"?_(o,t({...e,contained:!1}),i):o==="content"?t({...e,contained:!0}):u(M,{children:t({...e,contained:!0})})}function Q(t,e){const n=y[e],o=t.render;t.render=i=>{const s=G(i),r=s.content??"content";if(n==="hero"){const d=s.background,l=E(o(i),O(r,d));return d==="full"?u("div",{style:{[v]:"none",[B]:"initial",[A]:"initial"},children:l}):d==="content"?u("div",{style:W(!0),children:l}):l}const c=s.background??"full",a=k(i);if(n==="scrollOver"){const d=o({...i,fullWidth:r==="full"});return c==="content"?u("div",{className:"contents",style:{[K]:f},children:d}):d}switch(n){case"both":return _(c,J(o(i),z(r,c)),a);case"contained":{const d=x(o,i,r,c,a);if(!T(e))return d;const l=b(i),w=l===void 0?r:l?"content":"full";return w===r?d:u(D,{atTop:d,nested:x(o,i,w,c,a)})}case"contentColumn":case"contentFull":case"productGrid":{const l=o({...i,widthMode:r==="full"?"full":"page"});return n==="productGrid"?c==="content"?u("div",{className:a?`${m} ${a}`:m,children:l}):l:_(c,l,a)}default:return _(c,E(o(i),O(r,c)),a)}}}const wt={name:"sectionWidth",applies:(t,e,n)=>g(t)&&!!n&&typeof n.render=="function",panel(t,e,n){if(!T(e))return;const o=n.boxGutterFields();t.fields=R(e,t,{...t.fields,...o},Object.keys(o))},draw(t,e){Q(t,e)}};function X(t,e){if(!t||!("widthMode"in t))return t;const n={...t},o=n.widthMode;return o&&(n.widthMode={...o,currentValue:e.mode,inherited:e.inherited}),n}const Z=new Set(["Heading","Text","ImageBlock","ButtonBlock"]),Ct={name:"containedWidth",applies:(t,e,n)=>Z.has(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const o=n.widthField;t.fields=R(e,t,{...t.fields,...o("page")});const i=t.resolveFields;t.resolveFields=(s,r)=>{const c=i?i(s,r):r.fields,a=C(s?.props??{},"page"),d=l=>X(l,a);return c&&typeof c.then=="function"?c.then(d):d(c)}},draw(t){const e=t.render;t.render=n=>{const{mode:o}=C(n,"page");return e({...n,contained:o!=="full"})}}},tt={not:{context:"inHeroGroupRow",is:!0}},Tt={name:"buttonAlignInRow",applies:t=>t==="ButtonBlock",panel(t){const e=t;e.fields=h(e.fields??{},["align"],tt),p(e,{inHeroGroupRow:(n,o)=>{const i=j(o.appState,n.props?.id);return!!i&&i.type==="HeroGroup"&&S("HeroGroup",i.props?.direction)==="row"}})}};function et(t){return Object.values(t).some(e=>!!e&&typeof e=="object"&&e.type==="slot")}const nt={any:[]},ot={all:[{not:{context:"outsideBox",is:!0}},{not:{context:"insideSiteGutter",is:!0}}]},it={not:{context:"widthCappedByParent",is:!0}};function R(t,e,n,o=["widthMode"]){if(t==="ButtonBlock")return h(n,["_gWidth",...o],nt);if(et(n)){const i=(s,r)=>F(r.appState?.data?.content,s.props?.id,H(P()));return p(e,{outsideBox:(s,r)=>i(s,r)?.inBox!==!0,insideSiteGutter:(s,r)=>i(s,r)?.insideGutter}),h(n,o,ot)}return p(e,{widthCappedByParent:(i,s)=>"parent"in s?V(s.parent):L({props:i.props??{}},s)}),h(n,o,it)}export{K as SECTION_BACKGROUND_VAR,q as SECTION_CONTENT_CAP_CLASS,$ as SECTION_CONTENT_CAP_VAR,Y as SECTION_CONTENT_CLASS,U as SECTION_CONTENT_VAR,N as SITE_CONTENT_VAR,Tt as buttonAlignInRow,Ct as containedWidth,wt as sectionWidth,X as widthModeFields};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "49.
|
|
3
|
+
"version": "49.1.0",
|
|
4
4
|
"description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|