@vectoriox/iox-ui 5.156.0 → 5.157.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/fesm2022/vectoriox-iox-ui-generation-core.mjs +1088 -104
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/generation-core/index.d.ts +401 -3
- package/package.json +1 -1
- package/src/generation-core/check-free.ts +375 -0
- package/src/generation-core/free-fallback.ts +139 -0
- package/src/generation-core/free-wire.ts +432 -0
- package/src/generation-core/plan-words.ts +50 -3
- package/src/generation-core/prompt-limits.ts +96 -0
- package/src/generation-core/public-api.ts +4 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { JsonSchema, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonText } from './json-schema';
|
|
2
|
+
import { isPlainObject, PlainObject } from './shape-check';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* THE FREE SECTION (award-ingredients plan §11.4, FS3; FS-D15…FS-D18). A free page is ordinary builder-shaped nodes the
|
|
6
|
+
* model writes itself — Section, Container, Heading, Text, Button, Image, Video — each with styles, a phone layer, a hover
|
|
7
|
+
* and ONE move, plus SLOTS where a recipe stands (a list bound to content, a form): the model places a slot and never
|
|
8
|
+
* writes a Repeater or a Form (FS-T1). The look's values stay the look's (tokens only, `checkFree`); layout, overlap,
|
|
9
|
+
* turn, clip and size are free.
|
|
10
|
+
*
|
|
11
|
+
* It is ASKED as the strict FLAT wire (FS-D17): one list of nodes, every key required, no optional key, no union, no
|
|
12
|
+
* recursion, styles as `"<property>:<value>"` strings — 23 properties, held by `strictSchemaComplexity` — so a parse
|
|
13
|
+
* failure cannot happen. `expandFreeWire` turns it into the free tree (`FreePage`) the judge reads; `freeToWire` writes a
|
|
14
|
+
* tree back (fixtures, a repair's starting point); `freeWireIssue` says a judge's tree path in the wire's own words.
|
|
15
|
+
* The page is written in ONE language: the site's. Every enum is generated from THIS request (R-H2): the material ids,
|
|
16
|
+
* the slots, the pages. Pure. The prototype's copy is `prototypes/breaking-limits/code/flat5.mjs` (FS-D48 measured it).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** What a free node is. `Button` is stamped as the builder's ButtonBlock; a `Slot` is a recipe placed by name. */
|
|
20
|
+
export enum FreeNodeType {
|
|
21
|
+
Section = 'Section',
|
|
22
|
+
Container = 'Container',
|
|
23
|
+
Heading = 'Heading',
|
|
24
|
+
Text = 'Text',
|
|
25
|
+
Button = 'Button',
|
|
26
|
+
Image = 'Image',
|
|
27
|
+
Video = 'Video',
|
|
28
|
+
Slot = 'Slot',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The node types that carry words. */
|
|
32
|
+
export const FREE_WORD_TYPES: ReadonlyArray<FreeNodeType> = [FreeNodeType.Heading, FreeNodeType.Text, FreeNodeType.Button];
|
|
33
|
+
/** The node types that hold children. */
|
|
34
|
+
export const FREE_HOLDERS: ReadonlyArray<FreeNodeType> = [FreeNodeType.Section, FreeNodeType.Container];
|
|
35
|
+
|
|
36
|
+
/** What a free section is for — the fall back picks the ready-made section of the same place by it. */
|
|
37
|
+
export enum FreePurpose {
|
|
38
|
+
Opening = 'opening',
|
|
39
|
+
Videos = 'videos',
|
|
40
|
+
Products = 'products',
|
|
41
|
+
Work = 'work',
|
|
42
|
+
About = 'about',
|
|
43
|
+
Offer = 'offer',
|
|
44
|
+
Proof = 'proof',
|
|
45
|
+
Process = 'process',
|
|
46
|
+
Contact = 'contact',
|
|
47
|
+
Closing = 'closing',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The look's element styles a free node may wear, by type — a closed list (the contract has more, e.g. accordion parts,
|
|
52
|
+
* which belong to their recipes). A word node wears one and changes what it needs on top. The spec holds each id to the
|
|
53
|
+
* contract's `appliesTo` (`elementStylesFor`).
|
|
54
|
+
*/
|
|
55
|
+
export const FREE_ELEMENT_STYLES: Readonly<Partial<Record<FreeNodeType, ReadonlyArray<string>>>> = {
|
|
56
|
+
[FreeNodeType.Section]: ['section'],
|
|
57
|
+
[FreeNodeType.Container]: ['box', 'card', 'panel'],
|
|
58
|
+
[FreeNodeType.Heading]: ['display', 'h1', 'h2', 'h3', 'eyebrow'],
|
|
59
|
+
[FreeNodeType.Text]: ['lead', 'body', 'small', 'eyebrow'],
|
|
60
|
+
[FreeNodeType.Button]: ['button-primary', 'button-secondary', 'button-ghost'],
|
|
61
|
+
[FreeNodeType.Image]: ['media'],
|
|
62
|
+
[FreeNodeType.Video]: ['media'],
|
|
63
|
+
};
|
|
64
|
+
/** The builder type each free type is stamped as (and whose element styles it may wear). */
|
|
65
|
+
export const FREE_BUILDER_TYPE: Readonly<Record<FreeNodeType, string>> = {
|
|
66
|
+
[FreeNodeType.Section]: 'Section',
|
|
67
|
+
[FreeNodeType.Container]: 'Container',
|
|
68
|
+
[FreeNodeType.Heading]: 'Heading',
|
|
69
|
+
[FreeNodeType.Text]: 'Text',
|
|
70
|
+
[FreeNodeType.Button]: 'ButtonBlock',
|
|
71
|
+
[FreeNodeType.Image]: 'Image',
|
|
72
|
+
[FreeNodeType.Video]: 'Video',
|
|
73
|
+
[FreeNodeType.Slot]: 'Container',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** The one role a free node may carry: the heading a visitor reads first. */
|
|
77
|
+
export const FREE_LEAD_ROLE = 'lead';
|
|
78
|
+
|
|
79
|
+
/** How a page treats its pictures — ONE word, recorded and shown (R-H8: information, never a gate). */
|
|
80
|
+
export enum FreePictures {
|
|
81
|
+
UniformGrid = 'uniform-grid',
|
|
82
|
+
EqualSquares = 'equal-squares',
|
|
83
|
+
OneFormat = 'one-format',
|
|
84
|
+
SingleLarge = 'single-large',
|
|
85
|
+
FullBleed = 'full-bleed',
|
|
86
|
+
Mixed = 'mixed',
|
|
87
|
+
None = 'none',
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The product's breakpoints a free style layer is written at (`style-compiler/responsive.ts`): the wire asks two. */
|
|
91
|
+
export enum FreeLayer {
|
|
92
|
+
Phone = 'mobile',
|
|
93
|
+
Tablet = 'tablet',
|
|
94
|
+
}
|
|
95
|
+
/** Layers a phone in portrait reaches (a `mobile` layer reaches `small` by the cascade). */
|
|
96
|
+
export const FREE_PHONE_LAYERS: ReadonlyArray<string> = ['mobile', 'small'];
|
|
97
|
+
|
|
98
|
+
/** What triggers a free node's ONE move. */
|
|
99
|
+
export enum FreeTrigger {
|
|
100
|
+
Enter = 'viewportEnter',
|
|
101
|
+
Scroll = 'scrollProgress',
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The moves a free node may make — the product's own action words (actions-core `ELEMENT_ACTION_DESCRIPTORS`), each with
|
|
105
|
+
* the one parameter the wire may set. A hover is a style state, never a move.
|
|
106
|
+
*/
|
|
107
|
+
export const FREE_MOVES: Readonly<Record<FreeTrigger, Readonly<Record<string, Readonly<{ param?: string; values?: ReadonlyArray<string> }>>>>> = {
|
|
108
|
+
[FreeTrigger.Enter]: {
|
|
109
|
+
fadeIn: {},
|
|
110
|
+
moveUp: {},
|
|
111
|
+
blurIn: {},
|
|
112
|
+
zoomOut: {},
|
|
113
|
+
clipReveal: { param: 'from', values: ['start', 'end', 'top', 'bottom', 'centre'] },
|
|
114
|
+
revealText: { param: 'by', values: ['line', 'word'] },
|
|
115
|
+
countUp: {},
|
|
116
|
+
},
|
|
117
|
+
[FreeTrigger.Scroll]: {
|
|
118
|
+
parallax: { param: 'depth', values: ['back', 'front'] },
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/** One move, as the free tree holds it. */
|
|
123
|
+
export interface FreeMove {
|
|
124
|
+
trigger: FreeTrigger;
|
|
125
|
+
action: string;
|
|
126
|
+
params?: Record<string, string>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type FreeStyle = Record<string, string>;
|
|
130
|
+
|
|
131
|
+
/** One node of the free tree. */
|
|
132
|
+
export interface FreeNode {
|
|
133
|
+
id: string;
|
|
134
|
+
type: FreeNodeType;
|
|
135
|
+
/** A Section: what it is for. */
|
|
136
|
+
purpose?: FreePurpose;
|
|
137
|
+
elementStyle?: string;
|
|
138
|
+
/** A Heading: 1–4. */
|
|
139
|
+
level?: number;
|
|
140
|
+
role?: typeof FREE_LEAD_ROLE;
|
|
141
|
+
/** The words, in the site's language. */
|
|
142
|
+
text?: string;
|
|
143
|
+
/** An Image / Video: a material id. */
|
|
144
|
+
src?: string;
|
|
145
|
+
/** A Button: a page route of the site, or `#<section id>`. */
|
|
146
|
+
href?: string;
|
|
147
|
+
/** A Slot: what stands here (`list:<alias>`, `form:<preset>`). */
|
|
148
|
+
slot?: string;
|
|
149
|
+
/** A Slot's options (a list's mix words, `arrange:grid`). */
|
|
150
|
+
opts?: string[];
|
|
151
|
+
styleProps: FreeStyle;
|
|
152
|
+
responsive?: Partial<Record<FreeLayer, FreeStyle>>;
|
|
153
|
+
hover?: FreeStyle;
|
|
154
|
+
move?: FreeMove;
|
|
155
|
+
children?: FreeNode[];
|
|
156
|
+
/** Set by the fall back: the plan's ready-made section stands here instead (its index in the page plan, its pattern). */
|
|
157
|
+
readyMade?: { at: number; pattern: string };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** What the answer says about itself — `followed` quotes the owner's words (§11.4a, R-H17). */
|
|
161
|
+
export interface FreeRead {
|
|
162
|
+
idea: string;
|
|
163
|
+
why: string;
|
|
164
|
+
followed: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface FreePage {
|
|
168
|
+
read: FreeRead;
|
|
169
|
+
pictures: string;
|
|
170
|
+
sections: FreeNode[];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** The wire's node keys, in the order a model writes them. Every one is required. */
|
|
174
|
+
export const FREE_WIRE_NODE_KEYS = [
|
|
175
|
+
'id', 'parent', 'type', 'purpose', 'style', 'level', 'role', 'text', 'src', 'href', 'slot', 'opts', 'base', 'phone', 'tablet', 'hover', 'motion',
|
|
176
|
+
] as const;
|
|
177
|
+
export type FreeWireNode = {
|
|
178
|
+
id: string; parent: string; type: string; purpose: string; style: string; level: number; role: string; text: string; src: string;
|
|
179
|
+
href: string; slot: string; opts: string[]; base: string[]; phone: string[]; tablet: string[]; hover: string[]; motion: string;
|
|
180
|
+
};
|
|
181
|
+
export interface FreeWire {
|
|
182
|
+
read: FreeRead;
|
|
183
|
+
pictures: string;
|
|
184
|
+
nodes: FreeWireNode[];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface FreeWireOptions {
|
|
188
|
+
/** The material the page may place, by id (R-H2): the owner's photos and videos. */
|
|
189
|
+
material?: ReadonlyArray<string>;
|
|
190
|
+
/** The slots this page may place (`list:<alias>`, `form:<preset>`) — generated from the plan. */
|
|
191
|
+
slots?: ReadonlyArray<string>;
|
|
192
|
+
/** The site's language, named in the descriptions (`en`, `he`). */
|
|
193
|
+
language?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const SEP = ':';
|
|
197
|
+
const NONE = 'none';
|
|
198
|
+
const ENTER = 'enter';
|
|
199
|
+
const SCROLL = 'scroll';
|
|
200
|
+
const TRIGGER_WORD: Readonly<Record<FreeTrigger, string>> = { [FreeTrigger.Enter]: ENTER, [FreeTrigger.Scroll]: SCROLL };
|
|
201
|
+
|
|
202
|
+
/** Every move word the wire offers: `none`, `enter:<action>[:<value>]`, `scroll:parallax:<depth>`. */
|
|
203
|
+
export function freeMoveWords(): string[] {
|
|
204
|
+
const out = [NONE];
|
|
205
|
+
for (const trigger of Object.values(FreeTrigger)) {
|
|
206
|
+
for (const [action, spec] of Object.entries(FREE_MOVES[trigger])) {
|
|
207
|
+
if (spec.values?.length) for (const v of spec.values) out.push([TRIGGER_WORD[trigger], action, v].join(SEP));
|
|
208
|
+
else out.push([TRIGGER_WORD[trigger], action].join(SEP));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return out;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const FREE_STYLE_WORDS: ReadonlyArray<string> = [...new Set(Object.values(FREE_ELEMENT_STYLES).flat() as string[])];
|
|
215
|
+
|
|
216
|
+
const text = (d: string) => ({ ...jsonText(), description: d });
|
|
217
|
+
const oneOf = (values: ReadonlyArray<string>, d: string) => ({ ...jsonOneOf(values), description: d });
|
|
218
|
+
const strings = (d: string) => ({ ...jsonListOf(jsonText()), description: d });
|
|
219
|
+
const closed = (properties: Record<string, JsonSchema>, d?: string) => jsonClosedObject(properties, Object.keys(properties), d);
|
|
220
|
+
|
|
221
|
+
/** The strict format of ONE free page (FS-D17): 23 properties, 0 optional, 0 unions. */
|
|
222
|
+
export function freeWireJsonSchema(options: FreeWireOptions = {}): JsonSchema {
|
|
223
|
+
const lang = options.language ?? 'the site\'s language';
|
|
224
|
+
const node = closed({
|
|
225
|
+
id: text('unique kebab-case id'),
|
|
226
|
+
parent: text("the id of the Section or Container it sits in; '' for a Section (the top of the page). A parent is written before its children; siblings in reading order"),
|
|
227
|
+
type: oneOf(Object.values(FreeNodeType), 'what the node is'),
|
|
228
|
+
purpose: oneOf(['', ...Object.values(FreePurpose)], "a Section: what it is for; '' for every other node"),
|
|
229
|
+
style: oneOf(['', ...FREE_STYLE_WORDS], "the look's element style it wears (a Heading, Text and Button always wear one); '' for none"),
|
|
230
|
+
level: { ...jsonInteger(), description: 'a Heading: 1–4 (exactly one 1 on the page); 0 for other nodes' },
|
|
231
|
+
role: oneOf(['', FREE_LEAD_ROLE], "'lead' on the heading a visitor reads first (in the first section); '' otherwise"),
|
|
232
|
+
text: text(`the words (Heading, Text, Button), in ${lang}; '' for none`),
|
|
233
|
+
src: oneOf(['', ...(options.material ?? [])], "an Image / Video: an id from the material; '' for none"),
|
|
234
|
+
href: text("a Button: a page route of the site or '#<section id>'; '' for none"),
|
|
235
|
+
slot: oneOf(['', ...(options.slots ?? [])], "a Slot: the part that stands here, placed and never built; '' for none"),
|
|
236
|
+
opts: strings("a list Slot: how its items are shown, '<ingredient>:<word>'; [] for none"),
|
|
237
|
+
base: strings("styles at every width, each '<property>:<value>' (camelCase, one plain value; a size relative to the width is cqi, never vw); [] for none"),
|
|
238
|
+
phone: strings("the phone layer (≤ 767px), '<property>:<value>'; [] for none"),
|
|
239
|
+
tablet: strings("the tablet layer (≤ 991px), '<property>:<value>'; [] for none"),
|
|
240
|
+
hover: strings("on hover, '<property>:<value>' — transform, opacity or a colour token only; [] for none"),
|
|
241
|
+
motion: oneOf(freeMoveWords(), 'its ONE entrance or scroll move, or none'),
|
|
242
|
+
});
|
|
243
|
+
return closed({
|
|
244
|
+
read: closed({
|
|
245
|
+
idea: text("one line: the page's idea"),
|
|
246
|
+
why: text('one line: why it suits this owner'),
|
|
247
|
+
followed: text(`ONE line the owner can read, in ${lang}: which of THEIR words this page followed, quoting them as written`),
|
|
248
|
+
}),
|
|
249
|
+
pictures: oneOf(Object.values(FreePictures), 'how the page treats its pictures, one word'),
|
|
250
|
+
nodes: jsonListOf(node),
|
|
251
|
+
}, 'one free page, flat');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/** A problem found while reading the wire: said in the wire's own words (`nodes[4] ("hero-title")`). */
|
|
255
|
+
export interface FreeWireFault {
|
|
256
|
+
path: string;
|
|
257
|
+
message: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const str = (v: unknown): string => (typeof v === 'string' ? v : '');
|
|
261
|
+
const list = (v: unknown): string[] => (Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : []);
|
|
262
|
+
const nodeAt = (i: number, id: string) => `nodes[${i}]${id ? ` ("${id}")` : ''}`;
|
|
263
|
+
|
|
264
|
+
/** `["fontSize:4rem", …]` → a style map, split at each line's FIRST colon; a line with none is a fault. */
|
|
265
|
+
function styleOf(lines: unknown, at: string, faults: FreeWireFault[]): FreeStyle {
|
|
266
|
+
const out: FreeStyle = {};
|
|
267
|
+
list(lines).forEach((line, k) => {
|
|
268
|
+
const i = line.indexOf(SEP);
|
|
269
|
+
if (i <= 0) faults.push({ path: `${at}[${k}]`, message: `"${line}" — write each style as <property>:<value>` });
|
|
270
|
+
else out[line.slice(0, i).trim()] = line.slice(i + 1).trim();
|
|
271
|
+
});
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** `enter:clipReveal:start` → a move; `none`, or a word the format does not hold, → none. */
|
|
276
|
+
export function freeMoveOf(word: string): FreeMove | null {
|
|
277
|
+
const [where, action, value] = String(word ?? '').split(SEP);
|
|
278
|
+
const trigger = (Object.keys(TRIGGER_WORD) as FreeTrigger[]).find(t => TRIGGER_WORD[t] === where);
|
|
279
|
+
const spec = trigger ? FREE_MOVES[trigger][action] : undefined;
|
|
280
|
+
if (!trigger || !spec) return null;
|
|
281
|
+
return { trigger, action, ...(spec.param && value ? { params: { [spec.param]: value } } : {}) };
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** A move → its wire word. */
|
|
285
|
+
export function freeMoveWord(move: FreeMove | null | undefined): string {
|
|
286
|
+
if (!move) return NONE;
|
|
287
|
+
const value = Object.values(move.params ?? {})[0];
|
|
288
|
+
return [TRIGGER_WORD[move.trigger], move.action, ...(value ? [value] : [])].join(SEP);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface ExpandedFreeWire {
|
|
292
|
+
page: FreePage;
|
|
293
|
+
/** Each tree path (`sections[0].children[1]`) → the wire node it came from (its index in `nodes`). */
|
|
294
|
+
paths: Record<string, number>;
|
|
295
|
+
faults: FreeWireFault[];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* The wire → the free tree. A node whose parent is not written before it, a top node that is not a Section, a child of a
|
|
300
|
+
* node that holds none, a repeated id — each is a FAULT and the node is left out: never guessed, never repaired here.
|
|
301
|
+
*/
|
|
302
|
+
export function expandFreeWire(wire: unknown): ExpandedFreeWire {
|
|
303
|
+
const faults: FreeWireFault[] = [];
|
|
304
|
+
const w: PlainObject = isPlainObject(wire) ? wire : {};
|
|
305
|
+
const read: PlainObject = isPlainObject(w['read']) ? w['read'] : {};
|
|
306
|
+
const sections: FreeNode[] = [];
|
|
307
|
+
const made = new Map<string, FreeNode>();
|
|
308
|
+
const pathOf = new Map<FreeNode, string>();
|
|
309
|
+
const paths: Record<string, number> = {};
|
|
310
|
+
(Array.isArray(w['nodes']) ? w['nodes'] : []).forEach((raw: unknown, i: number) => {
|
|
311
|
+
if (!isPlainObject(raw)) { faults.push({ path: `nodes[${i}]`, message: 'not a node' }); return; }
|
|
312
|
+
const id = str(raw['id']);
|
|
313
|
+
const at = nodeAt(i, id);
|
|
314
|
+
const type = str(raw['type']) as FreeNodeType;
|
|
315
|
+
if (!Object.values(FreeNodeType).includes(type)) { faults.push({ path: at, message: `"${type}" is not a node type — ${Object.values(FreeNodeType).join(', ')}` }); return; }
|
|
316
|
+
if (!id || made.has(id)) { faults.push({ path: at, message: id ? `the id "${id}" is used twice` : 'every node needs its own id' }); return; }
|
|
317
|
+
const node: FreeNode = { id, type, styleProps: styleOf(raw['base'], `${at}.base`, faults) };
|
|
318
|
+
if (type === FreeNodeType.Section) node.purpose = str(raw['purpose']) as FreePurpose;
|
|
319
|
+
if (str(raw['style'])) node.elementStyle = str(raw['style']);
|
|
320
|
+
if (type === FreeNodeType.Heading) node.level = typeof raw['level'] === 'number' ? raw['level'] : 0;
|
|
321
|
+
if (str(raw['role'])) node.role = str(raw['role']) as typeof FREE_LEAD_ROLE;
|
|
322
|
+
if (FREE_WORD_TYPES.includes(type)) node.text = str(raw['text']);
|
|
323
|
+
if (str(raw['src'])) node.src = str(raw['src']);
|
|
324
|
+
if (type === FreeNodeType.Button) node.href = str(raw['href']);
|
|
325
|
+
if (type === FreeNodeType.Slot) {
|
|
326
|
+
node.slot = str(raw['slot']);
|
|
327
|
+
node.opts = list(raw['opts']);
|
|
328
|
+
}
|
|
329
|
+
const responsive: Partial<Record<FreeLayer, FreeStyle>> = {};
|
|
330
|
+
for (const [key, layer] of [['phone', FreeLayer.Phone], ['tablet', FreeLayer.Tablet]] as const) {
|
|
331
|
+
const style = styleOf(raw[key], `${at}.${key}`, faults);
|
|
332
|
+
if (Object.keys(style).length) responsive[layer] = style;
|
|
333
|
+
}
|
|
334
|
+
if (Object.keys(responsive).length) node.responsive = responsive;
|
|
335
|
+
const hover = styleOf(raw['hover'], `${at}.hover`, faults);
|
|
336
|
+
if (Object.keys(hover).length) node.hover = hover;
|
|
337
|
+
const motion = str(raw['motion']);
|
|
338
|
+
const move = freeMoveOf(motion);
|
|
339
|
+
if (move) node.move = move;
|
|
340
|
+
else if (motion && motion !== NONE) faults.push({ path: `${at}.motion`, message: `"${motion}" is not a move — ${freeMoveWords().join(', ')}` });
|
|
341
|
+
|
|
342
|
+
const parentId = str(raw['parent']);
|
|
343
|
+
if (!parentId) {
|
|
344
|
+
if (type !== FreeNodeType.Section) { faults.push({ path: at, message: 'only a Section sits at the top of the page — give it a parent' }); return; }
|
|
345
|
+
pathOf.set(node, `sections[${sections.length}]`);
|
|
346
|
+
sections.push(node);
|
|
347
|
+
} else {
|
|
348
|
+
const parent = made.get(parentId);
|
|
349
|
+
if (!parent) { faults.push({ path: at, message: `its parent "${parentId}" is not written before it` }); return; }
|
|
350
|
+
if (!FREE_HOLDERS.includes(parent.type)) { faults.push({ path: at, message: `a ${parent.type} holds no children` }); return; }
|
|
351
|
+
if (type === FreeNodeType.Section) { faults.push({ path: at, message: 'a Section sits at the top of the page only — use a Container inside' }); return; }
|
|
352
|
+
(parent.children ??= []).push(node);
|
|
353
|
+
pathOf.set(node, `${pathOf.get(parent)}.children[${parent.children.length - 1}]`);
|
|
354
|
+
}
|
|
355
|
+
made.set(id, node);
|
|
356
|
+
paths[pathOf.get(node)!] = i;
|
|
357
|
+
});
|
|
358
|
+
const page: FreePage = {
|
|
359
|
+
read: { idea: str(read['idea']), why: str(read['why']), followed: str(read['followed']) },
|
|
360
|
+
pictures: str(w['pictures']),
|
|
361
|
+
sections,
|
|
362
|
+
};
|
|
363
|
+
return { page, paths, faults };
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** Every node of a free page with its tree path, its section's index and its ancestors (outermost first). */
|
|
367
|
+
export interface FreeWalked {
|
|
368
|
+
node: FreeNode;
|
|
369
|
+
path: string;
|
|
370
|
+
section: number;
|
|
371
|
+
up: FreeNode[];
|
|
372
|
+
}
|
|
373
|
+
export function walkFree(sections: ReadonlyArray<FreeNode>): FreeWalked[] {
|
|
374
|
+
const out: FreeWalked[] = [];
|
|
375
|
+
const visit = (node: FreeNode, path: string, section: number, up: FreeNode[]) => {
|
|
376
|
+
out.push({ node, path, section, up });
|
|
377
|
+
(node.children ?? []).forEach((c, i) => visit(c, `${path}.children[${i}]`, section, [...up, node]));
|
|
378
|
+
};
|
|
379
|
+
sections.forEach((s, i) => visit(s, `sections[${i}]`, i, []));
|
|
380
|
+
return out;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const lines = (style: FreeStyle | undefined): string[] => Object.entries(style ?? {}).map(([k, v]) => `${k}${SEP}${v}`);
|
|
384
|
+
|
|
385
|
+
/** The free tree → the wire (a ready-made place is left out: it is not the model's). */
|
|
386
|
+
export function freeToWire(page: FreePage): FreeWire {
|
|
387
|
+
const nodes = walkFree(page.sections.filter(s => !s.readyMade)).map(({ node: n, up }): FreeWireNode => ({
|
|
388
|
+
id: n.id, parent: up.length ? up[up.length - 1].id : '', type: n.type, purpose: n.purpose ?? '', style: n.elementStyle ?? '',
|
|
389
|
+
level: n.type === FreeNodeType.Heading ? n.level ?? 0 : 0, role: n.role ?? '', text: n.text ?? '', src: n.src ?? '', href: n.href ?? '',
|
|
390
|
+
slot: n.slot ?? '', opts: [...(n.opts ?? [])], base: lines(n.styleProps), phone: lines(n.responsive?.[FreeLayer.Phone]),
|
|
391
|
+
tablet: lines(n.responsive?.[FreeLayer.Tablet]), hover: lines(n.hover), motion: freeMoveWord(n.move),
|
|
392
|
+
}));
|
|
393
|
+
return { read: { ...page.read }, pictures: page.pictures, nodes };
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** A tree key → the wire key it came from. */
|
|
397
|
+
const WIRE_KEY: ReadonlyArray<[string, string]> = [
|
|
398
|
+
[`responsive.${FreeLayer.Phone}`, 'phone'],
|
|
399
|
+
[`responsive.${FreeLayer.Tablet}`, 'tablet'],
|
|
400
|
+
['responsive', 'phone'],
|
|
401
|
+
['styleProps', 'base'],
|
|
402
|
+
['hover', 'hover'],
|
|
403
|
+
['move', 'motion'],
|
|
404
|
+
['elementStyle', 'style'],
|
|
405
|
+
['text', 'text'],
|
|
406
|
+
['opts', 'opts'],
|
|
407
|
+
];
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* A judge's path into the tree (`sections[0].children[1].styleProps.fontSize`) said against the wire
|
|
411
|
+
* (`nodes[2] ("shop-title").base.fontSize`) — a repair names wire paths. A path that names no node stays as written.
|
|
412
|
+
*/
|
|
413
|
+
export function freeWirePath(path: string, paths: Readonly<Record<string, number>>, wire: Pick<FreeWire, 'nodes'>): string {
|
|
414
|
+
const m = /^(sections\[\d+\](?:\.children\[\d+\])*)(?:\.(.*))?$/.exec(path);
|
|
415
|
+
if (!m || paths[m[1]] === undefined) return path;
|
|
416
|
+
const i = paths[m[1]];
|
|
417
|
+
const rest = m[2] ?? '';
|
|
418
|
+
const hit = WIRE_KEY.find(([k]) => rest === k || rest.startsWith(`${k}.`));
|
|
419
|
+
const where = hit ? `.${hit[1]}${rest.length > hit[0].length ? rest.slice(hit[0].length) : ''}` : rest ? `.${rest}` : '';
|
|
420
|
+
return `${nodeAt(i, wire.nodes?.[i]?.id ?? '')}${where}`;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** A repair's edits remove a node: what sat inside it goes too, so no orphan is left. */
|
|
424
|
+
export function withoutFreeOrphans(wire: FreeWire): FreeWire {
|
|
425
|
+
const ids = new Set<string>();
|
|
426
|
+
const nodes = (wire.nodes ?? []).filter(n => {
|
|
427
|
+
if (n?.parent && !ids.has(n.parent)) return false;
|
|
428
|
+
if (n?.id) ids.add(n.id);
|
|
429
|
+
return true;
|
|
430
|
+
});
|
|
431
|
+
return { ...wire, nodes };
|
|
432
|
+
}
|
|
@@ -29,6 +29,17 @@ export interface PlanWordContext {
|
|
|
29
29
|
* they are editing — a phone number on their own page is theirs to move or keep. Never a model's earlier answer.
|
|
30
30
|
*/
|
|
31
31
|
known?: ReadonlyArray<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Judge bare numbers too (a free section, award plan §11.4 FS3 gate 1): "since 1998", "1,200 clients", "320 m²" — any
|
|
34
|
+
* number of three digits or more that is not part of an email, phone, price or time and that no owner text holds.
|
|
35
|
+
* Off for the plan's words, whose slots carry counts the composer owns.
|
|
36
|
+
*/
|
|
37
|
+
numbers?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Judge quotes too (a free section, FS3): words in quotation marks — three words or more — that no owner text holds
|
|
40
|
+
* are a testimonial or a saying the model made up, and a quote is a fact (R-H6).
|
|
41
|
+
*/
|
|
42
|
+
quotes?: boolean;
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
/** A text a model wrote, and where. */
|
|
@@ -94,6 +105,23 @@ const FACT_SHAPES: ReadonlyArray<{ kind: string; pattern: RegExp; key: (match: s
|
|
|
94
105
|
{ kind: 'time', pattern: /(?<!\d)\d{1,2}[:.]\d{2}(?!\d)/g, key: m => m.replace(/\D/g, '') },
|
|
95
106
|
];
|
|
96
107
|
|
|
108
|
+
/** A bare number of three digits or more (`numbers` only); a phone, a price or a time is judged as one first. */
|
|
109
|
+
const NUMBER_SHAPE = { kind: 'number', pattern: /(?<![\p{L}\p{N}])\d[\d,.]*\d(?![\p{L}\p{N}])/gu, key: (m: string) => m.replace(/\D/g, '') };
|
|
110
|
+
const MIN_NUMBER_DIGITS = 3;
|
|
111
|
+
|
|
112
|
+
/** A quotation: three words or more between quotation marks that stand outside a word (a Hebrew gershayim inside one —
|
|
113
|
+
* ש״ח, צה״ל — is not a quote mark). */
|
|
114
|
+
const QUOTE = /(?<![\p{L}\p{N}])["“„«״]([^"“”„«»״\n]+?)["”»״](?![\p{L}\p{N}])/gu;
|
|
115
|
+
const MIN_QUOTE_WORDS = 3;
|
|
116
|
+
const QUOTE_WORDS = /[\p{L}\p{N}]+/gu;
|
|
117
|
+
/** A text's words, lower case, one space apart — what a quote is found in. */
|
|
118
|
+
const plainWords = (text: string): string => ` ${(normalise(text).match(QUOTE_WORDS) ?? []).join(' ')} `;
|
|
119
|
+
|
|
120
|
+
/** Every quotation in `text` of three words or more, as written between its marks. */
|
|
121
|
+
export function quotesIn(text: string): string[] {
|
|
122
|
+
return [...String(text ?? '').matchAll(QUOTE)].map(m => m[1].trim()).filter(q => (q.match(QUOTE_WORDS) ?? []).length >= MIN_QUOTE_WORDS);
|
|
123
|
+
}
|
|
124
|
+
|
|
97
125
|
/** Every price written in `text` (commerce C-D21: what a business sells never carries one — the owner sets prices). */
|
|
98
126
|
export function pricesIn(text: string): string[] {
|
|
99
127
|
return (text.match(PRICE_SHAPE.pattern) ?? []).map(m => m.trim());
|
|
@@ -103,15 +131,22 @@ const MIN_PHONE_DIGITS = 8;
|
|
|
103
131
|
/** "2019 – 2024" is two years, not a phone number. */
|
|
104
132
|
const YEAR_RANGE = /^\s*\d{4}\s*[-–]\s*\d{4}\s*$/;
|
|
105
133
|
|
|
106
|
-
function ownedKeys(facts: PlanWordContext['facts'], known: ReadonlyArray<string> = []): Set<string> {
|
|
134
|
+
function ownedKeys(facts: PlanWordContext['facts'], known: ReadonlyArray<string> = [], numbers = false): Set<string> {
|
|
107
135
|
const keys = new Set<string>();
|
|
136
|
+
const shapes = numbers ? [...FACT_SHAPES, NUMBER_SHAPE] : FACT_SHAPES;
|
|
108
137
|
for (const value of [...Object.values(facts), ...known]) {
|
|
109
138
|
if (typeof value !== 'string') continue;
|
|
110
|
-
for (const shape of
|
|
139
|
+
for (const shape of shapes) for (const m of value.match(shape.pattern) ?? []) keys.add(`${shape.kind}:${shape.key(m)}`);
|
|
111
140
|
}
|
|
112
141
|
return keys;
|
|
113
142
|
}
|
|
114
143
|
|
|
144
|
+
/** `text` with every email, real phone, price and time blanked — what is left for the bare-number shape. */
|
|
145
|
+
function withoutFactShapes(text: string): string {
|
|
146
|
+
return FACT_SHAPES.reduce((rest, shape) => rest.replace(shape.pattern, m =>
|
|
147
|
+
(shape.kind === 'phone' && (shape.key(m).length < MIN_PHONE_DIGITS || YEAR_RANGE.test(m)) ? m : ' ')), text);
|
|
148
|
+
}
|
|
149
|
+
|
|
115
150
|
/**
|
|
116
151
|
* The words to avoid and the facts never given, in any texts a model wrote — the plan's (`planWordIssues`) and an AI
|
|
117
152
|
* Assist turn's field values (assist-core, R-H2): ONE judge of what a model may write.
|
|
@@ -119,7 +154,7 @@ function ownedKeys(facts: PlanWordContext['facts'], known: ReadonlyArray<string>
|
|
|
119
154
|
export function factIssues(texts: ReadonlyArray<WrittenText>, ctx: PlanWordContext): PlanWordIssue[] {
|
|
120
155
|
const issues: PlanWordIssue[] = [];
|
|
121
156
|
const avoid = [...new Set(ctx.avoidWords.map(w => w.trim()).filter(Boolean))].map(w => ({ word: w, pattern: wordPattern(w) }));
|
|
122
|
-
const owned = ownedKeys(ctx.facts, ctx.known);
|
|
157
|
+
const owned = ownedKeys(ctx.facts, ctx.known, ctx.numbers);
|
|
123
158
|
for (const { path, text } of texts) {
|
|
124
159
|
const words = normalise(text);
|
|
125
160
|
for (const a of avoid) if (a.pattern.test(words)) issues.push({ code: PlanWordIssueCode.AvoidWord, path, message: `uses "${a.word}" — a word this site must not use` });
|
|
@@ -130,6 +165,18 @@ export function factIssues(texts: ReadonlyArray<WrittenText>, ctx: PlanWordConte
|
|
|
130
165
|
if (!owned.has(`${shape.kind}:${key}`)) issues.push({ code: PlanWordIssueCode.InventedFact, path, message: `"${m.trim()}" looks like a ${shape.kind} the owner never gave — leave it out` });
|
|
131
166
|
}
|
|
132
167
|
}
|
|
168
|
+
if (ctx.quotes) {
|
|
169
|
+
const owners = [...Object.values(ctx.facts), ...(ctx.known ?? [])].filter((v): v is string => typeof v === 'string').map(plainWords);
|
|
170
|
+
for (const q of quotesIn(text)) {
|
|
171
|
+
if (!owners.some(o => o.includes(plainWords(q)))) issues.push({ code: PlanWordIssueCode.InventedFact, path, message: `"${q}" reads as a quote the owner never gave — a quote is a fact: leave it out` });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (ctx.numbers) {
|
|
175
|
+
for (const m of withoutFactShapes(text).match(NUMBER_SHAPE.pattern) ?? []) {
|
|
176
|
+
const key = NUMBER_SHAPE.key(m);
|
|
177
|
+
if (key.length >= MIN_NUMBER_DIGITS && !owned.has(`number:${key}`)) issues.push({ code: PlanWordIssueCode.InventedFact, path, message: `"${m.trim()}" looks like a number the owner never gave — leave it out` });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
133
180
|
}
|
|
134
181
|
return issues;
|
|
135
182
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { patternById, PatternNode } from './patterns';
|
|
2
|
+
import { wordPattern } from './plan-words';
|
|
3
|
+
import { PageSectionPlan } from './site-plan.model';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* WHAT THE OWNER'S PROMPT RULED OUT, AS A READY-MADE SECTION CAN BREAK IT (award plan FS-D47, R-H20). The reading keeps
|
|
7
|
+
* the owner's refused and asked words as they wrote them (§11.4a); a ready-made section can only break the few of them
|
|
8
|
+
* that a pattern decides by its parts — pictures, a video, motion. Those are read here, in English and Hebrew, from the
|
|
9
|
+
* reading's own lists (never guessed from taste words), and judged against a plan section's pattern as it would be
|
|
10
|
+
* stamped (its `without` parts left out). The fall back picks only among sections that honour them; when it cannot, the
|
|
11
|
+
* followed line SAYS which of the owner's words the page no longer follows. Pure.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export enum PromptLimit {
|
|
15
|
+
/** "no pictures", "only the names", "mostly words". */
|
|
16
|
+
NoPictures = 'no-pictures',
|
|
17
|
+
NoVideo = 'no-video',
|
|
18
|
+
/** "nothing moving", "no animation". */
|
|
19
|
+
NoMotion = 'no-motion',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A refused entry that IS one of these words rules the thing out ("pictures"; never "stock photos", which refuses stock). */
|
|
23
|
+
const REFUSED_WORDS: Readonly<Record<PromptLimit, ReadonlyArray<string>>> = {
|
|
24
|
+
[PromptLimit.NoPictures]: ['pictures', 'photos', 'photographs', 'images', 'תמונות', 'צילומים'],
|
|
25
|
+
[PromptLimit.NoVideo]: ['video', 'videos', 'film', 'films', 'וידאו', 'סרטון', 'סרטונים'],
|
|
26
|
+
[PromptLimit.NoMotion]: ['motion', 'animation', 'animations', 'movement', 'תנועה', 'אנימציה', 'אנימציות'],
|
|
27
|
+
};
|
|
28
|
+
/** A phrase that rules the thing out wherever the reading kept it (asked, said or refused). */
|
|
29
|
+
const RULING_PHRASES: Readonly<Record<PromptLimit, ReadonlyArray<string>>> = {
|
|
30
|
+
[PromptLimit.NoPictures]: ['no pictures', 'no photos', 'no images', 'without pictures', 'without photos', 'mostly words', 'only words', 'just words', 'בלי תמונות', 'ללא תמונות', 'רק מילים', 'בלי צילומים'],
|
|
31
|
+
[PromptLimit.NoVideo]: ['no video', 'no videos', 'without video', 'בלי וידאו', 'בלי סרטונים', 'ללא וידאו', 'ללא סרטונים'],
|
|
32
|
+
[PromptLimit.NoMotion]: ['no motion', 'no animation', 'no animations', 'nothing moving', 'without motion', 'בלי תנועה', 'בלי אנימציה', 'בלי אנימציות', 'ללא תנועה'],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** The reading's lists as the free-page brief keeps them (§11.4a). */
|
|
36
|
+
export interface PromptReading {
|
|
37
|
+
readonly refused?: ReadonlyArray<string>;
|
|
38
|
+
readonly asked?: ReadonlyArray<string>;
|
|
39
|
+
readonly said?: ReadonlyArray<string>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const plain = (s: string) => String(s ?? '').normalize('NFKC').toLowerCase().replace(/^(any|no|בלי|ללא)\s+/, '').trim();
|
|
43
|
+
|
|
44
|
+
/** What the owner's words rule out that a ready-made section could break. */
|
|
45
|
+
export function promptLimitsOf(reading: PromptReading | null | undefined): PromptLimit[] {
|
|
46
|
+
const refused = (reading?.refused ?? []).map(plain);
|
|
47
|
+
const all = [...(reading?.refused ?? []), ...(reading?.asked ?? []), ...(reading?.said ?? [])].map(s => String(s ?? ''));
|
|
48
|
+
return Object.values(PromptLimit).filter(limit =>
|
|
49
|
+
refused.some(r => REFUSED_WORDS[limit].includes(r))
|
|
50
|
+
|| RULING_PHRASES[limit].some(phrase => all.some(text => wordPattern(phrase).test(text.normalize('NFKC').toLowerCase()))));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const PICTURE_TYPES: ReadonlyArray<string> = ['Image', 'Gallery'];
|
|
54
|
+
const CARD_RECIPE = 'card';
|
|
55
|
+
const CARD_MEDIA = 'media';
|
|
56
|
+
const IMAGE_BIND = 'image';
|
|
57
|
+
|
|
58
|
+
function shows(node: PatternNode, without: ReadonlySet<string>, out: Set<PromptLimit>): void {
|
|
59
|
+
if (node.optional && without.has(node.optional)) return;
|
|
60
|
+
// a picture node, or a recipe that draws one: a card keeps its media part unless switched off, a bound image
|
|
61
|
+
if (PICTURE_TYPES.includes(node.t) || (node.recipe === CARD_RECIPE && node.parts?.[CARD_MEDIA] !== false) || node.binds?.[IMAGE_BIND]) out.add(PromptLimit.NoPictures);
|
|
62
|
+
if (node.t === 'Video') out.add(PromptLimit.NoVideo);
|
|
63
|
+
if (node.tracks?.length) out.add(PromptLimit.NoMotion);
|
|
64
|
+
for (const child of node.c ?? []) shows(child, without, out);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The owner's limits a plan section would break, stamped as planned (an unknown pattern breaks none it can be judged on). */
|
|
68
|
+
export function sectionBreaks(section: PageSectionPlan, limits: ReadonlyArray<PromptLimit>): PromptLimit[] {
|
|
69
|
+
const pattern = patternById(section.pattern);
|
|
70
|
+
if (!pattern || !limits.length) return [];
|
|
71
|
+
const found = new Set<PromptLimit>();
|
|
72
|
+
if (pattern.scene || pattern.film) found.add(PromptLimit.NoMotion);
|
|
73
|
+
shows(pattern.node, new Set(section.without ?? []), found);
|
|
74
|
+
return limits.filter(l => found.has(l));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** One sentence per limit broken, in the site's language: n sections are ready-made and do what the owner ruled out. */
|
|
78
|
+
const UNFOLLOWED: Readonly<Record<'en' | 'he', Readonly<Record<PromptLimit, (n: number) => string>>>> = {
|
|
79
|
+
en: {
|
|
80
|
+
[PromptLimit.NoPictures]: n => `${n === 1 ? 'One section is' : `${n} sections are`} ready-made and ${n === 1 ? 'shows' : 'show'} pictures, which you asked to leave out.`,
|
|
81
|
+
[PromptLimit.NoVideo]: n => `${n === 1 ? 'One section is' : `${n} sections are`} ready-made and ${n === 1 ? 'plays a video' : 'play videos'}, which you asked to leave out.`,
|
|
82
|
+
[PromptLimit.NoMotion]: n => `${n === 1 ? 'One section is' : `${n} sections are`} ready-made and ${n === 1 ? 'moves' : 'move'} as the page scrolls, which you asked to leave out.`,
|
|
83
|
+
},
|
|
84
|
+
he: {
|
|
85
|
+
[PromptLimit.NoPictures]: n => `${n === 1 ? 'חלק אחד מוכן מראש ומציג' : `${n} חלקים מוכנים מראש ומציגים`} תמונות, אף שביקשת בלי תמונות.`,
|
|
86
|
+
[PromptLimit.NoVideo]: n => `${n === 1 ? 'חלק אחד מוכן מראש ומציג סרטון' : `${n} חלקים מוכנים מראש ומציגים סרטונים`}, אף שביקשת בלי סרטונים.`,
|
|
87
|
+
[PromptLimit.NoMotion]: n => `${n === 1 ? 'חלק אחד מוכן מראש וזז' : `${n} חלקים מוכנים מראש וזזים`} עם הגלילה, אף שביקשת בלי תנועה.`,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** The followed line after a fall back: the model's line, then what the page no longer follows (never a claim kept). */
|
|
92
|
+
export function followedAfter(line: string, broken: ReadonlyMap<PromptLimit, number>, language: string | null | undefined): string {
|
|
93
|
+
const words = UNFOLLOWED[language === 'he' ? 'he' : 'en'];
|
|
94
|
+
const said = Object.values(PromptLimit).filter(l => (broken.get(l) ?? 0) > 0).map(l => words[l](broken.get(l)!));
|
|
95
|
+
return [String(line ?? '').trim(), ...said].filter(Boolean).join(' ');
|
|
96
|
+
}
|
|
@@ -60,6 +60,10 @@ export * from './layout-render-check';
|
|
|
60
60
|
export * from './layout-drift';
|
|
61
61
|
export * from './layout-type';
|
|
62
62
|
export * from './layout-section-fallback';
|
|
63
|
+
export * from './free-wire';
|
|
64
|
+
export * from './check-free';
|
|
65
|
+
export * from './free-fallback';
|
|
66
|
+
export * from './prompt-limits';
|
|
63
67
|
export * from './layout-photos';
|
|
64
68
|
export * from './photo-inventory';
|
|
65
69
|
export * from './check-layout';
|