@vectoriox/iox-ui 5.142.0 → 5.144.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 (47) hide show
  1. package/composite-core/index.d.ts +40 -1
  2. package/design-core/index.d.ts +92 -27
  3. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +155 -90
  4. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-design-core.mjs +112 -27
  6. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-forms-core.mjs +61 -4
  8. package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +473 -193
  10. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +461 -2
  12. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui.mjs +102 -19
  14. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  15. package/forms-core/index.d.ts +17 -3
  16. package/generation-core/index.d.ts +270 -6
  17. package/harness-core/index.d.ts +341 -2
  18. package/index.d.ts +24 -9
  19. package/package.json +1 -1
  20. package/src/composite-core/accordion.ts +16 -1
  21. package/src/composite-core/card.ts +22 -2
  22. package/src/composite-core/consent.ts +2 -2
  23. package/src/composite-core/recipe-parts.ts +7 -0
  24. package/src/composite-core/segmented.ts +17 -2
  25. package/src/composite-core/slider.ts +19 -3
  26. package/src/composite-core/tabs.ts +16 -1
  27. package/src/design-core/contrast-audit.ts +18 -0
  28. package/src/design-core/flavor-spec.generated.ts +71 -25
  29. package/src/design-core/locale-direction.ts +24 -0
  30. package/src/design-core/menu-look.ts +2 -1
  31. package/src/design-core/public-api.ts +1 -0
  32. package/src/forms-core/form-presets.ts +72 -3
  33. package/src/generation-core/compose-layout.ts +1 -1
  34. package/src/generation-core/compose-site.ts +50 -19
  35. package/src/generation-core/footer-mix.ts +8 -0
  36. package/src/generation-core/nav-shape.ts +3 -2
  37. package/src/generation-core/patterns.ts +4 -0
  38. package/src/generation-core/public-api.ts +1 -0
  39. package/src/generation-core/site-plan.model.ts +10 -2
  40. package/src/generation-core/site-spec.generated.ts +281 -131
  41. package/src/generation-core/start-quote.ts +158 -0
  42. package/src/harness-core/business-types.ts +11 -0
  43. package/src/harness-core/film-idea.ts +178 -0
  44. package/src/harness-core/harness-spec.generated.ts +331 -0
  45. package/src/harness-core/intake.ts +8 -1
  46. package/src/harness-core/public-api.ts +1 -0
  47. package/styles/iox-design.css +60 -47
@@ -0,0 +1,158 @@
1
+ import {
2
+ AI_COMPOSED_PAGES_ESTIMATED, AI_STEP_PART_TOKENS, AI_STEP_TYPICAL_TOKENS, AiKeyMode, AiStep, AiTokenCounts, AiTokenPrice,
3
+ estimateStepCredits,
4
+ } from './ai-run';
5
+ import { AI_COMPOSED_PAGES_BY_TIER, tierOf } from './generation-tier';
6
+ import { PLAN_PARTS } from './plan-wire';
7
+ import { GenerationTier } from './site-plan.model';
8
+
9
+ /**
10
+ * What a generation will cost, said BEFORE Send (AI plan "Credit estimate before Send", CE-D1…CE-D3, CE-D6, CE-D9) —
11
+ * pure. ONE function prices a start: iox-cms holds its `high` when a generation starts and answers it, with the gate's
12
+ * refusal, on the dry quote route, so the number the owner sees is the number held (R-H1). The screens never sum
13
+ * prices themselves.
14
+ *
15
+ * - `high` = what the start holds: counted high like every estimate (the plan's pages part asked twice, each composed page
16
+ * with its repair). `low` = the same run with no re-ask and no repair. Both rounded OUTWARD to whole credits.
17
+ * - Home is composed at its model; every following page at the model that runs it (`followingFor`, CE-D3) — Award
18
+ * 196 → 123, Basic 79 → 65 at the default models.
19
+ * - An own-key route is priced and marked `keyMode: own` (not charged by IOX, CE-D6); a model the vetted list does not
20
+ * price carries `estimated` (iox-cms `priceFor`: the dearest known price of its provider).
21
+ * - Pictures and a film are never in the number (CE-D9): the screen names them as rows with no price.
22
+ */
23
+
24
+ /** The steps a generation's start is priced on, in order (the reading, the plan, the composed pages). */
25
+ export const START_QUOTE_STEPS: ReadonlyArray<AiStep> = [AiStep.ReadMessage, AiStep.PlanSite, AiStep.ComposePages];
26
+
27
+ /**
28
+ * One composed page with no repair — the low end of a start (measured on the live u2band run, 2026-11-16: Home 8.8k in /
29
+ * 8.7k out, the next page 8.7k / 5.6k; ≈ 9k / 7k a page). The high end is `AI_STEP_TYPICAL_TOKENS[ComposePages]` over
30
+ * `AI_COMPOSED_PAGES_ESTIMATED` (each page with its repair).
31
+ */
32
+ export const AI_COMPOSED_PAGE_LEAN_TOKENS: Readonly<AiTokenCounts> = Object.freeze({ input: 9_000, output: 7_000, cacheWrite: 0, cacheRead: 0 });
33
+
34
+ /** A step's route as the start would run it: the model and its price (null = no price known, priced 0). */
35
+ export interface QuoteRoute {
36
+ model: string;
37
+ price: AiTokenPrice | null;
38
+ /** The vetted list does not price this model; it is priced at its provider's dearest (iox-cms `priceFor`). */
39
+ estimated?: boolean;
40
+ /** Who pays — an own key is priced for the owner to see, never charged by IOX (absent = platform). */
41
+ keyMode?: `${AiKeyMode}`;
42
+ }
43
+
44
+ /** The routes a start runs: each of `START_QUOTE_STEPS` (null = no route, priced 0), and the model that composes the pages
45
+ * after Home (`following`; absent = Home's model composes them too). */
46
+ export interface StartQuoteRoutes {
47
+ [AiStep.ReadMessage]: QuoteRoute | null;
48
+ [AiStep.PlanSite]: QuoteRoute | null;
49
+ [AiStep.ComposePages]: QuoteRoute | null;
50
+ following?: QuoteRoute | null;
51
+ }
52
+
53
+ /** Tokens a start is priced on — the low end and the high end of each step; for composing, of ONE page. */
54
+ export interface StartQuoteTokens {
55
+ [AiStep.ReadMessage]: { low: AiTokenCounts; high: AiTokenCounts };
56
+ [AiStep.PlanSite]: { low: AiTokenCounts; high: AiTokenCounts };
57
+ [AiStep.ComposePages]: { low: AiTokenCounts; high: AiTokenCounts };
58
+ }
59
+
60
+ const scale = (t: AiTokenCounts, by: number): AiTokenCounts => ({
61
+ input: t.input * by, output: t.output * by, cacheWrite: t.cacheWrite * by, cacheRead: t.cacheRead * by,
62
+ ...(t.imageOutput !== undefined ? { imageOutput: t.imageOutput * by } : {}),
63
+ });
64
+ const sum = (a: AiTokenCounts, b: AiTokenCounts): AiTokenCounts => ({
65
+ input: a.input + b.input, output: a.output + b.output, cacheWrite: a.cacheWrite + b.cacheWrite, cacheRead: a.cacheRead + b.cacheRead,
66
+ });
67
+
68
+ /** The tokens a start is priced on: high = the held estimate's (`AI_STEP_TYPICAL_TOKENS`); low = no re-asked plan part,
69
+ * no layout repair. */
70
+ export const START_QUOTE_TOKENS: Readonly<StartQuoteTokens> = {
71
+ [AiStep.ReadMessage]: { low: AI_STEP_TYPICAL_TOKENS[AiStep.ReadMessage], high: AI_STEP_TYPICAL_TOKENS[AiStep.ReadMessage] },
72
+ [AiStep.PlanSite]: {
73
+ low: PLAN_PARTS.map(part => AI_STEP_PART_TOKENS[AiStep.PlanSite]![part]).reduce(sum),
74
+ high: AI_STEP_TYPICAL_TOKENS[AiStep.PlanSite],
75
+ },
76
+ [AiStep.ComposePages]: {
77
+ low: AI_COMPOSED_PAGE_LEAN_TOKENS,
78
+ high: scale(AI_STEP_TYPICAL_TOKENS[AiStep.ComposePages], 1 / AI_COMPOSED_PAGES_ESTIMATED),
79
+ },
80
+ };
81
+
82
+ /** One row of a quote: a step at one model (composing is two rows — Home, and the pages after it). */
83
+ export interface StartQuotePart {
84
+ step: AiStep;
85
+ /** Null when the step has no route (priced 0). */
86
+ model: string | null;
87
+ /** Composing only: the pages this row covers (Home = 1). */
88
+ pages?: number;
89
+ /** Composing only: the pages after Home. */
90
+ following?: boolean;
91
+ /** Exact credits (to a millionth) — round for the screen with `outwardCredits`. */
92
+ low: number;
93
+ high: number;
94
+ estimated: boolean;
95
+ keyMode: `${AiKeyMode}`;
96
+ }
97
+
98
+ export interface StartQuote {
99
+ /** Whole credits, rounded outward: `low` down, `high` up. `high` is what the start holds. */
100
+ low: number;
101
+ high: number;
102
+ tier: GenerationTier;
103
+ /** Own when every priced row runs on the studio's own key (nothing charged by IOX, never refused for credits). */
104
+ keyMode: `${AiKeyMode}`;
105
+ /** Any row priced at a model the vetted list does not price. */
106
+ estimated: boolean;
107
+ parts: StartQuotePart[];
108
+ }
109
+
110
+ const CREDIT_PRECISION = 1e6;
111
+ const exact = (credits: number): number => Math.round(credits * CREDIT_PRECISION) / CREDIT_PRECISION;
112
+
113
+ /** A credit range rounded OUTWARD to whole credits (low down, high up) — the ONE rounding every quoted range uses. */
114
+ export function outwardCredits(low: number, high: number): { low: number; high: number } {
115
+ return { low: Math.floor(exact(low)), high: Math.ceil(exact(high)) };
116
+ }
117
+
118
+ function part(step: AiStep, route: QuoteRoute | null, tokens: { low: AiTokenCounts; high: AiTokenCounts }, pages?: number, following?: boolean): StartQuotePart {
119
+ const times = pages ?? 1;
120
+ const price = route?.price ?? null;
121
+ const credits = (t: AiTokenCounts) => (price ? exact(estimateStepCredits(step, price, t) * times) : 0);
122
+ return {
123
+ step,
124
+ model: route?.model ?? null,
125
+ ...(pages !== undefined ? { pages } : {}),
126
+ ...(following ? { following: true } : {}),
127
+ low: credits(tokens.low),
128
+ high: credits(tokens.high),
129
+ estimated: !route || !price || route.estimated === true,
130
+ keyMode: route?.keyMode ?? AiKeyMode.Platform,
131
+ };
132
+ }
133
+
134
+ /**
135
+ * The price of a generation's start at `tier`, on `routes`. The composed pages are the tier's start count
136
+ * (`AI_COMPOSED_PAGES_BY_TIER`: Basic 2, Award 6) — Home at the composing route, the rest at `following`.
137
+ */
138
+ export function startQuote(routes: StartQuoteRoutes, tier: `${GenerationTier}`, tokens: StartQuoteTokens = START_QUOTE_TOKENS): StartQuote {
139
+ const at = tierOf(tier);
140
+ const pages = AI_COMPOSED_PAGES_BY_TIER[at];
141
+ const compose = routes[AiStep.ComposePages];
142
+ const following = routes.following === undefined ? compose : routes.following;
143
+ const parts: StartQuotePart[] = [
144
+ part(AiStep.ReadMessage, routes[AiStep.ReadMessage], tokens[AiStep.ReadMessage]),
145
+ part(AiStep.PlanSite, routes[AiStep.PlanSite], tokens[AiStep.PlanSite]),
146
+ part(AiStep.ComposePages, compose, tokens[AiStep.ComposePages], 1),
147
+ ...(pages > 1 ? [part(AiStep.ComposePages, following, tokens[AiStep.ComposePages], pages - 1, true)] : []),
148
+ ];
149
+ const total = outwardCredits(parts.reduce((s, p) => s + p.low, 0), parts.reduce((s, p) => s + p.high, 0));
150
+ const priced = parts.filter(p => p.model !== null);
151
+ return {
152
+ ...total,
153
+ tier: at,
154
+ keyMode: priced.length > 0 && priced.every(p => p.keyMode === AiKeyMode.Own) ? AiKeyMode.Own : AiKeyMode.Platform,
155
+ estimated: parts.some(p => p.estimated),
156
+ parts,
157
+ };
158
+ }
@@ -113,6 +113,15 @@ export interface BusinessTypeLists {
113
113
  readonly say: ReadonlyArray<string>;
114
114
  }
115
115
 
116
+ /** Award §0b + §0b.7 (AW-D26, AW-D32): how a type's opening film is suggested, and what it may show (`filmIdeaFor`). */
117
+ export interface BusinessTypeFilm {
118
+ /** offer · ifAsked · never — the default the owner's words move one step. */
119
+ readonly stance: string;
120
+ /** The ideas, in order (the first that fits is the site's). */
121
+ readonly ideas: ReadonlyArray<string>;
122
+ readonly why: string;
123
+ }
124
+
116
125
  export interface BusinessType {
117
126
  readonly id: string;
118
127
  readonly label: string;
@@ -136,6 +145,8 @@ export interface BusinessType {
136
145
  /** List ingredients LI0 (list-ingredients-plan.md L-D12): what this type's lists never do — arrangements and moves
137
146
  * the layout's list section is not offered, and the sentences saying why. Binds generated output only. */
138
147
  readonly lists: BusinessTypeLists;
148
+ /** Award §0b + §0b.7 (AW-D26…D32): how a film is suggested to this type, and what it may show (`filmIdeaFor`). */
149
+ readonly film: BusinessTypeFilm;
139
150
  readonly imagery: string;
140
151
  /** M7: the picture world a site's made pictures start in (generation-core `artDirectionFor`; contract site.pictureWorlds). */
141
152
  readonly world: `${PictureWorld}`;
@@ -0,0 +1,178 @@
1
+ import { BusinessType, businessTypeById } from './business-types';
2
+ import { SPEC_FILM_IDEAS } from './harness-spec.generated';
3
+ import { keywordsIn } from './intake';
4
+
5
+ /**
6
+ * The opening film, SUGGESTED (award-ingredients-plan §0b + §0b.7, AW-D26…AW-D32 — "the same moment, not the same
7
+ * picture"; "it is not a must"). Two answers, both the harness's, never the model's:
8
+ * - the STANCE — whether the Plan step offers a film at all: `offer` (the line shows, ticked only when the prompt asked),
9
+ * `ifAsked` (the line shows only when the prompt asked), `never` (nothing). A type's default (contract `FILM_IDEAS`,
10
+ * on each type as `film.stance`) is moved one step by the owner's words.
11
+ * - the IDEA — what the film would show: the first idea of the type's row the site can carry.
12
+ * No film is ever made without the owner's tick, and nothing fails for a film that is missing. The owner's OWN uploaded
13
+ * video plays on any type (SC6b `placeFilm`) — this decides only a made film. Pure: no transport, no clock.
14
+ */
15
+
16
+ /** The five ideas, in the contract's order. */
17
+ export enum FilmIdea {
18
+ Making = 'making',
19
+ Object = 'object',
20
+ Material = 'material',
21
+ Place = 'place',
22
+ None = 'none',
23
+ }
24
+
25
+ /** How a film is suggested (AW-D32). */
26
+ export enum FilmStance {
27
+ /** The Plan step offers it; ticked only when the prompt asked. */
28
+ Offer = 'offer',
29
+ /** Offered only when the prompt asked. */
30
+ IfAsked = 'ifAsked',
31
+ /** Never offered — no made film. */
32
+ Never = 'never',
33
+ }
34
+
35
+ /** The picture a film starts from. */
36
+ export enum FilmStart {
37
+ /** The owner's own photo. */
38
+ Own = 'own',
39
+ /** An art-direction still (M7) — only for a type that takes made pictures (not STOCK_NEVER, AW-D28). */
40
+ Art = 'art',
41
+ }
42
+
43
+ /** What a contract idea asks for its start picture. */
44
+ enum IdeaStart {
45
+ Own = 'own',
46
+ }
47
+
48
+ /** Why there is no film idea, or why an idea of the row was passed over. */
49
+ export enum FilmIdeaReason {
50
+ /** The stance is never: no made film for this business. */
51
+ Never = 'never',
52
+ /** No such business type. */
53
+ Type = 'type',
54
+ /** `making` / `object` need the subject the owner named (AW-D27). */
55
+ NoSubject = 'no-subject',
56
+ /** The idea needs the owner's photo (making, object; any idea on a STOCK_NEVER type — AW-D28). */
57
+ NoOwnPhoto = 'no-own-photo',
58
+ }
59
+
60
+ /** One idea of the row the harness passed over, and why. */
61
+ export interface FilmIdeaSkip {
62
+ readonly idea: FilmIdea;
63
+ readonly reason: FilmIdeaReason;
64
+ }
65
+
66
+ /** What the owner's words did to the stance. */
67
+ export interface FilmWords {
68
+ /** Words asking for motion (cinematic, video, film…), as they appear in the list. */
69
+ readonly raised: ReadonlyArray<string>;
70
+ /** Words asking for calm (formal, minimal, serious…). */
71
+ readonly lowered: ReadonlyArray<string>;
72
+ /** The business reads as one that never takes a film (cyber security, finance…). */
73
+ readonly never: ReadonlyArray<string>;
74
+ }
75
+
76
+ /** The harness's answer. */
77
+ export interface FilmIdeaChoice {
78
+ /** What the film would show (none: no made film). */
79
+ readonly idea: FilmIdea;
80
+ readonly stance: FilmStance;
81
+ /** The owner asked for motion: the Plan step's line starts ticked (still the owner's to untick). */
82
+ readonly asked: boolean;
83
+ /** The picture it starts from (null for none). */
84
+ readonly start: FilmStart | null;
85
+ /** The subject the owner named, trimmed (null when none). */
86
+ readonly subject: string | null;
87
+ /** Why there is no idea (null when there is one). */
88
+ readonly reason: FilmIdeaReason | null;
89
+ /** The ideas of the row passed over before the choice, each with why. */
90
+ readonly skipped: ReadonlyArray<FilmIdeaSkip>;
91
+ readonly words: FilmWords;
92
+ }
93
+
94
+ export interface FilmIdeaDef {
95
+ readonly shows: string;
96
+ readonly plays: { readonly pattern: string; readonly signature: string | null } | null;
97
+ readonly later: string | null;
98
+ readonly subject: boolean;
99
+ readonly start: string | null;
100
+ }
101
+
102
+ /** The contract's five ideas, keyed by word. */
103
+ export const FILM_IDEAS: Readonly<Record<FilmIdea, FilmIdeaDef>> = SPEC_FILM_IDEAS.ideas;
104
+
105
+ /** The words that move the stance (contract `FILM_IDEAS`). */
106
+ export const FILM_WORDS = {
107
+ raise: SPEC_FILM_IDEAS.raise as ReadonlyArray<string>,
108
+ lower: SPEC_FILM_IDEAS.lower as ReadonlyArray<string>,
109
+ neverReads: SPEC_FILM_IDEAS.neverReads as ReadonlyArray<string>,
110
+ } as const;
111
+
112
+ const NONE_IDEAS: ReadonlyArray<string> = [FilmIdea.None];
113
+
114
+ /** The ideas a type's film may show, in order; `[none]` for an unknown type. */
115
+ export function filmIdeasOf(type: BusinessType | string | null | undefined): ReadonlyArray<FilmIdea> {
116
+ const t: BusinessType | undefined = typeof type === 'string' ? businessTypeById(type) : (type ?? undefined);
117
+ return (t?.film.ideas ?? NONE_IDEAS) as ReadonlyArray<FilmIdea>;
118
+ }
119
+
120
+ /** What the owner's words say about a film (the ONE no-model word rule, `keywordsIn`). */
121
+ export function filmWordsIn(prompt: string | null | undefined): FilmWords {
122
+ const text = prompt ?? '';
123
+ return { raised: keywordsIn(text, FILM_WORDS.raise), lowered: keywordsIn(text, FILM_WORDS.lower), never: keywordsIn(text, FILM_WORDS.neverReads) };
124
+ }
125
+
126
+ /**
127
+ * The stance for a business and the owner's words (AW-D32): the type's default, moved ONE step — motion words raise
128
+ * ifAsked → offer, calm words lower offer → ifAsked, both together cancel — and `never` moves for no word. A business that
129
+ * reads as cyber security / IT / finance is never; so is a site with no known type.
130
+ */
131
+ export function filmStanceFor(type: BusinessType | undefined, words: FilmWords): FilmStance {
132
+ const base = (type?.film.stance ?? FilmStance.Never) as FilmStance;
133
+ if (base === FilmStance.Never || words.never.length) return FilmStance.Never;
134
+ const raise = words.raised.length > 0, lower = words.lowered.length > 0;
135
+ if (raise && !lower) return FilmStance.Offer;
136
+ if (lower && !raise) return FilmStance.IfAsked;
137
+ return base;
138
+ }
139
+
140
+ export interface FilmIdeaInput {
141
+ /** The reading's business type. */
142
+ readonly businessType: string | null | undefined;
143
+ /** The owner's own words (the prompt). */
144
+ readonly prompt?: string | null;
145
+ /** The reading's `film.subject` — the owner's words or a photo the vision step described, never the type's default. */
146
+ readonly subject?: string | null;
147
+ /** How many photos of their own the owner gave. */
148
+ readonly ownPhotos: number;
149
+ }
150
+
151
+ /**
152
+ * The film for a site (§0b.3 step 1 + §0b.7): its stance, and the first idea of the type's row the site can carry.
153
+ * - `never` → no idea: no made film (the owner's own video still plays).
154
+ * - `making` / `object` need the owner's subject AND photo — a film of a plate the potter never made is a fabricated product.
155
+ * - `material` / `place` start from the owner's photo, else an art-direction still — never for a STOCK_NEVER type.
156
+ */
157
+ export function filmIdeaFor(input: FilmIdeaInput): FilmIdeaChoice {
158
+ const subject = input.subject?.trim() || null;
159
+ const words = filmWordsIn(input.prompt);
160
+ const t = businessTypeById(input.businessType);
161
+ const stance = filmStanceFor(t, words);
162
+ const asked = stance !== FilmStance.Never && words.raised.length > 0;
163
+ const none = (reason: FilmIdeaReason, skipped: FilmIdeaSkip[] = []): FilmIdeaChoice =>
164
+ ({ idea: FilmIdea.None, stance, asked, start: null, subject, reason, skipped, words });
165
+ if (!t) return none(FilmIdeaReason.Type);
166
+ if (stance === FilmStance.Never) return none(FilmIdeaReason.Never);
167
+ const skipped: FilmIdeaSkip[] = [];
168
+ const hasOwn = input.ownPhotos > 0;
169
+ for (const idea of filmIdeasOf(t)) {
170
+ if (idea === FilmIdea.None) break;
171
+ const def = FILM_IDEAS[idea];
172
+ const reason = def.subject && !subject ? FilmIdeaReason.NoSubject
173
+ : !hasOwn && (def.start === IdeaStart.Own || !t.stock) ? FilmIdeaReason.NoOwnPhoto : null;
174
+ if (reason) { skipped.push({ idea, reason }); continue; }
175
+ return { idea, stance, asked, start: hasOwn ? FilmStart.Own : FilmStart.Art, subject, reason: null, skipped, words };
176
+ }
177
+ return none(skipped[skipped.length - 1]?.reason ?? FilmIdeaReason.Never, skipped);
178
+ }