efficient-web-builder 34.0.0 → 35.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/dist/editor/components/CanvasPartsBridge.d.ts +4 -0
- package/dist/editor/components/CanvasPartsBridge.js +1 -0
- package/dist/editor/components/MediaUploadField.d.ts +2 -1
- package/dist/editor/components/MediaUploadField.js +1 -1
- package/dist/editor/components/PartSettingsPanel.js +1 -1
- package/dist/editor/components/PreviewPartAnchors.js +1 -1
- package/dist/editor/components/SectionTextPartBridge.js +1 -1
- package/dist/editor/components/StandaloneSectionEditor.js +1 -1
- package/dist/editor/components/StorefrontEditor.js +1 -1
- package/dist/editor/lib/puck/blocks/general/Cards/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/general/Timeline/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/general/index.d.ts +2 -2
- package/dist/editor/lib/puck/controls.d.ts +2 -1
- package/dist/editor/lib/puck/part-anchors.d.ts +4 -2
- package/dist/editor/lib/puck/part-anchors.js +1 -1
- package/dist/editor/lib/site-text-styles.d.ts +3 -2
- package/dist/editor/lib/site-text-styles.js +2 -2
- package/dist/format/lib/editor-words-catalogue.d.ts +3 -0
- package/dist/format/lib/editor-words-catalogue.js +2 -2
- package/dist/format/lib/media-value.d.ts +9 -0
- package/dist/format/lib/media-value.js +1 -0
- package/dist/format/lib/puck/passes/media-values.d.ts +3 -0
- package/dist/format/lib/puck/passes/media-values.js +1 -0
- package/dist/format/lib/puck/section-catalog.js +7 -1
- package/dist/format/lib/puck/templateFields.js +1 -1
- package/dist/format/lib/text-style-face.d.ts +3 -0
- package/dist/format/lib/text-style-face.js +1 -0
- package/dist/render/components/Heading.d.ts +7 -1
- package/dist/render/components/Heading.js +1 -1
- package/dist/render/components/PartStyledKind.js +1 -1
- package/dist/render/components/PartStyledText.js +1 -1
- package/dist/render/components/PublishedPartStylesContext.js +1 -1
- package/dist/render/components/Text.d.ts +2 -1
- package/dist/render/components/Text.js +1 -1
- package/dist/render/lib/puck/blocks/general/Cards/render.d.ts +1 -0
- package/dist/render/lib/puck/blocks/general/Cards/render.js +1 -1
- package/dist/render/lib/puck/blocks/general/KeyFeatures/render.d.ts +2 -0
- package/dist/render/lib/puck/blocks/general/KeyFeatures/render.js +1 -1
- package/dist/render/lib/puck/blocks/general/Text/render.js +1 -1
- package/dist/render/lib/puck/blocks/general/Timeline/render.d.ts +2 -0
- package/dist/render/lib/puck/blocks/general/Timeline/render.js +2 -2
- package/dist/render/lib/puck/blocks/general/TimelineTrack/render.d.ts +2 -0
- package/dist/render/lib/puck/blocks/general/TimelineTrack/render.js +1 -1
- package/dist/render/lib/puck/part-styles.d.ts +13 -3
- package/dist/render/lib/puck/part-styles.js +2 -2
- package/dist/render/lib/puck/passes/index.js +1 -1
- package/dist/render/lib/puck/text-parts.d.ts +1 -0
- package/dist/render/lib/puck/text-parts.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as m}from"react/jsx-runtime";import u from"../../../../../components/KeyFeatures.js";import{parseSectionEyebrowLook as y}from"../../../../../../format/lib/sections/section-eyebrow-look.js";import{phRows as F,phHide as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import u from"../../../../../components/KeyFeatures.js";import{parseSectionEyebrowLook as y}from"../../../../../../format/lib/sections/section-eyebrow-look.js";import{phRows as F,phHide as r}from"../../scaffold.js";import{say as e}from"../../../../../../format/lib/editor-words.js";const l={eyebrow:"Highlight",title:"Key *features.*"},f=()=>[{label:e("Feature label one")},{label:e("Feature label two")},{label:e("Feature label three")},{label:e("Feature label four")},{label:e("Feature label five")},{label:e("Feature label six")}],K={label:"Key Features",defaultProps:{eyebrow:"",title:"",items:[],columns:3},render:({eyebrow:o,title:a,items:s,columns:i,eyebrowLook:b,puck:t})=>m(u,{look:y(b,"KeyFeatures"),eyebrow:r(o,l.eyebrow,t),title:r(a,l.title,t),items:F(s,f(),t),columns:i,editing:t?.isEditing})};export{l as KEY_FEATURES_PH,K as KeyFeaturesRender,f as keyFeaturesScaffoldItems};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as m,jsx as r}from"react/jsx-runtime";import{padValuesOf as
|
|
1
|
+
import{Fragment as m,jsx as r}from"react/jsx-runtime";import{padValuesOf as l}from"../../../../../../format/lib/content/section-padding.js";import x from"../../../../../components/Text.js";import{hidableText as f,readHidable as p}from"efficient-easel/draw";import{PH as g}from"../../../../../../format/lib/puck/blocks/placeholders.js";import{phPrev as u}from"../../scaffold.js";import{readPartStyle as c}from"../../../part-styles.js";const j={label:"Text",defaultProps:{text:"",align:"left",tone:"default",tag:"p",contained:!0},render:t=>{const{text:e,align:a,tone:o,tag:n,contained:i,puck:d}=t;return p(e).hidden?r(m,{}):r(x,{text:u(f(e),g.body,d)??"",align:a,tone:o,tag:n,textStyle:c(t,"text").textStyle,contained:i,pad:l(t)})}};export{j as TextRender};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TimelineLayout } from "../../../../../components/Timeline.js";
|
|
1
2
|
import type { BlockRender } from "../../../../../../format/lib/puck/blocks/block-types.js";
|
|
2
3
|
export declare const TIMELINE_PH: {
|
|
3
4
|
eyebrow: string;
|
|
@@ -7,4 +8,5 @@ export declare const TIMELINE_PH: {
|
|
|
7
8
|
imageMeta: string;
|
|
8
9
|
cta: string;
|
|
9
10
|
};
|
|
11
|
+
export type StoryTimelineDisplay = TimelineLayout | "track";
|
|
10
12
|
export declare const TimelineRender: BlockRender;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
*Highlight line*`,intro:n.body,imageCaption:n.imageCaption,imageMeta:n.imageMeta,cta:
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import d from"../../../../../components/Timeline.js";import l from"../../../../../components/TimelineTrack.js";import{resolveSectionBackground as u}from"../../../../../../format/lib/content/section-background.js";import{SECTION_BG_BUILT_IN as b}from"../../../../../../format/lib/puck/blocks/general/section-bg-built-in.js";import{TIMELINE_TRACK_PH as o,timelineTrackScaffoldEntries as f}from"../TimelineTrack/render.js";import{CTA_PH as g,PH as n}from"../../../../../../format/lib/puck/blocks/placeholders.js";import{phRows as c,phHide as i,ctaHide as r}from"../../scaffold.js";import{say as t}from"../../../../../../format/lib/editor-words.js";const a={eyebrow:n.eyebrow,title:`Section heading
|
|
2
|
+
*Highlight line*`,intro:n.body,imageCaption:n.imageCaption,imageMeta:n.imageMeta,cta:g.text},y=()=>[{date:t("Year"),title:t("Milestone title."),body:t("Describe what happened, in a sentence or two.")},{date:t("Year"),title:t("Milestone title."),body:t("Describe what happened, in a sentence or two.")},{date:t("Year"),title:t("Milestone title."),body:t("Describe what happened, in a sentence or two.")}];function T(e){return{date:e.date,title:e.title,blurb:e.body,future:e.future}}const x={label:"Story Timeline",defaultProps:{layout:"split",eyebrow:"",title:"",intro:"",imageSrc:"",imageCaption:"",imageMeta:"",ctaText:"",ctaHref:"",entries:[],padTop:120,padBottom:120},render:e=>e.layout==="track"?m(l,{eyebrow:i(e.eyebrow,o.eyebrow,e.puck),title:i(e.title,o.title,e.puck),intro:i(e.intro,o.intro,e.puck),entries:c(Array.isArray(e.entries)?e.entries.map(T):[],f(),e.puck),cta:r(e.ctaText,e.ctaHref,e.puck),background:u(e.background,b.TimelineTrack),padTop:typeof e.padTop=="number"?e.padTop:120,padBottom:typeof e.padBottom=="number"?e.padBottom:120,editing:e.puck?.isEditing}):m(d,{layout:e.layout||"split",eyebrow:i(e.eyebrow,a.eyebrow,e.puck),title:i(e.title,a.title,e.puck),intro:i(e.intro,a.intro,e.puck),imageSrc:e.imageSrc||void 0,imageCaption:i(e.imageCaption,a.imageCaption,e.puck),imageMeta:i(e.imageMeta,a.imageMeta,e.puck),cta:r(e.ctaText,e.ctaHref,e.puck),entries:c(e.entries,y(),e.puck),padTop:typeof e.padTop=="number"?e.padTop:120,padBottom:typeof e.padBottom=="number"?e.padBottom:120,editing:e.puck?.isEditing})};export{a as TIMELINE_PH,x as TimelineRender};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TimelineTrackEntry } from "../../../../../components/TimelineTrack.js";
|
|
1
2
|
import type { BlockRender } from "../../../../../../format/lib/puck/blocks/block-types.js";
|
|
2
3
|
export declare const TIMELINE_TRACK_PH: {
|
|
3
4
|
eyebrow: string;
|
|
@@ -5,4 +6,5 @@ export declare const TIMELINE_TRACK_PH: {
|
|
|
5
6
|
intro: string;
|
|
6
7
|
cta: string;
|
|
7
8
|
};
|
|
9
|
+
export declare const timelineTrackScaffoldEntries: () => TimelineTrackEntry[];
|
|
8
10
|
export declare const TimelineTrackRender: BlockRender;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as m}from"react/jsx-runtime";import c from"../../../../../components/TimelineTrack.js";import{SECTION_BG_INHERIT as d,resolveSectionBackground as u}from"../../../../../../format/lib/content/section-background.js";import{parseSectionHeadPlacement as b}from"../../../../../../format/lib/sections/section-head-placement.js";import{CTA_PH as f,PH as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import c from"../../../../../components/TimelineTrack.js";import{SECTION_BG_INHERIT as d,resolveSectionBackground as u}from"../../../../../../format/lib/content/section-background.js";import{parseSectionHeadPlacement as b}from"../../../../../../format/lib/sections/section-head-placement.js";import{CTA_PH as f,PH as r}from"../../../../../../format/lib/puck/blocks/placeholders.js";import{phRows as T,phHide as n,ctaHide as s}from"../../scaffold.js";import{SECTION_BG_BUILT_IN as k}from"../../../../../../format/lib/puck/blocks/general/section-bg-built-in.js";import{say as t}from"../../../../../../format/lib/editor-words.js";const a={eyebrow:r.eyebrow,title:r.headingAccent,intro:r.body,cta:f.text},h=()=>[{date:t("Year"),title:t("Milestone"),blurb:t("A short line about this milestone."),future:!1},{date:t("Year"),title:t("Milestone"),blurb:t("A short line about this milestone."),future:!1},{date:t("Year"),title:t("Milestone"),blurb:t("A short line about this milestone."),future:!1},{date:t("Year →"),title:t("Upcoming"),blurb:t("A milestone still to come."),future:!0}],A={label:"Milestone Timeline",defaultProps:{eyebrow:"",title:"",intro:"",entries:[],ctaText:"",ctaHref:"",background:d,padTop:120,padBottom:120},render:e=>{const o=b(e.headPlacement)==="own-box",i=l=>o?void 0:l;return m(c,{eyebrow:i(n(e.eyebrow,a.eyebrow,e.puck)),title:i(n(e.title,a.title,e.puck)),intro:i(n(e.intro,a.intro,e.puck)),omitHead:o,entries:T(e.entries,h(),e.puck),cta:s(e.ctaText,e.ctaHref,e.puck),background:u(e.background,k.TimelineTrack),padTop:o?0:typeof e.padTop=="number"?e.padTop:120,padBottom:typeof e.padBottom=="number"?e.padBottom:120,editing:e.puck?.isEditing})}};export{a as TIMELINE_TRACK_PH,A as TimelineTrackRender,h as timelineTrackScaffoldEntries};
|
|
@@ -4,6 +4,10 @@ import type { PartEl } from "../../../editor/lib/puck/part-anchors.js";
|
|
|
4
4
|
import { type PartNeedle } from "./text-parts.js";
|
|
5
5
|
export declare const PART_STYLES_PROP = "_partStyles";
|
|
6
6
|
export declare const PART_STYLED_ATTR = "data-sf-part-styled";
|
|
7
|
+
export declare const TEXT_STYLE_ATTR = "data-sf-text-style";
|
|
8
|
+
export declare function isTextStyleId(value: unknown): value is string;
|
|
9
|
+
export declare const STYLE_ID_OF_ROLE: Readonly<Partial<Record<FontRole, string>>>;
|
|
10
|
+
export declare function followedStyleOf(style: PartStyle): string | undefined;
|
|
7
11
|
export declare const PART_WEIGHTS: readonly [400, 500, 600, 700];
|
|
8
12
|
export type PartWeight = (typeof PART_WEIGHTS)[number];
|
|
9
13
|
export declare const PART_ALIGNS: readonly ["left", "center", "right", "justify"];
|
|
@@ -54,6 +58,7 @@ export declare const PART_PARAGRAPH_MAX = 400;
|
|
|
54
58
|
export type PartStyle = {
|
|
55
59
|
font?: string;
|
|
56
60
|
role?: FontRole;
|
|
61
|
+
textStyle?: string;
|
|
57
62
|
weight?: PartWeight;
|
|
58
63
|
size?: number;
|
|
59
64
|
line?: number;
|
|
@@ -96,6 +101,10 @@ export declare function propsWithPartStyleValue<K extends keyof PartStyle>(props
|
|
|
96
101
|
export declare function propsWithoutPartStyle(props: Record<string, unknown>, partKey: string): Record<string, unknown>;
|
|
97
102
|
export declare function partCaseOfTransform(transform: string | null | undefined): TextStyleCase;
|
|
98
103
|
export declare function partCaseTransform(value: TextStyleCase | undefined): string;
|
|
104
|
+
export type PartDeclarationOptions = {
|
|
105
|
+
blockDrawsStyle?: boolean;
|
|
106
|
+
};
|
|
107
|
+
export declare function blockDrawsTextStyle(type: string | undefined, partKey: string): boolean;
|
|
99
108
|
export declare function partSpacingOf(style: PartStyle): {
|
|
100
109
|
lineHeight?: number;
|
|
101
110
|
letterSpacingEm?: number;
|
|
@@ -104,7 +113,7 @@ export declare const PART_PARAGRAPH_VAR = "--sf-part-para";
|
|
|
104
113
|
export declare const PART_PHONE_MAX_CSS = "(max-width: 719.98px)";
|
|
105
114
|
export declare function partPhoneDeclarations(style: PartStyle): Record<string, string>;
|
|
106
115
|
export declare function partStyleForScreen(style: PartStyle, phone: boolean): PartStyle;
|
|
107
|
-
export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase): Record<string, string>;
|
|
116
|
+
export declare function partStyleDeclarations(style: PartStyle, base: PartStyleBase, options?: PartDeclarationOptions): Record<string, string>;
|
|
108
117
|
export declare function isHexColour(value: string): boolean;
|
|
109
118
|
export type MeasuredPartStyle = {
|
|
110
119
|
fontSize: string;
|
|
@@ -121,12 +130,13 @@ export declare function partFontKeyOf(family: string, resolve: (cssVar: string)
|
|
|
121
130
|
export declare function partStyleSource<E extends {
|
|
122
131
|
getAttribute(name: string): string | null;
|
|
123
132
|
}>(nodeId: string, selectedPartId: string | null, selectedElements: readonly E[], declaresStyle: (className: string | null) => boolean): E | null;
|
|
124
|
-
export declare function applyPartStyles(stamps: readonly StyledPartStamp[], styles: PartStyles, baseOf?: (element: StyledPartEl) => PartStyleBase, styleKeyOf?: (partKey: string) => string, isInline?: (element: StyledPartEl) => boolean, phone?: boolean): number;
|
|
133
|
+
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;
|
|
125
134
|
export declare const PART_PARAGRAPH_ATTR = "data-sf-part-para";
|
|
126
135
|
export declare const PART_STYLE_PROPERTIES: readonly string[];
|
|
127
136
|
export declare const SHARED_PART_PROPERTIES: readonly string[];
|
|
128
137
|
export type PublishedPartRule = {
|
|
129
138
|
stamp: string;
|
|
139
|
+
textStyle?: string;
|
|
130
140
|
declarations: Record<string, string>;
|
|
131
141
|
phone?: Record<string, string>;
|
|
132
142
|
};
|
|
@@ -135,7 +145,7 @@ export type PublishedPartSheet = {
|
|
|
135
145
|
kindRules: ReadonlyMap<string, PublishedPartRule>;
|
|
136
146
|
drawn: ReadonlySet<string>;
|
|
137
147
|
};
|
|
138
|
-
export declare function publishedPartStyles(needles: readonly PartNeedle[], styles: PartStyles, scope: string, styleKeyOf?: (partKey: string) => string): PublishedPartSheet | null;
|
|
148
|
+
export declare function publishedPartStyles(needles: readonly PartNeedle[], styles: PartStyles, scope: string, styleKeyOf?: (partKey: string) => string, drawsStyle?: (partKey: string) => boolean): PublishedPartSheet | null;
|
|
139
149
|
export declare function isPartKindKey(key: string): boolean;
|
|
140
150
|
export declare function partRuleForKind(sheet: PublishedPartSheet | null, kind: string): PublishedPartRule | null;
|
|
141
151
|
export declare function partStyleCss(sheet: PublishedPartSheet): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{textStyleCaseCss as
|
|
2
|
-
`)}function
|
|
1
|
+
import{textStyleCaseCss as q,textStyleCaseOfCss as J}from"efficient-easel/draw";import{FONT_OPTIONS as Q,FONT_ROLES as O,fontOption as v,SIZE_STEP_OF_ROLE as tt}from"../../../format/lib/fonts.js";import{encodePartKey as et}from"../../../format/lib/puck/part-key.js";import{decodePartId as H,normalizePartText as N}from"./text-parts.js";import{COLOUR_TOKEN as F}from"../../../format/lib/word-styles.js";const w="_partStyles",nt="data-sf-part-styled",L="data-sf-text-style",rt=/^(heading|body)-[1-7]$/;function g(t){return typeof t=="string"&&rt.test(t)}const z={heading:"heading-1",heading2:"heading-2",heading3:"heading-3",body:"body-1",label:"body-5"};function ot(t){if(!t)return null;for(const[e,n]of Object.entries(z))if(n===t)return e;return null}function ne(t){if(g(t.textStyle))return t.textStyle;const e=t.role&&O.includes(t.role)?t.role:null;return e?z[e]:void 0}const it=[400,500,600,700],k=["left","center","right","justify"],j=5,D=1e3,st=-5,at=10,ct=0,lt=64,ft=2,ut=120,E=1280,pt=10,C={size:{min:j,max:D,step:1},sizePhone:{min:j,max:D,step:1},padding:{min:ct,max:lt,step:ft},width:{min:ut,max:E,step:pt}},dt=.05,xt=.01,ht=["line","letter"],St=.5,gt=2.5,mt=-1,Pt=1,Tt=0,_t=400;function T(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function W(t){return T(t?.[w])??{}}function K(t,e){const n=W(t);return Object.hasOwn(n,e)?T(n[e])??{}:{}}function re(t,e){return Object.values(K(t,e)).filter(n=>n!==void 0).length}function G(t,e,n){const r={...W(t)};if(At(n).length?r[e]=n:delete r[e],!Object.keys(r).length){const{[w]:o,...i}=t;return i}return{...t,[w]:r}}function At(t){return Object.entries(t).filter(([,e])=>e!==void 0)}function bt(t){return ht.includes(t)}const _=(t,e,n)=>Math.min(n,Math.max(e,t));function Rt(t,e){if(bt(t)){const n=Math.round(Number(e));return!Number.isFinite(n)||n===0?null:_(n,st,at)}if(t==="lineHeight"){const n=Number(e);return Number.isFinite(n)?m(_(n,St,gt),3):null}if(t==="letterSpacing"){const n=Number(e);return Number.isFinite(n)?m(_(n,mt,Pt),4):null}if(t==="paragraphSpacing"){const n=Math.round(Number(e));return!Number.isFinite(n)||n<=0?null:_(n,Tt,_t)}if(Object.hasOwn(C,t)){const{min:n,max:r}=C[t],o=Math.round(Number(e));return Number.isFinite(o)?_(o,n,r):null}return t==="italic"?typeof e=="boolean"?e:null:t==="role"?O.includes(String(e))?e:null:t==="textStyle"?g(e)?e:null:e}const Et=["weight","size","sizePhone","line","letter","lineHeight","letterSpacing","paragraphSpacing","padding","width"];function X(t){let e=null;const n=r=>{e??={...t},delete e[r]};for(const r of Et){const o=t[r];o!==void 0&&!(typeof o=="number"&&Number.isFinite(o))&&n(r)}return t.align!==void 0&&!k.includes(t.align)&&n("align"),t.textStyle!==void 0&&!g(t.textStyle)&&n("textStyle"),e??t}const yt=[["font","role"],["role","textStyle"],["line","lineHeight"],["letter","letterSpacing"]];function Ot(t){const e=[];for(const[n,r]of yt)n===t?e.push(r):r===t&&e.push(n);return e}function oe(t,e,n,r){const o={...K(t,e)},i=r==null?null:Rt(n,r);if(i===null)delete o[n];else{o[n]=i;for(const s of Ot(n))delete o[s]}return G(t,e,o)}function ie(t,e){return G(t,e,{})}function Nt(t){return J(t)??"none"}function wt(t){return q(t)??""}const It={heading:"--font-role-heading",heading2:"--font-role-heading2",heading3:"--font-role-heading3",body:"--font-role-body",accent:"--font-role-accent",label:"--font-role-label"};function $t(t,e){const n=t.role;return n&&O.includes(n)?n:e?.blockDrawsStyle?null:ot(t.textStyle)}function se(t,e){return t==="Text"&&e==="text"}const Mt={headingLarge:"min(clamp(64px,9vw,144px), var(--sf-heading-max,9999px))",headingMedium:"min(32px, var(--sf-heading-max,9999px))",headingSmall:"min(24px, var(--sf-heading-max,9999px))",accent:"32px",body:"14px",label:"12px"};function Ht(t){const e=tt[t],n=Mt[e];return n?`var(--size-${e}, ${n})`:`var(--size-${e})`}function Ft(t){const e={};return typeof t.lineHeight=="number"?e.lineHeight=t.lineHeight:t.line&&(e.lineHeight=m(Lt+t.line*dt,3)),typeof t.letterSpacing=="number"?e.letterSpacingEm=t.letterSpacing:t.letter&&(e.letterSpacingEm=m(t.letter*xt,4)),e}const Lt=1,A="--sf-part-para",zt="(max-width: 719.98px)";function U(t){return t=X(t),typeof t.sizePhone=="number"&&t.sizePhone>0?{fontSize:`${t.sizePhone}px`}:{}}function kt(t,e){return e&&typeof t.sizePhone=="number"&&t.sizePhone>0?{...t,size:t.sizePhone}:t}function y(t,e,n){t=X(t);const r=$t(t,n),o=Ft(t),i=t.size?`${t.size}px`:r?Ht(r):"";return{fontFamily:t.font?Wt(t.font):r?`var(${It[r]})`:"",fontWeight:t.weight?String(t.weight):"",fontSize:i,minWidth:i?"0":"",overflowWrap:i?"break-word":"",lineHeight:o.lineHeight!==void 0?String(o.lineHeight):"",letterSpacing:o.letterSpacingEm!==void 0?`${o.letterSpacingEm}em`:"",[A]:t.paragraphSpacing?`${t.paragraphSpacing}px`:"",textTransform:wt(t.case),textAlign:t.align??"",paddingTop:I(t.padding),paddingBottom:I(t.padding),maxWidth:I(t.width),color:jt(t.color),fontStyle:t.italic===!0?"italic":t.italic===!1?"normal":""}}const jt=t=>t===void 0||t===""?"":Object.hasOwn(F,t)?F[t]:B.test(t)?t:"",B=/^#[0-9a-fA-F]{6}$/;function ae(t){return B.test(t)}const I=t=>t===void 0?"":`${t}px`,m=(t,e)=>Number(t.toFixed(e));function ce(t,e){const n=Number.parseFloat(t.fontSize)||16,r=Number.parseFloat(t.lineHeight),o=Number.parseFloat(t.letterSpacing),i=Number.parseFloat(t.paddingTop),s=Number.parseFloat(t.maxWidth);return{fontKey:e,sizePx:n,weight:Dt(Number.parseInt(t.fontWeight,10)),lineRatio:Number.isFinite(r)?m(r/n,3):1.2,letterEm:Number.isFinite(o)?m(o/n,4):0,align:Ct(t.textAlign),case:Nt(t.textTransform),paddingPx:Number.isFinite(i)?Math.round(i):0,widthPx:Number.isFinite(s)&&s<E?Math.round(s):E}}function Dt(t){return Number.isFinite(t)?it.reduce((e,n)=>Math.abs(n-t)<Math.abs(e-t)?n:e):400}function Ct(t){for(const e of k)if(e===t)return e;return t==="end"?"right":"left"}function le(t,e){const n=V(t);if(!n)return"";for(const r of Q)if(V(e(r.cssVar))===n)return r.key;return""}const V=t=>(t.split(",")[0]??"").replace(/["']/g,"").replace(/\s+/g," ").trim().toLowerCase();function Wt(t){const e=v(t);return e?`var(${e.cssVar})`:""}function fe(t,e,n,r){return!e||H(e)?.nodeId!==t?null:n.find(i=>r(i.getAttribute("class")))??n[0]??null}function ue(t,e,n=()=>b,r=d=>d,o=Xt,i=!1,s=()=>!1){let d=0;for(const{element:a,partId:c}of t){const u=H(c)?.propKey;if(!u)continue;const l=r(u),p=Object.hasOwn(e,l)?T(e[l])??{}:{},f=y(kt(p,i),b,{blockDrawsStyle:s(u)});g(p.textStyle)?a.setAttribute?.(L,p.textStyle):a.removeAttribute?.(L);const S=M.some(h=>a.style[h]);let x=!1;for(const[h,P]of Object.entries(f))Ut(a,h,P),P&&(x=!0);if(S||M.some(h=>f[h]))for(const h of Kt(a,o))for(const P of M)h.style[P]=f[P]??"";x&&(d+=1)}return d}function Kt(t,e){const n=N(t.textContent??""),r=[];let o=t;for(let i=0;i<Gt&&e(o);i+=1){const s=o.parentElement;if(!s||N(s.textContent??"")!==n)break;r.push(s),o=s}return r}const Gt=8;function Xt(t){const e=t;return typeof window>"u"||!e?.ownerDocument?!1:window.getComputedStyle(e).display==="inline"}const b={fontKey:"",sizePx:16,weight:400,lineRatio:1,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:E};function Ut(t,e,n){if(!e.startsWith("--")){t.style[e]=n;return}const r=t.style;typeof r.setProperty=="function"?n?r.setProperty(e,n):r.removeProperty?.(e):r[e]=n;const o=t;e===A&&(n?o.setAttribute?.(Y,""):o.removeAttribute?.(Y))}const Y="data-sf-part-para",Bt=Object.keys(y({},b)),$=new Set(["color","overflowWrap",A,"fontStyle"]),M=Bt.filter(t=>!$.has(t));function pe(t,e,n,r=i=>i,o=()=>!1){const i=new Map;for(const a of t){const c=et(a.key,a.row);for(const u of a.texts){const l=i.get(u);l?(l.keys.add(a.key),l.partKeys.add(c)):i.set(u,{keys:new Set([a.key]),partKeys:new Set([c])})}}const s=new Map;for(const a of Object.keys(e)){if(!Vt(a))continue;const c=T(e[a])??{},u=y(c,b),l=U(c),p=g(c.textStyle)?c.textStyle:void 0;!Object.values(u).some(Boolean)&&!Object.keys(l).length&&!p||s.set(a,{stamp:Z(n,a),declarations:u,...Object.keys(l).length?{phone:l}:{},...p?{textStyle:p}:{}})}const d=new Map;for(const[a,{keys:c,partKeys:u}]of i){const l=u.size===1?[...u][0]:c.size===1?[...c][0]:null;if(!l)continue;const p=r(l);if(!Object.hasOwn(e,p))continue;const f=T(e[p])??{},S=y(f,b,{blockDrawsStyle:o(l)}),x=U(f),R=g(f.textStyle)?f.textStyle:void 0;!Object.values(S).some(Boolean)&&!Object.keys(x).length&&!R||d.set(a,{stamp:Z(n,l),declarations:S,...Object.keys(x).length?{phone:x}:{},...R?{textStyle:R}:{}})}return d.size||s.size?{rules:d,kindRules:s,drawn:new Set(i.keys())}:null}function Vt(t){return t.startsWith("@")}function de(t,e){return t?.kindRules.get(e)??null}function Z(t,e){const n=r=>r.replace(/[^A-Za-z0-9_-]+/g,"-");return`${n(t)}~${n(e)}`}function xe(t){const e=[],n=new Set,r=o=>{const{stamp:i,declarations:s}=o;if(n.has(i))return;n.add(i);const d=Object.entries(s).filter(([,f])=>f!==""),a=f=>f.map(([S,x])=>`${Zt(S)}: ${x}`).join("; "),c=`[${nt}="${i}"]`,u=d.filter(([f])=>!$.has(f)),l=d.filter(([f])=>$.has(f));u.length&&e.push(`${c}, *:has(> ${c}) { ${a(u)} }`),l.length&&e.push(`${c} { ${a(l)} }`),s[A]&&e.push(...Yt(c));const p=Object.entries(o.phone??{}).filter(([,f])=>f!=="");p.length&&e.push(`@media ${zt} { ${c}, *:has(> ${c}) { ${a(p)} } }`)};for(const o of t.rules.values())r(o);for(const o of t.kindRules.values())r(o);return e.join(`
|
|
2
|
+
`)}function Yt(t){const e=`var(${A})`,n=":is([data-sf-bullet], [data-sf-number])";return[`${t} br:not(br + br) { display: block; content: ""; margin-top: ${e} }`,`${t} ${n}:not(:first-child) { margin-top: ${e} }`,`${t} ${n}:not(:last-child) { margin-bottom: ${e} }`]}const Zt=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function he(t,e){if(!t)return null;const n=N(e),r=t.rules.get(n);if(r)return r;if(n.length<qt||t.drawn.has(n))return null;let o=null;for(const[i,s]of t.rules)if(i.includes(n)){if(o&&o.stamp!==s.stamp)return null;o=s}return o}const qt=8;export{k as PART_ALIGNS,Pt as PART_LETTER_EM_MAX,mt as PART_LETTER_EM_MIN,xt as PART_LETTER_STEP,gt as PART_LINE_HEIGHT_MAX,St as PART_LINE_HEIGHT_MIN,dt as PART_LINE_STEP,C as PART_MEASURED_TRACKS,at as PART_NUDGE_MAX,st as PART_NUDGE_MIN,lt as PART_PADDING_MAX,ct as PART_PADDING_MIN,ft as PART_PADDING_STEP,Y as PART_PARAGRAPH_ATTR,_t as PART_PARAGRAPH_MAX,Tt as PART_PARAGRAPH_MIN,A as PART_PARAGRAPH_VAR,zt as PART_PHONE_MAX_CSS,ht as PART_RELATIVE_PROPS,D as PART_SIZE_MAX,j as PART_SIZE_MIN,nt as PART_STYLED_ATTR,w as PART_STYLES_PROP,Bt as PART_STYLE_PROPERTIES,it as PART_WEIGHTS,E as PART_WIDTH_MAX,ut as PART_WIDTH_MIN,pt as PART_WIDTH_STEP,M as SHARED_PART_PROPERTIES,z as STYLE_ID_OF_ROLE,L as TEXT_STYLE_ATTR,ue as applyPartStyles,se as blockDrawsTextStyle,ne as followedStyleOf,ae as isHexColour,Vt as isPartKindKey,g as isTextStyleId,Yt as paragraphRules,Nt as partCaseOfTransform,wt as partCaseTransform,le as partFontKeyOf,U as partPhoneDeclarations,de as partRuleForKind,he as partRuleForText,Ft as partSpacingOf,ce as partStyleBase,re as partStyleCount,xe as partStyleCss,y as partStyleDeclarations,kt as partStyleForScreen,fe as partStyleSource,oe as propsWithPartStyleValue,ie as propsWithoutPartStyle,pe as publishedPartStyles,K as readPartStyle,W as readPartStyles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{catalogueLabel as m}from"../../../../format/lib/puck/passes/catalogue-labels.js";import{cellWidth as n}from"./cell-width.js";import{clickableParts as s}from"./clickable-parts.js";import{cardCorners as p,sectionCorners as c}from"./corners.js";import{emptyHeadings as f}from"../../../../format/lib/puck/passes/empty-headings.js";import{showWhenRows as a}from"../../../../format/lib/puck/passes/show-when-rows.js";import{hiddenNodes as d}from"../../../../format/lib/puck/passes/hidden-nodes.js";import{
|
|
1
|
+
import{catalogueLabel as m}from"../../../../format/lib/puck/passes/catalogue-labels.js";import{cellWidth as n}from"./cell-width.js";import{clickableParts as s}from"./clickable-parts.js";import{cardCorners as p,sectionCorners as c}from"./corners.js";import{emptyHeadings as f}from"../../../../format/lib/puck/passes/empty-headings.js";import{showWhenRows as a}from"../../../../format/lib/puck/passes/show-when-rows.js";import{hiddenNodes as d}from"../../../../format/lib/puck/passes/hidden-nodes.js";import{mediaValues as l}from"../../../../format/lib/puck/passes/media-values.js";import{sectionAnchor as h}from"./section-anchor.js";import{sectionAnimation as u}from"./section-animation.js";import{sectionHeight as g}from"./section-height.js";import{cardSticky as w,sectionSticky as P}from"./section-sticky.js";import{sectionBorder as S}from"./borders.js";import{blockPadding as A,sectionPadding as W}from"./section-padding.js";import{sectionTheme as b,slideTheme as C}from"./section-theme.js";import{buttonAlignInRow as k,containedWidth as y,imageWidth as B,sectionWidth as G}from"./section-width.js";import{blockGroups as H,sectionGroups as L}from"../../../../format/lib/puck/passes/settings-groups.js";import{openSlotDisallow as R,sectionGroupAllow as T}from"../../../../format/lib/puck/passes/slot-rules.js";import{registryPassContext as oo}from"../../../../format/lib/puck/passes/registry-context.js";const D=[l,T,R,W,c,S,p,A,n,G,y,k,B,g,h,b,u,P,w,C,L,H,a,f,s,d,m];function Y(r,e,o){const i=e;for(const t of D)t.applies(r,o,i)&&(o.inspector&&t.panel?.(i,r,o.inspector,o),t.draw?.(i,r,o));return e}export{D as BLOCK_PASSES,Y as applyBlockPasses,oo as registryPassContext};
|
|
@@ -2,6 +2,7 @@ import { decodePartId, encodePartId } from "efficient-easel/draw";
|
|
|
2
2
|
import { type TextFieldMeta } from "efficient-easel/draw";
|
|
3
3
|
import { type PartRow } from "./part-rows.js";
|
|
4
4
|
export declare const PART_ATTR = "data-sf-part";
|
|
5
|
+
export declare const REGION_PART_ATTR = "data-sf-region-part";
|
|
5
6
|
export declare const PART_SELECTED_ATTR = "data-sf-part-selected";
|
|
6
7
|
export declare const PART_KIND_ATTR = "data-sf-part-kind";
|
|
7
8
|
export declare const PART_STYLE_OWNER_ATTR = "data-sf-part-style-owner";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{decodePartId as m,encodePartId as g}from"efficient-easel/draw";import{stripMarkup as y}from"../../../format/lib/markup.js";import{LINK_FIELD_MARKER as A,SCAFFOLD_FIELD_MARKER as R,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as
|
|
1
|
+
import{decodePartId as m,encodePartId as g}from"efficient-easel/draw";import{stripMarkup as y}from"../../../format/lib/markup.js";import{LINK_FIELD_MARKER as A,SCAFFOLD_FIELD_MARKER as R,TEXT_FIELD_MARKER as u}from"efficient-easel/draw";import{readHidable as _}from"efficient-easel/draw";import{SCALAR_TEXT_CONTROLS as L}from"efficient-easel/draw";import{isStructuralTextProp as b}from"../../../format/lib/puck/neutralization-contracts.js";import{fieldInOwnBox as P}from"../../../format/lib/puck/own-box.js";import{partRowTexts as I}from"./part-rows.js";const B="data-sf-part",H="data-sf-region-part",G="data-sf-part-selected",W="data-sf-part-kind",S="data-sf-part-style-owner",j="data-sf-part-style-kind";function q(e){for(let t=e;t;t=t.parentElement){const r=t.getAttribute(S),n=t.getAttribute(j);if(r&&n)return{owner:r,kind:n};if(t.getAttribute("data-puck-component"))return null}return null}const h=2;function J(e,t){if(!e)return!1;const r=m(e);return!!r?.propKey&&r.nodeId===t}function E(e){return y(e).replace(/\s+/gu,"")}function l(e,t,r){const n=e[u];if(n){if(n.control==="textList"){const o=n.itemKey??"text";if(!Array.isArray(t))return;for(const i of t){const c=i?.[o];typeof c=="string"&&r.push(c)}return}const{text:s}=_(t);s?r.push(s):n.placeholder&&r.push(n.placeholder);return}if(!e[A]){if(e.type==="text"||e.type==="textarea"){typeof t=="string"&&t&&r.push(t);return}if(e.arrayFields&&Array.isArray(t)){for(const s of t)for(const[o,i]of Object.entries(e.arrayFields))l(i,s?.[o],r);return}if(e.objectFields&&t&&typeof t=="object")for(const[s,o]of Object.entries(e.objectFields))l(o,t[s],r)}}function Q(e){if(!e||typeof e!="object")return!1;const t=e;return t[A]?!1:!!t[u]||t.type==="text"||t.type==="textarea"}function O(e,t){const r=e[u];return r?.label?r.label:typeof e.label=="string"?e.label:t}function N(e){const t=e.indexOf(" (");return(t>0?e.slice(0,t):e).trim()}function U(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){if(!s||typeof s!="object"||b(n))continue;const o=s,i=[];l(o,t?.[n],i),!i.length&&o[R]!==void 0&&l(o,o[R],i);const c=O(o,n),a=new Set;for(const{row:T,text:f}of I(o,t?.[n])){const d=E(f);d.length<h||(a.add(d),r.push({key:n,label:c,texts:[d],row:T}))}const p=new Set(a),x=[];for(const T of i){const f=E(T);f.length<h||p.has(f)||(p.add(f),x.push(f))}x.length&&r.push({key:n,label:c,texts:x})}return r}const F=L;function w(e,t){if(!t||typeof t!="object"||b(e)||P(t))return null;const r=t[u];return!r||!F.includes(r.control)?null:r}function V(e,t){const r=w(e,t);return r!==null&&r.identifier!==!0}function Z(e,t){if(!e)return[];const r=[];for(const[n,s]of Object.entries(e)){const o=w(n,s);if(!o)continue;const{text:i,hidden:c}=_(t?.[n]),a=i||o.placeholder||"",p=y(a).replace(/\s+/gu," ").trim();r.push({key:n,label:N(O(s,n)),preview:p,offPage:o.offPage===!0,identifier:o.identifier===!0,hidden:!!c})}return r}export{B as PART_ATTR,W as PART_KIND_ATTR,G as PART_SELECTED_ATTR,j as PART_STYLE_KIND_ATTR,S as PART_STYLE_OWNER_ATTR,H as REGION_PART_ATTR,m as decodePartId,g as encodePartId,w as entryPartMetaOf,V as fieldDrawsEntryRow,Q as holdsAuthoredText,E as normalizePartText,N as partHeadLabel,O as partLabel,U as partNeedles,J as partOpenOn,q as partStyleOwnerOf,Z as sectionTextParts};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "35.0.0",
|
|
4
4
|
"description": "The EFFICIENT website builder: the website editor, the general sections and the renderer that draws them, compiled. Hostable by any EFFICIENT product; nothing here imports a host.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@tabler/icons-react": "^3.46.0",
|
|
56
|
-
"efficient-easel": "^
|
|
56
|
+
"efficient-easel": "^17.0.0",
|
|
57
57
|
"efficient-shell": "^8.18.0",
|
|
58
58
|
"isomorphic-dompurify": "^3.18.0",
|
|
59
59
|
"next": ">=16",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@types/node": "^20",
|
|
73
73
|
"@types/react": "^19",
|
|
74
74
|
"@types/react-dom": "^19",
|
|
75
|
-
"efficient-easel": "^
|
|
75
|
+
"efficient-easel": "^17.0.0",
|
|
76
76
|
"efficient-shell": "^8.18.0",
|
|
77
77
|
"esbuild": "^0.28.0",
|
|
78
78
|
"happy-dom": "^20.14.5",
|