@vectoriox/iox-ui 5.133.0 → 5.134.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/commerce-core/index.d.ts +12 -1
- package/composite-core/index.d.ts +27 -22
- package/design-core/index.d.ts +436 -35
- package/domain-core/index.d.ts +353 -0
- package/domain-core/package.json +3 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +68 -57
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
- package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +13974 -12036
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs +210 -2
- package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +290 -16
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1419 -379
- package/harness-core/index.d.ts +6 -1
- package/index.d.ts +139 -10
- package/mail-core/index.d.ts +190 -2
- package/package.json +5 -1
- package/src/actions-core/element-actions.ts +2 -0
- package/src/assist-core/page-sections.ts +7 -37
- package/src/commerce-core/shop-display.ts +21 -0
- package/src/composite-core/shop.ts +71 -57
- package/src/design-core/design-settings.ts +16 -0
- package/src/design-core/design-token.model.ts +7 -1
- package/src/design-core/flavor-spec.generated.ts +374 -35
- package/src/design-core/flavor-tokens.ts +12 -1
- package/src/design-core/header-behaviour.ts +32 -0
- package/src/design-core/motion-language.ts +115 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +3 -0
- package/src/domain-core/domain-vocabulary.ts +125 -0
- package/src/domain-core/domain-wire.ts +95 -0
- package/src/domain-core/org-path-redirect.ts +105 -0
- package/src/domain-core/public-api.ts +12 -0
- package/src/domain-core/web-domain.ts +251 -0
- package/src/generation-core/carry-fill.ts +36 -0
- package/src/generation-core/carry.ts +398 -0
- package/src/generation-core/check-carry.ts +216 -0
- package/src/generation-core/check-layout.ts +71 -5
- package/src/generation-core/compose-layout.ts +187 -28
- package/src/generation-core/compose-site.ts +154 -31
- package/src/generation-core/entrances.ts +66 -10
- package/src/generation-core/header-edit.ts +299 -0
- package/src/generation-core/header-mix.ts +64 -5
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +20 -1
- package/src/generation-core/layout-space.ts +4 -4
- package/src/generation-core/layout-wire.ts +36 -1
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/public-api.ts +7 -0
- package/src/generation-core/redesign-additions.ts +273 -0
- package/src/generation-core/redesign-run.ts +364 -0
- package/src/generation-core/refit-page.ts +151 -0
- package/src/generation-core/section-stamp.ts +4 -4
- package/src/generation-core/shop-plan.ts +15 -0
- package/src/generation-core/site-build-run.ts +20 -3
- package/src/generation-core/site-spec.generated.ts +194 -94
- package/src/generation-core/site-tree.ts +19 -5
- package/src/generation-core/validate-site-plan.ts +37 -3
- package/src/harness-core/motion.ts +13 -3
- package/src/harness-core/starting-design.ts +1 -1
- package/src/mail-core/mail-domain.ts +305 -0
- package/src/mail-core/mail-wire.ts +8 -0
- package/src/mail-core/public-api.ts +3 -1
- package/styles/iox-design.css +30 -1
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A studio's own web address — what a domain is, the three records, the ONE state rule, which host serves (CD0).
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
PLATFORM_WEB_DOMAINS, WEB_DOMAIN_CLAIM_MS, WEB_DOMAIN_LOST_KEEP_MS, WEB_DOMAIN_RECHECK_MS, WEB_DOMAIN_TOKEN_PREFIX, WEB_DOMAIN_TXT_HOST,
|
|
6
|
+
WebCertState, WebDnsRecordRole, WebDomainName, WebDomainProblem, WebDomainRefusal, WebDomainState,
|
|
7
|
+
} from './domain-vocabulary';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Public suffixes of more than one label, curated (not the whole Public Suffix List — a framework-free entry carries no
|
|
11
|
+
* 250 KB table). Israel's first, then the ones an Israeli studio's customers most often hold. A suffix missing here makes
|
|
12
|
+
* `registrableDomain('shop.example.com.xx')` one label short, which the screen shows before anything is asked of DNS.
|
|
13
|
+
*/
|
|
14
|
+
export const MULTI_PART_SUFFIXES: readonly string[] = [
|
|
15
|
+
'co.il', 'org.il', 'net.il', 'ac.il', 'gov.il', 'muni.il', 'k12.il', 'idf.il',
|
|
16
|
+
'co.uk', 'org.uk', 'me.uk', 'ltd.uk', 'plc.uk', 'net.uk', 'ac.uk', 'gov.uk',
|
|
17
|
+
'com.au', 'net.au', 'org.au', 'co.nz', 'org.nz', 'co.za', 'co.jp', 'or.jp', 'ne.jp',
|
|
18
|
+
'com.br', 'com.mx', 'com.ar', 'com.tr', 'com.cy', 'com.gr', 'co.in', 'co.kr', 'com.cn', 'com.hk', 'com.sg',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
/** A record the owner adds, with the check's last word on it. */
|
|
22
|
+
export interface WebDnsRecord {
|
|
23
|
+
role: WebDnsRecordRole;
|
|
24
|
+
type: 'CNAME' | 'A' | 'TXT';
|
|
25
|
+
/** the full name — `www.mywebsite.co.il` */
|
|
26
|
+
name: string;
|
|
27
|
+
/** the name as most DNS screens want it, relative to the domain (`www`, `@`, `_iox`) */
|
|
28
|
+
host: string;
|
|
29
|
+
value: string;
|
|
30
|
+
/** the last check: true ok · false wrong or missing · null not checked yet */
|
|
31
|
+
ok: boolean | null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** What the control plane keeps per domain (one row = one registrable domain with its `www`, CD-D4). */
|
|
35
|
+
export interface WebDomainRow {
|
|
36
|
+
/** the registrable domain, lower-case ASCII (punycode for a Hebrew name) — `mywebsite.co.il` */
|
|
37
|
+
domain: string;
|
|
38
|
+
/** the organization the domain shows (CD-D5); null = the studio's default organization */
|
|
39
|
+
orgId?: string | null;
|
|
40
|
+
/** which name serves; the other 301s to it (CD-D2) — `www` unless the owner picked the bare domain */
|
|
41
|
+
serveAs?: WebDomainName | null;
|
|
42
|
+
/** the organization's primary domain — its other domains 301 here (CD-D5) */
|
|
43
|
+
primary?: boolean;
|
|
44
|
+
records?: readonly WebDnsRecord[];
|
|
45
|
+
problems?: readonly WebDomainProblem[];
|
|
46
|
+
certState?: WebCertState | null;
|
|
47
|
+
/** ISO times */
|
|
48
|
+
checkedAt?: string | null;
|
|
49
|
+
/** the TXT token was found — the domain is proven ours (R-CD2) */
|
|
50
|
+
verifiedAt?: string | null;
|
|
51
|
+
/** the first time the domain went live — a domain that once was and no longer is, is Lost */
|
|
52
|
+
liveAt?: string | null;
|
|
53
|
+
/** when a recheck found it gone (starts the 30 days, CD-D10) */
|
|
54
|
+
lostAt?: string | null;
|
|
55
|
+
createdAt?: string | null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const LABEL = /^(?!-)[a-z0-9-]{1,63}(?<!-)$/;
|
|
59
|
+
const IPV4 = /^\d{1,3}(\.\d{1,3}){3}$/;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The host a person typed, as a lower-case ASCII host name — a scheme, a path, a port, a trailing dot and spaces are
|
|
63
|
+
* forgiven; a Hebrew name becomes its punycode (the WHATWG URL parser does it, in Node and every browser). Null when it
|
|
64
|
+
* is not a host name.
|
|
65
|
+
*/
|
|
66
|
+
export function normalizeHost(input: unknown): string | null {
|
|
67
|
+
if (typeof input !== 'string') return null;
|
|
68
|
+
let raw = input.trim();
|
|
69
|
+
if (!raw || /\s/.test(raw)) return null;
|
|
70
|
+
if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) raw = `http://${raw}`;
|
|
71
|
+
let host: string;
|
|
72
|
+
try {
|
|
73
|
+
host = new URL(raw).hostname;
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
host = host.replace(/\.$/, '').toLowerCase();
|
|
78
|
+
if (host.startsWith('[')) return host; // an IPv6 literal — refused by the caller as an IP
|
|
79
|
+
return host || null;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function isIp(host: string): boolean {
|
|
83
|
+
return host.startsWith('[') || host.includes(':') || IPV4.test(host);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** `a.b` is `b` or below it. */
|
|
87
|
+
function under(host: string, zone: string): boolean {
|
|
88
|
+
return host === zone || host.endsWith(`.${zone}`);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The public suffix of a host: a known multi-part one, else its last label. */
|
|
92
|
+
function publicSuffix(host: string): string {
|
|
93
|
+
return MULTI_PART_SUFFIXES.find((s) => under(host, s)) ?? host.slice(host.lastIndexOf('.') + 1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The registrable domain of a host — `www.shop.mywebsite.co.il` → `mywebsite.co.il`. Null for an IP, a single label or
|
|
98
|
+
* a bare public suffix.
|
|
99
|
+
*/
|
|
100
|
+
export function registrableDomain(input: unknown): string | null {
|
|
101
|
+
const host = normalizeHost(input);
|
|
102
|
+
if (!host || isIp(host) || !host.includes('.')) return null;
|
|
103
|
+
if (!host.split('.').every((l) => LABEL.test(l))) return null;
|
|
104
|
+
const suffix = publicSuffix(host);
|
|
105
|
+
if (host === suffix) return null;
|
|
106
|
+
const rest = host.slice(0, host.length - suffix.length - 1);
|
|
107
|
+
return `${rest.slice(rest.lastIndexOf('.') + 1)}.${suffix}`;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Why `input` cannot become a studio's own domain, or null when it can (the domain is then `webDomainOf(input)`). */
|
|
111
|
+
export function webDomainRefusal(input: unknown, platformDomains: readonly string[] = PLATFORM_WEB_DOMAINS): WebDomainRefusal | null {
|
|
112
|
+
const host = normalizeHost(input);
|
|
113
|
+
if (!host) return WebDomainRefusal.NotADomain;
|
|
114
|
+
if (isIp(host)) return WebDomainRefusal.IpAddress;
|
|
115
|
+
if (!host.includes('.') || !host.split('.').every((l) => LABEL.test(l)) || /^\d+$/.test(host.slice(host.lastIndexOf('.') + 1))) {
|
|
116
|
+
return WebDomainRefusal.NotADomain;
|
|
117
|
+
}
|
|
118
|
+
if (platformDomains.some((p) => under(host, p.toLowerCase()))) return WebDomainRefusal.PlatformDomain;
|
|
119
|
+
const domain = registrableDomain(host);
|
|
120
|
+
if (!domain) return WebDomainRefusal.PublicSuffix;
|
|
121
|
+
if (host !== domain && host !== `www.${domain}`) return WebDomainRefusal.Subdomain;
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The registrable domain an accepted input names (`https://www.MyWebsite.co.il/` → `mywebsite.co.il`), else null. */
|
|
126
|
+
export function webDomainOf(input: unknown, platformDomains: readonly string[] = PLATFORM_WEB_DOMAINS): string | null {
|
|
127
|
+
return webDomainRefusal(input, platformDomains) ? null : registrableDomain(input);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** The ownership record's value for a studio's token. */
|
|
131
|
+
export function webDomainTokenValue(token: string): string {
|
|
132
|
+
return `${WEB_DOMAIN_TOKEN_PREFIX}${token}`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The three records to copy (CD-D3), in the order the card lists them, not checked yet. `studioHost` is the studio's
|
|
137
|
+
* `<studio>.iox.studio`; `loadBalancerIp` the ingress's public address.
|
|
138
|
+
*/
|
|
139
|
+
export function webDomainRecords(domain: string, studioHost: string, loadBalancerIp: string, token: string): WebDnsRecord[] {
|
|
140
|
+
const d = domain.toLowerCase();
|
|
141
|
+
return [
|
|
142
|
+
{ role: WebDnsRecordRole.Www, type: 'CNAME', name: `www.${d}`, host: 'www', value: studioHost.toLowerCase(), ok: null },
|
|
143
|
+
{ role: WebDnsRecordRole.Apex, type: 'A', name: d, host: '@', value: loadBalancerIp, ok: null },
|
|
144
|
+
{ role: WebDnsRecordRole.Ownership, type: 'TXT', name: `${WEB_DOMAIN_TXT_HOST}.${d}`, host: WEB_DOMAIN_TXT_HOST, value: webDomainTokenValue(token), ok: null },
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function recordsRight(row: WebDomainRow): boolean {
|
|
149
|
+
const records = row.records ?? [];
|
|
150
|
+
return records.length > 0 && records.every((r) => r.ok === true) && !(row.problems ?? []).length;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function recordWrong(row: WebDomainRow): boolean {
|
|
154
|
+
return (row.records ?? []).some((r) => r.ok === false) || (row.problems ?? []).length > 0;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* THE state of a domain (R-CD1) — every screen, the bell, the engine's host table and the control plane read it.
|
|
159
|
+
* Live only when proven, pointing here, and cert-manager says Ready (R-CD2); once live, anything less is Lost.
|
|
160
|
+
*/
|
|
161
|
+
export function webDomainState(row: WebDomainRow | null | undefined): WebDomainState {
|
|
162
|
+
if (!row?.domain) return WebDomainState.NotSet;
|
|
163
|
+
const right = !!row.verifiedAt && recordsRight(row);
|
|
164
|
+
if (right && row.certState === WebCertState.Ready) return WebDomainState.Live;
|
|
165
|
+
if (row.liveAt) return WebDomainState.Lost;
|
|
166
|
+
if (row.certState === WebCertState.Failed) return WebDomainState.Failed;
|
|
167
|
+
if (right) return WebDomainState.Certificate;
|
|
168
|
+
if (row.checkedAt && recordWrong(row)) return WebDomainState.Failed;
|
|
169
|
+
return WebDomainState.Waiting;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** States whose names are on the studio's custom Ingress (the chart's `customHosts`): DNS was right once, so a certificate is (being) held. */
|
|
173
|
+
const ATTACHED: ReadonlySet<WebDomainState> = new Set([WebDomainState.Certificate, WebDomainState.Live, WebDomainState.Lost]);
|
|
174
|
+
|
|
175
|
+
/** Is the domain on the studio's custom Ingress — the control plane renders its names into `customHosts`, the engine serves them. */
|
|
176
|
+
export function webDomainAttached(row: WebDomainRow | null | undefined): boolean {
|
|
177
|
+
return ATTACHED.has(webDomainState(row));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The host that serves a domain: `www.<domain>` unless the owner picked the bare domain (CD-D2). */
|
|
181
|
+
export function primaryHost(row: Pick<WebDomainRow, 'domain' | 'serveAs'>): string {
|
|
182
|
+
const d = row.domain.toLowerCase();
|
|
183
|
+
return row.serveAs === WebDomainName.Apex ? d : `www.${d}`;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Both names a domain connects — the served one first. */
|
|
187
|
+
export function webDomainHosts(row: Pick<WebDomainRow, 'domain' | 'serveAs'>): [string, string] {
|
|
188
|
+
const d = row.domain.toLowerCase();
|
|
189
|
+
return row.serveAs === WebDomainName.Apex ? [d, `www.${d}`] : [`www.${d}`, d];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The live address an organization's site answers on, or null (no live domain → the iox.studio address is canonical).
|
|
194
|
+
* The row marked `primary` wins; with none marked, the first live one (one domain needs no choice, CD-D5).
|
|
195
|
+
*/
|
|
196
|
+
export function orgPrimaryHost(rows: readonly WebDomainRow[] | null | undefined, orgId: string | null): string | null {
|
|
197
|
+
const live = (rows ?? []).filter((r) => (r.orgId ?? null) === orgId && webDomainState(r) === WebDomainState.Live);
|
|
198
|
+
const chosen = live.find((r) => r.primary) ?? live[0];
|
|
199
|
+
return chosen ? primaryHost(chosen) : null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** One entry of the host table iox-cms answers the engine's `resolve?host=` from. */
|
|
203
|
+
export interface WebHostRoute {
|
|
204
|
+
host: string;
|
|
205
|
+
orgId: string | null;
|
|
206
|
+
/** the organization's live primary host — the canonical address; null while none is live (no redirect anywhere) */
|
|
207
|
+
primaryHost: string | null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* The host table: every name of every ATTACHED domain → its organization, with that organization's live primary. A Lost
|
|
212
|
+
* domain still serves its organization (so a returning record revives it) but is nobody's primary (R-CD6).
|
|
213
|
+
*/
|
|
214
|
+
export function webHostTable(rows: readonly WebDomainRow[] | null | undefined): WebHostRoute[] {
|
|
215
|
+
const out: WebHostRoute[] = [];
|
|
216
|
+
for (const row of rows ?? []) {
|
|
217
|
+
if (!webDomainAttached(row)) continue;
|
|
218
|
+
const orgId = row.orgId ?? null;
|
|
219
|
+
const primary = orgPrimaryHost(rows, orgId);
|
|
220
|
+
for (const host of webDomainHosts(row)) out.push({ host, orgId, primaryHost: primary });
|
|
221
|
+
}
|
|
222
|
+
return out;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The route for a request's Host, or null (the default host, or a name no domain holds). */
|
|
226
|
+
export function webHostRoute(table: readonly WebHostRoute[] | null | undefined, host: string | null | undefined): WebHostRoute | null {
|
|
227
|
+
const h = normalizeHost(host ?? '');
|
|
228
|
+
return h ? (table ?? []).find((r) => r.host === h) ?? null : null;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Is a live or lost domain due its daily recheck (CD-D10)? */
|
|
232
|
+
export function webDomainRecheckDue(row: WebDomainRow | null | undefined, now: number): boolean {
|
|
233
|
+
const state = webDomainState(row);
|
|
234
|
+
if (state !== WebDomainState.Live && state !== WebDomainState.Lost) return false;
|
|
235
|
+
const at = row?.checkedAt ? Date.parse(row.checkedAt) : NaN;
|
|
236
|
+
return !Number.isFinite(at) || now - at >= WEB_DOMAIN_RECHECK_MS;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Has a lost domain been gone 30 days — detach it (CD-D10)? */
|
|
240
|
+
export function webDomainDetachDue(row: WebDomainRow | null | undefined, now: number): boolean {
|
|
241
|
+
if (webDomainState(row) !== WebDomainState.Lost || !row?.lostAt) return false;
|
|
242
|
+
const at = Date.parse(row.lostAt);
|
|
243
|
+
return Number.isFinite(at) && now - at >= WEB_DOMAIN_LOST_KEEP_MS;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Has an entered-but-unproven claim expired, so it blocks nobody (CD-D11)? */
|
|
247
|
+
export function webDomainClaimExpired(row: WebDomainRow | null | undefined, now: number): boolean {
|
|
248
|
+
if (!row?.domain || row.verifiedAt) return false;
|
|
249
|
+
const at = row.createdAt ? Date.parse(row.createdAt) : NaN;
|
|
250
|
+
return Number.isFinite(at) && now - at >= WEB_DOMAIN_CLAIM_MS;
|
|
251
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SerializedNode } from './serialized-node';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* New look, the owner's content (site-redesign RD1, Doron 2026-11-21: "New look, owner's content"; RD-D20: "the idea is
|
|
5
|
+
* style change structure being updated but the data and data relations remains"). ONE rule for what passes from the
|
|
6
|
+
* page as it was into a node the composer has just made — used by a layer that carries a handle (`composeLayout`) and
|
|
7
|
+
* by Re-fit (`refitPage`), so the two never disagree about what is the owner's.
|
|
8
|
+
*
|
|
9
|
+
* the owner's every prop (words, link, src, alt, a form's id and fields, a repeater's source, a slider's slides…), the
|
|
10
|
+
* bindings (the data relation), and what the node DOES (its interactions on click, hover, …)
|
|
11
|
+
* the layout's its element style, style props, states and responsive layers, the heading level its role gives it,
|
|
12
|
+
* and how it moves (its entrance and scroll motion — the new look's pace)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Props the layout decides, never taken from the page: a heading's level follows the layout's role (Doron, 2026-11-21). */
|
|
16
|
+
export const LAYOUT_OWNED_PROPS: ReadonlySet<string> = new Set(['level']);
|
|
17
|
+
|
|
18
|
+
/** Triggers that are motion — the composer's, in the new look's pace. Every other trigger is what the element does. */
|
|
19
|
+
export const MOTION_TRIGGERS: ReadonlySet<string> = new Set(['viewportEnter', 'scrollProgress', 'pageEnter', 'pageLeave']);
|
|
20
|
+
|
|
21
|
+
const triggerOf = (ix: unknown): string => String((ix as { trigger?: unknown } | null)?.trigger ?? '');
|
|
22
|
+
const idOf = (ix: unknown): string => String((ix as { id?: unknown } | null)?.id ?? '');
|
|
23
|
+
|
|
24
|
+
/** The owner's content of `owner` into `fresh` (mutates `fresh`; `owner` is never touched — its values are cloned). */
|
|
25
|
+
export function ownerContentInto(fresh: SerializedNode, owner: SerializedNode): void {
|
|
26
|
+
for (const [name, value] of Object.entries(owner.props ?? {})) {
|
|
27
|
+
if (!LAYOUT_OWNED_PROPS.has(name)) fresh.props[name] = structuredClone(value);
|
|
28
|
+
}
|
|
29
|
+
fresh.bindings = structuredClone(owner.bindings ?? []);
|
|
30
|
+
const moves = (fresh.interactions ?? []).filter(ix => MOTION_TRIGGERS.has(triggerOf(ix)));
|
|
31
|
+
const has = new Set(moves.map(idOf));
|
|
32
|
+
const does = (owner.interactions ?? []).filter(ix => !MOTION_TRIGGERS.has(triggerOf(ix)) && !has.has(idOf(ix)));
|
|
33
|
+
fresh.interactions = [...moves, ...structuredClone(does)];
|
|
34
|
+
if (owner.itemKey !== undefined) fresh.itemKey = owner.itemKey;
|
|
35
|
+
if (owner.stateTriggers) fresh.stateTriggers = structuredClone(owner.stateTriggers);
|
|
36
|
+
}
|