efficient-web-builder 22.0.0 → 22.1.1
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 +74 -0
- package/dist/components/PartSettingsPanel.d.ts +2 -1
- package/dist/components/PartSettingsPanel.js +1 -1
- package/dist/components/PinnedChromeLoadNotice.d.ts +12 -2
- package/dist/components/PinnedChromeLoadNotice.js +1 -1
- package/dist/components/PreviewHeaderContext.d.ts +4 -1
- package/dist/components/PreviewHeaderContext.js +1 -1
- package/dist/components/SectionEditor.js +1 -1
- package/dist/components/StorefrontEditor.js +1 -1
- package/dist/components/usePinnedChromeState.d.ts +3 -0
- package/dist/components/usePinnedChromeState.js +1 -0
- package/dist/components/useWebsiteMainAction.js +1 -1
- package/dist/lib/editor-words-catalogue.d.ts +5 -0
- package/dist/lib/editor-words-catalogue.js +3 -3
- package/dist/lib/page-live-state.d.ts +2 -1
- package/dist/lib/page-live-state.js +1 -1
- package/dist/lib/puck/blocks/general/text-part-shapes.json +2162 -0
- package/dist/lib/puck/header-clearance.d.ts +1 -1
- package/dist/lib/puck/header-clearance.js +1 -1
- package/dist/lib/puck/media-manifest.json +7 -2
- package/dist/lib/puck/page-root.js +2 -2
- package/dist/lib/puck/passes/clickable-parts.js +1 -1
- package/dist/lib/puck/passes/inspector.js +1 -1
- package/dist/lib/puck/passes/section-width.js +1 -1
- package/dist/lib/puck/passes/types.d.ts +3 -1
- package/dist/lib/puck/registry.d.ts +1 -1
- package/dist/lib/puck/registry.js +1 -1
- package/dist/lib/puck/render-registry.d.ts +3 -0
- package/dist/lib/puck/render-registry.js +1 -0
- package/dist/lib/puck/source-bound-parts.d.ts +2 -0
- package/dist/lib/puck/source-bound-parts.js +1 -1
- package/dist/lib/puck/text-part-shape.d.ts +18 -0
- package/dist/lib/puck/text-part-shape.js +2 -0
- package/dist/lib/source-rules/support/registry-source.d.ts +1 -1
- package/dist/lib/source-rules/support/registry-source.js +3 -3
- package/package.json +3 -2
|
@@ -8,7 +8,7 @@ export declare const HEADER_MENU_GAP_PX: {
|
|
|
8
8
|
readonly min: 0;
|
|
9
9
|
readonly max: 120;
|
|
10
10
|
readonly step: 2;
|
|
11
|
-
readonly default:
|
|
11
|
+
readonly default: 32;
|
|
12
12
|
};
|
|
13
13
|
export declare const HEADER_HEIGHT_CSS: string;
|
|
14
14
|
export declare const HEADER_SET_HEIGHT_VAR = "--sf-header-set-h";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HEADER_TYPE as o,FOOTER_TYPE as a}from"./content-tree.js";const E=new Set(["Hero","HeroSingle","IntroBleed"]),n={min:56,max:140,default:88},A={min:0,max:120,step:2,default:
|
|
1
|
+
import{HEADER_TYPE as o,FOOTER_TYPE as a}from"./content-tree.js";const E=new Set(["Hero","HeroSingle","IntroBleed"]),n={min:56,max:140,default:88},A={min:0,max:120,step:2,default:32},H=`var(--sf-header-h, ${n.default}px)`,s="--sf-header-set-h",d="--sf-header-h",l=`var(${s}, ${n.default}px)`,T="sf-header-clearance",R="sf-sticky-underheader";function c(e){return e?.find(t=>t?.type&&t.type!==o)??null}function p(e){const t=c(e)?.type;return!t||!E.has(t)}function D(e){return!p(e)}function P(e){return!!e?.some(t=>t?.type===o)}function h(e){return!e||e.length===0?!1:!e.some(t=>t?.type===o||t?.type===a)}const u=["auto","shared","own"],_="auto",S="topSpace",C="data-top-space";function f(e){return u.includes(e)?e:_}function x(e,t){const r=f(e?.props?.[S]);return r==="own"?!0:r==="shared"?!1:p(t)}function m(e,t){return x(e,t)?"own":null}export{_ as DEFAULT_TOP_SPACE,E as FULLBLEED_LEAD_SECTIONS,T as HEADER_CLEARANCE_CLASS,d as HEADER_DRAWN_HEIGHT_VAR,H as HEADER_HEIGHT_CSS,n as HEADER_HEIGHT_PX,A as HEADER_MENU_GAP_PX,l as HEADER_SET_HEIGHT_CSS,s as HEADER_SET_HEIGHT_VAR,R as STICKY_UNDERHEADER_CLASS,C as TOP_SPACE_ATTR,u as TOP_SPACE_MODES,S as TOP_SPACE_PROP,h as isStandaloneSectionDocument,c as leadSection,p as pageClearsHeader,P as pageHasHeaderSection,D as pageLeadsWithFullBleed,x as pageTakesTopSpace,f as resolveTopSpace,m as topSpaceMarker};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contentHash": "
|
|
2
|
+
"contentHash": "bff238ceb7836a0a",
|
|
3
3
|
"schema": 1,
|
|
4
4
|
"mediaFields": {
|
|
5
5
|
"ImageBlock": [
|
|
@@ -135,6 +135,11 @@
|
|
|
135
135
|
]
|
|
136
136
|
},
|
|
137
137
|
"technicalStateKeys": [
|
|
138
|
-
"
|
|
138
|
+
"focal",
|
|
139
|
+
"focalPhone",
|
|
140
|
+
"imageFocal",
|
|
141
|
+
"imageFocal2",
|
|
142
|
+
"imageFocal2Phone",
|
|
143
|
+
"imageFocalPhone"
|
|
139
144
|
]
|
|
140
145
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r,jsxs as A}from"react/jsx-runtime";import{accentItalicCss as
|
|
2
|
-
`),k=P({widthMode:c,fullWidth:l,pageWidth:f}),
|
|
1
|
+
import{jsx as r,jsxs as A}from"react/jsx-runtime";import{accentItalicCss as Y,storedTextStyles as q,textStylesCss as J}from"../site-text-styles.js";import{pageWidthMarker as Q,PAGE_WIDTH_ATTR as U,SITE_WIDTH_CAP as Z,siteWidthTokens as ee,siteGutterTokens as te,heroBackgroundTokens as oe}from"../content/page-width.js";import{siteBlockGapTokens as ne}from"../content/container-gap.js";import{siteCardRadiusTokens as re}from"../content/card-corners.js";import{usePreviewHeader as se}from"../../components/PreviewHeaderContext.js";import{SitePhotographyProvider as ae}from"../../components/SitePhotographyContext.js";import{CORNER_STYLE_TO_PX as de,normalizeCornerStyle as ie,normalizeCornerRadius as ce,themeColorStyle as le,typeSizesStyle as he,headingTypographyStyle as pe,normalizeHeadingTypography as fe,themeAccentStyle as me,themeButtonStyle as ue,themePresetAccentVars as ge,themeSurfaceStyle as ye,siteCornerRadiusTokens as v,shadowColorTokens as Se,headingCompressionAttr as xe,cardShadowAttr as Te,cardGapAttr as Ce,hoverEffectAttr as ke}from"../theme.js";import{fontRoleStyle as Ae}from"../fonts.js";import{wordStyleTokens as ve}from"../word-styles.js";import{isStandaloneSectionDocument as Ee,pageHasHeaderSection as E,pageTakesTopSpace as _e,topSpaceMarker as Pe,TOP_SPACE_ATTR as we,HEADER_CLEARANCE_CLASS as Re}from"./header-clearance.js";import{leadSectionInk as He,HEADER_INK_ATTR as We}from"./header-ink.js";import{useEasel as Ie}from"efficient-easel/easel";import{pageBackgroundVars as _}from"../content/page-background.js";const Ge="color-mix(in oklab, var(--bg) 40%, #ffffff)",Ne="12vh";function be({style:t,frameClass:o,children:s}){const{appState:n}=Ie(g=>g),a=n.data.content,d=n.data.root;if(Ee(a))return r("div",{className:`sf-themed-content${o?` ${o}`:""}`,style:{...t,background:Ge,minHeight:"100vh",paddingBottom:Ne},children:r("div",{style:{background:"var(--bg)"},children:s})});const c=E(a)&&_e(d,a),l=E(a)?Pe(d,a):null,f=l?{[we]:l}:null,h=Q(d?.widthChoice),m=h?{[U]:h}:null,p=c?null:He(a),u=p?{[We]:p}:null;return r("div",{className:`sf-themed-content${c?` ${Re}`:""}${o?` ${o}`:""}`,style:t,...u,...f,...m,children:r("div",{style:{background:"var(--bg)",minHeight:"100%"},children:s})})}function P(t){return{frameClass:void 0,style:{"--sf-page-width":Z}}}function Be({w:t,children:o}){const{frameClass:s,style:n}=P(t);return r("div",{className:s,style:n,children:o})}function Qe({propsTheme:t,propsFonts:o,propsCornerStyle:s,propsCornerRadiusPx:n,propsHeadingCompression:a,propsHeadingTypography:d,widthMode:c,fullWidth:l,pageWidth:f,pageBackground:h,chromeInheritsSiteBackground:m,suppressPreviewNav:p,footer:u,overlay:g,children:w}){const{theme:R,fonts:H,sizes:W,cornerRadiusPx:I,cardShadow:y,shadowColor:G,cardGap:N,hoverEffect:S,headingCompression:b,siteWidth:B,siteGutter:z,blockGap:D,headingTypography:V,heroBackgroundFollowsWidth:$,photographyGrayscale:j,textStyles:F,wordStyles:L,themeFromDocument:e}=se(),i=e?t:R,O=e?o:H,M=e?void 0:W,x=e?n===void 0?de[ie(s)]:ce(n):I,X=e?a:b,T=e?d:V,C=[J(q(e?void 0:F)),Y(fe(T).italicStrong)].filter(Boolean).join(`
|
|
2
|
+
`),k=P({widthMode:c,fullWidth:l,pageWidth:f}),K={...le(i),...he(M),...pe(T),...k.style,...m?{}:_(h)};return A("div",{className:"sf-theme-surfaces sf-theme-accent",style:{...Ae(O),...ve(e?null:L),...me(i),...ue(i),...ge(i),...ye(i),...v(x),...re(v(x)),...Se(e?void 0:y,e?void 0:G,e?void 0:S),...ee(e?void 0:B),...te(e?void 0:z),...ne(e?void 0:D),...oe(e?void 0:$)},"data-sf-headings":xe(X),"data-sf-card-shadow":e?void 0:Te(y),"data-sf-card-gap":e?void 0:Ce(N),"data-sf-card-hover":e?void 0:ke(S),onClickCapture:p,children:[C?r("style",{"data-sf-text-styles":"",dangerouslySetInnerHTML:{__html:C}}):null,A(ae,{grayscale:e?void 0:j,children:[r(be,{style:K,frameClass:k.frameClass,children:w}),u,g]})]})}const Ue=t=>{t.target?.closest?.("a")&&t.preventDefault()};function Ze({pageBackground:t,inheritBackground:o=!1,w:s,children:n}){return r("div",{style:{...o?{}:_(t),background:"var(--bg)",minHeight:"100%",overflowX:"clip"},children:r(Be,{w:s,children:n})})}export{be as EditorPageBody,Qe as EditorThemedBody,Be as PageWidthWrapper,Ze as PublishedPageFrame,Ge as SECTION_PREVIEW_CANVAS,Ne as SECTION_PREVIEW_CANVAS_TAIL,P as pageWidthTokens,Ue as suppressPreviewNav};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as c}from"react/jsx-runtime";import d from"../../../components/PreviewPartAnchors.js";import{PublishedPartStyles as o}from"../../../components/PublishedPartStylesContext.js";import{readPartStyles as m}from"../part-styles.js";import{partNeedles as a}from"../text-parts.js";const h={name:"clickableParts",applies:(i,r,t)=>typeof t?.render=="function",draw(i,r){const t=i,l=()=>t.textParts??t.fields,n=t.render;t.render=e=>{const s=m(e);return e.puck?.isEditing?c(d,{needles:a(l(),e),styles:s,type:r,children:n(e)}):Object.keys(s).length?c(o,{needles:a(l(),e),styles:s,type:r,children:n(e)}):n(e)}}};export{h as clickableParts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BLOCK_THEME_FOLLOW_LABEL as
|
|
1
|
+
import{WidthIcon as i}from"efficient-easel/icons";import{BLOCK_THEME_FOLLOW_LABEL as e,SECTION_THEME_FOLLOW_LABEL as s}from"../../../components/SectionThemePicker.js";import{anchorFields as d,cardShapeFields as o,cellWidthFields as t,heightFields as r,sectionAnimationFields as l,sectionShapeFields as m,sectionThemeFields as n,slider as F,spacingFields as p,sidesPaddingFields as c,stickFields as a,widthField as h}from"../controls.js";import{assignSectionGroups as E}from"../field-groups.js";import{dropEmptyHeadings as L}from"../panel-drop-empty-headings.js";const T={spacingFields:p,sidesPaddingFields:c,sectionShapeFields:m,cardShapeFields:o,cellWidthFields:t,widthField:h,heightFields:r,anchorFields:d,stickFields:a,sectionThemeFields:n,sectionAnimationFields:l,slider:F,WidthIcon:i,assignSectionGroups:E,dropEmptyHeadings:L,SECTION_THEME_FOLLOW_LABEL:s,BLOCK_THEME_FOLLOW_LABEL:e};export{T as PASS_INSPECTOR};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as a}from"react/jsx-runtime";import{resolveContainerDirection as w}from"../../content/container-direction.js";import{IMAGE_WIDTH as u}from"../../content/image-width.js";import{HERO_BACKGROUND_VAR as C,HERO_CHROME_CAP_VAR as I,HERO_CHROME_INSET_VAR as T,SITE_WIDTH_CAP as h,centredCap as B}from"../../content/page-width.js";import{resolveWidth as p}from"../../content/section-width.js";import{isInsideSiteGutter as g}from"../../content/site-gutter.js";import{parentCapsWidth as m}from"../../sections/section-head-placement.js";import{findParentNode as O,isNestedNode as S}from"./document-position.js";const W=new Set(["SectionHeader","ProductGrid","IntroBleed","RelatedProducts","Banner","Stats","Logos","Divider","OrderSummary","DeliveryOptions","PaymentBadges","CheckoutCTA","Ticker","CategoryBar","DocTabs","CustomHTML","Spacer","Flex","Grid"]),E=new Set(["Hero","HeroSingle","Manifesto","ProductHero"]),H=new Set(["ProductHero"]),G={name:"sectionWidth",applies:(e,n,t)=>n.isSection(e)&&!W.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const r=t.widthField;e.fields={...e.fields,...r("full")};const d=e.resolveFields;e.resolveFields=(i,l)=>{const o=d?d(i,l):l.fields,s=p(i?.props??{},"full");return o&&typeof o.then=="function"?o.then(c=>f(c,s)):f(o,s)}},draw(e,n){const t=E.has(n),r=e.render;e.render=d=>{const{mode:i,inherited:l}=p(d,"full"),o=r(d);if(i==="full")return t&&!l&&!H.has(n)?a("div",{style:{[C]:"none",[T]:"initial",[I]:"initial"},children:o}):o;const s=B(h);return t?a("div",{style:{"--sf-page-cap":h},children:o}):a("div",{style:s,children:o})}}};function f(e,n){if(!e||!("widthMode"in e))return e;const t={...e},r=t.widthMode;return r&&(t.widthMode={...r,currentValue:n.mode,inherited:n.inherited}),t}const v=new Set(["Heading","Text","ImageBlock","ButtonBlock","Banner","Stats","Logos","Divider","Flex","Grid","OrderSummary","DeliveryOptions","PaymentBadges","CheckoutCTA"]),j={name:"containedWidth",applies:(e,n,t)=>v.has(e)&&!!t&&typeof t.render=="function",panel(e,n,t){const r=t.widthField;e.fields={...e.fields,...r("page")};const d=e.resolveFields;e.resolveFields=(i,l)=>{const o=d?d(i,l):l.fields,s=p(i?.props??{},"page"),c=_=>F(n,A(f(_,s),i,l));return o&&typeof o.then=="function"?o.then(c):c(o)}},draw(e){const n=e.render;e.render=t=>{const{mode:r}=p(t,"page");return n({...t,contained:r!=="full"})}}},L={name:"buttonAlignInRow",applies:e=>e==="ButtonBlock",panel(e){const n=e,t=n?.resolveFields;n.resolveFields=(r,d)=>{const i=t?t(r,d):d.fields,l=o=>{const s=O(d.appState,r.props?.id);if(!s||s.type!=="HeroGroup"||w("HeroGroup",s.props?.direction)!=="row")return o;const c={...o};return delete c.align,c};return i&&typeof i.then=="function"?i.then(l):l(i)}}};function y(e){return Object.values(e).some(n=>!!n&&typeof n=="object"&&n.type==="slot")}function F(e,n){if(e!=="ButtonBlock")return n;const t={...n};return delete t._gWidth,delete t.widthMode,delete t.pageWidth,t}function A(e,n,t){if(y(e)){const d=t.appState?.data?.content;if(g(d,n.props?.id)!==!0)return e;const i={...e};return delete i.widthMode,delete i.pageWidth,i}if("parent"in t){if(!m(t.parent))return e}else if(!S({props:n.props??{}},t))return e;const r={...e};return delete r.widthMode,delete r.pageWidth,r}const V={name:"imageWidth",applies:e=>e==="ImageBlock",panel(e,n,t){const{slider:r,WidthIcon:d}=t;if(e?.fields){const i=r("Image width",a(d,{}),u.min,u.max,u.step,u.fallback,u.unit),l="focal",o=Object.entries(e.fields),s=o.findIndex(([c])=>c===l);e.fields=Object.fromEntries(s===-1?[...o,["width",i]]:[...o.slice(0,s+1),["width",i],...o.slice(s+1)])}}};export{L as buttonAlignInRow,j as containedWidth,V as imageWidth,G as sectionWidth,f as widthModeFields};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from "react";
|
|
1
|
+
import type { ComponentType, ReactElement, ReactNode } from "react";
|
|
2
2
|
export type PassRenderProps = Record<string, unknown>;
|
|
3
3
|
export type PassResolveFields = (data: {
|
|
4
4
|
props?: Record<string, unknown>;
|
|
@@ -12,6 +12,7 @@ export type PassResolveFields = (data: {
|
|
|
12
12
|
export type PassBlock = {
|
|
13
13
|
label?: string;
|
|
14
14
|
fields?: Record<string, unknown>;
|
|
15
|
+
textParts?: Record<string, unknown>;
|
|
15
16
|
defaultProps?: Record<string, unknown>;
|
|
16
17
|
resolveFields?: PassResolveFields;
|
|
17
18
|
render: (props: PassRenderProps) => ReactNode;
|
|
@@ -36,6 +37,7 @@ export type PassInspector = {
|
|
|
36
37
|
sectionThemeFields: (readValue?: (v: unknown) => unknown, followLabel?: string) => FieldMap;
|
|
37
38
|
sectionAnimationFields: () => FieldMap;
|
|
38
39
|
slider: (label: string, icon: ReactElement, min: number, max: number, step: number, fallback: number, suffix?: string) => unknown;
|
|
40
|
+
WidthIcon: ComponentType;
|
|
39
41
|
assignSectionGroups: <T extends FieldMap>(fields: T, where: string) => T;
|
|
40
42
|
dropEmptyHeadings: <T extends FieldMap>(fields: T) => T;
|
|
41
43
|
SECTION_THEME_FOLLOW_LABEL: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withRecordTypeRow as
|
|
1
|
+
import{withRecordTypeRow as c}from"./page-root-fields.js";import{dropEmptyHeadings as d}from"./panel-drop-empty-headings.js";import{PASS_INSPECTOR as l}from"./passes/inspector.js";import{finishRenderRegistry as m}from"./render-registry.js";function u(t){const f=m(t,l),s=t.root,n=s.resolveFields,r=(o,e)=>d(c(o,e?.props),"page");return s.resolveFields=n?(o,e)=>{const i=n(o,e);return i instanceof Promise?i.then(p=>r(p??e.fields,o)):r(i??e.fields,o)}:(o,e)=>r(e.fields,o),f}export{u as finishRegistry};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{applyBlockPasses as r,registryPassContext as c}from"./passes/index.js";function i(e,t){const o={...c(Object.keys(e.components),e.categories?.structure?.components??[]),...t?{inspector:t}:{}};for(const[s,n]of Object.entries(e.components))r(s,n,o);return o}export{i as finishRenderRegistry};
|
|
@@ -10,3 +10,5 @@ export declare const SOURCE_ACTIONS: Record<PartSource, {
|
|
|
10
10
|
}>;
|
|
11
11
|
export declare function sourceSlugOf(props: unknown): string | undefined;
|
|
12
12
|
export declare function partSourceOf(nodeType: string): PartSource | null;
|
|
13
|
+
export declare function partSourceNoteFor(nodeType: string, propKey: string): PartSource | null;
|
|
14
|
+
export declare function sourceMenuIdOf(props: unknown): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CUSTOM_FIELD_VALUES as n}from"./neutralization-contracts.js";import{HYDRATED_LISTS as
|
|
1
|
+
import{CUSTOM_FIELD_VALUES as n}from"./neutralization-contracts.js";import{HYDRATED_LISTS as u,SNAPSHOT_OBJECTS as s}from"./snapshot-contracts.js";function S(){const e=new Set([...Object.keys(s),...Object.keys(u)]);for(const[t,o]of Object.entries(n))for(const r of Object.values(o))r.verb==="snapshot"&&e.add(t);return[...e].sort()}function c(e){const t=new Set([...Object.keys(s[e]??{}),...u[e]??[]]);for(const[o,r]of Object.entries(n[e]??{}))r.verb==="snapshot"&&t.add(o);return[...t].sort()}const p={CollectionCard:"product",FooterMenu:"menu",Gallery:"product",GalleryItem:"product",ProductGrid:"product",ProductHero:"product",SpecTable:"product",Events:"blog",FeaturedCover:"blog",LongRead:"blog",SubscribeBlogs:"blog"},i={product:"Synced from the product.",blog:"Synced from the blog post.",menu:"Synced from the site menu."},O="Open",g={product:{type:"storefront-editor:open-product",needsSlug:!0},blog:{type:"storefront-editor:open-post",needsSlug:!0},menu:{type:"storefront-editor:open-menus",needsSlug:!1}};function b(e){const o=e?.source?.slug;return typeof o=="string"&&o.length>0?o:void 0}function d(e){return p[e]??null}function m(e,t){const o=d(e);return o&&c(e).includes(t)?o:null}function a(e){const o=e?.menu?.id;return typeof o=="string"&&o.length>0?o:void 0}export{p as PART_SOURCES,g as SOURCE_ACTIONS,O as SOURCE_ACTION_LABEL,i as SOURCE_LINES,c as hydratedPropsOf,m as partSourceNoteFor,d as partSourceOf,S as sourceBoundBlocks,a as sourceMenuIdOf,b as sourceSlugOf};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LINK_FIELD_MARKER, SCAFFOLD_FIELD_MARKER, TEXT_FIELD_MARKER, type TextFieldMeta } from "./field-markers.js";
|
|
2
|
+
export type TextPartShape = {
|
|
3
|
+
type?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
[TEXT_FIELD_MARKER]?: Pick<TextFieldMeta, "control" | "label" | "placeholder" | "itemKey">;
|
|
6
|
+
[LINK_FIELD_MARKER]?: true;
|
|
7
|
+
[SCAFFOLD_FIELD_MARKER]?: unknown;
|
|
8
|
+
arrayFields?: Record<string, TextPartShape>;
|
|
9
|
+
objectFields?: Record<string, TextPartShape>;
|
|
10
|
+
};
|
|
11
|
+
export type TextPartShapes = Record<string, TextPartShape>;
|
|
12
|
+
export declare function textPartShape(fields: Record<string, unknown> | undefined): TextPartShapes;
|
|
13
|
+
export declare function textPartShapes(blocks: Record<string, {
|
|
14
|
+
fields?: Record<string, unknown>;
|
|
15
|
+
}>): Record<string, TextPartShapes>;
|
|
16
|
+
export declare function textPartShapesText(blocks: Record<string, {
|
|
17
|
+
fields?: Record<string, unknown>;
|
|
18
|
+
}>): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{LINK_FIELD_MARKER as p,SCAFFOLD_FIELD_MARKER as s,TEXT_FIELD_MARKER as a}from"./field-markers.js";import{isStructuralTextProp as y}from"./neutralization-contracts.js";const b=["control","label","placeholder","itemKey"];function l(e){if(!e||typeof e!="object")return null;const t={};for(const[n,i]of Object.entries(e)){const o=d(i);o&&(t[n]=o)}return Object.keys(t).length?t:null}function d(e){if(!e||typeof e!="object")return null;const t=e,n=t[a],i=t.type==="text"||t.type==="textarea",o=l(t.arrayFields),f=l(t.objectFields);if(!n&&!i&&!o&&!f)return null;const r={};if(typeof t.type=="string"&&(r.type=t.type),typeof t.label=="string"&&(r.label=t.label),n){const u={};for(const c of b)n[c]!==void 0&&(u[c]=n[c]);r[a]=u}return t[p]&&(r[p]=!0),t[s]!==void 0&&(r[s]=t[s]),o&&(r.arrayFields=o),f&&(r.objectFields=f),r}function h(e){const t=l(e)??{};for(const n of Object.keys(t))y(n)&&delete t[n];return t}function j(e){const t={};for(const[n,i]of Object.entries(e)){const o=h(i.fields);Object.keys(o).length&&(t[n]=o)}return t}function F(e){return`${JSON.stringify(j(e),null,2)}
|
|
2
|
+
`}export{h as textPartShape,j as textPartShapes,F as textPartShapesText};
|
|
@@ -2,7 +2,7 @@ import type * as TS from "typescript";
|
|
|
2
2
|
import type { SourceFile } from "../rule.js";
|
|
3
3
|
export declare const CONFIG_FILE = "lib/puck/config.tsx";
|
|
4
4
|
export declare const REGISTRY_DIRS: readonly ["lib/puck/blocks", "lib/puck/passes"];
|
|
5
|
-
export declare const REGISTRY_MODULES: readonly ["lib/puck/page-root.tsx", "lib/puck/page-root-fields.tsx", "lib/puck/registry.ts"];
|
|
5
|
+
export declare const REGISTRY_MODULES: readonly ["lib/puck/page-root.tsx", "lib/puck/page-root-fields.tsx", "lib/puck/registry.ts", "lib/puck/render-registry.ts"];
|
|
6
6
|
export declare function isRegistryPath(p: string): boolean;
|
|
7
7
|
export declare function registryFiles(files: readonly SourceFile[]): SourceFile[];
|
|
8
8
|
export declare function registryText(files: readonly SourceFile[]): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const o="lib/puck/config.tsx",x=["lib/puck/blocks","lib/puck/passes"],g=["lib/puck/page-root.tsx","lib/puck/page-root-fields.tsx","lib/puck/registry.ts"],d=t=>/\.tsx?$/.test(t)&&!t.endsWith(".d.ts");function m(t){return t===o||g.includes(t)?!0:d(t)&&x.some(e=>t.startsWith(`${e}/`))}function k(t){const e=new Map(t.map(n=>[n.path,n])),r=[o,...g].map(n=>e.get(n)).filter(n=>!!n),i=x.flatMap(n=>t.filter(s=>d(s.path)&&s.path.startsWith(`${n}/`)).sort((s,c)=>s.path<c.path?-1:1));return[...r,...i]}function y(t){return k(t).map(e=>e.text).join(`
|
|
2
|
-
`)}function h(t,e){const r=t.find(i=>new RegExp(`^lib/puck/blocks/[^/]+/${e}/render\\.tsx$`).test(i.path));return r?r.path.slice(0,-11):null}function E(t){return t.map(e=>/^lib\/puck\/blocks\/[^/]+\/([^/]+)\/render\.tsx$/.exec(e.path)?.[1]).filter(e=>!!e).sort()}function b(t,e){const r=h(t,e);return r?[`${r}/render.tsx`,`${r}/fields.tsx`].filter(i=>t.some(n=>n.path===i)):t.some(i=>i.path===o)?[o]:[]}function
|
|
3
|
-
`);const n=
|
|
1
|
+
const o="lib/puck/config.tsx",x=["lib/puck/blocks","lib/puck/passes"],g=["lib/puck/page-root.tsx","lib/puck/page-root-fields.tsx","lib/puck/registry.ts","lib/puck/render-registry.ts"],d=t=>/\.tsx?$/.test(t)&&!t.endsWith(".d.ts");function m(t){return t===o||g.includes(t)?!0:d(t)&&x.some(e=>t.startsWith(`${e}/`))}function k(t){const e=new Map(t.map(n=>[n.path,n])),r=[o,...g].map(n=>e.get(n)).filter(n=>!!n),i=x.flatMap(n=>t.filter(s=>d(s.path)&&s.path.startsWith(`${n}/`)).sort((s,c)=>s.path<c.path?-1:1));return[...r,...i]}function y(t){return k(t).map(e=>e.text).join(`
|
|
2
|
+
`)}function h(t,e){const r=t.find(i=>new RegExp(`^lib/puck/blocks/[^/]+/${e}/render\\.tsx$`).test(i.path));return r?r.path.slice(0,-11):null}function E(t){return t.map(e=>/^lib\/puck\/blocks\/[^/]+\/([^/]+)\/render\.tsx$/.exec(e.path)?.[1]).filter(e=>!!e).sort()}function b(t,e){const r=h(t,e);return r?[`${r}/render.tsx`,`${r}/fields.tsx`].filter(i=>t.some(n=>n.path===i)):t.some(i=>i.path===o)?[o]:[]}function u(t,e){const r=e.find(l=>l.path===o);if(!r)return null;const i=r.text,n=t.createSourceFile(o,i,t.ScriptTarget.Latest,!0,t.ScriptKind.TSX),s={keys:[],literals:new Map,registeredAs:new Map};let c=!1;const f=l=>{if(!c){if(t.isPropertyAssignment(l)&&l.name.getText(n)==="components"&&t.isObjectLiteralExpression(l.initializer)){c=!0;for(const p of l.initializer.properties){if(!t.isPropertyAssignment(p))continue;const a=p.name.getText(n);s.keys.push(a),t.isObjectLiteralExpression(p.initializer)?s.literals.set(a,i.slice(p.getFullStart(),p.end)):s.registeredAs.set(a,p.initializer.getText(n))}return}t.forEachChild(l,f)}};if(f(n),!c)throw new Error(`registry-source: no \`components\` object in ${o}`);return s}function S(t,e){return[...u(t,e)?.keys??[]]}function $(t,e){return[...u(t,e)?.literals.keys()??[]]}function T(t,e,r){return u(t,e)?.registeredAs.get(r)}function w(t,e,r){if(h(e,r))return b(e,r).map(s=>e.find(c=>c.path===s).text).join(`
|
|
3
|
+
`);const n=u(t,e)?.literals.get(r);if(n===void 0)throw new Error(`registry-source: no block "${r}" among the files handed in — no folder under lib/puck/blocks/ and no literal in ${o}'s \`components\``);return n}export{o as CONFIG_FILE,x as REGISTRY_DIRS,g as REGISTRY_MODULES,b as blockFiles,w as blockSource,$ as blocksWrittenInConfig,m as isRegistryPath,T as registeredAs,S as registeredBlockKeys,k as registryFiles,y as registryText,E as splitBlockTypes};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.1.1",
|
|
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",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"verify:dist": "node scripts/verify-dist.mjs",
|
|
37
37
|
"verify": "pnpm run typecheck && pnpm run test:boundary && pnpm run test:screen && pnpm run test:own-ui && pnpm run test:guards && pnpm run build && pnpm run verify:dist",
|
|
38
38
|
"test:guards": "tsc --noEmit -p scripts/tsconfig.json && node scripts/run-guards.mjs",
|
|
39
|
-
"words": "TSX_TSCONFIG_PATH=scripts/tsconfig.json tsx scripts/write-editor-words.ts"
|
|
39
|
+
"words": "TSX_TSCONFIG_PATH=scripts/tsconfig.json tsx scripts/write-editor-words.ts",
|
|
40
|
+
"text-parts": "TSX_TSCONFIG_PATH=scripts/tsconfig.json tsx scripts/write-text-part-shapes.ts"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"@tabler/icons-react": "^3.46.0",
|