@vectoriox/iox-ui 5.173.0 → 5.174.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.
@@ -1,5 +1,5 @@
1
1
  import { PathIssue } from './shape-check';
2
- import { FACT_KEYS, FactKey, SitePlan } from './site-plan.model';
2
+ import { ContentSeedPlan, FACT_KEYS, FactKey, SitePlan } from './site-plan.model';
3
3
 
4
4
  /**
5
5
  * The plan stage's word checks (AI plan §3d / §3h, M1-3): every text a model WROTE into a plan — the tagline, page
@@ -61,8 +61,12 @@ export function writtenTexts(plan: SitePlan): WrittenText[] {
61
61
  });
62
62
  plan.contentTypes?.forEach((type, t) => {
63
63
  add(`contentTypes[${t}].label`, type.label);
64
- const { perItem, ...seed }: Record<string, unknown> & { perItem?: Readonly<Record<string, ReadonlyArray<string>>> } = type.seed ?? {};
65
- for (const [field, list] of Object.entries(perItem ?? {})) list.forEach((v, k) => add(`contentTypes[${t}].seed.perItem.${field}[${k}]`, v));
64
+ // X4: an imported item's old address is no one's words; a list field's value is a list of strings.
65
+ const { perItem, importedFrom: _from, ...seed }: Record<string, unknown> & Pick<ContentSeedPlan, 'perItem'> = type.seed ?? {};
66
+ for (const [field, list] of Object.entries(perItem ?? {})) list.forEach((v, k) => {
67
+ if (Array.isArray(v)) v.forEach((w, j) => add(`contentTypes[${t}].seed.perItem.${field}[${k}][${j}]`, w));
68
+ else add(`contentTypes[${t}].seed.perItem.${field}[${k}]`, v);
69
+ });
66
70
  for (const [field, value] of Object.entries(seed)) {
67
71
  const values = Array.isArray(value) ? value : [value];
68
72
  values.forEach((v, k) => add(`contentTypes[${t}].seed.${field}${Array.isArray(value) ? `[${k}]` : ''}`, v));
@@ -0,0 +1,232 @@
1
+ import {
2
+ buildPopupRecipe, CompositeNode, CompositeNodeFactory, findByRole, POPUP_BODY_MAX_CHARS, POPUP_KIND_MIX, POPUP_TITLE_MAX_WORDS, PopupAgain, PopupArrive,
3
+ PopupArt, PopupForm, PopupKind, PopupRole, popupWords, removeFromComposite,
4
+ } from '@vectoriox/iox-ui/composite-core';
5
+
6
+ import { SPEC_SITE_LAYOUT } from './site-spec.generated';
7
+ import { DEFAULT_SITE_LOCALE, PlanStatedFact, SitePlan } from './site-plan.model';
8
+
9
+ /**
10
+ * THE GENERATED POPUP (popups-plan.md §10, PU3; R-H1, R-H6). A generated site gets a popup ONLY from the owner's popup lines
11
+ * (`plan.popup`, set by the server from the Plan step — never a model's): the reading's STATED news, or the newsletter tick.
12
+ * The model's part is a few words on the Pages wire (`mixes.popup`: `kind:`, `form:`, `arrive:`, `link:<page key>` — the
13
+ * contract's `POPUP.wire`); never a word of copy. The words on the popup are the owner's (the news as stated), and:
14
+ * - every figure (a run of digits: a date, a price, a percent, a count) in them must be in the owner's own words (the quote) —
15
+ * otherwise there is no popup at all, said (never a discount the owner did not give);
16
+ * - a generated popup is never centred (`corner` or `bar`, the contract's `generatedForms`) and never waits for a button;
17
+ * - one popup per site, a global among the BEFORE globals (the palette's place);
18
+ * - it is stamped from composite-core's `buildPopupRecipe`, the palette's ONE recipe (R-H1).
19
+ * Pure: no clock, no transport.
20
+ */
21
+
22
+ interface PopupTable {
23
+ ingredients: Readonly<Record<string, ReadonlyArray<string>>>;
24
+ meanings: Readonly<Record<string, string>>;
25
+ meaningsHe?: Readonly<Record<string, string>>;
26
+ defaults: Readonly<Record<string, string>>;
27
+ named: Readonly<Record<string, Readonly<Record<string, string>>>>;
28
+ generatedForms: ReadonlyArray<string>;
29
+ fingerprint: ReadonlyArray<string>;
30
+ wire: { ingredients: ReadonlyArray<string>; never: ReadonlyArray<string>; link: string };
31
+ linkFallback: ReadonlyArray<string>;
32
+ }
33
+
34
+ const P = SPEC_SITE_LAYOUT.popup as unknown as PopupTable;
35
+
36
+ /** The wire's link word (`link:<page key>`) — a page of the plan, never an ingredient of the table. */
37
+ export const POPUP_LINK_WORD = P.wire.link;
38
+
39
+ /** The global's id — one popup per site. */
40
+ export const POPUP_GLOBAL_ID = 'popup';
41
+
42
+ export class PopupMixError extends Error {}
43
+
44
+ /** The words on the wire: `<ingredient>:<word>` for every word of the wire's ingredients but the `never` ones, then the
45
+ * link (`link:<page key>`, any page of the plan — written by the model, so it is not a closed list). */
46
+ export function popupWireWords(): string[] {
47
+ return P.wire.ingredients.flatMap(k => (P.ingredients[k] ?? []).map(w => `${k}:${w}`)).filter(w => !P.wire.never.includes(w.replace(':', '.')));
48
+ }
49
+
50
+ /** What a popup word means (the contract's meanings), in English or Hebrew. */
51
+ export function popupMeaning(ingredient: string, word: string, locale?: string | null): string {
52
+ const at = `${ingredient}.${word}`;
53
+ return (locale === 'he' ? P.meaningsHe?.[at] : undefined) ?? P.meanings[at] ?? word;
54
+ }
55
+
56
+ /** The ingredients the wire carries, in the contract's order. */
57
+ export const POPUP_WIRE_INGREDIENTS: ReadonlyArray<string> = P.wire.ingredients;
58
+
59
+ /** A popup's words as the model wrote them: one word per ingredient, and at most one link. */
60
+ export interface PopupMixWords {
61
+ kind?: PopupKind;
62
+ form?: PopupForm;
63
+ arrive?: PopupArrive;
64
+ /** The page key the action leads to. */
65
+ link?: string;
66
+ }
67
+
68
+ /** The words back into a mix. Refuses an unknown word and two words for one ingredient. A word the wire never OFFERS
69
+ * (centred, button) still reads — `checkPopup` mends it (a site is never refused for its popup). */
70
+ export function popupMixFromWords(words: ReadonlyArray<string>): PopupMixWords {
71
+ const out: Record<string, string> = {};
72
+ for (const pair of words) {
73
+ const text = String(pair);
74
+ const at = text.indexOf(':');
75
+ const [k, w] = at < 0 ? [text, ''] : [text.slice(0, at), text.slice(at + 1)];
76
+ if (!w || (k !== POPUP_LINK_WORD && !(P.wire.ingredients.includes(k) && (P.ingredients[k] ?? []).includes(w)))) {
77
+ throw new PopupMixError(`"${text}" is no popup word (${P.wire.ingredients.join(', ')} or ${POPUP_LINK_WORD}:<page key>)`);
78
+ }
79
+ if (out[k] !== undefined && out[k] !== w) throw new PopupMixError(`a popup has one ${k} ("${out[k]}" and "${w}")`);
80
+ out[k] = w;
81
+ }
82
+ return out as PopupMixWords;
83
+ }
84
+
85
+ /** A plan's popup words (`mixes.popup`), or null when it has none. */
86
+ export function popupMixOfPlan(plan: { readonly mixes?: { readonly popup?: ReadonlyArray<string> } }): PopupMixWords | null {
87
+ const words = plan.mixes?.popup;
88
+ return words?.length ? popupMixFromWords(words) : null;
89
+ }
90
+
91
+ /** The popup a plan makes, judged — everything `buildPopupRecipe` is given. */
92
+ export interface PlannedPopup {
93
+ kind: PopupKind;
94
+ form: PopupForm;
95
+ arrive: PopupArrive;
96
+ again: PopupAgain;
97
+ /** A generated popup wears no picture until the owner adds one (no AI or library picture yet). */
98
+ art: PopupArt;
99
+ /** The owner's words. */
100
+ title: string;
101
+ body: string;
102
+ /** The page the ONE action leads to, and its words (the page's name); null = no action. A newsletter's form is its action. */
103
+ actionRoute: string | null;
104
+ actionLabel: string;
105
+ }
106
+
107
+ export enum PopupRefusal {
108
+ /** A figure in the news the owner's words do not hold. */
109
+ Figure = 'popup-figure',
110
+ /** The news is longer than a popup holds — the owner's words are never cut. */
111
+ TooLong = 'popup-too-long',
112
+ }
113
+
114
+ export interface PopupCheck {
115
+ popup: PlannedPopup | null;
116
+ /** Every mend, in words (the composer's `popup-mended` issues). */
117
+ said: string[];
118
+ /** Why the owner's line made no popup, or null. */
119
+ refused: { code: PopupRefusal; said: string } | null;
120
+ }
121
+
122
+ const DIGITS = /\d+/g;
123
+
124
+ /** The figures (runs of digits) in `text` that `owner` does not hold — a date, a price, a percent or a count the news
125
+ * gained between the owner's words and the popup. Stricter than the plan's `factIssues` on purpose: there a figure is
126
+ * judged by its shape and a bare number from three digits; a popup is a claim to a passer-by, so every figure counts. */
127
+ export function figuresNotIn(text: string, owner: string): string[] {
128
+ const own = new Set(owner.match(DIGITS) ?? []);
129
+ return [...new Set((text.match(DIGITS) ?? []).filter(d => !own.has(d)))];
130
+ }
131
+
132
+ const nonEmpty = (s: unknown): s is string => typeof s === 'string' && s.trim().length > 0;
133
+ const stated = (fact: PlanStatedFact | undefined): fact is PlanStatedFact => !!fact && nonEmpty(fact.value) && nonEmpty(fact.quote);
134
+ const wordCount = (s: string) => s.trim().split(/\s+/).filter(Boolean).length;
135
+ const generated = (form: string): form is PopupForm => P.generatedForms.includes(form) && !P.wire.never.includes(`form.${form}`);
136
+ const named = (kind: PopupKind) => POPUP_KIND_MIX[kind];
137
+
138
+ /** The page the action leads to: the page the words name, else the first page of the fallback archetypes; never the home
139
+ * page and never a page per item (a route with a parameter). */
140
+ function linkedPage(plan: SitePlan, key: string | undefined, said: string[]): { route: string; name: string } | null {
141
+ const reachable = (p: SitePlan['pages'][number]) => !p.isHome && p.route !== '/' && !p.route.includes(':');
142
+ if (key !== undefined) {
143
+ const page = plan.pages.find(p => p.key === key);
144
+ if (page && reachable(page)) return { route: page.route, name: page.name };
145
+ said.push(`the popup's link "${key}" is no page it can open — it leads to ${P.linkFallback.join(' or ')} if the site has one`);
146
+ }
147
+ const fallback = plan.pages.find(p => reachable(p) && !!p.archetype && P.linkFallback.includes(p.archetype));
148
+ return fallback ? { route: fallback.route, name: fallback.name } : null;
149
+ }
150
+
151
+ /**
152
+ * The popup a plan makes (R-H6): only from the owner's lines; the model's words mended to what a generated popup may be
153
+ * (each mend said). No line, no popup — the words are dropped, said.
154
+ */
155
+ export function checkPopup(plan: SitePlan): PopupCheck {
156
+ const said: string[] = [];
157
+ let words: PopupMixWords = {};
158
+ try { words = popupMixOfPlan(plan) ?? {}; } catch { /* the validator names the word */ }
159
+ const news = stated(plan.popup?.news) ? plan.popup!.news! : null;
160
+ const newsletter = plan.popup?.newsletter === true;
161
+ const hasWords = !!plan.mixes?.popup?.length;
162
+ if (!news && !newsletter) {
163
+ if (hasWords) said.push("the plan's popup words are left out — the owner's lines ask for no popup");
164
+ return { popup: null, said, refused: null };
165
+ }
166
+
167
+ // The kind follows the owner's line: news is an announcement or an offer, the tick alone a newsletter.
168
+ const backed = (k: PopupKind) => (k === PopupKind.Newsletter ? newsletter : !!news);
169
+ let kind = words.kind ?? (news ? P.defaults['kind'] as PopupKind : PopupKind.Newsletter);
170
+ if (!backed(kind)) {
171
+ const instead = news ? P.defaults['kind'] as PopupKind : PopupKind.Newsletter;
172
+ said.push(`the popup is ${instead === PopupKind.Newsletter ? 'the newsletter invitation' : 'the owner\'s news'}, not ${kind} — that is the line the owner ticked`);
173
+ kind = instead;
174
+ }
175
+
176
+ let form = words.form ?? named(kind).form;
177
+ if (!generated(form)) {
178
+ const instead = generated(named(kind).form) ? named(kind).form : PopupForm.Corner;
179
+ said.push(`a generated popup is never ${form} — it sits as ${instead}`);
180
+ form = instead;
181
+ }
182
+ let arrive = words.arrive ?? named(kind).arrive;
183
+ if (P.wire.never.includes(`arrive.${arrive}`)) {
184
+ said.push(`a generated popup arrives by itself (${named(kind).arrive}), never only by ${arrive}`);
185
+ arrive = named(kind).arrive;
186
+ }
187
+
188
+ const lang = plan.locale ?? DEFAULT_SITE_LOCALE;
189
+ const label = popupWords(lang).label;
190
+ const base = { kind, form, arrive, again: named(kind).again, art: PopupArt.None };
191
+ if (kind === PopupKind.Newsletter) {
192
+ if (words.link !== undefined) said.push('a newsletter popup has its form as its action — the link is left out');
193
+ return { popup: { ...base, title: label[kind], body: '', actionRoute: null, actionLabel: '' }, said, refused: null };
194
+ }
195
+
196
+ const value = news!.value.trim();
197
+ const figures = figuresNotIn(value, news!.quote);
198
+ if (figures.length) {
199
+ return { popup: null, said, refused: { code: PopupRefusal.Figure, said: `no popup: "${figures.join('", "')}" in the news is not in the owner's words` } };
200
+ }
201
+ if (value.length > POPUP_BODY_MAX_CHARS) {
202
+ return { popup: null, said, refused: { code: PopupRefusal.TooLong, said: `no popup: the news is longer than ${POPUP_BODY_MAX_CHARS} characters — the owner's words are never cut` } };
203
+ }
204
+ // A short news is the title itself; a longer one sits under the kind's name.
205
+ const short = wordCount(value) <= POPUP_TITLE_MAX_WORDS;
206
+ const page = linkedPage(plan, words.link, said);
207
+ return {
208
+ popup: { ...base, title: short ? value : label[kind], body: short ? '' : value, actionRoute: page?.route ?? null, actionLabel: page?.name ?? '' },
209
+ said,
210
+ refused: null,
211
+ };
212
+ }
213
+
214
+ /** The popup's fingerprint token (`popup:<form>`, the contract's `POPUP.fingerprint`), or null — recorded, never a refusal. */
215
+ export function popupTokenOf(popup: Pick<PlannedPopup, 'form'> | null | undefined): string | null {
216
+ return popup ? `popup:${P.fingerprint.map(k => (popup as unknown as Record<string, string>)[k]).join('/')}` : null;
217
+ }
218
+
219
+ /**
220
+ * The popup's global, stamped through the palette's recipe (R-H1) with the composer's factory: a global among the BEFORE
221
+ * globals, its empty body left out. `newsletterForm` makes the newsletter preset form (the composer's own forms path).
222
+ */
223
+ export function composePopup(planned: PlannedPopup, create: CompositeNodeFactory, lang: string, newsletterForm: () => CompositeNode): CompositeNode {
224
+ const root = buildPopupRecipe(create, {
225
+ kind: planned.kind, lang, title: planned.title, body: planned.body, form: planned.form, arrive: planned.arrive, again: planned.again,
226
+ art: planned.art, actionRoute: planned.actionRoute, actionLabel: planned.actionLabel,
227
+ newsletterForm: planned.kind === PopupKind.Newsletter ? newsletterForm() : null,
228
+ });
229
+ const body = findByRole(root, PopupRole.Body);
230
+ if (body && !planned.body) removeFromComposite(root, body);
231
+ return root;
232
+ }
@@ -35,6 +35,7 @@ export * from './showcase';
35
35
  export * from './site-build-run';
36
36
  export * from './redesign-run';
37
37
  export * from './redesign-additions';
38
+ export * from './import-plan';
38
39
  export * from './ai-run';
39
40
  export * from './generation-tier';
40
41
  export * from './start-quote';
@@ -86,6 +87,7 @@ export * from './header-mix';
86
87
  export * from './header-edit';
87
88
  export * from './opening-mix';
88
89
  export * from './body-mix';
90
+ export * from './popup-plan';
89
91
  export * from './opening-edit';
90
92
  export * from './footer-mix';
91
93
  export * from './layout-edits';
@@ -3,7 +3,8 @@ import { FILM_PREPARED_PICTURES, FrameExtension, FrameSequence } from '@vectorio
3
3
 
4
4
  import { BindScope, patternNeedsBinding, PatternGlobalPosition, patternScopes, SCENE_LEVEL, SITE_PATTERNS } from './patterns';
5
5
  import { withDerivedSources } from './plan-derived';
6
- import { GlobalSlot, PagePlan, PageSectionPlan, ShopPlan, ShopResource, SiteBusiness, SiteLocale, SitePlan, SitePlanSourceKind, SITE_PLAN_VERSION } from './site-plan.model';
6
+ import { ContentFieldControl, ContentRole, ContentTypePlan, GlobalSlot, PagePlan, PageSectionPlan, ShopPlan, ShopResource, SiteBusiness, SiteLocale, SitePlan, SitePlanSourceKind,
7
+ SITE_PLAN_VERSION } from './site-plan.model';
7
8
  import { shopCategoriesOf, ShopSourceRole, shopSourceAliases } from './shop-plan';
8
9
  import { STUDIO_TEMPLATE } from './templates';
9
10
 
@@ -31,6 +32,20 @@ export const SHOWCASE_FILM: FrameSequence = {
31
32
 
32
33
  const ITEM_ROUTE = '/work/:slug';
33
34
  const LIST_SOURCE = 'projects';
35
+ /** X4: the item's own text — the Studio's projects play `body` on show, so `item.body` (an imported plan's) is composed too. */
36
+ const BODY_FIELD = 'body';
37
+ const SHOWCASE_BODY = 'The first paragraph of the project\'s own story.\n\nThe second paragraph, kept apart by a blank line.';
38
+
39
+ /** The Studio's content types, its projects with their own text (`body`) — what every showcase plan holds. */
40
+ function showcaseContentTypes(): ContentTypePlan[] {
41
+ const types = JSON.parse(JSON.stringify(STUDIO_TEMPLATE.contentTypes)) as ContentTypePlan[];
42
+ return types.map((type, i) => i ? type : {
43
+ ...type,
44
+ roles: { ...type.roles, [ContentRole.Body]: BODY_FIELD },
45
+ fields: [...type.fields, { name: BODY_FIELD, type: 'string', controller: ContentFieldControl.Textarea }],
46
+ ...(type.seed ? { seed: { ...type.seed, [BODY_FIELD]: SHOWCASE_BODY } } : {}),
47
+ });
48
+ }
34
49
 
35
50
  const routeOf = (family: string) => `/${family}`;
36
51
  /** A page key: the family — never a global slot's name (`header` would share the site header's ids). */
@@ -115,7 +130,7 @@ export function showcasePlans(input: ShowcaseInput): SitePlan[] {
115
130
  business: JSON.parse(JSON.stringify(input.business)),
116
131
  ...(input.locale ? { locale: input.locale } : {}),
117
132
  design: JSON.parse(JSON.stringify(design)),
118
- contentTypes: JSON.parse(JSON.stringify(STUDIO_TEMPLATE.contentTypes)),
133
+ contentTypes: showcaseContentTypes(),
119
134
  dataSources: JSON.parse(JSON.stringify(STUDIO_TEMPLATE.dataSources)),
120
135
  pages: JSON.parse(JSON.stringify(planPages)),
121
136
  globals: { [GlobalSlot.Header]: headers[i % headers.length], [GlobalSlot.Footer]: footers[i % footers.length] } as SitePlan['globals'],
@@ -15,6 +15,9 @@ export enum SiteBuildKind {
15
15
  Build = 'build',
16
16
  /** A new design for a built site, everything it holds kept (site-redesign RD2) — `redesign-run.ts`. */
17
17
  Redesign = 'redesign',
18
+ /** Bring my site X4 (W2-5's first kind): a plan read from the owner's own site (`planImport`) — its real items keep
19
+ * their old addresses (`importedFrom`). */
20
+ Import = 'import',
18
21
  }
19
22
 
20
23
  export enum SiteBuildStatus {
@@ -19,11 +19,14 @@ export const SITE_PLAN_VERSION = '1';
19
19
  export enum SitePlanSourceKind {
20
20
  Template = 'template',
21
21
  Ai = 'ai',
22
+ /** Bring my site X4: read from the owner's own site (`planImport`) — its real items, its text pages. */
23
+ Import = 'import',
22
24
  }
23
25
 
24
26
  export type SitePlanSource =
25
27
  | { kind: `${SitePlanSourceKind.Template}`; templateId: string; templateVersion: number }
26
- | { kind: `${SitePlanSourceKind.Ai}`; runId: string };
28
+ | { kind: `${SitePlanSourceKind.Ai}`; runId: string }
29
+ | { kind: `${SitePlanSourceKind.Import}`; scanId: string };
27
30
 
28
31
  /** A fact a customer could be held to. Only ever the customer's own words; blank → a placeholder. */
29
32
  export type FactKey = keyof typeof SPEC_SITE_FACTS;
@@ -94,8 +97,11 @@ export interface ContentSeedPlan {
94
97
  readonly count: number;
95
98
  readonly sample: boolean;
96
99
  readonly isPublished: boolean;
97
- /** Per field, one value per sample: real content where the items are about a subject anyone can know. Wins over the field's template. */
98
- readonly perItem?: Readonly<Record<string, ReadonlyArray<string>>>;
100
+ /** Per field, one value per sample: real content where the items are about a subject anyone can know. Wins over the field's
101
+ * template. An array field's value is a list of strings (an imported item's pictures, X4). */
102
+ readonly perItem?: Readonly<Record<string, ReadonlyArray<string | ReadonlyArray<string>>>>;
103
+ /** X4: per item, the old address it was read from — real items only (`sample: false`); each item keeps it as `importedFrom`. */
104
+ readonly importedFrom?: ReadonlyArray<string>;
99
105
  readonly [field: string]: unknown;
100
106
  }
101
107
 
@@ -120,6 +126,9 @@ export enum ContentRole {
120
126
  Link = 'link',
121
127
  /** AW11-D10: its own colour (a hex) — a colour block's ground; the ink on it is chosen when the page is drawn. */
122
128
  Colour = 'colour',
129
+ /** Bring my site X4: its own text at length (an imported post's body, paragraphs kept) — the item's page only
130
+ * (`item.body`), never a card or a list (`ITEM_PAGE_ONLY_ROLES`). */
131
+ Body = 'body',
123
132
  /** Commerce C-D21: the shop's own price — played only by the shop's fields (`SHOP_ROLES`), never a content type's. */
124
133
  Price = 'price',
125
134
  /** Commerce C-D21: the shop's earlier price, struck through. */
@@ -129,6 +138,10 @@ export enum ContentRole {
129
138
  /** The roles only the shop plays (contract `site.roles` less `planShape.roles`): a content type never names them. */
130
139
  export const SHOP_ONLY_CONTENT_ROLES: ReadonlyArray<`${ContentRole}`> = [ContentRole.Price, ContentRole.CompareAt];
131
140
 
141
+ /** X4: the roles shown only on the item's own page — never a list's part (a card, a row): `listShapeOfType` and
142
+ * `listBindingOfType` leave them out, and the model is never offered them (`plan-wire`). */
143
+ export const ITEM_PAGE_ONLY_ROLES: ReadonlyArray<`${ContentRole}`> = [ContentRole.Body];
144
+
132
145
  /** What each role means, verbatim from the contract — what the model reads. */
133
146
  export const CONTENT_ROLE_MEANINGS: Readonly<Record<`${ContentRole}`, string>> = SPEC_SITE_ROLES;
134
147
  export const REQUIRED_CONTENT_ROLES: ReadonlyArray<`${ContentRole}`> = SPEC_SITE_REQUIRED_ROLES;
@@ -364,6 +377,23 @@ export interface SitePlan {
364
377
  readonly direction?: PlanDirection;
365
378
  /** The header and footer as mixes of ingredients (ingredients.md): a mix wins over its `globals` pattern. */
366
379
  readonly mixes?: PlanMixes;
380
+ /** Popups PU3: the owner's popup lines from the Plan step (the reading's stated news, the newsletter tick) — set by the
381
+ * server, never a model's. A generated site gets a popup only from one of them (R-H6, `checkPopup`). */
382
+ readonly popup?: PlanPopupLines;
383
+ }
384
+
385
+ /** A fact the owner STATED (harness `statedFacts`): its value and the owner's own words it was read from. */
386
+ export interface PlanStatedFact {
387
+ readonly value: string;
388
+ readonly quote: string;
389
+ }
390
+
391
+ /** Popups PU3: the Plan step's popup lines, as the owner left them. */
392
+ export interface PlanPopupLines {
393
+ /** "Show your news in a popup" ticked: the news as stated. */
394
+ readonly news?: PlanStatedFact;
395
+ /** "Invite visitors to your newsletter in a popup" ticked. */
396
+ readonly newsletter?: boolean;
367
397
  }
368
398
 
369
399
  /** A part's mix as `<ingredient>:<word>` words (the contract's `site.layout.<part>`): the footer since list ingredients
@@ -375,6 +405,8 @@ export interface PlanMixes {
375
405
  readonly opening?: ReadonlyArray<string>;
376
406
  /** AW6 (body-mix.ts): how sections meet, how their grounds follow one another, the texture and extra kinds of section. */
377
407
  readonly body?: ReadonlyArray<string>;
408
+ /** Popups PU3 (popup-plan.ts): the site's popup — kind, form, arrive, `link:<page key>`; stamped only from `SitePlan.popup`. */
409
+ readonly popup?: ReadonlyArray<string>;
378
410
  }
379
411
 
380
412
  /** M8 gate 2: the idea a site's composed pages serve — the usual site for the business, and what this one does instead. */
@@ -5,7 +5,7 @@
5
5
  export const SPEC_SITE_PLAN_SHAPE = {
6
6
  "plan": {
7
7
  "version": "'1'",
8
- "source": "sourceTemplate | sourceAi",
8
+ "source": "sourceTemplate | sourceAi | sourceImport",
9
9
  "business": "business",
10
10
  "locale?": "'en' | 'he' — the site's language (site.locales): every page's locale; 'he' reads right to left (absent = en)",
11
11
  "design": "design",
@@ -17,13 +17,23 @@ export const SPEC_SITE_PLAN_SHAPE = {
17
17
  "film?": "film — the owner's film as pictures (SC6b), set by the build and placed by placeFilm; never a model's",
18
18
  "artDirection?": "artDirection — what every picture made for the site shares (M7): set by the generation from the business type and the look (generation-core artDirectionFor); never a model's",
19
19
  "direction?": "direction — what the site is built around (M8 gate 2): written with the pages, shown on the Plan step; every composed page serves it",
20
- "mixes?": "mixes — the header, the footer, the home page's opening and the body as mixes of ingredients (ingredients.md); a header or footer mix wins over its globals pattern"
20
+ "mixes?": "mixes — the header, the footer, the home page's opening and the body as mixes of ingredients (ingredients.md); a header or footer mix wins over its globals pattern",
21
+ "popup?": "popupLines — the owner's popup lines from the Plan step (popups PU-D12): their stated news (only while its line is ticked) and the newsletter tick. Set by the server from the reading and the ticks; never a model's"
22
+ },
23
+ "popupLines": {
24
+ "news?": "statedFact — the owner's news as the reading took it (harness.statedFacts.news): every number, date, price or percent in its value is in its quote",
25
+ "newsletter?": "boolean — the owner ticked \"Invite visitors to your newsletter in a popup\""
26
+ },
27
+ "statedFact": {
28
+ "value": "string — the fact, in the owner's words",
29
+ "quote": "string — the words of the prompt it came from"
21
30
  },
22
31
  "mixes": {
23
32
  "header?": "string[] — the header as <ingredient>:<word> words (site.layout.header; header ingredients HI1)",
24
33
  "footer?": "string[] — the footer as <ingredient>:<word> words (site.layout.footer; list ingredients LI5)",
25
34
  "opening?": "string[] — the home page's opening (its first screen) as <ingredient>:<word> words (site.layout.opening; award ingredients AW8): it takes the place of the home page's first section when that is a hero, the hero's words and pictures carried in; absent or empty = the home page opens with its sections as written",
26
- "body?": "string[] — the site's body as <ingredient>:<word> words (site.layout.body; award ingredients AW6): how sections meet (seam), how their grounds follow one another (rhythm), the texture and the extra kinds of section; absent or empty = straight seams, each section's ground its own"
35
+ "body?": "string[] — the site's body as <ingredient>:<word> words (site.layout.body; award ingredients AW6): how sections meet (seam), how their grounds follow one another (rhythm), the texture and the extra kinds of section; absent or empty = straight seams, each section's ground its own",
36
+ "popup?": "string[] — the site's popup as <ingredient>:<word> words (site.layout.popup.wire; popups PU3): its kind, where it sits, how it arrives and link:<page key>; absent or empty = no popup. Stamped only from the owner's popup lines (plan.popup)"
27
37
  },
28
38
  "direction": {
29
39
  "idea": "string — one sentence: what this site is about and how it should feel",
@@ -57,6 +67,10 @@ export const SPEC_SITE_PLAN_SHAPE = {
57
67
  "kind": "'ai'",
58
68
  "runId": "string"
59
69
  },
70
+ "sourceImport": {
71
+ "kind": "'import'",
72
+ "scanId": "string — the site scan the plan was read from (generation-core planImport)"
73
+ },
60
74
  "business": {
61
75
  "name": "string — the brand: the header, the hero, the copyright line",
62
76
  "tagline?": "string — the hero lead and the footer line",
@@ -101,7 +115,8 @@ export const SPEC_SITE_PLAN_SHAPE = {
101
115
  "quote?": "string — a field: someone's words",
102
116
  "person?": "string — a field: who said or made it",
103
117
  "link?": "string — a field: where the item leads (a route or an address)",
104
- "colour?": "string — a field: its own colour, a hex (a colour block's ground)"
118
+ "colour?": "string — a field: its own colour, a hex (a colour block's ground)",
119
+ "body?": "string — a field: its own text at length (an imported post's body) — the item page only, never a card"
105
120
  },
106
121
  "field": {
107
122
  "name": "string — unique in the type",
@@ -114,7 +129,8 @@ export const SPEC_SITE_PLAN_SHAPE = {
114
129
  "count": "integer ≥ 0",
115
130
  "sample": "boolean — items are flagged isSample",
116
131
  "isPublished": "boolean",
117
- "perItem?": "per field, one string per sample: real content that wins over the template",
132
+ "perItem?": "per field, one string per sample (a list of strings for an array field): real content that wins over the template",
133
+ "importedFrom?": "string[] — one per item, the old address it was read from (Bring my site X4): the item keeps it as importedFrom; only on real items (sample false)",
118
134
  "[field]?": "the field's value — strings are templates: {n} = the item's 1-based number, {sampleImage:n} / {sampleImage:n+k} = a bundled sample image"
119
135
  },
120
136
  "cmsDataSource": {
@@ -242,6 +258,7 @@ export const SPEC_SITE_ROLES = {
242
258
  "person": "who said or made it — a name (their role or place goes in meta)",
243
259
  "link": "where the item leads — its own page or an address; the card's arrow goes there",
244
260
  "colour": "its own colour (a hex) — the ground of its block; the words on it are chosen to read",
261
+ "body": "its own text at length — paragraphs, the item page's body (item.body); never on a card",
245
262
  "price": "its price — the shop's own field, shown through the money pipe in the studio currency",
246
263
  "compareAt": "its earlier price, struck through beside the price (the shop's own field)"
247
264
  } as const;
@@ -3336,7 +3353,8 @@ export const SPEC_SITE_PATTERNS = {
3336
3353
  "level": "h4",
3337
3354
  "slot": "eyebrow",
3338
3355
  "max": 32,
3339
- "enter": "heading"
3356
+ "enter": "heading",
3357
+ "optional": "eyebrow"
3340
3358
  },
3341
3359
  {
3342
3360
  "t": "Heading",
@@ -3353,6 +3371,7 @@ export const SPEC_SITE_PATTERNS = {
3353
3371
  "max": 180,
3354
3372
  "ph": "copy",
3355
3373
  "text": "One or two sentences that introduce this page.",
3374
+ "optional": "lead",
3356
3375
  "textHe": "משפט או שניים שמציגים את העמוד הזה."
3357
3376
  }
3358
3377
  ]
@@ -3502,6 +3521,37 @@ export const SPEC_SITE_PATTERNS = {
3502
3521
  }
3503
3522
  }
3504
3523
  },
3524
+ "item.body": {
3525
+ "family": "detail",
3526
+ "imported": true,
3527
+ "label": "Item text (bound to the route item)",
3528
+ "intent": "The item's own words at length — a post's body or a project's story, in one readable column.",
3529
+ "node": {
3530
+ "t": "Section",
3531
+ "es": "section",
3532
+ "c": [
3533
+ {
3534
+ "t": "Container",
3535
+ "es": "box",
3536
+ "lay": {
3537
+ "display": "flex",
3538
+ "flexDirection": "column",
3539
+ "gap": "18px",
3540
+ "maxWidth": "720px",
3541
+ "width": "100%",
3542
+ "margin": "0px auto 0px auto"
3543
+ },
3544
+ "c": [
3545
+ {
3546
+ "t": "Text",
3547
+ "es": "body",
3548
+ "bind": "route.@body"
3549
+ }
3550
+ ]
3551
+ }
3552
+ ]
3553
+ }
3554
+ },
3505
3555
  "about.story": {
3506
3556
  "family": "story",
3507
3557
  "label": "Story beside an image",
@@ -3597,6 +3647,7 @@ export const SPEC_SITE_PATTERNS = {
3597
3647
  "gap": "10px"
3598
3648
  },
3599
3649
  "enter": "content",
3650
+ "optional": "heading",
3600
3651
  "c": [
3601
3652
  {
3602
3653
  "t": "Text",
@@ -3628,6 +3679,7 @@ export const SPEC_SITE_PATTERNS = {
3628
3679
  "max": 180,
3629
3680
  "ph": "copy",
3630
3681
  "text": "The one sentence a reader should remember.",
3682
+ "optional": "lead",
3631
3683
  "textHe": "המשפט האחד שקוראים צריכים לזכור."
3632
3684
  },
3633
3685
  {
@@ -3646,6 +3698,7 @@ export const SPEC_SITE_PATTERNS = {
3646
3698
  "max": 900,
3647
3699
  "ph": "copy",
3648
3700
  "text": "Then what you learned, and what you do now because of it.",
3701
+ "optional": "more",
3649
3702
  "textHe": "ואז מה למדתם, ומה אתם עושים היום בזכות זה."
3650
3703
  }
3651
3704
  ]
@@ -10865,6 +10918,21 @@ export const SPEC_SITE_LAYOUT = {
10865
10918
  "fingerprint": [
10866
10919
  "form"
10867
10920
  ],
10921
+ "wire": {
10922
+ "ingredients": [
10923
+ "kind",
10924
+ "form",
10925
+ "arrive"
10926
+ ],
10927
+ "never": [
10928
+ "form.centred",
10929
+ "arrive.button"
10930
+ ],
10931
+ "link": "link"
10932
+ },
10933
+ "linkFallback": [
10934
+ "contact"
10935
+ ],
10868
10936
  "refused": {
10869
10937
  "again.every-view": "every page view is the nag: the visitor closed it",
10870
10938
  "arrive.load": "at load it is an interstitial: the landing view is always the page (minimum 3 s or a real scroll)",