@vectoriox/iox-ui 5.205.0 → 5.206.1

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 (49) hide show
  1. package/data-core/index.d.ts +13 -4
  2. package/design-core/index.d.ts +269 -6
  3. package/fesm2022/vectoriox-iox-ui-data-core.mjs +23 -4
  4. package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-design-core.mjs +3064 -2682
  6. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1184 -173
  8. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +71 -19
  10. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-scene-core.mjs +32 -4
  12. package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
  13. package/generation-core/index.d.ts +421 -34
  14. package/harness-core/index.d.ts +52 -12
  15. package/package.json +1 -1
  16. package/scene-core/index.d.ts +16 -2
  17. package/src/data-core/placeholder-rows.ts +24 -3
  18. package/src/design-core/colour-eval.ts +22 -0
  19. package/src/design-core/contrast-audit.ts +96 -2
  20. package/src/design-core/design-token.model.ts +2 -0
  21. package/src/design-core/flavor-spec.generated.ts +184 -0
  22. package/src/design-core/font-metrics.ts +14 -1
  23. package/src/design-core/font-vertical.ts +80 -0
  24. package/src/design-core/public-api.ts +1 -0
  25. package/src/design-core/style-presets.ts +20 -1
  26. package/src/design-core/token-css.ts +3 -1
  27. package/src/generation-core/audit-site.ts +5 -3
  28. package/src/generation-core/compose-free.ts +1 -1
  29. package/src/generation-core/compose-layout.ts +197 -23
  30. package/src/generation-core/critic-calibration.ts +26 -9
  31. package/src/generation-core/critic-numbers.ts +259 -0
  32. package/src/generation-core/critic-prompt.ts +53 -6
  33. package/src/generation-core/critic-rubric.generated.ts +6 -6
  34. package/src/generation-core/critic-sheet.ts +112 -1
  35. package/src/generation-core/layout-render-check.ts +35 -2
  36. package/src/generation-core/layout-space.ts +2 -1
  37. package/src/generation-core/nav-shape.ts +67 -8
  38. package/src/generation-core/opening-mix.ts +61 -17
  39. package/src/generation-core/public-api.ts +2 -0
  40. package/src/generation-core/social-links.ts +47 -8
  41. package/src/generation-core/stock-photos.ts +149 -14
  42. package/src/generation-core/stock-search.ts +108 -19
  43. package/src/generation-core/stock-subjects.ts +204 -0
  44. package/src/harness-core/business-types.ts +3 -0
  45. package/src/harness-core/harness-spec.generated.ts +54 -15
  46. package/src/harness-core/intake.ts +18 -5
  47. package/src/scene-core/scene.ts +34 -3
  48. package/styles/iox-design.css +41 -2
  49. package/styles/iox-forms.css +7 -6
@@ -0,0 +1,204 @@
1
+ import { stockWord, stockWords } from './stock-match';
2
+
3
+ /**
4
+ * What a stock photo is ABOUT, against what its place is about (iox-cms#130) — the closed tables the relevance check
5
+ * (`stockRelevance`, stock-search.ts) and the query (`stockSearchFocus`) read. Pure data and word helpers, English (the
6
+ * provider's tags) with a small Hebrew table for the place's own words (a Hebrew site's heading says "החלקה", the photo's
7
+ * tags say "manicure").
8
+ *
9
+ * - PARTS of a business (`STOCK_FACETS`): a salon does hair, nails, make-up; a hotel has rooms, a table, a pool. A place
10
+ * whose own words name a part takes a photo of THAT part — the "straightening" card never a manicure.
11
+ * - Words that say a photo is about SOMETHING ELSE (`STOCK_UNRELATED_WORDS`): a laptop on a café's table, a cruise ship in
12
+ * the bay, a drain in a basin. Off-subject unless the place or the business names it.
13
+ * - Places on the map (`STOCK_PLACE_NAMES`): a photo tagged "china, sanya" shows somewhere else. Off-subject unless the
14
+ * place's words name one of them (a Haifa hotel keeps a photo tagged "haifa").
15
+ * - Scenery words (`STOCK_GENERIC_WORDS`): "bay", "sea", "view" — never what a query asks alone (Pixabay answers "hotel
16
+ * view" with resort towers).
17
+ */
18
+
19
+ /** Words that only say where a photo looks — never a query's focus, never enough to tie a photo to a place. */
20
+ export const STOCK_GENERIC_WORDS: ReadonlySet<string> = new Set([
21
+ 'view', 'landscape', 'scenery', 'scenic', 'panorama', 'horizon', 'beach', 'sea', 'ocean', 'bay', 'coast', 'coastline', 'shore',
22
+ 'sky', 'sunset', 'sunrise', 'cloud', 'city', 'town', 'mountain', 'hill', 'forest', 'nature', 'water', 'lake', 'river', 'island',
23
+ 'outdoor', 'outside', 'travel', 'holiday', 'vacation', 'tourism', 'summer', 'morning', 'evening', 'night', 'below', 'above',
24
+ ].map(stockWord));
25
+
26
+ /**
27
+ * The parts of a business a photo shows (English, compared as `stockWord`s). A word of five letters or more counts in its
28
+ * longer forms (`straighten` → `straightening`). Keys are stable ids, never shown.
29
+ */
30
+ export const STOCK_FACETS: Readonly<Record<string, ReadonlyArray<string>>> = {
31
+ hair: [
32
+ 'hair', 'haircut', 'hairdresser', 'hairdressing', 'hairstyle', 'hairstylist', 'straighten', 'straightening', 'straightener',
33
+ 'keratin', 'blowout', 'blowdry', 'barber', 'barbershop', 'shampoo', 'comb', 'scissors', 'curl', 'curly', 'braid', 'highlights',
34
+ 'balayage', 'clipper', 'beard',
35
+ ],
36
+ nails: ['manicure', 'manicurist', 'pedicure', 'nail', 'fingernail', 'toenail'],
37
+ makeup: ['makeup', 'lipstick', 'mascara', 'eyeshadow', 'eyeliner', 'foundation', 'blush'],
38
+ brows: ['eyelash', 'lash', 'eyebrow', 'brow'],
39
+ skin: ['facial', 'skincare', 'peel', 'serum'],
40
+ massage: ['massage', 'masseur', 'masseuse'],
41
+ sleep: ['bedroom', 'bed', 'suite', 'pillow', 'bedding', 'duvet', 'headboard', 'mattress', 'linen'],
42
+ meal: ['breakfast', 'brunch', 'dinner', 'lunch', 'meal', 'dining', 'buffet'],
43
+ coffee: ['coffee', 'espresso', 'cappuccino', 'latte', 'barista'],
44
+ baking: ['bread', 'pastry', 'croissant', 'cake', 'cookie', 'muffin', 'baguette', 'dough', 'patisserie'],
45
+ pool: ['pool', 'swimming', 'jacuzzi'],
46
+ };
47
+
48
+ /**
49
+ * Words that say a photo shows something no place of a small business asked for — a device on the table, a vehicle in the
50
+ * frame, plumbing, a skyline. Off-subject unless the place's words or the business's own vocabulary name it.
51
+ */
52
+ export const STOCK_UNRELATED_WORDS: ReadonlySet<string> = new Set([
53
+ // devices
54
+ 'laptop', 'computer', 'keyboard', 'smartphone', 'iphone', 'phone', 'mobile', 'tablet', 'ipad', 'monitor', 'screen', 'macbook',
55
+ // vehicles and their places
56
+ 'cruise', 'cruiser', 'ship', 'cruiseship', 'ferry', 'tanker', 'airplane', 'aeroplane', 'aircraft', 'airport', 'plane', 'train',
57
+ 'railway', 'truck', 'bus', 'car', 'vehicle', 'traffic', 'motorcycle', 'highway',
58
+ // plumbing
59
+ 'sink', 'drain', 'faucet', 'tap', 'plughole', 'washbasin', 'basin', 'toilet', 'plumbing',
60
+ // a skyline, not a house
61
+ 'skyscraper', 'highrise', 'skyline', 'cityscape', 'downtown', 'metropolis', 'tower',
62
+ ].map(stockWord));
63
+
64
+ /** Places on the map a stock photo is tagged with (compared as plain phrases: `new york`, `tel aviv`). */
65
+ export const STOCK_PLACE_NAMES: ReadonlyArray<string> = [
66
+ // countries
67
+ 'afghanistan', 'albania', 'algeria', 'argentina', 'armenia', 'australia', 'austria', 'azerbaijan', 'bahamas', 'bangladesh',
68
+ 'belgium', 'bolivia', 'bosnia', 'brazil', 'bulgaria', 'cambodia', 'cameroon', 'canada', 'chile', 'china', 'colombia', 'costa rica',
69
+ 'croatia', 'cuba', 'cyprus', 'czech', 'czechia', 'denmark', 'dominican republic', 'ecuador', 'egypt', 'england', 'estonia',
70
+ 'ethiopia', 'fiji', 'finland', 'france', 'georgia', 'germany', 'ghana', 'greece', 'guatemala', 'hungary', 'iceland', 'india',
71
+ 'indonesia', 'iran', 'iraq', 'ireland', 'israel', 'italy', 'jamaica', 'japan', 'jordan', 'kazakhstan', 'kenya', 'korea', 'laos',
72
+ 'latvia', 'lebanon', 'lithuania', 'luxembourg', 'madagascar', 'malaysia', 'maldives', 'malta', 'mauritius', 'mexico', 'mongolia',
73
+ 'montenegro', 'morocco', 'myanmar', 'namibia', 'nepal', 'netherlands', 'holland', 'new zealand', 'nigeria', 'norway', 'oman',
74
+ 'pakistan', 'panama', 'peru', 'philippines', 'poland', 'portugal', 'qatar', 'romania', 'russia', 'saudi arabia', 'scotland',
75
+ 'serbia', 'seychelles', 'singapore', 'slovakia', 'slovenia', 'south africa', 'spain', 'sri lanka', 'sweden', 'switzerland',
76
+ 'syria', 'taiwan', 'tanzania', 'thailand', 'tunisia', 'ukraine', 'united arab emirates', 'uae', 'united kingdom', 'uk',
77
+ 'united states', 'usa', 'america', 'uruguay', 'uzbekistan', 'venezuela', 'vietnam', 'wales', 'zambia', 'zimbabwe',
78
+ // regions and islands a photo is tagged by
79
+ 'bali', 'hainan', 'hawaii', 'tuscany', 'provence', 'andalusia', 'sicily', 'sardinia', 'corsica', 'crete', 'santorini', 'mykonos',
80
+ 'ibiza', 'mallorca', 'majorca', 'tenerife', 'canary islands', 'madeira', 'phuket', 'zanzibar', 'caribbean', 'patagonia', 'bavaria',
81
+ 'alps', 'dolomites', 'amalfi', 'cinque terre', 'lake como', 'galilee', 'golan', 'negev', 'phoenix island',
82
+ // cities
83
+ 'sanya', 'beijing', 'shanghai', 'hong kong', 'macau', 'tokyo', 'kyoto', 'osaka', 'seoul', 'bangkok', 'hanoi', 'saigon',
84
+ 'ho chi minh', 'kuala lumpur', 'manila', 'jakarta', 'dubai', 'abu dhabi', 'doha', 'istanbul', 'athens', 'rome',
85
+ 'venice', 'florence', 'milan', 'naples', 'paris', 'marseille', 'lyon', 'london', 'edinburgh', 'dublin', 'amsterdam',
86
+ 'brussels', 'berlin', 'munich', 'hamburg', 'vienna', 'prague', 'budapest', 'warsaw', 'krakow', 'copenhagen', 'stockholm', 'oslo',
87
+ 'helsinki', 'lisbon', 'porto', 'madrid', 'barcelona', 'seville', 'valencia', 'zurich', 'geneva', 'moscow', 'new york', 'manhattan',
88
+ 'brooklyn', 'chicago', 'los angeles', 'san francisco', 'las vegas', 'miami', 'boston', 'seattle', 'toronto', 'vancouver',
89
+ 'montreal', 'mexico city', 'cancun', 'havana', 'rio de janeiro', 'buenos aires', 'lima', 'cairo', 'marrakech', 'cape town',
90
+ 'sydney', 'melbourne', 'auckland', 'mumbai', 'delhi', 'jerusalem', 'tel aviv', 'haifa', 'eilat', 'jaffa', 'nazareth',
91
+ 'akko', 'tiberias', 'caesarea', 'netanya', 'herzliya', 'beersheba',
92
+ ];
93
+
94
+ /** The same, as a set of plain phrases. */
95
+ const PLACE_NAMES: ReadonlySet<string> = new Set(STOCK_PLACE_NAMES);
96
+ /** The longest place name, in words. */
97
+ const PLACE_MAX_WORDS = Math.max(...STOCK_PLACE_NAMES.map(p => p.split(' ').length));
98
+
99
+ /**
100
+ * A Hebrew site's own words for the parts and subjects above, as the English word a provider's tags carry (a heading
101
+ * "החלקת קרטין" is about `hair`). Compared whole after a one- or two-letter prefix (ה, ו, ב, ל, מ, ש, כ) is taken off;
102
+ * a two-word phrase first ("ארוחת בוקר" is breakfast, "ארוחת ערב" dinner).
103
+ */
104
+ export const STOCK_SUBJECTS_HE: Readonly<Record<string, string>> = {
105
+ 'ארוחת בוקר': 'breakfast', 'ארוחות בוקר': 'breakfast', 'ארוחת ערב': 'dinner', 'ארוחת צהריים': 'lunch', 'חדר שינה': 'bedroom',
106
+ 'שיער': 'hair', 'תספורת': 'haircut', 'תספורות': 'haircut', 'החלקה': 'straightening', 'החלקת': 'straightening', 'החלקות': 'straightening',
107
+ 'קרטין': 'keratin', 'תסרוקת': 'hairstyle', 'תסרוקות': 'hairstyle', 'גוונים': 'highlights',
108
+ 'מניקור': 'manicure', 'פדיקור': 'pedicure', 'ציפורניים': 'nail', 'ציפורן': 'nail', 'לק': 'manicure', 'איפור': 'makeup',
109
+ 'ריסים': 'eyelash', 'גבות': 'eyebrow', 'עיסוי': 'massage', 'עיסויים': 'massage', 'טיפולי פנים': 'facial', 'טיפול פנים': 'facial',
110
+ 'בראנץ': 'brunch', 'בראנץ׳': 'brunch', 'קפה': 'coffee', 'אספרסו': 'espresso', 'לחם': 'bread', 'מאפים': 'pastry', 'מאפה': 'pastry',
111
+ 'עוגה': 'cake', 'עוגות': 'cake', 'קרואסון': 'croissant', 'סוויטה': 'suite', 'סוויטות': 'suite', 'מיטה': 'bed', 'בריכה': 'pool',
112
+ 'ג׳קוזי': 'jacuzzi', "ג'קוזי": 'jacuzzi', 'גג': 'rooftop', 'מרפסת': 'terrace', 'גינה': 'garden', 'חצר': 'courtyard',
113
+ };
114
+ const HE_PREFIX = /^[הובלמשכ]/;
115
+ const HE_LETTERS = /[֐-׿]/;
116
+ const HTML_TAG = /<[^>]*>/g;
117
+ const TOKEN_SPLIT = /[^\p{L}\p{N}'׳]+/u;
118
+ /** A facet word this long counts in its longer forms. */
119
+ const FACET_STEM_MIN = 5;
120
+
121
+ /** A Hebrew word's English subject, trying it whole, then without one and two prefix letters. */
122
+ function hebrewSubject(word: string): string | undefined {
123
+ let w = word;
124
+ for (let i = 0; i < 3 && w.length >= 2; i++) {
125
+ const hit = STOCK_SUBJECTS_HE[w];
126
+ if (hit) return hit;
127
+ if (!HE_PREFIX.test(w)) return undefined;
128
+ w = w.slice(1);
129
+ }
130
+ return undefined;
131
+ }
132
+
133
+ /** The English subject words a Hebrew text names (phrases first), in order, as `stockWord`s. */
134
+ export function stockSubjectsHe(...texts: ReadonlyArray<unknown>): string[] {
135
+ const out: string[] = [];
136
+ for (const text of texts) {
137
+ if (typeof text !== 'string' || !HE_LETTERS.test(text)) continue;
138
+ const tokens = text.replace(HTML_TAG, ' ').split(TOKEN_SPLIT).filter(Boolean);
139
+ for (let i = 0; i < tokens.length; i++) {
140
+ const pair = i + 1 < tokens.length ? hebrewSubject(`${tokens[i]} ${tokens[i + 1]}`) ?? phraseWithPrefix(tokens[i], tokens[i + 1]) : undefined;
141
+ if (pair) { out.push(stockWord(pair)); i++; continue; }
142
+ const one = hebrewSubject(tokens[i]);
143
+ if (one) out.push(stockWord(one));
144
+ }
145
+ }
146
+ return [...new Set(out)];
147
+ }
148
+
149
+ /** A two-word phrase whose first word wears a prefix ("וארוחת בוקר"). */
150
+ function phraseWithPrefix(first: string, second: string): string | undefined {
151
+ let w = first;
152
+ for (let i = 0; i < 2 && HE_PREFIX.test(w); i++) {
153
+ w = w.slice(1);
154
+ const hit = STOCK_SUBJECTS_HE[`${w} ${second}`];
155
+ if (hit) return hit;
156
+ }
157
+ return undefined;
158
+ }
159
+
160
+ /**
161
+ * The words a place's OWN text says (the heading beside a picture, a sample item's name): its meaningful words in order,
162
+ * then — a Hebrew text — the English subjects it names (`STOCK_SUBJECTS_HE`). What the place's part and query are read from.
163
+ */
164
+ export function stockNearWords(...texts: ReadonlyArray<unknown>): string[] {
165
+ return [...new Set([...stockWords(...texts), ...stockSubjectsHe(...texts)])];
166
+ }
167
+
168
+ /** Per facet, its words as compared. */
169
+ const FACET_WORDS: ReadonlyArray<[string, ReadonlySet<string>]> = Object.entries(STOCK_FACETS).map(([id, words]) => [id, new Set(words.map(stockWord))]);
170
+
171
+ /** Does `word` name a word of `words` — whole, or a longer form of one of `FACET_STEM_MIN` letters or more? */
172
+ function namesFacetWord(word: string, words: ReadonlySet<string>): boolean {
173
+ if (words.has(word)) return true;
174
+ for (const w of words) if (w.length >= FACET_STEM_MIN && word.length > w.length && word.startsWith(w)) return true;
175
+ return false;
176
+ }
177
+
178
+ /** The parts of a business some words name (`STOCK_FACETS` ids), in the table's order. */
179
+ export function stockFacetsOf(words: ReadonlyArray<string>): string[] {
180
+ return FACET_WORDS.filter(([, set]) => words.some(w => namesFacetWord(w, set))).map(([id]) => id);
181
+ }
182
+
183
+ /** Every facet word (as asked: the table's spelling), by its compared form — a closed vocabulary a query may carry. */
184
+ export const STOCK_FACET_VOCABULARY: ReadonlyMap<string, string> = new Map(Object.values(STOCK_FACETS).flat().map(w => [stockWord(w), w]));
185
+
186
+ /** A photo's tags as plain phrases (accents gone, lower case, single spaces) — what a place name is looked for in. */
187
+ export function stockTagPhrases(tags: ReadonlyArray<string>): string[] {
188
+ return tags.map(t => String(t ?? '').normalize('NFD').replace(/\p{M}+/gu, '').toLowerCase().replace(/[^\p{L}\p{N}]+/gu, ' ').trim()).filter(Boolean);
189
+ }
190
+
191
+ /** The places on the map some phrases name (each a `STOCK_PLACE_NAMES` entry), each once. */
192
+ export function stockPlaceNamesIn(phrases: ReadonlyArray<string>): string[] {
193
+ const out = new Set<string>();
194
+ for (const phrase of phrases) {
195
+ const words = phrase.split(' ');
196
+ for (let i = 0; i < words.length; i++) {
197
+ for (let n = Math.min(PLACE_MAX_WORDS, words.length - i); n >= 1; n--) {
198
+ const name = words.slice(i, i + n).join(' ');
199
+ if (PLACE_NAMES.has(name)) { out.add(name); i += n - 1; break; }
200
+ }
201
+ }
202
+ }
203
+ return [...out];
204
+ }
@@ -181,6 +181,9 @@ export interface BusinessType {
181
181
  readonly uupm: string;
182
182
  /** Keywords (English + Hebrew): the eval's expected answer and the no-model fallback. */
183
183
  readonly match: ReadonlyArray<string>;
184
+ /** iox-ui#213: those of `match` that also DESCRIBE other businesses ("a boutique hotel", "a coffee shop") — they name
185
+ * this type only when no other type's keyword is in the words (`matchBusinessTypes`). Empty for most types. */
186
+ readonly qualifiers: ReadonlyArray<string>;
184
187
  /** The styles that suit it, best first, each with why. */
185
188
  readonly good: ReadonlyArray<GoodFit>;
186
189
  /** Colour v2 CV2: its mood and swatches, and (H1) the colour words its site NEVER wears (`<ingredient>.<word>`, harness
@@ -177,6 +177,7 @@ export const SPEC_BUSINESS_TYPES = [
177
177
  "צלם",
178
178
  "צילום"
179
179
  ],
180
+ "qualifiers": [],
180
181
  "good": [
181
182
  {
182
183
  "preset": "night-gallery",
@@ -337,10 +338,10 @@ export const SPEC_BUSINESS_TYPES = [
337
338
  "uupm": "161 Home Decoration & Interior Design · 84 Architecture / Interior",
338
339
  "match": [
339
340
  "interior",
340
- "interiors",
341
341
  "עיצוב פנים",
342
342
  "decor"
343
343
  ],
344
+ "qualifiers": [],
344
345
  "good": [
345
346
  {
346
347
  "preset": "gallery-minimal",
@@ -511,6 +512,7 @@ export const SPEC_BUSINESS_TYPES = [
511
512
  "architecture",
512
513
  "אדריכל"
513
514
  ],
515
+ "qualifiers": [],
514
516
  "good": [
515
517
  {
516
518
  "preset": "swiss-grid",
@@ -680,6 +682,7 @@ export const SPEC_BUSINESS_TYPES = [
680
682
  "סטודיו לעיצוב",
681
683
  "מיתוג"
682
684
  ],
685
+ "qualifiers": [],
683
686
  "good": [
684
687
  {
685
688
  "preset": "zine",
@@ -836,6 +839,7 @@ export const SPEC_BUSINESS_TYPES = [
836
839
  "ציור",
837
840
  "איור"
838
841
  ],
842
+ "qualifiers": [],
839
843
  "good": [
840
844
  {
841
845
  "preset": "zine",
@@ -992,7 +996,7 @@ export const SPEC_BUSINESS_TYPES = [
992
996
  "pottery",
993
997
  "stoneware",
994
998
  "handmade",
995
- "crafts",
999
+ "craft",
996
1000
  "maker",
997
1001
  "workshop",
998
1002
  "קרמיקה",
@@ -1000,6 +1004,7 @@ export const SPEC_BUSINESS_TYPES = [
1000
1004
  "עבודת יד",
1001
1005
  "סדנ"
1002
1006
  ],
1007
+ "qualifiers": [],
1003
1008
  "good": [
1004
1009
  {
1005
1010
  "preset": "warm-editorial",
@@ -1156,6 +1161,7 @@ export const SPEC_BUSINESS_TYPES = [
1156
1161
  "rings",
1157
1162
  "תכשיט"
1158
1163
  ],
1164
+ "qualifiers": [],
1159
1165
  "good": [
1160
1166
  {
1161
1167
  "preset": "quiet-luxury",
@@ -1316,6 +1322,7 @@ export const SPEC_BUSINESS_TYPES = [
1316
1322
  "ברבר",
1317
1323
  "מספרה לגברים"
1318
1324
  ],
1325
+ "qualifiers": [],
1319
1326
  "good": [
1320
1327
  {
1321
1328
  "preset": "ink-studio",
@@ -1469,6 +1476,7 @@ export const SPEC_BUSINESS_TYPES = [
1469
1476
  "עיסוי",
1470
1477
  "טיפולי"
1471
1478
  ],
1479
+ "qualifiers": [],
1472
1480
  "good": [
1473
1481
  {
1474
1482
  "preset": "soft-spa",
@@ -1684,8 +1692,10 @@ export const SPEC_BUSINESS_TYPES = [
1684
1692
  "מספרה",
1685
1693
  "סלון",
1686
1694
  "ציפורניים",
1687
- "קוסמטיקה"
1695
+ "קוסמטיקה",
1696
+ "שיער"
1688
1697
  ],
1698
+ "qualifiers": [],
1689
1699
  "good": [
1690
1700
  {
1691
1701
  "preset": "soft-spa",
@@ -1852,6 +1862,7 @@ export const SPEC_BUSINESS_TYPES = [
1852
1862
  "פילאטיס",
1853
1863
  "מדיטציה"
1854
1864
  ],
1865
+ "qualifiers": [],
1855
1866
  "good": [
1856
1867
  {
1857
1868
  "preset": "morning-glass",
@@ -2020,6 +2031,7 @@ export const SPEC_BUSINESS_TYPES = [
2020
2031
  "מחול",
2021
2032
  "ריקוד"
2022
2033
  ],
2034
+ "qualifiers": [],
2023
2035
  "good": [
2024
2036
  {
2025
2037
  "preset": "coral-studio",
@@ -2190,6 +2202,7 @@ export const SPEC_BUSINESS_TYPES = [
2190
2202
  "פסיכולוג",
2191
2203
  "טיפול רגשי"
2192
2204
  ],
2205
+ "qualifiers": [],
2193
2206
  "good": [
2194
2207
  {
2195
2208
  "preset": "fresh-practice",
@@ -2424,6 +2437,7 @@ export const SPEC_BUSINESS_TYPES = [
2424
2437
  "רופא",
2425
2438
  "פיזיותרפיה"
2426
2439
  ],
2440
+ "qualifiers": [],
2427
2441
  "good": [
2428
2442
  {
2429
2443
  "preset": "clear-care",
@@ -2659,6 +2673,7 @@ export const SPEC_BUSINESS_TYPES = [
2659
2673
  "שיניים",
2660
2674
  "רופא שיניים"
2661
2675
  ],
2676
+ "qualifiers": [],
2662
2677
  "good": [
2663
2678
  {
2664
2679
  "preset": "fresh-practice",
@@ -2881,9 +2896,10 @@ export const SPEC_BUSINESS_TYPES = [
2881
2896
  "dog",
2882
2897
  "groom",
2883
2898
  "וטרינר",
2884
- "כלבים",
2899
+ "כלב",
2885
2900
  "חיות"
2886
2901
  ],
2902
+ "qualifiers": [],
2887
2903
  "good": [
2888
2904
  {
2889
2905
  "preset": "little-ones",
@@ -3077,6 +3093,7 @@ export const SPEC_BUSINESS_TYPES = [
3077
3093
  "שף",
3078
3094
  "ביסטרו"
3079
3095
  ],
3096
+ "qualifiers": [],
3080
3097
  "good": [
3081
3098
  {
3082
3099
  "preset": "warm-editorial",
@@ -3247,6 +3264,7 @@ export const SPEC_BUSINESS_TYPES = [
3247
3264
  "מאפייה",
3248
3265
  "קונדיטוריה"
3249
3266
  ],
3267
+ "qualifiers": [],
3250
3268
  "good": [
3251
3269
  {
3252
3270
  "preset": "corner-cafe",
@@ -3416,6 +3434,7 @@ export const SPEC_BUSINESS_TYPES = [
3416
3434
  "יין",
3417
3435
  "בירה"
3418
3436
  ],
3437
+ "qualifiers": [],
3419
3438
  "good": [
3420
3439
  {
3421
3440
  "preset": "quiet-luxury",
@@ -3579,6 +3598,13 @@ export const SPEC_BUSINESS_TYPES = [
3579
3598
  "אופנה",
3580
3599
  "חנות"
3581
3600
  ],
3601
+ "qualifiers": [
3602
+ "boutique",
3603
+ "shop",
3604
+ "store",
3605
+ "בוטיק",
3606
+ "חנות"
3607
+ ],
3582
3608
  "good": [
3583
3609
  {
3584
3610
  "preset": "gallery-minimal",
@@ -3725,13 +3751,14 @@ export const SPEC_BUSINESS_TYPES = [
3725
3751
  "uupm": "62 Florist/Plant Shop",
3726
3752
  "match": [
3727
3753
  "florist",
3728
- "flowers",
3729
- "plants",
3754
+ "flower",
3755
+ "plant",
3730
3756
  "bouquet",
3731
- "פרחים",
3757
+ "פרח",
3732
3758
  "צמחים",
3733
3759
  "זרים"
3734
3760
  ],
3761
+ "qualifiers": [],
3735
3762
  "good": [
3736
3763
  {
3737
3764
  "preset": "garden-party",
@@ -3890,9 +3917,10 @@ export const SPEC_BUSINESS_TYPES = [
3890
3917
  "home goods",
3891
3918
  "homeware",
3892
3919
  "decor shop",
3893
- "רהיטים",
3920
+ "רהיט",
3894
3921
  "כלי בית"
3895
3922
  ],
3923
+ "qualifiers": [],
3896
3924
  "good": [
3897
3925
  {
3898
3926
  "preset": "warm-editorial",
@@ -4048,6 +4076,7 @@ export const SPEC_BUSINESS_TYPES = [
4048
4076
  "יועץ",
4049
4077
  "ייעוץ"
4050
4078
  ],
4079
+ "qualifiers": [],
4051
4080
  "good": [
4052
4081
  {
4053
4082
  "preset": "trusted-advisor",
@@ -4247,6 +4276,7 @@ export const SPEC_BUSINESS_TYPES = [
4247
4276
  "אימון אישי",
4248
4277
  "קואצ'ינג"
4249
4278
  ],
4279
+ "qualifiers": [],
4250
4280
  "good": [
4251
4281
  {
4252
4282
  "preset": "morning-glass",
@@ -4437,9 +4467,12 @@ export const SPEC_BUSINESS_TYPES = [
4437
4467
  "accounting",
4438
4468
  "עורך דין",
4439
4469
  "עורכת דין",
4470
+ "עורכי דין",
4440
4471
  "רואה חשבון",
4472
+ "רואי חשבון",
4441
4473
  "משפט"
4442
4474
  ],
4475
+ "qualifiers": [],
4443
4476
  "good": [
4444
4477
  {
4445
4478
  "preset": "trusted-advisor",
@@ -4669,11 +4702,13 @@ export const SPEC_BUSINESS_TYPES = [
4669
4702
  "real estate",
4670
4703
  "realtor",
4671
4704
  "property",
4672
- "apartments",
4705
+ "apartment",
4673
4706
  "נדל\"ן",
4674
4707
  "נדלן",
4708
+ "דירה",
4675
4709
  "דירות"
4676
4710
  ],
4711
+ "qualifiers": [],
4677
4712
  "good": [
4678
4713
  {
4679
4714
  "preset": "holiday-light",
@@ -4841,9 +4876,10 @@ export const SPEC_BUSINESS_TYPES = [
4841
4876
  "volunteer",
4842
4877
  "community",
4843
4878
  "עמותה",
4844
- "מתנדבים",
4879
+ "מתנדב",
4845
4880
  "קהילה"
4846
4881
  ],
4882
+ "qualifiers": [],
4847
4883
  "good": [
4848
4884
  {
4849
4885
  "preset": "kind-community",
@@ -5025,15 +5061,16 @@ export const SPEC_BUSINESS_TYPES = [
5025
5061
  "match": [
5026
5062
  "venue",
5027
5063
  "wedding",
5028
- "events",
5029
5064
  "event",
5030
5065
  "hall",
5031
5066
  "festival",
5032
5067
  "אולם",
5068
+ "חתונה",
5033
5069
  "חתונות",
5034
- "אירועים",
5070
+ "אירוע",
5035
5071
  "גן אירועים"
5036
5072
  ],
5073
+ "qualifiers": [],
5037
5074
  "good": [
5038
5075
  {
5039
5076
  "preset": "garden-party",
@@ -5195,6 +5232,7 @@ export const SPEC_BUSINESS_TYPES = [
5195
5232
  "צימר",
5196
5233
  "אירוח"
5197
5234
  ],
5235
+ "qualifiers": [],
5198
5236
  "good": [
5199
5237
  {
5200
5238
  "preset": "holiday-light",
@@ -5350,18 +5388,19 @@ export const SPEC_BUSINESS_TYPES = [
5350
5388
  "uupm": "153 Music Instrument Learning · 56 Childcare/Daycare",
5351
5389
  "match": [
5352
5390
  "tutor",
5353
- "lessons",
5391
+ "lesson",
5354
5392
  "teacher",
5355
5393
  "classes",
5356
5394
  "school",
5357
- "music lessons",
5395
+ "music lesson",
5358
5396
  "kids",
5359
5397
  "מורה",
5360
- "שיעורים",
5398
+ "שיעור",
5361
5399
  "חוג",
5362
5400
  "חוגים",
5363
5401
  "ילדים"
5364
5402
  ],
5403
+ "qualifiers": [],
5365
5404
  "good": [
5366
5405
  {
5367
5406
  "preset": "little-ones",
@@ -38,14 +38,27 @@ export interface BusinessTypeMatch {
38
38
  score: number;
39
39
  }
40
40
 
41
- /** The kind of business the words name, best first; empty when none of the keywords appears. Ties keep the board's order. */
41
+ /**
42
+ * The kind of business the words name, best first; empty when none of the keywords appears. Ties keep the board's order.
43
+ *
44
+ * A QUALIFIER (`BusinessType.qualifiers` — "boutique", "shop", "בוטיק") is a word that also describes other businesses: in
45
+ * "a boutique hotel", "a boutique law firm" or "מספרה בוטיק" it says how, not what. So a qualifier counts only when the
46
+ * words hold no plain keyword at all — "a boutique selling linen dresses" is still a boutique, "a boutique hotel" a hotel,
47
+ * whatever their letter counts (iox-ui#213: "boutique" (8) used to outweigh "hotel" (5)).
48
+ */
42
49
  export function matchBusinessTypes(text: string, types: ReadonlyArray<BusinessType> = BUSINESS_TYPES): BusinessTypeMatch[] {
43
50
  const words = (text ?? '').toLocaleLowerCase();
44
51
  if (!words.trim()) return [];
45
- return types
46
- .map((type, order) => {
47
- const keywords = keywordsIn(words, type.match);
48
- return { id: type.id, keywords, score: keywords.reduce((n, k) => n + k.length, 0), order };
52
+ const found = types.map((type, order) => {
53
+ const keywords = keywordsIn(words, type.match);
54
+ const qualifiers = type.qualifiers ?? [];
55
+ return { type, order, keywords, plain: keywords.filter(k => !qualifiers.includes(k)) };
56
+ });
57
+ const anyPlain = found.some(f => f.plain.length > 0);
58
+ return found
59
+ .map(({ type, order, keywords, plain }) => {
60
+ const counted = anyPlain ? plain : keywords;
61
+ return { id: type.id, keywords: counted, score: counted.reduce((n, k) => n + k.length, 0), order };
49
62
  })
50
63
  .filter(m => m.score > 0)
51
64
  .sort((a, b) => b.score - a.score || a.order - b.order)
@@ -188,9 +188,40 @@ function validKey(key: unknown, colour: boolean): key is SceneKey {
188
188
  return colour ? typeof value === 'string' && COLOUR.test(value) : typeof value === 'number' && Number.isFinite(value);
189
189
  }
190
190
 
191
+ /** What a track is plotted on: its property, its range and, for a Clip, its direction — one timeline each. */
192
+ const timelineOf = (track: { prop: string; range?: string; from?: string }): string =>
193
+ `${track.prop}|${track.range ?? SceneRange.Hold}|${track.prop === SceneProp.Clip ? track.from ?? '' : ''}`;
194
+
195
+ /**
196
+ * Tracks on ONE timeline (the same property and range; a Clip's same direction) are pieces of one movement: their keys
197
+ * merge into the first one's track, ascending by progress (an exact repeat dropped), its ease kept. A step that fades in
198
+ * and later out (`[0.4, 0] → [0.5, 1]` and `[0.6, 1] → [0.7, 0]`) reads as one track — read as two, the later piece held
199
+ * its first key before it began and the step stood at full opacity over the step before it (iox-ui#195). The one rule
200
+ * both renderers read through `normalizeTracks`, and the composer stamps its tracks with. Pure.
201
+ */
202
+ export function mergeSceneTracks<T extends { prop: string; keys: ReadonlyArray<readonly [number, number | string]>; range?: string; from?: string }>(tracks: ReadonlyArray<T>): T[] {
203
+ const out: T[] = [];
204
+ const at = new Map<string, number>();
205
+ for (const track of tracks) {
206
+ const line = timelineOf(track);
207
+ const i = at.get(line);
208
+ if (i === undefined) {
209
+ at.set(line, out.length);
210
+ out.push(track);
211
+ continue;
212
+ }
213
+ const keys = [...out[i].keys, ...track.keys]
214
+ .sort((a, b) => a[0] - b[0])
215
+ .filter((key, k, all) => !k || all[k - 1][0] !== key[0] || all[k - 1][1] !== key[1]);
216
+ out[i] = { ...out[i], keys };
217
+ }
218
+ return out;
219
+ }
220
+
191
221
  /**
192
222
  * The tracks a saved value really holds: unknown properties, bad keys and colours that are not colours are dropped,
193
- * keys sorted by progress, a track left with no key dropped. Never throws on what a page document holds.
223
+ * keys sorted by progress, a track left with no key dropped, and tracks on one timeline merged (`mergeSceneTracks`).
224
+ * Never throws on what a page document holds.
194
225
  */
195
226
  export function normalizeTracks(tracks: unknown): SceneTrack[] {
196
227
  if (!Array.isArray(tracks)) return [];
@@ -212,7 +243,7 @@ export function normalizeTracks(tracks: unknown): SceneTrack[] {
212
243
  ...(typeof range === 'string' && RANGES.has(range) && range !== SceneRange.Hold ? { range } : {}),
213
244
  });
214
245
  }
215
- return out;
246
+ return mergeSceneTracks(out);
216
247
  }
217
248
 
218
249
  /**
@@ -320,7 +351,7 @@ const TRANSFORM_REST: Readonly<Partial<Record<SceneProp, number>>> = { [ScenePro
320
351
  */
321
352
  export function sceneFrame(tracks: ReadonlyArray<SceneTrack>, p: number | SceneProgress, options: SceneFrameOptions = {}): SceneFrame {
322
353
  const frame: SceneFrame = {};
323
- // Per property and range, the last track wins (as one list always read). Across ranges they compose: a hold that
354
+ // Per property and range, the last track wins (normalized tracks hold one per timeline — `mergeSceneTracks`). Across ranges they compose: a hold that
324
355
  // carries a layer and an exit that sinks it add their moves, and their scales and opacities multiply.
325
356
  const byRange = new Map<string, { prop: SceneProp; value: number | string; from?: SceneRevealFrom }>();
326
357
  for (const track of tracks) {