@vectoriox/iox-ui 5.196.0 → 5.198.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/composite-core/index.d.ts +19 -2
- package/data-core/index.d.ts +101 -2
- package/design-core/index.d.ts +183 -30
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +49 -10
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +192 -2
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +299 -74
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +2287 -528
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +3 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +32 -2
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1454 -200
- package/harness-core/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/composite-core/header.ts +34 -1
- package/src/composite-core/slider-runtime.ts +16 -8
- package/src/data-core/placeholder-rows.ts +220 -0
- package/src/data-core/public-api.ts +2 -1
- package/src/design-core/brand.ts +58 -5
- package/src/design-core/contrast-audit.ts +49 -22
- package/src/design-core/design-apply.ts +34 -3
- package/src/design-core/flavor-fixtures.generated.ts +123 -123
- package/src/design-core/flavor-spec.generated.ts +44 -4
- package/src/design-core/flavor-tokens.ts +1 -1
- package/src/design-core/header-behaviour.ts +82 -15
- package/src/design-core/motion-language.ts +5 -14
- package/src/design-core/node-links.ts +34 -0
- package/src/design-core/preloader.ts +4 -5
- package/src/generation-core/audit-site.ts +10 -1
- package/src/generation-core/audit-words.ts +5 -0
- package/src/generation-core/body-mix.ts +40 -102
- package/src/generation-core/check-free.ts +26 -5
- package/src/generation-core/check-layout.ts +10 -4
- package/src/generation-core/check-list.ts +3 -25
- package/src/generation-core/colour-mix.ts +296 -0
- package/src/generation-core/compose-free.ts +40 -18
- package/src/generation-core/compose-site.ts +124 -22
- package/src/generation-core/footer-mix.ts +102 -54
- package/src/generation-core/free-fallback.ts +6 -4
- package/src/generation-core/free-opening.ts +57 -0
- package/src/generation-core/free-parts.ts +87 -0
- package/src/generation-core/free-slot-words.ts +30 -0
- package/src/generation-core/generation-tier.ts +6 -17
- package/src/generation-core/header-mix.ts +125 -4
- package/src/generation-core/item-fill.ts +42 -0
- package/src/generation-core/layout-drawers.ts +3 -2
- package/src/generation-core/layout-wire.ts +10 -16
- package/src/generation-core/list-panel.ts +3 -3
- package/src/generation-core/list-table.ts +5 -14
- package/src/generation-core/list-words.ts +2 -1
- package/src/generation-core/nav-shape.ts +45 -16
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/opening-mix.ts +16 -33
- package/src/generation-core/part-tier.ts +14 -0
- package/src/generation-core/plan-wire.ts +31 -43
- package/src/generation-core/public-api.ts +4 -0
- package/src/generation-core/site-build-run.ts +4 -0
- package/src/generation-core/site-spec.generated.ts +1127 -93
- package/src/generation-core/stock-search.ts +106 -18
- package/src/generation-core/type-led.ts +19 -4
- package/src/generation-core/validate-site-plan.ts +4 -5
- package/src/harness-core/run-compose-context.ts +3 -1
- package/styles/iox-design.css +139 -4
|
@@ -502,11 +502,201 @@ function hasHomeConflict(pages) {
|
|
|
502
502
|
return (pages ?? []).filter(p => !!p?.isHome && p.status === HOME_PAGE_LIVE_STATUS).length > 1;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
+
/**
|
|
506
|
+
* Ghost cards (vectoriox/iox-ui#178, Doron 2026-11-28; board `architecture/ai/boards/ghost-cards.board.html`).
|
|
507
|
+
*
|
|
508
|
+
* A generated site keeps its sample items: every page, section and list stays, so the owner sees where things go.
|
|
509
|
+
* A sample the build could not name (it is still "Product 2") is a PLACEHOLDER ROW. The builder canvas and Preview draw
|
|
510
|
+
* it as a ghost card that asks the owner to add the first item. The live site never shows it. This file is the ONE
|
|
511
|
+
* reading of both, so the builder and the SSR engine agree:
|
|
512
|
+
*
|
|
513
|
+
* - `isNumberedPlaceholderTitle` — words and then a number (G-D1). The Publishable gate reads it as well.
|
|
514
|
+
* - `isPlaceholderRow(row, titleField)` — a row marked `isSample` whose title is such a placeholder.
|
|
515
|
+
* - `listTitleField(list)` — the field a list's card shows as its title.
|
|
516
|
+
* - `planPlaceholderHides(roots, resolved)` — what the live engine leaves out (G-D3): placeholder rows are dropped,
|
|
517
|
+
* a list with no live row is not drawn, and its top-level section hides when only its frame is left (heading,
|
|
518
|
+
* eyebrow, lead text, buttons). Pages and their nav links stay (G-D4).
|
|
519
|
+
*
|
|
520
|
+
* Pure and framework-free: no transport, no Angular.
|
|
521
|
+
*/
|
|
522
|
+
/** The stored field that marks a seeded sample item (iox-cms `SAMPLE_FIELD`). */
|
|
523
|
+
const SAMPLE_ROW_FIELD = 'isSample';
|
|
524
|
+
/** The fields a row's title is read from when its list names none (a hand-built list, a slider without a title part). */
|
|
525
|
+
const PLACEHOLDER_TITLE_FALLBACK_FIELDS = ['title', 'name', 'label'];
|
|
526
|
+
/**
|
|
527
|
+
* A title that is a numbered placeholder: words and then the item's number ("Product 2", "Room 2", "שם מעצבת השיער 1",
|
|
528
|
+
* "Sample name 3"). Read only on rows marked `isSample`, so a real item called "Studio 54" is never one.
|
|
529
|
+
*/
|
|
530
|
+
function isNumberedPlaceholderTitle(title) {
|
|
531
|
+
return typeof title === 'string' && /^\D*\S\s+\d{1,3}$/u.test(title.trim());
|
|
532
|
+
}
|
|
533
|
+
/** The value at a dotted path of a row (`title`, `details.name`). */
|
|
534
|
+
function fieldOf(row, path) {
|
|
535
|
+
let at = row;
|
|
536
|
+
for (const key of path.split('.').filter(Boolean)) {
|
|
537
|
+
if (at == null || typeof at !== 'object')
|
|
538
|
+
return undefined;
|
|
539
|
+
at = at[key];
|
|
540
|
+
}
|
|
541
|
+
return at;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* True when a row is a sample still titled "<words> <n>" — the builder draws a ghost card for it, the live site leaves it
|
|
545
|
+
* out. `titleField` is the list's title field (`listTitleField`); without one the row's `title` / `name` / `label` is
|
|
546
|
+
* read. A row with no title to read is never a placeholder: when in doubt, show it.
|
|
547
|
+
*/
|
|
548
|
+
function isPlaceholderRow(row, titleField) {
|
|
549
|
+
if (!row || typeof row !== 'object' || Array.isArray(row))
|
|
550
|
+
return false;
|
|
551
|
+
const r = row;
|
|
552
|
+
if (r[SAMPLE_ROW_FIELD] !== true)
|
|
553
|
+
return false;
|
|
554
|
+
const field = titleField || PLACEHOLDER_TITLE_FALLBACK_FIELDS.find(f => typeof r[f] === 'string');
|
|
555
|
+
if (!field)
|
|
556
|
+
return false;
|
|
557
|
+
const title = fieldOf(r, field);
|
|
558
|
+
return typeof title === 'string' && isNumberedPlaceholderTitle(title);
|
|
559
|
+
}
|
|
560
|
+
/** The node types that repeat a source's rows: a Repeater, and a slider whose slides repeat. */
|
|
561
|
+
const LIST_NODE_TYPES = new Set(['Repeater', 'SliderContainer']);
|
|
562
|
+
/**
|
|
563
|
+
* The data source whose ITEMS a node repeats — a Repeater's or slider's `source` binding with no path (or a slider's
|
|
564
|
+
* `props.source`) — else `null`. A list over an array inside one item (`project.gallery`) is not a list of items.
|
|
565
|
+
*/
|
|
566
|
+
function listSourceOf(node) {
|
|
567
|
+
if (!node || !LIST_NODE_TYPES.has(node.type ?? ''))
|
|
568
|
+
return null;
|
|
569
|
+
const bound = (node.bindings ?? []).find(b => b?.prop === 'source' && !!b.source);
|
|
570
|
+
if (bound)
|
|
571
|
+
return bound.path ? null : bound.source;
|
|
572
|
+
const prop = node.props?.['source'];
|
|
573
|
+
return typeof prop === 'string' && prop ? prop : null;
|
|
574
|
+
}
|
|
575
|
+
/** Depth-first walk of a node's descendants (not the node itself), stopping below `skip`. */
|
|
576
|
+
function descendants(node, skip) {
|
|
577
|
+
const out = [];
|
|
578
|
+
const walk = (n) => {
|
|
579
|
+
for (const c of n.children ?? []) {
|
|
580
|
+
if (!c)
|
|
581
|
+
continue;
|
|
582
|
+
out.push(c);
|
|
583
|
+
if (!skip?.(c))
|
|
584
|
+
walk(c);
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
walk(node);
|
|
588
|
+
return out;
|
|
589
|
+
}
|
|
590
|
+
/** The path a node's `content` binding reads from its list's rows, or '' when it has none. */
|
|
591
|
+
function contentPath(node, source) {
|
|
592
|
+
const b = (node.bindings ?? []).find(x => x?.prop === 'content' && x.source === source && !!x.path);
|
|
593
|
+
return b?.path ?? '';
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* The row field a list shows as its title: the bound text of its card's title part (a role ending in `title`, e.g.
|
|
597
|
+
* `card.title`), else of its first bound Heading, else `null` (then `isPlaceholderRow` falls back to title/name/label).
|
|
598
|
+
* Nested lists are not looked into.
|
|
599
|
+
*/
|
|
600
|
+
function listTitleField(list) {
|
|
601
|
+
const source = listSourceOf(list);
|
|
602
|
+
if (!list || !source)
|
|
603
|
+
return null;
|
|
604
|
+
const inside = descendants(list, n => LIST_NODE_TYPES.has(n.type ?? ''));
|
|
605
|
+
const titled = inside.find(n => /(^|\.)title$/.test(n.role ?? '') && contentPath(n, source));
|
|
606
|
+
if (titled)
|
|
607
|
+
return contentPath(titled, source);
|
|
608
|
+
const heading = inside.find(n => n.type === 'Heading' && contentPath(n, source));
|
|
609
|
+
return heading ? contentPath(heading, source) : null;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* The node types that are only a list section's FRAME (G-D3): its heading, eyebrow, lead text, buttons, links, icons
|
|
613
|
+
* and the boxes around them. A section left with only these hides with its list. Anything else (a picture, a video, a
|
|
614
|
+
* form, a gallery, a static list, a slider that is not bound) is content of its own and keeps the section.
|
|
615
|
+
*/
|
|
616
|
+
const LIST_FRAME_TYPES = new Set([
|
|
617
|
+
'Section', 'Container', 'LinkedContainer', 'Card', 'Heading', 'Text', 'Button', 'ButtonBlock', 'Link', 'Icon',
|
|
618
|
+
'Divider', 'Spacer', 'Dialog', 'Popover',
|
|
619
|
+
]);
|
|
620
|
+
/** The words a list section's frame holds at most outside its list: an eyebrow and a lead line. A third Text is words
|
|
621
|
+
* of the section's own (board B), so it stays. */
|
|
622
|
+
const LIST_FRAME_MAX_TEXTS = 2;
|
|
623
|
+
/**
|
|
624
|
+
* The ONE live rule (G-D3), shared by the SSR engine's renderers:
|
|
625
|
+
*
|
|
626
|
+
* 1. a list's placeholder rows are dropped (`rows`) — a mixed list shows only the owner's real items;
|
|
627
|
+
* 2. a list whose source resolved to no live row is not drawn (`hidden`);
|
|
628
|
+
* 3. the top-level root holding it hides too when everything else in it is frame (`LIST_FRAME_TYPES`, at most
|
|
629
|
+
* `LIST_FRAME_MAX_TEXTS` Texts) and no other list in it still has a live row.
|
|
630
|
+
*
|
|
631
|
+
* A source the engine did not resolve (`!(alias in resolved)`) is not judged — nothing is hidden on a guess. A page
|
|
632
|
+
* whose every section hid still renders with its header and footer, and its nav links stay (G-D4).
|
|
633
|
+
*/
|
|
634
|
+
function planPlaceholderHides(roots, resolved) {
|
|
635
|
+
const rows = {};
|
|
636
|
+
const hidden = new Set();
|
|
637
|
+
const data = resolved ?? {};
|
|
638
|
+
/** Live rows of a list, or `null` when its source is not resolved (never judged). */
|
|
639
|
+
const liveRows = (list, source) => {
|
|
640
|
+
if (!(source in data))
|
|
641
|
+
return null;
|
|
642
|
+
const all = resolveRepeaterItems(data[source]);
|
|
643
|
+
const title = listTitleField(list);
|
|
644
|
+
const live = all.filter(r => !isPlaceholderRow(r, title));
|
|
645
|
+
if (live.length !== all.length && Array.isArray(data[source]))
|
|
646
|
+
rows[source] = live;
|
|
647
|
+
return live;
|
|
648
|
+
};
|
|
649
|
+
for (const root of roots ?? []) {
|
|
650
|
+
if (!root)
|
|
651
|
+
continue;
|
|
652
|
+
const nodes = [root, ...descendants(root)];
|
|
653
|
+
const lists = nodes.filter(n => !!listSourceOf(n));
|
|
654
|
+
if (!lists.length)
|
|
655
|
+
continue;
|
|
656
|
+
const emptyLists = lists.filter(l => liveRows(l, listSourceOf(l))?.length === 0);
|
|
657
|
+
for (const l of emptyLists)
|
|
658
|
+
if (l.id)
|
|
659
|
+
hidden.add(l.id);
|
|
660
|
+
if (!emptyLists.length || emptyLists.length !== lists.length)
|
|
661
|
+
continue;
|
|
662
|
+
// Every list in this root is empty: the root hides unless something outside the lists is content of its own.
|
|
663
|
+
const outsideLists = [root, ...descendants(root, n => !!listSourceOf(n))].filter(n => !listSourceOf(n));
|
|
664
|
+
const onlyFrame = outsideLists.every(n => LIST_FRAME_TYPES.has(n.type ?? ''))
|
|
665
|
+
&& outsideLists.filter(n => n.type === 'Text').length <= LIST_FRAME_MAX_TEXTS;
|
|
666
|
+
if (onlyFrame && root.id)
|
|
667
|
+
hidden.add(root.id);
|
|
668
|
+
}
|
|
669
|
+
return { rows, hidden };
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* `planPlaceholderHides` applied — what the SSR engine hands BOTH its renderers (the string renderer and the component
|
|
673
|
+
* tree), so they never disagree: the hidden nodes pruned out of the tree (a copy only where something was pruned; the
|
|
674
|
+
* input is never mutated) and the list sources replaced by their live rows.
|
|
675
|
+
*/
|
|
676
|
+
function applyPlaceholderHides(roots, resolved) {
|
|
677
|
+
const plan = planPlaceholderHides(roots, resolved);
|
|
678
|
+
const data = { ...(resolved ?? {}), ...plan.rows };
|
|
679
|
+
if (!plan.hidden.size)
|
|
680
|
+
return { roots: [...(roots ?? [])], resolved: data };
|
|
681
|
+
const prune = (nodes) => {
|
|
682
|
+
const out = [];
|
|
683
|
+
for (const n of nodes) {
|
|
684
|
+
if (!n || (n.id && plan.hidden.has(n.id)))
|
|
685
|
+
continue;
|
|
686
|
+
const kids = n.children;
|
|
687
|
+
const pruned = kids?.length ? prune(kids) : null;
|
|
688
|
+
out.push(pruned && pruned.length !== kids.length ? { ...n, children: pruned } : n);
|
|
689
|
+
}
|
|
690
|
+
return out;
|
|
691
|
+
};
|
|
692
|
+
return { roots: prune(roots ?? []), resolved: data };
|
|
693
|
+
}
|
|
694
|
+
|
|
505
695
|
/**
|
|
506
696
|
* @vectoriox/iox-ui/data-core — the shared, FRAMEWORK-FREE data-source core (data-source-resolving.md): the ONE
|
|
507
697
|
* decision of how a data source becomes a fetch (`planDataSource`), the route-param matcher, the derived /
|
|
508
698
|
* relative (`$siblings`, `$related`) resolvers, the repeater item reader, and which sources a node tree
|
|
509
|
-
* references (`referencedDataSourcesDeep`), and which saved page is the studio's home (`homePageOf`, #116). The builder and the SSR engine resolve with it; iox-cms reads it
|
|
699
|
+
* references (`referencedDataSourcesDeep`), and which saved page is the studio's home (`homePageOf`, #116), and which rows are placeholder samples the live site leaves out (`planPlaceholderHides`, #178). The builder and the SSR engine resolve with it; iox-cms reads it
|
|
510
700
|
* under plain Node (W2's Undo: is a data source still in use). Pure: no transport, no Angular. The main
|
|
511
701
|
* entry re-exports it by package path, so `@vectoriox/iox-ui` keeps working.
|
|
512
702
|
* ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, tsconfig paths —
|
|
@@ -517,5 +707,5 @@ function hasHomeConflict(pages) {
|
|
|
517
707
|
* Generated bundle index. Do not edit.
|
|
518
708
|
*/
|
|
519
709
|
|
|
520
|
-
export { DataSourceSortDir, HOME_PAGE_LIVE_STATUS, RESERVED_ALIAS_PREFIX, SORT_PARAM, buildDataSourceFilter, buildRelatedFilter, collectReferencedAliases, computeRelative, dataSourcePlanToRequest, excludeSelf, getByPath, hasHomeConflict, homePageOf, isReservedAlias, matchRouteParams, normalizeCollectionResult, planDataSource, referencedDataSources, referencedDataSourcesDeep, resolveDerivedInto, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, sortParamValue, variableAliases, variableItemsFrom };
|
|
710
|
+
export { DataSourceSortDir, HOME_PAGE_LIVE_STATUS, LIST_FRAME_MAX_TEXTS, LIST_FRAME_TYPES, LIST_NODE_TYPES, PLACEHOLDER_TITLE_FALLBACK_FIELDS, RESERVED_ALIAS_PREFIX, SAMPLE_ROW_FIELD, SORT_PARAM, applyPlaceholderHides, buildDataSourceFilter, buildRelatedFilter, collectReferencedAliases, computeRelative, dataSourcePlanToRequest, excludeSelf, getByPath, hasHomeConflict, homePageOf, isNumberedPlaceholderTitle, isPlaceholderRow, isReservedAlias, listSourceOf, listTitleField, matchRouteParams, normalizeCollectionResult, planDataSource, planPlaceholderHides, referencedDataSources, referencedDataSourcesDeep, resolveDerivedInto, resolveRelativeInto, resolveRepeaterItems, resolveSiblings, resolveSingleItemId, sortParamValue, variableAliases, variableItemsFrom };
|
|
521
711
|
//# sourceMappingURL=vectoriox-iox-ui-data-core.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectoriox-iox-ui-data-core.mjs","sources":["../../../projects/iox-ui/src/data-core/data-source-resolver.ts","../../../projects/iox-ui/src/data-core/relative-sources.ts","../../../projects/iox-ui/src/data-core/home-page.ts","../../../projects/iox-ui/src/data-core/public-api.ts","../../../projects/iox-ui/src/data-core/vectoriox-iox-ui-data-core.ts"],"sourcesContent":["/**\n * Shared data-source resolving pattern — the SINGLE source of truth for how an IoxDataSource\n * becomes a backend fetch, consumed by BOTH the page builder (iox-cms-client bindings panel) and\n * the SSR client engine (iox-client-engine DataSourceResolverService). There must be no second\n * copy of this decision logic; only the transport differs between the two:\n *\n * builder → authenticated org-scoped controllers (admin session):\n * single by id → GET admin.../resources/:type/:id (ContentService.getContentById)\n * collection → GET admin.../resources/:type (ContentService.getContent)\n * engine → @Public() controllers (no auth, isPublished filter applied server-side):\n * single by id → GET api/:type/:id (UserResourcesController)\n * collection → GET api/:type?filters (UserResourcesController)\n *\n * The DECISION (by-id vs collection, which id, which filters, how to pick the single result) is\n * identical for both — that's what this module owns. Each app maps the returned {@link DataSourcePlan}\n * onto its own transport. A single item is ALWAYS fetched by its id as a path segment — never a\n * `?_id=` query — to match the builder's getContentById.\n */\n\nexport type DataSourceMode = 'single' | 'list';\nexport type DataSourceDomain = 'cms' | 'shop';\n\nexport interface DataSourceRouteFilter {\n field?: string;\n routeParam?: string;\n defaultId?: string;\n}\n\nexport interface DataSourceQueryFilter {\n field?: string;\n /** URL query param the value is read from. OMIT for a CONSTANT filter — then `defaultValue`\n * alone is the value, so `isReviewShow=true` filters identically in preview and on the site. */\n queryParam?: string;\n /** Value used when the query param is absent — i.e. always, for a constant filter, and in the\n * builder preview, where there are no live query params. NOT preview-only: it is the runtime\n * fallback too. An empty default with no query-param value means the filter is DROPPED. */\n defaultValue?: string;\n}\n\n/** The order a query source returns its rows in (CC2, board 4 \"Sort\" — the data source popover). */\nexport enum DataSourceSortDir {\n Asc = 'asc',\n Desc = 'desc',\n}\n\nexport interface DataSourceSort {\n /** A field of the content type (a dot path into a nested object is allowed). */\n field?: string;\n dir?: DataSourceSortDir | `${DataSourceSortDir}`;\n}\n\n/** The query parameter carrying the order: `sort=order` ascending, `sort=-order` descending. A CONTROL like\n * `limit`, not a field filter — the public controllers split it out (iox-cms `query-controls.ts`). */\nexport const SORT_PARAM = 'sort';\nconst SORT_FIELD = /^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$/;\n\n/** `sort`'s wire value, or null when the source sets no (valid) order. */\nexport function sortParamValue(sort: DataSourceSort | null | undefined): string | null {\n const field = sort?.field?.trim();\n if (!field || !SORT_FIELD.test(field)) return null;\n return sort?.dir === DataSourceSortDir.Desc ? `-${field}` : field;\n}\n\nexport interface DataSourceRequestSpec {\n contentType?: string;\n limit?: number;\n /** A query source's order (CC2). Absent = the backend's natural order, as before. */\n sort?: DataSourceSort;\n filterByRouteParam?: DataSourceRouteFilter;\n filterByQueryParams?: DataSourceQueryFilter[];\n}\n\n/** Structural (duck-typed) view of an IoxDataSource — kept free of the editor model so both libs\n * can depend on it without pulling in iox-builder. */\nexport interface DataSourceSpec {\n alias?: string;\n type?: string; // 'cms' | 'shop' | 'external-api' | 'static'\n mode?: DataSourceMode;\n request?: {\n cms?: DataSourceRequestSpec;\n shop?: DataSourceRequestSpec;\n endpoint?: string;\n data?: any;\n /** `derived` alias: a VIEW into another variable — resolve `from` then getByPath(value, path)\n * (e.g. galleryImages = product.gallery). See repeater-binding-ux-plan.md. */\n derived?: { from: string; path: string };\n };\n}\n\nexport type DataSourcePlan =\n | { kind: 'by-id'; domain: DataSourceDomain; resource: string; id: string; mode: DataSourceMode }\n | { kind: 'collection'; domain: DataSourceDomain; resource: string; filter: Record<string, any>; limit?: number; sort?: string; mode: DataSourceMode }\n | { kind: 'external'; endpoint: string; mode: DataSourceMode }\n | { kind: 'static'; data: any; mode: DataSourceMode }\n | { kind: 'derived'; from: string; path: string; mode: DataSourceMode }\n | { kind: 'none' };\n\n/**\n * Match a page route template against an actual path and extract named params.\n * matchRouteParams('/project/:projectId', 'project/68abc') → { projectId: '68abc' }\n * Both sides are normalised (leading slash stripped) and split on '/'; values are URL-decoded.\n */\nexport function matchRouteParams(template: string | undefined, actual: string | undefined): Record<string, string> {\n const t = (template ?? '').replace(/^\\/+/, '').split('/');\n const a = (actual ?? '').replace(/^\\/+/, '').split('/');\n const params: Record<string, string> = {};\n for (let i = 0; i < t.length; i++) {\n const seg = t[i];\n if (seg && seg.startsWith(':')) params[seg.slice(1)] = decodeURIComponent(a[i] ?? '');\n }\n return params;\n}\n\n/**\n * Build the query filter for a data-source request from its filterByRouteParam / filterByQueryParams\n * config. `field` is filtered by the route-param value (falling back to `defaultId`); query filters\n * map each `field` to a query-param value (falling back to `defaultValue`), and a filter with NO\n * `queryParam` is a constant on `defaultValue`. Empty values are omitted so the source isn't\n * accidentally filtered to nothing.\n */\nexport function buildDataSourceFilter(\n req: DataSourceRequestSpec | undefined,\n routeParams: Record<string, any> = {},\n queryParams: Record<string, any> = {},\n): Record<string, any> {\n const params: Record<string, any> = {};\n const byRoute = req?.filterByRouteParam;\n if (byRoute?.field && byRoute?.routeParam) {\n const value = routeParams[byRoute.routeParam] ?? byRoute.defaultId;\n if (value !== undefined && value !== null && value !== '') params[byRoute.field] = value;\n }\n for (const q of req?.filterByQueryParams ?? []) {\n if (!q?.field) continue;\n // No queryParam → a CONSTANT filter: defaultValue is the value, in the builder preview and\n // on the live site alike. With a queryParam the URL wins and defaultValue is the fallback.\n const value = q.queryParam ? (queryParams[q.queryParam] ?? q.defaultValue) : q.defaultValue;\n if (value !== undefined && value !== null && value !== '') params[q.field] = value;\n }\n return params;\n}\n\n/**\n * Mirrors the builder's getContentById decision. When a SINGLE source is filtered by the item id\n * (`_id`) via a route param, the item is fetched by PATH (`.../:type/:id`), not a `?_id=` query.\n * Returns that id (route-param value, else `defaultId`), or `null` when the source isn't a\n * single-by-id fetch — in which case the caller uses the collection endpoint + filters. The\n * path-based form only applies to the id field; a single source filtered by any other field still\n * goes through the collection endpoint.\n */\nexport function resolveSingleItemId(req: DataSourceRequestSpec | undefined, routeParams: Record<string, any> = {}): string | null {\n const byRoute = req?.filterByRouteParam;\n if (!byRoute?.routeParam) return null;\n if (byRoute.field && byRoute.field !== '_id') return null;\n const value = routeParams[byRoute.routeParam] ?? byRoute.defaultId;\n return value !== undefined && value !== null && value !== '' ? String(value) : null;\n}\n\n/**\n * Resolve an IoxDataSource into a transport-agnostic {@link DataSourcePlan}. This is the shared\n * decision both the builder and the SSR engine run; each then executes the plan with its own\n * HTTP layer. Single sources with a route-param id resolve to a `by-id` (path) fetch — exactly like\n * the builder's getContentById.\n */\nexport function planDataSource(\n ds: DataSourceSpec | undefined,\n routeParams: Record<string, any> = {},\n queryParams: Record<string, any> = {},\n): DataSourcePlan {\n const mode: DataSourceMode = ds?.mode === 'single' ? 'single' : 'list';\n switch (ds?.type) {\n case 'cms':\n case 'shop': {\n const domain = ds.type as DataSourceDomain;\n const req = domain === 'cms' ? ds.request?.cms : ds.request?.shop;\n const resource = req?.contentType;\n if (!resource) return { kind: 'none' };\n const id = mode === 'single' ? resolveSingleItemId(req, routeParams) : null;\n if (id) return { kind: 'by-id', domain, resource, id, mode };\n const filter = buildDataSourceFilter(req, routeParams, queryParams);\n const plan: DataSourcePlan = { kind: 'collection', domain, resource, filter, mode };\n if (req?.limit) (plan as any).limit = req.limit;\n const sort = sortParamValue(req?.sort);\n if (sort) (plan as any).sort = sort;\n return plan;\n }\n case 'external-api': {\n const endpoint = ds.request?.endpoint;\n return endpoint ? { kind: 'external', endpoint, mode } : { kind: 'none' };\n }\n case 'static':\n return { kind: 'static', data: ds.request?.data ?? null, mode };\n case 'derived': {\n const d = ds.request?.derived;\n return d?.from ? { kind: 'derived', from: d.from, path: d.path ?? '', mode } : { kind: 'none' };\n }\n case 'variable':\n // A VARIABLE is a page-local resource whose value is WRITTEN at runtime by an interaction\n // (setContext), never fetched. It resolves to nothing here on purpose: the page renders\n // its empty state until something writes it. `request.variable.itemsFrom` only names the\n // source whose items it holds, so the bind picker can suggest fields.\n return { kind: 'none' };\n default:\n return { kind: 'none' };\n }\n}\n\n/**\n * The aliases on a page that are VARIABLES — runtime-written resources, not fetched data.\n *\n * Shared so the builder and the SSR engine agree on which aliases start empty and are filled by\n * interactions. See element-context-state-plan.md.\n */\nexport function variableAliases(dataSources: readonly { alias?: string; type?: string }[] | undefined): Set<string> {\n const out = new Set<string>();\n for (const ds of dataSources ?? []) {\n if (ds?.type === 'variable' && ds.alias) out.add(ds.alias);\n }\n return out;\n}\n\n/** The source alias whose items a variable holds, if it declares one (for field suggestions). */\nexport function variableItemsFrom(\n dataSources: readonly { alias?: string; type?: string; request?: any }[] | undefined,\n alias: string,\n): string | undefined {\n for (const ds of dataSources ?? []) {\n if (ds?.type === 'variable' && ds.alias === alias) return ds.request?.variable?.itemsFrom || undefined;\n }\n return undefined;\n}\n\n/**\n * Normalise a collection response into the shape a source expects: unwraps `{items}`/`{data}`\n * envelopes, then returns the first item for a `single` source or the whole array for a `list`.\n * A `by-id` response is already the item, so callers pass it through unchanged.\n */\nexport function normalizeCollectionResult(mode: DataSourceMode, data: any): any {\n const items = Array.isArray(data) ? data : (data?.items ?? data?.data ?? []);\n return mode === 'single' ? (items[0] ?? null) : items;\n}\n\n/** Navigate a dot/bracket path into an object, e.g. `gallery`, `details.images`, `variants[0].skus`.\n * Returns undefined if any segment is missing. Kept minimal + self-contained so it is shareable by\n * both the builder and the SSR engine (the two have divergent local `resolvePath` copies). */\nexport function getByPath(obj: any, path: string): any {\n if (obj == null || !path) return obj;\n // Turn `a[0].b` into ['a','0','b'].\n const segments = path.replace(/\\[(\\w+)\\]/g, '.$1').split('.').filter(Boolean);\n let cur = obj;\n for (const seg of segments) {\n if (cur == null) return undefined;\n cur = cur[seg];\n }\n return cur;\n}\n\n/**\n * The array a Repeater (or a repeating Slider) iterates over — the SHARED decision so the builder\n * canvas and the SSR engine agree (see data-source-resolving.md).\n * - No `sourcePath`: the resolved source IS the list. An array passes through; a lone object degrades\n * to a single-row list (back-compat with the old `fetchItems`); null/undefined → `[]`.\n * - With `sourcePath`: the source resolved to a SINGLE resource (e.g. a product); dive into the\n * nested array property (e.g. `gallery`). Non-array / missing → `[]`.\n */\n/**\n * Fill in `derived` aliases in an already-resolved map. Given the data sources and a map of resolved\n * NON-derived values (by alias), compute each `type:'derived'` alias as `getByPath(parent, path)` in\n * dependency order (chains resolved by iterating until stable). Mutates + returns the map. Used by the\n * SSR engine after it resolves the root sources; the builder resolves derived lazily per alias.\n */\nexport function resolveDerivedInto(dataSources: DataSourceSpec[], resolved: Record<string, any>): Record<string, any> {\n const derived = (dataSources ?? []).filter(d => d?.type === 'derived' && !!d.alias);\n let changed = true, guard = 0;\n while (changed && guard++ < 25) {\n changed = false;\n for (const d of derived) {\n if (d.alias! in resolved) continue;\n const from = d.request?.derived?.from;\n if (from && from in resolved) {\n resolved[d.alias!] = getByPath(resolved[from], d.request!.derived!.path ?? '');\n changed = true;\n }\n }\n }\n return resolved;\n}\n\nexport function resolveRepeaterItems(resolved: any, sourcePath?: string | null): any[] {\n if (sourcePath) {\n const nested = getByPath(resolved, sourcePath);\n return Array.isArray(nested) ? nested : [];\n }\n if (Array.isArray(resolved)) return resolved;\n return resolved == null ? [] : [resolved];\n}\n\n// ── Referenced data sources (shared: builder-save + SSR resolve) ─────────────────────────────────\n// Which data-source aliases a node tree uses, so a consumer resolves ONLY what a page/global needs\n// (not the whole org library). Used by cms-client (persist globals' sources) and the SSR engine\n// (resolve the referenced subset per page). See org-data-sources-plan.md.\n\n/** Aliases referenced anywhere in a node tree: a repeater/slider `source` (a `bindings` entry with\n * `prop === 'source'`, or `props.source` for the slider) plus every binding's `source`. */\nexport function collectReferencedAliases(nodes: any[], acc: Set<string> = new Set<string>()): Set<string> {\n for (const n of nodes ?? []) {\n for (const b of n?.bindings ?? []) { if (b?.source) acc.add(b.source); }\n if (n?.props?.source) acc.add(n.props.source);\n if (n?.children?.length) collectReferencedAliases(n.children, acc);\n }\n return acc;\n}\n\n/** The subset of `all` whose `alias` is referenced by `nodes` (shallow — direct references only). */\nexport function referencedDataSources(nodes: any[], all: any[]): any[] {\n const aliases = collectReferencedAliases(nodes);\n return (all ?? []).filter(ds => aliases.has(ds?.alias));\n}\n\n/** Like `referencedDataSources`, but also pulls in a referenced source's DEPENDENCIES (transitively),\n * none of which the layout names directly:\n * - a `derived` alias needs its `request.derived.from` parent;\n * - a `relative` (route-context) alias needs its `request.relative.subjectFrom` (the current item)\n * and `request.relative.from` (the collection it navigates).\n * Use this when RESOLVING (the engine) so derived views and siblings/related don't resolve to nothing. */\nexport function referencedDataSourcesDeep(nodes: any[], all: any[]): any[] {\n const byAlias = new Map((all ?? []).map(d => [d?.alias, d]));\n const wanted = collectReferencedAliases(nodes);\n const queue = [...wanted];\n const enqueue = (alias?: string) => {\n if (alias && !wanted.has(alias)) { wanted.add(alias); queue.push(alias); }\n };\n while (queue.length) {\n const ds: any = byAlias.get(queue.pop() as string);\n enqueue(ds?.request?.derived?.from);\n enqueue(ds?.request?.relative?.subjectFrom);\n enqueue(ds?.request?.relative?.from);\n }\n return (all ?? []).filter(d => wanted.has(d?.alias));\n}\n\n/** Base URLs for the PUBLIC content controllers. Both must end with `/`. The builder and the SSR\n * engine pass their own host (they proxy `/api` differently) but MUST target the public\n * (`@Public()`) controllers, never the authed admin ones — data resolving is storefront data. */\nexport interface DataSourceEndpoints {\n /** cms resources, e.g. `${HOST}` (engine, HOST ends `/api/`) or `${HOST}api/` (builder). */\n cmsBase: string;\n /** shop resources, e.g. `${HOST}shop/` (engine) or `${HOST}api/shop/` (builder). */\n shopBase: string;\n}\n\nexport interface DataSourceRequest {\n url: string;\n params: Record<string, any>;\n}\n\n/**\n * Turn a resolved {@link DataSourcePlan} into the concrete public HTTP request (url + params) — the\n * SINGLE place that decides the URL shape, shared by the builder binding preview and the SSR engine\n * so both hit the SAME public endpoints (no admin, no duplication). Returns `null` for `static` /\n * `none` plans (no HTTP call). A single item is a PATH segment (`/:resource/:id`), never `?_id=`.\n */\nexport function dataSourcePlanToRequest(plan: DataSourcePlan, endpoints: DataSourceEndpoints): DataSourceRequest | null {\n const baseFor = (domain: DataSourceDomain) => (domain === 'shop' ? endpoints.shopBase : endpoints.cmsBase);\n switch (plan.kind) {\n case 'by-id':\n return { url: `${baseFor(plan.domain)}${plan.resource}/${encodeURIComponent(plan.id)}`, params: {} };\n case 'collection': {\n const params: Record<string, any> = { ...plan.filter };\n if (plan.limit) params['limit'] = plan.limit;\n if (plan.sort) params[SORT_PARAM] = plan.sort;\n return { url: `${baseFor(plan.domain)}${plan.resource}`, params };\n }\n case 'external':\n return { url: plan.endpoint, params: {} };\n default:\n return null;\n }\n}\n","/**\n * Shared RELATIVE (route-context) data resolving — the SINGLE source of truth for how a detail page\n * derives values FROM its current route item, consumed by BOTH the page builder (iox-cms-client) and\n * the SSR client engine (iox-client-engine). Companion to `data-source-resolver.ts`.\n *\n * These are the pure, transport-agnostic pieces behind the Route binding scope\n * (`$route` / `$current` / `$siblings` / `$related`). Resolution is a DEPENDENT SECOND PASS: the\n * consumer resolves `$current` first (the existing single by-id fetch via `planDataSource`), then\n * calls these to derive the relative values — there is NO new `DataSourcePlan` kind (`$related` still\n * feeds a normal `collection` plan built from {@link buildRelatedFilter}). See\n * `architecture/builder/relative-data-sources-plan.md`.\n *\n * There must be no second copy of this decision logic; only the transport (which HTTP layer fetches\n * the ordered collection / related list) differs between the two consumers.\n */\n\nimport { getByPath } from './data-source-resolver';\n\n/** Aliases in the Route scope are platform-owned and start with this prefix; a USER alias may never\n * start with it, which keeps the Route scope structurally collision-proof with Local/Global. Used to\n * validate new/renamed aliases and to render the reserved (read-only) item state in the bind picker. */\nexport const RESERVED_ALIAS_PREFIX = '$';\n\n/** True for a platform-owned Route-scope alias (`$route`, `$current`, `$siblings`, `$related`, …). */\nexport function isReservedAlias(alias: string | null | undefined): boolean {\n return typeof alias === 'string' && alias.startsWith(RESERVED_ALIAS_PREFIX);\n}\n\n/** The `$siblings` value: the current item's neighbours within an ordered set. */\nexport interface SiblingsResult<T = any> {\n /** The item before the current one (`null` at the start, unless `wrap`). */\n prev: T | null;\n /** The item after the current one (`null` at the end, unless `wrap`). */\n next: T | null;\n /** Zero-based position of the current item in the ordered set; `-1` when not found. */\n index: number;\n /** Total items in the set. */\n count: number;\n /** `true` when the current item is the first in the set. */\n isFirst: boolean;\n /** `true` when the current item is the last in the set. */\n isLast: boolean;\n}\n\nexport interface ResolveSiblingsOptions {\n /** Field identifying the current item within the list. Default `_id`. */\n idField?: string;\n /** Dot/bracket path to sort by BEFORE locating neighbours (e.g. `order`, `date`). Omit to use the\n * list's existing order. The same item neighbours differently per ordering, so this is the one\n * choice `$siblings` requires. */\n sortBy?: string;\n /** Sort direction when `sortBy` is set. Default `asc`. */\n sortDir?: 'asc' | 'desc';\n /** Wrap around the ends (`last.next` → first, `first.prev` → last). Only applies when `count > 1`.\n * Default `false`. */\n wrap?: boolean;\n}\n\nconst EMPTY_SIBLINGS: SiblingsResult = { prev: null, next: null, index: -1, count: 0, isFirst: false, isLast: false };\n\n/** Generic, deterministic comparator: numbers numerically, Dates by time, everything else by\n * locale-aware string compare (ISO date strings sort correctly this way). Nullish sorts first. */\nfunction compareValues(a: any, b: any): number {\n if (a == null && b == null) return 0;\n if (a == null) return -1;\n if (b == null) return 1;\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n const da = a instanceof Date ? a.getTime() : NaN;\n const db = b instanceof Date ? b.getTime() : NaN;\n if (!isNaN(da) && !isNaN(db)) return da - db;\n return String(a).localeCompare(String(b));\n}\n\n/**\n * Locate the current item within an ordered set and return its neighbours + position. Pure: the input\n * list is never mutated (sorting works on a shallow copy). `currentId` is compared to each item's\n * `idField` via string equality (route-param values are strings). When the current id isn't found,\n * `index` is `-1` and `prev`/`next` are `null` (but `count` still reflects the set size).\n */\nexport function resolveSiblings<T = any>(\n items: T[] | null | undefined,\n currentId: string | number | null | undefined,\n options: ResolveSiblingsOptions = {},\n): SiblingsResult<T> {\n const list = Array.isArray(items) ? items.slice() : [];\n const count = list.length;\n if (count === 0) return { ...EMPTY_SIBLINGS };\n\n const idField = options.idField ?? '_id';\n if (options.sortBy) {\n const dir = options.sortDir === 'desc' ? -1 : 1;\n list.sort((a, b) => dir * compareValues(getByPath(a, options.sortBy!), getByPath(b, options.sortBy!)));\n }\n\n const cid = currentId == null ? null : String(currentId);\n const index = cid == null ? -1 : list.findIndex(it => String(getByPath(it, idField)) === cid);\n if (index === -1) return { prev: null, next: null, index: -1, count, isFirst: false, isLast: false };\n\n const canWrap = !!options.wrap && count > 1;\n const prev = index > 0 ? list[index - 1] : (canWrap ? list[count - 1] : null);\n const next = index < count - 1 ? list[index + 1] : (canWrap ? list[0] : null);\n return { prev, next, index, count, isFirst: index === 0, isLast: index === count - 1 };\n}\n\nexport interface BuildRelatedFilterOptions {\n /** Field(s) on the current item whose value(s) the related items must match (e.g. `category`,\n * or `['category', 'brand']`). Each contributes an equality filter on that field. */\n matchFields: string | string[];\n}\n\n/** A value usable as an equality filter param: a non-empty scalar. Objects/arrays/nullish are skipped\n * so a related query isn't built from an unresolved rel object (surfaced as a config issue in the UI\n * rather than silently matching everything). Multi-value match is a v2 concern. */\nfunction isScalarFilterValue(v: any): boolean {\n if (v == null) return false;\n if (typeof v === 'string') return v !== '';\n if (typeof v === 'number') return Number.isFinite(v);\n return typeof v === 'boolean';\n}\n\n/**\n * Build the collection filter for `$related` from the resolved current item: an equality match on\n * each `matchField`'s value (e.g. same `category`). Feeds a normal `collection` plan — no new plan\n * kind. Fields whose value is not a scalar (or is empty) are omitted, matching\n * `buildDataSourceFilter`'s \"don't over-filter\" rule. Exclude-self is applied to the RESULT via\n * {@link excludeSelf} (the public query controllers are equality-only, so it can't be a `$ne` param).\n */\nexport function buildRelatedFilter(current: any, options: BuildRelatedFilterOptions): Record<string, any> {\n const fields = Array.isArray(options.matchFields) ? options.matchFields : [options.matchFields];\n const filter: Record<string, any> = {};\n for (const field of fields) {\n if (!field) continue;\n const value = getByPath(current, field);\n if (isScalarFilterValue(value)) filter[field] = value;\n }\n return filter;\n}\n\n/**\n * Drop the current item from a list by `idField` (default `_id`). Used to exclude self from a\n * `$related` result after fetch. A nullish/empty `currentId` leaves the list unchanged.\n */\nexport function excludeSelf<T = any>(items: T[] | null | undefined, currentId: string | number | null | undefined, idField = '_id'): T[] {\n if (!Array.isArray(items)) return [];\n if (currentId == null || currentId === '') return items;\n const cid = String(currentId);\n return items.filter(it => String(getByPath(it, idField)) !== cid);\n}\n\n/** The resolved Route-scope context bound values read from (`$route.projectId`, `$current.title`,\n * `$siblings.next`, `$related`). Assembled by each consumer during its dependent second pass. */\nexport interface RouteContext {\n /** Route path params for the current URL (from `matchRouteParams`). */\n $route: Record<string, string>;\n /** The resolved current item (the page's single by-id source). */\n $current: any;\n /** Neighbours of the current item within a chosen ordered set. */\n $siblings?: SiblingsResult;\n /** Items related to the current one (same-attribute), excluding self. */\n $related?: any[];\n}\n\n// ── Relative source declaration + the shared second-pass resolver ────────────────────────────────\n// A relative source is declared like a `derived` one (`type:'relative'`), and resolved AFTER the\n// root/derived sources by a PURE pass over the resolved map — mirroring `resolveDerivedInto`, so the\n// SSR engine and the builder canvas agree with no forked logic. `planDataSource` returns `none` for\n// it (not fetched); each consumer excludes `relative` from its fetched roots and runs this pass.\n\nexport type RelativeSourceKind = 'route' | 'current' | 'siblings' | 'related';\n\nexport interface RelativeSourceSpec {\n kind: RelativeSourceKind;\n /** The source alias this derives from: for `current` the subject single-source; for\n * `siblings`/`related` the COLLECTION alias to locate within / search. Unused for `route`. */\n from?: string;\n /** `siblings`/`related`: the SUBJECT source alias (the current item) whose id / field values drive\n * the computation. Defaults to `from` when omitted. May reference `$current`. */\n subjectFrom?: string;\n /** Field identifying an item. Default `_id`. */\n idField?: string;\n /** `siblings`: sort the set before locating neighbours. */\n sortBy?: string;\n sortDir?: 'asc' | 'desc';\n wrap?: boolean;\n /** `siblings`: resolve to a SINGLE neighbour ITEM (`next`/`prev`) instead of the whole\n * `{prev,next,index,count,…}` object — so a source can be named e.g. `nextProject` and bound\n * directly (`nextProject.route`). Omit for the whole-object shape. */\n pick?: 'next' | 'prev';\n /** `related`: field(s) on the subject the results must match. */\n matchFields?: string | string[];\n /** `related`: drop the subject from its own results. Default `true`. */\n excludeSelf?: boolean;\n}\n\n/** Duck-typed view of a data source carrying an optional relative descriptor (avoids a hard dep on\n * the full editor model / a circular type import). */\ninterface RelativeCapableSource {\n alias?: string;\n type?: string;\n request?: { relative?: RelativeSourceSpec };\n}\n\n/** The already-resolved inputs a single relative source computes from. Assembled by each consumer:\n * the batch pass reads them from the resolved map; the builder resolves them async per alias. */\nexport interface RelativeInputs {\n /** The subject item (the current resource) — for `current`/`siblings`/`related`. */\n subject?: any;\n /** The collection to locate within / search — for `siblings`/`related`. */\n collection?: any;\n /** Route path params — for `route`. */\n routeParams?: Record<string, any>;\n}\n\n/** Resolve kinds in a fixed order so a `siblings`/`related` source may reference `$current` (or any\n * earlier relative alias) via `subjectFrom` and still see it resolved. */\nconst KIND_ORDER: Record<RelativeSourceKind, number> = { route: 0, current: 1, siblings: 2, related: 3 };\n\n/** Does an item satisfy every field in an equality predicate map (string-compared)? */\nfunction matchesFilter(item: any, filter: Record<string, any>): boolean {\n return Object.keys(filter).every(k => String(getByPath(item, k)) === String(filter[k]));\n}\n\n/**\n * Compute ONE relative source's value from its already-resolved {@link RelativeInputs} — the SHARED\n * kind→computation decision, so the batch pass ({@link resolveRelativeInto}) and the builder's async\n * per-alias resolver produce identical results with no forked switch. `route` → the route params;\n * `current` → the subject; `siblings` → {@link resolveSiblings} over the collection; `related` → the\n * collection filtered by {@link buildRelatedFilter}'s predicate (+ {@link excludeSelf}).\n */\nexport function computeRelative(spec: RelativeSourceSpec, inputs: RelativeInputs): any {\n const idField = spec.idField ?? '_id';\n switch (spec.kind) {\n case 'route':\n return inputs.routeParams ?? {};\n case 'current':\n return inputs.subject ?? null;\n case 'siblings': {\n const siblings = resolveSiblings(inputs.collection, getByPath(inputs.subject, idField), {\n idField, sortBy: spec.sortBy, sortDir: spec.sortDir, wrap: spec.wrap,\n });\n // `pick` resolves the source directly to that neighbour item (named-source shape,\n // e.g. `nextProject`); without it the caller binds a sub-path of the whole object.\n return spec.pick ? siblings[spec.pick] : siblings;\n }\n case 'related': {\n const filter = buildRelatedFilter(inputs.subject, { matchFields: spec.matchFields ?? [] });\n const pool = Array.isArray(inputs.collection) ? inputs.collection : [];\n const items = pool.filter(it => matchesFilter(it, filter));\n return spec.excludeSelf !== false ? excludeSelf(items, getByPath(inputs.subject, idField), idField) : items;\n }\n default:\n return null;\n }\n}\n\n/**\n * Compute every `type:'relative'` source into `resolved` (keyed by alias), IN PLACE. Pure w.r.t. HTTP\n * — it only reads already-resolved roots + the route params, so both consumers run it identically as\n * a second pass. Delegates each source to {@link computeRelative}. `current`'s subject is `from`;\n * `siblings`/`related` take `collection` = `from` and `subject` = `subjectFrom ?? from`. Mutates and\n * returns `resolved`.\n */\nexport function resolveRelativeInto(\n dataSources: RelativeCapableSource[],\n resolved: Record<string, any>,\n routeParams: Record<string, any> = {},\n): Record<string, any> {\n const relatives = (dataSources ?? [])\n .filter(d => d?.type === 'relative' && !!d.alias && !!d.request?.relative)\n .sort((a, b) => KIND_ORDER[a.request!.relative!.kind] - KIND_ORDER[b.request!.relative!.kind]);\n\n for (const d of relatives) {\n const spec = d.request!.relative!;\n const subjectAlias = spec.kind === 'current' ? spec.from : (spec.subjectFrom ?? spec.from);\n resolved[d.alias!] = computeRelative(spec, {\n subject: subjectAlias ? resolved[subjectAlias] : undefined,\n collection: spec.from ? resolved[spec.from] : undefined,\n routeParams,\n });\n }\n return resolved;\n}\n","/**\n * Which saved page is the studio's HOME page — ONE answer for every screen that names it (iox-cms-client#116).\n *\n * Four readers used to decide this four ways: Home's summary (iox-cms) took the first page marked home at any status,\n * the Pages panel only a PUBLISHED one (so a draft site read \"No page is set as the home page\" while Home said\n * \"Home page: Home\"), the Design redirect a published one first, the Pages screen any. This is the rule they share:\n *\n * - the first PUBLISHED page marked `isHome` — the page the live site serves at its root (iox-cms\n * `PagesService.findByPath` resolves `/` the same way, so a screen never names a different home than the site);\n * - else the first page marked `isHome` at any other status — a site not live yet still HAS a home page, it is\n * only not live (`live: false`);\n * - else `null`: no page is marked home.\n *\n * Pure and framework-free: iox-cms reads it under plain Node, the admin in the browser.\n */\n\n/** The page fields the rule reads — any saved page (or a summary row of one) carries them. */\nexport interface HomePageCandidate {\n isHome?: boolean | null;\n status?: string | null;\n}\n\n/** The home page, and whether the live site serves it yet. */\nexport interface HomePageAnswer<P extends HomePageCandidate> {\n page: P;\n /** True when the page is published — the live site's root. False: marked home, not live yet. */\n live: boolean;\n}\n\n/** The page status that is live. Every other status (draft, archived, none) is not. */\nexport const HOME_PAGE_LIVE_STATUS = 'published';\n\n/** The studio's home page — published first, else the first marked one — or `null` when no page is marked home. */\nexport function homePageOf<P extends HomePageCandidate>(pages: ReadonlyArray<P | null | undefined> | null | undefined): HomePageAnswer<P> | null {\n const marked = (pages ?? []).filter((p): p is P => !!p?.isHome);\n const live = marked.find(p => p.status === HOME_PAGE_LIVE_STATUS);\n if (live) return { page: live, live: true };\n return marked.length ? { page: marked[0], live: false } : null;\n}\n\n/** True when more than one PUBLISHED page claims home — the live site serves the first, the owner should pick one. */\nexport function hasHomeConflict(pages: ReadonlyArray<HomePageCandidate | null | undefined> | null | undefined): boolean {\n return (pages ?? []).filter(p => !!p?.isHome && p.status === HOME_PAGE_LIVE_STATUS).length > 1;\n}\n","/**\n * @vectoriox/iox-ui/data-core — the shared, FRAMEWORK-FREE data-source core (data-source-resolving.md): the ONE\n * decision of how a data source becomes a fetch (`planDataSource`), the route-param matcher, the derived /\n * relative (`$siblings`, `$related`) resolvers, the repeater item reader, and which sources a node tree\n * references (`referencedDataSourcesDeep`), and which saved page is the studio's home (`homePageOf`, #116). The builder and the SSR engine resolve with it; iox-cms reads it\n * under plain Node (W2's Undo: is a data source still in use). Pure: no transport, no Angular. The main\n * entry re-exports it by package path, so `@vectoriox/iox-ui` keeps working.\n * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, tsconfig paths —\n * or `nest start` dies with ERR_REQUIRE_ESM while jest and build both pass.\n */\nexport * from './data-source-resolver';\nexport * from './relative-sources';\nexport * from './home-page';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;AAsBH;IACY;AAAZ,CAAA,UAAY,iBAAiB,EAAA;AACzB,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACjB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,GAAA,EAAA,CAAA,CAAA;AAW7B;AACuG;AAChG,MAAM,UAAU,GAAG;AAC1B,MAAM,UAAU,GAAG,qDAAqD;AAExE;AACM,SAAU,cAAc,CAAC,IAAuC,EAAA;IAClE,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK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,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI;AAClE;AAEA;AACM,SAAU,eAAe,CAAC,KAA6E,EAAA;AACzG,IAAA,OAAO,CAAC,KAAK,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,qBAAqB,CAAC,CAAC,MAAM,GAAG,CAAC;AAClG;;AC3CA;;;;;;;;;AASG;;ACTH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"vectoriox-iox-ui-data-core.mjs","sources":["../../../projects/iox-ui/src/data-core/data-source-resolver.ts","../../../projects/iox-ui/src/data-core/relative-sources.ts","../../../projects/iox-ui/src/data-core/home-page.ts","../../../projects/iox-ui/src/data-core/placeholder-rows.ts","../../../projects/iox-ui/src/data-core/public-api.ts","../../../projects/iox-ui/src/data-core/vectoriox-iox-ui-data-core.ts"],"sourcesContent":["/**\n * Shared data-source resolving pattern — the SINGLE source of truth for how an IoxDataSource\n * becomes a backend fetch, consumed by BOTH the page builder (iox-cms-client bindings panel) and\n * the SSR client engine (iox-client-engine DataSourceResolverService). There must be no second\n * copy of this decision logic; only the transport differs between the two:\n *\n * builder → authenticated org-scoped controllers (admin session):\n * single by id → GET admin.../resources/:type/:id (ContentService.getContentById)\n * collection → GET admin.../resources/:type (ContentService.getContent)\n * engine → @Public() controllers (no auth, isPublished filter applied server-side):\n * single by id → GET api/:type/:id (UserResourcesController)\n * collection → GET api/:type?filters (UserResourcesController)\n *\n * The DECISION (by-id vs collection, which id, which filters, how to pick the single result) is\n * identical for both — that's what this module owns. Each app maps the returned {@link DataSourcePlan}\n * onto its own transport. A single item is ALWAYS fetched by its id as a path segment — never a\n * `?_id=` query — to match the builder's getContentById.\n */\n\nexport type DataSourceMode = 'single' | 'list';\nexport type DataSourceDomain = 'cms' | 'shop';\n\nexport interface DataSourceRouteFilter {\n field?: string;\n routeParam?: string;\n defaultId?: string;\n}\n\nexport interface DataSourceQueryFilter {\n field?: string;\n /** URL query param the value is read from. OMIT for a CONSTANT filter — then `defaultValue`\n * alone is the value, so `isReviewShow=true` filters identically in preview and on the site. */\n queryParam?: string;\n /** Value used when the query param is absent — i.e. always, for a constant filter, and in the\n * builder preview, where there are no live query params. NOT preview-only: it is the runtime\n * fallback too. An empty default with no query-param value means the filter is DROPPED. */\n defaultValue?: string;\n}\n\n/** The order a query source returns its rows in (CC2, board 4 \"Sort\" — the data source popover). */\nexport enum DataSourceSortDir {\n Asc = 'asc',\n Desc = 'desc',\n}\n\nexport interface DataSourceSort {\n /** A field of the content type (a dot path into a nested object is allowed). */\n field?: string;\n dir?: DataSourceSortDir | `${DataSourceSortDir}`;\n}\n\n/** The query parameter carrying the order: `sort=order` ascending, `sort=-order` descending. A CONTROL like\n * `limit`, not a field filter — the public controllers split it out (iox-cms `query-controls.ts`). */\nexport const SORT_PARAM = 'sort';\nconst SORT_FIELD = /^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$/;\n\n/** `sort`'s wire value, or null when the source sets no (valid) order. */\nexport function sortParamValue(sort: DataSourceSort | null | undefined): string | null {\n const field = sort?.field?.trim();\n if (!field || !SORT_FIELD.test(field)) return null;\n return sort?.dir === DataSourceSortDir.Desc ? `-${field}` : field;\n}\n\nexport interface DataSourceRequestSpec {\n contentType?: string;\n limit?: number;\n /** A query source's order (CC2). Absent = the backend's natural order, as before. */\n sort?: DataSourceSort;\n filterByRouteParam?: DataSourceRouteFilter;\n filterByQueryParams?: DataSourceQueryFilter[];\n}\n\n/** Structural (duck-typed) view of an IoxDataSource — kept free of the editor model so both libs\n * can depend on it without pulling in iox-builder. */\nexport interface DataSourceSpec {\n alias?: string;\n type?: string; // 'cms' | 'shop' | 'external-api' | 'static'\n mode?: DataSourceMode;\n request?: {\n cms?: DataSourceRequestSpec;\n shop?: DataSourceRequestSpec;\n endpoint?: string;\n data?: any;\n /** `derived` alias: a VIEW into another variable — resolve `from` then getByPath(value, path)\n * (e.g. galleryImages = product.gallery). See repeater-binding-ux-plan.md. */\n derived?: { from: string; path: string };\n };\n}\n\nexport type DataSourcePlan =\n | { kind: 'by-id'; domain: DataSourceDomain; resource: string; id: string; mode: DataSourceMode }\n | { kind: 'collection'; domain: DataSourceDomain; resource: string; filter: Record<string, any>; limit?: number; sort?: string; mode: DataSourceMode }\n | { kind: 'external'; endpoint: string; mode: DataSourceMode }\n | { kind: 'static'; data: any; mode: DataSourceMode }\n | { kind: 'derived'; from: string; path: string; mode: DataSourceMode }\n | { kind: 'none' };\n\n/**\n * Match a page route template against an actual path and extract named params.\n * matchRouteParams('/project/:projectId', 'project/68abc') → { projectId: '68abc' }\n * Both sides are normalised (leading slash stripped) and split on '/'; values are URL-decoded.\n */\nexport function matchRouteParams(template: string | undefined, actual: string | undefined): Record<string, string> {\n const t = (template ?? '').replace(/^\\/+/, '').split('/');\n const a = (actual ?? '').replace(/^\\/+/, '').split('/');\n const params: Record<string, string> = {};\n for (let i = 0; i < t.length; i++) {\n const seg = t[i];\n if (seg && seg.startsWith(':')) params[seg.slice(1)] = decodeURIComponent(a[i] ?? '');\n }\n return params;\n}\n\n/**\n * Build the query filter for a data-source request from its filterByRouteParam / filterByQueryParams\n * config. `field` is filtered by the route-param value (falling back to `defaultId`); query filters\n * map each `field` to a query-param value (falling back to `defaultValue`), and a filter with NO\n * `queryParam` is a constant on `defaultValue`. Empty values are omitted so the source isn't\n * accidentally filtered to nothing.\n */\nexport function buildDataSourceFilter(\n req: DataSourceRequestSpec | undefined,\n routeParams: Record<string, any> = {},\n queryParams: Record<string, any> = {},\n): Record<string, any> {\n const params: Record<string, any> = {};\n const byRoute = req?.filterByRouteParam;\n if (byRoute?.field && byRoute?.routeParam) {\n const value = routeParams[byRoute.routeParam] ?? byRoute.defaultId;\n if (value !== undefined && value !== null && value !== '') params[byRoute.field] = value;\n }\n for (const q of req?.filterByQueryParams ?? []) {\n if (!q?.field) continue;\n // No queryParam → a CONSTANT filter: defaultValue is the value, in the builder preview and\n // on the live site alike. With a queryParam the URL wins and defaultValue is the fallback.\n const value = q.queryParam ? (queryParams[q.queryParam] ?? q.defaultValue) : q.defaultValue;\n if (value !== undefined && value !== null && value !== '') params[q.field] = value;\n }\n return params;\n}\n\n/**\n * Mirrors the builder's getContentById decision. When a SINGLE source is filtered by the item id\n * (`_id`) via a route param, the item is fetched by PATH (`.../:type/:id`), not a `?_id=` query.\n * Returns that id (route-param value, else `defaultId`), or `null` when the source isn't a\n * single-by-id fetch — in which case the caller uses the collection endpoint + filters. The\n * path-based form only applies to the id field; a single source filtered by any other field still\n * goes through the collection endpoint.\n */\nexport function resolveSingleItemId(req: DataSourceRequestSpec | undefined, routeParams: Record<string, any> = {}): string | null {\n const byRoute = req?.filterByRouteParam;\n if (!byRoute?.routeParam) return null;\n if (byRoute.field && byRoute.field !== '_id') return null;\n const value = routeParams[byRoute.routeParam] ?? byRoute.defaultId;\n return value !== undefined && value !== null && value !== '' ? String(value) : null;\n}\n\n/**\n * Resolve an IoxDataSource into a transport-agnostic {@link DataSourcePlan}. This is the shared\n * decision both the builder and the SSR engine run; each then executes the plan with its own\n * HTTP layer. Single sources with a route-param id resolve to a `by-id` (path) fetch — exactly like\n * the builder's getContentById.\n */\nexport function planDataSource(\n ds: DataSourceSpec | undefined,\n routeParams: Record<string, any> = {},\n queryParams: Record<string, any> = {},\n): DataSourcePlan {\n const mode: DataSourceMode = ds?.mode === 'single' ? 'single' : 'list';\n switch (ds?.type) {\n case 'cms':\n case 'shop': {\n const domain = ds.type as DataSourceDomain;\n const req = domain === 'cms' ? ds.request?.cms : ds.request?.shop;\n const resource = req?.contentType;\n if (!resource) return { kind: 'none' };\n const id = mode === 'single' ? resolveSingleItemId(req, routeParams) : null;\n if (id) return { kind: 'by-id', domain, resource, id, mode };\n const filter = buildDataSourceFilter(req, routeParams, queryParams);\n const plan: DataSourcePlan = { kind: 'collection', domain, resource, filter, mode };\n if (req?.limit) (plan as any).limit = req.limit;\n const sort = sortParamValue(req?.sort);\n if (sort) (plan as any).sort = sort;\n return plan;\n }\n case 'external-api': {\n const endpoint = ds.request?.endpoint;\n return endpoint ? { kind: 'external', endpoint, mode } : { kind: 'none' };\n }\n case 'static':\n return { kind: 'static', data: ds.request?.data ?? null, mode };\n case 'derived': {\n const d = ds.request?.derived;\n return d?.from ? { kind: 'derived', from: d.from, path: d.path ?? '', mode } : { kind: 'none' };\n }\n case 'variable':\n // A VARIABLE is a page-local resource whose value is WRITTEN at runtime by an interaction\n // (setContext), never fetched. It resolves to nothing here on purpose: the page renders\n // its empty state until something writes it. `request.variable.itemsFrom` only names the\n // source whose items it holds, so the bind picker can suggest fields.\n return { kind: 'none' };\n default:\n return { kind: 'none' };\n }\n}\n\n/**\n * The aliases on a page that are VARIABLES — runtime-written resources, not fetched data.\n *\n * Shared so the builder and the SSR engine agree on which aliases start empty and are filled by\n * interactions. See element-context-state-plan.md.\n */\nexport function variableAliases(dataSources: readonly { alias?: string; type?: string }[] | undefined): Set<string> {\n const out = new Set<string>();\n for (const ds of dataSources ?? []) {\n if (ds?.type === 'variable' && ds.alias) out.add(ds.alias);\n }\n return out;\n}\n\n/** The source alias whose items a variable holds, if it declares one (for field suggestions). */\nexport function variableItemsFrom(\n dataSources: readonly { alias?: string; type?: string; request?: any }[] | undefined,\n alias: string,\n): string | undefined {\n for (const ds of dataSources ?? []) {\n if (ds?.type === 'variable' && ds.alias === alias) return ds.request?.variable?.itemsFrom || undefined;\n }\n return undefined;\n}\n\n/**\n * Normalise a collection response into the shape a source expects: unwraps `{items}`/`{data}`\n * envelopes, then returns the first item for a `single` source or the whole array for a `list`.\n * A `by-id` response is already the item, so callers pass it through unchanged.\n */\nexport function normalizeCollectionResult(mode: DataSourceMode, data: any): any {\n const items = Array.isArray(data) ? data : (data?.items ?? data?.data ?? []);\n return mode === 'single' ? (items[0] ?? null) : items;\n}\n\n/** Navigate a dot/bracket path into an object, e.g. `gallery`, `details.images`, `variants[0].skus`.\n * Returns undefined if any segment is missing. Kept minimal + self-contained so it is shareable by\n * both the builder and the SSR engine (the two have divergent local `resolvePath` copies). */\nexport function getByPath(obj: any, path: string): any {\n if (obj == null || !path) return obj;\n // Turn `a[0].b` into ['a','0','b'].\n const segments = path.replace(/\\[(\\w+)\\]/g, '.$1').split('.').filter(Boolean);\n let cur = obj;\n for (const seg of segments) {\n if (cur == null) return undefined;\n cur = cur[seg];\n }\n return cur;\n}\n\n/**\n * The array a Repeater (or a repeating Slider) iterates over — the SHARED decision so the builder\n * canvas and the SSR engine agree (see data-source-resolving.md).\n * - No `sourcePath`: the resolved source IS the list. An array passes through; a lone object degrades\n * to a single-row list (back-compat with the old `fetchItems`); null/undefined → `[]`.\n * - With `sourcePath`: the source resolved to a SINGLE resource (e.g. a product); dive into the\n * nested array property (e.g. `gallery`). Non-array / missing → `[]`.\n */\n/**\n * Fill in `derived` aliases in an already-resolved map. Given the data sources and a map of resolved\n * NON-derived values (by alias), compute each `type:'derived'` alias as `getByPath(parent, path)` in\n * dependency order (chains resolved by iterating until stable). Mutates + returns the map. Used by the\n * SSR engine after it resolves the root sources; the builder resolves derived lazily per alias.\n */\nexport function resolveDerivedInto(dataSources: DataSourceSpec[], resolved: Record<string, any>): Record<string, any> {\n const derived = (dataSources ?? []).filter(d => d?.type === 'derived' && !!d.alias);\n let changed = true, guard = 0;\n while (changed && guard++ < 25) {\n changed = false;\n for (const d of derived) {\n if (d.alias! in resolved) continue;\n const from = d.request?.derived?.from;\n if (from && from in resolved) {\n resolved[d.alias!] = getByPath(resolved[from], d.request!.derived!.path ?? '');\n changed = true;\n }\n }\n }\n return resolved;\n}\n\nexport function resolveRepeaterItems(resolved: any, sourcePath?: string | null): any[] {\n if (sourcePath) {\n const nested = getByPath(resolved, sourcePath);\n return Array.isArray(nested) ? nested : [];\n }\n if (Array.isArray(resolved)) return resolved;\n return resolved == null ? [] : [resolved];\n}\n\n// ── Referenced data sources (shared: builder-save + SSR resolve) ─────────────────────────────────\n// Which data-source aliases a node tree uses, so a consumer resolves ONLY what a page/global needs\n// (not the whole org library). Used by cms-client (persist globals' sources) and the SSR engine\n// (resolve the referenced subset per page). See org-data-sources-plan.md.\n\n/** Aliases referenced anywhere in a node tree: a repeater/slider `source` (a `bindings` entry with\n * `prop === 'source'`, or `props.source` for the slider) plus every binding's `source`. */\nexport function collectReferencedAliases(nodes: any[], acc: Set<string> = new Set<string>()): Set<string> {\n for (const n of nodes ?? []) {\n for (const b of n?.bindings ?? []) { if (b?.source) acc.add(b.source); }\n if (n?.props?.source) acc.add(n.props.source);\n if (n?.children?.length) collectReferencedAliases(n.children, acc);\n }\n return acc;\n}\n\n/** The subset of `all` whose `alias` is referenced by `nodes` (shallow — direct references only). */\nexport function referencedDataSources(nodes: any[], all: any[]): any[] {\n const aliases = collectReferencedAliases(nodes);\n return (all ?? []).filter(ds => aliases.has(ds?.alias));\n}\n\n/** Like `referencedDataSources`, but also pulls in a referenced source's DEPENDENCIES (transitively),\n * none of which the layout names directly:\n * - a `derived` alias needs its `request.derived.from` parent;\n * - a `relative` (route-context) alias needs its `request.relative.subjectFrom` (the current item)\n * and `request.relative.from` (the collection it navigates).\n * Use this when RESOLVING (the engine) so derived views and siblings/related don't resolve to nothing. */\nexport function referencedDataSourcesDeep(nodes: any[], all: any[]): any[] {\n const byAlias = new Map((all ?? []).map(d => [d?.alias, d]));\n const wanted = collectReferencedAliases(nodes);\n const queue = [...wanted];\n const enqueue = (alias?: string) => {\n if (alias && !wanted.has(alias)) { wanted.add(alias); queue.push(alias); }\n };\n while (queue.length) {\n const ds: any = byAlias.get(queue.pop() as string);\n enqueue(ds?.request?.derived?.from);\n enqueue(ds?.request?.relative?.subjectFrom);\n enqueue(ds?.request?.relative?.from);\n }\n return (all ?? []).filter(d => wanted.has(d?.alias));\n}\n\n/** Base URLs for the PUBLIC content controllers. Both must end with `/`. The builder and the SSR\n * engine pass their own host (they proxy `/api` differently) but MUST target the public\n * (`@Public()`) controllers, never the authed admin ones — data resolving is storefront data. */\nexport interface DataSourceEndpoints {\n /** cms resources, e.g. `${HOST}` (engine, HOST ends `/api/`) or `${HOST}api/` (builder). */\n cmsBase: string;\n /** shop resources, e.g. `${HOST}shop/` (engine) or `${HOST}api/shop/` (builder). */\n shopBase: string;\n}\n\nexport interface DataSourceRequest {\n url: string;\n params: Record<string, any>;\n}\n\n/**\n * Turn a resolved {@link DataSourcePlan} into the concrete public HTTP request (url + params) — the\n * SINGLE place that decides the URL shape, shared by the builder binding preview and the SSR engine\n * so both hit the SAME public endpoints (no admin, no duplication). Returns `null` for `static` /\n * `none` plans (no HTTP call). A single item is a PATH segment (`/:resource/:id`), never `?_id=`.\n */\nexport function dataSourcePlanToRequest(plan: DataSourcePlan, endpoints: DataSourceEndpoints): DataSourceRequest | null {\n const baseFor = (domain: DataSourceDomain) => (domain === 'shop' ? endpoints.shopBase : endpoints.cmsBase);\n switch (plan.kind) {\n case 'by-id':\n return { url: `${baseFor(plan.domain)}${plan.resource}/${encodeURIComponent(plan.id)}`, params: {} };\n case 'collection': {\n const params: Record<string, any> = { ...plan.filter };\n if (plan.limit) params['limit'] = plan.limit;\n if (plan.sort) params[SORT_PARAM] = plan.sort;\n return { url: `${baseFor(plan.domain)}${plan.resource}`, params };\n }\n case 'external':\n return { url: plan.endpoint, params: {} };\n default:\n return null;\n }\n}\n","/**\n * Shared RELATIVE (route-context) data resolving — the SINGLE source of truth for how a detail page\n * derives values FROM its current route item, consumed by BOTH the page builder (iox-cms-client) and\n * the SSR client engine (iox-client-engine). Companion to `data-source-resolver.ts`.\n *\n * These are the pure, transport-agnostic pieces behind the Route binding scope\n * (`$route` / `$current` / `$siblings` / `$related`). Resolution is a DEPENDENT SECOND PASS: the\n * consumer resolves `$current` first (the existing single by-id fetch via `planDataSource`), then\n * calls these to derive the relative values — there is NO new `DataSourcePlan` kind (`$related` still\n * feeds a normal `collection` plan built from {@link buildRelatedFilter}). See\n * `architecture/builder/relative-data-sources-plan.md`.\n *\n * There must be no second copy of this decision logic; only the transport (which HTTP layer fetches\n * the ordered collection / related list) differs between the two consumers.\n */\n\nimport { getByPath } from './data-source-resolver';\n\n/** Aliases in the Route scope are platform-owned and start with this prefix; a USER alias may never\n * start with it, which keeps the Route scope structurally collision-proof with Local/Global. Used to\n * validate new/renamed aliases and to render the reserved (read-only) item state in the bind picker. */\nexport const RESERVED_ALIAS_PREFIX = '$';\n\n/** True for a platform-owned Route-scope alias (`$route`, `$current`, `$siblings`, `$related`, …). */\nexport function isReservedAlias(alias: string | null | undefined): boolean {\n return typeof alias === 'string' && alias.startsWith(RESERVED_ALIAS_PREFIX);\n}\n\n/** The `$siblings` value: the current item's neighbours within an ordered set. */\nexport interface SiblingsResult<T = any> {\n /** The item before the current one (`null` at the start, unless `wrap`). */\n prev: T | null;\n /** The item after the current one (`null` at the end, unless `wrap`). */\n next: T | null;\n /** Zero-based position of the current item in the ordered set; `-1` when not found. */\n index: number;\n /** Total items in the set. */\n count: number;\n /** `true` when the current item is the first in the set. */\n isFirst: boolean;\n /** `true` when the current item is the last in the set. */\n isLast: boolean;\n}\n\nexport interface ResolveSiblingsOptions {\n /** Field identifying the current item within the list. Default `_id`. */\n idField?: string;\n /** Dot/bracket path to sort by BEFORE locating neighbours (e.g. `order`, `date`). Omit to use the\n * list's existing order. The same item neighbours differently per ordering, so this is the one\n * choice `$siblings` requires. */\n sortBy?: string;\n /** Sort direction when `sortBy` is set. Default `asc`. */\n sortDir?: 'asc' | 'desc';\n /** Wrap around the ends (`last.next` → first, `first.prev` → last). Only applies when `count > 1`.\n * Default `false`. */\n wrap?: boolean;\n}\n\nconst EMPTY_SIBLINGS: SiblingsResult = { prev: null, next: null, index: -1, count: 0, isFirst: false, isLast: false };\n\n/** Generic, deterministic comparator: numbers numerically, Dates by time, everything else by\n * locale-aware string compare (ISO date strings sort correctly this way). Nullish sorts first. */\nfunction compareValues(a: any, b: any): number {\n if (a == null && b == null) return 0;\n if (a == null) return -1;\n if (b == null) return 1;\n if (typeof a === 'number' && typeof b === 'number') return a - b;\n const da = a instanceof Date ? a.getTime() : NaN;\n const db = b instanceof Date ? b.getTime() : NaN;\n if (!isNaN(da) && !isNaN(db)) return da - db;\n return String(a).localeCompare(String(b));\n}\n\n/**\n * Locate the current item within an ordered set and return its neighbours + position. Pure: the input\n * list is never mutated (sorting works on a shallow copy). `currentId` is compared to each item's\n * `idField` via string equality (route-param values are strings). When the current id isn't found,\n * `index` is `-1` and `prev`/`next` are `null` (but `count` still reflects the set size).\n */\nexport function resolveSiblings<T = any>(\n items: T[] | null | undefined,\n currentId: string | number | null | undefined,\n options: ResolveSiblingsOptions = {},\n): SiblingsResult<T> {\n const list = Array.isArray(items) ? items.slice() : [];\n const count = list.length;\n if (count === 0) return { ...EMPTY_SIBLINGS };\n\n const idField = options.idField ?? '_id';\n if (options.sortBy) {\n const dir = options.sortDir === 'desc' ? -1 : 1;\n list.sort((a, b) => dir * compareValues(getByPath(a, options.sortBy!), getByPath(b, options.sortBy!)));\n }\n\n const cid = currentId == null ? null : String(currentId);\n const index = cid == null ? -1 : list.findIndex(it => String(getByPath(it, idField)) === cid);\n if (index === -1) return { prev: null, next: null, index: -1, count, isFirst: false, isLast: false };\n\n const canWrap = !!options.wrap && count > 1;\n const prev = index > 0 ? list[index - 1] : (canWrap ? list[count - 1] : null);\n const next = index < count - 1 ? list[index + 1] : (canWrap ? list[0] : null);\n return { prev, next, index, count, isFirst: index === 0, isLast: index === count - 1 };\n}\n\nexport interface BuildRelatedFilterOptions {\n /** Field(s) on the current item whose value(s) the related items must match (e.g. `category`,\n * or `['category', 'brand']`). Each contributes an equality filter on that field. */\n matchFields: string | string[];\n}\n\n/** A value usable as an equality filter param: a non-empty scalar. Objects/arrays/nullish are skipped\n * so a related query isn't built from an unresolved rel object (surfaced as a config issue in the UI\n * rather than silently matching everything). Multi-value match is a v2 concern. */\nfunction isScalarFilterValue(v: any): boolean {\n if (v == null) return false;\n if (typeof v === 'string') return v !== '';\n if (typeof v === 'number') return Number.isFinite(v);\n return typeof v === 'boolean';\n}\n\n/**\n * Build the collection filter for `$related` from the resolved current item: an equality match on\n * each `matchField`'s value (e.g. same `category`). Feeds a normal `collection` plan — no new plan\n * kind. Fields whose value is not a scalar (or is empty) are omitted, matching\n * `buildDataSourceFilter`'s \"don't over-filter\" rule. Exclude-self is applied to the RESULT via\n * {@link excludeSelf} (the public query controllers are equality-only, so it can't be a `$ne` param).\n */\nexport function buildRelatedFilter(current: any, options: BuildRelatedFilterOptions): Record<string, any> {\n const fields = Array.isArray(options.matchFields) ? options.matchFields : [options.matchFields];\n const filter: Record<string, any> = {};\n for (const field of fields) {\n if (!field) continue;\n const value = getByPath(current, field);\n if (isScalarFilterValue(value)) filter[field] = value;\n }\n return filter;\n}\n\n/**\n * Drop the current item from a list by `idField` (default `_id`). Used to exclude self from a\n * `$related` result after fetch. A nullish/empty `currentId` leaves the list unchanged.\n */\nexport function excludeSelf<T = any>(items: T[] | null | undefined, currentId: string | number | null | undefined, idField = '_id'): T[] {\n if (!Array.isArray(items)) return [];\n if (currentId == null || currentId === '') return items;\n const cid = String(currentId);\n return items.filter(it => String(getByPath(it, idField)) !== cid);\n}\n\n/** The resolved Route-scope context bound values read from (`$route.projectId`, `$current.title`,\n * `$siblings.next`, `$related`). Assembled by each consumer during its dependent second pass. */\nexport interface RouteContext {\n /** Route path params for the current URL (from `matchRouteParams`). */\n $route: Record<string, string>;\n /** The resolved current item (the page's single by-id source). */\n $current: any;\n /** Neighbours of the current item within a chosen ordered set. */\n $siblings?: SiblingsResult;\n /** Items related to the current one (same-attribute), excluding self. */\n $related?: any[];\n}\n\n// ── Relative source declaration + the shared second-pass resolver ────────────────────────────────\n// A relative source is declared like a `derived` one (`type:'relative'`), and resolved AFTER the\n// root/derived sources by a PURE pass over the resolved map — mirroring `resolveDerivedInto`, so the\n// SSR engine and the builder canvas agree with no forked logic. `planDataSource` returns `none` for\n// it (not fetched); each consumer excludes `relative` from its fetched roots and runs this pass.\n\nexport type RelativeSourceKind = 'route' | 'current' | 'siblings' | 'related';\n\nexport interface RelativeSourceSpec {\n kind: RelativeSourceKind;\n /** The source alias this derives from: for `current` the subject single-source; for\n * `siblings`/`related` the COLLECTION alias to locate within / search. Unused for `route`. */\n from?: string;\n /** `siblings`/`related`: the SUBJECT source alias (the current item) whose id / field values drive\n * the computation. Defaults to `from` when omitted. May reference `$current`. */\n subjectFrom?: string;\n /** Field identifying an item. Default `_id`. */\n idField?: string;\n /** `siblings`: sort the set before locating neighbours. */\n sortBy?: string;\n sortDir?: 'asc' | 'desc';\n wrap?: boolean;\n /** `siblings`: resolve to a SINGLE neighbour ITEM (`next`/`prev`) instead of the whole\n * `{prev,next,index,count,…}` object — so a source can be named e.g. `nextProject` and bound\n * directly (`nextProject.route`). Omit for the whole-object shape. */\n pick?: 'next' | 'prev';\n /** `related`: field(s) on the subject the results must match. */\n matchFields?: string | string[];\n /** `related`: drop the subject from its own results. Default `true`. */\n excludeSelf?: boolean;\n}\n\n/** Duck-typed view of a data source carrying an optional relative descriptor (avoids a hard dep on\n * the full editor model / a circular type import). */\ninterface RelativeCapableSource {\n alias?: string;\n type?: string;\n request?: { relative?: RelativeSourceSpec };\n}\n\n/** The already-resolved inputs a single relative source computes from. Assembled by each consumer:\n * the batch pass reads them from the resolved map; the builder resolves them async per alias. */\nexport interface RelativeInputs {\n /** The subject item (the current resource) — for `current`/`siblings`/`related`. */\n subject?: any;\n /** The collection to locate within / search — for `siblings`/`related`. */\n collection?: any;\n /** Route path params — for `route`. */\n routeParams?: Record<string, any>;\n}\n\n/** Resolve kinds in a fixed order so a `siblings`/`related` source may reference `$current` (or any\n * earlier relative alias) via `subjectFrom` and still see it resolved. */\nconst KIND_ORDER: Record<RelativeSourceKind, number> = { route: 0, current: 1, siblings: 2, related: 3 };\n\n/** Does an item satisfy every field in an equality predicate map (string-compared)? */\nfunction matchesFilter(item: any, filter: Record<string, any>): boolean {\n return Object.keys(filter).every(k => String(getByPath(item, k)) === String(filter[k]));\n}\n\n/**\n * Compute ONE relative source's value from its already-resolved {@link RelativeInputs} — the SHARED\n * kind→computation decision, so the batch pass ({@link resolveRelativeInto}) and the builder's async\n * per-alias resolver produce identical results with no forked switch. `route` → the route params;\n * `current` → the subject; `siblings` → {@link resolveSiblings} over the collection; `related` → the\n * collection filtered by {@link buildRelatedFilter}'s predicate (+ {@link excludeSelf}).\n */\nexport function computeRelative(spec: RelativeSourceSpec, inputs: RelativeInputs): any {\n const idField = spec.idField ?? '_id';\n switch (spec.kind) {\n case 'route':\n return inputs.routeParams ?? {};\n case 'current':\n return inputs.subject ?? null;\n case 'siblings': {\n const siblings = resolveSiblings(inputs.collection, getByPath(inputs.subject, idField), {\n idField, sortBy: spec.sortBy, sortDir: spec.sortDir, wrap: spec.wrap,\n });\n // `pick` resolves the source directly to that neighbour item (named-source shape,\n // e.g. `nextProject`); without it the caller binds a sub-path of the whole object.\n return spec.pick ? siblings[spec.pick] : siblings;\n }\n case 'related': {\n const filter = buildRelatedFilter(inputs.subject, { matchFields: spec.matchFields ?? [] });\n const pool = Array.isArray(inputs.collection) ? inputs.collection : [];\n const items = pool.filter(it => matchesFilter(it, filter));\n return spec.excludeSelf !== false ? excludeSelf(items, getByPath(inputs.subject, idField), idField) : items;\n }\n default:\n return null;\n }\n}\n\n/**\n * Compute every `type:'relative'` source into `resolved` (keyed by alias), IN PLACE. Pure w.r.t. HTTP\n * — it only reads already-resolved roots + the route params, so both consumers run it identically as\n * a second pass. Delegates each source to {@link computeRelative}. `current`'s subject is `from`;\n * `siblings`/`related` take `collection` = `from` and `subject` = `subjectFrom ?? from`. Mutates and\n * returns `resolved`.\n */\nexport function resolveRelativeInto(\n dataSources: RelativeCapableSource[],\n resolved: Record<string, any>,\n routeParams: Record<string, any> = {},\n): Record<string, any> {\n const relatives = (dataSources ?? [])\n .filter(d => d?.type === 'relative' && !!d.alias && !!d.request?.relative)\n .sort((a, b) => KIND_ORDER[a.request!.relative!.kind] - KIND_ORDER[b.request!.relative!.kind]);\n\n for (const d of relatives) {\n const spec = d.request!.relative!;\n const subjectAlias = spec.kind === 'current' ? spec.from : (spec.subjectFrom ?? spec.from);\n resolved[d.alias!] = computeRelative(spec, {\n subject: subjectAlias ? resolved[subjectAlias] : undefined,\n collection: spec.from ? resolved[spec.from] : undefined,\n routeParams,\n });\n }\n return resolved;\n}\n","/**\n * Which saved page is the studio's HOME page — ONE answer for every screen that names it (iox-cms-client#116).\n *\n * Four readers used to decide this four ways: Home's summary (iox-cms) took the first page marked home at any status,\n * the Pages panel only a PUBLISHED one (so a draft site read \"No page is set as the home page\" while Home said\n * \"Home page: Home\"), the Design redirect a published one first, the Pages screen any. This is the rule they share:\n *\n * - the first PUBLISHED page marked `isHome` — the page the live site serves at its root (iox-cms\n * `PagesService.findByPath` resolves `/` the same way, so a screen never names a different home than the site);\n * - else the first page marked `isHome` at any other status — a site not live yet still HAS a home page, it is\n * only not live (`live: false`);\n * - else `null`: no page is marked home.\n *\n * Pure and framework-free: iox-cms reads it under plain Node, the admin in the browser.\n */\n\n/** The page fields the rule reads — any saved page (or a summary row of one) carries them. */\nexport interface HomePageCandidate {\n isHome?: boolean | null;\n status?: string | null;\n}\n\n/** The home page, and whether the live site serves it yet. */\nexport interface HomePageAnswer<P extends HomePageCandidate> {\n page: P;\n /** True when the page is published — the live site's root. False: marked home, not live yet. */\n live: boolean;\n}\n\n/** The page status that is live. Every other status (draft, archived, none) is not. */\nexport const HOME_PAGE_LIVE_STATUS = 'published';\n\n/** The studio's home page — published first, else the first marked one — or `null` when no page is marked home. */\nexport function homePageOf<P extends HomePageCandidate>(pages: ReadonlyArray<P | null | undefined> | null | undefined): HomePageAnswer<P> | null {\n const marked = (pages ?? []).filter((p): p is P => !!p?.isHome);\n const live = marked.find(p => p.status === HOME_PAGE_LIVE_STATUS);\n if (live) return { page: live, live: true };\n return marked.length ? { page: marked[0], live: false } : null;\n}\n\n/** True when more than one PUBLISHED page claims home — the live site serves the first, the owner should pick one. */\nexport function hasHomeConflict(pages: ReadonlyArray<HomePageCandidate | null | undefined> | null | undefined): boolean {\n return (pages ?? []).filter(p => !!p?.isHome && p.status === HOME_PAGE_LIVE_STATUS).length > 1;\n}\n","import { resolveRepeaterItems } from './data-source-resolver';\n\n/**\n * Ghost cards (vectoriox/iox-ui#178, Doron 2026-11-28; board `architecture/ai/boards/ghost-cards.board.html`).\n *\n * A generated site keeps its sample items: every page, section and list stays, so the owner sees where things go.\n * A sample the build could not name (it is still \"Product 2\") is a PLACEHOLDER ROW. The builder canvas and Preview draw\n * it as a ghost card that asks the owner to add the first item. The live site never shows it. This file is the ONE\n * reading of both, so the builder and the SSR engine agree:\n *\n * - `isNumberedPlaceholderTitle` — words and then a number (G-D1). The Publishable gate reads it as well.\n * - `isPlaceholderRow(row, titleField)` — a row marked `isSample` whose title is such a placeholder.\n * - `listTitleField(list)` — the field a list's card shows as its title.\n * - `planPlaceholderHides(roots, resolved)` — what the live engine leaves out (G-D3): placeholder rows are dropped,\n * a list with no live row is not drawn, and its top-level section hides when only its frame is left (heading,\n * eyebrow, lead text, buttons). Pages and their nav links stay (G-D4).\n *\n * Pure and framework-free: no transport, no Angular.\n */\n\n/** The stored field that marks a seeded sample item (iox-cms `SAMPLE_FIELD`). */\nexport const SAMPLE_ROW_FIELD = 'isSample';\n\n/** The fields a row's title is read from when its list names none (a hand-built list, a slider without a title part). */\nexport const PLACEHOLDER_TITLE_FALLBACK_FIELDS: readonly string[] = ['title', 'name', 'label'];\n\n/**\n * A title that is a numbered placeholder: words and then the item's number (\"Product 2\", \"Room 2\", \"שם מעצבת השיער 1\",\n * \"Sample name 3\"). Read only on rows marked `isSample`, so a real item called \"Studio 54\" is never one.\n */\nexport function isNumberedPlaceholderTitle(title: string | null | undefined): boolean {\n return typeof title === 'string' && /^\\D*\\S\\s+\\d{1,3}$/u.test(title.trim());\n}\n\n/** The value at a dotted path of a row (`title`, `details.name`). */\nfunction fieldOf(row: Record<string, unknown>, path: string): unknown {\n let at: unknown = row;\n for (const key of path.split('.').filter(Boolean)) {\n if (at == null || typeof at !== 'object') return undefined;\n at = (at as Record<string, unknown>)[key];\n }\n return at;\n}\n\n/**\n * True when a row is a sample still titled \"<words> <n>\" — the builder draws a ghost card for it, the live site leaves it\n * out. `titleField` is the list's title field (`listTitleField`); without one the row's `title` / `name` / `label` is\n * read. A row with no title to read is never a placeholder: when in doubt, show it.\n */\nexport function isPlaceholderRow(row: unknown, titleField?: string | null): boolean {\n if (!row || typeof row !== 'object' || Array.isArray(row)) return false;\n const r = row as Record<string, unknown>;\n if (r[SAMPLE_ROW_FIELD] !== true) return false;\n const field = titleField || PLACEHOLDER_TITLE_FALLBACK_FIELDS.find(f => typeof r[f] === 'string');\n if (!field) return false;\n const title = fieldOf(r, field);\n return typeof title === 'string' && isNumberedPlaceholderTitle(title);\n}\n\n/** The node fields the plan reads — a saved layout node (builder serializer shape) or a live ComponentNode. */\nexport interface PlaceholderPlanNode {\n id?: string;\n type?: string;\n role?: string;\n props?: Record<string, unknown> | null;\n bindings?: ReadonlyArray<{ prop?: string; source?: string; path?: string } | null | undefined> | null;\n children?: ReadonlyArray<PlaceholderPlanNode | null | undefined> | null;\n}\n\n/** The node types that repeat a source's rows: a Repeater, and a slider whose slides repeat. */\nexport const LIST_NODE_TYPES: ReadonlySet<string> = new Set(['Repeater', 'SliderContainer']);\n\n/**\n * The data source whose ITEMS a node repeats — a Repeater's or slider's `source` binding with no path (or a slider's\n * `props.source`) — else `null`. A list over an array inside one item (`project.gallery`) is not a list of items.\n */\nexport function listSourceOf(node: PlaceholderPlanNode | null | undefined): string | null {\n if (!node || !LIST_NODE_TYPES.has(node.type ?? '')) return null;\n const bound = (node.bindings ?? []).find(b => b?.prop === 'source' && !!b.source);\n if (bound) return bound.path ? null : bound.source!;\n const prop = node.props?.['source'];\n return typeof prop === 'string' && prop ? prop : null;\n}\n\n/** Depth-first walk of a node's descendants (not the node itself), stopping below `skip`. */\nfunction descendants(node: PlaceholderPlanNode, skip?: (n: PlaceholderPlanNode) => boolean): PlaceholderPlanNode[] {\n const out: PlaceholderPlanNode[] = [];\n const walk = (n: PlaceholderPlanNode): void => {\n for (const c of n.children ?? []) {\n if (!c) continue;\n out.push(c);\n if (!skip?.(c)) walk(c);\n }\n };\n walk(node);\n return out;\n}\n\n/** The path a node's `content` binding reads from its list's rows, or '' when it has none. */\nfunction contentPath(node: PlaceholderPlanNode, source: string): string {\n const b = (node.bindings ?? []).find(x => x?.prop === 'content' && x.source === source && !!x.path);\n return b?.path ?? '';\n}\n\n/**\n * The row field a list shows as its title: the bound text of its card's title part (a role ending in `title`, e.g.\n * `card.title`), else of its first bound Heading, else `null` (then `isPlaceholderRow` falls back to title/name/label).\n * Nested lists are not looked into.\n */\nexport function listTitleField(list: PlaceholderPlanNode | null | undefined): string | null {\n const source = listSourceOf(list);\n if (!list || !source) return null;\n const inside = descendants(list, n => LIST_NODE_TYPES.has(n.type ?? ''));\n const titled = inside.find(n => /(^|\\.)title$/.test(n.role ?? '') && contentPath(n, source));\n if (titled) return contentPath(titled, source);\n const heading = inside.find(n => n.type === 'Heading' && contentPath(n, source));\n return heading ? contentPath(heading, source) : null;\n}\n\n/**\n * The node types that are only a list section's FRAME (G-D3): its heading, eyebrow, lead text, buttons, links, icons\n * and the boxes around them. A section left with only these hides with its list. Anything else (a picture, a video, a\n * form, a gallery, a static list, a slider that is not bound) is content of its own and keeps the section.\n */\nexport const LIST_FRAME_TYPES: ReadonlySet<string> = new Set([\n 'Section', 'Container', 'LinkedContainer', 'Card', 'Heading', 'Text', 'Button', 'ButtonBlock', 'Link', 'Icon',\n 'Divider', 'Spacer', 'Dialog', 'Popover',\n]);\n\n/** The words a list section's frame holds at most outside its list: an eyebrow and a lead line. A third Text is words\n * of the section's own (board B), so it stays. */\nexport const LIST_FRAME_MAX_TEXTS = 2;\n\n/** What the live engine leaves out of a page so a visitor never meets a placeholder (G-D3). */\nexport interface PlaceholderHidePlan {\n /** Per list source alias: its rows without the placeholder rows. Only the aliases that lost a row are listed. */\n rows: Record<string, unknown[]>;\n /** Ids of the nodes not to draw: lists with no live row, and the top-level sections left with only their frame. */\n hidden: Set<string>;\n}\n\n/**\n * The ONE live rule (G-D3), shared by the SSR engine's renderers:\n *\n * 1. a list's placeholder rows are dropped (`rows`) — a mixed list shows only the owner's real items;\n * 2. a list whose source resolved to no live row is not drawn (`hidden`);\n * 3. the top-level root holding it hides too when everything else in it is frame (`LIST_FRAME_TYPES`, at most\n * `LIST_FRAME_MAX_TEXTS` Texts) and no other list in it still has a live row.\n *\n * A source the engine did not resolve (`!(alias in resolved)`) is not judged — nothing is hidden on a guess. A page\n * whose every section hid still renders with its header and footer, and its nav links stay (G-D4).\n */\nexport function planPlaceholderHides(\n roots: ReadonlyArray<PlaceholderPlanNode | null | undefined> | null | undefined,\n resolved: Readonly<Record<string, unknown>> | null | undefined,\n): PlaceholderHidePlan {\n const rows: Record<string, unknown[]> = {};\n const hidden = new Set<string>();\n const data = resolved ?? {};\n\n /** Live rows of a list, or `null` when its source is not resolved (never judged). */\n const liveRows = (list: PlaceholderPlanNode, source: string): unknown[] | null => {\n if (!(source in data)) return null;\n const all = resolveRepeaterItems(data[source]);\n const title = listTitleField(list);\n const live = all.filter(r => !isPlaceholderRow(r, title));\n if (live.length !== all.length && Array.isArray(data[source])) rows[source] = live;\n return live;\n };\n\n for (const root of roots ?? []) {\n if (!root) continue;\n const nodes = [root, ...descendants(root)];\n const lists = nodes.filter(n => !!listSourceOf(n));\n if (!lists.length) continue;\n\n const emptyLists = lists.filter(l => liveRows(l, listSourceOf(l)!)?.length === 0);\n for (const l of emptyLists) if (l.id) hidden.add(l.id);\n if (!emptyLists.length || emptyLists.length !== lists.length) continue;\n\n // Every list in this root is empty: the root hides unless something outside the lists is content of its own.\n const outsideLists = [root, ...descendants(root, n => !!listSourceOf(n))].filter(n => !listSourceOf(n));\n const onlyFrame = outsideLists.every(n => LIST_FRAME_TYPES.has(n.type ?? ''))\n && outsideLists.filter(n => n.type === 'Text').length <= LIST_FRAME_MAX_TEXTS;\n if (onlyFrame && root.id) hidden.add(root.id);\n }\n return { rows, hidden };\n}\n\n/** A page as the live engine draws it once the placeholder rule ran: the roots without the hidden nodes, and the data\n * with each list's placeholder rows dropped. */\nexport interface PlaceholderHidden<N> {\n roots: N[];\n resolved: Record<string, unknown>;\n}\n\n/**\n * `planPlaceholderHides` applied — what the SSR engine hands BOTH its renderers (the string renderer and the component\n * tree), so they never disagree: the hidden nodes pruned out of the tree (a copy only where something was pruned; the\n * input is never mutated) and the list sources replaced by their live rows.\n */\nexport function applyPlaceholderHides<N extends PlaceholderPlanNode>(\n roots: ReadonlyArray<N> | null | undefined,\n resolved: Readonly<Record<string, unknown>> | null | undefined,\n): PlaceholderHidden<N> {\n const plan = planPlaceholderHides(roots, resolved);\n const data = { ...(resolved ?? {}), ...plan.rows };\n if (!plan.hidden.size) return { roots: [...(roots ?? [])], resolved: data };\n const prune = (nodes: ReadonlyArray<N | null | undefined>): N[] => {\n const out: N[] = [];\n for (const n of nodes) {\n if (!n || (n.id && plan.hidden.has(n.id))) continue;\n const kids = n.children as ReadonlyArray<N | null | undefined> | null | undefined;\n const pruned = kids?.length ? prune(kids) : null;\n out.push(pruned && pruned.length !== kids!.length ? { ...n, children: pruned } : n);\n }\n return out;\n };\n return { roots: prune(roots ?? []), resolved: data };\n}\n","/**\n * @vectoriox/iox-ui/data-core — the shared, FRAMEWORK-FREE data-source core (data-source-resolving.md): the ONE\n * decision of how a data source becomes a fetch (`planDataSource`), the route-param matcher, the derived /\n * relative (`$siblings`, `$related`) resolvers, the repeater item reader, and which sources a node tree\n * references (`referencedDataSourcesDeep`), and which saved page is the studio's home (`homePageOf`, #116), and which rows are placeholder samples the live site leaves out (`planPlaceholderHides`, #178). The builder and the SSR engine resolve with it; iox-cms reads it\n * under plain Node (W2's Undo: is a data source still in use). Pure: no transport, no Angular. The main\n * entry re-exports it by package path, so `@vectoriox/iox-ui` keeps working.\n * ⚠️ Consumers wire the usual trio — ng-package raw-ts assets, jest moduleNameMapper, tsconfig paths —\n * or `nest start` dies with ERR_REQUIRE_ESM while jest and build both pass.\n */\nexport * from './data-source-resolver';\nexport * from './relative-sources';\nexport * from './home-page';\nexport * from './placeholder-rows';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;AAiBG;AAsBH;IACY;AAAZ,CAAA,UAAY,iBAAiB,EAAA;AACzB,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACjB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,GAAA,EAAA,CAAA,CAAA;AAW7B;AACuG;AAChG,MAAM,UAAU,GAAG;AAC1B,MAAM,UAAU,GAAG,qDAAqD;AAExE;AACM,SAAU,cAAc,CAAC,IAAuC,EAAA;IAClE,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;IACjC,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AAClD,IAAA,OAAO,IAAI,EAAE,GAAG,KAAK,iBAAiB,CAAC,IAAI,GAAG,IAAI,KAAK,CAAA,CAAE,GAAG,KAAK;AACrE;AAoCA;;;;AAIG;AACG,SAAU,gBAAgB,CAAC,QAA4B,EAAE,MAA0B,EAAA;AACrF,IAAA,MAAM,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;AACzD,IAAA,MAAM,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IACvD,MAAM,MAAM,GAA2B,EAAE;AACzC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAA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