@vectoriox/iox-ui 5.193.0 → 5.195.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/actions-core/index.d.ts +1 -0
- package/commerce-core/index.d.ts +0 -1
- package/composite-core/index.d.ts +28 -11
- package/design-core/index.d.ts +44 -2
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +1 -0
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +0 -2
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +65 -34
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +142 -60
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs +186 -122
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +244 -16
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +193 -95
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +209 -148
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/forms-core/index.d.ts +17 -2
- package/generation-core/index.d.ts +141 -4
- package/harness-core/index.d.ts +102 -12
- package/index.d.ts +15 -12
- package/package.json +1 -1
- package/src/actions-core/public-api.ts +3 -0
- package/src/commerce-core/shop-display.ts +0 -2
- package/src/composite-core/lightbox.ts +27 -8
- package/src/composite-core/shop.ts +45 -28
- package/src/design-core/close-word.ts +18 -0
- package/src/design-core/contrast-audit.ts +24 -14
- package/src/design-core/locale-direction.ts +17 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/token-css.ts +62 -3
- package/src/forms-core/messages.ts +72 -1
- package/src/forms-core/submit-lifecycle.ts +4 -5
- package/src/generation-core/audit-site.ts +26 -5
- package/src/generation-core/audit-words.ts +8 -0
- package/src/generation-core/compose-site.ts +3 -2
- package/src/generation-core/import-plan.ts +41 -0
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/stock-photos.ts +23 -4
- package/src/generation-core/stock-search.ts +235 -0
- package/src/harness-core/business-types.ts +14 -9
- package/src/harness-core/harness-spec.generated.ts +168 -84
- package/src/harness-core/lint.ts +29 -11
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DesignMode } from './design-token.model';
|
|
2
|
+
import { CASELESS_LANGUAGES } from './locale-direction';
|
|
2
3
|
import { SPEC_A11Y, SPEC_AXES, SPEC_SCHEMES } from './flavor-spec.generated';
|
|
3
4
|
import { columnSelector, CONTENT_CAP_TOKEN, CONTENT_WIDTH_TOKEN, contentCapOf, contentWidthOf, openingFollowerSelector, SCHEME_INK } from './node-classes';
|
|
4
5
|
import { specTokenNames } from './token-names';
|
|
@@ -14,6 +15,7 @@ import { specTokenNames } from './token-names';
|
|
|
14
15
|
* 2. schemes `.iox-scheme-<id> { overrides; every var()-referencing token re-declared }`, then the
|
|
15
16
|
* ONE scheme-ink rule `.iox-scheme-subtle, … { color: var(--iox-text) }` (iox-ui#15)
|
|
16
17
|
* columns `[data-iox-column="<word>"] { --iox-content-width: <literal>; --iox-content-cap: <length>; every token reading it }` (award §0c)
|
|
18
|
+
* caseless script `<root>:is([lang|="he" i], …), <root> :is(…) { case + tracking tokens stand down }` (iox-ui#124)
|
|
17
19
|
* 3. reduced motion `@media (prefers-reduced-motion: reduce)`
|
|
18
20
|
* 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`
|
|
19
21
|
* 5. dark — LAST `@media (prefers-color-scheme: dark)`
|
|
@@ -66,6 +68,30 @@ export const REDUCED_MOTION_OVERRIDES: Readonly<Record<string, string>> = SPEC_A
|
|
|
66
68
|
/** What `prefers-reduced-transparency: reduce` makes solid — the contract's `a11y.reducedTransparency`. */
|
|
67
69
|
export const REDUCED_TRANSPARENCY_OVERRIDES: Readonly<Record<string, string>> = SPEC_A11Y.reducedTransparency;
|
|
68
70
|
|
|
71
|
+
/**
|
|
72
|
+
* What a page in a CASELESS script (Hebrew, Arabic, Japanese… — locale-direction `CASELESS_LANGUAGES`) does with the
|
|
73
|
+
* look's case and tracking tokens (vectoriox/iox-ui#124): a pairing that sets buttons and labels `uppercase` with
|
|
74
|
+
* 0.04–0.12em tracking shouted only the Latin word inside a Hebrew label ("המשך עם GOOGLE") and opened up the Hebrew
|
|
75
|
+
* letters, which Hebrew typography never does. So under a caseless `lang` the case tokens compile to `none` and the
|
|
76
|
+
* tracking to `0em` (the contract's own `button-tracking` default). A CSS rule, not a compile option: the language is
|
|
77
|
+
* read where it is written — the engine's `<html lang>`, the canvas's token scope `lang` (the SITE's, never the
|
|
78
|
+
* admin's), a `lang` island inside a page — so ONE stylesheet serves a site whose pages differ in language.
|
|
79
|
+
* An author's own `text-transform` on a node (styleProps) is untouched: only the look's tokens stand down.
|
|
80
|
+
*/
|
|
81
|
+
export const CASELESS_SCRIPT_OVERRIDES: Readonly<Record<string, string>> = Object.freeze({
|
|
82
|
+
'button-case': 'none',
|
|
83
|
+
'case-label': 'none',
|
|
84
|
+
'button-tracking': '0em',
|
|
85
|
+
'tracking-label': '0em',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/** `:is([lang|="he" i], …)` — an element whose own `lang` names a caseless language (any region: `he`, `he-IL`). */
|
|
89
|
+
const CASELESS_LANG_SELECTOR = `:is(${[...CASELESS_LANGUAGES].map(l => `[lang|="${l}" i]`).join(', ')})`;
|
|
90
|
+
|
|
91
|
+
/** The scope itself carrying a caseless `lang`, and any element inside it that does. Specificity (0,2,0) on `:root`, so
|
|
92
|
+
* it outranks the base `:root` block and the dark block's `:root` (0,1,0) wherever either is emitted. */
|
|
93
|
+
const caselessSelector = (root: string): string => `${root}${CASELESS_LANG_SELECTOR}, ${root} ${CASELESS_LANG_SELECTOR}`;
|
|
94
|
+
|
|
69
95
|
const ROOT = ':root';
|
|
70
96
|
const DEFAULT_SCHEME = 'default';
|
|
71
97
|
const REFERENCE = 'var(';
|
|
@@ -179,12 +205,44 @@ export function resolveSchemeTokenValues(
|
|
|
179
205
|
mode: ResolvedMode,
|
|
180
206
|
schemeId: string | ReadonlyArray<string>,
|
|
181
207
|
): Record<string, string> {
|
|
208
|
+
return schemeValuesOf(usableTokens(tokens), mode, schemeId, {});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* `resolveSchemeTokenValues` for MANY schemes (and chains) of ONE look in one mode: the look's root and
|
|
213
|
+
* other-mode values are resolved once, and each scheme or chain once. The contrast audit asks ~90 of them per
|
|
214
|
+
* look and the sweep thousands of looks (iox-ui#166). The answers are shared between calls: read them, never
|
|
215
|
+
* write to them.
|
|
216
|
+
*/
|
|
217
|
+
export function schemeTokenResolver(
|
|
218
|
+
tokens: ReadonlyArray<DesignTokenLike> | null | undefined,
|
|
219
|
+
mode: ResolvedMode,
|
|
220
|
+
): (schemeId: string | ReadonlyArray<string>) => Readonly<Record<string, string>> {
|
|
182
221
|
const rows = usableTokens(tokens);
|
|
222
|
+
const ground: SchemeGround = {};
|
|
223
|
+
const known = new Map<string, Record<string, string>>();
|
|
224
|
+
return schemeId => {
|
|
225
|
+
const key = typeof schemeId === 'string' ? schemeId : schemeId.join('\u0001');
|
|
226
|
+
let values = known.get(key);
|
|
227
|
+
if (!values) known.set(key, values = schemeValuesOf(rows, mode, schemeId, ground));
|
|
228
|
+
return values;
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** The look's root and other-mode values, resolved on first need and kept for the next scheme. */
|
|
233
|
+
interface SchemeGround { root?: Record<string, string>; other?: Record<string, string>; }
|
|
234
|
+
|
|
235
|
+
function schemeValuesOf(
|
|
236
|
+
rows: ReadonlyArray<DesignTokenLike>,
|
|
237
|
+
mode: ResolvedMode,
|
|
238
|
+
schemeId: string | ReadonlyArray<string>,
|
|
239
|
+
ground: SchemeGround,
|
|
240
|
+
): Record<string, string> {
|
|
183
241
|
const sets = (typeof schemeId === 'string' ? [schemeId] : schemeId)
|
|
184
242
|
.map(id => (id === DEFAULT_SCHEME ? undefined : (SPEC_SCHEMES as Readonly<Record<string, { set: Readonly<Record<string, string>> }>>)[id]?.set));
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const other = resolveTokenValues(rows, mode === DARK ? LIGHT : DARK);
|
|
243
|
+
const root = (ground.root ??= resolveTokenValues(rows, mode));
|
|
244
|
+
if (!sets.some(Boolean)) return root;
|
|
245
|
+
const other = (ground.other ??= resolveTokenValues(rows, mode === DARK ? LIGHT : DARK));
|
|
188
246
|
// Nested (`[outer, inner]` — a Featured card in an Inverse section): each scheme block re-declares the
|
|
189
247
|
// rows that reference a token, so at every level those are restored before the block's own set.
|
|
190
248
|
const overrides = new Map<string, string>();
|
|
@@ -382,6 +440,7 @@ export function compileTokenCssBlocks(
|
|
|
382
440
|
rule(root, [...unset, ...rows.map((t): [string, string] => [t.name, t.value])]),
|
|
383
441
|
compileSchemeCss(rows, opts.scope, opposite),
|
|
384
442
|
columns.base,
|
|
443
|
+
rule(caselessSelector(root), presentOverrides(rows, CASELESS_SCRIPT_OVERRIDES, false)),
|
|
385
444
|
...ACCESSIBILITY_MEDIA.map(({ query, overrides }) =>
|
|
386
445
|
media(query, [rule(root, presentOverrides(rows, overrides, false), ' ')])),
|
|
387
446
|
].filter(Boolean).join('\n');
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// the page's locale bundle). The backend returns the key too, so a server-side rejection renders in
|
|
9
9
|
// the visitor's language rather than in the server's.
|
|
10
10
|
|
|
11
|
+
import { formLanguageOf } from './form-words';
|
|
11
12
|
import { RuleName } from './form.model';
|
|
12
13
|
|
|
13
14
|
/** Namespace for every forms validation key. Keep in sync with `en.json` / `he.json`. */
|
|
@@ -79,7 +80,8 @@ export const FORM_ERROR_KEYS = Object.freeze({
|
|
|
79
80
|
Server: `${MESSAGE_NAMESPACE}.form.server`,
|
|
80
81
|
});
|
|
81
82
|
|
|
82
|
-
/** The English
|
|
83
|
+
/** The English column of the ONE forms message catalog (`formMessage`) — what a site in any language the catalog does not
|
|
84
|
+
* hold reads, and what a consumer that has not added the keys yet still shows. */
|
|
83
85
|
export const DEFAULT_EN_MESSAGES: Readonly<Record<string, string>> = Object.freeze({
|
|
84
86
|
[RULE_MESSAGE_KEYS[RuleName.Required]]: 'This field is required',
|
|
85
87
|
[RULE_MESSAGE_KEYS[RuleName.MinLength]]: 'Use at least {{n}} characters',
|
|
@@ -111,3 +113,72 @@ export const DEFAULT_EN_MESSAGES: Readonly<Record<string, string>> = Object.free
|
|
|
111
113
|
[DATE_MESSAGE_KEYS.Max]: 'Choose an earlier date',
|
|
112
114
|
[SUBMIT_MESSAGE_KEYS.Sent]: 'Sent',
|
|
113
115
|
});
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The Hebrew column (iox-client-engine#15). A visitor is spoken to in the plural imperative, like every other word a site
|
|
119
|
+
* says (`form-words.ts`: בחרו, כתבו לנו). Every key of the English column has its entry here — a spec holds that.
|
|
120
|
+
*/
|
|
121
|
+
const HE_MESSAGES: Readonly<Record<string, string>> = /* @__PURE__ */ Object.freeze({
|
|
122
|
+
[RULE_MESSAGE_KEYS[RuleName.Required]]: 'שדה חובה',
|
|
123
|
+
[RULE_MESSAGE_KEYS[RuleName.MinLength]]: 'כתבו לפחות {{n}} תווים',
|
|
124
|
+
[RULE_MESSAGE_KEYS[RuleName.MaxLength]]: 'כתבו עד {{n}} תווים',
|
|
125
|
+
[RULE_MESSAGE_KEYS[RuleName.Min]]: 'הזינו {{n}} או יותר',
|
|
126
|
+
[RULE_MESSAGE_KEYS[RuleName.Max]]: 'הזינו {{n}} או פחות',
|
|
127
|
+
[RULE_MESSAGE_KEYS[RuleName.Pattern]]: 'בדקו את צורת הערך',
|
|
128
|
+
[RULE_MESSAGE_KEYS[RuleName.Matches]]: 'הערך צריך להתאים לשדה {{field}}',
|
|
129
|
+
[RULE_MESSAGE_KEYS[RuleName.Accepted]]: 'סמנו כדי להמשיך',
|
|
130
|
+
[RULE_MESSAGE_KEYS[RuleName.FileType]]: 'סוג הקובץ הזה לא מתקבל',
|
|
131
|
+
[RULE_MESSAGE_KEYS[RuleName.FileSize]]: 'הקובץ גדול מ-{{n}}MB',
|
|
132
|
+
[PATTERN_MESSAGE_KEYS['email']]: 'הזינו כתובת אימייל תקינה',
|
|
133
|
+
[PATTERN_MESSAGE_KEYS['phone']]: 'הזינו מספר טלפון תקין',
|
|
134
|
+
[PATTERN_MESSAGE_KEYS['url']]: 'הזינו כתובת אתר תקינה',
|
|
135
|
+
[PATTERN_MESSAGE_KEYS['digits']]: 'ספרות בלבד',
|
|
136
|
+
[PATTERN_MESSAGE_KEYS['letters']]: 'אותיות בלבד',
|
|
137
|
+
[PATTERN_MESSAGE_KEYS['slug']]: 'אותיות לטיניות קטנות, ספרות ומקפים',
|
|
138
|
+
[FORM_ERROR_KEYS.Network]: 'לא הצלחנו להגיע לשרת — בדקו את החיבור ונסו שוב',
|
|
139
|
+
[FORM_ERROR_KEYS.Rejected]: 'יש תשובות שצריך לתקן',
|
|
140
|
+
[FORM_ERROR_KEYS.Spam]: 'לא יכולנו לקבל את השליחה הזו',
|
|
141
|
+
[FORM_ERROR_KEYS.RateLimited]: 'יותר מדי ניסיונות — חכו רגע ונסו שוב',
|
|
142
|
+
[FORM_ERROR_KEYS.Server]: 'משהו השתבש אצלנו — התשובות שלכם עדיין כאן',
|
|
143
|
+
[RULE_MESSAGE_KEYS[RuleName.OneOf]]: 'בחרו אחת מהאפשרויות',
|
|
144
|
+
[RULE_MESSAGE_KEYS[RuleName.ValidDate]]: 'בחרו תאריך מלוח השנה',
|
|
145
|
+
[CHOICE_MESSAGE_KEYS.One]: 'בחרו אפשרות',
|
|
146
|
+
[CHOICE_MESSAGE_KEYS.Some]: 'בחרו לפחות אחת',
|
|
147
|
+
[CHOICE_MESSAGE_KEYS.Date]: 'בחרו תאריך',
|
|
148
|
+
[DATE_MESSAGE_KEYS.Min]: 'בחרו תאריך מאוחר יותר',
|
|
149
|
+
[DATE_MESSAGE_KEYS.Max]: 'בחרו תאריך מוקדם יותר',
|
|
150
|
+
[SUBMIT_MESSAGE_KEYS.Sent]: 'נשלח',
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
/** The catalog, by the language `formLanguageOf` reads. */
|
|
154
|
+
const FORM_MESSAGES: Readonly<Record<string, Readonly<Record<string, string>>>> = /* @__PURE__ */ Object.freeze({
|
|
155
|
+
en: DEFAULT_EN_MESSAGES,
|
|
156
|
+
he: HE_MESSAGES,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
/** The languages the catalog holds. */
|
|
160
|
+
export const FORM_MESSAGE_LANGUAGES: readonly string[] = Object.freeze(['en', 'he']);
|
|
161
|
+
|
|
162
|
+
/** The whole column for `lang` (`he-IL` → he, `iw` → he) — English for a language the catalog does not hold. */
|
|
163
|
+
export function formMessages(lang?: string | null): Readonly<Record<string, string>> {
|
|
164
|
+
const language = formLanguageOf(lang);
|
|
165
|
+
return Object.prototype.hasOwnProperty.call(FORM_MESSAGES, language) ? FORM_MESSAGES[language] : DEFAULT_EN_MESSAGES;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** `{{n}}` / `{{field}}` placed where the sentence's grammar put them; a missing param reads as ''. */
|
|
169
|
+
export function interpolateMessage(template: string, params?: Readonly<Record<string, unknown>> | null): string {
|
|
170
|
+
if (!params) return template;
|
|
171
|
+
return template.replace(/\{\{(\w+)\}\}/g, (_, name: string) => String(params[name] ?? ''));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* A message KEY as the sentence a visitor reads, in the page's language — THE reading both renderers make (the
|
|
176
|
+
* component path's default `IOX_FORM_MESSAGES`, the string runtime's): `lang`'s sentence, else the English one, else the
|
|
177
|
+
* key itself (an author's own message, which travels as its text).
|
|
178
|
+
*/
|
|
179
|
+
export function formMessage(key: string, params?: Readonly<Record<string, unknown>> | null, lang?: string | null): string {
|
|
180
|
+
const own = formMessages(lang);
|
|
181
|
+
const template = Object.prototype.hasOwnProperty.call(own, key) ? own[key]
|
|
182
|
+
: Object.prototype.hasOwnProperty.call(DEFAULT_EN_MESSAGES, key) ? DEFAULT_EN_MESSAGES[key] : key;
|
|
183
|
+
return interpolateMessage(template, params);
|
|
184
|
+
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { FeedbackTiming, FieldSpec, FormSpec } from './form.model';
|
|
13
13
|
import { formLanguageOf, formWords } from './form-words';
|
|
14
|
+
import { formMessage, SUBMIT_MESSAGE_KEYS } from './messages';
|
|
14
15
|
import { SubmitResponse } from './transport';
|
|
15
16
|
import { FieldError } from './validate';
|
|
16
17
|
|
|
@@ -146,12 +147,10 @@ export enum SubmitLabelClass {
|
|
|
146
147
|
export const SUBMIT_CHECK_SVG = `<svg class="${SubmitLabelClass.Check}" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false">` +
|
|
147
148
|
'<path d="M5 12.5l4.5 4.5L19 7.5" pathLength="100" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
148
149
|
|
|
149
|
-
/** "Sent" in the site's language, for a button whose author wrote no Sent words
|
|
150
|
-
*
|
|
151
|
-
const SENT_WORDS: Readonly<Record<string, string>> = Object.freeze({ en: 'Sent', he: 'נשלח' });
|
|
152
|
-
|
|
150
|
+
/** "Sent" in the site's language, for a button whose author wrote no Sent words — the forms message catalog's
|
|
151
|
+
* (`formMessage`), the document's `lang` picking, like the date picker's words. */
|
|
153
152
|
export function sentWord(lang: string | null | undefined): string {
|
|
154
|
-
return
|
|
153
|
+
return formMessage(SUBMIT_MESSAGE_KEYS.Sent, null, lang);
|
|
155
154
|
}
|
|
156
155
|
|
|
157
156
|
/** "While sending" in the site's language (iox-ui#158). The English one is the SubmitButton's baseline
|
|
@@ -102,6 +102,10 @@ export enum SiteFindingCode {
|
|
|
102
102
|
DeadLink = 'dead-link',
|
|
103
103
|
DeadDialogTarget = 'dead-dialog-target',
|
|
104
104
|
ActionNeedsConnector = 'action-needs-connector',
|
|
105
|
+
/** Actions plan R-H5 (K4): a shop or account action (`addToCart`, `startCheckout`, `signIn`, `signOut` — the catalog's
|
|
106
|
+
* `entitlement`) on a studio whose plan lacks that feature (`features.shop`): the checkout and the sign-in refuse it
|
|
107
|
+
* live, so the button would do nothing for every buyer. */
|
|
108
|
+
ActionNeedsEntitlement = 'action-needs-entitlement',
|
|
105
109
|
/** Popups PU3 (§11): a popup's title or its action's words are empty — never invented for it. `variant` title | action. */
|
|
106
110
|
PopupEmpty = 'popup-empty',
|
|
107
111
|
/** Popups PU3 (§11): a centred popup arrives by time sooner than the minimum seconds — an interstitial over the landing view. */
|
|
@@ -146,6 +150,7 @@ export const FINDING_SEVERITY: Readonly<Record<SiteFindingCode, CheckSeverity>>
|
|
|
146
150
|
[SiteFindingCode.DeadLink]: CheckSeverity.Block,
|
|
147
151
|
[SiteFindingCode.DeadDialogTarget]: CheckSeverity.Block,
|
|
148
152
|
[SiteFindingCode.ActionNeedsConnector]: CheckSeverity.Block,
|
|
153
|
+
[SiteFindingCode.ActionNeedsEntitlement]: CheckSeverity.Block,
|
|
149
154
|
[SiteFindingCode.PopupEmpty]: CheckSeverity.Block,
|
|
150
155
|
[SiteFindingCode.PopupCentredEarly]: CheckSeverity.Block,
|
|
151
156
|
[SiteFindingCode.PopupEnded]: CheckSeverity.Warn,
|
|
@@ -185,6 +190,7 @@ const CHECK_OF: Readonly<Record<SiteFindingCode, SiteCheckId>> = {
|
|
|
185
190
|
[SiteFindingCode.DeadLink]: SiteCheckId.Actions,
|
|
186
191
|
[SiteFindingCode.DeadDialogTarget]: SiteCheckId.Actions,
|
|
187
192
|
[SiteFindingCode.ActionNeedsConnector]: SiteCheckId.Actions,
|
|
193
|
+
[SiteFindingCode.ActionNeedsEntitlement]: SiteCheckId.Actions,
|
|
188
194
|
[SiteFindingCode.PopupEmpty]: SiteCheckId.Facts,
|
|
189
195
|
[SiteFindingCode.PopupCentredEarly]: SiteCheckId.Accessibility,
|
|
190
196
|
[SiteFindingCode.PopupEnded]: SiteCheckId.Facts,
|
|
@@ -248,6 +254,12 @@ export interface SiteAuditSnapshot {
|
|
|
248
254
|
connectors: Readonly<Record<string, boolean>>;
|
|
249
255
|
/** Connector types that set a tracker (a consent category) and are configured. */
|
|
250
256
|
trackers?: ReadonlyArray<string>;
|
|
257
|
+
/**
|
|
258
|
+
* Actions plan R-H5: the studio's plan features by the catalog's `entitlement` key (the control plane's
|
|
259
|
+
* `features.<key>`, e.g. `shop`) → in the plan. Absent = the caller does not know the plan, so nothing is judged by it
|
|
260
|
+
* (K4's v1 default); given, a key that is not `true` is not in the plan — unknown is never "included", as a connector.
|
|
261
|
+
*/
|
|
262
|
+
entitlements?: Readonly<Record<string, boolean>> | null;
|
|
251
263
|
/** The look's token rows and the mode(s) the site wears. */
|
|
252
264
|
design?: { rows: ReadonlyArray<DesignTokenLike>; modes: ReadonlyArray<'light' | 'dark'> } | null;
|
|
253
265
|
placeholders?: ReadonlyArray<AuditPlaceholder>;
|
|
@@ -610,11 +622,14 @@ function checkTokens(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray
|
|
|
610
622
|
});
|
|
611
623
|
}
|
|
612
624
|
|
|
625
|
+
/** What the owner sees a node as: its own words (a button's label, a heading's text), else its layer name, else its type. */
|
|
626
|
+
const shownAs = (n: SerializedNode): string => String(n.props['label'] ?? n.props['content'] ?? n.label ?? n.type);
|
|
627
|
+
|
|
613
628
|
function checkActions(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray<AuditPage>): void {
|
|
614
629
|
const routeExists = (route: unknown) => typeof route === 'string' && ctx.routes.some(r => routeMatches(r, route));
|
|
615
630
|
eachNode(snapshot, pages, (n, where) => {
|
|
616
631
|
if (LINKING_TYPES.has(n.type) && n.props['linkType'] === PAGE_LINK && !routeExists(n.props['pageRoute'])) {
|
|
617
|
-
add(ctx, SiteFindingCode.DeadLink, deadLinkParams(
|
|
632
|
+
add(ctx, SiteFindingCode.DeadLink, deadLinkParams(shownAs(n), String(n.props['pageRoute'] ?? '')), { ...where, nodeId: n.id });
|
|
618
633
|
}
|
|
619
634
|
for (const ix of (n.interactions ?? []) as Array<{ actions?: Array<{ type?: string; target?: string; params?: Record<string, unknown>; disabled?: boolean }> }>) {
|
|
620
635
|
for (const action of ix?.actions ?? []) {
|
|
@@ -625,17 +640,23 @@ function checkActions(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArra
|
|
|
625
640
|
if (descriptor.target?.required && action.target !== SELF) {
|
|
626
641
|
const targetType = action.target ? ctx.nodeIds.get(action.target) : undefined;
|
|
627
642
|
if (!targetType || (types && !types.includes(targetType))) {
|
|
628
|
-
add(ctx, SiteFindingCode.DeadDialogTarget, { label:
|
|
643
|
+
add(ctx, SiteFindingCode.DeadDialogTarget, { label: shownAs(n) }, { ...where, nodeId: n.id });
|
|
629
644
|
}
|
|
630
645
|
}
|
|
631
646
|
if (action.type === 'navigate' && action.params?.['navigateTo'] === PAGE_LINK && !routeExists(action.params?.['page'])) {
|
|
632
|
-
add(ctx, SiteFindingCode.DeadLink, { variant: 'action', label:
|
|
647
|
+
add(ctx, SiteFindingCode.DeadLink, { variant: 'action', label: shownAs(n) }, { ...where, nodeId: n.id });
|
|
633
648
|
}
|
|
634
649
|
// A connector the snapshot does not say is usable is not: unknown is never "fine".
|
|
635
650
|
const connectors = descriptor.connector ? { [descriptor.connector]: snapshot.connectors[descriptor.connector] === true } : {};
|
|
636
|
-
|
|
651
|
+
// R-H5: the same for the plan — judged only when the caller knows it (`entitlements` given).
|
|
652
|
+
const entitlements = descriptor.entitlement && snapshot.entitlements
|
|
653
|
+
? { [descriptor.entitlement]: snapshot.entitlements[descriptor.entitlement] === true } : undefined;
|
|
654
|
+
const availability = resolveActionAvailability(descriptor, { connectors, ...(entitlements ? { entitlements } : {}) });
|
|
637
655
|
if (availability.state === 'connector-missing') {
|
|
638
|
-
add(ctx, SiteFindingCode.ActionNeedsConnector, { label:
|
|
656
|
+
add(ctx, SiteFindingCode.ActionNeedsConnector, { label: shownAs(n), connector: String(availability.connector) }, { ...where, nodeId: n.id });
|
|
657
|
+
}
|
|
658
|
+
if (availability.state === 'entitlement-missing') {
|
|
659
|
+
add(ctx, SiteFindingCode.ActionNeedsEntitlement, { label: shownAs(n), entitlement: String(availability.entitlement) }, { ...where, nodeId: n.id });
|
|
639
660
|
}
|
|
640
661
|
}
|
|
641
662
|
}
|
|
@@ -209,6 +209,14 @@ export const SITE_FINDING_WORDS: Readonly<Record<`${SiteFindingCode}`, FindingWo
|
|
|
209
209
|
one: S('"{label}" needs {connector} connected.', '"{label}" צריך ש-{connector} יהיה מחובר.'),
|
|
210
210
|
group: FindingGrouping.Never,
|
|
211
211
|
},
|
|
212
|
+
// R-H5: one feature today (`shop`), so the sentence names it; a second gated feature gets variants.
|
|
213
|
+
'action-needs-entitlement': {
|
|
214
|
+
one: S('"{label}" sells or signs buyers in, and your plan does not include Shop and customer sign-in — upgrade the plan, or take it off the site.',
|
|
215
|
+
'"{label}" מוכר או מחבר קונים, והתוכנית שלך לא כוללת חנות והתחברות לקוחות — שדרגו את התוכנית, או הסירו אותו מהאתר.'),
|
|
216
|
+
many: S('{n} buttons sell or sign buyers in, and your plan does not include Shop and customer sign-in — upgrade the plan, or take them off the site.',
|
|
217
|
+
'{n} כפתורים מוכרים או מחברים קונים, והתוכנית שלך לא כוללת חנות והתחברות לקוחות — שדרגו את התוכנית, או הסירו אותם מהאתר.'),
|
|
218
|
+
group: FindingGrouping.Site,
|
|
219
|
+
},
|
|
212
220
|
'popup-empty': {
|
|
213
221
|
one: {
|
|
214
222
|
title: S('A popup has no title — write what it tells your visitors.', 'לחלון קופץ אין כותרת — כתבו מה הוא מספר למבקרים.'),
|
|
@@ -1538,13 +1538,14 @@ function composeSlideshow(pn: PatternNode, id: string, ctx: Ctx): SerializedNode
|
|
|
1538
1538
|
|
|
1539
1539
|
/**
|
|
1540
1540
|
* CC3: the Lightbox — a Dialog holding a Slider bound to the node's `src` (the gallery's own source): one template
|
|
1541
|
-
* slide whose image reads the row (a bare URL row: decorative alt), its arrows hidden on a phone.
|
|
1541
|
+
* slide whose image reads the row (a bare URL row: decorative alt), its arrows hidden on a phone. Its stored names
|
|
1542
|
+
* (Close, the arrows, the gallery) in the plan's language (iox-ui#170).
|
|
1542
1543
|
*/
|
|
1543
1544
|
function composeLightbox(pn: PatternNode, id: string, repeater: RepeaterScope | null, ctx: Ctx): SerializedNode {
|
|
1544
1545
|
if (!pn.src) throw new ComposeError(`${id}: a lightbox needs the gallery's source (src)`);
|
|
1545
1546
|
const scoped = resolveScoped(pn.src, repeater, ctx, id);
|
|
1546
1547
|
const sourcePath = scoped.path === ITEM_VALUE_PATH ? '' : scoped.path;
|
|
1547
|
-
return buildLightboxRecipe(recipeFactory(id, 'lightbox'), { source: scoped.source, sourcePath, imageField: 'item' }) as SerializedNode;
|
|
1548
|
+
return buildLightboxRecipe(recipeFactory(id, 'lightbox'), { source: scoped.source, sourcePath, imageField: 'item', lang: ctx.plan.locale }) as SerializedNode;
|
|
1548
1549
|
}
|
|
1549
1550
|
|
|
1550
1551
|
/** CC3: every `opens: lightbox` node of a stamped pattern opens the pattern's lightbox at its own row. */
|
|
@@ -88,11 +88,26 @@ export interface ImportReading {
|
|
|
88
88
|
readonly home?: ImportedHome;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* X9-D23 (What we found's ticks): what the owner leaves on the old site. Pages, their search words and their old addresses
|
|
93
|
+
* always move — an old address with no page has nowhere to go — so only these can stay behind:
|
|
94
|
+
*/
|
|
95
|
+
export interface ImportLeave {
|
|
96
|
+
/** The keys of the lists (the scan's content types, `ImportedList.key`) that stay: no type, no pages, no redirects. */
|
|
97
|
+
readonly lists?: ReadonlyArray<string>;
|
|
98
|
+
/** The pictures stay: every picture box is kept but left empty, so nothing is copied (`importedPicturesOf` is empty). */
|
|
99
|
+
readonly pictures?: boolean;
|
|
100
|
+
/** The details from the old site (its email, phone, address and hours) stay: the business carries none of them. */
|
|
101
|
+
readonly details?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
91
104
|
export interface ImportPlanInput {
|
|
92
105
|
/** The owner's pick (the Design step). */
|
|
93
106
|
readonly design: DesignChoices;
|
|
94
107
|
/** The structure the home page, the contact page and the globals come from; absent = the Studio. */
|
|
95
108
|
readonly template?: SiteTemplate;
|
|
109
|
+
/** What stays on the old site (X9-D23); absent = everything moves. */
|
|
110
|
+
readonly leave?: ImportLeave;
|
|
96
111
|
}
|
|
97
112
|
|
|
98
113
|
/** A Site Plan read from the owner's own site. */
|
|
@@ -385,6 +400,32 @@ const pageHeader = (title: string, lead?: string): PageSectionPlan => lead
|
|
|
385
400
|
* page, the contact page).
|
|
386
401
|
*/
|
|
387
402
|
export function planImport(reading: ImportReading, input: ImportPlanInput): ImportPlan {
|
|
403
|
+
const plan = planAll(readingKept(reading, input.leave), input);
|
|
404
|
+
return input.leave?.pictures ? withoutPictures(plan) : plan;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/** X9-D23: the reading without the lists that stay, and without the old site's details when they stay. */
|
|
408
|
+
function readingKept(reading: ImportReading, leave: ImportLeave | undefined): ImportReading {
|
|
409
|
+
if (!leave) return reading;
|
|
410
|
+
const staying = new Set(leave.lists ?? []);
|
|
411
|
+
const lists = staying.size ? reading.lists.filter(l => !staying.has(l.key)) : reading.lists;
|
|
412
|
+
const { facts: _facts, ...business } = reading.business;
|
|
413
|
+
return { ...reading, lists, business: leave.details ? business : reading.business };
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** X9-D23: the pictures stay — every picture and gallery field of a real item kept, its value empty (a box to fill). */
|
|
417
|
+
function withoutPictures(plan: ImportPlan): ImportPlan {
|
|
418
|
+
const contentTypes = plan.contentTypes.map(type => {
|
|
419
|
+
const perItem = type.seed?.importedFrom?.length ? type.seed.perItem : undefined;
|
|
420
|
+
if (!perItem) return type;
|
|
421
|
+
const emptied = Object.fromEntries(type.fields.filter(f => PICTURE_CONTROLS.includes(f.controller) && f.name in perItem)
|
|
422
|
+
.map(f => [f.name, perItem[f.name].map(() => f.controller === ContentFieldControl.Gallery ? [] : '')]));
|
|
423
|
+
return { ...type, seed: { ...type.seed!, perItem: { ...perItem, ...emptied } } };
|
|
424
|
+
});
|
|
425
|
+
return { ...plan, contentTypes };
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function planAll(reading: ImportReading, input: ImportPlanInput): ImportPlan {
|
|
388
429
|
const template = input.template ?? STUDIO_TEMPLATE;
|
|
389
430
|
const lists = reading.lists.filter(l => l.items.length > 0);
|
|
390
431
|
const matched = templateListOf(template, lists);
|
|
@@ -7,12 +7,14 @@ import {
|
|
|
7
7
|
aspectRatioOf, scoreStockPhoto, STOCK_FAMILY_INTENTS, STOCK_INTENT_ORDER, StockIntent, StockNeed, stockFits, StockPhotoTraits, stockPhotoUsable,
|
|
8
8
|
stockWords,
|
|
9
9
|
} from './stock-match';
|
|
10
|
+
import { isPeopleContentType, StockFit, stockMayFill, stockPhotoFits } from './stock-search';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Stock photos in a built site (AI plan §3g / §3m, I2 + I2.1): a FREE picture from the platform's curated library, copied
|
|
13
14
|
* into the studio's own storage (never hot-linked), placed only in an EMPTY picture slot of a section that may show
|
|
14
15
|
* one — never the owner's work (a collection, a detail page, a gallery: what the nine portfolio types sell is theirs),
|
|
15
|
-
* never a person (testimonials, the team
|
|
16
|
+
* never a person (testimonials, the team — nor a sample item of a type that lists people, iox-ui#172: `stockMayFill`),
|
|
17
|
+
* never anywhere when the business type says `stock: false` — and, since I2.1
|
|
16
18
|
* (Doron, 2026-10-28), in the picture of a MARKED sample item (a product, a service, a dish) of a type that may show
|
|
17
19
|
* stock. Which photo goes where is chosen by what the slot is about (`stock-match.ts`). Its alt text is
|
|
18
20
|
* the provider's description of what it shows (never a claim), and the credit line its licence requires — when it
|
|
@@ -131,6 +133,11 @@ export interface StockItemSlot extends StockNeed {
|
|
|
131
133
|
field: string;
|
|
132
134
|
/** The item's own name, as words (its `title`): an owner's photo stands under it only when it shows that. */
|
|
133
135
|
subject?: string[];
|
|
136
|
+
/**
|
|
137
|
+
* iox-ui#172: the item is a PERSON (its type lists people — `isPeopleContentType`): only the owner's photo of them may
|
|
138
|
+
* stand here, never stock (`stockMayFill`) — a stranger under a team member's name is a made-up fact.
|
|
139
|
+
*/
|
|
140
|
+
person?: boolean;
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
export type StockTarget = StockSlot | StockItemSlot;
|
|
@@ -358,10 +365,14 @@ export function stockItemSlots(plan: Pick<SitePlan, 'contentTypes'>, composed: P
|
|
|
358
365
|
for (const type of plan.contentTypes) {
|
|
359
366
|
const field = roleField(type, ContentRole.Image);
|
|
360
367
|
if (!field) continue;
|
|
368
|
+
const person = isPeopleContentType(type);
|
|
361
369
|
(composed.items[type.name] ?? []).forEach((item, index) => {
|
|
362
370
|
if (!item.isSample || parseSampleImageRef(item[field]) === null) return;
|
|
363
371
|
const { subject, words } = itemWords(type, item);
|
|
364
|
-
out.push({
|
|
372
|
+
out.push({
|
|
373
|
+
kind: StockSlotKind.Item, contentType: type.name, index, field, intent: StockIntent.Product, aspect: STOCK_ITEM_ASPECT, words, subject,
|
|
374
|
+
...(person ? { person: true } : {}),
|
|
375
|
+
});
|
|
365
376
|
});
|
|
366
377
|
}
|
|
367
378
|
return out;
|
|
@@ -383,6 +394,11 @@ export interface StockPlanOptions {
|
|
|
383
394
|
seed?: string;
|
|
384
395
|
/** M7: library keys other sites of this studio already show — chosen only when no photo they do not show fits. */
|
|
385
396
|
avoid?: ReadonlyArray<string>;
|
|
397
|
+
/**
|
|
398
|
+
* iox-cms#123: what every photo is held to on this site (`planStockSearch(type, …).fit` / `stockFitFor(type)`): the
|
|
399
|
+
* never-words of every site and of the trade, and an opening's second word of the business. Absent: the never-words only.
|
|
400
|
+
*/
|
|
401
|
+
fit?: StockFit;
|
|
386
402
|
}
|
|
387
403
|
|
|
388
404
|
/** How far below the best score a photo may be and still be the seed's choice (one word of the plan's, about). */
|
|
@@ -419,7 +435,9 @@ const intentRank = (intent: string) => STOCK_INTENT_ORDER.indexOf(intent as Stoc
|
|
|
419
435
|
* type's samples) — a photo no slot has taken yet always before one another page shows. Ties go to the library's
|
|
420
436
|
* order — or, with a `seed` (M7), the site's own pick among those nearly as good, and another site's photos (`avoid`) only
|
|
421
437
|
* when nothing fresh fits. A slot nothing fits keeps its empty box (a sample its abstract picture). None at all when the
|
|
422
|
-
* type says no stock,
|
|
438
|
+
* type says no stock, never a person's place (`stockMayFill`), never a photo the review rejected or flagged, and never
|
|
439
|
+
* one the site's fit refuses (`stockPhotoFits`: crime, ruin, a joke; an opening that does not name the business twice).
|
|
440
|
+
* Returned in the slots' order.
|
|
423
441
|
*/
|
|
424
442
|
export function planStockPhotos<T extends StockTarget>(slots: ReadonlyArray<T>, photos: ReadonlyArray<StockPhoto>, stockAllowed: boolean, opts: StockPlanOptions = {}): Array<StockPlacement<T>> {
|
|
425
443
|
if (!stockAllowed) return [];
|
|
@@ -431,9 +449,10 @@ export function planStockPhotos<T extends StockTarget>(slots: ReadonlyArray<T>,
|
|
|
431
449
|
const shownIn = new Map<string, Set<string>>();
|
|
432
450
|
const placed = new Map<number, StockPlacement<T>>();
|
|
433
451
|
for (const { slot, i } of order) {
|
|
452
|
+
if (!stockMayFill(slot)) continue;
|
|
434
453
|
const group = stockGroupOf(slot);
|
|
435
454
|
const here = shownIn.get(group) ?? new Set<string>();
|
|
436
|
-
const candidates = usable.filter(p => !here.has(p.key) && stockFits(p, slot));
|
|
455
|
+
const candidates = usable.filter(p => !here.has(p.key) && stockFits(p, slot) && stockPhotoFits(p, slot, opts.fit));
|
|
437
456
|
const fresh = candidates.filter(p => !used.has(p.key));
|
|
438
457
|
const best = bestFor(fresh.length ? fresh : candidates, slot, imagery, opts.seed);
|
|
439
458
|
if (!best) continue;
|