efficient-web-builder 69.3.0 → 69.4.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 +13 -0
- package/dist/editor/lib/document/blocks/general/ProcessSteps/fields.js +1 -1
- package/dist/editor/lib/host-document-bridge.js +1 -1
- package/dist/editor/lib/sections/hero-ticker-to-strip.js +1 -1
- package/dist/format/lib/content/card-row-keys.d.ts +5 -0
- package/dist/format/lib/content/card-row-keys.js +1 -0
- package/dist/format/lib/content/card-template.d.ts +1 -6
- package/dist/format/lib/content/card-template.js +1 -1
- package/dist/format/lib/document/article-body-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/CardList/item-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/Cards/card-seed.d.ts +2 -1
- package/dist/format/lib/document/blocks/general/Cards/card-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/FAQ/card-seed.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/FAQ/card-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/Footprint/card-seed.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/Footprint/card-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/Logos/card-seed.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/Logos/card-seed.js +1 -1
- package/dist/format/lib/document/blocks/general/OrderSummary/block-type.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/OrderSummary/block-type.js +1 -0
- package/dist/format/lib/document/blocks/general/ProcessSteps/row-seed.d.ts +1 -0
- package/dist/format/lib/document/blocks/general/ProcessSteps/row-seed.js +1 -1
- package/dist/format/lib/document/cap-hero-groups.js +1 -1
- package/dist/format/lib/document/card-content-switch.js +1 -1
- package/dist/format/lib/document/cards-template-on-read.js +1 -1
- package/dist/format/lib/document/node-lists.d.ts +1 -0
- package/dist/format/lib/document/node-lists.js +1 -1
- package/dist/format/lib/document/renamed-props.js +1 -1
- package/dist/format/lib/document/seed-parts.d.ts +3 -0
- package/dist/format/lib/document/seed-parts.js +1 -1
- package/dist/format/lib/sections/hero-single-to-hero.js +1 -1
- package/dist/format/lib/source-rules/no-glyph-rows.js +4 -4
- package/dist/format/lib/source-rules/one-node-list-loop.d.ts +6 -0
- package/dist/format/lib/source-rules/one-node-list-loop.js +1 -0
- package/dist/format/lib/source-rules/one-node-list.js +1 -1
- package/dist/format/lib/source-rules/one-seed-id-home.d.ts +6 -0
- package/dist/format/lib/source-rules/one-seed-id-home.js +1 -0
- package/dist/format/lib/source-rules/page-picture-place.js +3 -3
- package/dist/format/lib/source-rules/reduced-motion.js +8 -8
- package/dist/format/lib/source-rules/support/css-length.js +1 -1
- package/dist/format/lib/source-rules/support/css-rules.js +1 -1
- package/dist/format/lib/source-rules/support/label-extraction.js +5 -5
- package/dist/format/lib/source-rules/support/ts-source.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 69.4.0 - 2026-11-16
|
|
4
|
+
|
|
5
|
+
From main at `e3b20e48`: #763, #764. A minor: no `!`, no export is removed, no type is narrowed, 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
|
+
- No step is required to take this release.
|
|
9
|
+
- storefront-blocks may map a page's content and every zone with `mapPageLists` in place of its own loop over `content` and `zones`.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **One page map and the node-list rules in one home** (#763): `mapPageLists` in `lib/document/node-lists` maps `content` and every zone. New shared rule `lib/source-rules/one-node-list-loop` (`oneNodeListLoop`, `OneNodeListLoopOptions`): no own loop over a node's lists. `oneNodeList` catches more forms of a renamed node test and leaves a component that reads a prop's type. `blockEnd` also closes `(` and `[`.
|
|
14
|
+
- **Seed ids from one home, and each seed module loads alone** (#764): new `seedNodeId`, `slotSeedIds` and `withSeededSlot` in `seed-parts`; new rule module `oneSeedIdHome` (`OneSeedIdHomeOptions`). New module `lib/content/card-row-keys` (`CARD_ROW_FIELD_PROP`, `CARD_ROW_LINK_PROP`, `CARD_TEMPLATE_SLOT`, `CARD_LIST_TYPE`, `BOX_HIDE_WHEN_ROW_EMPTY`; `card-template` still exports the same names and values). Block type constants `CARDS_TYPE`, `FAQ_TYPE`, `FOOTPRINT_TYPE`, `LOGOS_TYPE`, `ORDER_SUMMARY_TYPE` (new leaf `OrderSummary/block-type`) and `PROCESS_STEPS_TYPE`.
|
|
15
|
+
|
|
3
16
|
## 69.3.0 - 2026-11-15
|
|
4
17
|
|
|
5
18
|
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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{ColumnWidthsIcon as T,ColumnsIcon as E,LayoutIcon as P,MediaLayoutStackedIcon as O,PlacementIcon as b}from"efficient-easel/icons";import{deviceField as g}from"efficient-easel/screen/lib/document/device-fields";import{cardImageFields as I,text as s,textarea as R}from"../../../controls.js";import{group as n,section as m}from"efficient-easel/screen/lib/document/box-fields";import{iconPickerRow as h,segmented as i,slider as C}from"../../../box-fields.js";import{IMAGE_TEXT_ARRANGEMENT_PICTURES as A,LAYOUT_CELL as L}from"../../../choice-pictures.js";import{BLOCK_SOURCE_EDIT_PROP as x,blockSourceEditField as N,blockSourceField as w,blockSourceFields as v}from"../../../block-source-fields.js";import{declaredBlockSource as a}from"../../../../../../format/lib/content/block-sources.js";import{ARRANGEMENT_OPTIONS as F,IMAGE_WIDTH_OPTIONS as D,PHONE_ORDER_OPTIONS as G}from"../../../../../../format/lib/content/image-text-rows.js";import{PROCESS_STEPS_TYPE as c,imageTextRowTemplate as H}from"../../../../../../format/lib/document/blocks/general/ProcessSteps/row-seed.js";import{CARD_TEMPLATE_SLOT as l}from"../../../../../../format/lib/content/card-row-keys.js";import{SPLITTABLE_SECTIONS as M,headFieldsForPlacement as W}from"../../../../../../format/lib/sections/section-head-placement.js";import{PH as k}from"../../../../../../format/lib/document/blocks/placeholders.js";import{withRowRules as y}from"../../../../../../render/lib/document/show-when.js";import{isNodeList as p}from"efficient-easel/data";import{seedNodeId as B}from"../../../../../../format/lib/document/seed-parts.js";import{PROCESS_PH as u,ProcessStepsSlots as d}from"../../../../../../format/lib/document/blocks/general/ProcessSteps/meta.js";const S={field:"arrangement",in:["rows-left","rows-right"]},_="drawsLegacySteps",f={not:{context:_,is:!0}},Y={[_]:e=>{const o=e.props??{};return!a(o)&&!p(o.boxes)}},U=e=>e?.data?.root?.props??null,me={fields:y({_gSource:n("Source"),dataSource:w("Item content","Manual"),[x]:N(),_sHeader:m("Header"),_gContent:n("Content"),num:s("Number",u.num),title:s("Heading",u.title),description:R("Body",k.body),boxes:d.boxes,[l]:d[l],_dDesign:m("Design"),arrangement:h("Arrangement",r(P,{}),F.map(e=>({label:e.label,hint:e.hint,value:e.value,picture:A[e.value]})),"columns",{columns:3,cell:L}),imageWidth:i("Image width",r(T,{}),D.map(e=>({label:e.label,value:e.value})),"half"),phoneOrder:g("mobile",i("Order",r(O,{}),G.map(e=>({label:e.label,value:e.value})),"picture")),columns:C("Columns",r(E,{}),2,4,1,3),...I(),cardText:i("Text position",r(b,{}),[{label:"Below picture",value:"below"},{label:"On picture",value:"on-image"}],"below")},[[["cardText"],{not:{field:"boxes",set:!0}}],[["arrangement"],f],[["imageWidth","phoneOrder"],{all:[S,f]}],[["columns"],{not:S}]]),showWhenFacts:Y,resolveFields:(e,o)=>v(c,W(o.fields,e.props.headPlacement,M.ProcessSteps.headRows),e.props,{root:U(o.appState)}),resolveData:(e,o)=>{const t=e.props;return o?.changed?.dataSource!==!0||!a(t)||p(t[l])?e:{...e,props:{...t,[l]:H(B(t,c))}}}};export{me as ProcessStepsFields};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FIELD_DESCRIPTION_MARKER as j}from"efficient-easel/screen/lib/host";import{isNode as
|
|
1
|
+
import{FIELD_DESCRIPTION_MARKER as j}from"efficient-easel/screen/lib/host";import{isNode as y,isNodeList as v}from"efficient-easel/data";import{RETIRED_SECTIONS as E}from"../../format/lib/document/section-catalog.js";import{layoutPresetFor as O}from"./sections/text-layouts.js";import{hasOwnEntry as x}from"../../format/lib/own-entry.js";function u(r,t){const e=r.components[t]?.label;return typeof e=="string"&&e.trim()?e.trim():t}function w(r){return r.length>3&&r.endsWith("s")?r.slice(0,-1):r}function d(r,t,e,o){r.forEach((s,l)=>{if(y(s)){o.push({node:s,list:r,index:l,parent:t,slot:e});for(const[i,n]of Object.entries(s.props))v(n)&&d(n,s,i,o)}})}function F(r){const t=[];d(Array.isArray(r.content)?r.content:[],null,"",t);for(const e of Object.values(r.zones??{}))Array.isArray(e)&&d(e,null,"",t);return t}function h(r,t){return F(r).find(e=>String(e.node.props.id)===t)}function L(r,t,e){if(!e)return null;const o=h(t,e);if(!o)return null;const s=u(r,o.node.type),l=o.parent?`${u(r,o.parent.type)} · ${w(o.slot)} ${o.index+1}`:s;return{blockId:e,type:o.node.type,label:l,path:""}}const S=r=>r.filter(t=>!!t&&typeof t=="object"&&"value"in t).map(t=>typeof t.label=="string"?{value:t.value,label:t.label}:{value:t.value});function C(r){if(!r||typeof r!="object")return null;const t=r;if(typeof t.type!="string")return null;const e=t.type==="custom"?t[j]:void 0,o={type:e?.type??t.type},s=e?.label??t.label;typeof s=="string"&&(o.label=s);const l=e?.options??t.options;Array.isArray(l)&&(o.options=S(l));for(const i of["arrayFields","objectFields"]){const n=e?.[i]??t[i];n&&typeof n=="object"&&(o[i]=k(n))}return o}function k(r){const t={};for(const[e,o]of Object.entries(r??{})){const s=C(o);s&&(t[e]=s)}return t}function T(r){const t={};for(const[e,o]of Object.entries(r.components))o&&(t[e]={label:u(r,e),fields:k(o.fields),...m(e)?{retired:!0}:{}});return t}function m(r){return x(E,r)}function g(r,t){const e=r.components[t]?.defaultProps;return e&&typeof e=="object"?structuredClone(e):{}}function R(r,t){let e=r;for(const o of t?t.split("."):[]){const s=/^([A-Za-z_][A-Za-z0-9_]*)(?:\[(\d+)\])?$/.exec(o);if(!s||!e||typeof e!="object")return null;e=e[s[1]],s[2]!==void 0&&(e=Array.isArray(e)?e[Number(s[2])]:void 0)}return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function b(r,t){return r.findIndex(e=>y(e)&&String(e.props.id)===t)}function A(r,t,e){const o=t||e;if(!o)return r.length;const s=b(r,o);if(s<0)throw new Error(`there is no top-level block ${o}`);return t?s+1:s}function B(r,t,e,o,s={}){const l=structuredClone(t),i=Array.isArray(l.content)?l.content:l.content=[];try{e.forEach((n,_)=>{const a=c=>{throw new Error(`change ${_+1}: ${c}`)};switch(n.op){case"set_props":{const c=h(l,n.block_id)??a(`there is no block ${n.block_id}`);"id"in n.props&&a("a block's id is never changed");const f=R(c.node.props,n.path)??a(`there is no ${n.path} in that block`);Object.assign(f,structuredClone(n.props));break}case"insert_block":{r.components[n.type]??a(`there is no block type ${n.type}`),m(n.type)&&a(`${u(r,n.type)} is retired: it is no longer added (a page that holds one keeps it)`);const c=O(n.type),f=Object.keys(n.props??{}).filter(p=>p!=="id");c&&f.length&&a(`${u(r,n.type)} is laid down as a Box of blocks: insert it with no props, then change its blocks`);const $=c?c(p=>g(r,p),o,s):{type:n.type,props:{...g(r,n.type),...structuredClone(n.props),id:o(n.type)}};i.splice(A(i,n.after,n.before),0,$);break}case"remove_block":{const c=b(i,n.block_id);c<0&&a(`there is no top-level block ${n.block_id}`),i.splice(c,1);break}case"move_block":{const c=b(i,n.block_id);c<0&&a(`there is no top-level block ${n.block_id}`);const[f]=i.splice(c,1);i.splice(A(i,n.after,n.before),0,f);break}default:a(`"${n.op}" is not a change this editor makes`)}})}catch(n){return{ok:!1,reason:n instanceof Error?n.message:String(n)}}return{ok:!0,document:l}}export{B as applyPageEdits,u as blockLabel,T as describeBlocks,L as describeSelection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readPartMotions as
|
|
1
|
+
import{readPartMotions as I}from"../../../render/lib/animation/part-motion.js";import{STRIP_SECTION_TO_BOX as g}from"../../../render/lib/document/blocks/general/section-to-box-rows-strip.js";import{HERO_STRIP_SLOT as a,legacyTickerWords as l,STRIP_ON_MEDIA as m,TICKER_MOTION_PART as n}from"../../../format/lib/hero-ticker.js";import{convertSection as u}from"../../../render/lib/sections/section-to-box.js";import{seedNodeId as O}from"../../../format/lib/document/seed-parts.js";function E(e){const{showTicker:i,tickerItems:k,...y}=e.props,T=O(e.props,"Hero"),r=[],o=[],t={...y},s=l({tickerItems:k}),p=i!==!1&&s.length>0,c=I(e.props),h=c[n];if(h){const{[n]:d,...w}=c;Object.keys(w).length?t._partMotion=w:delete t._partMotion,r.push({key:"_partMotion",home:p?`${n} → the strip Box's own Entrance`:`${n} → nothing: no strip is drawn`})}if(!p)return t[a]=[],"showTicker"in e.props&&o.push({key:"showTicker",why:i===!1?"switched off: an empty strip draws nothing, the same as today":"no words: the strip drew nothing published, so the strip stays empty"}),"tickerItems"in e.props&&o.push({key:"tickerItems",why:s.length?"switched off: the words were not drawn, and an empty strip draws nothing":"no row has words: an empty row draws nothing published"}),{node:{type:e.type,props:t},carried:r,dropped:o};const f={type:"Ticker",props:{id:`${T}~strip`,items:s.map(d=>({text:d})),tone:"plain",sectionAccent:m.sectionAccent,borders:m.line,...h??{}}},_=u(f,g.Ticker);return t[a]=[_.node],"showTicker"in e.props&&o.push({key:"showTicker",why:"on: the strip Box is the switch now (delete or hide it like any block)"}),r.push({key:"tickerItems",home:`the strip Box: one Text block per row with words (${s.length}), in order`}),{node:{type:e.type,props:t},carried:r,dropped:o}}export{E as heroTickerToStrip};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CARD_ROW_FIELD_PROP = "rowField";
|
|
2
|
+
export declare const CARD_ROW_LINK_PROP = "rowLinkField";
|
|
3
|
+
export declare const CARD_TEMPLATE_SLOT = "template";
|
|
4
|
+
export declare const CARD_LIST_TYPE = "CardList";
|
|
5
|
+
export declare const BOX_HIDE_WHEN_ROW_EMPTY = "hideWhenRowEmpty";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t="rowField",_="rowLinkField",o="template",e="CardList",R="hideWhenRowEmpty";export{R as BOX_HIDE_WHEN_ROW_EMPTY,e as CARD_LIST_TYPE,t as CARD_ROW_FIELD_PROP,_ as CARD_ROW_LINK_PROP,o as CARD_TEMPLATE_SLOT};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { type SourceRow } from "./block-sources.js";
|
|
2
2
|
import type { CardCopyPlace } from "./mirror-cards.js";
|
|
3
|
-
export declare const CARD_TEMPLATE_SLOT = "template";
|
|
4
3
|
export declare const CARD_TEMPLATE_LABEL = "Card template";
|
|
5
|
-
export declare const CARD_LIST_TYPE = "CardList";
|
|
6
4
|
export declare const CARD_TEMPLATE_BLOCKS: readonly ["Text", "ImageBlock", "ButtonBlock", "Flex"];
|
|
7
|
-
export
|
|
8
|
-
export declare const CARD_ROW_LINK_PROP = "rowLinkField";
|
|
5
|
+
export { BOX_HIDE_WHEN_ROW_EMPTY, CARD_LIST_TYPE, CARD_ROW_FIELD_PROP, CARD_ROW_LINK_PROP, CARD_TEMPLATE_SLOT } from "./card-row-keys.js";
|
|
9
6
|
export declare function cardTemplateSlot(): {
|
|
10
7
|
type: "slot";
|
|
11
8
|
allow: string[];
|
|
@@ -87,7 +84,6 @@ export declare function rowFieldIsDate(copy: Parameters<typeof rowFieldSpec>[0],
|
|
|
87
84
|
export declare function namedRowField(props: Record<string, unknown> | null | undefined, prop?: string): string;
|
|
88
85
|
export declare function cardKeyOf(row: SourceRow, index: number): string;
|
|
89
86
|
export declare function cardRow(value: unknown): SourceRow;
|
|
90
|
-
export declare const BOX_HIDE_WHEN_ROW_EMPTY = "hideWhenRowEmpty";
|
|
91
87
|
export declare function templateBoxIsEmpty(props: Record<string, unknown>, row: SourceRow | null | undefined): boolean;
|
|
92
88
|
export declare const ROW_BOUND_PROPS: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
93
89
|
export declare const ROW_PART_BY_WORDS: ReadonlySet<string>;
|
|
@@ -111,4 +107,3 @@ export declare function cardListFieldsOf(appState: unknown, list: {
|
|
|
111
107
|
} | null | undefined, kind?: CardRowFieldKinds): readonly CardRowFieldSpec[];
|
|
112
108
|
export declare function cardListProps(rows: readonly Record<string, unknown>[], fields: readonly CardRowFieldSpec[]): Record<string, unknown>;
|
|
113
109
|
export declare const HOST_PART_TYPE = "HostPart";
|
|
114
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
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
|
+
import{blockSources as Y,blockSourceSpec as O,declaredBlockSource as R}from"./block-sources.js";import{slotFieldBlocks as h}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 M}from"../global-registry.js";import{nonEmptyString as S}from"../non-empty-string.js";import{accentItalicRuns as N}from"../markup.js";import{BOX_HIDE_WHEN_ROW_EMPTY as K,CARD_LIST_TYPE as k,CARD_ROW_FIELD_PROP as p,CARD_ROW_LINK_PROP as y,CARD_TEMPLATE_SLOT as B}from"./card-row-keys.js";import{withCardsTemplate as H}from"../document/cards-template-on-read.js";import{CARDS_TYPE as L}from"../document/blocks/general/Cards/card-seed.js";import{ORDER_SUMMARY_TYPE as $}from"../document/blocks/general/OrderSummary/block-type.js";import{PROCESS_STEPS_TYPE as j}from"../document/blocks/general/ProcessSteps/row-seed.js";import{withCardListTemplate as U}from"../document/blocks/general/CardList/item-seed.js";import{ARTICLE_BODY_BLOCK as Q,withArticleBodyTemplate as X}from"../document/article-body-seed.js";import{LOGOS_TYPE as q,withLogosTemplate as V}from"../document/blocks/general/Logos/card-seed.js";import{FAQ_TYPE as G,withFaqTemplate as z}from"../document/blocks/general/FAQ/card-seed.js";import{FOOTPRINT_TYPE as J,withFootprintListTemplate as Z}from"../document/blocks/general/Footprint/card-seed.js";const ee="Card template",E=["Text","ImageBlock","ButtonBlock","Flex"];import{BOX_HIDE_WHEN_ROW_EMPTY as st,CARD_LIST_TYPE as it,CARD_ROW_FIELD_PROP as at,CARD_ROW_LINK_PROP as ct,CARD_TEMPLATE_SLOT as ft}from"./card-row-keys.js";function Fe(){return{type:"slot",allow:[...E]}}const te=E.filter(e=>e!=="ButtonBlock"),A="items",P="itemFields";function Ye(){return{type:"slot",allow:[...te]}}function m(e,t){if(!t)return e;const r=typeof t=="string"?[t]:t;return e.filter(n=>r.includes(n.kind??"text"))}const re=[{block:$,typedRows:"rows",linesBetween:!0,fields:[{key:"label",label:"Item"},{key:"meta",label:"Meta line"},{key:"amount",label:"Amount"}]},{block:G,typedRows:"items",fields:[{key:"question",label:"Question"},{key:"answer",label:"Answer",multiline:!0}],seedOnInsert:e=>z(e)},{block:J,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=>Z(e)},{block:L,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=>H(L,e)},{block:j,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:q,fields:[{key:"label",label:"Name"},{key:"kind",label:"Kind"}],seed:e=>V(e)},{block:k,fields:[{key:"badge",label:"Highlight badge",everySource:!0,plain:!0}],typedRows:A,seed:e=>U(e)},{block:Q,fields:[{key:"heading",label:"Subhead"},{key:"paragraph",label:"Paragraph",multiline:!0}],seed:e=>X(e)}];function f(){return M("efficient.card-templates",()=>new Map(re.map(e=>[e.block,e])))}function ve(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===D)throw new Error(`The card template of ${t.block} names "${D}" 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=S(o.label),c=Array.isArray(o.fields)?{fields:o.fields.map(a=>({...a}))}:null;n.some(a=>a.slot===o.slot)||n.push({slot:o.slot,...l?{label:l}:null,...c})}const s=n.some(o=>o.fields);if(s&&(t.fields.some(o=>o.everySource)||Y(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?h().add(t.block):h().delete(t.block);const i=S(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 oe(e,t){const r=e?f().get(e)?.seed:void 0;return r?r(t):t}function We(e,t){const r=le(e),n=(r.length?r:[B]).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):oe(e,s);return o===s?t:o}function Me(){for(const e of f().values())if(e.blocks?.length)return!0;return!1}function Ne(e){return f().get(e)?.blocks??[]}function Ke(e){for(const t of f().values())if(t.blocks?.some(r=>r.type===e))return!0;return!1}function He(e){return typeof e=="string"&&f().get(e)?.typedRows||""}function $e(e){return typeof e=="string"&&f().get(e)?.linesBetween===!0}function je(e){return typeof e=="string"&&f().has(e)}const ne=[{slot:B}];function b(e){if(typeof e!="string")return[];const t=f().get(e);return t?t.slots??ne:[]}function le(e){return b(e).map(t=>t.slot)}function se(e,t){return b(e).some(r=>r.slot===t)}function Ue(e,t){const r=b(e).find(n=>n.slot===t);return r?r.label??ee:null}function g(e,t){return t?b(e).find(r=>r.slot===t)?.fields:void 0}function ie(e,t){const r=f().get(e)?.fields??[];return m(r,t)}function ae(e,t){if(typeof e!="string")return"";const r=g(e,t);return(r?m(r,"list"):ie(e,"list"))[0]?.key??""}function ce(e,t,r){return _(e)||ae(t,r)}function C(e,t,r){const n=typeof e?.type=="string"?e.type:"";if(!n)return[];const s=g(n,r);if(s)return m(s,t);const i=f().get(n)?.fields??[],o=O(R(e?.props))?.fields,l=o?.length?[...o.map(c=>({...c})),...i.filter(c=>c.everySource&&!o.some(a=>a.key===c.key))]:i;return m(l,t)}function fe(e,t,r,n){if(!e)return null;const s=g(e,n);return s?s.find(i=>i.key===t)??null:r?C(r).find(i=>i.key===t)??null:f().get(e)?.fields.find(i=>i.key===t)??null}function x(e,t){return!e||!t?null:e.fields?.find(r=>r.key===t)??fe(e.ownerType,t,e.owner,e.slot)}function Qe(e,t){return x(e,t)?.plain===!0}function Xe(e,t){return x(e,t)?.kind==="date"}function _(e,t=p){const r=e?.[t];return typeof r=="string"?r.trim():""}function qe(e,t){return e.key||String(t+1)}function Ve(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}function Ge(e,t){const r=e[K];return!t||!Array.isArray(r)||!r.length?!1:r.every(n=>typeof n!="string"||!t[n]?.trim())}const w={Text:{text:p,href:y},ImageBlock:{src:p,href:y},ButtonBlock:{label:p,href:y},LogoBlock:{alt:p,href:y},Breadcrumb:{currentCrumb:p}},ze=w,ue=new Set(["ButtonBlock.label","LogoBlock.alt"]);function Je(e,t,r){return de(e,t,r)&&!ue.has(`${e}.${r}`)}function de(e,t,r){return pe(e,t,r)!==""}function pe(e,t,r){const n=w[e]?.[r];return n?_(t,n):""}function I(e,t){return!t||!e?null:e[t]??""}function me(e,t){return I(e,t)?.trim()||void 0}function Ze(e,t,r,n,s,i){if(!r)return t;let o=null;for(const[l,c]of Object.entries(w[e]??{})){const a=_(t,c),u=I(r,a);if(u!==null){if(o??={...t},c===y){o[l]=me(r,a);continue}o[l]=x({ownerType:n,fields:s,slot:i},a)?.mark==="accentItalic"?N(u):u}}return o??t}function T(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[c,a]of Object.entries(l?.props??{})){if(!v(a))continue;const u=se(l.type,c)?{owner:l,slot:c,direct:!0,nested:o!==null,underBox:!1}:o&&{owner:o.owner,slot:o.slot,direct:!1,nested:o.nested,underBox:o.underBox||l.type===W},d=n(a,u);if(d!==void 0)return d}}},s=n(r,null);return s===void 0?null:s}function ye(e,t){const r=T(e,t);return r&&r.owner}function ke(e,t){const r=T(e,t);return r&&r.slot}function et(e,t){const r=T(e,t);return r&&(r.direct?r.owner:null)}function tt(e,t){const r=T(e,t);if(r!==void 0)return r===null?{inCopy:!1,nestedCopy:!1,underBox:!1}:{inCopy:!0,nestedCopy:r.nested,underBox:r.underBox}}function rt(e,t,r){if(t?.type!==k)return[];const n=ye(e,t.props?.id);if(!n){const l=O(R(t.props))?.fields,c=l?.length?l.map(d=>({...d})):be(t.props),a=(f().get(k)?.fields??[]).filter(d=>d.everySource&&!c.some(F=>F.key===d.key)),u=[...c,...a];return m(u,r)}const s=ke(e,t.props?.id)??void 0,i=ce(t.props,n.type,s),o=i&&C(n,"list",s).find(l=>l.key===i)?.fields||[];return m(o,r)}function ot(e,t){return{[p]:"",[A]:e.map(r=>({...r})),[P]:t.map(r=>({...r}))}}function be(e,t){const r=e?.[P];if(!Array.isArray(r))return[];const n=r.flatMap(s=>{if(!s||typeof s!="object")return[];const{key:i,label:o,kind:l,multiline:c,alt:a,next:u}=s;if(typeof i!="string"||!i||typeof o!="string")return[];const d=l==="image"||l==="link"||l==="colour"||l==="date"?l:void 0;return[{key:i,label:o,...d?{kind:d}:{},...c===!0?{multiline:!0}:{},...typeof a=="string"&&a?{alt:a}:{},...typeof u=="string"&&u?{next:u}:{}}]});return m(n,t)}const D="HostPart";export{st as BOX_HIDE_WHEN_ROW_EMPTY,P as CARD_LIST_FIELDS,te as CARD_LIST_ITEM_BLOCKS,A as CARD_LIST_ROWS,it as CARD_LIST_TYPE,at as CARD_ROW_FIELD_PROP,ct as CARD_ROW_LINK_PROP,E as CARD_TEMPLATE_BLOCKS,ee as CARD_TEMPLATE_LABEL,ft as CARD_TEMPLATE_SLOT,D as HOST_PART_TYPE,ze as ROW_BOUND_PROPS,ue as ROW_PART_BY_WORDS,tt as cardCopyPlace,qe as cardKeyOf,rt as cardListFieldsOf,Ye as cardListItemSlot,ot as cardListProps,ce as cardListShows,Ve as cardRow,Ne as cardTemplateBlocks,et as cardTemplateCardOwner,fe as cardTemplateField,ie as cardTemplateFields,C as cardTemplateFieldsOf,$e as cardTemplateLinesBetween,ye as cardTemplateOwner,Fe as cardTemplateSlot,Ue as cardTemplateSlotLabel,le as cardTemplateSlotNames,ke as cardTemplateSlotOf,He as cardTemplateTypedRows,Me as cardTemplatesNameBlocks,ae as defaultListField,m as fieldsOfKind,je as hasCardTemplate,Ke as isCardTemplateBlock,se as isCardTemplateSlot,_ as namedRowField,ve as registerCardTemplates,de as rowBound,Xe as rowFieldIsDate,pe as rowFieldOf,x as rowFieldSpec,I as rowFieldText,Qe as rowFieldWordsArePlain,Ze as rowFilledProps,me as rowLinkText,Je as rowPartByKey,Ge as templateBoxIsEmpty,We as templateOnInsert,oe as templateOnRead};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CARDS_BODY_LOOK as
|
|
1
|
+
import{CARDS_BODY_LOOK as n,rowFieldTextSeed as t}from"./blocks/general/Cards/card-seed.js";import{CARD_TEMPLATE_SLOT as i}from"../content/card-row-keys.js";import{DIM as a,TEXT as d,seedNodes as p,token as c,withSeededSlot as l}from"./seed-parts.js";const g="ArticleBody",A={textStyle:"heading-3",...c("headingSmall",20),weight:500,lineHeight:1.4,align:"center"},h={...n,align:"center"},o=640,T=()=>[t("heading",{...d,tag:"h2",align:"center",maxWidth:o},A),t("paragraph",{...a,tag:"p",align:"center",maxWidth:o},h)],_=e=>p(T(),e);function m(e){return _((x,r)=>`${e}~${r==="0"?"heading":"paragraph"}`)}function O(e){return l(e,i,g,m)}export{g as ARTICLE_BODY_BLOCK,A as ARTICLE_HEADING_LOOK,o as ARTICLE_MEASURE,h as ARTICLE_PARAGRAPH_LOOK,m as articleBodySeed,_ as articleBodyTemplateNodes,O as withArticleBodyTemplate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as r}from"../../../container-blocks.js";import{CARDS_BODY_LOOK as
|
|
1
|
+
import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as r}from"../../../container-blocks.js";import{CARD_LIST_TYPE as T,CARD_TEMPLATE_SLOT as m}from"../../../../content/card-row-keys.js";import{CARDS_BODY_LOOK as _,rowFieldTextSeed as i}from"../Cards/card-seed.js";import{INNER_BOX as d,TEXT as p,seedNodes as S,slotSeedIds as s,withSeededSlot as L}from"../../../seed-parts.js";const E="label";function a(e){return L(e,m,T,t=>S([I()],s(t,"item")))}function I(){return{type:o,props:{...d,name:"Item"},slots:{[r]:[i(E,{...p,tag:"p"},_)]}}}export{E as CARD_LIST_ITEM_FIELD,a as withCardListTemplate};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type BlockSeed, type SeededNode } from "../../../seed-parts.js";
|
|
2
2
|
type Props = Record<string, unknown>;
|
|
3
|
+
export declare const CARDS_TYPE = "Cards";
|
|
3
4
|
export declare const CARDS_CARD: Props;
|
|
4
5
|
export declare const CARDS_TITLE_LOOK: Props;
|
|
5
6
|
export declare const CARDS_BODY_LOOK: Props;
|
|
@@ -19,6 +20,6 @@ export declare const LABEL_ONLY_CARD_FIELDS: {
|
|
|
19
20
|
export declare const LABEL_ONLY_LABEL_LOOK: Props;
|
|
20
21
|
export declare const LABEL_ONLY_MARK: Props;
|
|
21
22
|
export declare const labelOnlyCardSeed: (linked?: boolean) => BlockSeed;
|
|
22
|
-
export declare const cardIdOf: (own: string) => (
|
|
23
|
+
export declare const cardIdOf: (own: string) => ((type: string, at: string) => string);
|
|
23
24
|
export declare const labelOnlyTemplateNodes: (idOf: (type: string, at: string) => string, linked?: boolean) => SeededNode[];
|
|
24
25
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CARD_ROW_FIELD_PROP as O,CARD_ROW_LINK_PROP as L}from"../../../../content/card-
|
|
1
|
+
import{CARD_ROW_FIELD_PROP as O,CARD_ROW_LINK_PROP as L}from"../../../../content/card-row-keys.js";import{BOX_ANGLE_PROP as S}from"../../../../content/box-angle.js";import{BOX_HIGHLIGHT as R,HOVER_KEY as m}from"../../../../animation/hover.js";import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as a}from"../../../container-blocks.js";import{DIM as h,INNER_BOX as l,TEXT as n,boxPadding as s,markBoxProps as E,seedNodes as i,token as r,slotSeedIds as g}from"../../../seed-parts.js";import{labelTextSeed as y}from"../../../text-seeds.js";const H="Cards",D={...l,gap:12,gapPhone:12,...s(32,32,28,28)},f={textStyle:"heading-3",...r("headingSmall",20),weight:500,case:"upper",lineHeight:1.5,letterSpacing:.02},A={textStyle:"body-1",...r("body",15),lineHeight:1.6},p=(e,t,c,x=!1)=>({type:"Text",props:{...t,text:"",[O]:e,_partStyles:{text:{...x?y()._partStyles?.text??{}:{},...c}}}}),d={title:"title",body:"body"},K={title:"name",body:"note"},C=(e=d)=>({type:o,props:{...D,name:"Card"},slots:{[a]:[p(e.title,{...n,tag:"p",widthFit:"fill"},f),p(e.body,{...h,tag:"p",widthFit:"fill"},A)]}}),X=(e,t)=>i([C(t)],e),_={label:d.title,href:"href"},P={textStyle:"body-1",fontRole:"heading",color:"text",...r("body",17),weight:500,case:"upper",letterSpacing:.06,lineHeight:1.5},T=E(9,"main",{[S]:45}),b=(e=!1)=>({type:o,props:{...l,name:"Card",direction:"row",align:"center",gap:16,gapPhone:16,phoneRow:2,sharePhone:"content",wrapPhone:!1,...s(32,28),[L]:_.href,...e?{[m]:R}:{}},slots:{[a]:[{type:o,props:{...T,name:"Mark"}},p(_.label,{...n,tag:"p",widthFit:"fill"},P)]}}),k=e=>g(e,"card"),G=(e,t=!1)=>i([b(t)],e);export{A as CARDS_BODY_LOOK,D as CARDS_CARD,f as CARDS_TITLE_LOOK,H as CARDS_TYPE,_ as LABEL_ONLY_CARD_FIELDS,P as LABEL_ONLY_LABEL_LOOK,T as LABEL_ONLY_MARK,K as SERVED_CARD_FIELDS,d as TYPED_CARD_FIELDS,k as cardIdOf,C as cardsCardSeed,X as cardsTemplateNodes,b as labelOnlyCardSeed,G as labelOnlyTemplateNodes,p as rowFieldTextSeed};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type BlockSeed } from "../../../seed-parts.js";
|
|
2
2
|
type Props = Record<string, unknown>;
|
|
3
|
+
export declare const FAQ_TYPE = "FAQ";
|
|
3
4
|
export declare const FAQ_QUESTION_FIELD = "question";
|
|
4
5
|
export declare const FAQ_ANSWER_FIELD = "answer";
|
|
5
6
|
export declare function faqRunStyleKeys(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as
|
|
1
|
+
import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as a}from"../../../container-blocks.js";import{CARD_TEMPLATE_SLOT as d}from"../../../../content/card-row-keys.js";import{DIM as l,INNER_BOX as p,TEXT as f,seedNodes as s,token as r,withSeededSlot as S}from"../../../seed-parts.js";import{rowFieldTextSeed as n}from"../Cards/card-seed.js";import{nonEmptyString as c}from"../../../../non-empty-string.js";import{parseSectionHeadPlacement as u}from"../../../../sections/section-head-placement.js";import{textRegionPartKey as E}from"../../../../sections/text-regions.js";import{FAQ_REGIONS as O}from"../../../../sections/faq-text-regions.js";const T="FAQ",_="question",x="answer",w={textStyle:"body-1",fontRole:"heading",...r("body",18,15),weight:500,case:"upper",letterSpacing:.02,lineHeight:1.5},y={textStyle:"body-1",...r("body",15),lineHeight:1.7};function P(){return Object.keys(O).map(E)}const F=()=>({type:o,props:{...p,gap:0,name:"Question"},slots:{rowTitle:[n(_,{...f,tag:"p",widthFit:"fill"},w)],[a]:[n(x,{...l,tag:"p",widthFit:"fill",maxWidth:760},y)]}});function g(t){return u(t.headPlacement)==="own-box"?!1:["num","title","linkText"].some(e=>c(t[e])!==void 0)}function K(t){return g(t)?t:S(t,d,T,e=>{let i=0;return s([F()],m=>m===o?`${e}~row`:`${e}~row.${i++}`)})}export{x as FAQ_ANSWER_FIELD,_ as FAQ_QUESTION_FIELD,T as FAQ_TYPE,F as faqCardSeed,P as faqRunStyleKeys,K as withFaqTemplate};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type BlockSeed } from "../../../seed-parts.js";
|
|
2
|
+
export declare const FOOTPRINT_TYPE = "Footprint";
|
|
2
3
|
export declare const footprintCardSeed: () => BlockSeed;
|
|
3
4
|
export declare const footprintSideCardSeed: () => BlockSeed;
|
|
4
5
|
export declare function isUntouchedFootprintSideRow(props: Record<string, unknown>): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BOX_TYPE as
|
|
1
|
+
import{BOX_TYPE as a,CONTAINER_BLOCKS_SLOT as l}from"../../../container-blocks.js";import{DIM as h,INNER_BOX as s,TEXT as c,boxPadding as p,labelLook as N,seedNodes as E,token as u,seedNodeId as L}from"../../../seed-parts.js";import{listBesideMap as D}from"../../../../content/list-position.js";import{shapeKeyOf as d}from"../../../seed-shape.js";import{rowFieldTextSeed as r}from"../Cards/card-seed.js";import{BOX_HIDE_WHEN_ROW_EMPTY as B,CARD_ROW_FIELD_PROP as C,CARD_ROW_LINK_PROP as R,CARD_TEMPLATE_SLOT as o}from"../../../../content/card-row-keys.js";import{DEALERS_SOURCE as K,declaredBlockSource as k}from"../../../../content/block-sources.js";const P="Footprint",F=e=>k(e)===K,g=N(11),H={textStyle:"body-1",...u("body",18),weight:500,lineHeight:1.2},V=()=>({type:a,props:{...s,gap:8,gapPhone:8,...p(20,24,20,20),name:"Office"},slots:{[l]:[r("badge",{...c,tag:"p",widthFit:"fill"},g,!0),r("role",{...c,tag:"p",widthFit:"fill"},g,!0),r("city",{...c,tag:"p",widthFit:"fill"},H),r("country",{...h,tag:"p",widthFit:"fill"},g),r("address",{...h,tag:"p",widthFit:"fill"},g),{type:"ButtonBlock",props:{variant:"link",label:"",href:"",[C]:"linkLabel",[R]:"href"}}]}}),b={textStyle:"body-1",fontRole:"heading",...u("body",16),weight:500,lineHeight:1.25},O={textStyle:"body-1",...u("body",14),lineHeight:1.5},$=()=>({type:a,props:{...s,gap:4,gapPhone:4,...p(16,4),sectionBorder:{bottom:1},name:"Office"},slots:{[l]:[r("city",{...c,tag:"p",widthFit:"fill"},b),r("address",{...h,tag:"p",widthFit:"fill"},O),r("phone",{...h,tag:"p",widthFit:"fill"},O)]}});function S(e){const t=L(e,P);let n=0;return E([$()],i=>i===a?`${t}~office`:`${t}~office.${n++}`)}function T(e){return Array.isArray(e[o])&&e[o].length>0&&d(e[o])===d(S(e))}const x=e=>e===void 0||Array.isArray(e)&&e.length===0;function A(e){return D(e.listPosition)?!x(e[o])||F(e)?e:{...e,[o]:S(e)}:T(e)?{...e,[o]:[]}:e}const M=b,Y=O,W={textFit:"line"},y=(e,t,n="",i={},w={})=>{const f=r(e,{...t?h:c,tag:"p",...i},{...Y,...w});return n?{...f,props:{...f.props,[R]:n}}:f},m=(e,t,n,i)=>({type:a,props:{...s,gap:0,gapPhone:0,[B]:[e],name:i},slots:{[l]:[y(e,t,n,W,{align:"right"})]}}),X=e=>({type:a,props:{...s,direction:"row",justify:"between",share:"content",phoneRow:2,sharePhone:"content",wrapPhone:"nowrap",gap:12,gapPhone:12,...e?p(20,24):{...p(16,4),sectionBorder:{bottom:1}},name:"Dealer"},slots:{[l]:[{type:a,props:{...s,justify:"center",gap:0,gapPhone:0,widthFit:"fill",name:"Dealer words"},slots:{[l]:[{type:a,props:{...s,gap:4,gapPhone:4,widthFit:"fill",name:"Dealer name"},slots:{[l]:[r("name",{...c,tag:"p",widthFit:"fill"},M),y("address",!0)]}},y("place",!0,"",{widthFit:"fill"})]}},{type:a,props:{...s,align:"end",gap:4,gapPhone:4,name:"Dealer contact"},slots:{[l]:[m("distance",!0,"","Dealer distance"),m("phone",!1,"phoneHref","Dealer phone"),m("website",!1,"websiteHref","Dealer website")]}}]}}),U=e=>{const t=X(e),n={type:a,props:{...s,...p(0,12),name:"Dealer"},slots:{[l]:[{...t,props:{...t.props,name:"Dealer row"}}]}};return e?t:n};function _(e,t){const n=L(e,P);let i=0;return E([U(t)],(w,f)=>f==="0"?`${n}~dealer`:`${n}~dealer.${i++}`)}function I(e){if(!Array.isArray(e[o])||e[o].length===0)return!1;const t=d(e[o]);return t===d(_(e,!0))||t===d(_(e,!1))}function Z(e){if(F(e)){const i=_(e,!D(e.listPosition));return!(x(e[o])||T(e)||I(e))||d(e[o]??[])===d(i)?e:{...e,[o]:i}}if(!I(e))return A(e);const t={...e,[o]:[]};return A(t)}export{P as FOOTPRINT_TYPE,V as footprintCardSeed,U as footprintDealerCardSeed,$ as footprintSideCardSeed,T as isUntouchedFootprintSideRow,Z as withFootprintListTemplate,A as withFootprintSideTemplate};
|
|
@@ -2,6 +2,7 @@ import { type BlockSeed } from "../../../seed-parts.js";
|
|
|
2
2
|
type Props = Record<string, unknown>;
|
|
3
3
|
export declare const LOGOS_CARD_FIELD = "label";
|
|
4
4
|
export declare const logosCardSeed: () => BlockSeed;
|
|
5
|
+
export declare const LOGOS_TYPE = "Logos";
|
|
5
6
|
export declare function withLogosTemplate(props: Props): Props;
|
|
6
7
|
export declare function seedLogosTemplate(props: Props): Props;
|
|
7
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{declaredBlockSource as
|
|
1
|
+
import{declaredBlockSource as r}from"../../../../content/block-sources.js";import{CARD_ROW_FIELD_PROP as l,CARD_TEMPLATE_SLOT as t}from"../../../../content/card-row-keys.js";import{seedNodes as i,seedNodeId as c,withSeededSlot as m}from"../../../seed-parts.js";const L="label",a=()=>({type:"LogoBlock",props:{[l]:L}}),n="Logos",d=e=>i([a()],()=>`${e}~logo`);function _(e){return r(e)?m(e,t,n,d):e}function g(e){if(!r(e))return e;const o=e[t];return o!==void 0&&!(Array.isArray(o)&&o.length===0)?e:{...e,[t]:d(c(e,n))}}export{L as LOGOS_CARD_FIELD,n as LOGOS_TYPE,a as logosCardSeed,g as seedLogosTemplate,_ as withLogosTemplate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ORDER_SUMMARY_TYPE = "OrderSummary";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r="OrderSummary";export{r as ORDER_SUMMARY_TYPE};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CARD_LIST_TYPE as c,CARD_ROW_FIELD_PROP as m}from"../../../../content/card-
|
|
1
|
+
import{CARD_LIST_TYPE as c,CARD_ROW_FIELD_PROP as m}from"../../../../content/card-row-keys.js";import{BOX_TYPE as r,CONTAINER_BLOCKS_SLOT as s}from"../../../container-blocks.js";import{DIM as l,INNER_BOX as a,TEXT as g,labelStyle as d,seedNodes as P,token as T,slotSeedIds as _}from"../../../seed-parts.js";import{rowFieldTextSeed as p}from"../Cards/card-seed.js";import{withCardListTemplate as f}from"../CardList/item-seed.js";import{isNodeList as E}from"efficient-easel/data";const b="ProcessSteps",u={eyebrow:"eyebrow",title:"title",copy:"copy",image:"image",tag:"tag",specs:"specs"},e=u,w=()=>({type:r,props:{...a,name:"Row",direction:"row",share:"equal",align:"center",gap:48,sectionPaddingTop:60,sectionPaddingBottom:60,sectionPaddingTopPhone:60,sectionPaddingBottomPhone:60},slots:{[s]:[{type:r,props:{...a,name:"Picture",direction:"column",gap:12},slots:{[s]:[{type:"ImageBlock",props:{[m]:e.image,aspect:"1/1",fit:"contain"}},p(e.tag,{...l,tag:"p"},d(11))]}},{type:r,props:{...a,name:"Words",direction:"column",gap:16},slots:{[s]:[p(e.eyebrow,{...g,tag:"p"},{...d(13),color:"accent"}),p(e.title,{...g,tag:"h2"},{textStyle:"heading-2",...T("headingMedium",42,28),lineHeight:1.1,letterSpacing:-.02}),p(e.copy,{...l,tag:"p"},{textStyle:"body-1",...T("body",15),lineHeight:1.6}),{type:c,props:{[m]:e.specs}}]}}]}});function y(i){return i.map(o=>{let t=o.props;for(const[S,n]of Object.entries(t))E(n)&&(t={...t,[S]:y(n)});return o.type===c?{...o,props:f(t)}:{...o,props:t}})}function B(i){return y(P([w()],_(i,"row")))}export{u as IMAGE_TEXT_ROW_FIELDS,b as PROCESS_STEPS_TYPE,w as imageTextRowSeed,B as imageTextRowTemplate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HERO_GROUP_TYPE as
|
|
1
|
+
import{HERO_GROUP_TYPE as m,HERO_SLIDE_TYPE as a,publishableGroups as u}from"../hero-group-placement.js";import{mapEachNode as n,mapNodeLists as E,mapPageLists as f}from"./node-lists.js";function c(p){return p.props?E(p,r=>{const t=n(r,c),o=p.type===a&&t.every(e=>e.type===m)?u(t):t;return o.length!==r.length||o.some((e,i)=>e!==r[i])?o:r}):p}function _(p){return f(p,s=>n(s,c))}export{_ as capHeroGroups};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DELIVERY_OPTIONS_SOURCE as R,declaredBlockSource as d}from"../content/block-sources.js";import{nonEmptyString as
|
|
1
|
+
import{DELIVERY_OPTIONS_SOURCE as R,declaredBlockSource as d}from"../content/block-sources.js";import{nonEmptyString as v}from"../non-empty-string.js";import{CARD_LIST_TYPE as C,CARD_TEMPLATE_SLOT as f}from"../content/card-template.js";import{find as b,walk as E}from"efficient-easel/data";import{BOX_TYPE as Y,CONTAINER_BLOCKS_SLOT as F}from"./container-blocks.js";import{seedNodes as p,seedNodeId as _}from"./seed-parts.js";import{CARDS_TYPE as P,SERVED_CARD_FIELDS as a,TYPED_CARD_FIELDS as l,cardIdOf as D,cardsCardSeed as y,labelOnlyCardSeed as S}from"./blocks/general/Cards/card-seed.js";import{GRID_LOOK_KEYS as k,cardListCardSeed as m,cardsGridLook as L,deliveryCardSeed as g,deliveryGridLook as h}from"./blocks/general/Cards/card-list-seed.js";import{finiteNumber as G}from"../finite-number.js";import{shapeKeyOf as A}from"./seed-shape.js";const j=()=>"",B=t=>A(p([t],j));function I(t,r,e){if(!Array.isArray(t)||t.length!==1)return null;const o=e.keys??=Object.fromEntries(Object.entries(r()).map(([n,i])=>[n,new Set(i.map(B))])),s=A(t);return Object.keys(o).find(n=>o[n].has(s))??null}const M=()=>({press:[m(l),m(a)],delivery:[g()]}),J={},O=t=>I(t,M,J),V=t=>d(t)===R?"delivery":"press";function st(t,r){if(!r||d(t)===d(r))return t;const e=O(t[f]),o=V(t);if(!e||e===o)return t;const s=_(t,C),n=o==="delivery"?g():m(d(t)?a:l),i=p([n],D(s));return{...t,[f]:i}}const z=()=>({cards:[y(l),y(a)],label:[S(!1),S(!0)]}),H={},U=t=>I(t,z,H);function it(t,r){if(!r||t.cardStyle==="label-only"==(r.cardStyle==="label-only"))return t;const e=U(t[f]),o=t.cardStyle==="label-only"?"label":"cards";if(!e||e===o)return t;const s=_(t,P),n=Array.isArray(t.items)&&t.items.some(K=>v(K?.href)!==void 0),i=o==="label"?S(n):y(d(t)?a:l),c=p([i],D(s));return{...t,[f]:c}}const T=(t,r)=>k.every(e=>JSON.stringify(t[e])===JSON.stringify(r[e]));function N(t,r){const e={...t};for(const o of k)delete e[o];return{...e,...structuredClone(r)}}function w(t){const r=t?.[F];if(!Array.isArray(r)||r.length!==1)return null;const e=r[0];return e?.type===C&&e.props?e:null}function W(t,r){const e=w(t),o=w(r);if(!e?.props||!o?.props||o.props.id!==e.props.id||d(e.props)===d(o.props))return t;const s=O(e.props[f]);if(!s||s===O(o.props[f]))return t;const n=G(t.columns);return n===void 0?t:s==="delivery"&&T(t,L(n))?N(t,h(n)):s==="press"&&T(t,h(n))?N(t,L(n)):t}function ct(t){const r=u.get(t);r?r.count+=1:u.set(t,{count:1,stop:X(t)});let e=!1;return()=>{const o=u.get(t);e||!o||(e=!0,o.count-=1,!(o.count>0)&&(o.stop(),u.delete(t)))}}const u=new WeakMap;function X(t){let r=t.getState().appState.data;return t.subscribe(()=>{const e=t.getState().appState.data;if(e===r)return;const o=r;if(r=e,e===t.loaded)return;const s=new Map;E(e,t.config,n=>{if(n.type!==Y||!w(n.props))return;const i=b(o,t.config,n.props.id);if(!i||i.node===n)return;const c=W(n.props,i.node.props);c!==n.props&&s.set(n.props.id,c)}),s.size&&t.dispatch({type:"setData",recordHistory:!1,data:n=>E(n,t.config,i=>{const c=s.get(i.props.id);return c?{...i,props:{...c,id:i.props.id}}:void 0})})})}export{st as cardFollowsContentSwitch,it as cardsFollowCardStyle,W as cardsGridFollowsContent,ct as followCardContentSwitches};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{declaredBlockSource as
|
|
1
|
+
import{declaredBlockSource as s}from"../content/block-sources.js";import{nonEmptyString as D}from"../non-empty-string.js";import{CARD_ROW_FIELD_PROP as y,CARD_TEMPLATE_SLOT as l}from"../content/card-row-keys.js";import{CONTAINER_BLOCKS_SLOT as A}from"./container-blocks.js";import{CARDS_TYPE as E,SERVED_CARD_FIELDS as d,TYPED_CARD_FIELDS as m,cardIdOf as S,cardsTemplateNodes as C,labelOnlyTemplateNodes as O}from"./blocks/general/Cards/card-seed.js";import{seedNodeId as R}from"./seed-parts.js";function h(e,t){if(e!==E)return t;if(t[l]!==void 0)return T(t);const n=R(t,E),i=S(n);if(t.cardStyle==="label-only"){const o=Array.isArray(t.items)&&t.items.some(r=>D(r?.href)!==void 0);return T({...t,[l]:O(i,o)})}const f=s(t)?d:m;return{...t,[l]:C(i,f)}}const L=e=>{const[t,n]=e?[m,d]:[d,m];return new Map([[t.title,n.title],[t.body,n.body]])};function _(e,t){let n=null;return e.forEach((i,f)=>{const o=i?.props;if(!o)return;let r=o;const c=o[y];i.type==="Text"&&typeof c=="string"&&t.has(c)&&(r={...r,[y]:t.get(c)});const a=o[A];if(Array.isArray(a)){const u=_(a,t);u!==a&&(r={...r,[A]:u})}r!==o&&(n??=[...e],n[f]={...i,props:r})}),n??e}function T(e,t){if(!Array.isArray(e[l]))return e;const n=L(!!s(e)),i=t?new Map([...n].filter(([o,r])=>t(r)&&!t(o))):n;if(!i.size)return e;const f=_(e[l],i);return f===e[l]?e:{...e,[l]:f}}export{T as cardsFieldsFollowContent,h as withCardsTemplate};
|
|
@@ -6,4 +6,5 @@ export type ListNode = {
|
|
|
6
6
|
export declare function mapEachNode<N>(list: readonly N[], fn: (node: N, index: number) => N): N[];
|
|
7
7
|
export declare function mapNodeLists<N extends ListNode>(node: N, fn: (list: ListNode[], key: string) => ListNode[]): N;
|
|
8
8
|
export declare function mapPageContent<T>(data: T, fn: (content: ListNode[]) => ListNode[]): T;
|
|
9
|
+
export declare function mapPageLists<T>(data: T, fn: (list: ListNode[]) => ListNode[]): T;
|
|
9
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNodeList as p}from"efficient-easel/data";function
|
|
1
|
+
import{isNodeList as p}from"efficient-easel/data";function l(n,r){let t=null;return n.forEach((e,o)=>{const c=r(e,o);c!==e&&((t??=n.slice())[o]=c)}),t??n}function a(n,r){let t=null;for(const[e,o]of Object.entries(n.props??{})){if(!p(o))continue;const c=r(o,e);c!==o&&((t??={...n.props})[e]=c)}return t?{...n,props:t}:n}function f(n,r){const t=n;if(!t||!Array.isArray(t.content))return n;const e=r(t.content);return e===t.content?n:{...t,content:e}}function m(n,r){const t=f(n,r),e=n?.zones;if(!e||typeof e!="object")return t;let o=null;for(const[c,s]of Object.entries(e)){if(!Array.isArray(s))continue;const i=r(s);i!==s&&((o??={...e})[c]=i)}return o?{...t,zones:o}:t}export{l as mapEachNode,a as mapNodeLists,f as mapPageContent,m as mapPageLists};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mapEachNode as
|
|
1
|
+
import{mapEachNode as a,mapNodeLists as d,mapPageLists as m}from"./node-lists.js";import{templateOnRead as u}from"../content/card-template.js";import{BLOCK_SOURCE_PROP as y,declaredBlockSource as O,isBlockSourceKey as P}from"../content/block-sources.js";const R={"Logos.logosPerRow":"columns","HeroSlide.tintOpacity":"overlay","Split.textBgTint":"overlay"},g={"Footprint.source":"typed"};function l(o){let t=o.props,n=!1;if(o.type&&t)for(const[e,r]of Object.entries(R)){const p=e.indexOf("."),i=e.slice(0,p),s=e.slice(p+1);if(i!==o.type||!(s in t))continue;const c=t[s],f={...t};delete f[s],(!(r in f)||f[r]===void 0)&&(f[r]=c),t=f,n=!0}if(o.type&&t)for(const[e,r]of Object.entries(g)){const p=e.indexOf("."),i=e.slice(p+1);if(e.slice(0,p)!==o.type||!(i in t))continue;const s=typeof t[i]=="string"?t[i].trim():"",c={...t};delete c[i],P(s)&&s!==r&&!O(c)&&(c[y]=s),t=c,n=!0}if(o.type&&t){const e=u(o.type,t);e!==t&&(t=e,n=!0)}if(t){const e=d({props:t},r=>a(r,l));e.props!==t&&(t=e.props,n=!0)}return n?{...o,props:t}:o}function _(o){return m(o,t=>a(t,l))}export{R as RENAMED_PROPS,g as SOURCE_PROPS_MOVED,_ as migrateRenamedProps};
|
|
@@ -22,4 +22,7 @@ export type SeededNode = {
|
|
|
22
22
|
props: Props;
|
|
23
23
|
};
|
|
24
24
|
export declare function seedNodes(seeds: readonly BlockSeed[], idOf: (type: string, at: string) => string, at?: string): SeededNode[];
|
|
25
|
+
export declare function seedNodeId(props: Props, fallback: string): string;
|
|
26
|
+
export declare const slotSeedIds: (nodeId: string, tag: string) => (_type: string, at: string) => string;
|
|
27
|
+
export declare function withSeededSlot(props: Props, slot: string, fallback: string, seed: (nodeId: string) => SeededNode[]): Props;
|
|
25
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NESTED_BOX_PADDING as l}from"../content/box-layout.js";import{TextMeta as
|
|
1
|
+
import{NESTED_BOX_PADDING as l}from"../content/box-layout.js";import{TextMeta as x}from"./blocks/general/Text/meta.js";const{text:L,tag:_,...g}=x.defaultProps,f=g,T={...f,tone:"dim"},u={justify:"start",align:"stretch",wrap:!1,blockSpacing:"gap",padV2:!0},S={...u,direction:"column",...l},$=(t,e=t,n=t,o=e)=>({sectionPaddingTop:t,sectionPaddingRight:e,sectionPaddingBottom:t,sectionPaddingLeft:e,sectionPaddingTopPhone:n,sectionPaddingRightPhone:o,sectionPaddingBottomPhone:n,sectionPaddingLeftPhone:o}),m=t=>({fillColor:t}),k=(t,e,n={})=>({...S,widthFit:"fixed",width:t,minWidth:t,sectionHeightMode:"fixed",sectionHeightValue:t,sectionHeightUnit:"px",...e?m(e):{},...n}),c=(t,e,n,o)=>({sizeToken:{step:t,px:e,...o?{stepPhone:o}:{},...n?{pxPhone:n}:{}}}),N=t=>({textStyle:"body-1",...c("body",t),lineHeight:1.625}),s={case:"upper"},P={textStyle:"body-5",...s},h=(t,e)=>({...c("label",t,e),letterSpacing:.2,...s}),w=(t,e)=>({...P,...h(t,e)});function b(t,e,n=""){return t.map((o,i)=>{const d=n?`${n}.${i}`:String(i),r={...o.props??{}};for(const[p,a]of Object.entries(o.slots??{}))r[p]=b(a,e,d);return{type:o.type,props:{...r,id:e(o.type,d)}}})}function y(t,e){return typeof t.id=="string"&&t.id.trim()?t.id:e}const A=(t,e)=>(n,o)=>o==="0"?`${t}~${e}`:`${t}~${e}.${o.slice(2)}`;function D(t,e,n,o){return t[e]!==void 0?t:{...t,[e]:o(y(t,n))}}export{u as BOX,T as DIM,S as INNER_BOX,P as LABEL_FACE,f as TEXT,$ as boxPadding,m as fillSlot,h as labelLook,w as labelStyle,k as markBoxProps,N as relaxedBodyLook,y as seedNodeId,b as seedNodes,A as slotSeedIds,c as token,D as withSeededSlot};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ENTRANCE_STORE_KEYS as y,LEGACY_ENTRANCE_KEY as m}from"../animation/entrance-keys.js";import{SCROLL_STORE_KEYS as S}from"../animation/scroll.js";import{PICTURE_DOTS as E,viewFocusKeys as f}from"../content/picture-focus-rows.js";import{SECTION_PIN_KEYS as u}from"../content/section-sticky.js";import{SECTION_CORNERS_ROW as v}from"../content/section-corners.js";import{SECTION_BORDER_UNIT_KEYS as T}from"../content/borders.js";import{SECTION_WIDTH_KEYS as _}from"../content/section-width.js";import{DEFAULT_TINT as O}from"../content/tint.js";import{finiteNumber as b}from"../finite-number.js";import{nonEmptyString as
|
|
1
|
+
import{ENTRANCE_STORE_KEYS as y,LEGACY_ENTRANCE_KEY as m}from"../animation/entrance-keys.js";import{SCROLL_STORE_KEYS as S}from"../animation/scroll.js";import{PICTURE_DOTS as E,viewFocusKeys as f}from"../content/picture-focus-rows.js";import{SECTION_PIN_KEYS as u}from"../content/section-sticky.js";import{SECTION_CORNERS_ROW as v}from"../content/section-corners.js";import{SECTION_BORDER_UNIT_KEYS as T}from"../content/borders.js";import{SECTION_WIDTH_KEYS as _}from"../content/section-width.js";import{DEFAULT_TINT as O}from"../content/tint.js";import{finiteNumber as b}from"../finite-number.js";import{nonEmptyString as l}from"../non-empty-string.js";import{DEFAULT_OVERLAY_POSITION as w}from"./hero-overlay.js";import{normaliseVideoSource as g}from"../hero-video.js";import{VIEW_HIDE_KEYS as H}from"../content/view-hide-class.js";import{ownEntry as x}from"../own-entry.js";import{seedNodeId as C}from"../document/seed-parts.js";const I=50,d=["mediaImage","mediaVideo","poster","tintColor","mediaLayout","mediaLayoutPhone","mediaImage2","tintColor2","tintOpacity2","videoSource","youtubeUrl","videoPlayback","_partMotion",...E.filter(r=>r.block==="HeroSingle").flatMap(r=>f(r.focus))],k=["heightDesktop","heightMobile","heightFixed","heightFixedTablet","heightFixedMobile","sectionCorners",v.unitKey,"sectionCornerSides","sectionBorder","sectionBorderTablet","sectionBorderPhone",...T,"sectionAccent",...u,"anchor",...y,m,...S,...Object.values(_),...H],N=new Set(k),R="the Hero does not read this key as a section setting (only the section pass rows both heroes share carry), so it is not copied",P={eyebrow:"the single Hero stopped drawing its own copy on 2026-09-09 (owner: delete the old text); the words are blocks in its boxes, which the slide keeps",titleTop:"the single Hero stopped drawing its own copy on 2026-09-09 (owner: delete the old text); the words are blocks in its boxes, which the slide keeps",titleLevel:"it set the level of the copy the single Hero stopped drawing on 2026-09-09; a Text block in a box sets its own level",alignment:"its row was deleted on 2026-09-09 with the copy it placed; a box places itself on nine anchors, and the value was drawn by nothing"};function z(r){const e=r.props,a=C(e,"HeroSingle"),i=[],n=[],t={id:`${a}~slide`},s={id:`${a}~hero`};t.mediaType=e.mediaType==="video"?"video":"image","mediaType"in e&&i.push({key:"mediaType",home:"HeroSlide.mediaType"}),t.mediaType==="video"&&g(e.videoSource)==="upload"&&(t.videoSpeed=I);for(const o of d)o in e&&(t[o]=e[o],i.push({key:o,home:`HeroSlide.${o}`}));"tintOpacity"in e&&(t.overlay=e.tintOpacity,i.push({key:"tintOpacity",home:"HeroSlide.overlay (Image tint)"})),t.overlayColor=l(e.overlayColor)??O,t.overlayPosition=l(e.overlayPosition)??w,"overlayColor"in e&&i.push({key:"overlayColor",home:"HeroSlide.overlayColor"}),"overlayPosition"in e&&i.push({key:"overlayPosition",home:"HeroSlide.overlayPosition"}),Array.isArray(e.boxes)?(t.groups=e.boxes,i.push({key:"boxes",home:"HeroSlide.groups (the same HeroGroup boxes)"})):"boxes"in e&&i.push({key:"boxes",home:"HeroSlide.groups (none stored)"}),s.textureOpacity=b(e.overlay)??100,"overlay"in e&&i.push({key:"overlay",home:"Hero.textureOpacity (the ramp's opacity)"}),s.showTicker=!1;const h=new Set(["id","mediaType","tintOpacity","overlay","overlayColor","overlayPosition","boxes",...d]);for(const[o,c]of Object.entries(e)){if(h.has(o))continue;const p=x(P,o);if(p!==void 0){n.push({key:o,why:p});continue}if(!N.has(o)){n.push({key:o,why:R});continue}s[o]=c,i.push({key:o,home:`Hero.${o} (section pass)`})}return s.slides=[{type:"HeroSlide",props:t}],{node:{type:"Hero",props:s},carried:i,dropped:n}}export{k as HERO_SECTION_PASS_KEYS,z as heroSingleToHero};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isRegistryPath as
|
|
2
|
-
`,e.index)+1,r=n.slice(h,e.index);if(/^\s*(\/\/|\*|\/\*)/.test(r)||(r.match(/"/g)??[]).length%2===1||/\bfunction\s+$/.test(r))continue;
|
|
3
|
-
`).length;o.push({at:`${s.path}:${
|
|
4
|
-
`)});o("the reader finds the two calls, and neither the docblock, the declaration, the string nor the comment",t.length===2&&t[0].at==="fixture.tsx:7"&&t[1].at==="fixture.tsx:12",JSON.stringify(t)),o("…reads a concatenated reason whole, so it can be checked for a source",t[0]?.reason==="A facet's options grow out of the CATALOGUE — owner, 2026-08-29."&&
|
|
1
|
+
import{isRegistryPath as u,registryFiles as m}from"./support/registry-source.js";import{ruleChecks as g}from"./rule.js";import{blockEnd as x}from"./support/css-rules.js";import{isDocumentPath as y}from"./support/document-folder.js";const w=s=>y(s,"controls.tsx"),p=/doc\/naming\.md|N10\.\d|owner|GG|SS seat|editor-shell|\d{4}-\d{2}-\d{2}/;function G(s){const n=m(s),o=s.filter(e=>w(e.path)&&!u(e.path)),c=s.filter(e=>/^components\/[^/]+\.tsx$/.test(e.path));return[...n,...o,...c]}function d(s){const n=s.text,o=[],c=/noGlyph\(/g;let e;for(;e=c.exec(n);){const h=n.lastIndexOf(`
|
|
2
|
+
`,e.index)+1,r=n.slice(h,e.index);if(/^\s*(\/\/|\*|\/\*)/.test(r)||(r.match(/"/g)??[]).length%2===1||/\bfunction\s+$/.test(r))continue;const i=e.index+e[0].length-1,t=[...n.slice(i+1,x(n,i)).matchAll(/"((?:[^"\\]|\\.)*)"/g)].map(f=>f[1]).join(""),a=n.slice(0,e.index).split(`
|
|
3
|
+
`).length;o.push({at:`${s.path}:${a}`,reason:t})}return o}function O(s,n){const{check:o,report:c}=g("no-glyph rows");{const t=d({path:"fixture.tsx",text:["/**"," * `noGlyph(reason)` — the docblock names it; that is not a use."," */","export function noGlyph(reason: string) {",' if (!reason) throw new Error("noGlyph() needs a reason");',"}",'const a = select("Process", noGlyph(',` "A facet's options grow out of the CATALOGUE — owner, " +`,' "2026-08-29.",',"));",'// noGlyph("in a comment") is not a use','const b = noGlyph("");'].join(`
|
|
4
|
+
`)});o("the reader finds the two calls, and neither the docblock, the declaration, the string nor the comment",t.length===2&&t[0].at==="fixture.tsx:7"&&t[1].at==="fixture.tsx:12",JSON.stringify(t)),o("…reads a concatenated reason whole, so it can be checked for a source",t[0]?.reason==="A facet's options grow out of the CATALOGUE — owner, 2026-08-29."&&p.test(t[0].reason),JSON.stringify(t[0])),o("…and reads a bare call as no reason",t[1]?.reason==="",JSON.stringify(t[1]));const a=d({path:"open.tsx",text:'const c = noGlyph("cut off, owner 2026-11-16."'});o("…and reads a call left open at the end to the end",a[0]?.reason==="cut off, owner 2026-11-16.",JSON.stringify(a))}const e=G(s),h=e.reduce((t,a)=>t+a.text.length,0);o(`the scan read the files it meant to (${e.length} files, ${h} characters, at least ${n.minChars})`,h>=n.minChars,"the registry, lib/document/controls.tsx or components/ moved — a scan that reads nothing finds no exceptions");const r=e.flatMap(d),i=r.filter(t=>!t.reason.trim());o("every noGlyph() states a reason",i.length===0,i.map(t=>t.at).join(" · "));const l=r.filter(t=>t.reason.trim()&&!p.test(t.reason));return o("…and every reason names a source that can be checked",l.length===0,l.map(t=>`${t.at} — "${t.reason.slice(0,60)}"`).join(" · ")),o(`the no-glyph rows still number ${n.expected} (found ${r.length}${r.length?`: ${r.map(t=>t.at).join(", ")}`:""})`,r.length===n.expected,"a ruling was added or lost — move the number, with the ruling, in the guard that counts it"),c()}export{O as noGlyphRows,d as noGlyphRowsIn};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RuleReport, type SourceFile } from "./rule.js";
|
|
2
|
+
export type OneNodeListLoopOptions = {
|
|
3
|
+
readonly allowed?: Readonly<Record<string, readonly string[]>>;
|
|
4
|
+
readonly minFiles?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function oneNodeListLoop(files: readonly SourceFile[], options?: OneNodeListLoopOptions): RuleReport;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ruleChecks as h}from"./rule.js";import{blockEnd as d}from"./support/css-rules.js";import{stripComments as m}from"./support/ts-source.js";import{checkExemptionsStillHere as p}from"./support/exemptions.js";import{SOURCE_FILE as w}from"./support/source-file.js";const u=[{head:/for \((?:const|let) \[\w+, (\w+)\] of Object\.entries\(/g,by:"value"},{head:/for \((?:const|let) (\w+) of Object\.values\(/g,by:"value"},{head:/for \((?:const|let) (\w+) of Object\.keys\(/g,by:"key"},{head:/for \((?:const|let) (\w+) in /g,by:"key"},{head:/Object\.entries\([^\n]*?\)\.(?:map|forEach)\(\(\[\w+, (\w+)\](?:\s*:[^)]*)?\)\s*=>/g,by:"value"},{head:/Object\.values\([^\n]*?\)\.(?:map|forEach)\(\(?(\w+)(?:\s*:[^)=]*)?\)?\s*=>/g,by:"value"},{head:/Object\.keys\([^\n]*?\)\.(?:map|forEach)\(\(?(\w+)(?:\s*:[^)=]*)?\)?\s*=>/g,by:"key"}],g=[/(?:const|let)\s+(\w+)\s*=\s*\(\s*(\w+)[^)]*\)[^=\n]*=>\s*isNodeList\(\s*\2\s*\)/g,/function\s+(\w+)\s*\(\s*(\w+)[^)]*\)[^{]*\{\s*return\s+isNodeList\(\s*\2\s*\)/g];function b(e,o){const s=o[0];if(s.startsWith("for")){let t=d(e,o.index+s.indexOf("("))+1;for(;/\s/.test(e[t]??"");)t++;if(e[t]==="{")return e.slice(t,d(e,t)+1);const a=e.indexOf(";",t);return e.slice(t,a<0?e.length:a+1)}const n=o.index+Math.max(s.lastIndexOf(".map("),s.lastIndexOf(".forEach("))+s.slice(Math.max(s.lastIndexOf(".map("),s.lastIndexOf(".forEach("))).indexOf("(");return e.slice(n,d(e,n)+1)}const y=(e,o)=>new RegExp(String.raw`(?:\b(?:${o.join("|")})\(\s*${e}\s*\)`+String.raw`|Array\.isArray\(\s*${e}\s*\)\s*&&[^;]{0,80}?${e}\.(?:some|every)\(`+String.raw`|!Array\.isArray\(\s*${e}\s*\)\s*\|\|\s*!${e}\.(?:some|every)\()`);function x(e){const o=["isNodeList",...g.flatMap(n=>[...e.matchAll(n)].map(l=>l[1]))],s=[];for(const{head:n,by:l}of u){n.lastIndex=0;for(let t=n.exec(e);t;t=n.exec(e)){const a=b(e,t),i=t[1];if(!(l==="value"?[i]:[String.raw`[\w$.]+\[${i}\]`,...[...a.matchAll(new RegExp(String.raw`(?:const|let)\s+(\w+)\s*=\s*[^;]*\[${i}\]`,"g"))].map(f=>f[1])]).some(f=>y(f,o).test(a)))continue;const c=[...e.slice(0,t.index).matchAll(/function (\w+)|const (\w+) = (?:\([^)]*\)|\w+)[^=\n]*=>/g)].pop();s.push(c?c[1]??c[2]:"(top level)")}}return s}function L(e,o={}){const{check:s,report:n}=h("one walk over a node's lists"),l=o.allowed??{},t=e.filter(i=>w.test(i.path));s("the read found the source",t.length>=(o.minFiles??1),`read ${t.length} files, floor ${o.minFiles??1}`),p(s,t,Object.keys(l));const a=t.flatMap(i=>x(m(i.text)).filter(r=>!(l[i.path]??[]).includes(r)).map(r=>`${i.path} (${r})`));return s("no file keeps its own loop over a node's lists (use lib/document/node-lists)",a.length===0,a.length?`own loops: ${a.join(", ")}`:void 0),n()}export{L as oneNodeListLoop};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ruleChecks as
|
|
1
|
+
import{ruleChecks as y}from"./rule.js";import{SOURCE_FILE as S}from"./support/source-file.js";const f=/\b(?:function|const|let)\s+isNode(?:List|Array)?\b/,d=/Array\.isArray\(([\w.$]+)\)\s*(?:&&|\|\|)[^;]{0,240}?(?:\1\.every\(|\1\[0\])[^;]{0,240}?\btype\b/,n=String.raw`([\w$]+(?:\??\.[\w$]+|(?:\?\.)?\[[\w$]+\])*)`,h=/\(\s*([\w$]+)\s+as\s+[\w$.<>[\]|{}:?;, ]+?\)/g,w=s=>String.raw`${s}(?:\??\.type\b|\[["']type["']\])`,g=s=>String.raw`(?:${s}(?:\??\.props\b|\[["']props["']\])|["']props["']\s+in\s+${s}\b|Object\.hasOwn\(\s*${s}\s*,\s*["']props["']\s*\))`,e=String.raw`\s*[!=]==?\s*`,a=s=>String.raw`(?:typeof\s+${w(s)}${e}["']string["']|["']string["']${e}typeof\s+${w(s)})`,r=String.raw`[^;]{0,200}?`,l=[new RegExp(String.raw`typeof\s+${n}(?:\??\.type\b|\[["']type["']\])${e}["']string["']${r}${g("\\1")}`),new RegExp(String.raw`["']string["']${e}typeof\s+${n}(?:\??\.type\b|\[["']type["']\])${r}${g("\\1")}`),new RegExp(String.raw`${n}(?:\??\.props\b|\[["']props["']\])${r}${a("\\1")}`),new RegExp(String.raw`["']props["']\s+in\s+${n}${r}${a("\\1")}`),new RegExp(String.raw`Object\.hasOwn\(\s*${n}\s*,\s*["']props["']\s*\)${r}${a("\\1")}`),new RegExp(String.raw`\{\s*(?:type\s*:\s*(\w+)\s*,\s*props\s*:\s*\w+|props\s*:\s*\w+\s*,\s*type\s*:\s*(\w+))[^}]*\}${r}(?:typeof\s+(?:\1|\2)${e}["']string["']|["']string["']${e}typeof\s+(?:\1|\2)\b)`),new RegExp(String.raw`\{\s*(?:type\s*,\s*props|props\s*,\s*type)\b[^}]*\}${r}(?:typeof\s+type${e}["']string["']|["']string["']${e}typeof\s+type\b)`),new RegExp(String.raw`(?:const|let)\s+(\w+)\s*=\s*([\w$]+(?:\??\.[\w$]+)*)\??\.type\s*;\s*${r}(?:typeof\s+\1${e}["']string["']|["']string["']${e}typeof\s+\1\b)${r}\2\??\.props\b`)],E=s=>{const p=s.replace(h,"$1");return l.some(o=>o.test(p))},b=/Array\.isArray\(([\w$.]+)\)\s*&&[^;]{0,80}?\1\.every\(\s*isNode\s*\)/;function A(s){const{check:p,report:o}=y("one node-list check"),c=s.filter(t=>S.test(t.path)),i=c.filter(t=>f.test(t.text)).map(t=>t.path);p("no file declares isNode / isNodeList / isNodeArray (import them from efficient-easel/data)",i.length===0,i.length?`a local node check: ${i.join(", ")}`:void 0);const $=c.filter(t=>d.test(t.text)||b.test(t.text)||E(t.text)).map(t=>t.path);return p("no file writes the node check under another name",$.length===0,$.length?`a renamed node check: ${$.join(", ")}`:void 0),o()}export{A as oneNodeList};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RuleReport, type SourceFile } from "./rule.js";
|
|
2
|
+
export type OneSeedIdHomeOptions = {
|
|
3
|
+
readonly home?: string;
|
|
4
|
+
readonly minFiles: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function oneSeedIdHome(files: readonly SourceFile[], options: OneSeedIdHomeOptions): RuleReport;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ruleChecks as a}from"./rule.js";import{SOURCE_FILE as c}from"./support/source-file.js";import{stripComments as l}from"./support/ts-source.js";const h=[{name:"the id function",re:/~(?:[\w-]+|\$\{[^}]+\})\.\$\{\s*[\w$]+\.slice\(\s*2\s*\)\s*\}/},{name:"the node id read",re:/\bnonEmptyString\(\s*[\w$.]+\.id\s*\)\s*\?\?/},{name:"the node id read",re:/typeof\s+([\w$.]+)\.id\s*===\s*["'`]string["'`]\s*&&\s*\1\.id\.trim\(\s*\)/},{name:"the node id read",re:/\bString\(\s*[\w$.]+\.id\s*\?\?\s*["'`][A-Za-z]/}];function u(o,t){const{check:i,report:d}=a("one seed-id home"),s=o.filter(e=>c.test(e.path));i(`at least ${t.minFiles} source files read`,s.length>=t.minFiles,`${s.length} read`);const n=s.filter(e=>e.path!==t.home).flatMap(e=>{const m=l(e.text);return h.filter(r=>r.re.test(m)).map(r=>`${e.path} (${r.name})`)});return i("no file writes a seed id function or node id read of its own (import seedNodeId / slotSeedIds / withSeededSlot from lib/document/seed-parts)",n.length===0,n.length?`a copy: ${n.join(", ")}`:void 0),d()}export{u as oneSeedIdHome};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ruleChecks as y}from"./rule.js";const
|
|
2
|
-
${
|
|
1
|
+
import{ruleChecks as y}from"./rule.js";import{blockEnd as $}from"./support/css-rules.js";const f="<img",o="<Image",b=/createElement\(\s*["']img["']/g,w=/(^|\s)loading=(?:"lazy"|\{(?!\s*["'`]eager))|\{\s*loading:\s*"lazy"/,k=/\.\.\.\s*\(?\s*(?:deferred\b|useDeferredPicture\b)/,P=/\spriority(?=[\s/>]|=\{true\})|\sloading=(?:"eager"|\{\s*["'`]eager)/;function u(r,t){const n=[];let a=r.indexOf(t);for(;a!==-1;){const l=r[a+t.length];if(l===void 0||/\s|\/|>/.test(l)){let s=a;for(;s<r.length&&r[s]!==">";)s=r[s]==="{"?$(r,s)+1:s+1;n.push(r.slice(a,s+1))}a=r.indexOf(t,a+1)}return n}function d(r){const t=r.replace(/\/\*[\s\S]*?\*\/|(^|\s)\/\/.*$/gm,"$1"),n=/\buseDeferredPicture\(/.test(t);return[...u(t,f).filter(a=>!w.test(a)&&!(n&&k.test(a))),...u(t,o).filter(a=>P.test(a)),...t.match(b)??[]]}function x(r,t){const{check:n,report:a}=y("page picture place"),l=t.allowed??{};{const e=i=>`${f} ${i} />`,c=[["a bare tag",e('src={a} alt=""')],["a tag with an arrow in a handler",e("src={a} onError={() => fail()}")],["an eager tag",e('src={a} loading="eager"')],["an eager tag in braces",e('src={a} loading={"eager"}')],["a look-alike attribute",e('src={a} data-loading="x"')],["the word in a handler",e("src={a} onLoad={() => { state.loading = false; }}")],["a spread of `deferred` from anywhere",e("src={a} {...deferred}")],["a created tag",'createElement("img", { src: a })'],["a next image asked first",`${o} src={a} priority />`],["a next image made eager",`${o} src={a} loading="eager" />`],["a next image made eager in braces",`${o} src={a} loading={"eager"} />`],["a bare tag with a stray } before a lazy tag",`${e("src={a} }")} <p loading="lazy">x</p>`]];for(const[i,g]of c)n(`the reader finds ${i}`,d(g).length===1);const p=[["a lazy tag",e('src={a} loading="lazy"')],["a lazy tag in braces",e('src={a} loading={"lazy"}')],["a loading chosen in code",e('src={a} loading={far ? "lazy" : "eager"}')],["a conditional lazy tag",e('src={a} {...(far ? { loading: "lazy" as const } : {})}')],["a spread from the page's place",`const deferred = useDeferredPicture(); ${e("src={a} {...deferred}")}`],["a next image",`${o} src={a} />`],["a next image chosen by place",`${o} src={a} {...(far ? {} : { priority: true })} />`],["a lookalike block",`${o}Block src={a} priority />`],["another element that starts the same",`${f}Row src={a} />`]];for(const[i,g]of p)n(`…and leaves ${i} alone`,d(g).length===0)}const s=r.filter(e=>e.path.endsWith(".tsx"));n(`read the source (${s.length} .tsx files, at least ${t.minFiles})`,s.length>=t.minFiles,"fewer means the walk broke, and every check below is vacuous");const h=s.filter(e=>!(e.path in l)).flatMap(e=>d(e.text).map(()=>e.path));n("every plain picture says how it loads",h.length===0,`
|
|
2
|
+
${h.join(`
|
|
3
3
|
`)}
|
|
4
|
-
Draw a PagePicture, or spread useDeferredPicture (lib/first-screen).`);const m=Object.keys(
|
|
4
|
+
Draw a PagePicture, or spread useDeferredPicture (lib/first-screen).`);const m=Object.keys(l).filter(e=>!s.some(c=>c.path===e&&d(c.text).length>0));return n("every exemption still draws a silent picture",m.length===0,`drop these from \`allowed\`: ${m.join(", ")}`),a()}export{x as pagePicturePlace};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{isRuleSource as C,ruleChecks as I}from"./rule.js";import{stripCommentsAndStrings as O}from"./support/css-source.js";import{stripComments as S}from"./support/ts-source.js";const R=["all","transform","translate","rotate","scale","top","right","bottom","left","inset","margin","padding","width","height","max-height","max-width","min-height","min-width","gap","flex","flex-basis","grid-template-columns","grid-template-rows","background-position","object-position","offset-distance"],
|
|
2
|
-
`).entries())x.test(r)&&e.push({file:n.path,line:
|
|
3
|
-
`).entries())
|
|
4
|
-
a { color: red; }`))===null);const i="@media (prefers-reduced-motion: reduce) { * { animation-duration: 1ms !important; } }";e("the layer check fails on a layered copy and passes on an unlayered one",$(i)?.unlayered===!0&&$(`@layer base { ${i} }`)?.unlayered===!1&&$(`@layer base { a { color: red; } } ${i}`)?.unlayered===!0),e("valueOf reads a declaration and drops !important",
|
|
1
|
+
import{isRuleSource as C,ruleChecks as I}from"./rule.js";import{stripCommentsAndStrings as O}from"./support/css-source.js";import{stripComments as S}from"./support/ts-source.js";import{blockEnd as D}from"./support/css-rules.js";const R=["all","transform","translate","rotate","scale","top","right","bottom","left","inset","margin","padding","width","height","max-height","max-width","min-height","min-width","gap","flex","flex-basis","grid-template-columns","grid-template-rows","background-position","object-position","offset-distance"],N=["opacity","color","background-color","border-color"],x=/\bbehaviou?r\s*:\s*["'`]smooth["'`]/,A=/\b(transition|animation)[a-z-]*\s*:[^;]*!important/i;function $(n){const o=n.search(/@media[^{]*prefers-reduced-motion\s*:\s*reduce/);if(o<0)return null;let e=0;const h=[];let r="";for(let y=0;y<o;y++){const g=n[y];if(g==="{"){const t=/^@layer\b/.test(r.trim());h.push(t),t&&e++,r=""}else g==="}"?(h.pop()&&e--,r=""):g===";"?r="":r+=g}const d=n.indexOf("{",o);if(d<0)return null;const p=D(n,d);if(p>=n.length)return null;const u=n.slice(d+1,p),s=u.indexOf("{"),b=u.lastIndexOf("}");return s<0||b<0?null:{body:u,selector:u.slice(0,s).trim().replace(/\s+/g," "),decls:u.slice(s+1,b),unlayered:e===0}}function m(n,o){const e=new RegExp(`(?:^|;)\\s*${o}\\s*:([^;]*)`,"i"),h=n.match(e);return h?h[1].replace(/!important/i,"").trim().replace(/\s+/g," "):null}function j(n){const o=S(n.text),e=[];for(const[h,r]of o.split(`
|
|
2
|
+
`).entries())x.test(r)&&e.push({file:n.path,line:h+1,text:r.trim()});return e}function B(n,o){const e=O(n.text),h=o?e.replace(o,""):e,r=[];for(const[d,p]of h.split(`
|
|
3
|
+
`).entries())A.test(p)&&r.push(`${n.path}:${d+1} ${p.trim()}`);return r}function U(n,o){const{check:e,report:h}=I("reduced motion"),r=o.editorOnly??{},d=new Map(n.map(t=>[t.path,t]));{e("a rule that exists only in a comment is NOT counted",$(O(`/* the site should have a @media (prefers-reduced-motion: reduce) rule */
|
|
4
|
+
a { color: red; }`))===null);const i="@media (prefers-reduced-motion: reduce) { * { animation-duration: 1ms !important; } }";e("the layer check fails on a layered copy and passes on an unlayered one",$(i)?.unlayered===!0&&$(`@layer base { ${i} }`)?.unlayered===!1&&$(`@layer base { a { color: red; } } ${i}`)?.unlayered===!0),e("valueOf reads a declaration and drops !important",m("animation-duration: 1ms !important;","animation-duration")==="1ms"&&m("transition-property: opacity, color !important;","transition-property")==="opacity, color"&&m("animation-duration: 1ms;","animation")===null&&m("scroll-behavior: auto;","animation-delay")===null);const a=f=>(f??"").split(",").map(v=>v.trim()),c=a(m("transition-property: opacity, transform !important;","transition-property")),w=a(m("transition-property: opacity, color !important;","transition-property"));e("the moving-property check fails on a copy that lets transform through, and passes a fade-only list",c.some(f=>R.includes(f))&&!w.some(f=>R.includes(f))),e("the !important scan flags a motion declaration and not one in a comment",B({path:"fixture.css",text:`/* transition: x !important */
|
|
5
5
|
a { transition: opacity 1s !important; }`},null).length===1),e("the smooth-scroll regex bites, both ways",x.test('el.scrollIntoView({ behavior: "smooth" })')&&x.test("window.scrollTo({ top: 0, behavior: 'smooth' })")&&!x.test("el.scrollIntoView({ behavior: scrollBehavior() })")&&!x.test('window.scrollTo({ top: 0, behavior: "auto" })')),e("a commented example is not a breach",j({path:"fixture.ts",text:`// behavior: "smooth" in a comment
|
|
6
|
-
const a = 1;`}).length===0)}const
|
|
7
|
-
`+
|
|
8
|
-
`)),e(`read the scripts (${
|
|
9
|
-
`)+"\n Call `scrollBehavior()` from components/useReducedMotion.ts instead. It still scrolls — it just arrives instead of travelling.");for(const[t,i]of Object.entries(r)){const a=
|
|
6
|
+
const a = 1;`}).length===0)}const p=n.filter(t=>t.path.endsWith(".css")),u=n.filter(t=>/\.tsx?$/.test(t.path)&&!t.path.endsWith(".d.ts")&&!C(t.path));let s=null;if(o.globalSheet!==void 0){const t=d.get(o.globalSheet),i=t?O(t.text):"";s=$(i);const a=o.globalSheet;e(`${a} was actually read`,i.length>1e4,`expected the real stylesheet, got ${i.length} chars`),e(`${a} has a real prefers-reduced-motion rule, not just prose about one`,s!==null&&s.decls.trim().length>0,"no `@media (prefers-reduced-motion: reduce)` block once comments are stripped, or it is empty. Before this rule landed the sheet's ONLY match for that string was a comment, which is the state this asserts is over."),e("the rule is UNLAYERED, so Tailwind's utilities cannot outrank it",s?.unlayered===!0,"the reduced-motion rule sits inside an @layer. Tailwind's utilities live in a later layer, so every `transition-*` class would beat it and the site would move for everyone, with nothing to show for it.");const c=s?.selector??"";e("the rule applies to every element and both generated boxes",/\*/.test(c)&&/::before/.test(c)&&/::after/.test(c),`selector \`${c}\` — it must start from \`*\` (a narrower one covers only what somebody remembered) and cover \`::before\` and \`::after\`: a generated box animates like any other`);const w=(s?.decls??"").split(";").map(l=>l.trim()).filter(l=>l.length>0),f=w.filter(l=>!/!important\s*$/i.test(l)).map(l=>l.split(":")[0].trim());e("every declaration carries !important",w.length>=4&&f.length===0,`${w.length} declaration(s), without !important: ${f.join(", ")||"(none)"}. Being unlayered beats Tailwind, but not the unlayered class rules in the same sheet and not an inline style.`);const v=m(s?.decls??"","transition-property"),E=(v??"").split(",").map(l=>l.trim().toLowerCase()),T=E.filter(l=>R.includes(l));e("the transition allow-list lets nothing move",v!==null&&T.length===0,v===null?"the rule must set `transition-property` — that is how movement is sorted from fades":`movement is back on the allow-list: ${T.join(", ")}. Anything on that list still animates for a visitor who asked for no motion.`);const M=N.filter(l=>!E.includes(l));e("the transition allow-list still lets fades through",M.length===0,`\`${M.join("`, `")}\` must stay transitionable. A fade carries no movement, helps people follow what changed, and harms nobody — dropping it is the crude rule this one was written instead of.`);const k=m(s?.decls??"","animation-duration");e("animations are collapsed to a short NON-ZERO time",k!==null&&/^(0?\.\d+|[1-9]\d*)m?s$/.test(k),`animation-duration is \`${k}\`; the rule must cap it (CSS cannot sort a keyframe list by what it moves), and exactly 0s stops \`animationend\` firing in some engines and hangs any component waiting on it.`),e("a loop that still repeats is still a loop: animation-iteration-count is 1",m(s?.decls??"","animation-iteration-count")==="1"),e("animations are not collapsed with `animation: none`, which can hide content",m(s?.decls??"","animation")===null,"an element whose static styles are invisible, made visible by a `forwards` fill, would never appear. Run the animation to its end instead."),e("a scroll the visitor did not ask for is movement too: scroll-behavior is auto",m(s?.decls??"","scroll-behavior")==="auto","the sheet sets `scroll-behavior: smooth` on html inside @layer base; this must turn it off."),e("the escape hatch exists and is spelled the one way",/\[data-motion-keep\]/.test(c),"the exemption attribute must appear in the selector, so one grep finds every exception.")}for(const t of o.stylesheets??[])e(`read the stylesheet ${t}`,d.has(t)&&t.endsWith(".css"));const b=p.flatMap(t=>B(t,t.path===o.globalSheet&&s?s.body:null));e(`nothing in the stylesheets can outrank the rule (${p.length} sheet(s))`,p.length>0&&b.length===0,p.length===0?"read no stylesheet — this check is not measuring anything":`!important motion declaration(s) outside the reduced-motion rule:
|
|
7
|
+
`+b.join(`
|
|
8
|
+
`)),e(`read the scripts (${u.length} .ts/.tsx files, at least ${o.minScripts})`,u.length>=o.minScripts);const y=u.flatMap(j),g=y.filter(t=>!(t.file in r));e("no shopper-facing code hard-codes a smooth scroll",g.length===0,'an explicit `behavior: "smooth"` beats the stylesheet, so this scroll animates for a visitor who asked for no motion:\n '+g.map(t=>`${t.file}:${t.line} ${t.text}`).join(`
|
|
9
|
+
`)+"\n Call `scrollBehavior()` from components/useReducedMotion.ts instead. It still scrolls — it just arrives instead of travelling.");for(const[t,i]of Object.entries(r)){const a=d.get(t);e(`the editor waiver is still real: ${t} (${i})`,!!a&&/editor/i.test(a.text.slice(0,400))&&y.some(c=>c.file===t),a?"its own opening no longer says it is the editor's, or it no longer holds the literal — the waiver covers nothing":"the file is gone — remove the stale entry")}for(const[t,i]of Object.entries(o.askingSites??{})){const a=d.get(t),c=a?(S(a.text).match(/behaviou?r:\s*scrollBehavior\(\)/g)??[]).length:-1;e(`${t} still asks scrollBehavior() ${i} time(s)`,c===i,a?`found ${c}. A shopper-facing scroll stopped asking — if a site was deliberately removed, change the number and say which.`:"the file is gone")}if(o.hook!==void 0){const t=d.get(o.hook),i=t?S(t.text):"";e(`${o.hook} exports scrollBehavior()`,/export function scrollBehavior\(\)/.test(i)),e(`${o.hook} names the media query once and shares it`,/export const REDUCED_MOTION_QUERY/.test(i),"the media query must be named once and shared, not typed out per reader");const a=(i.match(/prefers-reduced-motion/g)??[]).length;e(`the query string appears exactly once in ${o.hook}`,a===1,`it appears ${a} times. Two spellings of the same question can disagree; there must be exactly one.`)}return h()}export{x as HARD_CODED_SMOOTH,R as MOVING_PROPERTIES,N as REQUIRED_FADES,j as hardCodedSmoothScrolls,$ as readReduceBlock,U as reducedMotion,m as valueOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function d(
|
|
1
|
+
import{blockEnd as u}from"./css-rules.js";function d(t,l){let n=t;for(let o=0;o<32;o++){const c=n.lastIndexOf("var(");if(c===-1)return n;const i=u(n,c+3);if(i>=n.length)throw new Error(`unbalanced var() in: ${t}`);const r=n.slice(c+4,i),e=r.indexOf(","),a=(e===-1?r:r.slice(0,e)).trim(),s=e===-1?"":r.slice(e+1).trim(),m=l[a]??s;if(!m)throw new Error(`var ${a} unset with no fallback in: ${t}`);n=n.slice(0,c)+m+n.slice(i+1)}throw new Error(`var() resolution did not converge: ${t}`)}function h(t,l,n={}){const o=d(t,n).replace(/([\d.]+)rem/g,(e,a)=>`(${Number(a)*16})`).replace(/([\d.]+)px/g,"($1)").replace(/([\d.]+)vw/g,`($1*${l}/100)`);if(!/^[\d\s+*/().,a-z-]+$/i.test(o))throw new Error(`unexpected chars: ${o}`);const r=new Function("calc","min","max","clamp",`return (${o});`)(e=>e,Math.min,Math.max,(e,a,s)=>Math.max(e,Math.min(a,s)));if(!Number.isFinite(r))throw new Error(`did not evaluate to a number: ${t}`);return Math.round(r*100)/100}export{h as evalLength,d as resolveVars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function p(e,t){const n=e[t]==="("||e[t]==="["?e[t]:"{",s=n==="("?")":n==="["?"]":"}";let i=0;for(let r=t;r<e.length;r+=1)if(e[r]===n)i+=1;else if(e[r]===s&&(i-=1,i===0))return r;return e.length}function m(e,t=null,n=[],s=null){if(s!==null){const r=g(e);r.trim()&&n.push({media:t,selector:s,decls:r})}let i=0;for(;i<e.length;){const r=e.indexOf("{",i);if(r===-1)break;const o=p(e,r);let c=i;for(let u=r;u>i;u-=1)if(";}".includes(e[u-1])){c=u;break}const l=e.slice(c,r).trim(),f=e.slice(r+1,o);l.startsWith("@media")?m(f,h(t,l),n,s):l.startsWith("@")?m(f,t,n,s):l&&m(f,t,n,l),i=o+1}return n}function h(e,t){const n=t.replace(/^@media\s*/,"").trim();return e===null?`@media ${n}`:`${e} and ${n}`}function g(e){let t="",n=0;for(;n<e.length;){const s=e.indexOf("{",n);if(s===-1){t+=e.slice(n);break}let i=s;for(;i>n&&!";}".includes(e[i-1]);)i-=1;t+=e.slice(n,i),n=p(e,s)+1}return t}function d(e,t){if(!e)return!0;const s=e.replace(/^@media\s*/,"").trim().split(/\s+and\s+/).map(i=>i.trim());for(const i of s){const r=/^\(\s*max-width:\s*([\d.]+)(px|rem)\s*\)$/.exec(i),o=/^\(\s*min-width:\s*([\d.]+)(px|rem)\s*\)$/.exec(i),c=/^\(\s*width\s*(<=|>=|<|>)\s*([\d.]+)(px|rem)\s*\)$/.exec(i),l=/^\(\s*([\d.]+)(px|rem)\s*(<=|>=|<|>)\s*width\s*\)$/.exec(i);if(r){if(t>a(r[1],r[2]))return!1}else if(o){if(t<a(o[1],o[2]))return!1}else if(c){if(!x(t,c[1],a(c[2],c[3])))return!1}else if(l){const f={"<":">",">":"<","<=":">=",">=":"<="}[l[3]];if(!x(t,f,a(l[1],l[2])))return!1}else return!1}return!0}const $=16;function a(e,t){return t==="rem"?Number(e)*$:Number(e)}function x(e,t,n){return t==="<"?e<n:t==="<="?e<=n:t===">"?e>n:e>=n}function w(e,t,n,s){let i=null;for(const r of e){if(!d(r.media,s)||!r.selector.split(",").map(f=>f.trim()).includes(t))continue;const c=new RegExp(`(?:^|;)\\s*${n}\\s*:\\s*([^;]+)`,"g");let l;for(;(l=c.exec(r.decls))!==null;)i=l[1].trim()}return i}function O(e,t,n,s){const i=new Set(t.map(o=>`.${o}`));let r=null;for(const o of e){if(!d(o.media,s)||!o.selector.split(/(?<!\\),/).map(u=>u.trim().replace(/\\/g,"")).some(u=>i.has(u)))continue;const l=new RegExp(`(?:^|;)\\s*${n}\\s*:\\s*([^;]+)`,"g");let f;for(;(f=l.exec(o.decls))!==null;)r=f[1].trim()}return r}export{h as andMedia,p as blockEnd,w as declFor,O as declForClasses,d as mediaApplies,g as ownDeclarations,m as readRules};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const g=["text","textarea","plainText","copyText","plainTextarea","linkField","textList","upload","toggle","select","searchSelect","segmented","slider","colorInput","focalPicker","sizeField","backgroundField","multiSelect"];function
|
|
2
|
-
`),n=new RegExp(`(?<![A-Za-z0-9_.$])(${g.join("|")})\\("((?:[^"\\\\]|\\\\.)*)"`,"g"),
|
|
3
|
-
`),n=[];for(let
|
|
4
|
-
`).forEach((n,
|
|
5
|
-
`);return[...
|
|
1
|
+
import{blockEnd as A}from"./css-rules.js";const g=["text","textarea","plainText","copyText","plainTextarea","linkField","textList","upload","toggle","select","searchSelect","segmented","slider","colorInput","focalPicker","sizeField","backgroundField","multiSelect"];function L(e){const t=e.split(`
|
|
2
|
+
`),n=new RegExp(`(?<![A-Za-z0-9_.$])(${g.join("|")})\\("((?:[^"\\\\]|\\\\.)*)"`,"g"),l=/label:\s*"((?:[^"\\]|\\.)*)"/g,o=new RegExp(`(?<![A-Za-z0-9_.$])(${g.join("|")})\\(\\s*$`),s=/^\s*"((?:[^"\\]|\\.)*)"\s*,/,r=[];let c=0,h=0;const f=[];return t.forEach((a,u)=>{const d=u+1,b=h>0;for(const i of a.matchAll(n))r.push({line:d,label:i[2],item:b,builder:i[1]});const m=o.exec(a);if(m){let i=u+1;for(;i<t.length&&t[i].trim()==="";)i+=1;const p=i<t.length?s.exec(t[i]):null;p&&r.push({line:i+1,label:p[1],item:b,builder:m[1]})}for(const i of a.matchAll(l)){const p=a.slice(0,i.index??0),x=u>0?t[u-1].trim():"";(/type:\s*"/.test(p)||/type:\s*"[a-z]+"\s*,?$/.test(x))&&r.push({line:d,label:i[1],item:b})}for(let i=0;i<a.length;i+=1)a[i]==="{"?(/arrayFields:\s*$/.test(a.slice(0,i))&&(f.push(c),h+=1),c+=1):a[i]==="}"&&(c-=1,f.length&&c===f[f.length-1]&&(f.pop(),h-=1))}),r}function $(e,t){let n=0,l=-1;for(let o=t-1;o>=0;o-=1){const s=e[o];if(s==="}")n+=1;else if(s==="{"){if(n===0){l=o;break}n-=1}}return l<0?"":e.slice(l,A(e,l)+1)}function w(e){let t=0,n="";for(const l of e){if(l==="{"||l==="["){t+=1;continue}if(l==="}"||l==="]"){t-=1;continue}t===1&&(n+=l)}return n}function y(e,t){const n=w($(e,t));return/(^|[,;])\s*(value|fields|render|resolveFields|panelId|href|amount|meta)\s*:/.test(n)||E(e,t)}function E(e,t){let n=0,l=0;for(let o=t-1;o>=0;o-=1){const s=e[o];if(s==="}"||s==="]"||s===")")n+=1;else if(s==="{"||s==="("){if(n>0){n-=1;continue}if(s==="("||++l>1)return!1}else if(s==="["){if(n>0){n-=1;continue}return/\w*TabItem\[\]\s*=\s*$/.test(e.slice(Math.max(0,o-80),o))}}return!1}function F(e){const t=e.split(`
|
|
3
|
+
`),n=[];for(let s=0,r=0;s<t.length;s+=1)n.push(r),r+=t[s].length+1;const l=/label:\s*"((?:[^"\\]|\\.)*)"/g,o=[];return t.forEach((s,r)=>{for(const c of s.matchAll(l))y(e,n[r]+(c.index??0))||o.push({line:r+1,label:c[1],item:!1})}),o}const j=/(?<![-A-Za-z])label=(?:\{say\()?"((?:[^"\\]|\\.)*)"/g;function k(e){const t=[];return e.split(`
|
|
4
|
+
`).forEach((n,l)=>{for(const o of n.matchAll(j))t.push({line:l+1,label:o[1],item:!1})}),t}const O=/className="sf-field"|from\s*["']efficient-easel/;function T(e){return e.path.startsWith("components/")&&e.path.endsWith(".tsx")&&O.test(e.text)}const P=6;function S(e,t){for(let n=t;n<Math.min(e.length,t+P);n+=1){if(/^\s*\}[,)]?\s*$/.test(e[n])&&n>t)return!1;if(/\bonClick:/.test(e[n]))return!0}return!1}function z(e){const t=new Set,n=e.split(`
|
|
5
|
+
`);return[...L(e),...F(e),...k(e)].filter(l=>{const o=`${l.line}:${l.label}`;return t.has(o)?!1:(t.add(o),!S(n,l.line-1))})}export{g as BUILDERS,j as JSX_LABEL,T as isPanelFile,k as readJsxLabels,L as readLabels,z as readPanelLabels,F as readRowLabels};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const f={single:"'",double:'"',template:"`"};function r(i){let
|
|
2
|
-
`?(
|
|
3
|
-
`?e:" ",
|
|
1
|
+
import{blockEnd as l}from"./css-rules.js";const f={single:"'",double:'"',template:"`"};function r(i){let n="",o="code",t=0;for(;t<i.length;){const e=i[t],c=i[t+1];if(o==="code"){if(e==="/"&&c==="/"){o="line",n+=" ",t+=2;continue}if(e==="/"&&c==="*"){o="block",n+=" ",t+=2;continue}e==="'"?o="single":e==='"'?o="double":e==="`"&&(o="template"),n+=e,t+=1;continue}if(o==="line"){e===`
|
|
2
|
+
`?(o="code",n+=e):n+=" ",t+=1;continue}if(o==="block"){if(e==="*"&&c==="/"){o="code",n+=" ",t+=2;continue}n+=e===`
|
|
3
|
+
`?e:" ",t+=1;continue}if(e==="\\"){n+=e+(c??""),t+=2;continue}e===f[o]&&(o="code"),n+=e,t+=1}return n}function d(i,n){const o=r(i),t=o.indexOf(n);if(t<0)throw new Error(`ts-source: marker not found: ${n}`);const e=o.indexOf("{",t+n.length-1);if(e<0)throw new Error(`ts-source: no block opens after: ${n}`);const c=l(o,e);if(c>=o.length)throw new Error(`ts-source: unbalanced block after: ${n}`);return i.slice(e,c+1)}function u(i){return`(?:@\\/|efficient-web-builder\\/(?:render|format|editor)\\/)${i.replace(/[.*+?^${}()|[\]\\/]/g,"\\$&")}`}export{d as balancedBlockAfter,u as builderModuleSpec,r as stripComments};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-web-builder",
|
|
3
|
-
"version": "69.
|
|
3
|
+
"version": "69.4.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",
|