@vectoriox/iox-ui 5.173.0 → 5.175.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 (32) hide show
  1. package/fesm2022/vectoriox-iox-ui-design-core.mjs +15 -3
  2. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  3. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +870 -77
  4. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +171 -143
  6. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  7. package/generation-core/index.d.ts +306 -17
  8. package/harness-core/index.d.ts +86 -82
  9. package/package.json +1 -1
  10. package/src/design-core/header-behaviour.ts +14 -4
  11. package/src/generation-core/audit-site.ts +71 -2
  12. package/src/generation-core/audit-words.ts +20 -0
  13. package/src/generation-core/check-layout.ts +1 -1
  14. package/src/generation-core/check-list.ts +8 -0
  15. package/src/generation-core/compose-site.ts +50 -9
  16. package/src/generation-core/fallback-memory.ts +1 -1
  17. package/src/generation-core/import-plan.ts +400 -0
  18. package/src/generation-core/layout-fingerprint.ts +10 -2
  19. package/src/generation-core/list-words.ts +6 -0
  20. package/src/generation-core/patterns.ts +3 -1
  21. package/src/generation-core/plan-wire.ts +37 -8
  22. package/src/generation-core/plan-words.ts +7 -3
  23. package/src/generation-core/popup-plan.ts +232 -0
  24. package/src/generation-core/public-api.ts +2 -0
  25. package/src/generation-core/showcase.ts +17 -2
  26. package/src/generation-core/site-build-run.ts +3 -0
  27. package/src/generation-core/site-plan.model.ts +35 -3
  28. package/src/generation-core/site-spec.generated.ts +74 -6
  29. package/src/generation-core/validate-site-plan.ts +46 -6
  30. package/src/harness-core/harness-spec.generated.ts +1 -0
  31. package/src/harness-core/site-analysis.ts +34 -9
  32. package/styles/iox-design.css +4 -1
@@ -2857,6 +2857,7 @@ declare const SPEC_ANALYSIS_SHAPE: {
2857
2857
  readonly business: "business";
2858
2858
  readonly needs: "need[] — what the site needs: the owner's (from: you) and the type's (from: type)";
2859
2859
  readonly facts: "{ [fact]: factRead } — site.facts keys, only what the prompt states; every quote is words of the prompt";
2860
+ readonly "statedFacts?": "{ [statedFact]: factRead } — harness.statedFacts keys (news), only what the prompt states; never a placeholder and never in missingFacts. On the wire a stated fact is a fact line of the facts list";
2860
2861
  readonly missingFacts: "string[] — site.facts keys the prompt does not state";
2861
2862
  readonly voice: "voice";
2862
2863
  readonly moods: "string[] — ≤ 3 moods";
@@ -3661,6 +3662,88 @@ declare function motionAdvice(typeId: string | null | undefined, animate: Animat
3661
3662
  usual: AnimateId;
3662
3663
  } | null;
3663
3664
 
3665
+ /**
3666
+ * A popup, SUGGESTED (popups-plan.md §10, PU-D11 / PU-D12). The harness's answer, never the model's:
3667
+ * - the STANCE — `offer` (hospitality, food, shops, events, studios), `ifAsked` (trust and care types), `never` — the
3668
+ * type's default (contract `POPUP_STANCES`, on each type as `popup`) moved ONE step by the owner's words, as for the film;
3669
+ * an owner who says "no popup" (`refusedBy`) makes it `never` whatever else they wrote.
3670
+ * - the Plan step's two LINES — "Show your news in a popup" exists only when the owner STATED news (`news`, a stated fact:
3671
+ * never inferred, never a placeholder) and the stance is offer, and starts ticked; "Invite visitors to your newsletter
3672
+ * in a popup" is offered when the site has a newsletter form and the stance is not never, and is never ticked by itself.
3673
+ * A generated site gets a popup only from one of these two lines. Pure: no transport, no clock.
3674
+ */
3675
+ /** How a popup is suggested. */
3676
+ declare enum PopupStance {
3677
+ Offer = "offer",
3678
+ IfAsked = "ifAsked",
3679
+ Never = "never"
3680
+ }
3681
+ /** What the owner's words did to the stance. */
3682
+ interface PopupWords {
3683
+ /** Words asking for a popup or a newsletter. */
3684
+ readonly raised: ReadonlyArray<string>;
3685
+ /** Words asking for calm. */
3686
+ readonly lowered: ReadonlyArray<string>;
3687
+ /** The owner said no popup. */
3688
+ readonly refused: ReadonlyArray<string>;
3689
+ }
3690
+ /** The words that move the stance (contract `POPUP_STANCES`). */
3691
+ declare const POPUP_WORDS: {
3692
+ readonly raise: ReadonlyArray<string>;
3693
+ readonly lower: ReadonlyArray<string>;
3694
+ readonly refusedBy: ReadonlyArray<string>;
3695
+ };
3696
+ /** A fact a reading takes ONLY as stated — never a placeholder, never a gap (contract `statedFacts`). */
3697
+ interface StatedFactDef {
3698
+ readonly label: {
3699
+ readonly en: string;
3700
+ readonly he: string;
3701
+ };
3702
+ readonly how: string;
3703
+ /** The phase that reads it. */
3704
+ readonly reads: string;
3705
+ /** What it makes. */
3706
+ readonly feeds: string;
3707
+ }
3708
+ /** The stated facts, keyed (`news`). Kept apart from site.facts on purpose: a site.facts key is a placeholder. */
3709
+ declare const STATED_FACTS: Readonly<Record<keyof typeof SPEC_STATED_FACTS, StatedFactDef>>;
3710
+ type StatedFactKey = keyof typeof SPEC_STATED_FACTS;
3711
+ declare const STATED_FACT_KEYS: ReadonlyArray<StatedFactKey>;
3712
+ /** What the owner's words say about a popup (the ONE no-model word rule, `keywordsIn`). A refusal ("no popup") holds a
3713
+ * raise word ("popup"); it is read first and the raise words it holds do not count. */
3714
+ declare function popupWordsIn(prompt: string | null | undefined): PopupWords;
3715
+ /** The stance for a business and the owner's words: the type's default moved ONE step (raise ifAsked → offer, lower
3716
+ * offer → ifAsked, both cancel); `never` moves for no word; a refusal is never; an unknown type is never. */
3717
+ declare function popupStanceFor(type: BusinessType | undefined, words: PopupWords): PopupStance;
3718
+ interface PopupSuggestionInput {
3719
+ readonly businessType: string | null | undefined;
3720
+ /** The owner's own words (the prompt). */
3721
+ readonly prompt?: string | null;
3722
+ /** The reading's stated `news` fact — its value and the words it came from; absent = no news was stated. */
3723
+ readonly news?: {
3724
+ readonly value: string;
3725
+ readonly quote: string;
3726
+ } | null;
3727
+ /** The site carries a newsletter form. */
3728
+ readonly newsletterForm: boolean;
3729
+ }
3730
+ /** One line of the Plan step. */
3731
+ interface PopupLine {
3732
+ readonly shown: boolean;
3733
+ /** Starts ticked (always the owner's to untick). */
3734
+ readonly ticked: boolean;
3735
+ }
3736
+ interface PopupSuggestion {
3737
+ readonly stance: PopupStance;
3738
+ /** "Show your news in a popup — '<news>'". */
3739
+ readonly news: PopupLine;
3740
+ /** "Invite visitors to your newsletter in a popup" — never ticked by itself. */
3741
+ readonly newsletter: PopupLine;
3742
+ readonly words: PopupWords;
3743
+ }
3744
+ /** The Plan step's popup lines for a site (PU-D12). */
3745
+ declare function popupSuggestion(input: PopupSuggestionInput): PopupSuggestion;
3746
+
3664
3747
  /**
3665
3748
  * What the reading of a prompt returns (AI plan rev 3 §3d): one of the 30 kinds of business (and the two
3666
3749
  * nearest), who it is for, what the site needs, the facts the prompt STATES (each with the words it came from)
@@ -3696,6 +3779,9 @@ interface SiteAnalysis {
3696
3779
  needs: SiteNeed[];
3697
3780
  facts: Partial<Record<FactKey, FactRead>>;
3698
3781
  missingFacts: FactKey[];
3782
+ /** Popups PU3: what the prompt STATES of the harness's stated facts (`news`) — never a placeholder, never missing;
3783
+ * absent = none stated. On the wire a stated fact is a line of `facts`. */
3784
+ statedFacts?: Partial<Record<StatedFactKey, FactRead>>;
3699
3785
  voice: {
3700
3786
  tone: string;
3701
3787
  person: `${VoicePerson}`;
@@ -4385,88 +4471,6 @@ interface FilmIdeaInput {
4385
4471
  */
4386
4472
  declare function filmIdeaFor(input: FilmIdeaInput): FilmIdeaChoice;
4387
4473
 
4388
- /**
4389
- * A popup, SUGGESTED (popups-plan.md §10, PU-D11 / PU-D12). The harness's answer, never the model's:
4390
- * - the STANCE — `offer` (hospitality, food, shops, events, studios), `ifAsked` (trust and care types), `never` — the
4391
- * type's default (contract `POPUP_STANCES`, on each type as `popup`) moved ONE step by the owner's words, as for the film;
4392
- * an owner who says "no popup" (`refusedBy`) makes it `never` whatever else they wrote.
4393
- * - the Plan step's two LINES — "Show your news in a popup" exists only when the owner STATED news (`news`, a stated fact:
4394
- * never inferred, never a placeholder) and the stance is offer, and starts ticked; "Invite visitors to your newsletter
4395
- * in a popup" is offered when the site has a newsletter form and the stance is not never, and is never ticked by itself.
4396
- * A generated site gets a popup only from one of these two lines. Pure: no transport, no clock.
4397
- */
4398
- /** How a popup is suggested. */
4399
- declare enum PopupStance {
4400
- Offer = "offer",
4401
- IfAsked = "ifAsked",
4402
- Never = "never"
4403
- }
4404
- /** What the owner's words did to the stance. */
4405
- interface PopupWords {
4406
- /** Words asking for a popup or a newsletter. */
4407
- readonly raised: ReadonlyArray<string>;
4408
- /** Words asking for calm. */
4409
- readonly lowered: ReadonlyArray<string>;
4410
- /** The owner said no popup. */
4411
- readonly refused: ReadonlyArray<string>;
4412
- }
4413
- /** The words that move the stance (contract `POPUP_STANCES`). */
4414
- declare const POPUP_WORDS: {
4415
- readonly raise: ReadonlyArray<string>;
4416
- readonly lower: ReadonlyArray<string>;
4417
- readonly refusedBy: ReadonlyArray<string>;
4418
- };
4419
- /** A fact a reading takes ONLY as stated — never a placeholder, never a gap (contract `statedFacts`). */
4420
- interface StatedFactDef {
4421
- readonly label: {
4422
- readonly en: string;
4423
- readonly he: string;
4424
- };
4425
- readonly how: string;
4426
- /** The phase that reads it. */
4427
- readonly reads: string;
4428
- /** What it makes. */
4429
- readonly feeds: string;
4430
- }
4431
- /** The stated facts, keyed (`news`). Kept apart from site.facts on purpose: a site.facts key is a placeholder. */
4432
- declare const STATED_FACTS: Readonly<Record<keyof typeof SPEC_STATED_FACTS, StatedFactDef>>;
4433
- type StatedFactKey = keyof typeof SPEC_STATED_FACTS;
4434
- declare const STATED_FACT_KEYS: ReadonlyArray<StatedFactKey>;
4435
- /** What the owner's words say about a popup (the ONE no-model word rule, `keywordsIn`). A refusal ("no popup") holds a
4436
- * raise word ("popup"); it is read first and the raise words it holds do not count. */
4437
- declare function popupWordsIn(prompt: string | null | undefined): PopupWords;
4438
- /** The stance for a business and the owner's words: the type's default moved ONE step (raise ifAsked → offer, lower
4439
- * offer → ifAsked, both cancel); `never` moves for no word; a refusal is never; an unknown type is never. */
4440
- declare function popupStanceFor(type: BusinessType | undefined, words: PopupWords): PopupStance;
4441
- interface PopupSuggestionInput {
4442
- readonly businessType: string | null | undefined;
4443
- /** The owner's own words (the prompt). */
4444
- readonly prompt?: string | null;
4445
- /** The reading's stated `news` fact — its value and the words it came from; absent = no news was stated. */
4446
- readonly news?: {
4447
- readonly value: string;
4448
- readonly quote: string;
4449
- } | null;
4450
- /** The site carries a newsletter form. */
4451
- readonly newsletterForm: boolean;
4452
- }
4453
- /** One line of the Plan step. */
4454
- interface PopupLine {
4455
- readonly shown: boolean;
4456
- /** Starts ticked (always the owner's to untick). */
4457
- readonly ticked: boolean;
4458
- }
4459
- interface PopupSuggestion {
4460
- readonly stance: PopupStance;
4461
- /** "Show your news in a popup — '<news>'". */
4462
- readonly news: PopupLine;
4463
- /** "Invite visitors to your newsletter in a popup" — never ticked by itself. */
4464
- readonly newsletter: PopupLine;
4465
- readonly words: PopupWords;
4466
- }
4467
- /** The Plan step's popup lines for a site (PU-D12). */
4468
- declare function popupSuggestion(input: PopupSuggestionInput): PopupSuggestion;
4469
-
4470
4474
  /**
4471
4475
  * `GET …/webbuilder/site-audit?page=` (AI plan §3e, M1-7): the eight checks (generation-core `auditSite`) and the design
4472
4476
  * advice beside them (`lintDesign` — never blocks, "Keep it" dismisses). ONE definition: iox-cms answers it, the Publish
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectoriox/iox-ui",
3
- "version": "5.173.0",
3
+ "version": "5.175.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=20.0.0",
6
6
  "@angular/core": ">=20.0.0",
@@ -189,8 +189,9 @@ export const BAR_CROWDED_AT = 3;
189
189
  export const PHONE_BAR_CONTROL_ROLES: ReadonlyArray<string> = ['nav.menu-button', 'shop.cart-button', 'account', 'nav.pinned', 'nav.actions'];
190
190
  /** What never counts: the drawer (a Dialog) and everything in it. */
191
191
  const BAR_SKIPPED_TYPES: ReadonlyArray<string> = ['Dialog'];
192
- /** The phone layers that may hide a part (responsive-breakpoints plan: `mobile` ≤ 767, `small` ≤ 479). */
193
- const PHONE_LAYERS: ReadonlyArray<string> = ['mobile', 'small'];
192
+ /** The layers that reach a phone held upright, widest → narrowest — the cascade order (iox-ui `BREAKPOINTS`: `laptop`
193
+ * ≤ 1200, `tablet` ≤ 991, `mobile` ≤ 767, `small` ≤ 479). Spelled here: design-core reads no Angular entry. */
194
+ const PHONE_CASCADE: ReadonlyArray<string> = ['laptop', 'tablet', 'mobile', 'small'];
194
195
 
195
196
  export interface BarNode {
196
197
  role?: string | null;
@@ -200,8 +201,17 @@ export interface BarNode {
200
201
  children?: ReadonlyArray<unknown> | null;
201
202
  }
202
203
 
203
- const hiddenOnPhone = (node: BarNode): boolean =>
204
- node.styleProps?.['display'] === 'none' || PHONE_LAYERS.some(bp => node.responsive?.[bp]?.styleProps?.['display'] === 'none');
204
+ /** Hidden on a phone: its display where a phone held upright lands, the last layer that says one (base → `small`).
205
+ * vectoriox/iox-ui#143: a menu button is `none` at base and shown from its breakpoint down — read by its base alone it
206
+ * was "hidden", the store bar (account · bag · menu) counted two and was never crowded, and its name broke at 390. */
207
+ const hiddenOnPhone = (node: BarNode): boolean => {
208
+ let display = node.styleProps?.['display'];
209
+ for (const bp of PHONE_CASCADE) {
210
+ const layer = node.responsive?.[bp]?.styleProps?.['display'];
211
+ if (layer !== undefined && layer !== null && layer !== '') display = layer;
212
+ }
213
+ return display === 'none';
214
+ };
205
215
 
206
216
  /** How many controls sit beside the name in the navigation's phone bar. */
207
217
  export function phoneBarControls(nav: BarNode | null | undefined): number {
@@ -1,6 +1,6 @@
1
- import { ELEMENT_ACTION_DESCRIPTORS, resolveActionAvailability } from '@vectoriox/iox-ui/actions-core';
1
+ import { ELEMENT_ACTION_DESCRIPTORS, POPUP_RULES, popupEnded, resolveActionAvailability } from '@vectoriox/iox-ui/actions-core';
2
2
  import { CheckoutGateCode, CheckoutGateRefusal, labelIn } from '@vectoriox/iox-ui/commerce-core';
3
- import { ShopRole } from '@vectoriox/iox-ui/composite-core';
3
+ import { PopupArrive, PopupForm, popupFormOf, PopupKind, PopupRole, PopupTrait, ShopRole } from '@vectoriox/iox-ui/composite-core';
4
4
  import { auditDesignContrast, DesignTokenLike } from '@vectoriox/iox-ui/design-core';
5
5
  import { ConsentActionType } from '@vectoriox/iox-ui/composite-core';
6
6
  import { collectFormSpec, FORM_CHANNEL_ROLE, FORM_NODE_TYPE, isChannelFilled } from '@vectoriox/iox-ui/forms-core';
@@ -101,6 +101,14 @@ export enum SiteFindingCode {
101
101
  DeadLink = 'dead-link',
102
102
  DeadDialogTarget = 'dead-dialog-target',
103
103
  ActionNeedsConnector = 'action-needs-connector',
104
+ /** Popups PU3 (§11): a popup's title or its action's words are empty — never invented for it. `variant` title | action. */
105
+ PopupEmpty = 'popup-empty',
106
+ /** Popups PU3 (§11): a centred popup arrives by time sooner than the minimum seconds — an interstitial over the landing view. */
107
+ PopupCentredEarly = 'popup-centred-early',
108
+ /** Popups PU3 (§11): a popup's last day is past (only when the caller passes `today`) — it shows to no one. */
109
+ PopupEnded = 'popup-ended',
110
+ /** Popups PU3 (§11): more than one popup arrives by itself on a page (the site's and the page's counted together). */
111
+ PopupTwoAuto = 'popup-two-auto',
104
112
  }
105
113
 
106
114
  /** Each finding's severity — one table (D8), never decided at a call site. */
@@ -137,6 +145,10 @@ export const FINDING_SEVERITY: Readonly<Record<SiteFindingCode, CheckSeverity>>
137
145
  [SiteFindingCode.DeadLink]: CheckSeverity.Block,
138
146
  [SiteFindingCode.DeadDialogTarget]: CheckSeverity.Block,
139
147
  [SiteFindingCode.ActionNeedsConnector]: CheckSeverity.Block,
148
+ [SiteFindingCode.PopupEmpty]: CheckSeverity.Block,
149
+ [SiteFindingCode.PopupCentredEarly]: CheckSeverity.Block,
150
+ [SiteFindingCode.PopupEnded]: CheckSeverity.Warn,
151
+ [SiteFindingCode.PopupTwoAuto]: CheckSeverity.Warn,
140
152
  };
141
153
 
142
154
  const CHECK_OF: Readonly<Record<SiteFindingCode, SiteCheckId>> = {
@@ -172,6 +184,10 @@ const CHECK_OF: Readonly<Record<SiteFindingCode, SiteCheckId>> = {
172
184
  [SiteFindingCode.DeadLink]: SiteCheckId.Actions,
173
185
  [SiteFindingCode.DeadDialogTarget]: SiteCheckId.Actions,
174
186
  [SiteFindingCode.ActionNeedsConnector]: SiteCheckId.Actions,
187
+ [SiteFindingCode.PopupEmpty]: SiteCheckId.Facts,
188
+ [SiteFindingCode.PopupCentredEarly]: SiteCheckId.Accessibility,
189
+ [SiteFindingCode.PopupEnded]: SiteCheckId.Facts,
190
+ [SiteFindingCode.PopupTwoAuto]: SiteCheckId.Actions,
175
191
  };
176
192
 
177
193
  export interface SiteFinding {
@@ -258,6 +274,8 @@ export interface SiteAuditSnapshot {
258
274
  /** AW1: the site was built with the law — a site-build run carried the AW1 legal context (iox-cms stores it on the
259
275
  * run as `decisions.legal`). With a page that says its legal kind, the signal `siteBuiltWithLaw` reads. */
260
276
  legalBuilt?: boolean | null;
277
+ /** Popups PU3: today, `YYYY-MM-DD` — the gate reads no clock; without it an ended popup is not judged. */
278
+ today?: string | null;
261
279
  }
262
280
 
263
281
  export interface SiteAuditOptions {
@@ -623,6 +641,56 @@ function checkActions(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArra
623
641
  });
624
642
  }
625
643
 
644
+ const isPopup = (n: SerializedNode) => n.type === DIALOG_TYPE && (Object.values(PopupKind) as unknown[]).includes(n.props[PopupTrait.Kind]);
645
+ const popupPart = (root: SerializedNode, role: PopupRole): SerializedNode | null => {
646
+ let hit: SerializedNode | null = null;
647
+ walkSerialized(root.children ?? [], n => { if (!hit && n.role === role) hit = n; });
648
+ return hit;
649
+ };
650
+ const bound = (n: SerializedNode, prop: string) => n.bindings.some(b => b.prop === prop);
651
+
652
+ /**
653
+ * Popups PU3 (§11): each popup's own rows — an empty title or action words (block; an action to no page is the ONE
654
+ * dead-link rule's), a centred popup by time under the minimum (block), an ended one (warn, with `today`), and more than
655
+ * one popup arriving by itself on a page (warn). A figure the owner never stated is refused when the popup is BUILT
656
+ * (generation-core `checkPopup`) — the gate holds no owner words to compare.
657
+ */
658
+ function checkPopups(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray<AuditPage>): void {
659
+ const auto = (n: SerializedNode) => n.props[PopupTrait.Arrive] !== PopupArrive.Button;
660
+ let siteAuto = 0;
661
+ const judge = (root: SerializedNode, where: FindingWhere) => {
662
+ const get = (name: string) => root.props[name];
663
+ const title = popupPart(root, PopupRole.Title);
664
+ if (title && !nonEmpty(title.props['content']) && !bound(title, 'content')) add(ctx, SiteFindingCode.PopupEmpty, { variant: 'title' }, { ...where, nodeId: title.id });
665
+ const action = popupPart(root, PopupRole.Action);
666
+ if (action && !nonEmpty(action.props['label']) && !bound(action, 'label')) add(ctx, SiteFindingCode.PopupEmpty, { variant: 'action' }, { ...where, nodeId: action.id });
667
+ const arrive = get(PopupTrait.Arrive);
668
+ const seconds = Number(get(PopupTrait.Seconds));
669
+ if (popupFormOf(get(PopupTrait.Kind), get(PopupTrait.Form)) === PopupForm.Centred && (arrive === PopupArrive.Time || arrive === PopupArrive.ScrollOrTime)
670
+ && get(PopupTrait.Seconds) !== undefined && get(PopupTrait.Seconds) !== '' && Number.isFinite(seconds) && seconds < POPUP_RULES.minSeconds) {
671
+ add(ctx, SiteFindingCode.PopupCentredEarly, { seconds: POPUP_RULES.minSeconds }, { ...where, nodeId: root.id });
672
+ }
673
+ if (snapshot.today && /^\d{4}-\d{2}-\d{2}$/.test(snapshot.today) && popupEnded(get, new Date(`${snapshot.today}T12:00:00`))) {
674
+ add(ctx, SiteFindingCode.PopupEnded, { until: String(get(PopupTrait.ShowUntil)) }, { ...where, nodeId: root.id });
675
+ }
676
+ };
677
+ for (const global of snapshot.globals) walkSerialized([global], n => {
678
+ if (!isPopup(n)) return;
679
+ judge(n, { owner: global.globalPosition === PatternGlobalPosition.Before ? 'header' : 'footer' });
680
+ if (auto(n)) siteAuto++;
681
+ });
682
+ for (const page of pages) {
683
+ let pageAuto = 0;
684
+ walkSerialized(page.layout, n => {
685
+ if (!isPopup(n)) return;
686
+ judge(n, { pageId: page.id });
687
+ if (auto(n)) pageAuto++;
688
+ });
689
+ if (siteAuto + pageAuto > 1) add(ctx, SiteFindingCode.PopupTwoAuto, { n: siteAuto + pageAuto }, { pageId: page.id });
690
+ }
691
+ if (siteAuto > 1 && !pages.length) add(ctx, SiteFindingCode.PopupTwoAuto, { n: siteAuto }, {});
692
+ }
693
+
626
694
  /** Run the eight checks. `pageId` narrows the page checks to the page being published; site-wide ones always run. */
627
695
  export function auditSite(snapshot: SiteAuditSnapshot, options: SiteAuditOptions = {}): SiteAudit {
628
696
  const pages = options.pageId ? snapshot.pages.filter(p => p.id === options.pageId) : snapshot.pages;
@@ -637,6 +705,7 @@ export function auditSite(snapshot: SiteAuditSnapshot, options: SiteAuditOptions
637
705
  checkAccessibility(ctx, snapshot, pages);
638
706
  checkTokens(ctx, snapshot, pages);
639
707
  checkActions(ctx, snapshot, pages);
708
+ checkPopups(ctx, snapshot, pages);
640
709
  const checks = SITE_CHECKS.map(id => {
641
710
  const findings = ctx.out.filter(f => f.check === id);
642
711
  return { id, passed: !findings.some(f => f.severity !== CheckSeverity.Warn), findings };
@@ -209,6 +209,26 @@ export const SITE_FINDING_WORDS: Readonly<Record<`${SiteFindingCode}`, FindingWo
209
209
  one: S('"{label}" needs {connector} connected.', '"{label}" צריך ש-{connector} יהיה מחובר.'),
210
210
  group: FindingGrouping.Never,
211
211
  },
212
+ 'popup-empty': {
213
+ one: {
214
+ title: S('A popup has no title — write what it tells your visitors.', 'לחלון קופץ אין כותרת — כתבו מה הוא מספר למבקרים.'),
215
+ action: S('A popup\'s link has no words — write where it leads.', 'לקישור בחלון קופץ אין מילים — כתבו לאן הוא מוביל.'),
216
+ },
217
+ group: FindingGrouping.Never,
218
+ },
219
+ 'popup-centred-early': {
220
+ one: S('A popup in the middle of the screen arrives before {seconds} seconds — it hides the page before anyone has read it.',
221
+ 'חלון קופץ במרכז המסך מופיע לפני {seconds} שניות — הוא מסתיר את העמוד לפני שמישהו קרא אותו.'),
222
+ group: FindingGrouping.Never,
223
+ },
224
+ 'popup-ended': {
225
+ one: S('A popup\'s last day ({until}) has passed — no one sees it now.', 'היום האחרון של חלון קופץ ({until}) עבר — אף אחד לא רואה אותו עכשיו.'),
226
+ group: FindingGrouping.Never,
227
+ },
228
+ 'popup-two-auto': {
229
+ one: S('{n} popups arrive by themselves on this page — visitors see one, then another.', '{n} חלונות קופצים מופיעים מעצמם בעמוד הזה — המבקרים רואים אחד ואז עוד אחד.'),
230
+ group: FindingGrouping.Never,
231
+ },
212
232
  };
213
233
 
214
234
  /** The values a finding's sentence names (a page's or an item's name, a count, a route…), and its variant. */
@@ -651,7 +651,7 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
651
651
  if (g.scroll && !s.pin) add(LayoutIssueCode.Motion, `${lp}.gallery.scroll`, 'a scroll-turned gallery sits in a held section');
652
652
  if (g.list) {
653
653
  if (g.source === undefined) add(LayoutIssueCode.Content, `${lp}.gallery.source`, 'a list section names the list it shows');
654
- issues.push(...checkList(g.list, ctx.listShapes?.find(x => x.alias === g.source) ?? null, lp, ctx.listNever, { tier: ctx.tier, firstScreen: i === 0 }));
654
+ issues.push(...checkList(g.list, ctx.listShapes?.find(x => x.alias === g.source) ?? null, lp, ctx.listNever, { tier: ctx.tier, firstScreen: i === 0, held: !!s.pin }));
655
655
  }
656
656
  if (!g.scroll) swappable++;
657
657
  slides.forEach((slide, k) => photoId(slide.photo?.id, `${lp}.gallery.slides[${k}]`));
@@ -50,6 +50,8 @@ export interface ListCheckOptions {
50
50
  readonly tier?: string | null;
51
51
  /** The list is in the page's first screen (its first section): no arrival plays there (AW11-D15). */
52
52
  readonly firstScreen?: boolean;
53
+ /** The list is in a held section (a pinned Scene): its slider is turned by the scroll (vectoriox/iox-ui#128). */
54
+ readonly held?: boolean;
53
55
  }
54
56
 
55
57
  /** True when the type's art direction forbids nothing. */
@@ -182,6 +184,12 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
182
184
  repair(ListSayCode.NeverArrange, { ...why, instead: arr(LayoutListArrange.Row) });
183
185
  next.arrange = LayoutListArrange.Row;
184
186
  }
187
+ // vectoriox/iox-ui#128: a held section turns its list by the scroll, and a scroll can stop anywhere — a deck would rest
188
+ // mid-turn, two cards crossing. A row turned by the scroll stays a strip of whole items side by side.
189
+ if (options.held && next.arrange === LayoutListArrange.Deck) {
190
+ repair(ListSayCode.DeckHeld, { instead: arr(LayoutListArrange.Row) });
191
+ next.arrange = LayoutListArrange.Row;
192
+ }
185
193
  // AW11: round-two arrangements — pictures where they need them, the counts they are drawn at.
186
194
  const arrangeRefusal = listWordRefusal('arrange', next.arrange, shape);
187
195
  if (arrangeRefusal === ListWordRefusal.NoPictures) {
@@ -4,7 +4,7 @@ import {
4
4
  columnWordOf,
5
5
  } from '@vectoriox/iox-ui/design-core';
6
6
  import { SEO_DESCRIPTION_MAX, SEO_TITLE_MAX, SeoRawDoc } from '@vectoriox/iox-ui/seo-core';
7
- import { channelOpensNewTab, FORM_ACTIONS_ROLE, FORM_CHANNEL_ROLE, FormPresetChannel, FormPresetDef, FormPresetField, formPresetById, presetFormActions } from '@vectoriox/iox-ui/forms-core';
7
+ import { channelOpensNewTab, FORM_ACTIONS_ROLE, FORM_CHANNEL_ROLE, FormPresetChannel, FormPresetDef, FormPresetField, formPresetById, FormPresetId, presetFormActions } from '@vectoriox/iox-ui/forms-core';
8
8
  import {
9
9
  ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT, accordionWords, accordionAnswerOf, accordionItems, accordionQuestionOf, AccordionRole,
10
10
  buildAccordionRecipe, buildCardRecipe, buildCarouselRecipe, buildLightboxRecipe, buildSlideshowRecipe, CardLayout, CardPart, CardRole, CARD_LAYOUTS, CARD_PARTS, CompositeNode,
@@ -30,6 +30,7 @@ import {
30
30
  } from './opening-mix';
31
31
  import { checkHeader, drawnHeaderMix, HeaderContext, headerContextOfPlan, HeaderIngredient, headerMix, HeaderMix, headerRecipe, HeaderRecipe, stampHeaderMix, wornHeaderOfPlan } from './header-mix';
32
32
  import { bodyMixOfPlan, checkBody, drawnBodyMix, joinPageHeader, wearBodyMix } from './body-mix';
33
+ import { checkPopup, composePopup, POPUP_GLOBAL_ID } from './popup-plan';
33
34
  import { NODE_BASELINES } from './node-baselines.generated';
34
35
  import {
35
36
  BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternGlobalPosition, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternTrack,
@@ -41,7 +42,7 @@ import { recipeListBinds } from './recipe-fields';
41
42
  import { assertStyleSlots, ComposeError, createSerializedNode, SerializedBinding, SerializedNode, setStyleProps, walkSerialized } from './serialized-node';
42
43
  import { refreshSectionStamps, stampSection } from './section-stamp';
43
44
  import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
44
- ContentRole, ContentTypePlan, DataSourcePlan, DEFAULT_SITE_LOCALE, FactKey, FACT_KEYS, GlobalSlot, isRtlLocale, PagePlan, PageSectionPlan, PlanDataSourceMode,
45
+ ContentRole, ContentTypePlan, DataSourcePlan, DEFAULT_SITE_LOCALE, FactKey, FACT_KEYS, GlobalSlot, isRtlLocale, ITEM_PAGE_ONLY_ROLES, PagePlan, PageSectionPlan, PlanDataSourceMode,
45
46
  PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource, siteFactLabel, SiteBusiness, GenerationTier,
46
47
  } from './site-plan.model';
47
48
  import { assertValidSitePlan, nextSourceOf, routeParams } from './validate-site-plan';
@@ -133,6 +134,11 @@ export enum ComposeIssueCode {
133
134
  /** AW6: the body's mix asked for what the build cannot carry (`checkBody`: an award edge on a basic build): the
134
135
  * detail says how. */
135
136
  BodyMended = 'body-mended',
137
+ /** Popups PU3: the plan's popup words asked for what a generated popup may not be (`checkPopup`: centred, by a button
138
+ * only, a kind the owner did not tick, a link to no page): the detail says how it was mended. */
139
+ PopupMended = 'popup-mended',
140
+ /** Popups PU3: the owner's popup line made no popup (a figure the owner's words do not hold, news too long): the detail says why. */
141
+ PopupRefused = 'popup-refused',
136
142
  }
137
143
 
138
144
  /** The issues that are a dangling link (a route the plan has no page for) and what was done about it. */
@@ -230,7 +236,8 @@ export interface ComposedDataSource {
230
236
  request: Record<string, unknown>;
231
237
  }
232
238
 
233
- export type ComposedItem = Record<string, unknown> & { isPublished: boolean; isSample: boolean };
239
+ /** One item to write. `importedFrom` (X4): the old address a real item was read from — the build keeps it on the item. */
240
+ export type ComposedItem = Record<string, unknown> & { isPublished: boolean; isSample: boolean; importedFrom?: string };
234
241
 
235
242
  export interface ComposedRoute {
236
243
  key: string;
@@ -566,7 +573,7 @@ export function layoutGalleryLists(plan: SitePlan): LayoutGalleryList[] {
566
573
  /** The words a list's roles are called in the brief — what a visitor would see, never the field name. */
567
574
  export const LIST_ROLE_WORDS: Readonly<Record<`${ContentRole}`, string>> = {
568
575
  title: 'name', summary: 'summary', image: 'picture', meta: 'detail', date: 'date', gallery: 'pictures',
569
- logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', colour: 'colour', price: 'price', compareAt: 'earlier price',
576
+ logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', colour: 'colour', body: 'text', price: 'price', compareAt: 'earlier price',
570
577
  };
571
578
  /** A text role whose planned samples run past this many words (median) is called long: a small card would cut it. */
572
579
  export const LIST_LONG_WORDS = 20;
@@ -602,9 +609,12 @@ export interface ListShapeReading {
602
609
  * the roles its items play, which text roles run long, the names' length, how many items. From the plan's planned
603
610
  * samples (`type.seed`) or, given `rows`, from the studio's real items. `layoutListShapes` is this, per plan source.
604
611
  */
612
+ /** The roles a list (a card, a row) may show — every role but the item page's own (X4 `ITEM_PAGE_ONLY_ROLES`). */
613
+ const LIST_ROLES: ReadonlyArray<`${ContentRole}`> = (Object.values(ContentRole) as `${ContentRole}`[]).filter(role => !ITEM_PAGE_ONLY_ROLES.includes(role));
614
+
605
615
  export function listShapeOfType(alias: string, type: Pick<ContentTypePlan, 'label' | 'roles' | 'seed'> | null | undefined,
606
616
  reading: ListShapeReading = {}): LayoutListShape {
607
- const played = (Object.values(ContentRole) as `${ContentRole}`[]).filter(role => !!roleField(type, role));
617
+ const played = LIST_ROLES.filter(role => !!roleField(type, role));
608
618
  const perItem = type?.seed?.perItem ?? {};
609
619
  const samples = (field: string | undefined): string[] => {
610
620
  if (!field) return [];
@@ -645,7 +655,7 @@ export function layoutListBinding(alias: string, plan: SitePlan): LayoutListBind
645
655
  * shows one item. The ONE reading `layoutListBinding` and Bindings ▸ List (`composeListFrame`) hand the composer. */
646
656
  export function listBindingOfType(type: Pick<ContentTypePlan, 'roles'> | null | undefined, detail?: LayoutListBinding['detail']): LayoutListBinding {
647
657
  const roles: Record<string, string> = {};
648
- for (const role of Object.values(ContentRole) as `${ContentRole}`[]) {
658
+ for (const role of LIST_ROLES) {
649
659
  const field = roleField(type, role);
650
660
  if (field) roles[role] = field;
651
661
  }
@@ -1647,6 +1657,10 @@ function composeDataSource(ds: DataSourcePlan): ComposedDataSource {
1647
1657
  };
1648
1658
  }
1649
1659
 
1660
+ function clonePlain(value: unknown): unknown {
1661
+ return Array.isArray(value) ? [...value] : value;
1662
+ }
1663
+
1650
1664
  function expandSeedValue(value: unknown, n: number): unknown {
1651
1665
  if (Array.isArray(value)) return value.map(v => expandSeedValue(v, n));
1652
1666
  if (typeof value !== 'string') return value;
@@ -1678,10 +1692,14 @@ function composeItems(type: ContentTypePlan, fillEmpty: boolean): ComposedItem[]
1678
1692
  const given = seed[field.name];
1679
1693
  const empty = !(field.name in seed) || given === '' || (Array.isArray(given) && !given.length);
1680
1694
  const own = seed.perItem?.[field.name]?.[n - 1];
1681
- const value = own || (empty && fillEmpty ? defaultSeed(type, field) : given);
1682
- if (value !== undefined) item[field.name] = expandSeedValue(value, n);
1695
+ const owned = Array.isArray(own) ? own.length > 0 : !!own;
1696
+ const value = owned ? own : (empty && fillEmpty ? defaultSeed(type, field) : given);
1697
+ if (value === undefined) continue;
1698
+ // A real item's own words are never templates (X4: an imported post may well say "{n}").
1699
+ item[field.name] = owned && !seed.sample ? clonePlain(value) : expandSeedValue(value, n);
1683
1700
  }
1684
- items.push({ ...item, isPublished: seed.isPublished, isSample: seed.sample });
1701
+ const from = seed.sample ? undefined : seed.importedFrom?.[n - 1];
1702
+ items.push({ ...item, isPublished: seed.isPublished, isSample: seed.sample, ...(from ? { importedFrom: from } : {}) });
1685
1703
  }
1686
1704
  return items;
1687
1705
  }
@@ -1978,6 +1996,8 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
1978
1996
  // gradient name) mirrors from the node (design-core `iox-footer-mirrored`), never from the admin's `:dir()`.
1979
1997
  if (footerRoot && isRtlLocale(plan.locale)) footerRoot.styleProps = { ...(footerRoot.styleProps ?? {}), textDirection: 'rtl' };
1980
1998
  if (planSells(plan)) globals = withStore(globals, plan.locale ?? DEFAULT_SITE_LOCALE);
1999
+ // PU3 (R-H6): the popup, only from the owner's lines — before the law, so a newsletter popup's form gets its legal line.
2000
+ globals = withPopup(plan, globals, issues);
1981
2001
  // AW1: the law, derived from facts and never asked — the legal pages, the banner when a tracker is connected, the
1982
2002
  // footer's legal row and the line beside every form that asks for personal details.
1983
2003
  const legal = composeLegal(plan, context.legal ?? {}, pages, globals, footer.mix.arrange, placeholders);
@@ -2002,6 +2022,27 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
2002
2022
  };
2003
2023
  }
2004
2024
 
2025
+ /**
2026
+ * Popups PU3: the site's ONE popup (`checkPopup` — the owner's lines, the model's words mended), stamped through the palette's
2027
+ * recipe (R-H1) as a global among the BEFORE globals — after the header and its companions, so the header stays the first.
2028
+ * Every mend and a refusal said. Pure: new globals.
2029
+ */
2030
+ function withPopup(plan: SitePlan, globals: SerializedNode[], issues: ComposeIssue[]): SerializedNode[] {
2031
+ const checked = checkPopup(plan);
2032
+ for (const detail of checked.said) issues.push({ code: ComposeIssueCode.PopupMended, nodeId: POPUP_GLOBAL_ID, owner: POPUP_GLOBAL_ID, detail });
2033
+ if (checked.refused) issues.push({ code: ComposeIssueCode.PopupRefused, nodeId: POPUP_GLOBAL_ID, owner: POPUP_GLOBAL_ID, detail: checked.refused.said });
2034
+ if (!checked.popup) return globals;
2035
+ const locale = plan.locale ?? DEFAULT_SITE_LOCALE;
2036
+ const root = composePopup(checked.popup, spec => create(spec.key, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode, locale,
2037
+ () => composePresetForm('popup-form', FormPresetId.Newsletter, POPUP_GLOBAL_ID, locale) as unknown as CompositeNode) as SerializedNode;
2038
+ root.isGlobal = true;
2039
+ root.globalPosition = PatternGlobalPosition.Before;
2040
+ const out = [...globals];
2041
+ const lastBefore = out.map(g => g.globalPosition).lastIndexOf(PatternGlobalPosition.Before);
2042
+ out.splice(lastBefore + 1, 0, root);
2043
+ return out;
2044
+ }
2045
+
2005
2046
  // ── AW1: the law (award-ingredients-plan §4) ──────────────────────────────────────────────────────────────────────
2006
2047
 
2007
2048
  const LINK = 'Link';
@@ -69,7 +69,7 @@ const filled = (value: string | undefined): boolean => typeof value === 'string'
69
69
  /** May the pattern stand in for another at a fallen page's opening — a plain section of the same family. */
70
70
  function mayStandIn(id: string, family: string): boolean {
71
71
  const p = patternById(id);
72
- return !!p && p.family === family && !p.scene && !p.film && !p.shop && !p.global && !patternNeedsBinding(p);
72
+ return !!p && p.family === family && !p.scene && !p.film && !p.imported && !p.shop && !p.global && !patternNeedsBinding(p);
73
73
  }
74
74
 
75
75
  /**