efficient-web-builder 69.2.0 → 69.3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 69.3.0 - 2026-11-15
4
+
5
+ From main at `32f5be7b`: #762. A minor: no `!`, no export is removed, the peers stay `efficient-easel` `^34.3.0` and `efficient-shell` `^13.3.0`. New exports only. No stored key or value moves.
6
+
7
+ **For hosts:**
8
+ - storefront-blocks may declare a card row field `kind: "date"` (an ISO instant, such as a post's `publishedAt`); a Text bound to it draws `PostDate` (the reader's day). No step is required to take this release.
9
+ - `CardRowFieldKind` gains `"date"`. A host that switches over every kind adds a case.
10
+
11
+ ### Added
12
+
13
+ - **A date row field a Text draws as PostDate** (#762): `CardRowFieldKind` gains `"date"`. New `CardRowFieldKinds` (one kind or a list), `fieldsOfKind(fields, kind)` (the one filter for the fields of a kind, in declared order) and `rowFieldIsDate(copy, key)` in `lib/content/card-template`. `cardTemplateFields`, `cardTemplateFieldsOf`, `cardListFieldsOf`, `recordRowFields` and `cardRowField` take one kind or a list. The Text block's new optional `date` prop draws `<PostDate>` inside its own tag, part and link; its "Shows" row offers words and dates. A Card list's stored `date` field keeps its kind when read back.
14
+
3
15
  ## 69.2.0 - 2026-11-15
4
16
 
5
17
  From main at `18a8db55`: #756. A minor: no `!`, no export is removed, the peers stay `efficient-easel` `^34.3.0` and `efficient-shell` `^13.3.0`. New exports only. `postDateLabel` is deprecated (delete by 2026-12-12, in a major).
@@ -1 +1 @@
1
- import{jsx as w}from"react/jsx-runtime";import{AccentIcon as O,ListIcon as F}from"efficient-easel/icons";import{isNodeList as L,newId as b}from"efficient-easel/data";import{group as u}from"efficient-easel/screen/lib/document/box-fields";import{COUNT_KEY_PROP as h}from"../../../../../../format/lib/content/block-sources.js";import{CARD_LIST_ROWS as p,CARD_LIST_TYPE as f,cardListFieldsOf as S,cardTemplateOwner as g,namedRowField as I}from"../../../../../../format/lib/content/card-template.js";import{BLOCK_SOURCE_EDIT_PROP as T,NO_BLOCK_SOURCE as E,blockSourceEditField as A,blockSourceField as M,blockSourceFields as D}from"../../../block-source-fields.js";import{select as P}from"../../../box-fields.js";import{text as W}from"../../../controls.js";import{cardsFieldsFollowContent as x}from"../../../../../../format/lib/document/cards-template-on-read.js";import{cardFollowsContentSwitch as N}from"../../../../../../format/lib/document/card-content-switch.js";import{cardPicks as j,pickRow as v,withOwnCardKeys as B}from"../../../../../../format/lib/document/card-row-keys.js";import{ROW_LIVE_NUMBER_FIELD as U}from"../../../live-number-field.js";import{withShowWhen as d}from"../../../../../../format/lib/document/show-when-attach.js";import{CARD_ROW_FACTS as K,cardRowField as H,cardRowFields as Y,cardRowItemField as J}from"../../../card-row-fields.js";import{say as V}from"../../../../../../format/lib/editor-words.js";import{CardListSlots as q}from"../../../../../../format/lib/document/blocks/general/CardList/meta.js";function y(e){return L(e)?e.some(o=>{const t=o.props??{};return o.type==="Text"&&typeof t[h]=="string"&&I(t)?!0:Object.values(t).some(y)}):!1}const z=e=>Object.defineProperty(Object.fromEntries(e.map(o=>[o.key,""])),"key",{get:()=>b("row"),enumerable:!0}),_=new WeakMap;function G(e,o,t){const r=o.filter(c=>!c.everySource);let s=_.get(e);s||_.set(e,s=new Map);const i=JSON.stringify([r,t]);let n=s.get(i);if(!n){const c=Object.fromEntries(r.map(l=>[l.key,J(l)]));t&&(c[h]=U);const a=r[0]?.key;n={...e,arrayFields:c,defaultItemProps:z(r),getItemSummary:l=>a&&typeof l?.[a]=="string"&&l[a]||V("Row")},s.set(i,n)}return n}const C="cardListInCardTemplate",m={not:{context:C,is:!0}},Q={...K,[C]:(e,o)=>{const t=g(o.appState,e.props?.id);return t===void 0?void 0:t!==null}},X=d({type:"array",label:"Rows",icon:w(F,{}),arrayFields:{}},{all:[m,E]}),Z=e=>e.find(o=>!o.everySource&&(o.kind??"text")==="text")?.key??"title",R=new WeakMap;function $(e,o){let t=R.get(e);t||R.set(e,t=new WeakMap);let r=t.get(o);return r||t.set(o,r={...e,highlightedCard:o}),r}const tt=e=>{const o=new Set(S(null,{type:f,props:e}).map(t=>t.key));return t=>o.has(t)},k=new WeakMap;function et(e,o){let t=k.get(e);t||k.set(e,t=new WeakMap);let r=t.get(o);return r||t.set(o,r={...e,[p]:o}),r}const yt={fields:{_gSource:u("Source"),dataSource:d(M("Card content","Manual"),m),[T]:A(),_gCardList:u("Card list"),rowField:H("Shows","list"),[p]:X,highlightedCard:d(P("Highlighted card",w(O,{}),[{label:"None",value:""}],""),m),highlightBadge:d(W("Highlight badge","Most popular"),m),...q},resolveData:(e,o)=>{const t=e.props,r=o?.lastData?.props,s=B(N(t,r),p),i=x(s,tt(s));return i===t?e:{...e,props:i}},resolveFields:(e,o)=>{const t=e.props??{},r=D(f,Y(o.fields,e,o),t),s=!!g(o.appState,t.id),i=r[p];if(s||!i)return r;const n=S(o.appState,{type:f,props:t}),c=et(r,G(i,n,y(t.template))),a=r.highlightedCard;return a?$(c,v(a,j(t,{rows:p,label:Z(n)}))):c},showWhenFacts:Q};export{yt as CardListFields};
1
+ import{jsx as w}from"react/jsx-runtime";import{AccentIcon as k,ListIcon as F}from"efficient-easel/icons";import{isNodeList as L,newId as b}from"efficient-easel/data";import{group as u}from"efficient-easel/screen/lib/document/box-fields";import{COUNT_KEY_PROP as h}from"../../../../../../format/lib/content/block-sources.js";import{CARD_LIST_ROWS as p,CARD_LIST_TYPE as m,cardListFieldsOf as S,cardTemplateOwner as g,fieldsOfKind as I,namedRowField as T}from"../../../../../../format/lib/content/card-template.js";import{BLOCK_SOURCE_EDIT_PROP as E,NO_BLOCK_SOURCE as A,blockSourceEditField as M,blockSourceField as D,blockSourceFields as P}from"../../../block-source-fields.js";import{select as W}from"../../../box-fields.js";import{text as x}from"../../../controls.js";import{cardsFieldsFollowContent as N}from"../../../../../../format/lib/document/cards-template-on-read.js";import{cardFollowsContentSwitch as j}from"../../../../../../format/lib/document/card-content-switch.js";import{cardPicks as v,pickRow as B,withOwnCardKeys as K}from"../../../../../../format/lib/document/card-row-keys.js";import{ROW_LIVE_NUMBER_FIELD as U}from"../../../live-number-field.js";import{withShowWhen as d}from"../../../../../../format/lib/document/show-when-attach.js";import{CARD_ROW_FACTS as H,cardRowField as Y,cardRowFields as J,cardRowItemField as V}from"../../../card-row-fields.js";import{say as q}from"../../../../../../format/lib/editor-words.js";import{CardListSlots as z}from"../../../../../../format/lib/document/blocks/general/CardList/meta.js";function y(e){return L(e)?e.some(o=>{const t=o.props??{};return o.type==="Text"&&typeof t[h]=="string"&&T(t)?!0:Object.values(t).some(y)}):!1}const G=e=>Object.defineProperty(Object.fromEntries(e.map(o=>[o.key,""])),"key",{get:()=>b("row"),enumerable:!0}),_=new WeakMap;function Q(e,o,t){const r=o.filter(c=>!c.everySource);let s=_.get(e);s||_.set(e,s=new Map);const i=JSON.stringify([r,t]);let n=s.get(i);if(!n){const c=Object.fromEntries(r.map(l=>[l.key,V(l)]));t&&(c[h]=U);const a=r[0]?.key;n={...e,arrayFields:c,defaultItemProps:G(r),getItemSummary:l=>a&&typeof l?.[a]=="string"&&l[a]||q("Row")},s.set(i,n)}return n}const C="cardListInCardTemplate",f={not:{context:C,is:!0}},X={...H,[C]:(e,o)=>{const t=g(o.appState,e.props?.id);return t===void 0?void 0:t!==null}},Z=d({type:"array",label:"Rows",icon:w(F,{}),arrayFields:{}},{all:[f,A]}),$=e=>I(e,"text").find(o=>!o.everySource)?.key??"title",R=new WeakMap;function tt(e,o){let t=R.get(e);t||R.set(e,t=new WeakMap);let r=t.get(o);return r||t.set(o,r={...e,highlightedCard:o}),r}const et=e=>{const o=new Set(S(null,{type:m,props:e}).map(t=>t.key));return t=>o.has(t)},O=new WeakMap;function ot(e,o){let t=O.get(e);t||O.set(e,t=new WeakMap);let r=t.get(o);return r||t.set(o,r={...e,[p]:o}),r}const _t={fields:{_gSource:u("Source"),dataSource:d(D("Card content","Manual"),f),[E]:M(),_gCardList:u("Card list"),rowField:Y("Shows","list"),[p]:Z,highlightedCard:d(W("Highlighted card",w(k,{}),[{label:"None",value:""}],""),f),highlightBadge:d(x("Highlight badge","Most popular"),f),...z},resolveData:(e,o)=>{const t=e.props,r=o?.lastData?.props,s=K(j(t,r),p),i=N(s,et(s));return i===t?e:{...e,props:i}},resolveFields:(e,o)=>{const t=e.props??{},r=P(m,J(o.fields,e,o),t),s=!!g(o.appState,t.id),i=r[p];if(s||!i)return r;const n=S(o.appState,{type:m,props:t}),c=ot(r,Q(i,n,y(t.template))),a=r.highlightedCard;return a?tt(c,B(a,v(t,{rows:p,label:$(n)}))):c},showWhenFacts:X};export{_t as CardListFields};
@@ -1 +1 @@
1
- import{jsx as r}from"react/jsx-runtime";import{BlockBadgeIcon as n,BorderTopIcon as a,MediaLayoutInsetIcon as p}from"efficient-easel/icons";import{FieldGlyph as m}from"../../../../../components/FieldGlyph.js";import{COUNT_KEY_PROP as s}from"../../../../../../format/lib/content/block-sources.js";import{CARD_PLACE_PROP as d,OUTSIDE_FRAMED_CARD as l,framesItsCards as c}from"../../../../../../format/lib/content/card-place.js";import{CARD_ROW_LINK_PROP as f,cardTemplateOwner as h}from"../../../../../../format/lib/content/card-template.js";import{CARD_ROW_FACTS as u,cardRowField as g,cardRowFields as _,cardRowLinkField as w}from"../../../card-row-fields.js";import{textarea as R}from"../../../controls.js";import{group as b}from"efficient-easel/screen/lib/document/box-fields";import{keptByRow as x}from"efficient-easel/screen/lib/document/style-fields";import{segmented as F,select as P}from"../../../box-fields.js";import{withShowWhen as v}from"../../../../../../format/lib/document/show-when-attach.js";import{PH as C}from"../../../../../../format/lib/document/blocks/placeholders.js";import{toneField as T}from"../../shared-fields.js";import{blockAlignmentFields as A}from"../../../box-fields.js";import{VIEW_KEY_ACCESS as O}from"efficient-easel/screen/lib/document/box-fields";import{consentWordsKept as y,withConsentWordsRow as H}from"../../../consent-words-field.js";import{withLiveNumberRow as I}from"../../../live-number-field.js";function W(e,o){const t=o?.textStyle;if(typeof t!="string"||!t.startsWith("heading-"))return e;const{align:S,alignTablet:E,alignPhone:B,...i}=e;return i}const ee={fields:{text:R("Body",C.body),consentWords:y("text"),[s]:x("text"),...A("align",{access:O}),tone:T(),_gText:b("Text"),rowField:g("Shows","text"),[f]:w(),[d]:v(F("Place",r(n,{}),[{label:"In the card",value:"",picture:r(p,{})},{label:"On the top line",value:"top-line",picture:r(a,{})}],""),{not:{context:l,is:!0}}),tag:P("HTML tag",r(m,{noun:"heading"}),[{label:"Paragraph",value:"p"},{label:"H1",value:"h1"},{label:"H2",value:"h2"},{label:"H3",value:"h3"},{label:"H4",value:"h4"},{label:"H5",value:"h5"},{label:"H6",value:"h6"}],"p")},resolveFields:(e,o)=>W(I(H(_(o.fields,e,o),e.props,"text"),e.props),e.props),showWhenFacts:{...u,[l]:(e,o)=>{const t=h(o.appState,e.props?.id);return t===void 0?void 0:!c(t?.type)}}};export{ee as TextFields};
1
+ import{jsx as r}from"react/jsx-runtime";import{BlockBadgeIcon as n,BorderTopIcon as a,MediaLayoutInsetIcon as p}from"efficient-easel/icons";import{FieldGlyph as m}from"../../../../../components/FieldGlyph.js";import{COUNT_KEY_PROP as s}from"../../../../../../format/lib/content/block-sources.js";import{CARD_PLACE_PROP as d,OUTSIDE_FRAMED_CARD as l,framesItsCards as c}from"../../../../../../format/lib/content/card-place.js";import{CARD_ROW_LINK_PROP as f,cardTemplateOwner as h}from"../../../../../../format/lib/content/card-template.js";import{CARD_ROW_FACTS as u,cardRowField as g,cardRowFields as _,cardRowLinkField as w}from"../../../card-row-fields.js";import{textarea as R}from"../../../controls.js";import{group as b}from"efficient-easel/screen/lib/document/box-fields";import{keptByRow as x}from"efficient-easel/screen/lib/document/style-fields";import{segmented as F,select as P}from"../../../box-fields.js";import{withShowWhen as v}from"../../../../../../format/lib/document/show-when-attach.js";import{PH as C}from"../../../../../../format/lib/document/blocks/placeholders.js";import{toneField as T}from"../../shared-fields.js";import{blockAlignmentFields as A}from"../../../box-fields.js";import{VIEW_KEY_ACCESS as O}from"efficient-easel/screen/lib/document/box-fields";import{consentWordsKept as y,withConsentWordsRow as H}from"../../../consent-words-field.js";import{withLiveNumberRow as I}from"../../../live-number-field.js";function W(e,o){const t=o?.textStyle;if(typeof t!="string"||!t.startsWith("heading-"))return e;const{align:S,alignTablet:E,alignPhone:B,...i}=e;return i}const ee={fields:{text:R("Body",C.body),consentWords:y("text"),[s]:x("text"),...A("align",{access:O}),tone:T(),_gText:b("Text"),rowField:g("Shows",["text","date"]),[f]:w(),[d]:v(F("Place",r(n,{}),[{label:"In the card",value:"",picture:r(p,{})},{label:"On the top line",value:"top-line",picture:r(a,{})}],""),{not:{context:l,is:!0}}),tag:P("HTML tag",r(m,{noun:"heading"}),[{label:"Paragraph",value:"p"},{label:"H1",value:"h1"},{label:"H2",value:"h2"},{label:"H3",value:"h3"},{label:"H4",value:"h4"},{label:"H5",value:"h5"},{label:"H6",value:"h6"}],"p")},resolveFields:(e,o)=>W(I(H(_(o.fields,e,o),e.props,"text"),e.props),e.props),showWhenFacts:{...u,[l]:(e,o)=>{const t=h(o.appState,e.props?.id);return t===void 0?void 0:!c(t?.type)}}};export{ee as TextFields};
@@ -1,11 +1,11 @@
1
- import { type CardRowFieldKind, type CardRowFieldSpec } from "../../../format/lib/content/card-template.js";
1
+ import { type CardRowFieldKinds, type CardRowFieldSpec } from "../../../format/lib/content/card-template.js";
2
2
  import { type CustomField } from "./controls.js";
3
3
  import { type SelectField } from "efficient-easel/screen/lib/document/box-fields";
4
4
  import { type BlockShowWhenFacts, type ShowWhenRule } from "../../../format/lib/document/show-when-attach.js";
5
5
  export declare const OUTSIDE_CARD_TEMPLATE = "outsideCardTemplate";
6
6
  export declare const IN_CARD_TEMPLATE: ShowWhenRule;
7
7
  export declare const CARD_ROW_FACTS: BlockShowWhenFacts;
8
- export declare function cardRowField(label: string, kind: CardRowFieldKind, opts?: {
8
+ export declare function cardRowField(label: string, kind: CardRowFieldKinds, opts?: {
9
9
  content?: boolean;
10
10
  }): SelectField;
11
11
  export declare function cardRowLinkField(): SelectField;
@@ -17,7 +17,9 @@ export declare function cardListItemSlot(): {
17
17
  type: "slot";
18
18
  allow: string[];
19
19
  };
20
- export type CardRowFieldKind = "text" | "image" | "link" | "list" | "colour";
20
+ export type CardRowFieldKind = "text" | "image" | "link" | "list" | "colour" | "date";
21
+ export type CardRowFieldKinds = CardRowFieldKind | readonly CardRowFieldKind[];
22
+ export declare function fieldsOfKind(fields: readonly CardRowFieldSpec[], kind?: CardRowFieldKinds): readonly CardRowFieldSpec[];
21
23
  export interface CardRowFieldSpec {
22
24
  key: string;
23
25
  label: string;
@@ -60,13 +62,13 @@ export declare function hasCardTemplate(type: unknown): boolean;
60
62
  export declare function cardTemplateSlotNames(type: unknown): readonly string[];
61
63
  export declare function isCardTemplateSlot(type: unknown, slot: string): boolean;
62
64
  export declare function cardTemplateSlotLabel(type: unknown, slot: string): string | null;
63
- export declare function cardTemplateFields(type: string, kind?: CardRowFieldKind): readonly CardRowFieldSpec[];
65
+ export declare function cardTemplateFields(type: string, kind?: CardRowFieldKinds): readonly CardRowFieldSpec[];
64
66
  export declare function defaultListField(type: unknown, slot?: string): string;
65
67
  export declare function cardListShows(props: Record<string, unknown> | null | undefined, ownerType: unknown, slot?: string): string;
66
68
  export declare function cardTemplateFieldsOf(owner: {
67
69
  type?: unknown;
68
70
  props?: Record<string, unknown>;
69
- } | null | undefined, kind?: CardRowFieldKind, slot?: string): readonly CardRowFieldSpec[];
71
+ } | null | undefined, kind?: CardRowFieldKinds, slot?: string): readonly CardRowFieldSpec[];
70
72
  export declare function cardTemplateField(type: string | undefined, key: string, owner?: {
71
73
  type?: unknown;
72
74
  props?: Record<string, unknown>;
@@ -81,6 +83,7 @@ export declare function rowFieldSpec(copy: {
81
83
  } | null;
82
84
  } | null | undefined, key: string): CardRowFieldSpec | null;
83
85
  export declare function rowFieldWordsArePlain(copy: Parameters<typeof rowFieldSpec>[0], key: string): boolean;
86
+ export declare function rowFieldIsDate(copy: Parameters<typeof rowFieldSpec>[0], key: string): boolean;
84
87
  export declare function namedRowField(props: Record<string, unknown> | null | undefined, prop?: string): string;
85
88
  export declare function cardKeyOf(row: SourceRow, index: number): string;
86
89
  export declare function cardRow(value: unknown): SourceRow;
@@ -105,7 +108,7 @@ export declare function cardCopyPlace(appState: unknown, id: unknown): CardCopyP
105
108
  export declare function cardListFieldsOf(appState: unknown, list: {
106
109
  type?: unknown;
107
110
  props?: Record<string, unknown>;
108
- } | null | undefined, kind?: CardRowFieldKind): readonly CardRowFieldSpec[];
111
+ } | null | undefined, kind?: CardRowFieldKinds): readonly CardRowFieldSpec[];
109
112
  export declare function cardListProps(rows: readonly Record<string, unknown>[], fields: readonly CardRowFieldSpec[]): Record<string, unknown>;
110
113
  export declare const HOST_PART_TYPE = "HostPart";
111
114
  export {};
@@ -1 +1 @@
1
- import{blockSources as P,blockSourceSpec as T,declaredBlockSource as h}from"./block-sources.js";import{slotFieldBlocks as B}from"./slot-field-blocks.js";import{isNodeList as D}from"efficient-easel/data";import{BOX_TYPE as v}from"../document/container-blocks.js";import{globalRegistry as W}from"../global-registry.js";import{nonEmptyString as L}from"../non-empty-string.js";import{accentItalicRuns as M}from"../markup.js";import{withCardsTemplate as N}from"../document/cards-template-on-read.js";import{withCardListTemplate as K}from"../document/blocks/general/CardList/item-seed.js";import{ARTICLE_BODY_BLOCK as H,withArticleBodyTemplate as $}from"../document/article-body-seed.js";import{withLogosTemplate as Y}from"../document/blocks/general/Logos/card-seed.js";import{withFaqTemplate as j}from"../document/blocks/general/FAQ/card-seed.js";import{withFootprintListTemplate as U}from"../document/blocks/general/Footprint/card-seed.js";const O="template",Q="Card template",y="CardList",S=["Text","ImageBlock","ButtonBlock","Flex"],p="rowField",m="rowLinkField";function Le(){return{type:"slot",allow:[...S]}}const q=S.filter(e=>e!=="ButtonBlock"),R="items",_="itemFields";function Oe(){return{type:"slot",allow:[...q]}}const V=[{block:"OrderSummary",typedRows:"rows",linesBetween:!0,fields:[{key:"label",label:"Item"},{key:"meta",label:"Meta line"},{key:"amount",label:"Amount"}]},{block:"FAQ",typedRows:"items",fields:[{key:"question",label:"Question"},{key:"answer",label:"Answer",multiline:!0}],seedOnInsert:e=>j(e)},{block:"Footprint",typedRows:"offices",fields:[{key:"badge",label:"HQ",plain:!0},{key:"role",label:"Role"},{key:"city",label:"City"},{key:"country",label:"Region · country"},{key:"address",label:"Address"},{key:"phone",label:"Phone"},{key:"linkLabel",label:"Button"},{key:"href",label:"Link",kind:"link"}],seed:e=>U(e)},{block:"Cards",typedRows:"items",fields:[{key:"num",label:"Number"},{key:"since",label:"Corner note"},{key:"label",label:"Label"},{key:"title",label:"Card title"},{key:"value",label:"Value"},{key:"body",label:"Card body",multiline:!0},{key:"href",label:"Link",kind:"link"},{key:"count",label:"Count"},{key:"badge",label:"Highlight badge",everySource:!0,plain:!0}],seed:e=>N("Cards",e)},{block:"ProcessSteps",fields:[{key:"eyebrow",label:"Eyebrow"},{key:"title",label:"Title",mark:"accentItalic"},{key:"copy",label:"Body",multiline:!0},{key:"image",label:"Image",kind:"image",alt:"title"},{key:"tag",label:"Image tag"},{key:"specs",label:"Specs",kind:"list",fields:[{key:"label",label:"Label"},{key:"value",label:"Value"}]}],blocks:[{type:y,label:"Card list"}]},{block:"Logos",fields:[{key:"label",label:"Name"},{key:"kind",label:"Kind"}],seed:e=>Y(e)},{block:y,fields:[{key:"badge",label:"Highlight badge",everySource:!0,plain:!0}],typedRows:R,seed:e=>K(e)},{block:H,fields:[{key:"heading",label:"Subhead"},{key:"paragraph",label:"Paragraph",multiline:!0}],seed:e=>$(e)}];function f(){return W("efficient.card-templates",()=>new Map(V.map(e=>[e.block,e])))}function Se(e){for(const t of e){if(typeof t.block!="string"||!t.block)throw new Error("A card template names no block.");const r=[];for(const o of t.blocks??[]){if(typeof o?.type!="string"||!o.type)throw new Error(`The card template of ${t.block} names an empty block.`);if(o.type===I)throw new Error(`The card template of ${t.block} names "${I}" in its blocks. Only a host's seed puts a host part in a card template; a merchant never adds one. Take it out.`);r.some(l=>l.type===o.type)||r.push({type:o.type,label:o.label||o.type})}const n=[];for(const o of t.slots??[]){if(typeof o?.slot!="string"||!o.slot)throw new Error(`The card template of ${t.block} names an empty slot.`);const l=L(o.label),a=Array.isArray(o.fields)?{fields:o.fields.map(c=>({...c}))}:null;n.some(c=>c.slot===o.slot)||n.push({slot:o.slot,...l?{label:l}:null,...a})}const s=n.some(o=>o.fields);if(s&&(t.fields.some(o=>o.everySource)||P(t.block).length))throw new Error(`The card template of ${t.block} declares slot fields, but the block reads a source: slot fields take the place of a source's fields, so a block with slot fields reads no source.`);s?B().add(t.block):B().delete(t.block);const i=L(t.typedRows);f().set(t.block,{block:t.block,...n.length?{slots:n}:{},fields:t.fields.map(o=>({...o})),blocks:r,typedRows:i,...t.seed?{seed:t.seed}:{},...t.seedOnInsert?{seedOnInsert:t.seedOnInsert}:{},...t.linesBetween===!0?{linesBetween:!0}:{}})}}function X(e,t){const r=e?f().get(e)?.seed:void 0;return r?r(t):t}function Re(e,t){const r=G(e),n=(r.length?r:[O]).filter(l=>t[l]===void 0||Array.isArray(t[l])&&t[l].length===0);if(!n.length)return t;const s={...t};for(const l of n)delete s[l];const i=e?f().get(e)?.seedOnInsert:void 0,o=i?i(s):X(e,s);return o===s?t:o}function _e(){for(const e of f().values())if(e.blocks?.length)return!0;return!1}function Ae(e){return f().get(e)?.blocks??[]}function Ce(e){for(const t of f().values())if(t.blocks?.some(r=>r.type===e))return!0;return!1}function Ee(e){return typeof e=="string"&&f().get(e)?.typedRows||""}function Ie(e){return typeof e=="string"&&f().get(e)?.linesBetween===!0}function Fe(e){return typeof e=="string"&&f().has(e)}const z=[{slot:O}];function k(e){if(typeof e!="string")return[];const t=f().get(e);return t?t.slots??z:[]}function G(e){return k(e).map(t=>t.slot)}function J(e,t){return k(e).some(r=>r.slot===t)}function Pe(e,t){const r=k(e).find(n=>n.slot===t);return r?r.label??Q:null}function x(e,t){return t?k(e).find(r=>r.slot===t)?.fields:void 0}function Z(e,t){const r=f().get(e)?.fields??[];return t?r.filter(n=>(n.kind??"text")===t):r}function ee(e,t){if(typeof e!="string")return"";const r=x(e,t);return(r?r.filter(n=>n.kind==="list"):Z(e,"list"))[0]?.key??""}function te(e,t,r){return g(e)||ee(t,r)}function A(e,t,r){const n=typeof e?.type=="string"?e.type:"";if(!n)return[];const s=x(n,r);if(s)return t?s.filter(a=>(a.kind??"text")===t):s;const i=f().get(n)?.fields??[],o=T(h(e?.props))?.fields,l=o?.length?[...o.map(a=>({...a})),...i.filter(a=>a.everySource&&!o.some(c=>c.key===a.key))]:i;return t?l.filter(a=>(a.kind??"text")===t):l}function re(e,t,r,n){if(!e)return null;const s=x(e,n);return s?s.find(i=>i.key===t)??null:r?A(r).find(i=>i.key===t)??null:f().get(e)?.fields.find(i=>i.key===t)??null}function C(e,t){return!e||!t?null:e.fields?.find(r=>r.key===t)??re(e.ownerType,t,e.owner,e.slot)}function De(e,t){return C(e,t)?.plain===!0}function g(e,t=p){const r=e?.[t];return typeof r=="string"?r.trim():""}function ve(e,t){return e.key||String(t+1)}function We(e){const t={};if(e&&typeof e=="object"&&!Array.isArray(e))for(const[r,n]of Object.entries(e))typeof n=="string"&&(t[r]=n);return t}const oe="hideWhenRowEmpty";function Me(e,t){const r=e[oe];return!t||!Array.isArray(r)||!r.length?!1:r.every(n=>typeof n!="string"||!t[n]?.trim())}const w={Text:{text:p,href:m},ImageBlock:{src:p,href:m},ButtonBlock:{label:p,href:m},LogoBlock:{alt:p,href:m},Breadcrumb:{currentCrumb:p}},Ne=w,ne=new Set(["ButtonBlock.label","LogoBlock.alt"]);function Ke(e,t,r){return le(e,t,r)&&!ne.has(`${e}.${r}`)}function le(e,t,r){return se(e,t,r)!==""}function se(e,t,r){const n=w[e]?.[r];return n?g(t,n):""}function E(e,t){return!t||!e?null:e[t]??""}function ie(e,t){return E(e,t)?.trim()||void 0}function He(e,t,r,n,s,i){if(!r)return t;let o=null;for(const[l,a]of Object.entries(w[e]??{})){const c=g(t,a),u=E(r,c);if(u!==null){if(o??={...t},a===m){o[l]=ie(r,c);continue}o[l]=C({ownerType:n,fields:s,slot:i},c)?.mark==="accentItalic"?M(u):u}}return o??t}function b(e,t){const r=e?.data?.content;if(!Array.isArray(r)||typeof t!="string")return;const n=(i,o)=>{for(const l of i){if(l?.props?.id===t)return o;for(const[a,c]of Object.entries(l?.props??{})){if(!D(c))continue;const u=J(l.type,a)?{owner:l,slot:a,direct:!0,nested:o!==null,underBox:!1}:o&&{owner:o.owner,slot:o.slot,direct:!1,nested:o.nested,underBox:o.underBox||l.type===v},d=n(c,u);if(d!==void 0)return d}}},s=n(r,null);return s===void 0?null:s}function ae(e,t){const r=b(e,t);return r&&r.owner}function ce(e,t){const r=b(e,t);return r&&r.slot}function $e(e,t){const r=b(e,t);return r&&(r.direct?r.owner:null)}function Ye(e,t){const r=b(e,t);if(r!==void 0)return r===null?{inCopy:!1,nestedCopy:!1,underBox:!1}:{inCopy:!0,nestedCopy:r.nested,underBox:r.underBox}}function je(e,t,r){if(t?.type!==y)return[];const n=ae(e,t.props?.id);if(!n){const l=T(h(t.props))?.fields,a=l?.length?l.map(d=>({...d})):fe(t.props),c=(f().get(y)?.fields??[]).filter(d=>d.everySource&&!a.some(F=>F.key===d.key)),u=[...a,...c];return r?u.filter(d=>(d.kind??"text")===r):u}const s=ce(e,t.props?.id)??void 0,i=te(t.props,n.type,s),o=i&&A(n,"list",s).find(l=>l.key===i)?.fields||[];return r?o.filter(l=>(l.kind??"text")===r):o}function Ue(e,t){return{[p]:"",[R]:e.map(r=>({...r})),[_]:t.map(r=>({...r}))}}function fe(e,t){const r=e?.[_];if(!Array.isArray(r))return[];const n=r.flatMap(s=>{if(!s||typeof s!="object")return[];const{key:i,label:o,kind:l,multiline:a,alt:c,next:u}=s;if(typeof i!="string"||!i||typeof o!="string")return[];const d=l==="image"||l==="link"||l==="colour"?l:void 0;return[{key:i,label:o,...d?{kind:d}:{},...a===!0?{multiline:!0}:{},...typeof c=="string"&&c?{alt:c}:{},...typeof u=="string"&&u?{next:u}:{}}]});return t?n.filter(s=>(s.kind??"text")===t):n}const I="HostPart";export{oe as BOX_HIDE_WHEN_ROW_EMPTY,_ as CARD_LIST_FIELDS,q as CARD_LIST_ITEM_BLOCKS,R as CARD_LIST_ROWS,y as CARD_LIST_TYPE,p as CARD_ROW_FIELD_PROP,m as CARD_ROW_LINK_PROP,S as CARD_TEMPLATE_BLOCKS,Q as CARD_TEMPLATE_LABEL,O as CARD_TEMPLATE_SLOT,I as HOST_PART_TYPE,Ne as ROW_BOUND_PROPS,ne as ROW_PART_BY_WORDS,Ye as cardCopyPlace,ve as cardKeyOf,je as cardListFieldsOf,Oe as cardListItemSlot,Ue as cardListProps,te as cardListShows,We as cardRow,Ae as cardTemplateBlocks,$e as cardTemplateCardOwner,re as cardTemplateField,Z as cardTemplateFields,A as cardTemplateFieldsOf,Ie as cardTemplateLinesBetween,ae as cardTemplateOwner,Le as cardTemplateSlot,Pe as cardTemplateSlotLabel,G as cardTemplateSlotNames,ce as cardTemplateSlotOf,Ee as cardTemplateTypedRows,_e as cardTemplatesNameBlocks,ee as defaultListField,Fe as hasCardTemplate,Ce as isCardTemplateBlock,J as isCardTemplateSlot,g as namedRowField,Se as registerCardTemplates,le as rowBound,se as rowFieldOf,C as rowFieldSpec,E as rowFieldText,De as rowFieldWordsArePlain,He as rowFilledProps,ie as rowLinkText,Ke as rowPartByKey,Me as templateBoxIsEmpty,Re as templateOnInsert,X as templateOnRead};
1
+ import{blockSources as D,blockSourceSpec as B,declaredBlockSource as L}from"./block-sources.js";import{slotFieldBlocks as O}from"./slot-field-blocks.js";import{isNodeList as v}from"efficient-easel/data";import{BOX_TYPE as W}from"../document/container-blocks.js";import{globalRegistry as K}from"../global-registry.js";import{nonEmptyString as S}from"../non-empty-string.js";import{accentItalicRuns as M}from"../markup.js";import{withCardsTemplate as N}from"../document/cards-template-on-read.js";import{withCardListTemplate as H}from"../document/blocks/general/CardList/item-seed.js";import{ARTICLE_BODY_BLOCK as $,withArticleBodyTemplate as Y}from"../document/article-body-seed.js";import{withLogosTemplate as j}from"../document/blocks/general/Logos/card-seed.js";import{withFaqTemplate as U}from"../document/blocks/general/FAQ/card-seed.js";import{withFootprintListTemplate as Q}from"../document/blocks/general/Footprint/card-seed.js";const R="template",q="Card template",k="CardList",_=["Text","ImageBlock","ButtonBlock","Flex"],p="rowField",y="rowLinkField";function Oe(){return{type:"slot",allow:[..._]}}const V=_.filter(e=>e!=="ButtonBlock"),A="items",C="itemFields";function Se(){return{type:"slot",allow:[...V]}}function m(e,t){if(!t)return e;const o=typeof t=="string"?[t]:t;return e.filter(n=>o.includes(n.kind??"text"))}const X=[{block:"OrderSummary",typedRows:"rows",linesBetween:!0,fields:[{key:"label",label:"Item"},{key:"meta",label:"Meta line"},{key:"amount",label:"Amount"}]},{block:"FAQ",typedRows:"items",fields:[{key:"question",label:"Question"},{key:"answer",label:"Answer",multiline:!0}],seedOnInsert:e=>U(e)},{block:"Footprint",typedRows:"offices",fields:[{key:"badge",label:"HQ",plain:!0},{key:"role",label:"Role"},{key:"city",label:"City"},{key:"country",label:"Region · country"},{key:"address",label:"Address"},{key:"phone",label:"Phone"},{key:"linkLabel",label:"Button"},{key:"href",label:"Link",kind:"link"}],seed:e=>Q(e)},{block:"Cards",typedRows:"items",fields:[{key:"num",label:"Number"},{key:"since",label:"Corner note"},{key:"label",label:"Label"},{key:"title",label:"Card title"},{key:"value",label:"Value"},{key:"body",label:"Card body",multiline:!0},{key:"href",label:"Link",kind:"link"},{key:"count",label:"Count"},{key:"badge",label:"Highlight badge",everySource:!0,plain:!0}],seed:e=>N("Cards",e)},{block:"ProcessSteps",fields:[{key:"eyebrow",label:"Eyebrow"},{key:"title",label:"Title",mark:"accentItalic"},{key:"copy",label:"Body",multiline:!0},{key:"image",label:"Image",kind:"image",alt:"title"},{key:"tag",label:"Image tag"},{key:"specs",label:"Specs",kind:"list",fields:[{key:"label",label:"Label"},{key:"value",label:"Value"}]}],blocks:[{type:k,label:"Card list"}]},{block:"Logos",fields:[{key:"label",label:"Name"},{key:"kind",label:"Kind"}],seed:e=>j(e)},{block:k,fields:[{key:"badge",label:"Highlight badge",everySource:!0,plain:!0}],typedRows:A,seed:e=>H(e)},{block:$,fields:[{key:"heading",label:"Subhead"},{key:"paragraph",label:"Paragraph",multiline:!0}],seed:e=>Y(e)}];function u(){return K("efficient.card-templates",()=>new Map(X.map(e=>[e.block,e])))}function Re(e){for(const t of e){if(typeof t.block!="string"||!t.block)throw new Error("A card template names no block.");const o=[];for(const r of t.blocks??[]){if(typeof r?.type!="string"||!r.type)throw new Error(`The card template of ${t.block} names an empty block.`);if(r.type===F)throw new Error(`The card template of ${t.block} names "${F}" in its blocks. Only a host's seed puts a host part in a card template; a merchant never adds one. Take it out.`);o.some(l=>l.type===r.type)||o.push({type:r.type,label:r.label||r.type})}const n=[];for(const r of t.slots??[]){if(typeof r?.slot!="string"||!r.slot)throw new Error(`The card template of ${t.block} names an empty slot.`);const l=S(r.label),c=Array.isArray(r.fields)?{fields:r.fields.map(a=>({...a}))}:null;n.some(a=>a.slot===r.slot)||n.push({slot:r.slot,...l?{label:l}:null,...c})}const s=n.some(r=>r.fields);if(s&&(t.fields.some(r=>r.everySource)||D(t.block).length))throw new Error(`The card template of ${t.block} declares slot fields, but the block reads a source: slot fields take the place of a source's fields, so a block with slot fields reads no source.`);s?O().add(t.block):O().delete(t.block);const i=S(t.typedRows);u().set(t.block,{block:t.block,...n.length?{slots:n}:{},fields:t.fields.map(r=>({...r})),blocks:o,typedRows:i,...t.seed?{seed:t.seed}:{},...t.seedOnInsert?{seedOnInsert:t.seedOnInsert}:{},...t.linesBetween===!0?{linesBetween:!0}:{}})}}function z(e,t){const o=e?u().get(e)?.seed:void 0;return o?o(t):t}function _e(e,t){const o=J(e),n=(o.length?o:[R]).filter(l=>t[l]===void 0||Array.isArray(t[l])&&t[l].length===0);if(!n.length)return t;const s={...t};for(const l of n)delete s[l];const i=e?u().get(e)?.seedOnInsert:void 0,r=i?i(s):z(e,s);return r===s?t:r}function Ae(){for(const e of u().values())if(e.blocks?.length)return!0;return!1}function Ce(e){return u().get(e)?.blocks??[]}function Ee(e){for(const t of u().values())if(t.blocks?.some(o=>o.type===e))return!0;return!1}function Ie(e){return typeof e=="string"&&u().get(e)?.typedRows||""}function Fe(e){return typeof e=="string"&&u().get(e)?.linesBetween===!0}function Pe(e){return typeof e=="string"&&u().has(e)}const G=[{slot:R}];function b(e){if(typeof e!="string")return[];const t=u().get(e);return t?t.slots??G:[]}function J(e){return b(e).map(t=>t.slot)}function Z(e,t){return b(e).some(o=>o.slot===t)}function De(e,t){const o=b(e).find(n=>n.slot===t);return o?o.label??q:null}function x(e,t){return t?b(e).find(o=>o.slot===t)?.fields:void 0}function ee(e,t){const o=u().get(e)?.fields??[];return m(o,t)}function te(e,t){if(typeof e!="string")return"";const o=x(e,t);return(o?m(o,"list"):ee(e,"list"))[0]?.key??""}function oe(e,t,o){return T(e)||te(t,o)}function E(e,t,o){const n=typeof e?.type=="string"?e.type:"";if(!n)return[];const s=x(n,o);if(s)return m(s,t);const i=u().get(n)?.fields??[],r=B(L(e?.props))?.fields,l=r?.length?[...r.map(c=>({...c})),...i.filter(c=>c.everySource&&!r.some(a=>a.key===c.key))]:i;return m(l,t)}function re(e,t,o,n){if(!e)return null;const s=x(e,n);return s?s.find(i=>i.key===t)??null:o?E(o).find(i=>i.key===t)??null:u().get(e)?.fields.find(i=>i.key===t)??null}function w(e,t){return!e||!t?null:e.fields?.find(o=>o.key===t)??re(e.ownerType,t,e.owner,e.slot)}function ve(e,t){return w(e,t)?.plain===!0}function We(e,t){return w(e,t)?.kind==="date"}function T(e,t=p){const o=e?.[t];return typeof o=="string"?o.trim():""}function Ke(e,t){return e.key||String(t+1)}function Me(e){const t={};if(e&&typeof e=="object"&&!Array.isArray(e))for(const[o,n]of Object.entries(e))typeof n=="string"&&(t[o]=n);return t}const ne="hideWhenRowEmpty";function Ne(e,t){const o=e[ne];return!t||!Array.isArray(o)||!o.length?!1:o.every(n=>typeof n!="string"||!t[n]?.trim())}const h={Text:{text:p,href:y},ImageBlock:{src:p,href:y},ButtonBlock:{label:p,href:y},LogoBlock:{alt:p,href:y},Breadcrumb:{currentCrumb:p}},He=h,le=new Set(["ButtonBlock.label","LogoBlock.alt"]);function $e(e,t,o){return se(e,t,o)&&!le.has(`${e}.${o}`)}function se(e,t,o){return ie(e,t,o)!==""}function ie(e,t,o){const n=h[e]?.[o];return n?T(t,n):""}function I(e,t){return!t||!e?null:e[t]??""}function ae(e,t){return I(e,t)?.trim()||void 0}function Ye(e,t,o,n,s,i){if(!o)return t;let r=null;for(const[l,c]of Object.entries(h[e]??{})){const a=T(t,c),f=I(o,a);if(f!==null){if(r??={...t},c===y){r[l]=ae(o,a);continue}r[l]=w({ownerType:n,fields:s,slot:i},a)?.mark==="accentItalic"?M(f):f}}return r??t}function g(e,t){const o=e?.data?.content;if(!Array.isArray(o)||typeof t!="string")return;const n=(i,r)=>{for(const l of i){if(l?.props?.id===t)return r;for(const[c,a]of Object.entries(l?.props??{})){if(!v(a))continue;const f=Z(l.type,c)?{owner:l,slot:c,direct:!0,nested:r!==null,underBox:!1}:r&&{owner:r.owner,slot:r.slot,direct:!1,nested:r.nested,underBox:r.underBox||l.type===W},d=n(a,f);if(d!==void 0)return d}}},s=n(o,null);return s===void 0?null:s}function ce(e,t){const o=g(e,t);return o&&o.owner}function ue(e,t){const o=g(e,t);return o&&o.slot}function je(e,t){const o=g(e,t);return o&&(o.direct?o.owner:null)}function Ue(e,t){const o=g(e,t);if(o!==void 0)return o===null?{inCopy:!1,nestedCopy:!1,underBox:!1}:{inCopy:!0,nestedCopy:o.nested,underBox:o.underBox}}function Qe(e,t,o){if(t?.type!==k)return[];const n=ce(e,t.props?.id);if(!n){const l=B(L(t.props))?.fields,c=l?.length?l.map(d=>({...d})):fe(t.props),a=(u().get(k)?.fields??[]).filter(d=>d.everySource&&!c.some(P=>P.key===d.key)),f=[...c,...a];return m(f,o)}const s=ue(e,t.props?.id)??void 0,i=oe(t.props,n.type,s),r=i&&E(n,"list",s).find(l=>l.key===i)?.fields||[];return m(r,o)}function qe(e,t){return{[p]:"",[A]:e.map(o=>({...o})),[C]:t.map(o=>({...o}))}}function fe(e,t){const o=e?.[C];if(!Array.isArray(o))return[];const n=o.flatMap(s=>{if(!s||typeof s!="object")return[];const{key:i,label:r,kind:l,multiline:c,alt:a,next:f}=s;if(typeof i!="string"||!i||typeof r!="string")return[];const d=l==="image"||l==="link"||l==="colour"||l==="date"?l:void 0;return[{key:i,label:r,...d?{kind:d}:{},...c===!0?{multiline:!0}:{},...typeof a=="string"&&a?{alt:a}:{},...typeof f=="string"&&f?{next:f}:{}}]});return m(n,t)}const F="HostPart";export{ne as BOX_HIDE_WHEN_ROW_EMPTY,C as CARD_LIST_FIELDS,V as CARD_LIST_ITEM_BLOCKS,A as CARD_LIST_ROWS,k as CARD_LIST_TYPE,p as CARD_ROW_FIELD_PROP,y as CARD_ROW_LINK_PROP,_ as CARD_TEMPLATE_BLOCKS,q as CARD_TEMPLATE_LABEL,R as CARD_TEMPLATE_SLOT,F as HOST_PART_TYPE,He as ROW_BOUND_PROPS,le as ROW_PART_BY_WORDS,Ue as cardCopyPlace,Ke as cardKeyOf,Qe as cardListFieldsOf,Se as cardListItemSlot,qe as cardListProps,oe as cardListShows,Me as cardRow,Ce as cardTemplateBlocks,je as cardTemplateCardOwner,re as cardTemplateField,ee as cardTemplateFields,E as cardTemplateFieldsOf,Fe as cardTemplateLinesBetween,ce as cardTemplateOwner,Oe as cardTemplateSlot,De as cardTemplateSlotLabel,J as cardTemplateSlotNames,ue as cardTemplateSlotOf,Ie as cardTemplateTypedRows,Ae as cardTemplatesNameBlocks,te as defaultListField,m as fieldsOfKind,Pe as hasCardTemplate,Ee as isCardTemplateBlock,Z as isCardTemplateSlot,T as namedRowField,Re as registerCardTemplates,se as rowBound,We as rowFieldIsDate,ie as rowFieldOf,w as rowFieldSpec,I as rowFieldText,ve as rowFieldWordsArePlain,Ye as rowFilledProps,ae as rowLinkText,$e as rowPartByKey,Ne as templateBoxIsEmpty,_e as templateOnInsert,z as templateOnRead};
@@ -1,5 +1,5 @@
1
1
  import type { SourceRow } from "./block-sources.js";
2
- import type { CardRowFieldKind, CardRowFieldSpec } from "./card-template.js";
2
+ import type { CardRowFieldKinds, CardRowFieldSpec } from "./card-template.js";
3
3
  export declare const RECORD_TITLE_FIELD = "title";
4
4
  export declare function recordPictureAlt(key: string): string;
5
5
  export interface RecordForRow {
@@ -11,4 +11,4 @@ export interface RecordForRow {
11
11
  }[] | null;
12
12
  }
13
13
  export declare function recordRow(record: RecordForRow, dateWords?: (iso: string) => string): SourceRow;
14
- export declare function recordRowFields(key: string, kind: CardRowFieldKind): readonly CardRowFieldSpec[];
14
+ export declare function recordRowFields(key: string, kind: CardRowFieldKinds): readonly CardRowFieldSpec[];
@@ -1 +1 @@
1
- import{PRODUCT_RECORD_TYPE as c,recordFields as n,recordTypeSpec as p}from"./record-types.js";import{say as y}from"../editor-words.js";const a="title";function s(e){return`${e}Alt`}function m(e){const r=e.find(t=>typeof t?.url=="string");return{url:r?.url??"",alt:typeof r?.alt=="string"?r.alt:""}}function R(e,r){const t={[a]:typeof e.title=="string"?e.title:""};for(const{key:o,kind:l}of e.schema??[]){const i=e.fields?.[o];if(l==="text"&&typeof i=="string")t[o]=i;else if(l==="date"&&typeof i=="string")t[o]=i&&r?r(i):i;else if(l==="images"&&Array.isArray(i)){const{url:f,alt:u}=m(i);t[o]=f,t[s(o)]=u}}return t}function T(e,r){return e===c||!p(e)?[]:r==="image"?n(e,["images"]).map(t=>({key:t.key,label:t.label,kind:"image",alt:s(t.key)})):r!=="text"?[]:[{key:a,label:y("Title")},...n(e,["text","date"]).map(t=>({key:t.key,label:t.label}))]}export{a as RECORD_TITLE_FIELD,s as recordPictureAlt,R as recordRow,T as recordRowFields};
1
+ import{PRODUCT_RECORD_TYPE as p,recordFields as n,recordTypeSpec as c}from"./record-types.js";import{say as y}from"../editor-words.js";const a="title";function f(e){return`${e}Alt`}function m(e){const r=e.find(t=>typeof t?.url=="string");return{url:r?.url??"",alt:typeof r?.alt=="string"?r.alt:""}}function T(e,r){const t={[a]:typeof e.title=="string"?e.title:""};for(const{key:o,kind:l}of e.schema??[]){const i=e.fields?.[o];if(l==="text"&&typeof i=="string")t[o]=i;else if(l==="date"&&typeof i=="string")t[o]=i&&r?r(i):i;else if(l==="images"&&Array.isArray(i)){const{url:s,alt:u}=m(i);t[o]=s,t[f(o)]=u}}return t}function g(e,r){return typeof r!="string"?r.flatMap(t=>g(e,t)):e===p||!c(e)?[]:r==="image"?n(e,["images"]).map(t=>({key:t.key,label:t.label,kind:"image",alt:f(t.key)})):r!=="text"?[]:[{key:a,label:y("Title")},...n(e,["text","date"]).map(t=>({key:t.key,label:t.label}))]}export{a as RECORD_TITLE_FIELD,f as recordPictureAlt,T as recordRow,g as recordRowFields};
@@ -22,7 +22,8 @@ interface TextProps {
22
22
  partDeclare?: boolean;
23
23
  plain?: boolean;
24
24
  href?: string;
25
+ date?: string;
25
26
  }
26
27
  export declare function headingLevelOfStyle(id: string): HeadingLevel;
27
- export default function Text({ text, labelId, number, align, alignTablet, alignPhone, tone, contained, hero, pad, tag, textStyle, ownWidth, partAlign, onLine, partKey, partDeclare, plain, href }: TextProps): import("react").JSX.Element;
28
+ export default function Text({ text, labelId, number, align, alignTablet, alignPhone, tone, contained, hero, pad, tag, textStyle, ownWidth, partAlign, onLine, partKey, partDeclare, plain, href, date }: TextProps): import("react").JSX.Element;
28
29
  export {};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as B}from"react/jsx-runtime";import E from"./BlockFrame.js";import{renderGold as g,renderHeadline as G,renderPlain as _,splitParagraphs as H}from"./goldPhrases.js";import{headingLook as M}from"./Heading.js";import{alignViewClasses as U,BLOCK_ALIGN_PLACE as y}from"../../format/lib/content/block-align.js";import{useDrawsAtEdge as X}from"./InBoxContext.js";import{textTagOf as D}from"../../format/lib/content/text-tag.js";import{KICKER_NUMBER_ATTR as F,kickerLead as V}from"../lib/content/page-contents.js";import{isTextStyleId as W}from"../lib/document/part-styles.js";import{faceClassOf as w}from"../../format/lib/text-style-face.js";import{useMirroredCopy as Z}from"./MirrorContext.js";import{mirroredTextClasses as A}from"../../format/lib/content/mirror-cards.js";import q from"./PartStyledKind.js";import{SiteLink as J}from"../lib/site-runtime.js";import{markupHoldsLink as Q}from"../../format/lib/markup.js";const p={bodyUpTo800:"max-view-wide:text-[length:var(--size-body,14px)]",bodySmall:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,17px)]",label:"text-[length:var(--size-label,13px)]"},Y="underline underline-offset-2",n=e=>e?` ${e}`:"";function ee(e,o,l,a){const c=U("place",e,o,l,{atSectionLine:!a});return c?` ${c}`:""}const te={left:`text-left${n(y.left)}`,center:`text-left${n(y.center)}`,right:`text-left${n(y.right)}`},re=`max-w-[380px] ${p.bodySmall} leading-[1.5] opacity-80 ${p.bodyUpTo800}`,se={default:"text-fg",dim:"text-fg-dim"};function ne(e){return String(Math.min(Number(e.slice(8)),6))}function ae({text:e,labelId:o,number:l,align:a,alignTablet:c,alignPhone:O,tone:$,contained:T,hero:j=!1,pad:f,tag:z,textStyle:N,ownWidth:I=!1,partAlign:b,onLine:m=!1,partKey:L,partDeclare:K=!1,plain:u=!1,href:S}){const P=t=>L?r(q,{kind:L,declare:K,children:t}):t,k=S&&!Q(e)?S:void 0,h=t=>P(k?r(J,{href:k,className:Y,newTab:"auto",children:t}):t),v=Z(),R=X();if(j)return r("p",{className:re,children:g(e)});const d=l?r("span",{[F]:"",children:V(l)}):void 0,i=W(N)?N:void 0,C=`${i?`${w({id:i})} `:""}${I?"":"max-w-[680px] "}whitespace-pre-line ${i==="body-5"?p.label:p.bodyLarge} leading-[1.7]${n(a?te[a]:"")}${ee(a,c,O,R)}${n($?se[$]:"")}${n(A(v,a,b))}`,x=D(z);if(i?.startsWith("heading-")){const t=ne(i),s=M(t,w({id:i}));return r(E,{contained:T,className:m?"":"py-6",pad:f?{values:f,frame:m?0:24}:void 0,children:B(x,{id:o,className:`${s.className}${n(A(v,void 0,b))}`,style:s.style,children:[d,h(G(e.trim(),!1,u))]})})}return r(E,{contained:T,className:m?"":"py-4",pad:f?{values:f,frame:m?0:16}:void 0,children:x==="p"?H(e).map((t,s)=>r("p",{id:s===0?o:void 0,className:C,children:h(u?_(t,s===0?d:void 0):g(t,!1,s===0?d:void 0))},s)):r(x,{id:o,className:C,children:h(u?_(e.trim(),d):g(e.trim(),!1,d))})})}export{ae as default,ne as headingLevelOfStyle};
1
+ import{jsx as r,jsxs as E,Fragment as H}from"react/jsx-runtime";import w from"./BlockFrame.js";import{renderGold as y,renderHeadline as M,renderPlain as A,splitParagraphs as U}from"./goldPhrases.js";import{headingLook as D}from"./Heading.js";import{alignViewClasses as X,BLOCK_ALIGN_PLACE as $}from"../../format/lib/content/block-align.js";import{useDrawsAtEdge as V}from"./InBoxContext.js";import{textTagOf as W}from"../../format/lib/content/text-tag.js";import{KICKER_NUMBER_ATTR as Z,kickerLead as q}from"../lib/content/page-contents.js";import{isTextStyleId as J}from"../lib/document/part-styles.js";import{faceClassOf as O}from"../../format/lib/text-style-face.js";import{useMirroredCopy as Q}from"./MirrorContext.js";import{mirroredTextClasses as P}from"../../format/lib/content/mirror-cards.js";import Y from"./PartStyledKind.js";import j from"./PostDate.js";import{SiteLink as ee}from"../lib/site-runtime.js";import{markupHoldsLink as te}from"../../format/lib/markup.js";const u={bodyUpTo800:"max-view-wide:text-[length:var(--size-body,14px)]",bodySmall:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,17px)]",label:"text-[length:var(--size-label,13px)]"},re="underline underline-offset-2",s=e=>e?` ${e}`:"";function ne(e,l,m,a){const c=X("place",e,l,m,{atSectionLine:!a});return c?` ${c}`:""}const se={left:`text-left${s($.left)}`,center:`text-left${s($.center)}`,right:`text-left${s($.right)}`},ae=`max-w-[380px] ${u.bodySmall} leading-[1.5] opacity-80 ${u.bodyUpTo800}`,ie={default:"text-fg",dim:"text-fg-dim"};function oe(e){return String(Math.min(Number(e.slice(8)),6))}function le({text:e,labelId:l,number:m,align:a,alignTablet:c,alignPhone:z,tone:T,contained:N,hero:I=!1,pad:f,tag:K,textStyle:b,ownWidth:R=!1,partAlign:L,onLine:p=!1,partKey:S,partDeclare:B=!1,plain:h=!1,href:k,date:d}){const F=t=>S?r(Y,{kind:S,declare:B,children:t}):t,_=k&&!te(e)?k:void 0,g=t=>F(_?r(ee,{href:_,className:re,newTab:"auto",children:t}):t),v=Q(),G=V();if(I)return r("p",{className:ae,children:y(e)});const i=m?r("span",{[Z]:"",children:q(m)}):void 0,o=J(b)?b:void 0,C=`${o?`${O({id:o})} `:""}${R?"":"max-w-[680px] "}whitespace-pre-line ${o==="body-5"?u.label:u.bodyLarge} leading-[1.7]${s(a?se[a]:"")}${ne(a,c,z,G)}${s(T?ie[T]:"")}${s(P(v,a,L))}`,x=W(K);if(o?.startsWith("heading-")){const t=oe(o),n=D(t,O({id:o}));return r(w,{contained:N,className:p?"":"py-6",pad:f?{values:f,frame:p?0:24}:void 0,children:E(x,{id:l,className:`${n.className}${s(P(v,void 0,L))}`,style:n.style,children:[i,g(d?r(j,{at:d}):M(e.trim(),!1,h))]})})}return r(w,{contained:N,className:p?"":"py-4",pad:f?{values:f,frame:p?0:16}:void 0,children:x==="p"&&!d?U(e).map((t,n)=>r("p",{id:n===0?l:void 0,className:C,children:g(h?A(t,n===0?i:void 0):y(t,!1,n===0?i:void 0))},n)):r(x,{id:l,className:C,children:g(d?E(H,{children:[i,r(j,{at:d})]}):h?A(e.trim(),i):y(e.trim(),!1,i))})})}export{le as default,oe as headingLevelOfStyle};
@@ -1 +1 @@
1
- import{Fragment as h,jsx as o}from"react/jsx-runtime";import{CardPressTitled as H,CardRowDrawn as y}from"../../../../../components/CardRowContext.js";import{CountDrawn as I}from"../../../../../components/CountRowsContext.js";import{KickerNumberDrawn as M}from"../../../../../components/PageContentsContext.js";import{KICKER_NUMBER_PROP as U}from"../../../../content/page-contents.js";import{WALL_LABEL_ID_PROP as V}from"../../../wall-labels.js";import{CARD_PRESS_TITLE_PROP as z}from"../../../card-press-titles.js";import{CARD_ROW_LINK_PROP as q,namedRowField as g,rowFieldWordsArePlain as G,rowPartByKey as J}from"../../../../../../format/lib/content/card-template.js";import{TOP_LINE_ATTRIBUTE as Q,TOP_LINE_CLASS as X,cardPlaceOf as Y,framesItsCards as Z}from"../../../../../../format/lib/content/card-place.js";import{blockSetsItsWidth as $,blockSizeValuesOf as ee}from"../../../../content/block-size.js";import{linkedCount as O}from"../../../../../../format/lib/content/count-numbers.js";import{nonEmptyString as te}from"../../../../../../format/lib/non-empty-string.js";import{padValuesOf as ne}from"../../../../content/section-padding.js";import re from"../../../../../components/Text.js";import{hidableText as c,readHidable as ie}from"efficient-easel/draw";import{PH as C}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as oe}from"../../scaffold.js";import{readPartStyle as de}from"../../../part-styles.js";import{TextMeta as ae}from"../../../../../../format/lib/document/blocks/general/Text/meta.js";const Ce={...ae,render:t=>{const{text:f,align:K,alignTablet:L,alignPhone:S,tone:A,tag:D,contained:N,editor:s}=t;if(ie(f).hidden)return o(h,{});const{textStyle:x,align:k}=de(t,"text"),F=x?.startsWith("heading-")?C.heading:C.body,W=J("Text",t,"text")?{partKey:"text",partDeclare:!!s?.isEditing}:{},T=t[V],B=typeof T=="string"?T:void 0,P=t[z]===!0?g(t):"",a=(e,n,r,i,d)=>P?o(H,{field:P,children:l=>_(e,l,n,r,i,d)}):_(e,B,n,r,i,d),_=(e,n,r,i,d,l)=>o(re,{...W,plain:d,href:l,labelId:n,text:oe(e,F,s)??"",number:r,align:K,alignTablet:L,alignPhone:S,tone:A,tag:D,textStyle:x,partAlign:k,ownWidth:$(ee(t)),contained:N,pad:ne(t),onLine:i}),R=e=>!e?.trim()&&!s?.isEditing,m=g(t),j=g(t,q),u=e=>te(e.href),b=(e,n)=>!!m&&!!n&&G(e,m),p=O(t);if(p)return o(I,{countKey:p,children:e=>a(e??c(f))});const w=()=>{if(!m){const e=t[U],n=r=>typeof e=="string"?a(c(f),e,void 0,void 0,r):o(M,{id:t.id,children:i=>a(c(f),i,void 0,void 0,r)});return j?o(y,{type:"Text",props:t,children:r=>n(u(r))}):n()}return o(y,{type:"Text",props:t,children:(e,n,r)=>{const i=c(e.text),d=O(t,r),l=b(n,r),E=u(e);return d?o(I,{countKey:d,children:v=>a(v??i,void 0,void 0,l,E)}):r&&R(i)?o(h,{}):a(i,void 0,void 0,l,E)}})};return Y(t)!=="top-line"?w():o(y,{type:"Text",props:t,children:(e,n,r)=>{if(!n||!Z(n.ownerType))return w();const i=c(m?e.text:f);return R(i)?o(h,{}):o("div",{className:X,[Q]:"",children:a(i,void 0,!0,b(n,r),u(e))})}})}};export{Ce as TextRender};
1
+ import{Fragment as y,jsx as o}from"react/jsx-runtime";import{CardPressTitled as M,CardRowDrawn as g}from"../../../../../components/CardRowContext.js";import{CountDrawn as C}from"../../../../../components/CountRowsContext.js";import{KickerNumberDrawn as U}from"../../../../../components/PageContentsContext.js";import{KICKER_NUMBER_PROP as V}from"../../../../content/page-contents.js";import{WALL_LABEL_ID_PROP as z}from"../../../wall-labels.js";import{CARD_PRESS_TITLE_PROP as q}from"../../../card-press-titles.js";import{CARD_ROW_LINK_PROP as G,namedRowField as x,rowFieldIsDate as J,rowFieldWordsArePlain as Q,rowPartByKey as X}from"../../../../../../format/lib/content/card-template.js";import{TOP_LINE_ATTRIBUTE as Y,TOP_LINE_CLASS as Z,cardPlaceOf as $,framesItsCards as ee}from"../../../../../../format/lib/content/card-place.js";import{blockSetsItsWidth as te,blockSizeValuesOf as ne}from"../../../../content/block-size.js";import{linkedCount as K}from"../../../../../../format/lib/content/count-numbers.js";import{nonEmptyString as re}from"../../../../../../format/lib/non-empty-string.js";import{padValuesOf as ie}from"../../../../content/section-padding.js";import oe from"../../../../../components/Text.js";import{hidableText as s,readHidable as de}from"efficient-easel/draw";import{PH as L}from"../../../../../../format/lib/document/blocks/placeholders.js";import{phPrev as ae}from"../../scaffold.js";import{readPartStyle as le}from"../../../part-styles.js";import{TextMeta as fe}from"../../../../../../format/lib/document/blocks/general/Text/meta.js";const Se={...fe,render:r=>{const{text:c,align:S,alignTablet:w,alignPhone:A,tone:D,tag:F,contained:N,editor:u}=r;if(de(c).hidden)return o(y,{});const{textStyle:T,align:k}=le(r,"text"),W=T?.startsWith("heading-")?L.heading:L.body,B=X("Text",r,"text")?{partKey:"text",partDeclare:!!u?.isEditing}:{},P=r[z],j=typeof P=="string"?P:void 0,_=r[q]===!0?x(r):"",l=(e,n,t,i,d,a)=>_?o(M,{field:_,children:m=>R(e,m,n,t,i,d,a)}):R(e,j,n,t,i,d,a),R=(e,n,t,i,d,a,m)=>o(oe,{...B,plain:d,href:a,date:m,labelId:n,text:ae(e,W,u)??"",number:t,align:S,alignTablet:w,alignPhone:A,tone:D,tag:F,textStyle:T,partAlign:k,ownWidth:te(ne(r)),contained:N,pad:ie(r),onLine:i}),b=e=>!e?.trim()&&!u?.isEditing,f=x(r),v=x(r,G),h=e=>re(e.href),p=(e,n)=>!!f&&!!n&&Q(e,f),I=(e,n,t)=>f&&n&&t.trim()&&J(e,f)?t.trim():void 0,E=K(r);if(E)return o(C,{countKey:E,children:e=>l(e??s(c))});const O=()=>{if(!f){const e=r[V],n=t=>typeof e=="string"?l(s(c),e,void 0,void 0,t):o(U,{id:r.id,children:i=>l(s(c),i,void 0,void 0,t)});return v?o(g,{type:"Text",props:r,children:t=>n(h(t))}):n()}return o(g,{type:"Text",props:r,children:(e,n,t)=>{const i=s(e.text),d=K(r,t),a=p(n,t),m=h(e);return d?o(C,{countKey:d,children:H=>l(H??i,void 0,void 0,a,m)}):t&&b(i)?o(y,{}):l(i,void 0,void 0,a,m,I(n,t,i))}})};return $(r)!=="top-line"?O():o(g,{type:"Text",props:r,children:(e,n,t)=>{if(!n||!ee(n.ownerType))return O();const i=s(f?e.text:c);return b(i)?o(y,{}):o("div",{className:Z,[Y]:"",children:l(i,void 0,!0,p(n,t),h(e),I(n,t,i))})}})}};export{Se as TextRender};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-web-builder",
3
- "version": "69.2.0",
3
+ "version": "69.3.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",