@vectoriox/iox-ui 5.133.0 → 5.135.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.
Files changed (77) hide show
  1. package/commerce-core/index.d.ts +12 -1
  2. package/composite-core/index.d.ts +27 -22
  3. package/design-core/index.d.ts +436 -35
  4. package/domain-core/index.d.ts +353 -0
  5. package/domain-core/package.json +3 -0
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
  7. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
  9. package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
  11. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  12. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +68 -57
  13. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  14. package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
  15. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  16. package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
  17. package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
  18. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +14039 -12067
  19. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  20. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
  21. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  22. package/fesm2022/vectoriox-iox-ui-mail-core.mjs +210 -2
  23. package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
  24. package/fesm2022/vectoriox-iox-ui.mjs +290 -16
  25. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  26. package/generation-core/index.d.ts +1511 -432
  27. package/harness-core/index.d.ts +6 -1
  28. package/index.d.ts +139 -10
  29. package/mail-core/index.d.ts +190 -2
  30. package/package.json +5 -1
  31. package/src/actions-core/element-actions.ts +2 -0
  32. package/src/assist-core/page-sections.ts +7 -37
  33. package/src/commerce-core/shop-display.ts +21 -0
  34. package/src/composite-core/shop.ts +71 -57
  35. package/src/design-core/design-settings.ts +16 -0
  36. package/src/design-core/design-token.model.ts +7 -1
  37. package/src/design-core/flavor-spec.generated.ts +374 -35
  38. package/src/design-core/flavor-tokens.ts +12 -1
  39. package/src/design-core/header-behaviour.ts +32 -0
  40. package/src/design-core/motion-language.ts +115 -0
  41. package/src/design-core/public-api.ts +1 -0
  42. package/src/design-core/style-presets.ts +3 -0
  43. package/src/domain-core/domain-vocabulary.ts +125 -0
  44. package/src/domain-core/domain-wire.ts +95 -0
  45. package/src/domain-core/org-path-redirect.ts +105 -0
  46. package/src/domain-core/public-api.ts +12 -0
  47. package/src/domain-core/web-domain.ts +251 -0
  48. package/src/generation-core/carry-fill.ts +36 -0
  49. package/src/generation-core/carry.ts +398 -0
  50. package/src/generation-core/check-carry.ts +216 -0
  51. package/src/generation-core/check-layout.ts +71 -5
  52. package/src/generation-core/compose-layout.ts +187 -28
  53. package/src/generation-core/compose-site.ts +154 -31
  54. package/src/generation-core/entrances.ts +66 -10
  55. package/src/generation-core/header-edit.ts +299 -0
  56. package/src/generation-core/header-mix.ts +64 -5
  57. package/src/generation-core/layout-fingerprint.ts +5 -1
  58. package/src/generation-core/layout-language.ts +20 -1
  59. package/src/generation-core/layout-space.ts +4 -4
  60. package/src/generation-core/layout-wire.ts +36 -1
  61. package/src/generation-core/node-baselines.generated.ts +1 -0
  62. package/src/generation-core/public-api.ts +7 -0
  63. package/src/generation-core/redesign-additions.ts +273 -0
  64. package/src/generation-core/redesign-run.ts +364 -0
  65. package/src/generation-core/refit-page.ts +151 -0
  66. package/src/generation-core/section-stamp.ts +4 -4
  67. package/src/generation-core/shop-plan.ts +15 -0
  68. package/src/generation-core/site-build-run.ts +67 -3
  69. package/src/generation-core/site-spec.generated.ts +194 -94
  70. package/src/generation-core/site-tree.ts +19 -5
  71. package/src/generation-core/validate-site-plan.ts +37 -3
  72. package/src/harness-core/motion.ts +13 -3
  73. package/src/harness-core/starting-design.ts +1 -1
  74. package/src/mail-core/mail-domain.ts +305 -0
  75. package/src/mail-core/mail-wire.ts +8 -0
  76. package/src/mail-core/public-api.ts +3 -1
  77. package/styles/iox-design.css +30 -1
@@ -0,0 +1,151 @@
1
+ import { ownerContentInto } from './carry-fill';
2
+ import { sectionFingerprint, sectionUnchanged } from './section-stamp';
3
+ import { SerializedNode } from './serialized-node';
4
+
5
+ /**
6
+ * Re-fit on an EDITED composed page (site-redesign RD1, F5 — Doron 2026-11-21: "Allow, keep edits"). No AI: the page is
7
+ * recomposed from its stored layout for the new look (`fresh`), and the owner's edits are carried across by NODE ID —
8
+ * the composer's ids are deterministic (`<page>-s<i>-l<j>…`), so the page as the build MADE it, the page as it IS and the
9
+ * page as it is RE-FITTED name the same element the same way.
10
+ *
11
+ * an element on both the new look, the owner's content (`ownerContentInto`): words, links, photos, bindings, what
12
+ * it does; a form is the owner's whole (F8: the same `formId`, fields, After-send)
13
+ * one the owner deleted stays deleted (made, no longer on the page)
14
+ * one the owner added stays — after the element it followed, under the same parent; a section the owner added
15
+ * after the section it followed
16
+ * a section left as built keeps reading as the build's (its stamp re-taken); an edited one keeps reading edited
17
+ *
18
+ * Pure: `fresh` is cloned, `made` and `current` are never touched. ONE undo step is the caller's.
19
+ */
20
+
21
+ const FORM = 'Form';
22
+
23
+ export interface RefitResult {
24
+ layout: SerializedNode[];
25
+ /** Ids the owner had deleted that the new look would have brought back — left out. */
26
+ deleted: string[];
27
+ /** Top-most ids the owner had added, carried into the re-fitted page. */
28
+ added: string[];
29
+ }
30
+
31
+ interface Place {
32
+ node: SerializedNode;
33
+ parent: string | null;
34
+ /** The ids before it under the same parent, nearest first. */
35
+ before: string[];
36
+ }
37
+
38
+ function index(layout: ReadonlyArray<SerializedNode>): Map<string, Place> {
39
+ const out = new Map<string, Place>();
40
+ const visit = (nodes: ReadonlyArray<SerializedNode>, parent: string | null) => {
41
+ nodes.forEach((node, i) => {
42
+ out.set(node.id, { node, parent, before: nodes.slice(0, i).map(n => n.id).reverse() });
43
+ visit(node.children ?? [], node.id);
44
+ });
45
+ };
46
+ visit(layout.filter(n => !n.isGlobal), null);
47
+ return out;
48
+ }
49
+
50
+ const idsOf = (layout: ReadonlyArray<SerializedNode>): Set<string> => new Set(index(layout).keys());
51
+
52
+ /** Insert `node` into `list` after the nearest of `before` that is in it, else first. */
53
+ function insertAfter(list: SerializedNode[], node: SerializedNode, before: ReadonlyArray<string>): void {
54
+ for (const id of before) {
55
+ const at = list.findIndex(n => n.id === id);
56
+ if (at >= 0) return void list.splice(at + 1, 0, node);
57
+ }
58
+ list.unshift(node);
59
+ }
60
+
61
+ export function refitPage(made: ReadonlyArray<SerializedNode>, current: ReadonlyArray<SerializedNode>, fresh: ReadonlyArray<SerializedNode>): RefitResult {
62
+ const wasMade = idsOf(made);
63
+ const now = index(current);
64
+ const layout: SerializedNode[] = structuredClone(fresh as SerializedNode[]);
65
+ const deleted: string[] = [];
66
+
67
+ // The owner's content into every element on both; a form is the owner's whole; what the owner deleted goes.
68
+ const visit = (list: SerializedNode[]): void => {
69
+ for (let i = list.length - 1; i >= 0; i--) {
70
+ const node = list[i];
71
+ const own = now.get(node.id);
72
+ if (!own && wasMade.has(node.id)) {
73
+ deleted.push(node.id);
74
+ list.splice(i, 1);
75
+ continue;
76
+ }
77
+ if (own?.node.type === FORM && node.type === FORM) {
78
+ list[i] = structuredClone(own.node);
79
+ continue;
80
+ }
81
+ if (own) ownerContentInto(node, own.node);
82
+ if (node.children?.length) visit(node.children);
83
+ }
84
+ };
85
+ visit(layout);
86
+
87
+ // What the owner added: the top-most added nodes, each after the element it followed under the same parent.
88
+ const placed = index(layout);
89
+ const added: string[] = [];
90
+ for (const [id, place] of now) {
91
+ if (wasMade.has(id) || placed.has(id)) continue;
92
+ if (place.parent && !wasMade.has(place.parent) && now.has(place.parent)) continue; // inside an added node: it travels with it
93
+ const node = structuredClone(place.node);
94
+ if (place.parent === null) insertAfter(layout, node, place.before);
95
+ else {
96
+ const parent = placed.get(place.parent)?.node;
97
+ if (!parent) continue;
98
+ parent.children = parent.children ?? [];
99
+ insertAfter(parent.children, node, place.before);
100
+ }
101
+ added.push(id);
102
+ }
103
+
104
+ // A section the owner left as the build made it is still the build's; one they edited keeps reading edited.
105
+ for (const root of layout) {
106
+ const was = now.get(root.id)?.node;
107
+ if (root.composed && (!was || sectionUnchanged(was) !== false)) root.composed = { ...root.composed, fingerprint: sectionFingerprint(root) };
108
+ }
109
+ return { layout, deleted: deleted.reverse(), added };
110
+ }
111
+
112
+ /** The composer's own ids on a page (`<pageKey>-s<i>…`): never the owner's (the builder's ids are generated). */
113
+ const composerIdOf = (pageKey: string) => new RegExp(`^${pageKey.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}-s\\d+(?:-|$)`);
114
+
115
+ /**
116
+ * Nodes of the current page the composer made for ANOTHER look (the page was re-fitted and saved since the run, so the
117
+ * run's plan composes a page with other parts — a band, a ground): made, not the owner's, so never carried as added.
118
+ * Each one alone (its children are judged on their own).
119
+ */
120
+ export function composerLeftovers(pageKey: string, made: ReadonlyArray<SerializedNode>, current: ReadonlyArray<SerializedNode>): SerializedNode[] {
121
+ const known = new Set<string>();
122
+ const walk = (nodes: ReadonlyArray<SerializedNode>, visit: (n: SerializedNode) => void) => nodes.forEach(n => { visit(n); walk(n.children ?? [], visit); });
123
+ walk(made, n => known.add(n.id));
124
+ const ours = composerIdOf(pageKey);
125
+ const out: SerializedNode[] = [];
126
+ walk(current, n => { if (!known.has(n.id) && ours.test(n.id)) out.push({ ...n, children: [] }); });
127
+ return out;
128
+ }
129
+
130
+ /**
131
+ * A BUILT page re-fitted (Design ▸ Look's Re-fit, and a redesign's page that is not asked of a model — site-redesign RD2):
132
+ * `made` = the page as its run's plan composes it in the look it was built for, `fresh` = the same plan in the new look,
133
+ * `current` = the page as it is. ONE rule for the builder and the server.
134
+ */
135
+ export function refitBuiltPage(pageKey: string, made: ReadonlyArray<SerializedNode>, current: ReadonlyArray<SerializedNode>, fresh: ReadonlyArray<SerializedNode>): RefitResult {
136
+ return refitPage([...made, ...composerLeftovers(pageKey, made, current)], current, fresh);
137
+ }
138
+
139
+ /** Node ids that occur more than once in a layout (a carried subtree keeps its own ids — a composed one must not repeat
140
+ * them). Empty when every id is unique. */
141
+ export function duplicateNodeIds(layout: ReadonlyArray<SerializedNode>): string[] {
142
+ const seen = new Set<string>();
143
+ const twice = new Set<string>();
144
+ const walk = (nodes: ReadonlyArray<SerializedNode>) => nodes.forEach(n => {
145
+ if (seen.has(n.id)) twice.add(n.id);
146
+ seen.add(n.id);
147
+ walk(n.children ?? []);
148
+ });
149
+ walk(layout);
150
+ return [...twice];
151
+ }
@@ -33,13 +33,13 @@ const isEmpty = (value: unknown): boolean =>
33
33
  * stamp field gone at every depth — so a saved node and a composed one compare equal however their empties were written
34
34
  * (iox-cms's `canonical` rule, the server's fingerprints).
35
35
  */
36
- function canonical(value: unknown): unknown {
37
- if (Array.isArray(value)) return value.map(canonical).filter(v => !isEmpty(v));
36
+ export function canonicalValue(value: unknown): unknown {
37
+ if (Array.isArray(value)) return value.map(canonicalValue).filter(v => !isEmpty(v));
38
38
  if (value && typeof value === 'object') {
39
39
  const out: Record<string, unknown> = {};
40
40
  for (const key of Object.keys(value as object).sort()) {
41
41
  if (key === STAMP_FIELD) continue;
42
- const v = canonical((value as Record<string, unknown>)[key]);
42
+ const v = canonicalValue((value as Record<string, unknown>)[key]);
43
43
  if (!isEmpty(v)) out[key] = v;
44
44
  }
45
45
  return out;
@@ -49,7 +49,7 @@ function canonical(value: unknown): unknown {
49
49
 
50
50
  /** A node's canonical JSON, its stamp aside. */
51
51
  export function canonicalNodeJson(node: SerializedNode): string {
52
- return JSON.stringify(canonical(node)) ?? '';
52
+ return JSON.stringify(canonicalValue(node)) ?? '';
53
53
  }
54
54
 
55
55
  /**
@@ -163,3 +163,18 @@ export function variantNamesOf(options: ReadonlyArray<{ readonly values: Readonl
163
163
  if (!lists.length) return [];
164
164
  return lists.reduce<string[][]>((combos, values) => combos.flatMap(c => values.map(v => [...c, v])), [[]]).map(c => c.join(VARIANT_NAME_SEPARATOR));
165
165
  }
166
+
167
+ /** The shop's lists a plan page shows — the list and the newest that its sections bind, in that order (a shop page's
168
+ * products): where a composed page must list them, each linking to the product page (vectoriox/iox-ui#99). */
169
+ export function shopListsShownOn(page: { sections?: ReadonlyArray<{ binding?: string }> } | null | undefined, plan: unknown): string[] {
170
+ const aliases = shopSourceAliases(plan);
171
+ const lists = [aliases[ShopSourceRole.List], aliases[ShopSourceRole.Latest]].filter(isNonEmptyString);
172
+ const bound = new Set((page?.sections ?? []).map(s => s?.binding).filter(isNonEmptyString));
173
+ return lists.filter(alias => bound.has(alias));
174
+ }
175
+
176
+ /** The shop's lists of a plan (the list, the newest) — what a visitor reaches a product from. */
177
+ export function shopListAliases(plan: unknown): string[] {
178
+ const aliases = shopSourceAliases(plan);
179
+ return [aliases[ShopSourceRole.List], aliases[ShopSourceRole.Latest]].filter(isNonEmptyString);
180
+ }
@@ -12,6 +12,8 @@ import { planSells } from './shop-plan';
12
12
 
13
13
  export enum SiteBuildKind {
14
14
  Build = 'build',
15
+ /** A new design for a built site, everything it holds kept (site-redesign RD2) — `redesign-run.ts`. */
16
+ Redesign = 'redesign',
15
17
  }
16
18
 
17
19
  export enum SiteBuildStatus {
@@ -20,10 +22,20 @@ export enum SiteBuildStatus {
20
22
  Failed = 'failed',
21
23
  Undoing = 'undoing',
22
24
  Undone = 'undone',
25
+ /** A redesign (RD2): its new design going onto the pages, header, footer and look — page by page. */
26
+ Switching = 'switching',
27
+ /** A redesign switched: the site wears it; Back is open for `REDESIGN_BACK_DAYS`. */
28
+ Switched = 'switched',
29
+ /** A redesign going Back: its snapshot restored, page by page. */
30
+ Restoring = 'restoring',
31
+ /** A redesign gone Back: the site wears what it wore before the switch. */
32
+ Restored = 'restored',
33
+ /** A staged (or failed, never switched) redesign let go — by the owner, or by a newer redesign: no page was written. */
34
+ Discarded = 'discarded',
23
35
  }
24
36
 
25
37
  /** The statuses a runner advances — and the ones that hold the org's single-run slot. */
26
- export const ACTIVE_BUILD_STATUSES: ReadonlyArray<SiteBuildStatus> = [SiteBuildStatus.Running, SiteBuildStatus.Undoing];
38
+ export const ACTIVE_BUILD_STATUSES: ReadonlyArray<SiteBuildStatus> = [SiteBuildStatus.Running, SiteBuildStatus.Undoing, SiteBuildStatus.Switching, SiteBuildStatus.Restoring];
27
39
 
28
40
  /** The steps of a build, in the order they run. */
29
41
  export enum BuildStep {
@@ -71,6 +83,9 @@ export enum CreatedKind {
71
83
  ShopProduct = 'shop-product',
72
84
  DataSource = 'data-source',
73
85
  Page = 'page',
86
+ /** RD3-D3 (a) Replace: a page an earlier Undo kept, moved aside (`/<route>-previous`, a draft) so the plan's page takes
87
+ * its address — Undo puts it back while it is as the move left it and its address is free (`CreatedRecord.from`). */
88
+ PageMoved = 'page-moved',
74
89
  Global = 'global',
75
90
  Look = 'look',
76
91
  }
@@ -89,8 +104,9 @@ export interface BuildStepError {
89
104
  detail: string;
90
105
  }
91
106
 
92
- export interface BuildStepRecord {
93
- key: BuildStep;
107
+ /** A run's step as it is recorded — a build's (`BuildStep`) or, with `K`, another run's (a redesign's `RedesignStep`). */
108
+ export interface BuildStepRecord<K extends string = BuildStep> {
109
+ key: K;
94
110
  state: StepState;
95
111
  attempts: number;
96
112
  startedAt?: Date | string;
@@ -111,6 +127,8 @@ export interface CreatedRecord {
111
127
  url?: string;
112
128
  /** `content-type-fields`: the fields the build added. */
113
129
  fields?: string[];
130
+ /** `page-moved`: where the page was and its status before the move — what Undo puts back. */
131
+ from?: { route: string; status: string };
114
132
  }
115
133
 
116
134
  export interface UndoKept {
@@ -153,6 +171,34 @@ export enum BuildNoticeCode {
153
171
  /** Commerce G2: the facts the owner gave (email, phone, address) became the shop's contact details where it had none
154
172
  * — said, so the owner adds what only they know (the legal name, the business number) in Shop ▸ Settings. */
155
173
  ShopBusinessFromFacts = 'shop-business-from-facts',
174
+ /** RD3-D3 (a) Keep mine: a page an earlier Undo kept stays at an address the plan builds — the plan's page there is
175
+ * not built. */
176
+ KeptPageSkipped = 'kept-page-skipped',
177
+ /** RD3-D3 (a) Replace: that page moved aside as a draft (`/<route>-previous`) — Undo puts it back. */
178
+ KeptPageMoved = 'kept-page-moved',
179
+ }
180
+
181
+ /** RD3-D3 (a): what a build does with a page an earlier Undo kept at an address its plan builds — the header and footer's
182
+ * pair (`replaceGlobals`), for pages. */
183
+ export enum KeptPagesChoice {
184
+ /** Build every other page; leave these as they are. */
185
+ Keep = 'keep',
186
+ /** Move each aside as a draft at `/<route>-previous` and build the plan's page at its address. Nothing is deleted. */
187
+ Replace = 'replace',
188
+ }
189
+
190
+ /** The suffix a replaced page's address takes. */
191
+ export const PREVIOUS_ROUTE_SUFFIX = '-previous';
192
+
193
+ /** Where a page moved aside goes: `/<route>-previous`, then `-previous-2`… — never an address in `taken` (shapes
194
+ * compared case-insensitively, trailing slash ignored). The home page (`/`) goes to `/home-previous`. */
195
+ export function previousRoute(route: string, taken: ReadonlyArray<string>): string {
196
+ const key = (r: string) => (r.replace(/\/+$/, '') || '/').toLowerCase();
197
+ const held = new Set(taken.map(key));
198
+ const base = `${route.replace(/\/+$/, '') || '/home'}${PREVIOUS_ROUTE_SUFFIX}`.replace(/^\/\//, '/');
199
+ let candidate = base;
200
+ for (let n = 2; held.has(key(candidate)); n++) candidate = `${base}-${n}`;
201
+ return candidate;
156
202
  }
157
203
 
158
204
  export interface BuildNotice {
@@ -171,6 +217,10 @@ export interface SiteBuildRun {
171
217
  /** AW-D23: the tier its generation was made at; absent = Basic (`tierOf`). Every later compose of `plan` in the browser
172
218
  * (Design ▸ Look's Re-fit) is given it — an award plan composed as Basic is refused (iox-cms-client#66). */
173
219
  tier?: `${GenerationTier}`;
220
+ /** RD3-D4 (a): the AI generation whose build this is — written by that generation's build, never by the HTTP body.
221
+ * Absent: a build from a template or a plan sent by hand. The undone screen offers exactly this generation's plan
222
+ * again ("Build it again", iox-cms-client#74), and nothing when it is gone. */
223
+ generationId?: string;
174
224
  status: SiteBuildStatus;
175
225
  active?: boolean;
176
226
  steps: BuildStepRecord[];
@@ -210,6 +260,9 @@ export enum PreflightRefusalCode {
210
260
  GlobalsNeedDecision = 'globals-need-decision',
211
261
  /** A global the plan adds has the id of one the studio keeps. */
212
262
  GlobalTaken = 'global-taken',
263
+ /** RD3-D3 (a): a page an earlier Undo kept (published or edited) sits at an address the plan builds — Keep mine or
264
+ * Replace them is the caller's choice (`KeptPagesChoice`). A page made by hand there stays a plain `route-taken`. */
265
+ KeptPageNeedsDecision = 'kept-page-needs-decision',
213
266
  }
214
267
 
215
268
  export interface PreflightRefusal {
@@ -219,6 +272,16 @@ export interface PreflightRefusal {
219
272
  detail: string;
220
273
  /** For `invalid-plan`: the validator's issue code. */
221
274
  issue?: SitePlanIssueCode;
275
+ /** For `kept-page-needs-decision` (RD3-D3): the kept page as the owner knows it — said in their language. */
276
+ kept?: KeptPageRefusal;
277
+ }
278
+
279
+ /** RD3-D3: a page an earlier build's Undo kept, standing at an address the plan needs. */
280
+ export interface KeptPageRefusal {
281
+ pageId: string;
282
+ name: string;
283
+ route: string;
284
+ reason: KeptReason;
222
285
  }
223
286
 
224
287
  /**
@@ -238,6 +301,7 @@ export const buildKeys = {
238
301
  page: (key: string) => `page:${key}`,
239
302
  global: (nodeId: string) => `global:${nodeId}`,
240
303
  look: () => 'look',
304
+ pageMoved: (pageId: string) => `page-moved:${pageId}`,
241
305
  } as const;
242
306
 
243
307
  /** The id of the page a run made for the plan's home page, or null (not made yet, or no home page). */