@vectoriox/iox-ui 5.195.0 → 5.197.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/composite-core/index.d.ts +15 -2
- package/data-core/index.d.ts +101 -2
- package/design-core/index.d.ts +374 -8
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +41 -12
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +192 -2
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +749 -264
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1084 -630
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +224 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs +11 -5
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +100 -17
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +351 -109
- package/harness-core/index.d.ts +166 -4
- package/identity-core/index.d.ts +8 -1
- package/index.d.ts +23 -2
- package/package.json +1 -1
- package/src/composite-core/account-runtime.ts +2 -2
- package/src/composite-core/header.ts +23 -1
- package/src/composite-core/slider-runtime.ts +16 -8
- package/src/data-core/placeholder-rows.ts +220 -0
- package/src/data-core/public-api.ts +2 -1
- package/src/design-core/contrast-audit.ts +38 -0
- package/src/design-core/flavor-spec.generated.ts +275 -1
- package/src/design-core/header-behaviour.ts +180 -3
- package/src/design-core/node-classes.ts +9 -2
- package/src/design-core/node-links.ts +34 -0
- package/src/generation-core/audit-site.ts +10 -1
- package/src/generation-core/audit-words.ts +5 -0
- package/src/generation-core/check-free.ts +21 -3
- package/src/generation-core/compose-site.ts +57 -17
- package/src/generation-core/free-opening.ts +57 -0
- package/src/generation-core/header-mix.ts +245 -12
- package/src/generation-core/item-fill.ts +42 -0
- package/src/generation-core/nav-shape.ts +45 -16
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/opening-mix.ts +10 -0
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/site-build-run.ts +4 -0
- package/src/generation-core/site-spec.generated.ts +41 -9
- package/src/generation-core/stock-search.ts +106 -18
- package/src/generation-core/type-led.ts +19 -4
- package/src/harness-core/business-types.ts +11 -0
- package/src/harness-core/harness-spec.generated.ts +213 -0
- package/src/harness-core/run-compose-context.ts +12 -4
- package/src/identity-core/site-auth-transport.ts +11 -4
- package/styles/iox-design.css +149 -6
|
@@ -8356,6 +8356,7 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8356
8356
|
"solid",
|
|
8357
8357
|
"over",
|
|
8358
8358
|
"glass",
|
|
8359
|
+
"over-glass",
|
|
8359
8360
|
"blend"
|
|
8360
8361
|
],
|
|
8361
8362
|
"shape": [
|
|
@@ -8444,6 +8445,7 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8444
8445
|
"ground.solid": "its own ground",
|
|
8445
8446
|
"ground.over": "over the opening, transparent until the page moves",
|
|
8446
8447
|
"ground.glass": "frosted glass (a look with a blur)",
|
|
8448
|
+
"ground.over-glass": "over the opening and clear at first; frosted glass once the page moves",
|
|
8447
8449
|
"ground.blend": "blends with what is under it, readable over any picture",
|
|
8448
8450
|
"shape.bar": "a full-width bar",
|
|
8449
8451
|
"shape.pill": "one floating rounded bar",
|
|
@@ -8509,6 +8511,7 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8509
8511
|
"ground.solid": "רקע משלו",
|
|
8510
8512
|
"ground.over": "מעל הפתיחה, שקוף עד שהדף זז",
|
|
8511
8513
|
"ground.glass": "זכוכית חלבית (מראה עם טשטוש)",
|
|
8514
|
+
"ground.over-glass": "מעל הפתיחה ושקופה בהתחלה; זכוכית חלבית ברגע שהדף זז",
|
|
8512
8515
|
"ground.blend": "נבלע במה שמתחתיו, קריא מעל כל תמונה",
|
|
8513
8516
|
"shape.bar": "פס ברוחב מלא",
|
|
8514
8517
|
"shape.pill": "פס מעוגל אחד שמרחף",
|
|
@@ -8564,14 +8567,6 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8564
8567
|
"phase": "HI6",
|
|
8565
8568
|
"drawnAs": "links"
|
|
8566
8569
|
},
|
|
8567
|
-
"ground.over": {
|
|
8568
|
-
"phase": "HI3",
|
|
8569
|
-
"drawnAs": "solid"
|
|
8570
|
-
},
|
|
8571
|
-
"ground.glass": {
|
|
8572
|
-
"phase": "HI3",
|
|
8573
|
-
"drawnAs": "solid"
|
|
8574
|
-
},
|
|
8575
8570
|
"ground.blend": {
|
|
8576
8571
|
"phase": "HI3",
|
|
8577
8572
|
"drawnAs": "solid"
|
|
@@ -8644,6 +8639,17 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8644
8639
|
"wordsHe": "שם ודפים · כפתור אחד · מגירה בטלפון",
|
|
8645
8640
|
"mix": {}
|
|
8646
8641
|
},
|
|
8642
|
+
{
|
|
8643
|
+
"id": "over-picture",
|
|
8644
|
+
"name": "Over the picture",
|
|
8645
|
+
"nameHe": "מעל התמונה",
|
|
8646
|
+
"words": "Over the opening, then glass · one button",
|
|
8647
|
+
"wordsHe": "מעל הפתיחה, ואז זכוכית · כפתור אחד",
|
|
8648
|
+
"mix": {
|
|
8649
|
+
"ground": "over-glass",
|
|
8650
|
+
"edge": "none"
|
|
8651
|
+
}
|
|
8652
|
+
},
|
|
8647
8653
|
{
|
|
8648
8654
|
"id": "card",
|
|
8649
8655
|
"name": "Card from the button",
|
|
@@ -8742,7 +8748,33 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8742
8748
|
"pinnedMax": 1,
|
|
8743
8749
|
"inlineRoomPx": 1100,
|
|
8744
8750
|
"betweenNameEm": 7,
|
|
8745
|
-
"betweenMinPages": 2
|
|
8751
|
+
"betweenMinPages": 2,
|
|
8752
|
+
"overFrames": [
|
|
8753
|
+
"full",
|
|
8754
|
+
"shrinks",
|
|
8755
|
+
"grows"
|
|
8756
|
+
],
|
|
8757
|
+
"overMedia": [
|
|
8758
|
+
"photo",
|
|
8759
|
+
"film",
|
|
8760
|
+
"slideshow",
|
|
8761
|
+
"object",
|
|
8762
|
+
"material"
|
|
8763
|
+
],
|
|
8764
|
+
"glassFlavors": [
|
|
8765
|
+
"crisp",
|
|
8766
|
+
"linen",
|
|
8767
|
+
"midnight",
|
|
8768
|
+
"glass",
|
|
8769
|
+
"bloom"
|
|
8770
|
+
],
|
|
8771
|
+
"glassIsOwnBar": [
|
|
8772
|
+
"glass"
|
|
8773
|
+
],
|
|
8774
|
+
"noEdgeGrounds": [
|
|
8775
|
+
"glass",
|
|
8776
|
+
"over-glass"
|
|
8777
|
+
]
|
|
8746
8778
|
},
|
|
8747
8779
|
"references": [
|
|
8748
8780
|
{
|
|
@@ -14,11 +14,15 @@ import type { StockTarget } from './stock-photos';
|
|
|
14
14
|
* picture; a stranger, or a street at night, under a person's name is a made-up fact about the business.
|
|
15
15
|
* - WHAT is asked (`stockSearchQuery`): closed English words only (LS-D3) — the business type's own keyword and at most one
|
|
16
16
|
* subject word for the place. Nothing the owner typed (a name, a phone, an address) ever reaches the provider.
|
|
17
|
-
* - WHAT is never taken (`stockPhotoFits`): a photo whose words speak of crime, injury, ruin or a
|
|
18
|
-
* `STOCK_NEVER_PHRASES`), or — for a trade people trust with their money, health or rights — of what
|
|
19
|
-
* (`STOCK_TRADE_NEVER_WORDS`); and an
|
|
20
|
-
*
|
|
21
|
-
* "salon" alone is a drawing room, "salon" + "hair" is a hair salon
|
|
17
|
+
* - WHAT is never taken (`stockPhotoFits`): a photo whose words speak of crime, injury, ruin, a joke or a state's emblem
|
|
18
|
+
* (`STOCK_NEVER_WORDS`, `STOCK_NEVER_PHRASES`), or — for a trade people trust with their money, health or rights — of what
|
|
19
|
+
* that trade fears (`STOCK_TRADE_NEVER_WORDS`); and an unreviewed photo that does not show the business: an OPENING (an
|
|
20
|
+
* atmosphere place: a hero, a page header, a call to action) names it twice (`STOCK_OPENING_TYPE_WORDS` of the type's
|
|
21
|
+
* vocabulary — "salon" alone is a drawing room, "salon" + "hair" is a hair salon), every other place at least once
|
|
22
|
+
* (`STOCK_PLACE_TYPE_WORDS`, iox-ui#175 — a law firm's About never shows a clothing boutique, a salon's service never a
|
|
23
|
+
* street at night). The vocabulary is the type's own words and what its photos are tagged with (`STOCK_TRADE_WORDS`); an
|
|
24
|
+
* item's own name vouches too. A word that names ANOTHER trade's place (`STOCK_TRADE_PLACE_WORDS`: a boutique, a bar) is
|
|
25
|
+
* never asked for and never vouches — "Boutique law firm" asked Pixabay for "law boutique" and got a clothes shop.
|
|
22
26
|
*
|
|
23
27
|
* The provider side (Pixabay) already asks `image_type=photo` and `safesearch=true` and drops people, brands and generated
|
|
24
28
|
* pictures by their tags; this is what the PLATFORM decides on top, the same for every provider.
|
|
@@ -49,10 +53,12 @@ export const STOCK_NEVER_WORDS: ReadonlySet<string> = new Set([
|
|
|
49
53
|
'cocaine', 'abandoned', 'derelict', 'ruin', 'decay', 'decayed', 'dilapidated', 'demolition', 'rotten', 'trash',
|
|
50
54
|
'garbage', 'rubbish', 'dirty', 'homeless', 'riot', 'caricature', 'cartoon', 'figurine', 'clipart', 'illustration', 'vector',
|
|
51
55
|
'meme', 'joke', 'funny', 'humor', 'humour', 'halloween', 'horror', 'creepy', 'zombie',
|
|
56
|
+
// iox-ui#175: a state's emblem says the business speaks for a state (the Pro law firm's "imperial eagle").
|
|
57
|
+
'emblem', 'imperial',
|
|
52
58
|
].map(stockWord));
|
|
53
59
|
|
|
54
60
|
/** Phrases that say the same where no one word does ("lost places" — the photography of abandoned buildings). */
|
|
55
|
-
export const STOCK_NEVER_PHRASES: ReadonlyArray<string> = ['lost place', 'lost places', 'tax evasion', 'urban exploration', 'urbex'];
|
|
61
|
+
export const STOCK_NEVER_PHRASES: ReadonlyArray<string> = ['lost place', 'lost places', 'tax evasion', 'urban exploration', 'urbex', 'coat of arms'];
|
|
56
62
|
|
|
57
63
|
/**
|
|
58
64
|
* Per business type (harness-core id), what a trade people trust with their rights, money or health never shows on its
|
|
@@ -60,7 +66,8 @@ export const STOCK_NEVER_PHRASES: ReadonlyArray<string> = ['lost place', 'lost p
|
|
|
60
66
|
* sells by (an accountant's tax, a lawyer's court) — the universal list already keeps the joke about it out.
|
|
61
67
|
*/
|
|
62
68
|
export const STOCK_TRADE_NEVER_WORDS: Readonly<Record<string, ReadonlyArray<string>>> = {
|
|
63
|
-
|
|
69
|
+
// iox-ui#175: another country's law ("The basic law, germany") is not the law this firm practises.
|
|
70
|
+
'law-accounting': ['debt', 'bankruptcy', 'bankrupt', 'guilty', 'crisis', 'stress', 'eviction', 'divorce', 'germany', 'german', 'constitution'],
|
|
64
71
|
consultant: ['debt', 'bankruptcy', 'bankrupt', 'crisis', 'stress'],
|
|
65
72
|
coach: ['crisis', 'stress', 'depression', 'sad', 'lonely'],
|
|
66
73
|
therapist: ['depression', 'sad', 'lonely', 'suicide', 'crying', 'tear', 'anxiety', 'stress'],
|
|
@@ -69,8 +76,61 @@ export const STOCK_TRADE_NEVER_WORDS: Readonly<Record<string, ReadonlyArray<stri
|
|
|
69
76
|
vet: ['sick', 'injured', 'pain', 'syringe', 'needle', 'injection', 'surgery', 'stray', 'cage'],
|
|
70
77
|
};
|
|
71
78
|
|
|
79
|
+
/**
|
|
80
|
+
* iox-ui#175 — per business type (harness-core id), the words a stock photo of that trade is tagged with when it does not
|
|
81
|
+
* say the trade's own name: a hairdresser, a manicure, a barbershop are a salon's; a gavel, a contract, a notary a law
|
|
82
|
+
* firm's. With the type's label, keywords and imagery they are its VOCABULARY (`stockFitFor`) — what a photo must name to
|
|
83
|
+
* show the business. Every type that may show stock has a row (spec). English only (the provider's tags), compared as
|
|
84
|
+
* `stockWord`s, and a word of four letters or more counts in its longer forms (`hair` → `hairdressing`).
|
|
85
|
+
*/
|
|
86
|
+
export const STOCK_TRADE_WORDS: Readonly<Record<string, ReadonlyArray<string>>> = {
|
|
87
|
+
spa: ['sauna', 'towel', 'aromatherapy', 'relaxation', 'relax', 'treatment', 'jacuzzi', 'hammam', 'pool', 'stones'],
|
|
88
|
+
salon: ['hairdresser', 'barber', 'barbershop', 'manicure', 'manicurist', 'pedicure', 'fingernail', 'beautician', 'cosmetic', 'cosmetics', 'makeup', 'lash', 'eyelash', 'shampoo', 'scissors', 'comb', 'polish'],
|
|
89
|
+
yoga: ['mat', 'asana', 'lotus', 'pose', 'stretching', 'zen', 'mindfulness'],
|
|
90
|
+
fitness: ['workout', 'exercise', 'dumbbell', 'barbell', 'kettlebell', 'treadmill', 'weights', 'sport', 'athlete'],
|
|
91
|
+
therapist: ['couch', 'armchair', 'counseling', 'counselling', 'psychotherapy', 'mindfulness'],
|
|
92
|
+
clinic: ['health', 'healthcare', 'medicine', 'stethoscope', 'rehabilitation', 'wellbeing'],
|
|
93
|
+
dental: ['tooth', 'teeth', 'dentistry', 'toothbrush', 'orthodontic', 'braces', 'smile'],
|
|
94
|
+
vet: ['cat', 'puppy', 'kitten', 'veterinarian', 'paw', 'animal'],
|
|
95
|
+
restaurant: ['dining', 'dinner', 'dish', 'meal', 'plate', 'cuisine', 'cooking', 'gourmet', 'table'],
|
|
96
|
+
'cafe-bakery': ['espresso', 'cappuccino', 'latte', 'barista', 'croissant', 'pastry', 'cake', 'bread', 'muffin', 'dessert', 'breakfast', 'brunch', 'cookie'],
|
|
97
|
+
'bar-winery': ['beer', 'whiskey', 'whisky', 'vineyard', 'grape', 'barrel', 'pub', 'bartender', 'glass'],
|
|
98
|
+
boutique: ['dress', 'apparel', 'garment', 'outfit', 'shoe', 'handbag', 'textile', 'wardrobe'],
|
|
99
|
+
florist: ['rose', 'tulip', 'blossom', 'floral', 'peony', 'orchid', 'succulent', 'greenery', 'vase'],
|
|
100
|
+
'home-goods': ['sofa', 'chair', 'table', 'lamp', 'interior', 'cushion', 'armchair', 'shelf', 'vase'],
|
|
101
|
+
consultant: ['meeting', 'business', 'planning', 'presentation', 'chart', 'office', 'desk', 'teamwork'],
|
|
102
|
+
coach: ['meeting', 'conversation', 'notebook', 'goal', 'growth', 'motivation'],
|
|
103
|
+
'law-accounting': ['justice', 'court', 'judge', 'gavel', 'contract', 'notary', 'tax', 'finance', 'paperwork', 'document', 'signature', 'desk', 'agreement'],
|
|
104
|
+
nonprofit: ['donation', 'solidarity', 'fundraising', 'charity'],
|
|
105
|
+
'venue-events': ['banquet', 'ballroom', 'celebration', 'reception', 'ceremony', 'catering', 'party'],
|
|
106
|
+
'hotel-bnb': ['bedroom', 'bed', 'suite', 'resort', 'hospitality', 'lobby', 'pillow', 'accommodation', 'villa', 'inn', 'hostel'],
|
|
107
|
+
classes: ['classroom', 'education', 'learning', 'student', 'study', 'piano', 'guitar', 'blackboard'],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* iox-ui#175 — words that name a KIND of business by its place (compared as `stockWord`s). For a type whose vocabulary
|
|
112
|
+
* does not hold one, it is another trade: never the query's subject word (Pixabay answers "law boutique" with a clothes
|
|
113
|
+
* shop) and never a word that vouches for a photo.
|
|
114
|
+
*/
|
|
115
|
+
export const STOCK_TRADE_PLACE_WORDS: ReadonlySet<string> = new Set([
|
|
116
|
+
'salon', 'shop', 'store', 'boutique', 'restaurant', 'cafe', 'bar', 'pub', 'bistro', 'bakery', 'cellar', 'winery', 'brewery',
|
|
117
|
+
'gym', 'clinic', 'spa', 'sauna', 'hotel', 'studio', 'workshop', 'market', 'vineyard', 'barbershop', 'office',
|
|
118
|
+
].map(stockWord));
|
|
119
|
+
|
|
120
|
+
/** Words of an imagery line that say how a picture is TAKEN or who gives it, never what it shows ("Real people (with
|
|
121
|
+
* permission)", "never stock", "on plain grounds") — left out of the vocabulary (iox-ui#175). */
|
|
122
|
+
const IMAGERY_NOISE: ReadonlySet<string> = new Set([
|
|
123
|
+
'real', 'people', 'permission', 'needed', 'stock', 'plain', 'ground', 'close', 'treat', 'help', 'working', 'before', 'after',
|
|
124
|
+
'face', 'own', 'never', 'large', 'uncropped', 'clean', 'healed', 'true', 'flat', 'natural', 'light', 'daylight', 'calm',
|
|
125
|
+
'portrait', 'good', 'piece', 'wearing', 'need',
|
|
126
|
+
].map(stockWord));
|
|
127
|
+
|
|
72
128
|
/** An opening's unreviewed photo names the business this many times (distinct words of the type's vocabulary). */
|
|
73
129
|
export const STOCK_OPENING_TYPE_WORDS = 2;
|
|
130
|
+
/** iox-ui#175: every other place's unreviewed photo names it at least this many times. */
|
|
131
|
+
export const STOCK_PLACE_TYPE_WORDS = 1;
|
|
132
|
+
/** A vocabulary word this long counts in its longer forms (`hair` → `hairdresser`); a shorter one only whole (`law`). */
|
|
133
|
+
const STEM_MIN = 4;
|
|
74
134
|
|
|
75
135
|
/** The intents an opening stands as — wide places the visitor reads as "this is the business". */
|
|
76
136
|
const OPENING_INTENTS: ReadonlySet<string> = new Set([StockIntent.Atmosphere]);
|
|
@@ -140,8 +200,10 @@ const SUBJECT_VOCABULARY: ReadonlyMap<StockSubject, ReadonlyMap<string, string>>
|
|
|
140
200
|
* first, then the words around the place, then the type's imagery line — the first that names a subject its intent takes,
|
|
141
201
|
* its best subject first. None: the base query.
|
|
142
202
|
*/
|
|
143
|
-
export function stockSearchFocus(slot: StockTarget, type: Pick<StockSearchType, 'imagery'>, term: string): string | null {
|
|
144
|
-
|
|
203
|
+
export function stockSearchFocus(slot: StockTarget, type: StockSearchType | Pick<StockSearchType, 'imagery'>, term: string): string | null {
|
|
204
|
+
// iox-ui#175: another trade's place word is never the subject ("Boutique law firm" → never "law boutique").
|
|
205
|
+
const vocabulary = 'label' in type ? stockFitFor(type).vocabulary : new Set<string>();
|
|
206
|
+
const words = [...(slot.kind === 'item' ? slot.subject ?? [] : []), ...slot.words, ...stockWords(type.imagery)].filter(w => !foreignTrade(w, vocabulary));
|
|
145
207
|
const asked = new Set(term.split(' ').map(stockWord));
|
|
146
208
|
for (const subject of STOCK_INTENT_SUBJECTS[slot.intent as StockIntent] ?? []) {
|
|
147
209
|
const vocabulary = SUBJECT_VOCABULARY.get(subject)!;
|
|
@@ -173,32 +235,58 @@ export const STOCK_FIT_ANY: StockFit = { never: STOCK_NEVER_WORDS, vocabulary: n
|
|
|
173
235
|
/** What a photo is held to on a site of `type`. */
|
|
174
236
|
export function stockFitFor(type: StockSearchType | null | undefined): StockFit {
|
|
175
237
|
if (!type) return STOCK_FIT_ANY;
|
|
176
|
-
const
|
|
238
|
+
const fears = (type.id ? STOCK_TRADE_NEVER_WORDS[type.id] : undefined) ?? [];
|
|
239
|
+
const tagged = (type.id ? STOCK_TRADE_WORDS[type.id] : undefined) ?? [];
|
|
177
240
|
const latin = (type.match ?? []).map(plain).filter(k => LATIN_KEYWORD.test(k));
|
|
178
241
|
return {
|
|
179
|
-
never: new Set([...STOCK_NEVER_WORDS, ...
|
|
180
|
-
vocabulary: new Set(stockWords(type.label, ...latin, type.imagery)),
|
|
242
|
+
never: new Set([...STOCK_NEVER_WORDS, ...fears.map(stockWord)]),
|
|
243
|
+
vocabulary: new Set([...stockWords(type.label, ...latin, ...tagged), ...stockWords(type.imagery).filter(w => !IMAGERY_NOISE.has(w))]),
|
|
181
244
|
};
|
|
182
245
|
}
|
|
183
246
|
|
|
247
|
+
/** Does `word` name one of `words` — whole, or in a longer form of a word of `STEM_MIN` letters or more? */
|
|
248
|
+
function namesOneOf(word: string, words: ReadonlySet<string>): boolean {
|
|
249
|
+
if (words.has(word)) return true;
|
|
250
|
+
for (const w of words) if (w.length >= STEM_MIN && word.length > w.length && word.startsWith(w)) return true;
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** A word that names another trade's place, for a type whose vocabulary is `vocabulary`. */
|
|
255
|
+
const foreignTrade = (word: string, vocabulary: ReadonlySet<string>) => STOCK_TRADE_PLACE_WORDS.has(word) && !namesOneOf(word, vocabulary);
|
|
256
|
+
|
|
184
257
|
/** A photo's tags (else its alt, split at commas) and the reviewer's notes, each as plain words between spaces. */
|
|
185
258
|
function photoPhrases(photo: Pick<StockPhotoTraits, 'alt' | 'tags' | 'review'>): string[] {
|
|
186
259
|
const tags = photo.tags?.length ? photo.tags : String(photo.alt ?? '').split(',');
|
|
187
260
|
return [...tags, photo.review?.notes ?? ''].map(t => ` ${plain(String(t ?? '')).replace(/[^\p{L}\p{N}]+/gu, ' ').trim()} `);
|
|
188
261
|
}
|
|
189
262
|
|
|
263
|
+
/** What a place is, as the fit reads it: its intent, and — an item — its own name's words. */
|
|
264
|
+
export interface StockFitPlace {
|
|
265
|
+
readonly intent: string;
|
|
266
|
+
/** A sample item's own name (`StockItemSlot.subject`): a photo that names it shows the item. */
|
|
267
|
+
readonly subject?: ReadonlyArray<string>;
|
|
268
|
+
}
|
|
269
|
+
|
|
190
270
|
/**
|
|
191
|
-
* Whether a photo may stand in a place on a site held to `fit`: none of its words is a never-word or phrase, and
|
|
192
|
-
*
|
|
193
|
-
*
|
|
271
|
+
* Whether a photo may stand in a place on a site held to `fit`: none of its words is a never-word or phrase, and a photo no
|
|
272
|
+
* operator approved SHOWS THE BUSINESS — it names the type's vocabulary `STOCK_OPENING_TYPE_WORDS` times in an opening and
|
|
273
|
+
* `STOCK_PLACE_TYPE_WORDS` times anywhere else (iox-ui#175); an item's own name counts as the business's there (a
|
|
274
|
+
* "Bridal makeup" service, a makeup photo). Another trade's place word never counts. An approved library photo was seen for
|
|
275
|
+
* its type and needs no word. No type known (`STOCK_FIT_ANY`): the never-words only.
|
|
194
276
|
*/
|
|
195
|
-
export function stockPhotoFits(photo: Pick<StockPhotoTraits, 'alt' | 'tags' | 'review'>, slot:
|
|
277
|
+
export function stockPhotoFits(photo: Pick<StockPhotoTraits, 'alt' | 'tags' | 'review'>, slot: StockFitPlace, fit: StockFit = STOCK_FIT_ANY): boolean {
|
|
196
278
|
const words = stockPhotoWords(photo);
|
|
197
279
|
if (words.some(w => fit.never.has(w))) return false;
|
|
198
280
|
const phrases = photoPhrases(photo);
|
|
199
281
|
if (STOCK_NEVER_PHRASES.some(phrase => phrases.some(p => p.includes(` ${phrase} `)))) return false;
|
|
200
|
-
if (
|
|
201
|
-
return words
|
|
282
|
+
if (photo.review?.verdict === StockReviewVerdict.Approved || !fit.vocabulary.size) return true;
|
|
283
|
+
return businessWordsOf(words, slot, fit) >= (OPENING_INTENTS.has(slot.intent) ? STOCK_OPENING_TYPE_WORDS : STOCK_PLACE_TYPE_WORDS);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** How many distinct words of a photo name the business (the opening: its vocabulary; elsewhere an item's name too). */
|
|
287
|
+
function businessWordsOf(words: ReadonlyArray<string>, slot: StockFitPlace, fit: StockFit): number {
|
|
288
|
+
const own = OPENING_INTENTS.has(slot.intent) ? null : new Set((slot.subject ?? []).filter(w => !foreignTrade(w, fit.vocabulary)));
|
|
289
|
+
return words.filter(w => !foreignTrade(w, fit.vocabulary) && (namesOneOf(w, fit.vocabulary) || (!!own && own.has(w)))).length;
|
|
202
290
|
}
|
|
203
291
|
|
|
204
292
|
const intentRank = (intent: string) => STOCK_INTENT_ORDER.indexOf(intent as StockIntent);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComposedItem, ComposedPlaceholder, ComposedSite, openingContextOf, PlaceholderKind } from './compose-site';
|
|
2
|
+
import { FreeNode, FreeNodeType } from './free-wire';
|
|
2
3
|
import { FingerprintedPage, wornOpenings } from './layout-fingerprint';
|
|
3
4
|
import { LAYOUT_TEXT_KINDS, LayoutColour, LayoutLayer, LayoutLayerKind, LayoutRole, LayoutSection, LayoutSize } from './layout-language';
|
|
4
5
|
import {
|
|
@@ -423,13 +424,18 @@ const isHome = (page: PagePlan) => page.isHome === true || page.route === '/';
|
|
|
423
424
|
/**
|
|
424
425
|
* The type-led first screen for a home page: the plan's own frame and words first, then the contract's ways
|
|
425
426
|
* (`typeLedOpeningWays`), the first the site carries unmended (its tier, the business name's fit) that no OTHER site of
|
|
426
|
-
* the studio opens on — else the first it carries, said as worn.
|
|
427
|
+
* the studio opens on — else the first it carries, said as worn. J10 lever (b): the plan's own way is tried first only
|
|
428
|
+
* when it is a COMPOSED way — never the bare band (the contract's last way: a heading, a line and one action on a full
|
|
429
|
+
* plain ground), which stays every site's last resort. Pure.
|
|
427
430
|
*/
|
|
428
431
|
export function chooseTypeLedOpening(plan: SitePlan, context: TypeLedRoundContext = {}): { mix: OpeningMix; token: string; worn: boolean; ground: OpeningGround } {
|
|
429
432
|
const own = openingMixOfPlan(plan);
|
|
433
|
+
const contract = typeLedOpeningWays();
|
|
434
|
+
const bare = contract[contract.length - 1];
|
|
435
|
+
const isBare = (m: Pick<OpeningMix, 'frame' | 'words'>) => m.frame === bare.frame && m.words === bare.words;
|
|
430
436
|
// The plan's own frame and words, on no picture (a slow zoom has nothing to move: it goes with the picture).
|
|
431
|
-
const mine = own ? [{ ...own, media: OpeningMedia.None, extras: [...own.extras], motion: own.motion.filter(m => m !== OpeningMotion.SlowZoom) }] : [];
|
|
432
|
-
const ways = [...mine, ...
|
|
437
|
+
const mine = own && !isBare(own) ? [{ ...own, media: OpeningMedia.None, extras: [...own.extras], motion: own.motion.filter(m => m !== OpeningMotion.SlowZoom) }] : [];
|
|
438
|
+
const ways = [...mine, ...contract];
|
|
433
439
|
const site = openingContextOf({ business: plan.business, design: plan.design, tier: context.tier ?? BASIC, badge: null, cutOut: false });
|
|
434
440
|
const carried = ways.map(m => drawnOpeningMix(m).drawn).filter(m => !checkOpening(m, site).repairs.length);
|
|
435
441
|
const worn = [...wornOpenings(context.studio ?? [])].map(openingTokenParts);
|
|
@@ -543,6 +549,13 @@ export function typeLedRound(
|
|
|
543
549
|
});
|
|
544
550
|
if (plated) next = { ...next, layout: { ...page.layout, sections: laidSections } };
|
|
545
551
|
}
|
|
552
|
+
// iox-ui#180: a free Home whose opening holds a picture nothing fills gives its opening back to the plan's (the
|
|
553
|
+
// ready-made place a fall back would give) — then it opens type-led below, like every Home; the rest stays free.
|
|
554
|
+
const opening = next.free?.sections[0];
|
|
555
|
+
if (first && opening && !opening.readyMade && next.sections[0]) {
|
|
556
|
+
const given: FreeNode = { id: opening.id, type: FreeNodeType.Section, styleProps: {}, readyMade: { at: 0, pattern: next.sections[0].pattern } };
|
|
557
|
+
next = { ...next, free: { ...next.free!, sections: [given, ...next.free!.sections.slice(1)] } };
|
|
558
|
+
}
|
|
546
559
|
if (first) { firstScreen = next; homeAt = p; }
|
|
547
560
|
return next;
|
|
548
561
|
});
|
|
@@ -560,7 +573,9 @@ export function typeLedRound(
|
|
|
560
573
|
const hero = at >= 0 ? sections[at] : undefined;
|
|
561
574
|
const takes = !!hero && !!typeLedOpeningSection(chosen.mix, hero);
|
|
562
575
|
const nextPages = [...pages];
|
|
563
|
-
|
|
576
|
+
// A free Home's ready-made places name their plan section by its pattern — the swapped one when it was swapped.
|
|
577
|
+
const free = home.free ? { ...home.free, sections: home.free.sections.map(s => (s.readyMade && sections[s.readyMade.at] ? { ...s, readyMade: { ...s.readyMade, pattern: sections[s.readyMade.at].pattern } } : s)) } : undefined;
|
|
578
|
+
nextPages[homeAt] = { ...home, sections, ...(free ? { free } : {}) };
|
|
564
579
|
next = { ...next, pages: nextPages };
|
|
565
580
|
if (takes) {
|
|
566
581
|
const words = openingMixWords(chosen.mix);
|
|
@@ -136,6 +136,15 @@ export interface BusinessTypeFooter {
|
|
|
136
136
|
readonly sayHe: ReadonlyArray<string>;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/** HI3-D12 (header-ingredients-plan §8): what a type's header never stands on (contract harness `businessTypes[].header`,
|
|
140
|
+
* from harness.mjs HEADER_NEVER) — handed to generation-core `composeSite` as `headerNever`, where `checkHeader` mends it
|
|
141
|
+
* to its own ground (`type-never`). Shaped as generation-core `HeaderNever`. */
|
|
142
|
+
export interface BusinessTypeHeader {
|
|
143
|
+
readonly grounds: ReadonlyArray<string>;
|
|
144
|
+
readonly say: ReadonlyArray<string>;
|
|
145
|
+
readonly sayHe: ReadonlyArray<string>;
|
|
146
|
+
}
|
|
147
|
+
|
|
139
148
|
/** Award §0b + §0b.7 (AW-D26, AW-D32): how a type's opening film is suggested, and what it may show (`filmIdeaFor`). */
|
|
140
149
|
export interface BusinessTypeFilm {
|
|
141
150
|
/** offer · ifAsked · never — the default the owner's words move one step. */
|
|
@@ -172,6 +181,8 @@ export interface BusinessType {
|
|
|
172
181
|
readonly column: BusinessTypeColumn;
|
|
173
182
|
/** AW12-D10: what its footer never closes with or stands on — trust and care never a call word, a scene or a film. */
|
|
174
183
|
readonly footer: BusinessTypeFooter;
|
|
184
|
+
/** HI3-D12: what its header never stands on — care and advice never over the opening's picture. */
|
|
185
|
+
readonly header: BusinessTypeHeader;
|
|
175
186
|
/** Award §0b + §0b.7 (AW-D26…D32): how a film is suggested to this type, and what it may show (`filmIdeaFor`). */
|
|
176
187
|
readonly film: BusinessTypeFilm;
|
|
177
188
|
/** Popups PU0 (popups-plan §10, PU-D11/PU-D12): offer · ifAsked · never — how a popup is suggested (`popupSuggestion`). */
|