@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.
Files changed (46) hide show
  1. package/actions-core/index.d.ts +1 -0
  2. package/commerce-core/index.d.ts +0 -1
  3. package/composite-core/index.d.ts +28 -11
  4. package/design-core/index.d.ts +44 -2
  5. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +1 -0
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +0 -2
  8. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +65 -34
  10. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-design-core.mjs +142 -60
  12. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui-forms-core.mjs +186 -122
  14. package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
  15. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +244 -16
  16. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  17. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +193 -95
  18. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  19. package/fesm2022/vectoriox-iox-ui.mjs +209 -148
  20. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  21. package/forms-core/index.d.ts +17 -2
  22. package/generation-core/index.d.ts +141 -4
  23. package/harness-core/index.d.ts +102 -12
  24. package/index.d.ts +15 -12
  25. package/package.json +1 -1
  26. package/src/actions-core/public-api.ts +3 -0
  27. package/src/commerce-core/shop-display.ts +0 -2
  28. package/src/composite-core/lightbox.ts +27 -8
  29. package/src/composite-core/shop.ts +45 -28
  30. package/src/design-core/close-word.ts +18 -0
  31. package/src/design-core/contrast-audit.ts +24 -14
  32. package/src/design-core/locale-direction.ts +17 -0
  33. package/src/design-core/public-api.ts +1 -0
  34. package/src/design-core/token-css.ts +62 -3
  35. package/src/forms-core/messages.ts +72 -1
  36. package/src/forms-core/submit-lifecycle.ts +4 -5
  37. package/src/generation-core/audit-site.ts +26 -5
  38. package/src/generation-core/audit-words.ts +8 -0
  39. package/src/generation-core/compose-site.ts +3 -2
  40. package/src/generation-core/import-plan.ts +41 -0
  41. package/src/generation-core/public-api.ts +1 -0
  42. package/src/generation-core/stock-photos.ts +23 -4
  43. package/src/generation-core/stock-search.ts +235 -0
  44. package/src/harness-core/business-types.ts +14 -9
  45. package/src/harness-core/harness-spec.generated.ts +168 -84
  46. package/src/harness-core/lint.ts +29 -11
@@ -1,7 +1,7 @@
1
- import { AnimateId, DesignChoices, DesignMotion, parseHexColor, rgbToOklab, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
1
+ import { AnimateId, DesignChoices, DesignMotion, languageOf, parseHexColor, rgbToOklab, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
2
2
  import type { FactKey } from '@vectoriox/iox-ui/generation-core';
3
3
 
4
- import { AvoidCheck, BUSINESS_TYPES, BusinessType, COPY_LENGTH_ORDER, CopyLength, isLookRule } from './business-types';
4
+ import { AvoidCheck, BUSINESS_TYPES, BusinessType, COPY_LENGTH_ORDER, CopyLength, isLookRule, RuleLine } from './business-types';
5
5
  import { lookMatches } from './look';
6
6
 
7
7
  /**
@@ -19,9 +19,23 @@ export enum LintKind {
19
19
  export interface LintFinding {
20
20
  kind: LintKind;
21
21
  say: string;
22
+ /** The same line in Hebrew (vectoriox/iox-cms-client#128). Read through `lintSentence`. */
23
+ sayHe: string;
22
24
  fact?: FactKey;
23
25
  }
24
26
 
27
+ /**
28
+ * A finding's line in the reader's language — THE choice Home, the Publish dialog and anything else showing advice make:
29
+ * Hebrew (`he`, `he-IL`, the old `iw`) reads `sayHe`, every other language the English `say`. A finding from an older
30
+ * server, without `sayHe`, says its English.
31
+ */
32
+ export function lintSentence(finding: Pick<LintFinding, 'say'> & Partial<Pick<LintFinding, 'sayHe'>>, lang?: string | null): string {
33
+ const language = languageOf(lang);
34
+ return (language === 'he' || language === 'iw') && finding.sayHe ? finding.sayHe : finding.say;
35
+ }
36
+
37
+ const line = (kind: LintKind, rule: RuleLine): LintFinding => ({ kind, say: rule.say, sayHe: rule.sayHe });
38
+
25
39
  /** What the lint reads of a site. */
26
40
  export interface LintSite {
27
41
  design: Pick<DesignChoices, 'flavorId' | 'seed' | 'motion' | 'density' | 'mode'> & Partial<Pick<DesignChoices, 'tint'>> & Partial<DesignMotion>;
@@ -59,36 +73,40 @@ export function lintDesign(site: LintSite, typeId: string, types: ReadonlyArray<
59
73
  const all = site.allPatterns ?? home;
60
74
  for (const rule of type.avoid) {
61
75
  if (isLookRule(rule)) {
62
- if (lookMatches(rule.when, site.design, site.moods ?? [])) out.push({ kind: LintKind.Look, say: rule.say });
76
+ if (lookMatches(rule.when, site.design, site.moods ?? [])) out.push(line(LintKind.Look, rule));
63
77
  continue;
64
78
  }
65
79
  switch (rule.check) {
66
80
  case AvoidCheck.NeedsFamily:
67
- if (!home.some(id => familyOf(id) === rule.family)) out.push({ kind: LintKind.Content, say: rule.say });
81
+ if (!home.some(id => familyOf(id) === rule.family)) out.push(line(LintKind.Content, rule));
68
82
  break;
69
83
  case AvoidCheck.NeedsFact:
70
- if (!site.facts?.[rule.fact]) out.push({ kind: LintKind.Fact, say: rule.say, fact: rule.fact });
84
+ if (!site.facts?.[rule.fact]) out.push({ ...line(LintKind.Fact, rule), fact: rule.fact });
71
85
  break;
72
86
  case AvoidCheck.ImageHero:
73
- if (!site.heroHasImage) out.push({ kind: LintKind.Content, say: rule.say });
87
+ if (!site.heroHasImage) out.push(line(LintKind.Content, rule));
74
88
  break;
75
89
  case AvoidCheck.NoPattern:
76
- if (all.includes(rule.pattern)) out.push({ kind: LintKind.Content, say: rule.say });
90
+ if (all.includes(rule.pattern)) out.push(line(LintKind.Content, rule));
77
91
  break;
78
92
  case AvoidCheck.CopyLength:
79
- if (site.copyLength && COPY_LENGTH_ORDER.indexOf(site.copyLength) > COPY_LENGTH_ORDER.indexOf(rule.max)) out.push({ kind: LintKind.Content, say: rule.say });
93
+ if (site.copyLength && COPY_LENGTH_ORDER.indexOf(site.copyLength) > COPY_LENGTH_ORDER.indexOf(rule.max)) out.push(line(LintKind.Content, rule));
80
94
  break;
81
95
  case AvoidCheck.BrandHue: {
82
96
  const hue = oklchHue(site.design.seed);
83
- if (hue && hue.chroma >= rule.minChroma && hue.hue >= rule.from && hue.hue <= rule.to) out.push({ kind: LintKind.Look, say: rule.say });
97
+ if (hue && hue.chroma >= rule.minChroma && hue.hue >= rule.from && hue.hue <= rule.to) out.push(line(LintKind.Look, rule));
84
98
  break;
85
99
  }
86
100
  }
87
101
  }
88
102
  const advice = motionAdvice(type.id, site.design.animate, types);
89
103
  if (advice) {
90
- const usual = (SPEC_AXES.animations as Readonly<Record<string, { label: string }>>)[advice.usual].label;
91
- out.push({ kind: LintKind.Look, say: `${type.label} sites usually move less (${usual}); this much movement as people scroll can feel restless.` });
104
+ const usual = (SPEC_AXES.animations as Readonly<Record<string, { label: string; he: string }>>)[advice.usual];
105
+ out.push({
106
+ kind: LintKind.Look,
107
+ say: `${type.label} sites usually move less (${usual.label}); this much movement as people scroll can feel restless.`,
108
+ sayHe: `באתר של ${type.he} בדרך כלל יש פחות תנועה (${usual.he}); כל כך הרבה תנועה בזמן הגלילה עלולה להרגיש חסרת מנוחה.`,
109
+ });
92
110
  }
93
111
  return out;
94
112
  }