efficient-web-builder 46.0.0 → 47.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 +54 -0
- package/README.md +6 -0
- package/dist/editor/components/PagesPanel.js +1 -1
- package/dist/editor/lib/animation/entrance-fields.js +1 -1
- package/dist/editor/lib/document/ColourControl.d.ts +4 -7
- package/dist/editor/lib/document/ColourControl.js +1 -1
- package/dist/editor/lib/document/blocks/general/ButtonBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Divider/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Flex/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/Grid/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroGroup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/general/HeroSingle/fields.js +1 -1
- package/dist/editor/lib/document/box-fields.d.ts +2 -1
- package/dist/editor/lib/document/box-fields.js +1 -1
- package/dist/editor/lib/document/consent-words-field.d.ts +1 -2
- package/dist/editor/lib/document/consent-words-field.js +1 -1
- package/dist/editor/lib/document/controls.d.ts +7 -60
- package/dist/editor/lib/document/controls.js +1 -1
- package/dist/editor/lib/document/passes/inspector.js +1 -1
- package/dist/format/lib/content/section-corners.d.ts +2 -4
- package/dist/format/lib/content/section-corners.js +1 -1
- package/dist/format/lib/document/box-footer.js +1 -1
- package/dist/format/lib/document/easel-row-words.d.ts +6 -0
- package/dist/format/lib/document/easel-row-words.js +1 -0
- package/dist/format/lib/document/passes/types.d.ts +2 -1
- package/dist/format/lib/editor-words-catalogue.d.ts +0 -5
- package/dist/format/lib/editor-words-catalogue.js +2 -2
- package/dist/format/lib/source-rules/one-alignment-row.js +2 -2
- package/dist/format/lib/theme.d.ts +1 -0
- package/dist/format/lib/theme.js +4 -4
- package/dist/render/components/ButtonBlock.d.ts +2 -0
- package/dist/render/components/ButtonBlock.js +1 -1
- package/dist/render/components/Flex.js +1 -1
- package/dist/render/components/Grid.d.ts +2 -1
- package/dist/render/components/Grid.js +1 -1
- package/dist/render/components/HeroGroup.d.ts +2 -1
- package/dist/render/components/HeroGroup.js +1 -1
- package/dist/render/components/InBoxContext.d.ts +23 -1
- package/dist/render/components/InBoxContext.js +1 -1
- package/dist/render/components/SectionAnimation.js +1 -1
- package/dist/render/lib/content/block-size.d.ts +19 -0
- package/dist/render/lib/content/block-size.js +1 -0
- package/dist/render/lib/content/button-look.d.ts +6 -6
- package/dist/render/lib/content/button-look.js +1 -1
- package/dist/render/lib/document/blocks/general/ButtonBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/general/Grid/render.js +1 -1
- package/dist/render/lib/document/blocks/general/HeroGroup/render.js +1 -1
- package/dist/render/lib/document/blocks/general/LocationMap/render.js +1 -1
- package/dist/render/lib/document/passes/block-size.js +1 -1
- package/dist/render/lib/document/passes/index.js +1 -1
- package/dist/render/lib/document/passes/section-height.js +1 -1
- package/dist/render/lib/document/passes/section-sticky.js +1 -1
- package/dist/render/lib/document/passes/section-theme.js +1 -1
- package/dist/render/lib/document/passes/slots-start-afresh.d.ts +2 -0
- package/dist/render/lib/document/passes/slots-start-afresh.js +1 -0
- package/dist/render/lib/media.d.ts +0 -1
- package/dist/render/lib/media.js +1 -1
- package/package.json +3 -3
- package/dist/editor/components/DuplicatePageDialog.d.ts +0 -10
- package/dist/editor/components/DuplicatePageDialog.js +0 -1
- package/dist/editor/lib/page-copy.d.ts +0 -6
- package/dist/editor/lib/page-copy.js +0 -1
- package/dist/format/lib/content/block-size.d.ts +0 -59
- package/dist/format/lib/content/block-size.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as m}from"react/jsx-runtime";import{containerDirectionClass as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{containerDirectionClass as G,resolveContainerDirection as H}from"../../format/lib/content/container-direction.js";import{containerGapProps as P}from"../../format/lib/content/container-gap.js";import{boxLayoutClasses as j,boxWrapClass as $}from"../../format/lib/content/box-layout.js";import{sectionPadAttrs as C}from"../lib/content/section-padding.js";import{clampNudge as p,clampWidth as k,normalisePlacement as v,placementParts as D,placementRow as W}from"../../format/lib/hero-group-placement.js";function w({placement:c,nudgeX:f,nudgeY:u,width:r,gap:g,gapPhone:d,direction:t,justify:y,align:h,wrap:x,pad:b={},content:n,dragRef:N}){const s=v(c),a=p(f),l=p(u),i=P("HeroGroup",g,H("HeroGroup",t)==="column"?"block":"inline",d),o={"--sf-hg-row":W(s),justifySelf:D(s).column};typeof r=="number"&&Number.isFinite(r)&&(o["--sf-hg-w"]=`${k(r)}%`),(a!==0||l!==0)&&(o["--sf-hg-nudge"]=`${a}px ${l}px`);const e=C(b);return m("div",{className:e?`sf-hero-group ${e.className}`:"sf-hero-group","data-hg":s,style:e?{...o,...e.style}:o,ref:N??void 0,children:n?m(n,{className:["sf-hero-group-blocks flex",G("HeroGroup",t),j(y,h),$(x)].filter(Boolean).join(" ")+i.className,style:i.style,minEmptyHeight:40}):null})}export{w as default};
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
export type BoxCell = {
|
|
3
|
+
stretchedRow: boolean;
|
|
4
|
+
fillingColumn: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const InBoxContext: import("react").Context<BoxCell | null>;
|
|
2
7
|
export declare const useInBox: () => boolean;
|
|
8
|
+
export declare const useBoxCell: () => BoxCell | null;
|
|
9
|
+
export declare const CellFillContext: import("react").Context<boolean>;
|
|
10
|
+
export declare function useCellOfStretchedRow(): boolean;
|
|
11
|
+
export declare const useFillsCell: () => boolean;
|
|
12
|
+
export declare function useCellLayer(): {
|
|
13
|
+
fill: string;
|
|
14
|
+
inner: (children: ReactNode) => ReactNode;
|
|
15
|
+
};
|
|
16
|
+
export declare function CellWrap({ className, style, attrs, children, }: {
|
|
17
|
+
className: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
attrs?: Record<string, string>;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
export declare function SlotsStartAfresh({ children }: {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createContext as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import{createContext as i,useContext as o}from"react";import{SECTION_FILL_CLASS as f}from"../../format/lib/content/section-min-height.js";const a={stretchedRow:!1,fillingColumn:!1},r=i(null),C=()=>o(r)!==null,w=()=>o(r),s=i(!1);function p(){const t=o(r)?.stretchedRow===!0,e=o(s);return t&&!e}const d=()=>o(s);function m(){const t=p(),e=d();return{fill:e?` ${f}`:"",inner:l=>t||e?n(s.Provider,{value:!0,children:l}):l}}function B({className:t,style:e,attrs:l,children:c}){const{fill:u,inner:x}=m();return n("div",{className:`${t}${u}`,...e?{style:e}:{},...l,children:x(c)})}function F({children:t}){const e=C();return n(r.Provider,{value:e?a:null,children:n(s.Provider,{value:!1,children:t})})}export{s as CellFillContext,B as CellWrap,r as InBoxContext,F as SlotsStartAfresh,w as useBoxCell,m as useCellLayer,p as useCellOfStretchedRow,d as useFillsCell,C as useInBox};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as N}from"react/jsx-runtime";import{useEffect as m,useRef as p,useState as S}from"react";import{armEntrance as x,entranceAttrs as g,playEntrance as A}from"efficient-shell/format";import{PHONE_MEDIA as O}from"../lib/content/view-values.js";import{useCellLayer as P}from"./InBoxContext.js";const v="sf-entrance";function C({desktop:e,phone:n,editing:s,children:o}){const t=p(null),r=P(),c=R(t),y=c?n:e,{attrs:h,style:u}=g(y),f=p(i.seed(e,n)),d=JSON.stringify(e),E=JSON.stringify(n);return m(()=>{const a=t.current;if(a){if(s){const l=i.next(f.current,e,n,c);f.current=l.seen,l.play&&A(a);return}return x(a)}},[d,E,c,s]),N("div",{ref:t,className:`${v}${r.fill}`,...h,...Object.keys(u).length?{style:u}:{},children:r.inner(o)})}const i={seed(e,n){return{desktop:JSON.stringify(e),phone:JSON.stringify(n)}},next(e,n,s,o){const t=i.seed(n,s);return{play:o?t.phone!==e.phone:t.desktop!==e.desktop,seen:t}}};function R(e){const[n,s]=S(!1);return m(()=>{const o=e.current?.ownerDocument?.defaultView;if(!o?.matchMedia)return;const t=o.matchMedia(O),r=()=>s(t.matches);return r(),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[e]),n}export{v as ENTRANCE_WRAPPER_CLASS,C as SectionAnimation,i as entranceReplay};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type BlockSizeKey } from "efficient-easel/draw";
|
|
2
|
+
export declare const BLOCK_SIZE_CLASS = "sf-block-size";
|
|
3
|
+
export declare const TEXT_FIT_ATTR: {
|
|
4
|
+
readonly fit: "data-fit";
|
|
5
|
+
readonly fitPhone: "data-fit-phone";
|
|
6
|
+
readonly min: "data-fit-min";
|
|
7
|
+
readonly minPhone: "data-fit-min-phone";
|
|
8
|
+
};
|
|
9
|
+
export type BlockSizeTwin = {
|
|
10
|
+
desktop?: unknown;
|
|
11
|
+
phone?: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type BlockSizeValues = Partial<Record<BlockSizeKey, BlockSizeTwin>>;
|
|
14
|
+
export type BlockSize = {
|
|
15
|
+
className: string;
|
|
16
|
+
style: Record<string, string>;
|
|
17
|
+
attrs: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
export declare function blockSizeOf(values: BlockSizeValues): BlockSize | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BLOCK_FIXED_WIDTH as S,parseBlockWidthFit as w,parseTextFit as b}from"efficient-easel/draw";const _="sf-block-size",p={fit:"data-fit",fitPhone:"data-fit-phone",min:"data-fit-min",minPhone:"data-fit-min-phone"},e=n=>typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,g={desktop:{fill:"min-[800px]:w-full min-[800px]:[.flex-row>&]:grow",fixed:"min-[800px]:w-[min(var(--sf-bw),100%)] min-[800px]:basis-auto! min-[800px]:grow-0! min-[800px]:shrink-0"},phone:{fill:"max-[800px]:w-full",fixed:"max-[800px]:w-[min(var(--sf-bw-p),100%)] max-[800px]:basis-auto! max-[800px]:grow-0! max-[800px]:shrink-0"}},u={desktop:"--sf-bw",phone:"--sf-bw-p"},P={minWidth:{desktop:["--sf-bmin","min-[800px]:min-w-[var(--sf-bmin)]"],phone:["--sf-bmin-p","max-[800px]:min-w-[var(--sf-bmin-p)]"]},maxWidth:{desktop:["--sf-bmax","min-[800px]:max-w-[var(--sf-bmax)]"],phone:["--sf-bmax-p","max-[800px]:max-w-[var(--sf-bmax-p)]"]}};function y(n){const s=[],f={},i={},d=w(n.widthFit?.desktop),l=w(n.widthFit?.phone)??d,x=e(n.width?.desktop),F=e(n.width?.phone)??x;for(const[o,t,m]of[["desktop",d,x],["phone",l,F]])!t||t==="fit"||(s.push(g[o][t]),t==="fixed"&&(f[u[o]]=`${m??S.fallback}px`));for(const o of["minWidth","maxWidth"]){const t=e(n[o]?.desktop),m=e(n[o]?.phone)??t;for(const[T,k]of[["desktop",t],["phone",m]]){if(k===void 0)continue;const[W,I]=P[o][T];f[W]=`${k}px`,s.push(I)}}const h=b(n.textFit?.desktop),c=b(n.textFit?.phone),a=e(n.minFont?.desktop),r=e(n.minFont?.phone);return h&&(i[p.fit]=h),c&&(i[p.fitPhone]=c),a!==void 0&&(i[p.min]=String(a)),r!==void 0&&(i[p.minPhone]=String(r)),s.length===0&&Object.keys(i).length===0?null:{className:[_,...s].join(" "),style:f,attrs:i}}export{_ as BLOCK_SIZE_CLASS,p as TEXT_FIT_ATTR,y as blockSizeOf};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly right: "buttonPaddingRight";
|
|
5
|
-
readonly bottom: "buttonPaddingBottom";
|
|
6
|
-
readonly left: "buttonPaddingLeft";
|
|
7
|
-
};
|
|
2
|
+
import { BUTTON_PAD_KEYS } from "efficient-easel/draw";
|
|
3
|
+
export { BUTTON_PAD_KEYS };
|
|
8
4
|
export declare const BUTTON_PAD_CLASSES = "px-6 py-4";
|
|
9
5
|
export declare const BUTTON_PAD_BUILT_IN: {
|
|
10
6
|
readonly top: number;
|
|
@@ -28,6 +24,10 @@ export declare function buttonLook(p: ButtonLookProps): {
|
|
|
28
24
|
changed: boolean;
|
|
29
25
|
};
|
|
30
26
|
export declare function buttonPaint(p: ButtonLookProps): CSSProperties | null;
|
|
27
|
+
export declare function buttonCornersStyle(p: {
|
|
28
|
+
buttonCorners?: unknown;
|
|
29
|
+
buttonCornerSides?: unknown;
|
|
30
|
+
}): CSSProperties | null;
|
|
31
31
|
export declare function buttonPadAttrs(p: Record<string, unknown>): {
|
|
32
32
|
className: string;
|
|
33
33
|
style: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{finiteNumber as
|
|
1
|
+
import{BUTTON_PAD_KEYS as i,buttonBorderOf as S,buttonFillOpacityOf as T,buttonPadSidesOf as h}from"efficient-easel/draw";import{finiteNumber as y}from"../../../format/lib/finite-number.js";import{nonEmptyString as c}from"../../../format/lib/non-empty-string.js";import{padSideAttrs as _}from"./section-padding.js";import{cornerSidesShorthand as x,normalizeCornerSides as O}from"../../../format/lib/content/section-corners.js";const N="px-6 py-4",$=4,s=o=>{const t=new RegExp(`\\bp${o}-(?:\\[(\\d+)px\\]|(\\d+))`).exec(N);if(!t)throw new Error(`BUTTON_PAD_CLASSES has no p${o}`);return t[1]!==void 0?Number(t[1]):Number(t[2])*$},U={top:s("y"),right:s("x"),bottom:s("y"),left:s("x")},a="var(--btn)";function g(o){const t=o.variant==="ghost",n=T(o.buttonFillOpacity),r=S(o.buttonBorder),e=c(o.buttonColor);return{fillOpacity:n??(t?0:100),border:{width:r?.width??1,color:r?.color??e??(t?"currentColor":a)},changed:n!==void 0||r!==void 0}}function L(o){const t=g(o);if(!t.changed)return null;const n=c(o.buttonColor)??a;return{background:t.fillOpacity===0?"transparent":t.fillOpacity===100?n:`color-mix(in srgb, ${n} ${t.fillOpacity}%, transparent)`,borderWidth:t.border.width,borderStyle:"solid",borderColor:t.border.color}}const C="var(--sf-button-radius, 0)";function D(o){const t=y(o.buttonCorners),n=O(o.buttonCornerSides);if(t===void 0&&n===null)return null;const r=t===void 0?C:`${Math.max(0,t)}px`;return{borderRadius:n===null?r:x(r,n)}}function k(o){const t=e=>h({top:o[`${i.top}${e}`],right:o[`${i.right}${e}`],bottom:o[`${i.bottom}${e}`],left:o[`${i.left}${e}`]})??{},{classes:n,style:r}=_(t(""),t("Phone"));return Object.keys(r).length?{className:n.join(" "),style:r}:null}const b="upper";function w(o,t,n){const r=o&&typeof o=="object"?o:{},e=c(r.textStyle),u=e?c(t?.find(f=>f?.id===e)?.name):void 0,d=e?/^(heading|body)-(\d+)$/.exec(e):null,p=e?u||(d?n.styleName({kind:d[1],n:Number(d[2])}):e):n.noStyle,{cases:l}=n,m=c(r.case)??b;return`${p} · ${l[m]??l[b]}`}export{U as BUTTON_PAD_BUILT_IN,N as BUTTON_PAD_CLASSES,i as BUTTON_PAD_KEYS,b as BUTTON_WORDS_BUILT_IN_CASE,a as SITE_BUTTON_FILL,D as buttonCornersStyle,g as buttonLook,k as buttonPadAttrs,L as buttonPaint,w as buttonWordsSummary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{CardRowDrawn as R}from"../../../../../components/CardRowContext.js";import g from"../../../../../components/ButtonBlock.js";import{CARD_ROW_LINK_PROP as p,namedRowField as i}from"../../../../../../format/lib/content/card-template.js";import{CTA_PH as O}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as _}from"../../scaffold.js";import{phoneKey as j}from"efficient-easel/draw";import{ButtonBlockMeta as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{CardRowDrawn as R}from"../../../../../components/CardRowContext.js";import g from"../../../../../components/ButtonBlock.js";import{CARD_ROW_LINK_PROP as p,namedRowField as i}from"../../../../../../format/lib/content/card-template.js";import{CTA_PH as O}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as _}from"../../scaffold.js";import{phoneKey as j}from"efficient-easel/draw";import{ButtonBlockMeta as v}from"../../../../../../format/lib/document/blocks/general/ButtonBlock/meta.js";const H={...v,render:o=>{const{label:e,href:l,variant:a,align:c,alignPhone:d,contained:m,arrow:u,icon:b,iconPosition:f,widthFit:h,buttonColor:s,buttonTextColor:w,editor:P}=o,B=Object.fromEntries(Object.entries(o).filter(([t])=>t==="buttonFillOpacity"||t==="buttonBorder"||t==="buttonCorners"||t==="buttonCornerSides"||t.startsWith("buttonPadding"))),n=(t,F)=>r(g,{label:_(t,O.text,P)??"",href:F,variant:a,align:c,alignPhone:d,contained:m,arrow:u,icon:b,iconPosition:f,widthFit:h,widthFitPhone:o[j("widthFit")],buttonColor:s,buttonTextColor:w,...B}),C=i(o),x=i(o,p);return!C&&!x?n(e,l):r(R,{type:"ButtonBlock",props:o,children:t=>n(t.label,t.href)})}};export{H as ButtonBlockRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{phoneKey as n}from"efficient-easel/draw";import{sectionFillsHeight as i}from"../../../../../../format/lib/content/section-min-height.js";import t from"../../../../../components/Grid.js";import{GridMeta as m}from"../../../../../../format/lib/document/blocks/general/Grid/meta.js";const f={...m,render:o=>e(t,{columns:o.columns,mobileColumns:o.mobileColumns,gap:o.gap,gapPhone:o[n("gap")],contained:o.contained,fillHeight:i(o),content:o.content})};export{f as GridRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as f}from"react/jsx-runtime";import c from"../../../../../components/HeroGroup.js";import{padValuesOf as
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import{phoneKey as c}from"efficient-easel/draw";import s from"../../../../../components/HeroGroup.js";import{padValuesOf as l}from"../../../../content/section-padding.js";import{HeroGroupMeta as h}from"../../../../../../format/lib/document/blocks/general/HeroGroup/meta.js";const H={...h,render:e=>{const{placement:r,nudgeX:o,nudgeY:t,width:n,gap:a,direction:i,justify:p,align:d,wrap:g,content:m,editor:u}=e;return f(s,{placement:r,nudgeX:o,nudgeY:t,width:n,gap:a,gapPhone:e[c("gap")],direction:i,justify:p,align:d,wrap:g,pad:l(e),content:m,dragRef:u?.dragRef})}};export{H as HeroGroupRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as e,Fragment as i}from"react/jsx-runtime";import{readHidable as s}from"efficient-easel/draw";import{useBoxCell as x}from"../../../../../components/InBoxContext.js";import l from"../../../../../components/LocationMap.js";import{hasMapCoords as u}from"../../../../../../format/lib/map-styles.js";import{LocationMapMeta as c}from"../../../../../../format/lib/document/blocks/general/LocationMap/meta.js";const h="relative overflow-hidden h-full min-h-[560px] max-[1100px]:h-auto max-[1100px]:min-h-0 max-[1100px]:aspect-square",d="relative overflow-hidden grow shrink-0 max-[800px]:shrink basis-0 min-h-[560px] max-[1100px]:basis-auto max-[1100px]:h-auto max-[1100px]:min-h-0 max-[1100px]:aspect-square",p=new Set(["auto","dark","light"]),a=t=>s(t).text.trim();function f(t){return e(l,{...t,boxClass:x()?.fillingColumn?d:h})}const L={...c,render:t=>{const n=Number(t.lat),o=Number(t.lng),m=t.editor?.isEditing===!0;if(!m&&!u(n,o))return e(i,{});const r=t.mapTheme;return e(f,{name:a(t.name),state:a(t.state),country:a(t.country),lat:n,lng:o,mapsUrl:a(t.mapsUrl),mapTheme:p.has(r)?r:"auto",editing:m})}};export{L as LocationMapRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as H}from"react/jsx-runtime";import{phoneKey as o}from"efficient-easel/draw";import{
|
|
1
|
+
import{jsx as H}from"react/jsx-runtime";import{BLOCK_SIZE_KEYS as N,parseBlockWidthFit as z,phoneKey as o}from"efficient-easel/draw";import{blockSizeOf as R}from"../../content/block-size.js";import{CellWrap as j}from"../../../components/InBoxContext.js";import{boxPhoneRowFits as D,boxShareClasses as K}from"../../../../format/lib/content/box-layout.js";import{resolveContainerDirection as C}from"../../../../format/lib/content/container-direction.js";import{containerBlocksFor as P}from"../../../../format/lib/document/container-blocks.js";import{readPartStyle as A}from"../part-styles.js";import{addShowWhenFacts as L,withRowRules as h}from"../../../../format/lib/document/show-when-attach.js";import{BOX_BLOCK_KEYS as Z}from"./cell-width.js";import{findParentNode as v}from"../../../../format/lib/document/passes/document-position.js";const G=new Set(["Text","Heading"]),X=new Set(["h1","h2","h3","h4","h5","h6"]);function _(t,e){return t==="Heading"?!0:t!=="Text"?!1:typeof e.tag=="string"&&X.has(e.tag)?!0:A(e,"text").textStyle?.startsWith("heading-")===!0}const c={not:{context:"blockOutsideBox",is:!0}},m={all:[c,{not:{context:"boxSharesWidth",is:!0}}]},g={all:[c,{not:{context:"boxSharesWidthPhone",is:!0}}]};function O(t,e,n){return{any:[{field:o(t),is:e},{all:[{field:o(t),set:!1},n??{field:t,is:e}]}]}}const b={any:[{field:"textFit",is:"shrink"},{all:[{field:"textFit",set:!1},{not:{context:"textWrapsByDefault",is:!0}}]}]},U=[[["_gBlockSize","minWidth",o("minWidth"),"maxWidth",o("maxWidth")],c],[["widthFit"],m],[[o("widthFit")],g],[["width"],{all:[m,{field:"widthFit",is:"fixed"}]}],[[o("width")],{all:[g,O("widthFit","fixed")]}]],W=[[["_gText","textFit",o("textFit")],c],[["minFont"],{all:[c,b]}],[[o("minFont")],{all:[c,O("textFit","shrink",b)]}]],u=(t,e)=>v(e.appState,t.props?.id),x=t=>!!t&&typeof t.type=="string"&&P(t.type)!==null,k=t=>(t.type==="Flex"||t.type==="HeroGroup")&&C(t.type,t.props?.direction)==="row",B=t=>{const e=z(t);return e!==void 0&&e!=="fit"},Y={blockOutsideBox:(t,e)=>!x(u(t,e)),boxSharesWidth:(t,e)=>{const n=u(t,e);return x(n)&&k(n)&&K(n.props?.share)!==""&&!B(t.props?.widthFit)},boxSharesWidthPhone:(t,e)=>{const n=u(t,e);if(!x(n)||!k(n))return!1;const i=n.props?.phoneRow;return(Number(i)===2||Number(i)===3)&&!D(i,n.props?.[o("share")])&&!B(t.props?.[o("widthFit")]??t.props?.widthFit)}},M=t=>/^_[gds][A-Z]/.test(t);function V(t,e,n){const i=Object.entries(t),r=i.findIndex(([l])=>l===e);if(r===-1)return null;let s=r+1;for(;s<i.length&&!M(i[s][0]);)s++;return Object.fromEntries([...i.slice(0,s),...Object.entries(n),...i.slice(s)])}function T(t,e,n){const i=Object.entries(t);return Object.fromEntries([...i.slice(0,e),...Object.entries(n),...i.slice(e)])}function q(t,e,n){const i=Object.keys(e);if(i.includes("_dSize")){const{_gBlockSize:r,...s}=n;return T(e,i.indexOf("_dSize")+1,s)}return J.has(t)&&i.includes("_gSpacing")?T(e,i.indexOf("_gSpacing"),n):{...e,...n}}const J=new Set(["Text","Heading"]);function Q(t,e){const{_gText:n,...i}=e;return V(t,"_gText",i)??{...t,...e}}function $(t){const e=new WeakMap;return n=>{if(!n||!("textFit"in n))return n;let i=e.get(n);if(!i){i={...n};for(const r of["textFit",o("textFit")])r in i&&(i[r]=t[r]);e.set(n,i)}return i}}const ut={name:"blockSize",applies:(t,e,n)=>Z.includes(t)&&!!n&&typeof n.render=="function",panel(t,e,n){const i=G.has(e),{size:r,text:s}=n.blockSizeFields(i?{textFit:e==="Heading"?"shrink":"wrap"}:{});let l=q(e,t.fields??{},h(r,U));if(i){const f=h(s,W);if(l=Q(l,f),e==="Text"){const y=h(n.blockSizeFields({textFit:"shrink"}).text,W),E=$(y),p=t.resolveFields,I=(S,a)=>{const d=p?p(S,a):a.fields,w=F=>_(e,S?.props??{})?E(F??a.fields):F;return d instanceof Promise?d.then(w):w(d)};t.resolveFields=I}}t.fields=l,L(t,{...Y,textWrapsByDefault:f=>!_(e,f.props??{})})},draw(t){et(t)}};function tt(t){const e={};for(const n of N){const i=t[n],r=t[o(n)];(i!==void 0||r!==void 0)&&(e[n]={desktop:i,phone:r})}return e}function et(t){const e=t.render;t.render=n=>{const i=R(tt(n)),r=e(n);return i===null?r:H(j,{className:i.className,...Object.keys(i.style).length?{style:i.style}:{},attrs:i.attrs,children:r})}}export{ut as blockSize,_ as textShrinksByDefault};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{catalogueLabel as
|
|
1
|
+
import{catalogueLabel as e}from"../../../../format/lib/document/passes/catalogue-labels.js";import{blockSize as n}from"./block-size.js";import{cellWidth as s}from"./cell-width.js";import{clickableParts as p}from"./clickable-parts.js";import{cardCorners as c,sectionCorners as f}from"./corners.js";import{emptyHeadings as a}from"../../../../format/lib/document/passes/empty-headings.js";import{showWhenRows as l}from"../../../../format/lib/document/passes/show-when-rows.js";import{hiddenNodes as d}from"../../../../format/lib/document/passes/hidden-nodes.js";import{mediaValues as h}from"../../../../format/lib/document/passes/media-values.js";import{sectionAnchor as u}from"./section-anchor.js";import{blockEntrance as S,sectionAnimation as g}from"./section-animation.js";import{sectionHeight as b}from"./section-height.js";import{cardSticky as w,sectionSticky as A}from"./section-sticky.js";import{sectionBorder as P}from"./borders.js";import{blockPadding as k,sectionPadding as C}from"./section-padding.js";import{sectionTheme as W,slideTheme as y}from"./section-theme.js";import{buttonAlignInRow as B,containedWidth as G,sectionWidth as E}from"./section-width.js";import{blockGroups as H,sectionGroups as L}from"../../../../format/lib/document/passes/settings-groups.js";import{slotsStartAfresh as R}from"./slots-start-afresh.js";import{openSlotDisallow as T,sectionGroupAllow as z}from"../../../../format/lib/document/passes/slot-rules.js";import{registryPassContext as mo}from"../../../../format/lib/document/passes/registry-context.js";const D=[R,h,z,T,C,f,P,c,k,S,s,E,G,B,b,u,W,g,A,w,y,n,L,H,l,a,p,d,e];function ro(r,m,o){const t=m;for(const i of D)i.applies(r,o,t)&&(o.inspector&&i.panel?.(t,r,o.inspector,o),i.draw?.(t,r,o));return m}export{D as BLOCK_PASSES,ro as applyBlockPasses,mo as registryPassContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as M}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as s,SECTION_MIN_HEIGHT_EXCLUDED as P,hasPhoneHeight as x,resolvePhoneHeight as E,resolveSectionMinHeight as _,sectionMinHeightAttrs as
|
|
1
|
+
import{jsx as M}from"react/jsx-runtime";import{SECTION_HEIGHT_MODES as s,SECTION_MIN_HEIGHT_EXCLUDED as P,hasPhoneHeight as x,resolvePhoneHeight as E,resolveSectionMinHeight as _,sectionMinHeightAttrs as F}from"../../../../format/lib/content/section-min-height.js";import{CellWrap as m}from"../../../components/InBoxContext.js";import{shownForOption as r,withRowRules as p}from"../../../../format/lib/document/show-when-attach.js";const v=[[["sectionHeightValue"],r("sectionHeightMode",s,"auto",["fixed","screen"])],[["sectionHeightUnit"],r("sectionHeightMode",s,"auto",["fixed"])],[["sectionHeightValuePhone"],r("sectionHeightModePhone",s,"auto",["fixed","screen"])],[["sectionHeightUnitPhone"],r("sectionHeightModePhone",s,"auto",["fixed"])]],O={name:"sectionHeight",applies:(e,n,t)=>n.isSection(e)&&!P.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const i=t.heightFields;e.fields={...e.fields,...p(i(),v)};const c=e.resolveFields;e.resolveFields=(u,H)=>{const o=c?c(u,H):H.fields,h=u?.props??{},l=_(h),g=x(h)?E(h):null;return o&&typeof o.then=="function"?o.then(f=>d(a(f,l),g)):d(a(o,l),g)}},draw(e){const n=e.render;e.render=t=>{const i=F(t);return i?M(m,{className:i.className,style:i.style,children:n(t)}):n(t)}}};function a(e,n){if(!e||!("sectionHeightMode"in e)||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValue;return i&&(t.sectionHeightValue={...i,unit:n.unit}),t}function d(e,n){if(!e||!("sectionHeightModePhone"in e)||!n||n.mode==="auto")return e;const t={...e},i=t.sectionHeightValuePhone;return i&&(t.sectionHeightValuePhone={...i,unit:n.unit}),t}export{O as sectionHeight};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{SECTION_STICK_EXCLUDED as a,sectionStickAttrs as l}from"../../../../format/lib/content/section-sticky.js";import{withRowRules as d}from"../../../../format/lib/document/show-when-attach.js";import{SlotsStartAfresh as f}from"../../../components/InBoxContext.js";import{CARD_BLOCK_KEYS as S}from"./corners.js";const T=c("sectionSticky",(e,s,t)=>s.isSection(e)&&!a.has(e)&&!!t&&typeof t.render=="function"),p=c("cardSticky",(e,s,t)=>S.includes(e)&&!!t&&typeof t.render=="function");function c(e,s){return{name:e,applies:s,panel(t,r,i){t.fields={...t.fields,...d(i.stickFields(),k)}},draw(t){const r=t.render;t.render=i=>{const n=l(i);return n?o("div",{className:n.className,style:n.style,children:o(f,{children:r(i)})}):r(i)}}}}const k=[[["stickTopDistance"],{field:"stickTop",is:!0}],[["stickTopDistancePhone"],{field:"stickTopPhone",is:!0}]];export{p as cardSticky,T as sectionSticky};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{CellWrap as d}from"../../../components/InBoxContext.js";import{SECTION_THEME_EXCLUDED as E,SECTION_THEME_NESTED_READING as o,nestedAccentValue as l,sectionThemeWrap as T}from"../../../../format/lib/content/section-surface.js";const h={name:"sectionTheme",applies:(e,t,s)=>t.isSection(e)&&!E.has(e)&&!!s&&typeof s.render=="function",panel(e,t,s){const{sectionThemeFields:i,SECTION_THEME_FOLLOW_LABEL:n}=s,r=o.has(t);e.fields={...e.fields,...r?i(l,n):i()}},draw(e,t){const s=o.has(t),i=e.render;e.render=n=>{const r=T(s?{...n,sectionAccent:l(n.sectionAccent)}:n),c=i(n);return r?a(d,{className:r.className,style:r.style,children:c}):c}}},L={name:"slideTheme",applies:e=>e==="HeroSlide",panel(e,t,s){const{sectionThemeFields:i,BLOCK_THEME_FOLLOW_LABEL:n}=s;e?.fields&&(e.fields={...e.fields,...i(l,n)})}};export{h as sectionTheme,L as slideTheme};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import{SlotsStartAfresh as l}from"../../../components/InBoxContext.js";const u=new Set(["Flex","Grid"]),i=t=>Object.entries(t.fields??{}).filter(([,e])=>e?.type==="slot").map(([e])=>e),a=new WeakMap;function d(t){const e=a.get(t);if(e)return e;const r=t,n=s=>f(l,{children:f(r,{...s})});return Object.assign(n,t),Object.defineProperty(n,"blockCount",{get:()=>t.blockCount,configurable:!0}),a.set(t,n),n}const y={name:"slotsStartAfresh",applies:(t,e,r)=>!u.has(t)&&typeof r?.render=="function"&&i(r).length>0,draw(t){const e=i(t),r=t.render;t.render=n=>{const s={...n};for(const o of e){const c=n[o];typeof c=="function"&&(s[o]=d(c))}return r(s)}}};export{y as slotsStartAfresh};
|
|
@@ -5,5 +5,4 @@ export declare const efficientMediaResolve: (ref: string) => string | null;
|
|
|
5
5
|
export declare function absolutizeApiUrl(url: string | null | undefined): string | null;
|
|
6
6
|
export declare function isExternalMediaUrl(src: string): boolean;
|
|
7
7
|
export declare function resolveMedia(src?: string): string | undefined;
|
|
8
|
-
export declare function mediaThumb(url: string, width?: number): string;
|
|
9
8
|
export declare function hasAv1Variant(src?: string): boolean;
|
package/dist/render/lib/media.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{currentEaselSession as
|
|
1
|
+
import{currentEaselSession as o}from"efficient-easel/screen/lib/session";const n=process.env.NEXT_PUBLIC_MEDIA_URL?.replace(/\/+$/,"");function i(e){const t=o().hostBackend?.media.resolve;if(!(!t||t===d))return t(e)??e}function s(e){return/^(?:https?:)?\/\//i.test(e)||/^(?:data|blob):/i.test(e)}function u(e){return i(e)??r(e)}function r(e){return!n||s(e)?e:n+e.replace(/^\/media/,"")}const d=e=>r(e),f=process.env.NEXT_PUBLIC_API_URL??"";function p(e){if(!e)return null;const t=i(e);return t!==void 0?t:e.startsWith("/")?`${f}${e}`:e}function l(e){return/^https?:\/\//i.test(e)&&!(n&&e.startsWith(n+"/"))}function x(e){if(!e)return;const t=i(e);return t!==void 0?t:e.startsWith("/media/")?u(e):e}const a="/videos/products/";function E(e){return!!e&&e.includes(a)}export{p as absolutizeApiUrl,r as efficientMedia,d as efficientMediaResolve,E as hasAv1Variant,s as isAbsoluteUrl,l as isExternalMediaUrl,u as media,x as resolveMedia};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "47.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": "^26.
|
|
56
|
+
"efficient-easel": "^26.7.0",
|
|
57
57
|
"efficient-shell": "^11.8.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": "^26.
|
|
75
|
+
"efficient-easel": "^26.7.0",
|
|
76
76
|
"efficient-shell": "^11.8.0",
|
|
77
77
|
"esbuild": "^0.28.0",
|
|
78
78
|
"happy-dom": "^20.14.5",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { DuplicatePageInput, EditorPageRow } from "../../format/lib/web-backend.js";
|
|
2
|
-
interface Props {
|
|
3
|
-
source: EditorPageRow | null;
|
|
4
|
-
taken: ReadonlySet<string>;
|
|
5
|
-
duplicate: (row: EditorPageRow, input: DuplicatePageInput) => Promise<EditorPageRow>;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
onDuplicated: (copy: EditorPageRow) => void;
|
|
8
|
-
}
|
|
9
|
-
export default function DuplicatePageDialog({ source, taken, duplicate, onClose, onDuplicated }: Props): import("react").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{jsx as l,jsxs as S,Fragment as L}from"react/jsx-runtime";import{useId as C,useState as i}from"react";import{Button as F,Dialog as R,FormField as T,Input as k,Stack as U}from"efficient-shell/ui";import{copySuggestion as _,urlHandleTaken as K}from"../lib/page-copy.js";import{slugify as w}from"efficient-shell/format";import{say as n}from"../../format/lib/editor-words.js";function z({source:t,taken:h,duplicate:x,onClose:f,onDuplicated:I}){const g=C(),m=C(),[j,B]=i(null),[r,p]=i(""),[a,d]=i(""),[E,y]=i(!1),[o,v]=i(!1),[b,u]=i(null);if(t!==j&&(B(t),t)){const e=_(t,h);p(e.title),d(e.slug),y(!1),u(null)}const s=K(a,h),D=!!(t&&r.trim()&&a&&!s&&!o),c=async()=>{if(!(!t||!D)){v(!0),u(null);try{const e=await x(t,{title:r.trim(),slug:a});I(e)}catch{u(n("Couldn’t duplicate the page — please retry."))}finally{v(!1)}}};return l(R,{open:t!==null,onClose:()=>{o||f()},size:"sm",title:n("Duplicate “{name}”",{name:t?.label??""}),description:n("The copy is a draft and stays hidden until you publish it. It opens in the editor."),footer:S(L,{children:[l(F,{variant:"secondary",onClick:f,disabled:o,children:n("Cancel")}),l(F,{onClick:()=>{c()},disabled:!D,loading:o,children:n("Duplicate page")})]}),children:S(U,{gap:4,children:[l(T,{label:n("Title"),htmlFor:g,error:b??void 0,children:l(k,{id:g,value:r,invalid:!!b,onChange:e=>{p(e.target.value),E||d(w(e.target.value))},onKeyDown:e=>{e.key==="Enter"&&c()}})}),l(T,{label:n("URL handle"),htmlFor:m,hint:s?void 0:n("URL: /{slug}",{slug:a}),error:s?n("Another page uses this URL handle."):void 0,children:l(k,{id:m,value:a,invalid:s,onChange:e=>{y(!0),d(w(e.target.value))},onKeyDown:e=>{e.key==="Enter"&&c()}})})]})})}export{z as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { DuplicatePageInput, EditorPageRow } from "../../format/lib/web-backend.js";
|
|
2
|
-
export declare function canDuplicatePage(row: Pick<EditorPageRow, "kind">): boolean;
|
|
3
|
-
export declare function uniqueSlug(base: string, taken: ReadonlySet<string>): string;
|
|
4
|
-
export declare function urlHandleTaken(slug: string, taken: ReadonlySet<string>): boolean;
|
|
5
|
-
export declare function copySuggestion(row: Pick<EditorPageRow, "label" | "slug">, taken: ReadonlySet<string>): DuplicatePageInput;
|
|
6
|
-
export declare function usePageDuplicate(): ((row: EditorPageRow, input: DuplicatePageInput) => Promise<EditorPageRow>) | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use client";import{useEaselSession as i}from"efficient-easel/screen/lib/session-context";import{useScreenDocument as r}from"efficient-easel/screen/components/ScreenDocumentContext";import{slugify as c}from"efficient-shell/format";import{backendOf as a}from"./website-session.js";const l=new Set(["normal","dynamic"]);function S(e){return!e.kind||l.has(e.kind)}function p(e,t){const n=c(e)||"page";if(!t.has(n))return n;let s=2;for(;t.has(`${n}-${s}`);)s+=1;return`${n}-${s}`}function D(e,t){return t.has(e)}function $(e,t){return{title:`${e.label||e.slug} copy`,slug:p(`${e.slug}-copy`,t)}}function h(){const e=i(),{siteId:t,templateId:n}=r(),s=a(e).pages;if(!(!s.duplicate||n))return(u,o)=>s.duplicate(u.id,{...o,...t?{siteId:t}:{}})}export{S as canDuplicatePage,$ as copySuggestion,p as uniqueSlug,D as urlHandleTaken,h as usePageDuplicate};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export declare const BLOCK_SIZE_CLASS = "sf-block-size";
|
|
2
|
-
export declare const BLOCK_WIDTH_FIT_POINTS: readonly [{
|
|
3
|
-
readonly label: "Fit content";
|
|
4
|
-
readonly value: "fit";
|
|
5
|
-
}, {
|
|
6
|
-
readonly label: "Fill";
|
|
7
|
-
readonly value: "fill";
|
|
8
|
-
}, {
|
|
9
|
-
readonly label: "Fixed";
|
|
10
|
-
readonly value: "fixed";
|
|
11
|
-
}];
|
|
12
|
-
export type BlockWidthFit = (typeof BLOCK_WIDTH_FIT_POINTS)[number]["value"];
|
|
13
|
-
export declare const BLOCK_WIDTH_FIT_DEFAULT: BlockWidthFit;
|
|
14
|
-
export declare function parseBlockWidthFit(value: unknown): BlockWidthFit | undefined;
|
|
15
|
-
export declare const BLOCK_FIXED_WIDTH: {
|
|
16
|
-
readonly min: 40;
|
|
17
|
-
readonly max: 2000;
|
|
18
|
-
readonly step: 10;
|
|
19
|
-
readonly fallback: 480;
|
|
20
|
-
};
|
|
21
|
-
export declare const BLOCK_WIDTH_LIMIT: {
|
|
22
|
-
readonly min: 40;
|
|
23
|
-
readonly max: 2000;
|
|
24
|
-
readonly step: 10;
|
|
25
|
-
};
|
|
26
|
-
export declare const TEXT_FIT_POINTS: readonly [{
|
|
27
|
-
readonly label: "Wrap";
|
|
28
|
-
readonly value: "wrap";
|
|
29
|
-
}, {
|
|
30
|
-
readonly label: "Shrink to fit";
|
|
31
|
-
readonly value: "shrink";
|
|
32
|
-
}];
|
|
33
|
-
export type TextFit = (typeof TEXT_FIT_POINTS)[number]["value"];
|
|
34
|
-
export declare function parseTextFit(value: unknown): TextFit | undefined;
|
|
35
|
-
export declare const TEXT_FIT_MIN_FONT: {
|
|
36
|
-
readonly min: 8;
|
|
37
|
-
readonly max: 120;
|
|
38
|
-
readonly step: 1;
|
|
39
|
-
readonly fallback: 16;
|
|
40
|
-
};
|
|
41
|
-
export declare const TEXT_FIT_ATTR: {
|
|
42
|
-
readonly fit: "data-fit";
|
|
43
|
-
readonly fitPhone: "data-fit-phone";
|
|
44
|
-
readonly min: "data-fit-min";
|
|
45
|
-
readonly minPhone: "data-fit-min-phone";
|
|
46
|
-
};
|
|
47
|
-
export declare const BLOCK_SIZE_KEYS: readonly ["widthFit", "width", "minWidth", "maxWidth", "textFit", "minFont"];
|
|
48
|
-
export type BlockSizeKey = (typeof BLOCK_SIZE_KEYS)[number];
|
|
49
|
-
export type BlockSizeTwin = {
|
|
50
|
-
desktop?: unknown;
|
|
51
|
-
phone?: unknown;
|
|
52
|
-
};
|
|
53
|
-
export type BlockSizeValues = Partial<Record<BlockSizeKey, BlockSizeTwin>>;
|
|
54
|
-
export type BlockSize = {
|
|
55
|
-
className: string;
|
|
56
|
-
style: Record<string, string>;
|
|
57
|
-
attrs: Record<string, string>;
|
|
58
|
-
};
|
|
59
|
-
export declare function blockSizeOf(values: BlockSizeValues): BlockSize | null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const u="sf-block-size",W=[{label:"Fit content",value:"fit"},{label:"Fill",value:"fill"},{label:"Fixed",value:"fixed"}],E="fit";function b(t){return W.some(n=>n.value===t)?t:void 0}const S={min:40,max:2e3,step:10,fallback:480},P={min:40,max:2e3,step:10},L=[{label:"Wrap",value:"wrap"},{label:"Shrink to fit",value:"shrink"}];function k(t){return L.some(n=>n.value===t)?t:void 0}const g={min:8,max:120,step:1,fallback:16},p={fit:"data-fit",fitPhone:"data-fit-phone",min:"data-fit-min",minPhone:"data-fit-min-phone"},B=["widthFit","width","minWidth","maxWidth","textFit","minFont"],s=t=>typeof t=="number"&&Number.isFinite(t)&&t>=0?t:void 0,O={desktop:{fill:"min-[800px]:w-full min-[800px]:[.flex-row>&]:grow",fixed:"min-[800px]:w-[min(var(--sf-bw),100%)] min-[800px]:basis-auto! min-[800px]:grow-0! min-[800px]:shrink-0"},phone:{fill:"max-[800px]:w-full",fixed:"max-[800px]:w-[min(var(--sf-bw-p),100%)] max-[800px]:basis-auto! max-[800px]:grow-0! max-[800px]:shrink-0"}},C={desktop:"--sf-bw",phone:"--sf-bw-p"},D={minWidth:{desktop:["--sf-bmin","min-[800px]:min-w-[var(--sf-bmin)]"],phone:["--sf-bmin-p","max-[800px]:min-w-[var(--sf-bmin-p)]"]},maxWidth:{desktop:["--sf-bmax","min-[800px]:max-w-[var(--sf-bmax)]"],phone:["--sf-bmax-p","max-[800px]:max-w-[var(--sf-bmax-p)]"]}};function K(t){const n=[],f={},o={},x=b(t.widthFit?.desktop),T=b(t.widthFit?.phone)??x,d=s(t.width?.desktop),w=s(t.width?.phone)??d;for(const[e,i,m]of[["desktop",x,d],["phone",T,w]])!i||i==="fit"||(n.push(O[e][i]),i==="fixed"&&(f[C[e]]=`${m??S.fallback}px`));for(const e of["minWidth","maxWidth"]){const i=s(t[e]?.desktop),m=s(t[e]?.phone)??i;for(const[F,l]of[["desktop",i],["phone",m]]){if(l===void 0)continue;const[_,I]=D[e][F];f[_]=`${l}px`,n.push(I)}}const a=k(t.textFit?.desktop),c=k(t.textFit?.phone),h=s(t.minFont?.desktop),r=s(t.minFont?.phone);return a&&(o[p.fit]=a),c&&(o[p.fitPhone]=c),h!==void 0&&(o[p.min]=String(h)),r!==void 0&&(o[p.minPhone]=String(r)),n.length===0&&Object.keys(o).length===0?null:{className:[u,...n].join(" "),style:f,attrs:o}}export{S as BLOCK_FIXED_WIDTH,u as BLOCK_SIZE_CLASS,B as BLOCK_SIZE_KEYS,E as BLOCK_WIDTH_FIT_DEFAULT,W as BLOCK_WIDTH_FIT_POINTS,P as BLOCK_WIDTH_LIMIT,p as TEXT_FIT_ATTR,g as TEXT_FIT_MIN_FONT,L as TEXT_FIT_POINTS,K as blockSizeOf,b as parseBlockWidthFit,k as parseTextFit};
|