@vectoriox/iox-ui 5.114.0 → 5.115.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,4 +1,4 @@
1
- import { NEW_NODE_STYLE_DEFAULTS, defaultElementStyleFor, elementStyleById, ownedTraitsOf, applyElementStyle, parseHexColor, rgbToOklab, flavorPackById, SPEC_AXES, EntranceParam, staggerDelay, LinkType, presetChoices, resolveDesignChoices, textWidthEm, elementStyleFace, setColorScheme, ColorScheme, stylePresetOfChoices, presetModes, STYLE_PRESETS, COLOR_SCHEMES, colorSchemeClass, COLOR_SCHEME_TRAIT, ANIMATE_IDS, auditDesignContrast, parseCssColour, compositeOver, wcagContrastRatio, relativeLuminance, toHexColor, resolveTokenValues, designTokenRows } from '@vectoriox/iox-ui/design-core';
1
+ import { NEW_NODE_STYLE_DEFAULTS, defaultElementStyleFor, elementStyleById, ownedTraitsOf, applyElementStyle, parseHexColor, rgbToOklab, textWidthEm, elementStyleFace, resolveDesignChoices, flavorPackById, SPEC_AXES, EntranceParam, staggerDelay, LinkType, presetChoices, setColorScheme, ColorScheme, stylePresetOfChoices, presetModes, STYLE_PRESETS, COLOR_SCHEMES, colorSchemeClass, COLOR_SCHEME_TRAIT, ANIMATE_IDS, auditDesignContrast, parseCssColour, compositeOver, wcagContrastRatio, relativeLuminance, toHexColor, resolveTokenValues, designTokenRows } from '@vectoriox/iox-ui/design-core';
2
2
  import { formPresetById, FormPresetId, FormAfterSend, FORM_AFTER_SEND_TRAIT, FORM_ACTIONS_ROLE, channelOpensNewTab, FORM_CHANNEL_ROLE, planFormPresetIds, ControlType, FORM_NODE_TYPE, collectFormSpec, FIELD_NODE_TYPE, isChannelFilled } from '@vectoriox/iox-ui/forms-core';
3
3
  import { normalizeFrameSequence, filmScreensFor, FILM_PREPARED_PICTURES, FrameExtension } from '@vectoriox/iox-ui/media-core';
4
4
  import { SEO_DESCRIPTION_MAX, SEO_TITLE_MAX } from '@vectoriox/iox-ui/seo-core';
@@ -25,7 +25,12 @@ const SPEC_SITE_PLAN_SHAPE = {
25
25
  "globals": "globals",
26
26
  "film?": "film — the owner's film as pictures (SC6b), set by the build and placed by placeFilm; never a model's",
27
27
  "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",
28
- "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"
28
+ "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",
29
+ "mixes?": "mixes — the header and footer as mixes of ingredients (ingredients.md); a mix wins over its globals pattern"
30
+ },
31
+ "mixes": {
32
+ "header?": "string[] — the header as <ingredient>:<word> words (site.layout.header; header ingredients HI1)",
33
+ "footer?": "string[] — the footer as <ingredient>:<word> words (site.layout.footer; list ingredients LI5)"
29
34
  },
30
35
  "direction": {
31
36
  "idea": "string — one sentence: what this site is about and how it should feel",
@@ -1615,12 +1620,12 @@ const SPEC_SITE_PATTERNS = {
1615
1620
  {
1616
1621
  "t": "Text",
1617
1622
  "es": "small",
1618
- "ph": "phone"
1623
+ "ph": "email"
1619
1624
  },
1620
1625
  {
1621
1626
  "t": "Text",
1622
1627
  "es": "small",
1623
- "ph": "email"
1628
+ "ph": "phone"
1624
1629
  }
1625
1630
  ]
1626
1631
  }
@@ -5286,6 +5291,209 @@ const SPEC_SITE_PATTERNS = {
5286
5291
  }
5287
5292
  }
5288
5293
  };
5294
+ const SPEC_SITE_FOOTER_PARTS = {
5295
+ "section": {
5296
+ "t": "Section",
5297
+ "es": "section",
5298
+ "lay": {
5299
+ "display": "flex",
5300
+ "flexDirection": "column",
5301
+ "gap": "32px"
5302
+ }
5303
+ },
5304
+ "brand": {
5305
+ "t": "Container",
5306
+ "es": "box",
5307
+ "lay": {
5308
+ "display": "flex",
5309
+ "flexDirection": "column",
5310
+ "gap": "8px"
5311
+ },
5312
+ "c": [
5313
+ {
5314
+ "t": "Heading",
5315
+ "es": "h3",
5316
+ "level": "h3",
5317
+ "slot": "brand",
5318
+ "max": 32,
5319
+ "fromBusiness": "name"
5320
+ },
5321
+ {
5322
+ "t": "Text",
5323
+ "es": "small",
5324
+ "slot": "tagline",
5325
+ "max": 120,
5326
+ "fromBusiness": "tagline",
5327
+ "ph": "copy"
5328
+ }
5329
+ ]
5330
+ },
5331
+ "pages": {
5332
+ "t": "Container",
5333
+ "es": "box",
5334
+ "lay": {
5335
+ "display": "flex",
5336
+ "flexDirection": "column",
5337
+ "gap": "8px"
5338
+ },
5339
+ "c": [
5340
+ {
5341
+ "t": "Heading",
5342
+ "es": "eyebrow",
5343
+ "level": "h4",
5344
+ "slot": "pagesLabel",
5345
+ "max": 40,
5346
+ "text": "Pages",
5347
+ "textHe": "עמודים"
5348
+ },
5349
+ {
5350
+ "t": "Link",
5351
+ "es": "link",
5352
+ "each": "$navPages",
5353
+ "bind": "page.name",
5354
+ "href": "$page.route"
5355
+ }
5356
+ ]
5357
+ },
5358
+ "pageRow": {
5359
+ "t": "Container",
5360
+ "es": "box",
5361
+ "lay": {
5362
+ "display": "flex",
5363
+ "flexWrap": "wrap",
5364
+ "gap": "var(--iox-space-gap)",
5365
+ "alignItems": "center",
5366
+ "width": "auto"
5367
+ },
5368
+ "c": [
5369
+ {
5370
+ "t": "Link",
5371
+ "es": "link",
5372
+ "each": "$navPages",
5373
+ "bind": "page.name",
5374
+ "href": "$page.route"
5375
+ }
5376
+ ]
5377
+ },
5378
+ "contact": {
5379
+ "t": "Container",
5380
+ "es": "box",
5381
+ "lay": {
5382
+ "display": "flex",
5383
+ "flexDirection": "column",
5384
+ "gap": "8px"
5385
+ },
5386
+ "c": [
5387
+ {
5388
+ "t": "Heading",
5389
+ "es": "eyebrow",
5390
+ "level": "h4",
5391
+ "slot": "contactLabel",
5392
+ "max": 40,
5393
+ "text": "Contact",
5394
+ "textHe": "יצירת קשר"
5395
+ },
5396
+ {
5397
+ "t": "Text",
5398
+ "es": "small",
5399
+ "ph": "email"
5400
+ },
5401
+ {
5402
+ "t": "Text",
5403
+ "es": "small",
5404
+ "ph": "phone"
5405
+ },
5406
+ {
5407
+ "t": "Text",
5408
+ "es": "small",
5409
+ "ph": "city"
5410
+ }
5411
+ ]
5412
+ },
5413
+ "visit": {
5414
+ "t": "Container",
5415
+ "es": "box",
5416
+ "lay": {
5417
+ "display": "flex",
5418
+ "flexDirection": "column",
5419
+ "gap": "8px"
5420
+ },
5421
+ "c": [
5422
+ {
5423
+ "t": "Heading",
5424
+ "es": "eyebrow",
5425
+ "level": "h4",
5426
+ "slot": "visitLabel",
5427
+ "max": 40,
5428
+ "text": "Visit",
5429
+ "textHe": "ביקור"
5430
+ },
5431
+ {
5432
+ "t": "Text",
5433
+ "es": "small",
5434
+ "ph": "address"
5435
+ },
5436
+ {
5437
+ "t": "Text",
5438
+ "es": "small",
5439
+ "ph": "hours"
5440
+ }
5441
+ ]
5442
+ },
5443
+ "call": {
5444
+ "t": "Container",
5445
+ "es": "box",
5446
+ "lay": {
5447
+ "display": "flex",
5448
+ "flexDirection": "column",
5449
+ "gap": "20px",
5450
+ "alignItems": "flex-start"
5451
+ },
5452
+ "c": [
5453
+ {
5454
+ "t": "Heading",
5455
+ "es": "h2",
5456
+ "level": "h2",
5457
+ "slot": "closing",
5458
+ "max": 44,
5459
+ "text": "Let's talk.",
5460
+ "textHe": "בואו נדבר."
5461
+ },
5462
+ {
5463
+ "t": "ButtonBlock",
5464
+ "es": "button-primary",
5465
+ "href": "/contact",
5466
+ "slot": "closingAction",
5467
+ "max": 24,
5468
+ "text": "Get in touch",
5469
+ "textHe": "צרו קשר"
5470
+ }
5471
+ ]
5472
+ },
5473
+ "name": {
5474
+ "t": "Heading",
5475
+ "es": "display",
5476
+ "level": "h2",
5477
+ "slot": "wordmark",
5478
+ "max": 32,
5479
+ "fromBusiness": "name",
5480
+ "lay": {
5481
+ "lineHeight": "0.9",
5482
+ "margin": "0px"
5483
+ }
5484
+ },
5485
+ "rule": {
5486
+ "t": "Divider",
5487
+ "es": "rule"
5488
+ },
5489
+ "copyright": {
5490
+ "t": "Text",
5491
+ "es": "small",
5492
+ "slot": "copyright",
5493
+ "max": 90,
5494
+ "text": "© {year} {business.name}"
5495
+ }
5496
+ };
5289
5497
  const SPEC_SITE_TEMPLATES = {
5290
5498
  "studio": {
5291
5499
  "id": "studio",
@@ -7441,6 +7649,88 @@ const SPEC_SITE_LAYOUT = {
7441
7649
  }
7442
7650
  }
7443
7651
  ]
7652
+ },
7653
+ "footer": {
7654
+ "ingredients": {
7655
+ "arrange": [
7656
+ "columns",
7657
+ "centred",
7658
+ "line"
7659
+ ],
7660
+ "holds": [
7661
+ "pages",
7662
+ "visit",
7663
+ "contact"
7664
+ ],
7665
+ "closing": [
7666
+ "none",
7667
+ "call",
7668
+ "name"
7669
+ ],
7670
+ "ground": [
7671
+ "inverse",
7672
+ "plain",
7673
+ "subtle",
7674
+ "accent"
7675
+ ]
7676
+ },
7677
+ "many": [
7678
+ "holds"
7679
+ ],
7680
+ "meanings": {
7681
+ "arrange.columns": "the name and its line at the start, a column for each block it holds",
7682
+ "arrange.centred": "everything centred, one block under another",
7683
+ "arrange.line": "one quiet line: the copyright beside the pages",
7684
+ "holds.pages": "the pages",
7685
+ "holds.contact": "how to reach the business (email, phone, city)",
7686
+ "holds.visit": "where and when to visit (address, hours) — for a place people come to",
7687
+ "closing.none": "nothing before the footer's blocks",
7688
+ "closing.call": "a closing line and one button, above the blocks",
7689
+ "closing.name": "the business name set huge across the width, under the blocks",
7690
+ "ground.inverse": "a dark band",
7691
+ "ground.plain": "the page's own ground, a hairline above",
7692
+ "ground.subtle": "a soft band",
7693
+ "ground.accent": "a band in the brand colour"
7694
+ },
7695
+ "waits": {},
7696
+ "defaults": {
7697
+ "arrange": "columns",
7698
+ "holds": [
7699
+ "pages",
7700
+ "contact"
7701
+ ],
7702
+ "closing": "none",
7703
+ "ground": "inverse"
7704
+ },
7705
+ "named": {
7706
+ "footer.three-column": {},
7707
+ "footer.mega": {
7708
+ "holds": [
7709
+ "pages",
7710
+ "visit",
7711
+ "contact"
7712
+ ]
7713
+ },
7714
+ "footer.minimal": {
7715
+ "arrange": "line",
7716
+ "holds": [
7717
+ "pages"
7718
+ ],
7719
+ "ground": "plain"
7720
+ }
7721
+ },
7722
+ "fingerprint": [
7723
+ "arrange",
7724
+ "closing",
7725
+ "ground"
7726
+ ],
7727
+ "rules": {
7728
+ "lineHolds": [
7729
+ "pages"
7730
+ ],
7731
+ "minHolds": 1
7732
+ },
7733
+ "references": []
7444
7734
  }
7445
7735
  };
7446
7736
 
@@ -13344,7 +13634,7 @@ var SiteTemplateId;
13344
13634
  const STUDIO_TEMPLATE = SITE_TEMPLATES[SiteTemplateId.Studio];
13345
13635
  class SiteTemplateError extends Error {
13346
13636
  }
13347
- const clone$4 = (value) => JSON.parse(JSON.stringify(value));
13637
+ const clone$5 = (value) => JSON.parse(JSON.stringify(value));
13348
13638
  /**
13349
13639
  * The template as a Site Plan (`source.kind: template`), with the customer's business and look. A
13350
13640
  * required page cannot be left out, and an unknown key is refused — nothing is guessed.
@@ -13361,12 +13651,12 @@ function planFromTemplate(template, input) {
13361
13651
  return {
13362
13652
  version: SITE_PLAN_VERSION,
13363
13653
  source: { kind: SitePlanSourceKind.Template, templateId: template.id, templateVersion: template.version },
13364
- business: clone$4(input.business),
13365
- design: clone$4(input.design),
13366
- contentTypes: clone$4(template.contentTypes),
13367
- dataSources: clone$4(template.dataSources),
13368
- pages: clone$4(template.pages.filter(p => !omit.has(p.key))),
13369
- globals: clone$4(template.globals),
13654
+ business: clone$5(input.business),
13655
+ design: clone$5(input.design),
13656
+ contentTypes: clone$5(template.contentTypes),
13657
+ dataSources: clone$5(template.dataSources),
13658
+ pages: clone$5(template.pages.filter(p => !omit.has(p.key))),
13659
+ globals: clone$5(template.globals),
13370
13660
  };
13371
13661
  }
13372
13662
 
@@ -13375,7 +13665,7 @@ function planFromTemplate(template, input) {
13375
13665
  * wrong — never something to work around. */
13376
13666
  class ComposeError extends Error {
13377
13667
  }
13378
- const clone$3 = (value) => JSON.parse(JSON.stringify(value));
13668
+ const clone$4 = (value) => JSON.parse(JSON.stringify(value));
13379
13669
  /**
13380
13670
  * A NEW node of `type`, as the builder creates one (ComponentRegistryService.createConfig, serialized):
13381
13671
  * the type's constructor defaults, its text colour released to `inherit` (NEW_NODE_STYLE_DEFAULTS), then
@@ -13390,8 +13680,8 @@ function createSerializedNode(id, type, props = {}, elementStyle, options = {})
13390
13680
  const node = {
13391
13681
  id,
13392
13682
  type,
13393
- props: { ...clone$3(baseline.props), ...props },
13394
- styleProps: clone$3(baseline.styleProps),
13683
+ props: { ...clone$4(baseline.props), ...props },
13684
+ styleProps: clone$4(baseline.styleProps),
13395
13685
  bindings: [],
13396
13686
  interactions: [],
13397
13687
  };
@@ -13942,1161 +14232,1940 @@ function artDirectionIssues(value) {
13942
14232
  return issues;
13943
14233
  }
13944
14234
 
13945
- const LIST_RECIPES = {
13946
- [PatternRecipe.Accordion]: { picks: f => ({ ...pickAccordionAutoBinds(f) }), required: ['question', 'answer'], needs: 'short-text field for the question and long-text field for the answer' },
13947
- [PatternRecipe.Tabs]: { picks: f => ({ ...pickTabsAutoBinds(f) }), required: ['label', 'text'], needs: 'short-text field for the tab and long-text field for its panel' },
13948
- };
13949
- /** The fields `recipe` binds from a listed type's `fields`, and what they lack. A recipe that lists nothing lacks nothing. */
13950
- function recipeListBinds(recipe, fields) {
13951
- const spec = recipe ? LIST_RECIPES[recipe] : undefined;
13952
- if (!spec)
13953
- return { picks: {}, gap: null };
13954
- const picks = spec.picks(fields);
13955
- return { picks: picks, gap: spec.required.every(key => picks[key]) ? null : spec.needs };
13956
- }
13957
- const listsBinding = (src) => src === PatternDirective.Binding || src === PatternDirective.OptionalBinding;
13958
- /** What a listed type with `fields` lacks for the pattern's recipes that repeat the section's binding — the first gap, or null. */
13959
- function patternListGap(pattern, fields) {
13960
- for (const node of patternNodes(pattern)) {
13961
- if (!listsBinding(node.src))
13962
- continue;
13963
- const { gap } = recipeListBinds(node.recipe, fields);
13964
- if (gap)
13965
- return gap;
13966
- }
13967
- return null;
13968
- }
13969
-
13970
14235
  /**
13971
- * The Site Plan validator — the gate in front of the composer. The wizard's plan and (later) the AI's
13972
- * plan go through the SAME checks: an unknown pattern, a slot the pattern does not declare, a source
13973
- * that does not exist, a page whose route item cannot be resolved — all refused, with a path, before a
13974
- * single page is written. It never repairs: a model gets the issues back and rewrites.
14236
+ * The LAYOUT LANGUAGE (premium components M8 — the prototype's CL2 / CL2.1, premium-sites plan "Breaking limits"): a page
14237
+ * composed as layers of closed kinds placed on a 12-column grid, with closed sizes, the look's five colours, roles, time
14238
+ * entrances, a parallax depth, held sections whose layers move by tracks, sideways sections, galleries, forms and a phone
14239
+ * reading order. The model writes no CSS and no node tree; `composeLayout` stamps ordinary builder nodes from it.
14240
+ *
14241
+ * Gate 1 typed the shape the three proof sites were saved in (iox-ai-guidance `prototypes/breaking-limits/round4|round3`).
14242
+ * Gate 2 moved the closed lists into the contract (`site.layout`, SPEC_SITE_LAYOUT): these enums are held equal to it by
14243
+ * layout-language.spec, and a generated page carries one in `PagePlan.layout` (a `LayoutPage`).
13975
14244
  */
13976
- var SitePlanIssueCode;
13977
- (function (SitePlanIssueCode) {
13978
- /** A value of the wrong type, or a required value missing. */
13979
- SitePlanIssueCode["Shape"] = "shape";
13980
- /** A key the plan shape does not have. */
13981
- SitePlanIssueCode["UnknownKey"] = "unknown-key";
13982
- SitePlanIssueCode["Version"] = "version";
13983
- SitePlanIssueCode["UnknownFlavor"] = "unknown-flavor";
13984
- SitePlanIssueCode["InvalidDesign"] = "invalid-design";
13985
- SitePlanIssueCode["MissingBusinessName"] = "missing-business-name";
13986
- SitePlanIssueCode["UnknownFact"] = "unknown-fact";
13987
- SitePlanIssueCode["Duplicate"] = "duplicate";
13988
- SitePlanIssueCode["ReservedAlias"] = "reserved-alias";
13989
- SitePlanIssueCode["UnknownContentType"] = "unknown-content-type";
13990
- SitePlanIssueCode["UnknownField"] = "unknown-field";
13991
- SitePlanIssueCode["UnknownDataSource"] = "unknown-data-source";
13992
- SitePlanIssueCode["InvalidDataSource"] = "invalid-data-source";
13993
- SitePlanIssueCode["InvalidRoute"] = "invalid-route";
13994
- SitePlanIssueCode["Home"] = "home";
13995
- SitePlanIssueCode["RouteSource"] = "route-source";
13996
- SitePlanIssueCode["UnknownPattern"] = "unknown-pattern";
13997
- SitePlanIssueCode["GlobalPattern"] = "global-pattern";
13998
- SitePlanIssueCode["UnknownSlot"] = "unknown-slot";
13999
- SitePlanIssueCode["UnknownOptionalPart"] = "unknown-optional-part";
14000
- SitePlanIssueCode["Binding"] = "binding";
14001
- SitePlanIssueCode["MissingScope"] = "missing-scope";
14002
- /** A pattern reads a role (`@title`) the bound item's content type does not name (L0-3), or a type names no title. */
14003
- SitePlanIssueCode["MissingRole"] = "missing-role";
14004
- /** A role the contract does not know, or one played by a field the type does not have. */
14005
- SitePlanIssueCode["UnknownRole"] = "unknown-role";
14006
- /** A page type that does not exist; or (`archetypeIssues`, the plan stage's own check) sections that do not fit it. */
14007
- SitePlanIssueCode["Archetype"] = "archetype";
14008
- /** A slot's words are longer than its budget under the look's density (L0-2, M1-6c): rewrite, never cut. */
14009
- SitePlanIssueCode["SlotTooLong"] = "slot-too-long";
14010
- /** A section re-points a slot that does not link, or to a route the plan has no page for. */
14011
- SitePlanIssueCode["InvalidLink"] = "invalid-link";
14012
- /** A section's form preset is not a forms-core preset, or the pattern holds no form. */
14013
- SitePlanIssueCode["InvalidForm"] = "invalid-form";
14014
- /** A section's entrance is not a How animated level. */
14015
- SitePlanIssueCode["InvalidEnter"] = "invalid-enter";
14016
- /** The plan's language is not a site locale. */
14017
- SitePlanIssueCode["InvalidLocale"] = "invalid-locale";
14018
- /** A page's SEO words are longer than a search result shows (seo-core limits). */
14019
- SitePlanIssueCode["InvalidSeo"] = "invalid-seo";
14020
- /** A page names a need the harness does not have. */
14021
- SitePlanIssueCode["UnknownNeed"] = "unknown-need";
14022
- /** A page key that is a global slot's name (`header`, `footer`): its sections' ids would be the global's. */
14023
- SitePlanIssueCode["ReservedPageKey"] = "reserved-page-key";
14024
- /** SC6: a Scene below How animated Expressive, a second Scene on a page, or Scenes on more than the home page and
14025
- * one other — the pages answer by choosing another pattern. */
14026
- SitePlanIssueCode["SceneBudget"] = "scene-budget";
14027
- /** SC6b: the owner's film — pictures that cannot play, too few to play smoothly, or a film's pattern on a plan with
14028
- * no film (or twice). Set by the build, never by a model. */
14029
- SitePlanIssueCode["Film"] = "film";
14030
- /** M7: the art direction is not a picture world with its five parts. Set by the generation, never by a model. */
14031
- SitePlanIssueCode["ArtDirection"] = "art-direction";
14032
- /** M8 gate 2: the site's direction (the idea, the cliché, the flip, three rules) — written whole or not at all. */
14033
- SitePlanIssueCode["Direction"] = "direction";
14034
- /** M8 gate 2: which pages are composed — the home page and at most one other that is no per-item page. */
14035
- SitePlanIssueCode["Compose"] = "compose";
14036
- /** M8 gate 2: a composed page's layout (`checkLayout`'s issues, each at its path under `layout`). */
14037
- SitePlanIssueCode["Layout"] = "layout";
14038
- /** Commerce C-D21: what the business sells — a selling business without its products, one that sells nothing with a
14039
- * shop, a product past the sixth, a shop source with no shop, or a content type named after a shop list. */
14040
- SitePlanIssueCode["Shop"] = "shop";
14041
- /** Commerce C-D21: a selling site has a product page — a page at a `:slug` route reading the shop's one product. */
14042
- SitePlanIssueCode["ProductPage"] = "product-page";
14043
- /** Commerce C-D21: a price, a stock count or a fee written into what the business sells — the owner sets those. */
14044
- SitePlanIssueCode["Price"] = "price";
14045
- })(SitePlanIssueCode || (SitePlanIssueCode = {}));
14046
- class SitePlanError extends Error {
14047
- constructor(issues) {
14048
- super(`invalid site plan: ${issues.map(i => `${i.path}: ${i.message}`).join('; ')}`);
14049
- this.issues = issues;
14050
- }
14051
- }
14052
- /** Route-scope aliases (`$route`, `$current`, …) are platform-owned. */
14053
- const RESERVED_PREFIX = '$';
14054
- const ID_FIELD = '_id';
14055
- /** The documented plan shape (contract `site.planShape`): its key lists are READ (`shape-check`), so a key
14056
- * the plan documents is a key the gate validates — and an undocumented one is refused. */
14057
- const SHAPE = SPEC_SITE_PLAN_SHAPE;
14058
- const PLAN_KEYS = shapeKeys(SHAPE['plan']);
14059
- const TEMPLATE_SOURCE_KEYS = shapeKeys(SHAPE['sourceTemplate']);
14060
- const AI_SOURCE_KEYS = shapeKeys(SHAPE['sourceAi']);
14061
- const BUSINESS_KEYS = shapeKeys(SHAPE['business']);
14062
- const DESIGN_REQUIRED = requiredShapeKeys(SHAPE['design']);
14063
- const DESIGN_KEYS = shapeKeys(SHAPE['design']);
14064
- const CONTENT_TYPE_KEYS = shapeKeys(SHAPE['contentType']);
14065
- const ROLE_KEYS$1 = shapeKeys(SHAPE['roles']);
14066
- const PAGE_SEO_KEYS = shapeKeys(SHAPE['pageSeo']);
14067
- const ARRAY_TYPE = 'array';
14068
- const FIELD_KEYS = shapeKeys(SHAPE['field']);
14069
- const SLUG_FIELD = 'slug';
14070
- const SEED_FIXED_KEYS = shapeKeys(SHAPE['seed']);
14071
- const CMS_SOURCE_KEYS = shapeKeys(SHAPE['cmsDataSource']);
14072
- const RELATIVE_SOURCE_KEYS = shapeKeys(SHAPE['relativeDataSource']);
14073
- const SHOP_SOURCE_KEYS = shapeKeys(SHAPE['shopDataSource']);
14074
- const SHOP_KEYS = shapeKeys(SHAPE['shop']);
14075
- const SHOP_PRODUCT_KEYS = shapeKeys(SHAPE['shopProduct']);
14076
- const SHOP_OPTION_KEYS = shapeKeys(SHAPE['shopOption']);
14077
- const PAGE_KEYS = shapeKeys(SHAPE['page']);
14078
- const FILM_KEYS = shapeKeys(SHAPE['film']);
14079
- const ART_DIRECTION_KEYS = shapeKeys(SHAPE['artDirection']);
14080
- const DIRECTION_KEYS = shapeKeys(SHAPE['direction']);
14081
- const LAYOUT_PAGE_KEYS = shapeKeys(SHAPE['layoutPage']);
14082
- const LAYOUT_DIALS = SPEC_SITE_LAYOUT.vocab.dials;
14083
- const COMPOSED_PAGES_MAX = SPEC_SITE_LAYOUT.limits.composedPages;
14084
- const DIRECTION_RULES_MAX = 3;
14085
- const SECTION_KEYS = shapeKeys(SHAPE['section']);
14086
- const GLOBAL_POSITION = {
14087
- [GlobalSlot.Header]: PatternGlobalPosition.Before,
14088
- [GlobalSlot.Footer]: PatternGlobalPosition.After,
14245
+ var LayoutLayerKind;
14246
+ (function (LayoutLayerKind) {
14247
+ LayoutLayerKind["Word"] = "word";
14248
+ LayoutLayerKind["Heading"] = "heading";
14249
+ LayoutLayerKind["Text"] = "text";
14250
+ LayoutLayerKind["Photo"] = "photo";
14251
+ LayoutLayerKind["Gallery"] = "gallery";
14252
+ LayoutLayerKind["Button"] = "button";
14253
+ LayoutLayerKind["List"] = "list";
14254
+ LayoutLayerKind["Number"] = "number";
14255
+ LayoutLayerKind["Shape"] = "shape";
14256
+ LayoutLayerKind["Label"] = "label";
14257
+ LayoutLayerKind["Form"] = "form";
14258
+ LayoutLayerKind["Marquee"] = "marquee";
14259
+ })(LayoutLayerKind || (LayoutLayerKind = {}));
14260
+ var LayoutSize;
14261
+ (function (LayoutSize) {
14262
+ LayoutSize["Xs"] = "xs";
14263
+ LayoutSize["S"] = "s";
14264
+ LayoutSize["M"] = "m";
14265
+ LayoutSize["L"] = "l";
14266
+ LayoutSize["Xl"] = "xl";
14267
+ LayoutSize["Xxl"] = "xxl";
14268
+ /** As wide as its columns allow — a word, never a sentence. */
14269
+ LayoutSize["Screen"] = "screen";
14270
+ })(LayoutSize || (LayoutSize = {}));
14271
+ /** The look's five colours, by role. */
14272
+ var LayoutColour;
14273
+ (function (LayoutColour) {
14274
+ LayoutColour["Ground"] = "ground";
14275
+ LayoutColour["Ink"] = "ink";
14276
+ LayoutColour["Accent"] = "accent";
14277
+ LayoutColour["Soft"] = "soft";
14278
+ LayoutColour["Muted"] = "muted";
14279
+ })(LayoutColour || (LayoutColour = {}));
14280
+ var LayoutRole;
14281
+ (function (LayoutRole) {
14282
+ LayoutRole["Lead"] = "lead";
14283
+ LayoutRole["Support"] = "support";
14284
+ LayoutRole["Decoration"] = "decoration";
14285
+ LayoutRole["Static"] = "static";
14286
+ })(LayoutRole || (LayoutRole = {}));
14287
+ var LayoutEnter;
14288
+ (function (LayoutEnter) {
14289
+ LayoutEnter["None"] = "none";
14290
+ LayoutEnter["Fade"] = "fade";
14291
+ LayoutEnter["FadeRise"] = "fadeRise";
14292
+ LayoutEnter["ScaleIn"] = "scaleIn";
14293
+ LayoutEnter["ClipReveal"] = "clipReveal";
14294
+ LayoutEnter["MaskRise"] = "maskRise";
14295
+ LayoutEnter["BlurIn"] = "blurIn";
14296
+ LayoutEnter["Pop"] = "pop";
14297
+ })(LayoutEnter || (LayoutEnter = {}));
14298
+ var LayoutDepth;
14299
+ (function (LayoutDepth) {
14300
+ LayoutDepth["Back"] = "back";
14301
+ LayoutDepth["Mid"] = "mid";
14302
+ LayoutDepth["Front"] = "front";
14303
+ })(LayoutDepth || (LayoutDepth = {}));
14304
+ var LayoutTransition;
14305
+ (function (LayoutTransition) {
14306
+ LayoutTransition["Cut"] = "cut";
14307
+ LayoutTransition["Flood"] = "flood";
14308
+ LayoutTransition["WipeUp"] = "wipe-up";
14309
+ LayoutTransition["WipeDown"] = "wipe-down";
14310
+ LayoutTransition["WipeStart"] = "wipe-start";
14311
+ LayoutTransition["WipeEnd"] = "wipe-end";
14312
+ })(LayoutTransition || (LayoutTransition = {}));
14313
+ var LayoutEase;
14314
+ (function (LayoutEase) {
14315
+ LayoutEase["Out"] = "out";
14316
+ LayoutEase["InOut"] = "inOut";
14317
+ LayoutEase["Drawer"] = "drawer";
14318
+ LayoutEase["Linear"] = "linear";
14319
+ })(LayoutEase || (LayoutEase = {}));
14320
+ var LayoutPace;
14321
+ (function (LayoutPace) {
14322
+ LayoutPace["Slow"] = "slow";
14323
+ LayoutPace["Normal"] = "normal";
14324
+ LayoutPace["Quick"] = "quick";
14325
+ })(LayoutPace || (LayoutPace = {}));
14326
+ var LayoutSide;
14327
+ (function (LayoutSide) {
14328
+ LayoutSide["Bottom"] = "bottom";
14329
+ LayoutSide["Top"] = "top";
14330
+ LayoutSide["Start"] = "start";
14331
+ LayoutSide["End"] = "end";
14332
+ })(LayoutSide || (LayoutSide = {}));
14333
+ var LayoutTrackProp;
14334
+ (function (LayoutTrackProp) {
14335
+ LayoutTrackProp["X"] = "x";
14336
+ LayoutTrackProp["Y"] = "y";
14337
+ LayoutTrackProp["Scale"] = "scale";
14338
+ LayoutTrackProp["Opacity"] = "opacity";
14339
+ LayoutTrackProp["Rotate"] = "rotate";
14340
+ LayoutTrackProp["Clip"] = "clip";
14341
+ LayoutTrackProp["Blur"] = "blur";
14342
+ })(LayoutTrackProp || (LayoutTrackProp = {}));
14343
+ var LayoutAlign;
14344
+ (function (LayoutAlign) {
14345
+ LayoutAlign["Start"] = "start";
14346
+ LayoutAlign["Center"] = "center";
14347
+ LayoutAlign["End"] = "end";
14348
+ })(LayoutAlign || (LayoutAlign = {}));
14349
+ var LayoutBleed;
14350
+ (function (LayoutBleed) {
14351
+ LayoutBleed["None"] = "none";
14352
+ LayoutBleed["Start"] = "start";
14353
+ LayoutBleed["End"] = "end";
14354
+ LayoutBleed["Both"] = "both";
14355
+ })(LayoutBleed || (LayoutBleed = {}));
14356
+ /** A pool photo's shape (the inventory measures each one): what it keeps where nothing else gives it a height. */
14357
+ var LayoutPhotoShape;
14358
+ (function (LayoutPhotoShape) {
14359
+ LayoutPhotoShape["Wide"] = "wide";
14360
+ LayoutPhotoShape["Landscape"] = "landscape";
14361
+ LayoutPhotoShape["Square"] = "square";
14362
+ LayoutPhotoShape["Portrait"] = "portrait";
14363
+ LayoutPhotoShape["Tall"] = "tall";
14364
+ })(LayoutPhotoShape || (LayoutPhotoShape = {}));
14365
+ const LAYOUT_PHOTO_ASPECT = {
14366
+ [LayoutPhotoShape.Wide]: '16 / 9',
14367
+ [LayoutPhotoShape.Landscape]: '3 / 2',
14368
+ [LayoutPhotoShape.Square]: '1 / 1',
14369
+ [LayoutPhotoShape.Portrait]: '2 / 3',
14370
+ [LayoutPhotoShape.Tall]: '9 / 16',
14089
14371
  };
14090
- const ROUTE = /^\/(?:(?:[a-z0-9]+(?:-[a-z0-9]+)*|:[a-zA-Z_][a-zA-Z0-9_]*)(?:\/(?:[a-z0-9]+(?:-[a-z0-9]+)*|:[a-zA-Z_][a-zA-Z0-9_]*))*)?$/;
14091
- const ROUTE_PARAM$1 = /:([a-zA-Z_][a-zA-Z0-9_]*)/g;
14092
- const has$1 = (table, key) => Object.prototype.hasOwnProperty.call(table, key);
14093
- /** The `:param` names of a route, in order. */
14094
- function routeParams(route) {
14095
- return [...route.matchAll(ROUTE_PARAM$1)].map(m => m[1]);
14372
+ var LayoutSectionKind;
14373
+ (function (LayoutSectionKind) {
14374
+ LayoutSectionKind["Content"] = "content";
14375
+ LayoutSectionKind["Inhale"] = "inhale";
14376
+ })(LayoutSectionKind || (LayoutSectionKind = {}));
14377
+ var LayoutButtonVariant;
14378
+ (function (LayoutButtonVariant) {
14379
+ LayoutButtonVariant["Primary"] = "primary";
14380
+ LayoutButtonVariant["Secondary"] = "secondary";
14381
+ LayoutButtonVariant["Ghost"] = "ghost";
14382
+ })(LayoutButtonVariant || (LayoutButtonVariant = {}));
14383
+ /** The product SliderContainer's own effects (iox-ui `slider-options.ts`). */
14384
+ var LayoutGalleryEffect;
14385
+ (function (LayoutGalleryEffect) {
14386
+ LayoutGalleryEffect["Slide"] = "slide";
14387
+ LayoutGalleryEffect["Fade"] = "fade";
14388
+ LayoutGalleryEffect["Cube"] = "cube";
14389
+ LayoutGalleryEffect["Flip"] = "flip";
14390
+ LayoutGalleryEffect["Coverflow"] = "coverflow";
14391
+ LayoutGalleryEffect["Cards"] = "cards";
14392
+ LayoutGalleryEffect["Creative"] = "creative";
14393
+ })(LayoutGalleryEffect || (LayoutGalleryEffect = {}));
14394
+ var LayoutNavKind;
14395
+ (function (LayoutNavKind) {
14396
+ LayoutNavKind["Bar"] = "bar";
14397
+ LayoutNavKind["Corner"] = "corner";
14398
+ LayoutNavKind["Index"] = "index";
14399
+ LayoutNavKind["Side"] = "side";
14400
+ })(LayoutNavKind || (LayoutNavKind = {}));
14401
+ /** List ingredients (list-ingredients-plan.md §2): the seven choices a list section mixes. Held equal to the contract's
14402
+ * `site.layout.list` by layout-language.spec. */
14403
+ var LayoutListItem;
14404
+ (function (LayoutListItem) {
14405
+ LayoutListItem["Photo"] = "photo";
14406
+ LayoutListItem["Card"] = "card";
14407
+ })(LayoutListItem || (LayoutListItem = {}));
14408
+ var LayoutListArrange;
14409
+ (function (LayoutListArrange) {
14410
+ LayoutListArrange["Row"] = "row";
14411
+ LayoutListArrange["Grid"] = "grid";
14412
+ LayoutListArrange["Masonry"] = "masonry";
14413
+ LayoutListArrange["Strips"] = "strips";
14414
+ LayoutListArrange["Deck"] = "deck";
14415
+ })(LayoutListArrange || (LayoutListArrange = {}));
14416
+ var LayoutListWho;
14417
+ (function (LayoutListWho) {
14418
+ LayoutListWho["None"] = "none";
14419
+ LayoutListWho["Middle"] = "middle";
14420
+ LayoutListWho["First"] = "first";
14421
+ LayoutListWho["Pointed"] = "pointed";
14422
+ })(LayoutListWho || (LayoutListWho = {}));
14423
+ var LayoutListHow;
14424
+ (function (LayoutListHow) {
14425
+ LayoutListHow["Bigger"] = "bigger";
14426
+ LayoutListHow["Wider"] = "wider";
14427
+ LayoutListHow["Raised"] = "raised";
14428
+ LayoutListHow["Brighter"] = "brighter";
14429
+ })(LayoutListHow || (LayoutListHow = {}));
14430
+ var LayoutListMove;
14431
+ (function (LayoutListMove) {
14432
+ LayoutListMove["Arrows"] = "arrows";
14433
+ LayoutListMove["Drag"] = "drag";
14434
+ LayoutListMove["Auto"] = "auto";
14435
+ LayoutListMove["Page"] = "page";
14436
+ })(LayoutListMove || (LayoutListMove = {}));
14437
+ var LayoutListHover;
14438
+ (function (LayoutListHover) {
14439
+ LayoutListHover["Rise"] = "rise";
14440
+ LayoutListHover["Open"] = "open";
14441
+ LayoutListHover["Zoom"] = "zoom";
14442
+ LayoutListHover["Dim"] = "dim";
14443
+ })(LayoutListHover || (LayoutListHover = {}));
14444
+ var LayoutListArrive;
14445
+ (function (LayoutListArrive) {
14446
+ LayoutListArrive["Together"] = "together";
14447
+ LayoutListArrive["OneByOne"] = "one-by-one";
14448
+ LayoutListArrive["SlideIn"] = "slide-in";
14449
+ })(LayoutListArrive || (LayoutListArrive = {}));
14450
+ var LayoutListPhone;
14451
+ (function (LayoutListPhone) {
14452
+ LayoutListPhone["Swipe"] = "swipe";
14453
+ LayoutListPhone["Stack"] = "stack";
14454
+ LayoutListPhone["TwoUp"] = "two-up";
14455
+ })(LayoutListPhone || (LayoutListPhone = {}));
14456
+ /** How far a composed page breaks the usual layout (M8-G2-D5: follows How animated and the type's ceiling). */
14457
+ var LayoutDial;
14458
+ (function (LayoutDial) {
14459
+ LayoutDial["Distinct"] = "distinct";
14460
+ LayoutDial["Daring"] = "daring";
14461
+ })(LayoutDial || (LayoutDial = {}));
14462
+ /** Where a layout's photo comes from (M8-G2-D10): `own:<assetId>` · `stock:<libraryKey>` · `box:<shape>`. */
14463
+ var LayoutPhotoSource;
14464
+ (function (LayoutPhotoSource) {
14465
+ LayoutPhotoSource["Own"] = "own";
14466
+ LayoutPhotoSource["Stock"] = "stock";
14467
+ LayoutPhotoSource["Box"] = "box";
14468
+ })(LayoutPhotoSource || (LayoutPhotoSource = {}));
14469
+ /** A photo id read: its source and key (`box:portrait` → box, portrait). Null when it names no source. */
14470
+ function parseLayoutPhotoId(id) {
14471
+ const m = /^(own|stock|box):(.+)$/.exec(String(id ?? '').trim());
14472
+ if (!m)
14473
+ return null;
14474
+ if (m[1] === LayoutPhotoSource.Box && !Object.values(LayoutPhotoShape).includes(m[2]))
14475
+ return null;
14476
+ return { source: m[1], key: m[2] };
14096
14477
  }
14097
- let Collector$1 = class Collector extends PathIssueCollector {
14098
- constructor() {
14099
- super('plan', { shape: SitePlanIssueCode.Shape, unknownKey: SitePlanIssueCode.UnknownKey, duplicate: SitePlanIssueCode.Duplicate });
14100
- }
14101
- };
14102
- function validateSource(c, source) {
14103
- if (!isPlainObject(source))
14104
- return c.add(SitePlanIssueCode.Shape, 'source', 'must be an object');
14105
- if (source['kind'] === SitePlanSourceKind.Template) {
14106
- c.keys(source, TEMPLATE_SOURCE_KEYS, 'source');
14107
- c.string(source, 'templateId', 'source');
14108
- if (!Number.isInteger(source['templateVersion']))
14109
- c.add(SitePlanIssueCode.Shape, 'source.templateVersion', 'must be an integer');
14110
- }
14111
- else if (source['kind'] === SitePlanSourceKind.Ai) {
14112
- c.keys(source, AI_SOURCE_KEYS, 'source');
14113
- c.string(source, 'runId', 'source');
14114
- }
14115
- else {
14116
- c.add(SitePlanIssueCode.Shape, 'source.kind', `must be "${SitePlanSourceKind.Template}" or "${SitePlanSourceKind.Ai}"`);
14478
+ /** What can be wrong with a composed page, each refused with a path (`checkLayout`, `expandLayoutWire`). */
14479
+ var LayoutIssueCode;
14480
+ (function (LayoutIssueCode) {
14481
+ /** The answer cannot be read (not an object, no sections). */
14482
+ LayoutIssueCode["Shape"] = "shape";
14483
+ /** A value outside its closed list or range. */
14484
+ LayoutIssueCode["Value"] = "value";
14485
+ /** The page's structure (sections, leads, signature, phone order). */
14486
+ LayoutIssueCode["Structure"] = "structure";
14487
+ /** The look's composition notes (space, type contrast, rotation, accent, what it avoids). */
14488
+ LayoutIssueCode["Look"] = "look";
14489
+ /** How things move (Emil). */
14490
+ LayoutIssueCode["Motion"] = "motion";
14491
+ /** Words that would not read: on a photo's busy part, too faint, too long for their box. */
14492
+ LayoutIssueCode["Reading"] = "reading";
14493
+ /** A photo, a source, a fact or a form that is not the business's. */
14494
+ LayoutIssueCode["Content"] = "content";
14495
+ /** What daring asks for and the page does not do. */
14496
+ LayoutIssueCode["Daring"] = "daring";
14497
+ /** It repeats a page already made (the fingerprint). */
14498
+ LayoutIssueCode["Sameness"] = "sameness";
14499
+ /** The rendered page (the render check): overlap, overflow, a first screen without its lead. */
14500
+ LayoutIssueCode["Render"] = "render";
14501
+ })(LayoutIssueCode || (LayoutIssueCode = {}));
14502
+ /** What the composer may settle by itself, with no word or place changed (`mendLayout`). */
14503
+ var LayoutMendKind;
14504
+ (function (LayoutMendKind) {
14505
+ /** Words over a busy or too-light part of a photo, in a look that allows scrims: the layer gets one. */
14506
+ LayoutMendKind["Scrim"] = "scrim";
14507
+ /** The accent on more layers than the look allows: the least important words go back to the ink, then — where words
14508
+ * cannot give enough back — the least important accent bands take the ground nearest the accent their words read on. */
14509
+ LayoutMendKind["Accent"] = "accent";
14510
+ /** Words too faint on their ground, where the ink holds there: they go back to the ink. */
14511
+ LayoutMendKind["Ink"] = "ink";
14512
+ /** Decoration that enters with a move: it fades instead. */
14513
+ LayoutMendKind["Fade"] = "fade";
14514
+ /** Fewer layers glide than the look asks (iox-ui#63): the layers that may glide and do not get a depth, most important
14515
+ * first — exactly as many as are missing. */
14516
+ LayoutMendKind["Depth"] = "depth";
14517
+ /** A gallery naming a list with no pictures (iox-ui#64): it shows a list that has them — the only one, else the one
14518
+ * the section's words name, else the first in plan order. None, or the section's words name the list it named
14519
+ * (iox-ui#66): left to the model. */
14520
+ LayoutMendKind["Source"] = "source";
14521
+ /** A held section where nothing moves by the scroll (the page stops on a still screen, M8 demo): its line — a word,
14522
+ * heading or text of at most the kinetic words — is lit word by word as the hold plays. */
14523
+ LayoutMendKind["Words"] = "words";
14524
+ /** A held section where nothing moves and no line can be lit: it flows, one screen tall — when the page can spare the hold. */
14525
+ LayoutMendKind["Unpin"] = "unpin";
14526
+ /** …and when it cannot (a daring page needs its holds): its largest photo drifts — a slow scale as the hold plays. */
14527
+ LayoutMendKind["Drift"] = "drift";
14528
+ /** A shape with no purpose — not a rule, a band, a frame, a backdrop to words, and it does not move: it is dropped. */
14529
+ LayoutMendKind["Drop"] = "drop";
14530
+ /** A section that leaves a stretch of the laptop's screen with nothing on it: its height comes down (its rows keep
14531
+ * their share, the words still fit) until the stretch is gone. */
14532
+ LayoutMendKind["Screens"] = "screens";
14533
+ /** A daring or Expressive page whose opening has no display: the opening's lead line is set as one (a word). */
14534
+ LayoutMendKind["Display"] = "display";
14535
+ /** A list section's mix that breaks a list rule the composer can settle (list-ingredients §6, `checkList`): the layer
14536
+ * takes the repaired mix — every repair of one list carries the same one. */
14537
+ LayoutMendKind["List"] = "list";
14538
+ })(LayoutMendKind || (LayoutMendKind = {}));
14539
+ /** Which rule chose a mended gallery's list. */
14540
+ var LayoutSourceChoice;
14541
+ (function (LayoutSourceChoice) {
14542
+ /** The plan has exactly one list with pictures. */
14543
+ LayoutSourceChoice["Only"] = "only";
14544
+ /** Several: the first whose name or type the section's own words name. */
14545
+ LayoutSourceChoice["Intent"] = "intent";
14546
+ /** Several, none named: the first in plan order. */
14547
+ LayoutSourceChoice["Order"] = "order";
14548
+ })(LayoutSourceChoice || (LayoutSourceChoice = {}));
14549
+ // ── The tables the composer reads (the prototype renderer v4's values, `code/renderer-round4.src.html`) ──────────────
14550
+ /** A size as CSS — the prototype's `.s-*` rules. `screen` is computed per word (`screenFontSize`). */
14551
+ const LAYOUT_FONT_SIZE = {
14552
+ [LayoutSize.Xs]: '12px',
14553
+ [LayoutSize.S]: '15px',
14554
+ [LayoutSize.M]: '19px',
14555
+ [LayoutSize.L]: 'clamp(26px, 2.8vw, 44px)',
14556
+ [LayoutSize.Xl]: 'clamp(38px, 5vw, 82px)',
14557
+ [LayoutSize.Xxl]: 'clamp(54px, 8.5vw, 150px)',
14558
+ };
14559
+ /** A colour name as the look's token (what the prototype probed off the preset: `--iox-bg` … `--iox-text-muted`). */
14560
+ const LAYOUT_COLOUR_TOKEN = {
14561
+ [LayoutColour.Ground]: 'var(--iox-bg)',
14562
+ [LayoutColour.Ink]: 'var(--iox-text)',
14563
+ [LayoutColour.Accent]: 'var(--iox-accent)',
14564
+ [LayoutColour.Soft]: 'var(--iox-surface-2)',
14565
+ [LayoutColour.Muted]: 'var(--iox-text-muted)',
14566
+ };
14567
+ /** Words in the accent colour read the accent's text shade (round four: `accent-text`). */
14568
+ const LAYOUT_ACCENT_TEXT = 'var(--iox-accent-text)';
14569
+ /** Emil's easing tokens (never ease-in). */
14570
+ const LAYOUT_EASING = {
14571
+ [LayoutEase.Out]: 'cubic-bezier(0.23, 1, 0.32, 1)',
14572
+ [LayoutEase.InOut]: 'cubic-bezier(0.77, 0, 0.175, 1)',
14573
+ [LayoutEase.Drawer]: 'cubic-bezier(0.32, 0.72, 0, 1)',
14574
+ [LayoutEase.Linear]: 'linear',
14575
+ };
14576
+ /** How long an entrance takes, by the look's pace and the layer's role, and how far apart the beats are. */
14577
+ const LAYOUT_PACE = {
14578
+ [LayoutPace.Slow]: { lead: 1100, support: 900, decoration: 900, gap: 1.3 },
14579
+ [LayoutPace.Normal]: { lead: 800, support: 650, decoration: 600, gap: 1 },
14580
+ [LayoutPace.Quick]: { lead: 560, support: 460, decoration: 420, gap: 0.7 },
14581
+ };
14582
+ /** A stagger that shrinks as the beats go on, capped at the sixth — never a metronome. */
14583
+ const LAYOUT_BEAT_DELAY = [0, 120, 210, 275, 320, 350];
14584
+ /** How far a rise travels, by role (px). */
14585
+ const LAYOUT_RISE = {
14586
+ [LayoutRole.Lead]: 44,
14587
+ [LayoutRole.Support]: 22,
14588
+ [LayoutRole.Decoration]: 0,
14589
+ [LayoutRole.Static]: 0,
14590
+ };
14591
+ /** The kinds a visitor OPERATES: never moved for style (Emil gate 4). */
14592
+ const LAYOUT_OPERATED = new Set([LayoutLayerKind.Gallery, LayoutLayerKind.Button, LayoutLayerKind.Form, LayoutLayerKind.Marquee]);
14593
+ const LAYOUT_TEXT_KINDS = new Set([
14594
+ LayoutLayerKind.Word, LayoutLayerKind.Heading, LayoutLayerKind.Text, LayoutLayerKind.Label, LayoutLayerKind.Number, LayoutLayerKind.List,
14595
+ ]);
14596
+ /** The grid's gutter and column gap (the prototype's `--gutter` and `.grid`). */
14597
+ const LAYOUT_GUTTER = 'max(4vw, 16px)';
14598
+ const LAYOUT_COLUMN_GAP = '1.2vw';
14599
+ /** A depth's `params.phone`: scene-core `ParallaxPhone.Rest` — stacked on a phone, a layer never glides into its neighbour.
14600
+ * Stamped verbatim and read where it plays (not imported, as `PatternTrack`); compose-layout.spec holds the two equal. */
14601
+ const LAYOUT_DEPTH_ON_PHONE = 'rest';
14602
+ /** Below this opacity a layer counts as hidden: the static check's rule for an entrance or an exit that hides, and the
14603
+ * render check's for words a held section never shows together. */
14604
+ const LAYOUT_HIDDEN_OPACITY = 0.3;
14605
+ /**
14606
+ * The stretches of a held section's play (0..1) in which a layer's opacity tracks show it — above
14607
+ * `LAYOUT_HIDDEN_OPACITY`, each fade taken as linear. A layer with no opacity track shows throughout. Captions that take
14608
+ * turns in one cell (the live café's four, M8 gate 2 fix first part 3) never show together, so they never overlap.
14609
+ */
14610
+ function layerShownSpans(l) {
14611
+ const fades = (l.motion ?? []).filter(m => m.prop === LayoutTrackProp.Opacity && Array.isArray(m.at) && m.at[1] > m.at[0]).sort((a, b) => a.at[0] - b.at[0]);
14612
+ if (!fades.length)
14613
+ return [[0, 1]];
14614
+ const shows = (v) => v > LAYOUT_HIDDEN_OPACITY;
14615
+ const spans = [];
14616
+ let from = shows(fades[0].from) ? 0 : null;
14617
+ for (const m of fades) {
14618
+ if (shows(m.from) === shows(m.to))
14619
+ continue;
14620
+ const at = Math.round(Math.min(1, Math.max(0, m.at[0] + ((LAYOUT_HIDDEN_OPACITY - m.from) / (m.to - m.from)) * (m.at[1] - m.at[0]))) * 1000) / 1000;
14621
+ if (shows(m.to) && from === null)
14622
+ from = at;
14623
+ else if (!shows(m.to) && from !== null) {
14624
+ if (at > from)
14625
+ spans.push([from, at]);
14626
+ from = null;
14627
+ }
14117
14628
  }
14629
+ if (from !== null && from < 1)
14630
+ spans.push([from, 1]);
14631
+ return spans;
14118
14632
  }
14119
- function validateBusiness(c, business) {
14120
- if (!isPlainObject(business))
14121
- return c.add(SitePlanIssueCode.Shape, 'business', 'must be an object');
14122
- c.keys(business, BUSINESS_KEYS, 'business');
14123
- if (!isNonEmptyString(business['name']))
14124
- c.add(SitePlanIssueCode.MissingBusinessName, 'business.name', 'the business name is required');
14125
- if (business['tagline'] !== undefined && typeof business['tagline'] !== 'string')
14126
- c.add(SitePlanIssueCode.Shape, 'business.tagline', 'must be a string');
14127
- const facts = business['facts'];
14128
- if (facts === undefined)
14129
- return;
14130
- if (!isPlainObject(facts))
14131
- return c.add(SitePlanIssueCode.Shape, 'business.facts', 'must be an object');
14132
- for (const [key, value] of Object.entries(facts)) {
14133
- if (!FACT_KEYS.includes(key))
14134
- c.add(SitePlanIssueCode.UnknownFact, `business.facts.${key}`, `"${key}" is not a fact (${FACT_KEYS.join(', ')})`);
14135
- else if (typeof value !== 'string')
14136
- c.add(SitePlanIssueCode.Shape, `business.facts.${key}`, 'must be a string');
14137
- }
14633
+ /** Whether two layers' shown stretches meet for any length (no spans: shown throughout). */
14634
+ function shownTogether(a, b) {
14635
+ const A = a ?? [[0, 1]], B = b ?? [[0, 1]];
14636
+ return A.some(([a0, a1]) => B.some(([b0, b1]) => Math.min(a1, b1) > Math.max(a0, b0)));
14138
14637
  }
14139
- function validateLocale(c, locale) {
14140
- if (locale !== undefined && (typeof locale !== 'string' || !has$1(SITE_LOCALES, locale))) {
14141
- c.add(SitePlanIssueCode.InvalidLocale, 'locale', `must be one of ${Object.keys(SITE_LOCALES).join(', ')}`);
14142
- }
14638
+ /** A control's tooltip words: the main entry's `A11yTrait.Tooltip` (premium M5), held equal by compose-layout.spec. */
14639
+ const LAYOUT_TOOLTIP_TRAIT = 'tooltip';
14640
+ /** The phone: at or under this breakpoint a section stacks in its `phone` order (the `mobile` breakpoint, ≤ 767px). */
14641
+ const LAYOUT_PHONE_BREAKPOINT = 'mobile';
14642
+ /** A phone section's padding above and below (M1.3: 56). */
14643
+ const LAYOUT_PHONE_PADDING = '56px';
14644
+ /** The kind of layer, for the phone's rhythm: the space between two stacked layers says how they belong (M1.3). */
14645
+ function phoneGapBefore(prev, next) {
14646
+ if (!prev)
14647
+ return 0;
14648
+ const k = (l) => l.kind;
14649
+ if (k(prev) === LayoutLayerKind.Photo || k(prev) === LayoutLayerKind.Gallery || k(next) === LayoutLayerKind.Photo || k(next) === LayoutLayerKind.Gallery)
14650
+ return 32;
14651
+ if (k(next) === LayoutLayerKind.Button || k(next) === LayoutLayerKind.Form)
14652
+ return 28;
14653
+ if (k(prev) === LayoutLayerKind.Label || (k(prev) === LayoutLayerKind.Number && k(next) === LayoutLayerKind.Heading))
14654
+ return 10;
14655
+ if ((k(prev) === LayoutLayerKind.Heading && (k(next) === LayoutLayerKind.Text || k(next) === LayoutLayerKind.List)) || (k(prev) === LayoutLayerKind.Text && k(next) === LayoutLayerKind.Text))
14656
+ return 14;
14657
+ return 20;
14143
14658
  }
14144
- function validateDesign(c, design) {
14145
- if (!isPlainObject(design))
14146
- return c.add(SitePlanIssueCode.Shape, 'design', 'must be an object');
14147
- c.keys(design, DESIGN_KEYS, 'design');
14148
- for (const key of DESIGN_REQUIRED)
14149
- if (design[key] === undefined)
14150
- c.add(SitePlanIssueCode.Shape, `design.${key}`, 'is required');
14151
- const pack = flavorPackById(typeof design['flavorId'] === 'string' ? design['flavorId'] : null);
14152
- if (design['flavorId'] !== undefined && (!pack || pack.id !== design['flavorId'])) {
14153
- c.add(SitePlanIssueCode.UnknownFlavor, 'design.flavorId', `"${String(design['flavorId'])}" is not a flavor`);
14154
- }
14155
- const bad = (key, why) => c.add(SitePlanIssueCode.InvalidDesign, `design.${key}`, why);
14156
- if (design['seed'] !== undefined && (typeof design['seed'] !== 'string' || !parseHexColor(design['seed'])))
14157
- bad('seed', 'must be a #rrggbb colour');
14158
- if (design['pairId'] !== undefined && pack && !pack.pairs.some(p => p.id === design['pairId']))
14159
- bad('pairId', `is not a font pairing of ${pack.id}`);
14160
- const axis = (key, table) => {
14161
- if (design[key] !== undefined && (typeof design[key] !== 'string' || !has$1(table, design[key])))
14162
- bad(key, `must be one of ${Object.keys(table).join(', ')}`);
14163
- };
14164
- axis('shape', SPEC_AXES.shapes);
14165
- axis('density', SPEC_AXES.densities);
14166
- axis('motion', SPEC_AXES.motions);
14167
- axis('tint', SPEC_AXES.tints);
14168
- axis('scroll', SPEC_AXES.scrolls);
14169
- axis('animate', SPEC_AXES.animations);
14170
- axis('between', SPEC_AXES.betweens);
14171
- if (design['mode'] !== undefined && !SPEC_AXES.modes.includes(design['mode']))
14172
- bad('mode', `must be one of ${SPEC_AXES.modes.join(', ')}`);
14173
- if (design['pillButtons'] !== undefined && typeof design['pillButtons'] !== 'boolean')
14174
- bad('pillButtons', 'must be a boolean');
14175
- if (design['fonts'] !== undefined && !isPlainObject(design['fonts']))
14176
- bad('fonts', 'must be an object');
14659
+ /** The grid a laptop page is laid on, in vw: its width inside the gutters (`LAYOUT_GUTTER` 4vw a side), the gap between
14660
+ * columns (`LAYOUT_COLUMN_GAP`), and 12 columns. */
14661
+ const GRID_VW = 92;
14662
+ const COLUMN_GAP_VW = 1.2;
14663
+ const GRID_COLUMNS$1 = 12;
14664
+ /** A `screen` word's smallest and largest size (px), and the share of its room it fills (the renderer's margin). */
14665
+ const LAYOUT_SCREEN_PX = [36, 560];
14666
+ const SCREEN_FILL = 0.98;
14667
+ const round2 = (n) => Math.round(n * 100) / 100;
14668
+ /** How wide `cols` columns of the laptop grid stand, in vw (12 columns: 92vw). */
14669
+ function layoutColumnsVw(cols) {
14670
+ const column = (GRID_VW - (GRID_COLUMNS$1 - 1) * COLUMN_GAP_VW) / GRID_COLUMNS$1;
14671
+ return cols * column + Math.max(0, cols - 1) * COLUMN_GAP_VW;
14177
14672
  }
14178
- function validateContentTypes(c, list) {
14179
- const types = new Map();
14180
- list.forEach((raw, i) => {
14181
- const path = `contentTypes[${i}]`;
14182
- if (!isPlainObject(raw))
14183
- return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
14184
- c.keys(raw, CONTENT_TYPE_KEYS, path);
14185
- const name = c.string(raw, 'name', path);
14186
- c.string(raw, 'label', path);
14187
- const fields = c.array(raw, 'fields', path);
14188
- const names = fields.map((f, j) => {
14189
- const fp = `${path}.fields[${j}]`;
14190
- if (!isPlainObject(f)) {
14191
- c.add(SitePlanIssueCode.Shape, fp, 'must be an object');
14192
- return null;
14193
- }
14194
- c.keys(f, FIELD_KEYS, fp);
14195
- const control = c.string(f, 'controller', fp);
14196
- const stored = c.string(f, 'type', fp);
14197
- const expected = control ? FIELD_TYPE_OF_CONTROL[control] : undefined;
14198
- if (control && !expected)
14199
- c.add(SitePlanIssueCode.Shape, `${fp}.controller`, `"${control}" is not a field control (${Object.values(ContentFieldControl).join(', ')})`);
14200
- if (expected && stored && stored !== expected)
14201
- c.add(SitePlanIssueCode.Shape, `${fp}.type`, `a ${control} field is stored as ${expected}, not "${stored}"`);
14202
- c.boolean(f, 'required', fp);
14203
- return c.string(f, 'name', fp);
14204
- });
14205
- c.unique(names, j => `${path}.fields[${j}].name`, 'field');
14206
- const fieldSet = new Set(names.filter((n) => !!n));
14207
- const fieldTypes = new Map(fields.filter(isPlainObject).map(f => [f['name'], f['type']]));
14208
- const roles = validateRoles(c, raw['roles'], `${path}.roles`, name, fieldSet, fieldTypes);
14209
- const seed = raw['seed'];
14210
- if (seed !== undefined) {
14211
- if (!isPlainObject(seed))
14212
- c.add(SitePlanIssueCode.Shape, `${path}.seed`, 'must be an object');
14213
- else {
14214
- if (!Number.isInteger(seed['count']) || seed['count'] < 0)
14215
- c.add(SitePlanIssueCode.Shape, `${path}.seed.count`, 'must be a whole number');
14216
- for (const key of ['sample', 'isPublished'])
14217
- if (typeof seed[key] !== 'boolean')
14218
- c.add(SitePlanIssueCode.Shape, `${path}.seed.${key}`, 'must be a boolean');
14219
- const perItem = seed['perItem'];
14220
- if (perItem !== undefined) {
14221
- if (!isPlainObject(perItem))
14222
- c.add(SitePlanIssueCode.Shape, `${path}.seed.perItem`, 'must be an object');
14223
- else
14224
- for (const [field, list] of Object.entries(perItem)) {
14225
- const at = `${path}.seed.perItem.${field}`;
14226
- if (!fieldSet.has(field))
14227
- c.add(SitePlanIssueCode.UnknownField, at, `"${field}" is not a field of ${name}`);
14228
- else if (!Array.isArray(list) || list.length !== seed['count'] || list.some(v => typeof v !== 'string'))
14229
- c.add(SitePlanIssueCode.Shape, at, `must be ${String(seed['count'])} strings, one per sample`);
14230
- else if (field === SLUG_FIELD && new Set(list).size !== list.length)
14231
- c.add(SitePlanIssueCode.Shape, at, 'each sample needs its own slug');
14232
- }
14233
- }
14234
- for (const key of Object.keys(seed)) {
14235
- if (!SEED_FIXED_KEYS.includes(key) && !fieldSet.has(key))
14236
- c.add(SitePlanIssueCode.UnknownField, `${path}.seed.${key}`, `"${key}" is not a field of ${name}`);
14237
- }
14238
- }
14239
- }
14240
- if (name && types.has(name))
14241
- c.add(SitePlanIssueCode.Duplicate, `${path}.name`, `content type "${name}" is used twice`);
14242
- else if (name)
14243
- types.set(name, { fields: fieldSet, described: fields.filter(isPlainObject).map(describeField), roles });
14244
- });
14245
- return types;
14673
+ /** The room a layer of `cols` columns has on a screen `width` px wide, in px — a phone stacks every layer full width
14674
+ * inside its gutters (`max(4vw, 16px)` a side). */
14675
+ function layoutRoomPx(cols, width, phone) {
14676
+ return phone ? width - 2 * Math.max(0.04 * width, 16) : (layoutColumnsVw(cols) * width) / 100;
14246
14677
  }
14247
- const describeField = (f) => ({ name: String(f['name']), type: typeof f['type'] === 'string' ? f['type'] : undefined, controller: typeof f['controller'] === 'string' ? f['controller'] : undefined });
14248
- /** A content type's roles (L0-3): known roles only, each played by a field of the type; `title` always; `gallery` a list. */
14249
- function validateRoles(c, roles, path, typeName, fields, fieldTypes) {
14250
- if (!isPlainObject(roles)) {
14251
- c.add(SitePlanIssueCode.Shape, path, 'must be an object (which field plays each role)');
14252
- return {};
14253
- }
14254
- const out = {};
14255
- for (const [role, field] of Object.entries(roles)) {
14256
- if (!ROLE_KEYS$1.includes(role)) {
14257
- c.add(SitePlanIssueCode.UnknownRole, `${path}.${role}`, `"${role}" is not a role (${ROLE_KEYS$1.join(', ')})`);
14258
- continue;
14259
- }
14260
- if (typeof field !== 'string' || !fields.has(field)) {
14261
- c.add(SitePlanIssueCode.UnknownRole, `${path}.${role}`, `"${String(field)}" is not a field of ${typeName}`);
14262
- continue;
14263
- }
14264
- if (role === 'gallery' && fieldTypes.get(field) !== ARRAY_TYPE) {
14265
- c.add(SitePlanIssueCode.UnknownRole, `${path}.${role}`, `"${field}" is not a list field — a gallery is a list of pictures`);
14678
+ /**
14679
+ * A `screen` word's size (iox-ui#46): the word fills its columns' width — `widthEm` is how wide it stands at 1em in its
14680
+ * own face (design-core `textWidthEm`, from the face's measured letters) — and never stands taller than its rows; never
14681
+ * under 36px or over 560px. `rows` 0 sizes by width alone (a phone's stacked word). Held sections are one screen tall.
14682
+ */
14683
+ function screenFontSize(widthEm, cols, rows, sectionRows, screens) {
14684
+ const [min, max] = LAYOUT_SCREEN_PX;
14685
+ const widthVw = round2((layoutColumnsVw(cols) / Math.max(widthEm, 0.01)) * SCREEN_FILL);
14686
+ if (!rows || !sectionRows)
14687
+ return `clamp(${min}px, ${widthVw}vw, ${max}px)`;
14688
+ const heightSvh = round2((((rows / sectionRows) * screens * 100) / 0.92) * SCREEN_FILL);
14689
+ return `clamp(${min}px, min(${widthVw}vw, ${heightSvh}svh), ${max}px)`;
14690
+ }
14691
+ /** How many px a `screen` word `widthEm` wide runs past its room at its smallest size, on a screen `width` px wide — 0
14692
+ * when it fits. The one thing sizing cannot mend: the static check refuses it (a browser would show it cut). */
14693
+ function screenWordOverflowPx(widthEm, cols, width, phone) {
14694
+ return Math.max(0, Math.round(LAYOUT_SCREEN_PX[0] * widthEm - layoutRoomPx(cols, width, phone)));
14695
+ }
14696
+
14697
+ /**
14698
+ * FOOTER INGREDIENTS (list-ingredients-plan.md LI5): a site's footer is a MIX — an arrangement, the blocks it holds, how
14699
+ * it closes and what it stands on — never one of three footer patterns. Every word, its meaning, the named mixes stored
14700
+ * plans use, the fingerprint and Doron's references live in ONE table, the contract's `site.layout.footer` (layout.mjs
14701
+ * `FOOTER`); the parts a footer is made of are the contract's `site.footerParts`. This module reads both: it checks a
14702
+ * mix (`checkFooter`) and arranges the parts (`footerPattern`) into an ordinary pattern the composer stamps — the same
14703
+ * stamper, the same nodes as every section, on the canvas and both engine paths. Pure.
14704
+ */
14705
+ const F = SPEC_SITE_LAYOUT.footer;
14706
+ const PARTS$1 = SPEC_SITE_FOOTER_PARTS;
14707
+ /** The ingredients, by the contract's keys (held equal to it by footer-mix.spec). */
14708
+ var FooterIngredient;
14709
+ (function (FooterIngredient) {
14710
+ FooterIngredient["Arrange"] = "arrange";
14711
+ FooterIngredient["Holds"] = "holds";
14712
+ FooterIngredient["Closing"] = "closing";
14713
+ FooterIngredient["Ground"] = "ground";
14714
+ })(FooterIngredient || (FooterIngredient = {}));
14715
+ var FooterArrange;
14716
+ (function (FooterArrange) {
14717
+ FooterArrange["Columns"] = "columns";
14718
+ FooterArrange["Centred"] = "centred";
14719
+ FooterArrange["Line"] = "line";
14720
+ })(FooterArrange || (FooterArrange = {}));
14721
+ var FooterHold;
14722
+ (function (FooterHold) {
14723
+ FooterHold["Pages"] = "pages";
14724
+ FooterHold["Visit"] = "visit";
14725
+ FooterHold["Contact"] = "contact";
14726
+ })(FooterHold || (FooterHold = {}));
14727
+ var FooterClosing;
14728
+ (function (FooterClosing) {
14729
+ FooterClosing["None"] = "none";
14730
+ FooterClosing["Call"] = "call";
14731
+ FooterClosing["Name"] = "name";
14732
+ })(FooterClosing || (FooterClosing = {}));
14733
+ var FooterGround;
14734
+ (function (FooterGround) {
14735
+ FooterGround["Inverse"] = "inverse";
14736
+ FooterGround["Plain"] = "plain";
14737
+ FooterGround["Subtle"] = "subtle";
14738
+ FooterGround["Accent"] = "accent";
14739
+ })(FooterGround || (FooterGround = {}));
14740
+ class FooterMixError extends Error {
14741
+ }
14742
+ const INGREDIENTS$1 = F.ingredients;
14743
+ const MEANINGS$2 = F.meanings;
14744
+ const MANY = F.many;
14745
+ /** The footer pattern a plan names when it names none the table knows (the Studio footer). */
14746
+ const DEFAULT_FOOTER_PATTERN = 'footer.three-column';
14747
+ /** The words an ingredient may take. */
14748
+ function footerWords(ingredient) {
14749
+ return INGREDIENTS$1[ingredient] ?? [];
14750
+ }
14751
+ /** What a word means, as the brief and the builder say it. */
14752
+ function footerMeaning(ingredient, word) {
14753
+ return MEANINGS$2[`${ingredient}.${word}`] ?? word;
14754
+ }
14755
+ /** A word list in the table's order, each once. */
14756
+ const inOrder = (k, words) => footerWords(k).filter(w => words.includes(w));
14757
+ /** A whole mix from part of one: what is not named is the default. Refuses a word the table lacks. */
14758
+ function footerMix(partial = {}) {
14759
+ const mix = { ...F.defaults };
14760
+ for (const [k, v] of Object.entries(partial)) {
14761
+ if (v === undefined)
14266
14762
  continue;
14267
- }
14268
- out[role] = field;
14763
+ if (!INGREDIENTS$1[k])
14764
+ throw new FooterMixError(`no footer ingredient "${k}"`);
14765
+ const words = typeof v === 'string' ? [v] : v;
14766
+ if (MANY.includes(k) !== (typeof v !== 'string'))
14767
+ throw new FooterMixError(`a footer's ${k} is ${MANY.includes(k) ? 'a list of words' : 'one word'}`);
14768
+ for (const w of words)
14769
+ if (!INGREDIENTS$1[k].includes(w))
14770
+ throw new FooterMixError(`a footer's ${k} cannot be "${w}" (${INGREDIENTS$1[k].join(' · ')})`);
14771
+ mix[k] = MANY.includes(k) ? inOrder(k, words) : words[0];
14269
14772
  }
14270
- for (const role of REQUIRED_CONTENT_ROLES)
14271
- if (!out[role] && !has$1(roles, role))
14272
- c.add(SitePlanIssueCode.MissingRole, `${path}.${role}`, `every content type names its ${role} field`);
14273
- return out;
14773
+ return mix;
14274
14774
  }
14275
- /** A source a page may read ONE item from by its route (`routeSource`), or bind a list to — a cms one or the shop's. */
14276
- const isItemSource = (s) => !!s && (s.type === PlanDataSourceType.Cms || s.type === PlanDataSourceType.Shop) && s.mode === PlanDataSourceMode.Single;
14277
- const isListSource = (s) => !!s && (s.type === PlanDataSourceType.Cms || s.type === PlanDataSourceType.Shop) && s.mode === PlanDataSourceMode.Query;
14278
- function validateDataSources(c, list, types) {
14279
- const sources = new Map();
14280
- list.forEach((raw, i) => {
14281
- const path = `dataSources[${i}]`;
14282
- if (!isPlainObject(raw))
14283
- return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
14284
- const alias = c.string(raw, 'alias', path);
14285
- if (alias && alias.startsWith(RESERVED_PREFIX)) {
14286
- c.add(SitePlanIssueCode.ReservedAlias, `${path}.alias`, `"${alias}" is reserved for the platform`);
14287
- }
14288
- if (raw['type'] === PlanDataSourceType.Cms) {
14289
- c.keys(raw, CMS_SOURCE_KEYS, path);
14290
- const mode = raw['mode'];
14291
- if (mode !== PlanDataSourceMode.Query && mode !== PlanDataSourceMode.Single)
14292
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.mode`, `must be "${PlanDataSourceMode.Query}" or "${PlanDataSourceMode.Single}"`);
14293
- const contentType = c.string(raw, 'contentType', path);
14294
- const type = contentType ? types.get(contentType) : undefined;
14295
- if (contentType && !type)
14296
- c.add(SitePlanIssueCode.UnknownContentType, `${path}.contentType`, `no content type "${contentType}" in the plan`);
14297
- if (raw['limit'] !== undefined && (!Number.isInteger(raw['limit']) || raw['limit'] < 1))
14298
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.limit`, 'must be a positive whole number');
14299
- let routeParam;
14300
- const byRoute = raw['filterByRouteParam'];
14301
- if (byRoute !== undefined) {
14302
- if (!isPlainObject(byRoute))
14303
- c.add(SitePlanIssueCode.Shape, `${path}.filterByRouteParam`, 'must be an object');
14304
- else {
14305
- c.keys(byRoute, ['field', 'routeParam'], `${path}.filterByRouteParam`);
14306
- const field = c.string(byRoute, 'field', `${path}.filterByRouteParam`);
14307
- routeParam = c.string(byRoute, 'routeParam', `${path}.filterByRouteParam`) ?? undefined;
14308
- if (field && type && field !== ID_FIELD && !type.fields.has(field))
14309
- c.add(SitePlanIssueCode.UnknownField, `${path}.filterByRouteParam.field`, `"${field}" is not a field of ${contentType}`);
14310
- if (mode !== PlanDataSourceMode.Single)
14311
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam`, 'only a single source is looked up by a route param');
14312
- }
14313
- }
14314
- if (alias && !sources.has(alias))
14315
- sources.set(alias, { type: PlanDataSourceType.Cms, mode: mode, contentType: contentType ?? undefined, routeParam });
14316
- }
14317
- else if (raw['type'] === PlanDataSourceType.Relative) {
14318
- c.keys(raw, RELATIVE_SOURCE_KEYS, path);
14319
- c.string(raw, 'of', path);
14320
- c.string(raw, 'within', path);
14321
- if (!Object.values(RelativeOp).includes(raw['op']))
14322
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.op`, `must be one of ${Object.values(RelativeOp).join(', ')}`);
14323
- if (alias && !sources.has(alias))
14324
- sources.set(alias, { type: PlanDataSourceType.Relative, of: raw['of'], op: raw['op'] });
14775
+ /** The mix a stored footer pattern id stands for (`footer.three-column`, `footer.mega`, `footer.minimal`), or null. */
14776
+ function namedFooterMix(patternId) {
14777
+ const named = F.named[patternId];
14778
+ return named ? footerMix(named) : null;
14779
+ }
14780
+ /** The stored footer pattern a mix is exactly, else null. */
14781
+ function footerPatternIdOf(mix) {
14782
+ const key = footerTokenOf(mix) + JSON.stringify(mix.holds);
14783
+ return Object.keys(F.named).find(id => {
14784
+ const m = namedFooterMix(id);
14785
+ return footerTokenOf(m) + JSON.stringify(m.holds) === key;
14786
+ }) ?? null;
14787
+ }
14788
+ /** A mix on the wire: ONE list of `<ingredient>:<word>` words (the list wire's encoding), `holds` once per block. */
14789
+ function footerMixWords(mix) {
14790
+ return Object.values(FooterIngredient).flatMap(k => (MANY.includes(k) ? mix[k] : [mix[k]]).map(w => `${k}:${w}`));
14791
+ }
14792
+ /** Every `<ingredient>:<word>` the wire may carry (every footer word is drawn — the table's `waits` is empty). */
14793
+ function footerWireWords() {
14794
+ return Object.values(FooterIngredient).flatMap(k => footerWords(k).filter(w => !F.waits[`${k}.${w}`]).map(w => `${k}:${w}`));
14795
+ }
14796
+ /** The words back into a mix: an ingredient not named is the default; a `holds` named is the whole list. Refuses an unknown
14797
+ * word, and two words for a one-word ingredient. */
14798
+ function footerMixFromWords(words) {
14799
+ const partial = {};
14800
+ for (const pair of words) {
14801
+ const [k, w] = String(pair).split(':');
14802
+ if (!INGREDIENTS$1[k] || !w)
14803
+ throw new FooterMixError(`"${pair}" is no footer word (<ingredient>:<word>)`);
14804
+ if (MANY.includes(k))
14805
+ (partial[k] ??= []).push(w);
14806
+ else if (partial[k] !== undefined && partial[k] !== w)
14807
+ throw new FooterMixError(`a footer has one ${k} ("${partial[k]}" and "${w}")`);
14808
+ else
14809
+ partial[k] = w;
14810
+ }
14811
+ return footerMix(partial);
14812
+ }
14813
+ /** The site plan's footer as a mix: its `mixes.footer` when it has one, else its `globals.footer` pattern read as a named
14814
+ * mix, else the Studio footer. */
14815
+ function footerMixOfPlan(plan) {
14816
+ if (plan.mixes?.footer?.length)
14817
+ return footerMixFromWords(plan.mixes.footer);
14818
+ return namedFooterMix(plan.globals?.['footer'] ?? '') ?? footerMix();
14819
+ }
14820
+ /** The fingerprint's prefix for a footer. */
14821
+ const FOOTER_TOKEN = 'footer';
14822
+ /** A footer as the fingerprint sees it: `footer:<arrange>/<closing>/<ground>` — what a visitor takes in at once, in the
14823
+ * contract's order. Two sites with the same token wear the same footer. */
14824
+ function footerTokenOf(mix) {
14825
+ return `${FOOTER_TOKEN}:${F.fingerprint.map(k => mix[k]).join('/')}`;
14826
+ }
14827
+ /** A footer token in words: `footer:columns/none/inverse` → "columns · none · inverse". */
14828
+ const footerTokenWords = (token) => token.replace(`${FOOTER_TOKEN}:`, '').split('/').join(' · ');
14829
+ /** Doron's reference footers, each as a whole mix. */
14830
+ function footerReferences() {
14831
+ return F.references
14832
+ .map(r => ({ id: r.id, after: r.after, added: r.added, mix: footerMix(r.mix) }));
14833
+ }
14834
+ // ── The check: any mix, judged and mended ──────────────────────────────────────────────────────────────────────────
14835
+ var FooterRepairCode;
14836
+ (function (FooterRepairCode) {
14837
+ /** A one-line footer holds only the pages: the other blocks need room. */
14838
+ FooterRepairCode["LineHolds"] = "line-holds";
14839
+ /** A footer that holds nothing and closes with nothing: it holds the pages. */
14840
+ FooterRepairCode["Empty"] = "empty";
14841
+ /** The name is too long to stand across a phone's width at the smallest size: no closing name. */
14842
+ FooterRepairCode["NameTooLong"] = "name-too-long";
14843
+ /** Another site already wears this footer: the nearest free one (`distinctFooter`). */
14844
+ FooterRepairCode["Worn"] = "worn";
14845
+ })(FooterRepairCode || (FooterRepairCode = {}));
14846
+ /** The phone the closing name must fit (the render check's). */
14847
+ const PHONE_WIDTH = 390;
14848
+ /** How wide the name stands at 1em in the look's display face. */
14849
+ const nameWidthEm = (ctx) => textWidthEm(ctx.name, elementStyleFace(ctx.design, 'display'));
14850
+ /**
14851
+ * The ONE judge of a footer mix: what the table's rules refuse is mended to the nearest mix that keeps them, and each mend
14852
+ * is said. Never throws on a well-formed mix. Pure.
14853
+ */
14854
+ function checkFooter(mix, ctx) {
14855
+ const repairs = [];
14856
+ let holds = inOrder(FooterIngredient.Holds, mix.holds);
14857
+ let closing = mix.closing;
14858
+ if (mix.arrange === FooterArrange.Line) {
14859
+ const kept = holds.filter(h => F.rules.lineHolds.includes(h));
14860
+ const left = holds.filter(h => !kept.includes(h));
14861
+ if (left.length)
14862
+ repairs.push({ code: FooterRepairCode.LineHolds, said: `a one-line footer holds only ${F.rules.lineHolds.join(' and ')}: ${left.join(' and ')} left out` });
14863
+ holds = kept;
14864
+ }
14865
+ if (closing === FooterClosing.Name && screenWordOverflowPx(nameWidthEm(ctx), 12, PHONE_WIDTH, true) > 0) {
14866
+ repairs.push({ code: FooterRepairCode.NameTooLong, said: `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing` });
14867
+ closing = FooterClosing.None;
14868
+ }
14869
+ if (holds.length < F.rules.minHolds && closing === FooterClosing.None) {
14870
+ repairs.push({ code: FooterRepairCode.Empty, said: 'a footer that holds nothing holds the pages' });
14871
+ holds = [FooterHold.Pages];
14872
+ }
14873
+ return { mix: { ...mix, holds, closing }, repairs };
14874
+ }
14875
+ // ── The recipe: the mix arranged from the contract's parts ─────────────────────────────────────────────────────────
14876
+ const clone$3 = (v) => JSON.parse(JSON.stringify(v));
14877
+ const part$1 = (id) => clone$3(PARTS$1[id]);
14878
+ /** A part with more layout, its own kept. */
14879
+ const laid = (node, lay) => ({ ...node, lay: { ...(node.lay ?? {}), ...lay } });
14880
+ const GAP = 'var(--iox-space-gap)';
14881
+ const CENTRED = { alignItems: 'center', textAlign: 'center' };
14882
+ /** The columns of a footer's grid: the name's block wider, one column per block it holds. */
14883
+ function columnsOf(count) {
14884
+ const lay = { display: 'grid', gridTemplateColumns: ['2fr', ...Array.from({ length: count }, () => '1fr')].join(' '), gap: GAP };
14885
+ const resp = count >= 3
14886
+ ? { tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }
14887
+ : { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } };
14888
+ return { lay, resp };
14889
+ }
14890
+ /** The closing name: the business name across the width — fitted to the name in the look's display face as a layout's
14891
+ * screen word is (`screenFontSize`, the 12-column room), never under the smallest or over the largest screen word. */
14892
+ function closingName(ctx) {
14893
+ return laid(part$1('name'), { fontSize: screenFontSize(nameWidthEm(ctx), 12, 0, 0, 0) });
14894
+ }
14895
+ /** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
14896
+ function holdPart(hold, mix) {
14897
+ const node = part$1(hold);
14898
+ if (hold !== FooterHold.Contact || !mix.holds.includes(FooterHold.Visit))
14899
+ return node;
14900
+ return { ...node, c: (node.c ?? []).filter(n => n.ph !== 'city') };
14901
+ }
14902
+ /** The body: the blocks it holds, arranged. */
14903
+ function bodyOf(mix) {
14904
+ const holds = mix.holds.map(h => holdPart(h, mix));
14905
+ switch (mix.arrange) {
14906
+ case FooterArrange.Line: {
14907
+ const row = { t: 'Container', es: 'box', lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'space-between', gap: GAP }, c: [
14908
+ laid(part$1('copyright'), { width: 'auto' }),
14909
+ ...(mix.holds.includes(FooterHold.Pages) ? [part$1('pageRow')] : []),
14910
+ ] };
14911
+ return [row];
14325
14912
  }
14326
- else if (raw['type'] === PlanDataSourceType.Shop) {
14327
- const routeParam = validateShopSource(c, raw, path);
14328
- if (alias && !sources.has(alias))
14329
- sources.set(alias, { type: PlanDataSourceType.Shop, mode: raw['mode'], contentType: raw['resource'], routeParam });
14913
+ case FooterArrange.Centred: {
14914
+ const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part$1('pageRow'), { justifyContent: 'center' }) : laid(holdPart(h, mix), CENTRED)));
14915
+ return [
14916
+ { t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [laid(part$1('brand'), CENTRED), ...blocks] },
14917
+ part$1('rule'),
14918
+ laid(part$1('copyright'), { textAlign: 'center' }),
14919
+ ];
14330
14920
  }
14331
- else {
14332
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.type`, `must be one of ${Object.values(PlanDataSourceType).map(t => `"${t}"`).join(', ')}`);
14921
+ default:
14922
+ return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [part$1('brand'), ...holds] }, part$1('rule'), part$1('copyright')];
14923
+ }
14924
+ }
14925
+ /** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
14926
+ function footerPattern(mix, ctx) {
14927
+ const plain = mix.ground === FooterGround.Plain;
14928
+ const call = mix.closing === FooterClosing.Call ? [mix.arrange === FooterArrange.Columns ? part$1('call') : laid(part$1('call'), CENTRED)] : [];
14929
+ const name = mix.closing === FooterClosing.Name ? [closingName(ctx)] : [];
14930
+ const c = [...(plain ? [part$1('rule')] : []), ...call, ...bodyOf(mix), ...name];
14931
+ // The contract's shell; a Section with one child does not stack it (the patterns' rule, build-spec "more than one child").
14932
+ const { lay, ...shell } = part$1('section');
14933
+ const node = { ...shell, ...(c.length > 1 && lay ? { lay } : {}), ...(plain ? {} : { scheme: mix.ground }), c };
14934
+ // A stored footer keeps its own name and intent (the composed root is labelled with it).
14935
+ const stored = SITE_PATTERNS[footerPatternIdOf(mix) ?? ''];
14936
+ return {
14937
+ family: 'footer',
14938
+ label: stored?.label ?? `Footer — ${footerTokenWords(footerTokenOf(mix))}`,
14939
+ intent: stored?.intent ?? [footerMeaning(FooterIngredient.Arrange, mix.arrange), footerMeaning(FooterIngredient.Closing, mix.closing), footerMeaning(FooterIngredient.Ground, mix.ground)].join('; '),
14940
+ global: PatternGlobalPosition.After,
14941
+ node,
14942
+ };
14943
+ }
14944
+ // ── No sameness: another site's footer is never worn again ─────────────────────────────────────────────────────────
14945
+ /** The ingredients `distinctFooter` may change, in the order it tries them: how it closes and what it stands on before the
14946
+ * arrangement the model chose. */
14947
+ const MEND_ORDER = [
14948
+ FooterIngredient.Closing, FooterIngredient.Ground, FooterIngredient.Arrange,
14949
+ ];
14950
+ /**
14951
+ * A footer no other site wears (R-H10): the mix when its token is free, else the nearest mix whose token is — one changed
14952
+ * ingredient before two, in `MEND_ORDER`, each word in the table's order — checked again (`checkFooter`), and said. When
14953
+ * every footer is worn, the mix as it is. Pure, deterministic.
14954
+ */
14955
+ function distinctFooter(mix, taken, ctx) {
14956
+ const used = new Set(taken);
14957
+ if (!used.has(footerTokenOf(mix)))
14958
+ return { mix, repairs: [] };
14959
+ const tries = [];
14960
+ for (const k of MEND_ORDER)
14961
+ for (const w of footerWords(k))
14962
+ tries.push({ ...mix, [k]: w });
14963
+ for (const [i, a] of MEND_ORDER.entries())
14964
+ for (const b of MEND_ORDER.slice(i + 1)) {
14965
+ for (const wa of footerWords(a))
14966
+ for (const wb of footerWords(b))
14967
+ tries.push({ ...mix, [a]: wa, [b]: wb });
14333
14968
  }
14334
- });
14335
- c.unique(list.map(r => (isPlainObject(r) && isNonEmptyString(r['alias']) ? r['alias'] : null)), i => `dataSources[${i}].alias`, 'alias');
14336
- // A relative source locates its subject (a single item) within a collection of the SAME type.
14337
- list.forEach((raw, i) => {
14338
- if (!isPlainObject(raw) || raw['type'] !== PlanDataSourceType.Relative)
14339
- return;
14340
- const of = sources.get(raw['of']);
14341
- const within = sources.get(raw['within']);
14342
- if (!of || of.type !== PlanDataSourceType.Cms || of.mode !== PlanDataSourceMode.Single)
14343
- c.add(SitePlanIssueCode.UnknownDataSource, `dataSources[${i}].of`, 'must name a single cms source of the plan');
14344
- if (!within || within.type !== PlanDataSourceType.Cms || within.mode !== PlanDataSourceMode.Query)
14345
- c.add(SitePlanIssueCode.UnknownDataSource, `dataSources[${i}].within`, 'must name a list (query) cms source of the plan');
14346
- if (of?.contentType && within?.contentType && of.contentType !== within.contentType)
14347
- c.add(SitePlanIssueCode.InvalidDataSource, `dataSources[${i}]`, `${raw['of']} and ${raw['within']} are different content types`);
14348
- });
14349
- return sources;
14969
+ for (const t of tries) {
14970
+ const checked = checkFooter(t, ctx);
14971
+ if (checked.repairs.length || used.has(footerTokenOf(checked.mix)))
14972
+ continue;
14973
+ return { mix: checked.mix, repairs: [{ code: FooterRepairCode.Worn, said: `another site wears ${footerTokenWords(footerTokenOf(mix))}: this one is ${footerTokenWords(footerTokenOf(checked.mix))}` }] };
14974
+ }
14975
+ return { mix, repairs: [] };
14350
14976
  }
14351
- /** A shop source (derived — `derivedShopSources` — so a bad one is the plan's own writing): a list of the shop or one row of
14352
- * it by its slug. Returns the route param it is looked up by. */
14353
- function validateShopSource(c, raw, path) {
14354
- c.keys(raw, SHOP_SOURCE_KEYS, path);
14355
- const mode = raw['mode'];
14356
- if (mode !== PlanDataSourceMode.Query && mode !== PlanDataSourceMode.Single)
14357
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.mode`, `must be "${PlanDataSourceMode.Query}" or "${PlanDataSourceMode.Single}"`);
14358
- if (!isShopResource(raw['resource']))
14359
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.resource`, `must be one of ${Object.values(ShopResource).join(', ')}`);
14360
- if (raw['limit'] !== undefined && (!Number.isInteger(raw['limit']) || raw['limit'] < 1))
14361
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.limit`, 'must be a positive whole number');
14362
- const byRoute = raw['filterByRouteParam'];
14363
- if (byRoute === undefined)
14364
- return undefined;
14365
- if (!isPlainObject(byRoute)) {
14366
- c.add(SitePlanIssueCode.Shape, `${path}.filterByRouteParam`, 'must be an object');
14367
- return undefined;
14977
+ /** A plan's footer made distinct (R-H10): `distinctFooter` over the plan's own mix, the name and the look it wears; the
14978
+ * plan unchanged when nothing was mended, else with the new mix in `mixes.footer`. Pure. */
14979
+ function withDistinctFooter(plan, taken) {
14980
+ const done = distinctFooter(footerMixOfPlan(plan), taken, { name: plan.business.name, design: resolveDesignChoices(JSON.parse(JSON.stringify(plan.design))) });
14981
+ if (!done.repairs.length)
14982
+ return { plan, repairs: [] };
14983
+ return { plan: { ...plan, mixes: { ...(plan.mixes ?? {}), footer: footerMixWords(done.mix) } }, repairs: done.repairs };
14984
+ }
14985
+
14986
+ const LIST_RECIPES = {
14987
+ [PatternRecipe.Accordion]: { picks: f => ({ ...pickAccordionAutoBinds(f) }), required: ['question', 'answer'], needs: 'short-text field for the question and long-text field for the answer' },
14988
+ [PatternRecipe.Tabs]: { picks: f => ({ ...pickTabsAutoBinds(f) }), required: ['label', 'text'], needs: 'short-text field for the tab and long-text field for its panel' },
14989
+ };
14990
+ /** The fields `recipe` binds from a listed type's `fields`, and what they lack. A recipe that lists nothing lacks nothing. */
14991
+ function recipeListBinds(recipe, fields) {
14992
+ const spec = recipe ? LIST_RECIPES[recipe] : undefined;
14993
+ if (!spec)
14994
+ return { picks: {}, gap: null };
14995
+ const picks = spec.picks(fields);
14996
+ return { picks: picks, gap: spec.required.every(key => picks[key]) ? null : spec.needs };
14997
+ }
14998
+ const listsBinding = (src) => src === PatternDirective.Binding || src === PatternDirective.OptionalBinding;
14999
+ /** What a listed type with `fields` lacks for the pattern's recipes that repeat the section's binding — the first gap, or null. */
15000
+ function patternListGap(pattern, fields) {
15001
+ for (const node of patternNodes(pattern)) {
15002
+ if (!listsBinding(node.src))
15003
+ continue;
15004
+ const { gap } = recipeListBinds(node.recipe, fields);
15005
+ if (gap)
15006
+ return gap;
14368
15007
  }
14369
- c.keys(byRoute, ['field', 'routeParam'], `${path}.filterByRouteParam`);
14370
- const field = c.string(byRoute, 'field', `${path}.filterByRouteParam`);
14371
- const routeParam = c.string(byRoute, 'routeParam', `${path}.filterByRouteParam`) ?? undefined;
14372
- if (field && field !== SHOP_SLUG_FIELD)
14373
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam.field`, `a shop row is looked up by its ${SHOP_SLUG_FIELD}`);
14374
- if (mode !== PlanDataSourceMode.Single)
14375
- c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam`, 'only a single source is looked up by a route param');
14376
- return routeParam;
15008
+ return null;
14377
15009
  }
15010
+
14378
15011
  /**
14379
- * Commerce C-D21: what the business sells — up to six products by name, each in one of the categories, how each varies;
14380
- * never a price, a stock count or a fee (the owner sets those, shop-aware §3i). A selling business must say what it
14381
- * sells, one that sells nothing holds no shop, and a shop list is never a content type's name (its collection is the
14382
- * shop's). Returns whether the plan sells.
14383
- */
14384
- function validateShop(c, plan, ctx) {
14385
- c.array(plan, 'contentTypes', '').forEach((t, i) => {
14386
- if (isPlainObject(t) && isShopResource(t['name']))
14387
- c.add(SitePlanIssueCode.Shop, `contentTypes[${i}].name`, `"${t['name']}" is the shop's own list — what the business sells goes in shop, never a content type`);
14388
- });
14389
- const shop = plan['shop'];
14390
- const sells = planSells(plan);
14391
- if (ctx.sells === true && !sells)
14392
- c.add(SitePlanIssueCode.Shop, 'shop', `this business sells — name what (1–${SHOP_PRODUCTS_MAX} products, each in a category)`);
14393
- if (ctx.sells === false && shop !== undefined)
14394
- c.add(SitePlanIssueCode.Shop, 'shop', 'this business sells nothing online — no shop');
14395
- if (!sells) {
14396
- c.array(plan, 'dataSources', '').forEach((d, i) => {
14397
- if (isPlainObject(d) && d['type'] === PlanDataSourceType.Shop)
14398
- c.add(SitePlanIssueCode.Shop, `dataSources[${i}]`, 'a shop source on a plan that sells nothing');
14399
- });
15012
+ * The Site Plan validator — the gate in front of the composer. The wizard's plan and (later) the AI's
15013
+ * plan go through the SAME checks: an unknown pattern, a slot the pattern does not declare, a source
15014
+ * that does not exist, a page whose route item cannot be resolved — all refused, with a path, before a
15015
+ * single page is written. It never repairs: a model gets the issues back and rewrites.
15016
+ */
15017
+ var SitePlanIssueCode;
15018
+ (function (SitePlanIssueCode) {
15019
+ /** A value of the wrong type, or a required value missing. */
15020
+ SitePlanIssueCode["Shape"] = "shape";
15021
+ /** A key the plan shape does not have. */
15022
+ SitePlanIssueCode["UnknownKey"] = "unknown-key";
15023
+ SitePlanIssueCode["Version"] = "version";
15024
+ SitePlanIssueCode["UnknownFlavor"] = "unknown-flavor";
15025
+ SitePlanIssueCode["InvalidDesign"] = "invalid-design";
15026
+ SitePlanIssueCode["MissingBusinessName"] = "missing-business-name";
15027
+ SitePlanIssueCode["UnknownFact"] = "unknown-fact";
15028
+ SitePlanIssueCode["Duplicate"] = "duplicate";
15029
+ SitePlanIssueCode["ReservedAlias"] = "reserved-alias";
15030
+ SitePlanIssueCode["UnknownContentType"] = "unknown-content-type";
15031
+ SitePlanIssueCode["UnknownField"] = "unknown-field";
15032
+ SitePlanIssueCode["UnknownDataSource"] = "unknown-data-source";
15033
+ SitePlanIssueCode["InvalidDataSource"] = "invalid-data-source";
15034
+ SitePlanIssueCode["InvalidRoute"] = "invalid-route";
15035
+ SitePlanIssueCode["Home"] = "home";
15036
+ SitePlanIssueCode["RouteSource"] = "route-source";
15037
+ SitePlanIssueCode["UnknownPattern"] = "unknown-pattern";
15038
+ SitePlanIssueCode["GlobalPattern"] = "global-pattern";
15039
+ /** A header/footer mix (`mixes`) with a word its part's table lacks, or two words for a one-word ingredient. */
15040
+ SitePlanIssueCode["Mix"] = "mix";
15041
+ SitePlanIssueCode["UnknownSlot"] = "unknown-slot";
15042
+ SitePlanIssueCode["UnknownOptionalPart"] = "unknown-optional-part";
15043
+ SitePlanIssueCode["Binding"] = "binding";
15044
+ SitePlanIssueCode["MissingScope"] = "missing-scope";
15045
+ /** A pattern reads a role (`@title`) the bound item's content type does not name (L0-3), or a type names no title. */
15046
+ SitePlanIssueCode["MissingRole"] = "missing-role";
15047
+ /** A role the contract does not know, or one played by a field the type does not have. */
15048
+ SitePlanIssueCode["UnknownRole"] = "unknown-role";
15049
+ /** A page type that does not exist; or (`archetypeIssues`, the plan stage's own check) sections that do not fit it. */
15050
+ SitePlanIssueCode["Archetype"] = "archetype";
15051
+ /** A slot's words are longer than its budget under the look's density (L0-2, M1-6c): rewrite, never cut. */
15052
+ SitePlanIssueCode["SlotTooLong"] = "slot-too-long";
15053
+ /** A section re-points a slot that does not link, or to a route the plan has no page for. */
15054
+ SitePlanIssueCode["InvalidLink"] = "invalid-link";
15055
+ /** A section's form preset is not a forms-core preset, or the pattern holds no form. */
15056
+ SitePlanIssueCode["InvalidForm"] = "invalid-form";
15057
+ /** A section's entrance is not a How animated level. */
15058
+ SitePlanIssueCode["InvalidEnter"] = "invalid-enter";
15059
+ /** The plan's language is not a site locale. */
15060
+ SitePlanIssueCode["InvalidLocale"] = "invalid-locale";
15061
+ /** A page's SEO words are longer than a search result shows (seo-core limits). */
15062
+ SitePlanIssueCode["InvalidSeo"] = "invalid-seo";
15063
+ /** A page names a need the harness does not have. */
15064
+ SitePlanIssueCode["UnknownNeed"] = "unknown-need";
15065
+ /** A page key that is a global slot's name (`header`, `footer`): its sections' ids would be the global's. */
15066
+ SitePlanIssueCode["ReservedPageKey"] = "reserved-page-key";
15067
+ /** SC6: a Scene below How animated Expressive, a second Scene on a page, or Scenes on more than the home page and
15068
+ * one other — the pages answer by choosing another pattern. */
15069
+ SitePlanIssueCode["SceneBudget"] = "scene-budget";
15070
+ /** SC6b: the owner's film — pictures that cannot play, too few to play smoothly, or a film's pattern on a plan with
15071
+ * no film (or twice). Set by the build, never by a model. */
15072
+ SitePlanIssueCode["Film"] = "film";
15073
+ /** M7: the art direction is not a picture world with its five parts. Set by the generation, never by a model. */
15074
+ SitePlanIssueCode["ArtDirection"] = "art-direction";
15075
+ /** M8 gate 2: the site's direction (the idea, the cliché, the flip, three rules) — written whole or not at all. */
15076
+ SitePlanIssueCode["Direction"] = "direction";
15077
+ /** M8 gate 2: which pages are composed — the home page and at most one other that is no per-item page. */
15078
+ SitePlanIssueCode["Compose"] = "compose";
15079
+ /** M8 gate 2: a composed page's layout (`checkLayout`'s issues, each at its path under `layout`). */
15080
+ SitePlanIssueCode["Layout"] = "layout";
15081
+ /** Commerce C-D21: what the business sells — a selling business without its products, one that sells nothing with a
15082
+ * shop, a product past the sixth, a shop source with no shop, or a content type named after a shop list. */
15083
+ SitePlanIssueCode["Shop"] = "shop";
15084
+ /** Commerce C-D21: a selling site has a product page — a page at a `:slug` route reading the shop's one product. */
15085
+ SitePlanIssueCode["ProductPage"] = "product-page";
15086
+ /** Commerce C-D21: a price, a stock count or a fee written into what the business sells — the owner sets those. */
15087
+ SitePlanIssueCode["Price"] = "price";
15088
+ })(SitePlanIssueCode || (SitePlanIssueCode = {}));
15089
+ class SitePlanError extends Error {
15090
+ constructor(issues) {
15091
+ super(`invalid site plan: ${issues.map(i => `${i.path}: ${i.message}`).join('; ')}`);
15092
+ this.issues = issues;
14400
15093
  }
14401
- if (shop === undefined)
14402
- return sells;
14403
- if (!isPlainObject(shop)) {
14404
- c.add(SitePlanIssueCode.Shape, 'shop', 'must be an object');
14405
- return false;
15094
+ }
15095
+ /** Route-scope aliases (`$route`, `$current`, …) are platform-owned. */
15096
+ const RESERVED_PREFIX = '$';
15097
+ const ID_FIELD = '_id';
15098
+ /** The documented plan shape (contract `site.planShape`): its key lists are READ (`shape-check`), so a key
15099
+ * the plan documents is a key the gate validates — and an undocumented one is refused. */
15100
+ const SHAPE = SPEC_SITE_PLAN_SHAPE;
15101
+ const PLAN_KEYS = shapeKeys(SHAPE['plan']);
15102
+ const TEMPLATE_SOURCE_KEYS = shapeKeys(SHAPE['sourceTemplate']);
15103
+ const AI_SOURCE_KEYS = shapeKeys(SHAPE['sourceAi']);
15104
+ const BUSINESS_KEYS = shapeKeys(SHAPE['business']);
15105
+ const DESIGN_REQUIRED = requiredShapeKeys(SHAPE['design']);
15106
+ const DESIGN_KEYS = shapeKeys(SHAPE['design']);
15107
+ const CONTENT_TYPE_KEYS = shapeKeys(SHAPE['contentType']);
15108
+ const ROLE_KEYS$1 = shapeKeys(SHAPE['roles']);
15109
+ const PAGE_SEO_KEYS = shapeKeys(SHAPE['pageSeo']);
15110
+ const ARRAY_TYPE = 'array';
15111
+ const FIELD_KEYS = shapeKeys(SHAPE['field']);
15112
+ const SLUG_FIELD = 'slug';
15113
+ const SEED_FIXED_KEYS = shapeKeys(SHAPE['seed']);
15114
+ const CMS_SOURCE_KEYS = shapeKeys(SHAPE['cmsDataSource']);
15115
+ const RELATIVE_SOURCE_KEYS = shapeKeys(SHAPE['relativeDataSource']);
15116
+ const SHOP_SOURCE_KEYS = shapeKeys(SHAPE['shopDataSource']);
15117
+ const SHOP_KEYS = shapeKeys(SHAPE['shop']);
15118
+ const SHOP_PRODUCT_KEYS = shapeKeys(SHAPE['shopProduct']);
15119
+ const SHOP_OPTION_KEYS = shapeKeys(SHAPE['shopOption']);
15120
+ const PAGE_KEYS = shapeKeys(SHAPE['page']);
15121
+ const FILM_KEYS = shapeKeys(SHAPE['film']);
15122
+ const ART_DIRECTION_KEYS = shapeKeys(SHAPE['artDirection']);
15123
+ const DIRECTION_KEYS = shapeKeys(SHAPE['direction']);
15124
+ const LAYOUT_PAGE_KEYS = shapeKeys(SHAPE['layoutPage']);
15125
+ const LAYOUT_DIALS = SPEC_SITE_LAYOUT.vocab.dials;
15126
+ const COMPOSED_PAGES_MAX = SPEC_SITE_LAYOUT.limits.composedPages;
15127
+ const DIRECTION_RULES_MAX = 3;
15128
+ const SECTION_KEYS = shapeKeys(SHAPE['section']);
15129
+ const GLOBAL_POSITION = {
15130
+ [GlobalSlot.Header]: PatternGlobalPosition.Before,
15131
+ [GlobalSlot.Footer]: PatternGlobalPosition.After,
15132
+ };
15133
+ const ROUTE = /^\/(?:(?:[a-z0-9]+(?:-[a-z0-9]+)*|:[a-zA-Z_][a-zA-Z0-9_]*)(?:\/(?:[a-z0-9]+(?:-[a-z0-9]+)*|:[a-zA-Z_][a-zA-Z0-9_]*))*)?$/;
15134
+ const ROUTE_PARAM$1 = /:([a-zA-Z_][a-zA-Z0-9_]*)/g;
15135
+ const has$1 = (table, key) => Object.prototype.hasOwnProperty.call(table, key);
15136
+ /** The `:param` names of a route, in order. */
15137
+ function routeParams(route) {
15138
+ return [...route.matchAll(ROUTE_PARAM$1)].map(m => m[1]);
15139
+ }
15140
+ let Collector$1 = class Collector extends PathIssueCollector {
15141
+ constructor() {
15142
+ super('plan', { shape: SitePlanIssueCode.Shape, unknownKey: SitePlanIssueCode.UnknownKey, duplicate: SitePlanIssueCode.Duplicate });
15143
+ }
15144
+ };
15145
+ function validateSource(c, source) {
15146
+ if (!isPlainObject(source))
15147
+ return c.add(SitePlanIssueCode.Shape, 'source', 'must be an object');
15148
+ if (source['kind'] === SitePlanSourceKind.Template) {
15149
+ c.keys(source, TEMPLATE_SOURCE_KEYS, 'source');
15150
+ c.string(source, 'templateId', 'source');
15151
+ if (!Number.isInteger(source['templateVersion']))
15152
+ c.add(SitePlanIssueCode.Shape, 'source.templateVersion', 'must be an integer');
15153
+ }
15154
+ else if (source['kind'] === SitePlanSourceKind.Ai) {
15155
+ c.keys(source, AI_SOURCE_KEYS, 'source');
15156
+ c.string(source, 'runId', 'source');
15157
+ }
15158
+ else {
15159
+ c.add(SitePlanIssueCode.Shape, 'source.kind', `must be "${SitePlanSourceKind.Template}" or "${SitePlanSourceKind.Ai}"`);
14406
15160
  }
14407
- c.keys(shop, SHOP_KEYS, 'shop');
14408
- const categories = c.array(shop, 'categories', 'shop');
14409
- categories.forEach((name, i) => { if (!isNonEmptyString(name))
14410
- c.add(SitePlanIssueCode.Shape, `shop.categories[${i}]`, 'must be a name'); });
14411
- c.unique(categories.map(n => (isNonEmptyString(n) ? n : null)), i => `shop.categories[${i}]`, 'category');
14412
- const products = c.array(shop, 'products', 'shop');
14413
- if (!products.length)
14414
- c.add(SitePlanIssueCode.Shop, 'shop.products', 'name what the business sells, or hold no shop');
14415
- if (products.length > SHOP_PRODUCTS_MAX)
14416
- c.add(SitePlanIssueCode.Shop, 'shop.products', `${products.length} products — at most ${SHOP_PRODUCTS_MAX} samples`);
14417
- const price = (path, text) => {
14418
- if (typeof text === 'string' && pricesIn(text).length)
14419
- c.add(SitePlanIssueCode.Price, path, `"${pricesIn(text)[0]}" — never a price, stock or fee: the owner sets those`);
14420
- };
14421
- products.forEach((raw, i) => {
14422
- const path = `shop.products[${i}]`;
14423
- if (!isPlainObject(raw))
14424
- return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
14425
- c.keys(raw, SHOP_PRODUCT_KEYS, path);
14426
- price(`${path}.name`, c.string(raw, 'name', path));
14427
- const category = c.string(raw, 'category', path);
14428
- if (category && !categories.includes(category))
14429
- c.add(SitePlanIssueCode.Shop, `${path}.category`, `"${category}" is not one of the shop's categories`);
14430
- const description = raw['description'];
14431
- if (typeof description !== 'string')
14432
- c.add(SitePlanIssueCode.Shape, `${path}.description`, 'must be a string (one line)');
14433
- else
14434
- price(`${path}.description`, description);
14435
- const options = c.array(raw, 'options', path);
14436
- options.forEach((o, j) => {
14437
- const op = `${path}.options[${j}]`;
14438
- if (!isPlainObject(o))
14439
- return c.add(SitePlanIssueCode.Shape, op, 'must be an object');
14440
- c.keys(o, SHOP_OPTION_KEYS, op);
14441
- c.string(o, 'name', op);
14442
- const values = c.array(o, 'values', op);
14443
- if (!values.length)
14444
- c.add(SitePlanIssueCode.Shop, `${op}.values`, 'an option names its values (sizes, colours…)');
14445
- values.forEach((v, k) => { if (!isNonEmptyString(v))
14446
- c.add(SitePlanIssueCode.Shape, `${op}.values[${k}]`, 'must be a name');
14447
- else
14448
- price(`${op}.values[${k}]`, v); });
14449
- c.unique(values.map(v => (isNonEmptyString(v) ? v : null)), k => `${op}.values[${k}]`, 'value');
14450
- });
14451
- c.unique(options.map(o => (isPlainObject(o) && isNonEmptyString(o['name']) ? o['name'] : null)), j => `${path}.options[${j}].name`, 'option');
14452
- });
14453
- c.unique(products.map(p => (isPlainObject(p) && isNonEmptyString(p['name']) ? p['name'] : null)), i => `shop.products[${i}].name`, 'product');
14454
- return sells;
14455
15161
  }
14456
- /** A selling site has a product page: a page whose route item is the shop's one product (`/shop/:slug`). */
14457
- function validateProductPage(c, pages, sources) {
14458
- const hasProductPage = pages.some(p => {
14459
- const source = isPlainObject(p) && typeof p['routeSource'] === 'string' ? sources.get(p['routeSource']) : undefined;
14460
- return source?.type === PlanDataSourceType.Shop && source.mode === PlanDataSourceMode.Single && source.contentType === ShopResource.Products;
14461
- });
14462
- if (!hasProductPage) {
14463
- const item = [...sources].find(([, s]) => s.type === PlanDataSourceType.Shop && s.mode === PlanDataSourceMode.Single)?.[0] ?? 'product';
14464
- c.add(SitePlanIssueCode.ProductPage, 'pages', `this site sells — it needs a product page: a page at /shop/:slug whose routeSource is "${item}" and template "${ShopResource.Products}"`);
15162
+ function validateBusiness(c, business) {
15163
+ if (!isPlainObject(business))
15164
+ return c.add(SitePlanIssueCode.Shape, 'business', 'must be an object');
15165
+ c.keys(business, BUSINESS_KEYS, 'business');
15166
+ if (!isNonEmptyString(business['name']))
15167
+ c.add(SitePlanIssueCode.MissingBusinessName, 'business.name', 'the business name is required');
15168
+ if (business['tagline'] !== undefined && typeof business['tagline'] !== 'string')
15169
+ c.add(SitePlanIssueCode.Shape, 'business.tagline', 'must be a string');
15170
+ const facts = business['facts'];
15171
+ if (facts === undefined)
15172
+ return;
15173
+ if (!isPlainObject(facts))
15174
+ return c.add(SitePlanIssueCode.Shape, 'business.facts', 'must be an object');
15175
+ for (const [key, value] of Object.entries(facts)) {
15176
+ if (!FACT_KEYS.includes(key))
15177
+ c.add(SitePlanIssueCode.UnknownFact, `business.facts.${key}`, `"${key}" is not a fact (${FACT_KEYS.join(', ')})`);
15178
+ else if (typeof value !== 'string')
15179
+ c.add(SitePlanIssueCode.Shape, `business.facts.${key}`, 'must be a string');
14465
15180
  }
14466
15181
  }
14467
- function validatePages(c, list, types, sources, density) {
14468
- const homes = [];
14469
- const routes = new Set(list.map(p => (isPlainObject(p) && typeof p['route'] === 'string' ? p['route'] : null)).filter((r) => !!r));
14470
- list.forEach((raw, i) => {
14471
- const path = `pages[${i}]`;
14472
- if (!isPlainObject(raw))
14473
- return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
14474
- c.keys(raw, PAGE_KEYS, path);
14475
- const key = c.string(raw, 'key', path);
14476
- if (key && Object.values(GlobalSlot).includes(key)) {
14477
- c.add(SitePlanIssueCode.ReservedPageKey, `${path}.key`, `"${key}" names the site's ${key} — a page's sections would share its ids`);
14478
- }
14479
- c.string(raw, 'name', path);
14480
- for (const key of ['isHome', 'required', 'inNav'])
14481
- c.boolean(raw, key, path);
14482
- const route = c.string(raw, 'route', path);
14483
- if (route && !ROUTE.test(route))
14484
- c.add(SitePlanIssueCode.InvalidRoute, `${path}.route`, `"${route}" is not a route (/lowercase-words, :params)`);
14485
- if (raw['isHome'] === true) {
14486
- homes.push(i);
14487
- if (route !== '/')
14488
- c.add(SitePlanIssueCode.Home, `${path}.route`, 'the home page lives at /');
14489
- }
14490
- else if (route === '/')
14491
- c.add(SitePlanIssueCode.Home, `${path}.isHome`, 'the page at / is the home page');
14492
- const params = route ? routeParams(route) : [];
14493
- const template = c.string(raw, 'template', path, false);
14494
- const routeSourceAlias = c.string(raw, 'routeSource', path, false);
14495
- const routeSource = routeSourceAlias ? sources.get(routeSourceAlias) : undefined;
14496
- const routeSourceOk = isItemSource(routeSource);
14497
- if (template && !types.has(template))
14498
- c.add(SitePlanIssueCode.UnknownContentType, `${path}.template`, `no content type "${template}" in the plan`);
14499
- if (params.length > 1)
14500
- c.add(SitePlanIssueCode.InvalidRoute, `${path}.route`, 'a template page has one route param');
14501
- if (params.length && !routeSourceAlias)
14502
- c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `a route with :${params[0]} names the source that reads it`);
14503
- if (routeSourceAlias) {
14504
- if (!routeSourceOk) {
14505
- c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" must be a single source of the plan`);
15182
+ function validateLocale(c, locale) {
15183
+ if (locale !== undefined && (typeof locale !== 'string' || !has$1(SITE_LOCALES, locale))) {
15184
+ c.add(SitePlanIssueCode.InvalidLocale, 'locale', `must be one of ${Object.keys(SITE_LOCALES).join(', ')}`);
15185
+ }
15186
+ }
15187
+ function validateDesign(c, design) {
15188
+ if (!isPlainObject(design))
15189
+ return c.add(SitePlanIssueCode.Shape, 'design', 'must be an object');
15190
+ c.keys(design, DESIGN_KEYS, 'design');
15191
+ for (const key of DESIGN_REQUIRED)
15192
+ if (design[key] === undefined)
15193
+ c.add(SitePlanIssueCode.Shape, `design.${key}`, 'is required');
15194
+ const pack = flavorPackById(typeof design['flavorId'] === 'string' ? design['flavorId'] : null);
15195
+ if (design['flavorId'] !== undefined && (!pack || pack.id !== design['flavorId'])) {
15196
+ c.add(SitePlanIssueCode.UnknownFlavor, 'design.flavorId', `"${String(design['flavorId'])}" is not a flavor`);
15197
+ }
15198
+ const bad = (key, why) => c.add(SitePlanIssueCode.InvalidDesign, `design.${key}`, why);
15199
+ if (design['seed'] !== undefined && (typeof design['seed'] !== 'string' || !parseHexColor(design['seed'])))
15200
+ bad('seed', 'must be a #rrggbb colour');
15201
+ if (design['pairId'] !== undefined && pack && !pack.pairs.some(p => p.id === design['pairId']))
15202
+ bad('pairId', `is not a font pairing of ${pack.id}`);
15203
+ const axis = (key, table) => {
15204
+ if (design[key] !== undefined && (typeof design[key] !== 'string' || !has$1(table, design[key])))
15205
+ bad(key, `must be one of ${Object.keys(table).join(', ')}`);
15206
+ };
15207
+ axis('shape', SPEC_AXES.shapes);
15208
+ axis('density', SPEC_AXES.densities);
15209
+ axis('motion', SPEC_AXES.motions);
15210
+ axis('tint', SPEC_AXES.tints);
15211
+ axis('scroll', SPEC_AXES.scrolls);
15212
+ axis('animate', SPEC_AXES.animations);
15213
+ axis('between', SPEC_AXES.betweens);
15214
+ if (design['mode'] !== undefined && !SPEC_AXES.modes.includes(design['mode']))
15215
+ bad('mode', `must be one of ${SPEC_AXES.modes.join(', ')}`);
15216
+ if (design['pillButtons'] !== undefined && typeof design['pillButtons'] !== 'boolean')
15217
+ bad('pillButtons', 'must be a boolean');
15218
+ if (design['fonts'] !== undefined && !isPlainObject(design['fonts']))
15219
+ bad('fonts', 'must be an object');
15220
+ }
15221
+ function validateContentTypes(c, list) {
15222
+ const types = new Map();
15223
+ list.forEach((raw, i) => {
15224
+ const path = `contentTypes[${i}]`;
15225
+ if (!isPlainObject(raw))
15226
+ return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
15227
+ c.keys(raw, CONTENT_TYPE_KEYS, path);
15228
+ const name = c.string(raw, 'name', path);
15229
+ c.string(raw, 'label', path);
15230
+ const fields = c.array(raw, 'fields', path);
15231
+ const names = fields.map((f, j) => {
15232
+ const fp = `${path}.fields[${j}]`;
15233
+ if (!isPlainObject(f)) {
15234
+ c.add(SitePlanIssueCode.Shape, fp, 'must be an object');
15235
+ return null;
14506
15236
  }
15237
+ c.keys(f, FIELD_KEYS, fp);
15238
+ const control = c.string(f, 'controller', fp);
15239
+ const stored = c.string(f, 'type', fp);
15240
+ const expected = control ? FIELD_TYPE_OF_CONTROL[control] : undefined;
15241
+ if (control && !expected)
15242
+ c.add(SitePlanIssueCode.Shape, `${fp}.controller`, `"${control}" is not a field control (${Object.values(ContentFieldControl).join(', ')})`);
15243
+ if (expected && stored && stored !== expected)
15244
+ c.add(SitePlanIssueCode.Shape, `${fp}.type`, `a ${control} field is stored as ${expected}, not "${stored}"`);
15245
+ c.boolean(f, 'required', fp);
15246
+ return c.string(f, 'name', fp);
15247
+ });
15248
+ c.unique(names, j => `${path}.fields[${j}].name`, 'field');
15249
+ const fieldSet = new Set(names.filter((n) => !!n));
15250
+ const fieldTypes = new Map(fields.filter(isPlainObject).map(f => [f['name'], f['type']]));
15251
+ const roles = validateRoles(c, raw['roles'], `${path}.roles`, name, fieldSet, fieldTypes);
15252
+ const seed = raw['seed'];
15253
+ if (seed !== undefined) {
15254
+ if (!isPlainObject(seed))
15255
+ c.add(SitePlanIssueCode.Shape, `${path}.seed`, 'must be an object');
14507
15256
  else {
14508
- if (!params.length || routeSource.routeParam !== params[0])
14509
- c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" is not looked up by this route's param`);
14510
- if (template && routeSource.contentType !== template)
14511
- c.add(SitePlanIssueCode.RouteSource, `${path}.template`, `"${routeSourceAlias}" reads ${routeSource.contentType}, not ${template}`);
14512
- }
14513
- }
14514
- const archetype = c.string(raw, 'archetype', path, false);
14515
- if (archetype && !has$1(PAGE_ARCHETYPES, archetype))
14516
- c.add(SitePlanIssueCode.Archetype, `${path}.archetype`, `"${archetype}" is not a page type (${Object.keys(PAGE_ARCHETYPES).join(', ')})`);
14517
- validatePageSeo(c, raw['seo'], `${path}.seo`);
14518
- const need = c.string(raw, 'need', path, false);
14519
- if (need && !SITE_NEED_IDS.includes(need))
14520
- c.add(SitePlanIssueCode.UnknownNeed, `${path}.need`, `"${need}" is not a need (${SITE_NEED_IDS.join(', ')})`);
14521
- c.array(raw, 'sections', path).forEach((s, j) => {
14522
- const sp = `${path}.sections[${j}]`;
14523
- if (!isPlainObject(s))
14524
- return c.add(SitePlanIssueCode.Shape, sp, 'must be an object');
14525
- c.keys(s, SECTION_KEYS, sp);
14526
- const patternId = c.string(s, 'pattern', sp);
14527
- const pattern = patternById(patternId);
14528
- if (patternId && !pattern)
14529
- return c.add(SitePlanIssueCode.UnknownPattern, `${sp}.pattern`, `no pattern "${patternId}"`);
14530
- if (!pattern)
14531
- return;
14532
- if (pattern.global)
14533
- c.add(SitePlanIssueCode.GlobalPattern, `${sp}.pattern`, `"${patternId}" is a header/footer pattern (globals)`);
14534
- const slots = s['slots'];
14535
- if (slots !== undefined) {
14536
- if (!isPlainObject(slots))
14537
- c.add(SitePlanIssueCode.Shape, `${sp}.slots`, 'must be an object');
14538
- else {
14539
- const declared = patternSlots(pattern);
14540
- for (const [slot, value] of Object.entries(slots)) {
14541
- if (!declared.includes(slot))
14542
- c.add(SitePlanIssueCode.UnknownSlot, `${sp}.slots.${slot}`, `"${patternId}" has no slot "${slot}" (${declared.join(', ') || 'none'})`);
14543
- else if (typeof value !== 'string')
14544
- c.add(SitePlanIssueCode.Shape, `${sp}.slots.${slot}`, 'must be a string');
14545
- else {
14546
- const budget = slotBudget(pattern, slot, density);
14547
- if (budget !== null && value.length > budget)
14548
- c.add(SitePlanIssueCode.SlotTooLong, `${sp}.slots.${slot}`, `${value.length} characters — the slot holds ${budget} at the ${density ?? 'regular'} density`);
15257
+ if (!Number.isInteger(seed['count']) || seed['count'] < 0)
15258
+ c.add(SitePlanIssueCode.Shape, `${path}.seed.count`, 'must be a whole number');
15259
+ for (const key of ['sample', 'isPublished'])
15260
+ if (typeof seed[key] !== 'boolean')
15261
+ c.add(SitePlanIssueCode.Shape, `${path}.seed.${key}`, 'must be a boolean');
15262
+ const perItem = seed['perItem'];
15263
+ if (perItem !== undefined) {
15264
+ if (!isPlainObject(perItem))
15265
+ c.add(SitePlanIssueCode.Shape, `${path}.seed.perItem`, 'must be an object');
15266
+ else
15267
+ for (const [field, list] of Object.entries(perItem)) {
15268
+ const at = `${path}.seed.perItem.${field}`;
15269
+ if (!fieldSet.has(field))
15270
+ c.add(SitePlanIssueCode.UnknownField, at, `"${field}" is not a field of ${name}`);
15271
+ else if (!Array.isArray(list) || list.length !== seed['count'] || list.some(v => typeof v !== 'string'))
15272
+ c.add(SitePlanIssueCode.Shape, at, `must be ${String(seed['count'])} strings, one per sample`);
15273
+ else if (field === SLUG_FIELD && new Set(list).size !== list.length)
15274
+ c.add(SitePlanIssueCode.Shape, at, 'each sample needs its own slug');
14549
15275
  }
14550
- }
14551
- }
14552
- }
14553
- const links = s['links'];
14554
- if (links !== undefined) {
14555
- if (!isPlainObject(links))
14556
- c.add(SitePlanIssueCode.Shape, `${sp}.links`, 'must be an object');
14557
- else {
14558
- const linkSlots = patternLinkSlots(pattern);
14559
- for (const [slot, route] of Object.entries(links)) {
14560
- if (!linkSlots.includes(slot))
14561
- c.add(SitePlanIssueCode.InvalidLink, `${sp}.links.${slot}`, `"${patternId}" has no linked slot "${slot}" (${linkSlots.join(', ') || 'none'})`);
14562
- else if (typeof route !== 'string' || !routes.has(route) || routeParams(route).length)
14563
- c.add(SitePlanIssueCode.InvalidLink, `${sp}.links.${slot}`, `"${String(route)}" is not a page route of the plan`);
14564
- }
14565
- }
14566
- }
14567
- const form = c.string(s, 'form', sp, false);
14568
- if (form && !patternHasForm(pattern))
14569
- c.add(SitePlanIssueCode.InvalidForm, `${sp}.form`, `"${patternId}" holds no form`);
14570
- else if (form && !formPresetById(form))
14571
- c.add(SitePlanIssueCode.InvalidForm, `${sp}.form`, `"${form}" is not a form preset`);
14572
- const enter = c.string(s, 'enter', sp, false);
14573
- if (enter && !has$1(SPEC_AXES.animations, enter))
14574
- c.add(SitePlanIssueCode.InvalidEnter, `${sp}.enter`, `must be one of ${Object.keys(SPEC_AXES.animations).join(', ')}`);
14575
- const without = s['without'];
14576
- if (without !== undefined) {
14577
- const parts = patternOptionalParts(pattern);
14578
- if (!Array.isArray(without))
14579
- c.add(SitePlanIssueCode.Shape, `${sp}.without`, 'must be an array');
14580
- else
14581
- without.forEach((w, k) => {
14582
- if (!parts.includes(w))
14583
- c.add(SitePlanIssueCode.UnknownOptionalPart, `${sp}.without[${k}]`, `"${patternId}" has no optional part "${String(w)}"`);
14584
- });
14585
- }
14586
- const binding = c.string(s, 'binding', sp, false);
14587
- if (patternTakesBinding(pattern)) {
14588
- if (!binding) {
14589
- if (patternNeedsBinding(pattern))
14590
- c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" repeats the section's binding — name a list source`);
14591
- }
14592
- else {
14593
- const src = sources.get(binding);
14594
- if (!src)
14595
- c.add(SitePlanIssueCode.UnknownDataSource, `${sp}.binding`, `no data source "${binding}"`);
14596
- else if (!isListSource(src))
14597
- c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${binding}" is not a list source`);
14598
- else {
14599
- const listed = src.contentType ? types.get(src.contentType) : undefined;
14600
- const gap = listed ? patternListGap(pattern, listed.described) : null;
14601
- if (gap)
14602
- c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${binding}" lists ${src.contentType}, which has no ${gap} — bind "${patternId}" to a list that has${patternNeedsBinding(pattern) ? '' : ', or to none'}`);
14603
- }
14604
- }
14605
- }
14606
- else if (binding)
14607
- c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" repeats nothing — it takes no binding`);
14608
- // Commerce G1: a store section reads the shop — its list from a shop source, its product from the page's.
14609
- if (pattern.shop) {
14610
- const listed = binding ? sources.get(binding) : undefined;
14611
- if (listed && listed.type !== PlanDataSourceType.Shop)
14612
- c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" shows the shop's products — bind a shop source, not "${binding}"`);
14613
- if (patternScopes(pattern).has(BindScope.Route) && routeSourceOk && routeSource.type !== PlanDataSourceType.Shop) {
14614
- c.add(SitePlanIssueCode.RouteSource, `${sp}.pattern`, `"${patternId}" shows one product — its page reads a shop source, not "${routeSourceAlias}"`);
14615
15276
  }
14616
- }
14617
- // A pattern reading the route item needs a routeSource (an INVALID one is reported above, once).
14618
- const scopes = patternScopes(pattern);
14619
- const readsRoute = scopes.has(BindScope.Route) || scopes.has(BindScope.Next);
14620
- if (readsRoute && !routeSourceAlias) {
14621
- c.add(SitePlanIssueCode.MissingScope, `${sp}.pattern`, `"${patternId}" reads the route item — the page needs a routeSource`);
14622
- }
14623
- if (scopes.has(BindScope.Next) && routeSourceOk && !nextSourceOf(sources, routeSourceAlias)) {
14624
- c.add(SitePlanIssueCode.MissingScope, `${sp}.pattern`, `"${patternId}" reads the next item — the plan needs a ${RelativeOp.SiblingsNext} source of ${routeSourceAlias}`);
14625
- }
14626
- // L0-3: the roles a pattern reads must be roles of the item's type — the section's list (`item`), the route
14627
- // item (`route`) or its next sibling (`next`, the same type). An optional one (`@image?`) is only left out.
14628
- for (const need of patternRoleNeeds(pattern)) {
14629
- if (need.optional)
14630
- continue;
14631
- const alias = need.scope === BindScope.Item ? binding : routeSourceOk ? routeSourceAlias : null;
14632
- const typeName = alias ? sources.get(alias)?.contentType : undefined;
14633
- const type = typeName ? types.get(typeName) : undefined;
14634
- if (type && !type.roles[need.role]) {
14635
- c.add(SitePlanIssueCode.MissingRole, `${sp}.pattern`, `"${patternId}" shows each ${typeName} item's ${need.role} — ${typeName} names no ${need.role} field (roles.${need.role})`);
15277
+ for (const key of Object.keys(seed)) {
15278
+ if (!SEED_FIXED_KEYS.includes(key) && !fieldSet.has(key))
15279
+ c.add(SitePlanIssueCode.UnknownField, `${path}.seed.${key}`, `"${key}" is not a field of ${name}`);
14636
15280
  }
14637
15281
  }
14638
- });
15282
+ }
15283
+ if (name && types.has(name))
15284
+ c.add(SitePlanIssueCode.Duplicate, `${path}.name`, `content type "${name}" is used twice`);
15285
+ else if (name)
15286
+ types.set(name, { fields: fieldSet, described: fields.filter(isPlainObject).map(describeField), roles });
14639
15287
  });
14640
- c.unique(list.map(p => (isPlainObject(p) && isNonEmptyString(p['key']) ? p['key'] : null)), i => `pages[${i}].key`, 'page key');
14641
- c.unique(list.map(p => (isPlainObject(p) && isNonEmptyString(p['route']) ? p['route'] : null)), i => `pages[${i}].route`, 'route');
14642
- if (homes.length !== 1)
14643
- c.add(SitePlanIssueCode.Home, 'pages', `exactly one page is the home page (found ${homes.length})`);
15288
+ return types;
14644
15289
  }
14645
- /** SC6 (premium-sites plan, APPROVED 2026-11-05): who may hold the page — Scenes only at Expressive, one per page, on the
14646
- * home page and at most one other. A Scene past that is an issue at its pattern, so the pages choose another. */
14647
- function validateScenes(c, pages, animate) {
14648
- let otherPages = 0;
14649
- pages.forEach((raw, i) => {
14650
- if (!isPlainObject(raw) || !Array.isArray(raw['sections']))
14651
- return;
14652
- let onPage = 0;
14653
- const counted = raw['isHome'] === true;
14654
- raw['sections'].forEach((s, j) => {
14655
- const pattern = isPlainObject(s) && typeof s['pattern'] === 'string' ? patternById(s['pattern']) : null;
14656
- if (!pattern?.scene)
14657
- return;
14658
- const at = `pages[${i}].sections[${j}].pattern`;
14659
- if (animate !== SCENE_LEVEL)
14660
- return c.add(SitePlanIssueCode.SceneBudget, at, `"${s['pattern']}" holds the page as it scrolls — only on a site whose How animated is Expressive (this one is ${animate ?? 'unset'})`);
14661
- if (++onPage > 1)
14662
- return c.add(SitePlanIssueCode.SceneBudget, at, 'one Scene per page — choose a section that does not hold the page');
14663
- if (!counted && onPage === 1 && ++otherPages > SCENE_OTHER_PAGES)
14664
- c.add(SitePlanIssueCode.SceneBudget, at, `Scenes on the home page and at most ${SCENE_OTHER_PAGES} other page — choose a section that does not hold the page`);
14665
- });
14666
- });
15290
+ const describeField = (f) => ({ name: String(f['name']), type: typeof f['type'] === 'string' ? f['type'] : undefined, controller: typeof f['controller'] === 'string' ? f['controller'] : undefined });
15291
+ /** A content type's roles (L0-3): known roles only, each played by a field of the type; `title` always; `gallery` a list. */
15292
+ function validateRoles(c, roles, path, typeName, fields, fieldTypes) {
15293
+ if (!isPlainObject(roles)) {
15294
+ c.add(SitePlanIssueCode.Shape, path, 'must be an object (which field plays each role)');
15295
+ return {};
15296
+ }
15297
+ const out = {};
15298
+ for (const [role, field] of Object.entries(roles)) {
15299
+ if (!ROLE_KEYS$1.includes(role)) {
15300
+ c.add(SitePlanIssueCode.UnknownRole, `${path}.${role}`, `"${role}" is not a role (${ROLE_KEYS$1.join(', ')})`);
15301
+ continue;
15302
+ }
15303
+ if (typeof field !== 'string' || !fields.has(field)) {
15304
+ c.add(SitePlanIssueCode.UnknownRole, `${path}.${role}`, `"${String(field)}" is not a field of ${typeName}`);
15305
+ continue;
15306
+ }
15307
+ if (role === 'gallery' && fieldTypes.get(field) !== ARRAY_TYPE) {
15308
+ c.add(SitePlanIssueCode.UnknownRole, `${path}.${role}`, `"${field}" is not a list field — a gallery is a list of pictures`);
15309
+ continue;
15310
+ }
15311
+ out[role] = field;
15312
+ }
15313
+ for (const role of REQUIRED_CONTENT_ROLES)
15314
+ if (!out[role] && !has$1(roles, role))
15315
+ c.add(SitePlanIssueCode.MissingRole, `${path}.${role}`, `every content type names its ${role} field`);
15316
+ return out;
14667
15317
  }
14668
- /** SC6b: a film plays only when its pictures can (and smoothly over the shortest hold); its pattern only with a film, once. */
14669
- function validateFilm(c, film, pages) {
14670
- let playable = false;
14671
- if (film !== undefined) {
14672
- if (!isPlainObject(film)) {
14673
- c.add(SitePlanIssueCode.Shape, 'film', 'must be an object');
15318
+ /** A source a page may read ONE item from by its route (`routeSource`), or bind a list to — a cms one or the shop's. */
15319
+ const isItemSource = (s) => !!s && (s.type === PlanDataSourceType.Cms || s.type === PlanDataSourceType.Shop) && s.mode === PlanDataSourceMode.Single;
15320
+ const isListSource = (s) => !!s && (s.type === PlanDataSourceType.Cms || s.type === PlanDataSourceType.Shop) && s.mode === PlanDataSourceMode.Query;
15321
+ function validateDataSources(c, list, types) {
15322
+ const sources = new Map();
15323
+ list.forEach((raw, i) => {
15324
+ const path = `dataSources[${i}]`;
15325
+ if (!isPlainObject(raw))
15326
+ return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
15327
+ const alias = c.string(raw, 'alias', path);
15328
+ if (alias && alias.startsWith(RESERVED_PREFIX)) {
15329
+ c.add(SitePlanIssueCode.ReservedAlias, `${path}.alias`, `"${alias}" is reserved for the platform`);
15330
+ }
15331
+ if (raw['type'] === PlanDataSourceType.Cms) {
15332
+ c.keys(raw, CMS_SOURCE_KEYS, path);
15333
+ const mode = raw['mode'];
15334
+ if (mode !== PlanDataSourceMode.Query && mode !== PlanDataSourceMode.Single)
15335
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.mode`, `must be "${PlanDataSourceMode.Query}" or "${PlanDataSourceMode.Single}"`);
15336
+ const contentType = c.string(raw, 'contentType', path);
15337
+ const type = contentType ? types.get(contentType) : undefined;
15338
+ if (contentType && !type)
15339
+ c.add(SitePlanIssueCode.UnknownContentType, `${path}.contentType`, `no content type "${contentType}" in the plan`);
15340
+ if (raw['limit'] !== undefined && (!Number.isInteger(raw['limit']) || raw['limit'] < 1))
15341
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.limit`, 'must be a positive whole number');
15342
+ let routeParam;
15343
+ const byRoute = raw['filterByRouteParam'];
15344
+ if (byRoute !== undefined) {
15345
+ if (!isPlainObject(byRoute))
15346
+ c.add(SitePlanIssueCode.Shape, `${path}.filterByRouteParam`, 'must be an object');
15347
+ else {
15348
+ c.keys(byRoute, ['field', 'routeParam'], `${path}.filterByRouteParam`);
15349
+ const field = c.string(byRoute, 'field', `${path}.filterByRouteParam`);
15350
+ routeParam = c.string(byRoute, 'routeParam', `${path}.filterByRouteParam`) ?? undefined;
15351
+ if (field && type && field !== ID_FIELD && !type.fields.has(field))
15352
+ c.add(SitePlanIssueCode.UnknownField, `${path}.filterByRouteParam.field`, `"${field}" is not a field of ${contentType}`);
15353
+ if (mode !== PlanDataSourceMode.Single)
15354
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam`, 'only a single source is looked up by a route param');
15355
+ }
15356
+ }
15357
+ if (alias && !sources.has(alias))
15358
+ sources.set(alias, { type: PlanDataSourceType.Cms, mode: mode, contentType: contentType ?? undefined, routeParam });
15359
+ }
15360
+ else if (raw['type'] === PlanDataSourceType.Relative) {
15361
+ c.keys(raw, RELATIVE_SOURCE_KEYS, path);
15362
+ c.string(raw, 'of', path);
15363
+ c.string(raw, 'within', path);
15364
+ if (!Object.values(RelativeOp).includes(raw['op']))
15365
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.op`, `must be one of ${Object.values(RelativeOp).join(', ')}`);
15366
+ if (alias && !sources.has(alias))
15367
+ sources.set(alias, { type: PlanDataSourceType.Relative, of: raw['of'], op: raw['op'] });
15368
+ }
15369
+ else if (raw['type'] === PlanDataSourceType.Shop) {
15370
+ const routeParam = validateShopSource(c, raw, path);
15371
+ if (alias && !sources.has(alias))
15372
+ sources.set(alias, { type: PlanDataSourceType.Shop, mode: raw['mode'], contentType: raw['resource'], routeParam });
14674
15373
  }
14675
15374
  else {
14676
- c.keys(film, FILM_KEYS, 'film');
14677
- const sequence = normalizeFrameSequence(film['sequence']);
14678
- if (!sequence)
14679
- c.add(SitePlanIssueCode.Film, 'film.sequence', 'not a film\'s pictures (a media-core FrameSequence)');
14680
- else if (filmScreensFor(sequence.wide.count) === null)
14681
- c.add(SitePlanIssueCode.Film, 'film.sequence', `${sequence.wide.count} pictures — too few to play smoothly`);
14682
- else
14683
- playable = true;
15375
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.type`, `must be one of ${Object.values(PlanDataSourceType).map(t => `"${t}"`).join(', ')}`);
14684
15376
  }
14685
- }
14686
- let placed = 0;
14687
- pages.forEach((raw, i) => {
14688
- if (!isPlainObject(raw) || !Array.isArray(raw['sections']))
15377
+ });
15378
+ c.unique(list.map(r => (isPlainObject(r) && isNonEmptyString(r['alias']) ? r['alias'] : null)), i => `dataSources[${i}].alias`, 'alias');
15379
+ // A relative source locates its subject (a single item) within a collection of the SAME type.
15380
+ list.forEach((raw, i) => {
15381
+ if (!isPlainObject(raw) || raw['type'] !== PlanDataSourceType.Relative)
14689
15382
  return;
14690
- raw['sections'].forEach((s, j) => {
14691
- const pattern = isPlainObject(s) && typeof s['pattern'] === 'string' ? patternById(s['pattern']) : null;
14692
- if (!pattern?.film)
14693
- return;
14694
- const path = `pages[${i}].sections[${j}].pattern`;
14695
- if (!playable)
14696
- c.add(SitePlanIssueCode.Film, path, `"${s['pattern']}" plays the owner's film — this plan has none`);
14697
- else if (++placed > 1)
14698
- c.add(SitePlanIssueCode.Film, path, 'the film plays once on a site');
14699
- });
15383
+ const of = sources.get(raw['of']);
15384
+ const within = sources.get(raw['within']);
15385
+ if (!of || of.type !== PlanDataSourceType.Cms || of.mode !== PlanDataSourceMode.Single)
15386
+ c.add(SitePlanIssueCode.UnknownDataSource, `dataSources[${i}].of`, 'must name a single cms source of the plan');
15387
+ if (!within || within.type !== PlanDataSourceType.Cms || within.mode !== PlanDataSourceMode.Query)
15388
+ c.add(SitePlanIssueCode.UnknownDataSource, `dataSources[${i}].within`, 'must name a list (query) cms source of the plan');
15389
+ if (of?.contentType && within?.contentType && of.contentType !== within.contentType)
15390
+ c.add(SitePlanIssueCode.InvalidDataSource, `dataSources[${i}]`, `${raw['of']} and ${raw['within']} are different content types`);
14700
15391
  });
15392
+ return sources;
14701
15393
  }
14702
- /** M7: what every picture made for the site shares — a known world and its five parts (`artDirectionIssues`). */
14703
- function validateArtDirection(c, direction) {
14704
- if (direction === undefined)
14705
- return;
14706
- if (isPlainObject(direction))
14707
- c.keys(direction, ART_DIRECTION_KEYS, 'artDirection');
14708
- for (const issue of artDirectionIssues(direction)) {
14709
- c.add(issue.path ? SitePlanIssueCode.ArtDirection : SitePlanIssueCode.Shape, issue.path ? `artDirection.${issue.path}` : 'artDirection', issue.message);
14710
- }
14711
- }
14712
- function validatePageSeo(c, seo, path) {
14713
- if (seo === undefined)
14714
- return;
14715
- if (!isPlainObject(seo))
14716
- return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
14717
- c.keys(seo, PAGE_SEO_KEYS, path);
14718
- const limits = { title: SEO_TITLE_MAX, description: SEO_DESCRIPTION_MAX };
14719
- for (const key of PAGE_SEO_KEYS) {
14720
- const value = c.string(seo, key, path, false);
14721
- if (value && value.length > limits[key])
14722
- c.add(SitePlanIssueCode.InvalidSeo, `${path}.${key}`, `${value.length} characters — a search result shows ${limits[key]}`);
15394
+ /** A shop source (derived — `derivedShopSources` — so a bad one is the plan's own writing): a list of the shop or one row of
15395
+ * it by its slug. Returns the route param it is looked up by. */
15396
+ function validateShopSource(c, raw, path) {
15397
+ c.keys(raw, SHOP_SOURCE_KEYS, path);
15398
+ const mode = raw['mode'];
15399
+ if (mode !== PlanDataSourceMode.Query && mode !== PlanDataSourceMode.Single)
15400
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.mode`, `must be "${PlanDataSourceMode.Query}" or "${PlanDataSourceMode.Single}"`);
15401
+ if (!isShopResource(raw['resource']))
15402
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.resource`, `must be one of ${Object.values(ShopResource).join(', ')}`);
15403
+ if (raw['limit'] !== undefined && (!Number.isInteger(raw['limit']) || raw['limit'] < 1))
15404
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.limit`, 'must be a positive whole number');
15405
+ const byRoute = raw['filterByRouteParam'];
15406
+ if (byRoute === undefined)
15407
+ return undefined;
15408
+ if (!isPlainObject(byRoute)) {
15409
+ c.add(SitePlanIssueCode.Shape, `${path}.filterByRouteParam`, 'must be an object');
15410
+ return undefined;
14723
15411
  }
15412
+ c.keys(byRoute, ['field', 'routeParam'], `${path}.filterByRouteParam`);
15413
+ const field = c.string(byRoute, 'field', `${path}.filterByRouteParam`);
15414
+ const routeParam = c.string(byRoute, 'routeParam', `${path}.filterByRouteParam`) ?? undefined;
15415
+ if (field && field !== SHOP_SLUG_FIELD)
15416
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam.field`, `a shop row is looked up by its ${SHOP_SLUG_FIELD}`);
15417
+ if (mode !== PlanDataSourceMode.Single)
15418
+ c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam`, 'only a single source is looked up by a route param');
15419
+ return routeParam;
14724
15420
  }
14725
- /** The plan's `$siblings.next` source of `routeSource` — what a pattern's `next.*` reads. */
14726
- function nextSourceOf(sources, routeSource) {
14727
- for (const [alias, s] of sources)
14728
- if (s.type === PlanDataSourceType.Relative && s.of === routeSource && s.op === RelativeOp.SiblingsNext)
14729
- return alias;
14730
- return null;
14731
- }
14732
- function validateGlobals(c, globals) {
14733
- if (!isPlainObject(globals))
14734
- return c.add(SitePlanIssueCode.Shape, 'globals', 'must be an object');
14735
- c.keys(globals, Object.values(GlobalSlot), 'globals');
14736
- for (const slot of Object.values(GlobalSlot)) {
14737
- const id = c.string(globals, slot, 'globals');
14738
- const pattern = patternById(id);
14739
- if (id && !pattern)
14740
- c.add(SitePlanIssueCode.UnknownPattern, `globals.${slot}`, `no pattern "${id}"`);
14741
- else if (pattern && pattern.global !== GLOBAL_POSITION[slot])
14742
- c.add(SitePlanIssueCode.GlobalPattern, `globals.${slot}`, `"${id}" is not a ${slot} pattern`);
15421
+ /**
15422
+ * Commerce C-D21: what the business sells — up to six products by name, each in one of the categories, how each varies;
15423
+ * never a price, a stock count or a fee (the owner sets those, shop-aware §3i). A selling business must say what it
15424
+ * sells, one that sells nothing holds no shop, and a shop list is never a content type's name (its collection is the
15425
+ * shop's). Returns whether the plan sells.
15426
+ */
15427
+ function validateShop(c, plan, ctx) {
15428
+ c.array(plan, 'contentTypes', '').forEach((t, i) => {
15429
+ if (isPlainObject(t) && isShopResource(t['name']))
15430
+ c.add(SitePlanIssueCode.Shop, `contentTypes[${i}].name`, `"${t['name']}" is the shop's own list — what the business sells goes in shop, never a content type`);
15431
+ });
15432
+ const shop = plan['shop'];
15433
+ const sells = planSells(plan);
15434
+ if (ctx.sells === true && !sells)
15435
+ c.add(SitePlanIssueCode.Shop, 'shop', `this business sells — name what (1–${SHOP_PRODUCTS_MAX} products, each in a category)`);
15436
+ if (ctx.sells === false && shop !== undefined)
15437
+ c.add(SitePlanIssueCode.Shop, 'shop', 'this business sells nothing online — no shop');
15438
+ if (!sells) {
15439
+ c.array(plan, 'dataSources', '').forEach((d, i) => {
15440
+ if (isPlainObject(d) && d['type'] === PlanDataSourceType.Shop)
15441
+ c.add(SitePlanIssueCode.Shop, `dataSources[${i}]`, 'a shop source on a plan that sells nothing');
15442
+ });
14743
15443
  }
14744
- }
14745
- /** Check a Site Plan against the plan shape and the pattern library. Never throws, never repairs. */
14746
- function validateSitePlan(plan, ctx = {}) {
14747
- const c = new Collector$1();
14748
- if (!isPlainObject(plan)) {
14749
- c.add(SitePlanIssueCode.Shape, '', 'a site plan is an object');
14750
- return { valid: false, issues: c.issues };
15444
+ if (shop === undefined)
15445
+ return sells;
15446
+ if (!isPlainObject(shop)) {
15447
+ c.add(SitePlanIssueCode.Shape, 'shop', 'must be an object');
15448
+ return false;
14751
15449
  }
14752
- c.keys(plan, PLAN_KEYS, '');
14753
- if (plan['version'] !== SITE_PLAN_VERSION)
14754
- c.add(SitePlanIssueCode.Version, 'version', `must be "${SITE_PLAN_VERSION}"`);
14755
- validateSource(c, plan['source']);
14756
- validateBusiness(c, plan['business']);
14757
- validateLocale(c, plan['locale']);
14758
- validateDesign(c, plan['design']);
14759
- const types = validateContentTypes(c, c.array(plan, 'contentTypes', ''));
14760
- const sources = validateDataSources(c, c.array(plan, 'dataSources', ''), types);
14761
- const sells = validateShop(c, plan, ctx);
14762
- const design = isPlainObject(plan['design']) ? plan['design'] : {};
14763
- validatePages(c, c.array(plan, 'pages', ''), withShopTypes(types, sources), sources, typeof design['density'] === 'string' ? design['density'] : null);
14764
- if (sells)
14765
- validateProductPage(c, c.array(plan, 'pages', ''), sources);
14766
- validateGlobals(c, plan['globals']);
14767
- validateScenes(c, c.array(plan, 'pages', ''), typeof design['animate'] === 'string' ? design['animate'] : null);
14768
- validateFilm(c, plan['film'], c.array(plan, 'pages', ''));
14769
- validateArtDirection(c, plan['artDirection']);
14770
- validateDirection(c, plan['direction']);
14771
- validateComposed(c, c.array(plan, 'pages', ''));
14772
- return { valid: c.issues.length === 0, issues: c.issues };
14773
- }
14774
- /** M8 gate 2: the direction is whole — three sentences and up to three rules — or absent. */
14775
- function validateDirection(c, direction) {
14776
- if (direction === undefined)
14777
- return;
14778
- if (!isPlainObject(direction))
14779
- return c.add(SitePlanIssueCode.Shape, 'direction', 'must be an object');
14780
- c.keys(direction, DIRECTION_KEYS, 'direction');
14781
- for (const key of ['idea', 'cliche', 'flip'])
14782
- if (!isNonEmptyString(direction[key]))
14783
- c.add(SitePlanIssueCode.Direction, `direction.${key}`, 'one sentence');
14784
- const rules = direction['rules'];
14785
- if (!Array.isArray(rules) || !rules.length || rules.length > DIRECTION_RULES_MAX || !rules.every(isNonEmptyString)) {
14786
- c.add(SitePlanIssueCode.Direction, 'direction.rules', `1–${DIRECTION_RULES_MAX} short rules`);
14787
- }
14788
- }
14789
- /**
14790
- * M8 gate 2: the composed pages. The home page and at most one other, never a per-item page (its words come from the
14791
- * item); a layout only on a page marked `compose`, its dial one of the dials and 4–8 sections (the rest is `checkLayout`'s
14792
- * — the plan stage runs it with the photos, `layoutIssues` on a whole plan).
14793
- */
14794
- function validateComposed(c, pages) {
14795
- let composed = 0;
14796
- pages.forEach((raw, i) => {
15450
+ c.keys(shop, SHOP_KEYS, 'shop');
15451
+ const categories = c.array(shop, 'categories', 'shop');
15452
+ categories.forEach((name, i) => { if (!isNonEmptyString(name))
15453
+ c.add(SitePlanIssueCode.Shape, `shop.categories[${i}]`, 'must be a name'); });
15454
+ c.unique(categories.map(n => (isNonEmptyString(n) ? n : null)), i => `shop.categories[${i}]`, 'category');
15455
+ const products = c.array(shop, 'products', 'shop');
15456
+ if (!products.length)
15457
+ c.add(SitePlanIssueCode.Shop, 'shop.products', 'name what the business sells, or hold no shop');
15458
+ if (products.length > SHOP_PRODUCTS_MAX)
15459
+ c.add(SitePlanIssueCode.Shop, 'shop.products', `${products.length} products — at most ${SHOP_PRODUCTS_MAX} samples`);
15460
+ const price = (path, text) => {
15461
+ if (typeof text === 'string' && pricesIn(text).length)
15462
+ c.add(SitePlanIssueCode.Price, path, `"${pricesIn(text)[0]}" — never a price, stock or fee: the owner sets those`);
15463
+ };
15464
+ products.forEach((raw, i) => {
15465
+ const path = `shop.products[${i}]`;
14797
15466
  if (!isPlainObject(raw))
14798
- return;
14799
- const path = `pages[${i}]`;
14800
- c.boolean(raw, 'compose', path);
14801
- const compose = raw['compose'] === true;
14802
- if (compose) {
14803
- composed++;
14804
- if (raw['template'] !== undefined || raw['routeSource'] !== undefined || (typeof raw['route'] === 'string' && routeParams(raw['route']).length)) {
14805
- c.add(SitePlanIssueCode.Compose, `${path}.compose`, 'a per-item page shows its item from patterns — it is not composed');
14806
- }
14807
- }
14808
- const layout = raw['layout'];
14809
- if (layout === undefined)
14810
- return;
14811
- if (!compose)
14812
- c.add(SitePlanIssueCode.Compose, `${path}.layout`, 'a layout only on a page marked compose');
14813
- if (!isPlainObject(layout))
14814
- return c.add(SitePlanIssueCode.Shape, `${path}.layout`, 'must be an object');
14815
- c.keys(layout, LAYOUT_PAGE_KEYS, `${path}.layout`);
14816
- if (!LAYOUT_DIALS.includes(String(layout['dial'])))
14817
- c.add(SitePlanIssueCode.Layout, `${path}.layout.dial`, LAYOUT_DIALS.join(' | '));
14818
- if (!Array.isArray(layout['sections']))
14819
- c.add(SitePlanIssueCode.Shape, `${path}.layout.sections`, 'must be an array');
15467
+ return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
15468
+ c.keys(raw, SHOP_PRODUCT_KEYS, path);
15469
+ price(`${path}.name`, c.string(raw, 'name', path));
15470
+ const category = c.string(raw, 'category', path);
15471
+ if (category && !categories.includes(category))
15472
+ c.add(SitePlanIssueCode.Shop, `${path}.category`, `"${category}" is not one of the shop's categories`);
15473
+ const description = raw['description'];
15474
+ if (typeof description !== 'string')
15475
+ c.add(SitePlanIssueCode.Shape, `${path}.description`, 'must be a string (one line)');
15476
+ else
15477
+ price(`${path}.description`, description);
15478
+ const options = c.array(raw, 'options', path);
15479
+ options.forEach((o, j) => {
15480
+ const op = `${path}.options[${j}]`;
15481
+ if (!isPlainObject(o))
15482
+ return c.add(SitePlanIssueCode.Shape, op, 'must be an object');
15483
+ c.keys(o, SHOP_OPTION_KEYS, op);
15484
+ c.string(o, 'name', op);
15485
+ const values = c.array(o, 'values', op);
15486
+ if (!values.length)
15487
+ c.add(SitePlanIssueCode.Shop, `${op}.values`, 'an option names its values (sizes, colours…)');
15488
+ values.forEach((v, k) => { if (!isNonEmptyString(v))
15489
+ c.add(SitePlanIssueCode.Shape, `${op}.values[${k}]`, 'must be a name');
15490
+ else
15491
+ price(`${op}.values[${k}]`, v); });
15492
+ c.unique(values.map(v => (isNonEmptyString(v) ? v : null)), k => `${op}.values[${k}]`, 'value');
15493
+ });
15494
+ c.unique(options.map(o => (isPlainObject(o) && isNonEmptyString(o['name']) ? o['name'] : null)), j => `${path}.options[${j}].name`, 'option');
14820
15495
  });
14821
- if (composed > COMPOSED_PAGES_MAX)
14822
- c.add(SitePlanIssueCode.Compose, 'pages', `${composed} composed pages — the home page and at most ${COMPOSED_PAGES_MAX - 1} other`);
15496
+ c.unique(products.map(p => (isPlainObject(p) && isNonEmptyString(p['name']) ? p['name'] : null)), i => `shop.products[${i}].name`, 'product');
15497
+ return sells;
14823
15498
  }
14824
- /** The plan's content types and, for each shop list a source reads, the shop's own (fixed fields and roles). */
14825
- function withShopTypes(types, sources) {
14826
- const out = new Map(types);
14827
- for (const s of sources.values()) {
14828
- if (s.type !== PlanDataSourceType.Shop || !isShopResource(s.contentType) || out.has(s.contentType))
14829
- continue;
14830
- const shop = shopContentType(s.contentType);
14831
- out.set(s.contentType, { fields: new Set(shop.fields.map(f => f.name)), described: shop.fields.map(f => ({ ...f })), roles: { ...shop.roles } });
15499
+ /** A selling site has a product page: a page whose route item is the shop's one product (`/shop/:slug`). */
15500
+ function validateProductPage(c, pages, sources) {
15501
+ const hasProductPage = pages.some(p => {
15502
+ const source = isPlainObject(p) && typeof p['routeSource'] === 'string' ? sources.get(p['routeSource']) : undefined;
15503
+ return source?.type === PlanDataSourceType.Shop && source.mode === PlanDataSourceMode.Single && source.contentType === ShopResource.Products;
15504
+ });
15505
+ if (!hasProductPage) {
15506
+ const item = [...sources].find(([, s]) => s.type === PlanDataSourceType.Shop && s.mode === PlanDataSourceMode.Single)?.[0] ?? 'product';
15507
+ c.add(SitePlanIssueCode.ProductPage, 'pages', `this site sells — it needs a product page: a page at /shop/:slug whose routeSource is "${item}" and template "${ShopResource.Products}"`);
14832
15508
  }
14833
- return out;
14834
15509
  }
14835
- /** Throw a `SitePlanError` carrying every issue unless the plan is valid. */
14836
- function assertValidSitePlan(plan) {
14837
- const result = validateSitePlan(plan);
14838
- if (!result.valid)
14839
- throw new SitePlanError(result.issues);
14840
- }
14841
- /**
14842
- * A plan's pages against their page types (L0-2): every required slot filled, every section of a family the type takes.
14843
- * NOT part of `validateSitePlan` — a page type is what the model READS to give a page its shape, and the plan stage
14844
- * holds the model's plan to it; the owner may then make any page their own (merge About into Contact, drop the
14845
- * closing band), which the gate must not refuse. Pure; issues carry the same paths.
14846
- */
14847
- function archetypeIssues(plan) {
14848
- const c = new Collector$1();
14849
- plan.pages.forEach((page, i) => {
14850
- const type = page.archetype ? PAGE_ARCHETYPES[page.archetype] : undefined;
14851
- if (!type)
14852
- return;
14853
- const families = page.sections.map(s => patternById(s.pattern)?.family ?? '');
14854
- for (const slot of type.slots) {
14855
- if (slot.required && !families.some(f => slot.families.includes(f))) {
14856
- c.add(SitePlanIssueCode.Archetype, `pages[${i}].sections`, `a ${page.archetype} page needs a ${slot.label} section (${slot.families.join(' / ')})`);
15510
+ function validatePages(c, list, types, sources, density) {
15511
+ const homes = [];
15512
+ const routes = new Set(list.map(p => (isPlainObject(p) && typeof p['route'] === 'string' ? p['route'] : null)).filter((r) => !!r));
15513
+ list.forEach((raw, i) => {
15514
+ const path = `pages[${i}]`;
15515
+ if (!isPlainObject(raw))
15516
+ return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
15517
+ c.keys(raw, PAGE_KEYS, path);
15518
+ const key = c.string(raw, 'key', path);
15519
+ if (key && Object.values(GlobalSlot).includes(key)) {
15520
+ c.add(SitePlanIssueCode.ReservedPageKey, `${path}.key`, `"${key}" names the site's ${key} — a page's sections would share its ids`);
15521
+ }
15522
+ c.string(raw, 'name', path);
15523
+ for (const key of ['isHome', 'required', 'inNav'])
15524
+ c.boolean(raw, key, path);
15525
+ const route = c.string(raw, 'route', path);
15526
+ if (route && !ROUTE.test(route))
15527
+ c.add(SitePlanIssueCode.InvalidRoute, `${path}.route`, `"${route}" is not a route (/lowercase-words, :params)`);
15528
+ if (raw['isHome'] === true) {
15529
+ homes.push(i);
15530
+ if (route !== '/')
15531
+ c.add(SitePlanIssueCode.Home, `${path}.route`, 'the home page lives at /');
15532
+ }
15533
+ else if (route === '/')
15534
+ c.add(SitePlanIssueCode.Home, `${path}.isHome`, 'the page at / is the home page');
15535
+ const params = route ? routeParams(route) : [];
15536
+ const template = c.string(raw, 'template', path, false);
15537
+ const routeSourceAlias = c.string(raw, 'routeSource', path, false);
15538
+ const routeSource = routeSourceAlias ? sources.get(routeSourceAlias) : undefined;
15539
+ const routeSourceOk = isItemSource(routeSource);
15540
+ if (template && !types.has(template))
15541
+ c.add(SitePlanIssueCode.UnknownContentType, `${path}.template`, `no content type "${template}" in the plan`);
15542
+ if (params.length > 1)
15543
+ c.add(SitePlanIssueCode.InvalidRoute, `${path}.route`, 'a template page has one route param');
15544
+ if (params.length && !routeSourceAlias)
15545
+ c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `a route with :${params[0]} names the source that reads it`);
15546
+ if (routeSourceAlias) {
15547
+ if (!routeSourceOk) {
15548
+ c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" must be a single source of the plan`);
15549
+ }
15550
+ else {
15551
+ if (!params.length || routeSource.routeParam !== params[0])
15552
+ c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" is not looked up by this route's param`);
15553
+ if (template && routeSource.contentType !== template)
15554
+ c.add(SitePlanIssueCode.RouteSource, `${path}.template`, `"${routeSourceAlias}" reads ${routeSource.contentType}, not ${template}`);
14857
15555
  }
14858
15556
  }
14859
- families.forEach((family, j) => {
14860
- if (!type.slots.some(slot => slot.families.includes(family)))
14861
- c.add(SitePlanIssueCode.Archetype, `pages[${i}].sections[${j}]`, `a ${family} section does not belong on a ${page.archetype} page`);
14862
- });
14863
- });
14864
- return c.issues;
14865
- }
14866
-
14867
- /**
14868
- * How animated (AI plan rev 3.1 §3p) — the ONE reading of the contract's `axes.animations` (what each level
14869
- * moves, how) and `axes.animationFamilies` (which parts a section family lets move). The pieces every stamper
14870
- * shares: the Design step's business specimen (H4-4) and `planEntrances`, which the composer runs per section (M1-6b).
14871
- * When an entrance plays — a static item's literal delay, a Repeater row's share — is design-core's `staggerDelay` /
14872
- * `entranceDelay`, which both interaction runtimes read too. Pure.
14873
- *
14874
- * A level with `content` moves a section's content together, once; otherwise it names parts (heading, items,
14875
- * media…) and each part enters on its own, items one after another. Navigation, footers and globals are a family
14876
- * with no parts, so nothing there ever moves.
14877
- */
14878
- var EntrancePart;
14879
- (function (EntrancePart) {
14880
- EntrancePart["Content"] = "content";
14881
- EntrancePart["Heading"] = "heading";
14882
- EntrancePart["Items"] = "items";
14883
- EntrancePart["Media"] = "media";
14884
- EntrancePart["RowMedia"] = "rowMedia";
14885
- EntrancePart["HeroText"] = "heroText";
14886
- })(EntrancePart || (EntrancePart = {}));
14887
- /** What an entrance stamp is marked with — a later restamp touches only what the look made (H4-5). */
14888
- const ENTRANCE_ORIGIN_LOOK = 'look';
14889
- /** The trigger every entrance plays on. */
14890
- const ENTRANCE_TRIGGER = 'viewportEnter';
14891
- /** The easing every entrance plays with (only `opacity` and `transform` move). */
14892
- const ENTRANCE_EASING = 'ease-out';
14893
- const LEVELS = SPEC_AXES.animations;
14894
- const FAMILIES = SPEC_AXES.animationFamilies;
14895
- const NOTHING = { content: null, parts: {} };
14896
- /** What a section of `family` moves at `level` — nothing for an unknown level or family. */
14897
- function sectionEntrances(level, family) {
14898
- const lv = level ? LEVELS[level] : undefined;
14899
- const allow = FAMILIES[family] ?? [];
14900
- if (!lv || !allow.length)
14901
- return NOTHING;
14902
- if (lv.parts.content && allow.includes(EntrancePart.Content))
14903
- return { content: lv.parts.content, parts: {} };
14904
- const parts = {};
14905
- for (const part of allow) {
14906
- if (part === EntrancePart.Content)
14907
- continue;
14908
- // A level without its own side-by-side entrance gives a row's picture the plain picture one.
14909
- const spec = lv.parts[part] ?? (part === EntrancePart.RowMedia ? lv.parts.media : undefined);
14910
- if (spec)
14911
- parts[part] = spec;
14912
- }
14913
- return { content: null, parts };
14914
- }
14915
- /** Which side of its row a picture sits on (`rowMedia`): an end-side picture enters from the end. */
14916
- var EntranceSide;
14917
- (function (EntranceSide) {
14918
- EntranceSide["Start"] = "start";
14919
- EntranceSide["End"] = "end";
14920
- })(EntranceSide || (EntranceSide = {}));
14921
- /** The action a node plays: the spec's type (mirrored for a start-side picture and on a right-to-left page — both
14922
- * together cancel out), its distance, and its delay (or, for a Repeater's rows, the stagger the runtime adds). */
14923
- function entranceAction(spec, opts = {}) {
14924
- const mirrored = (opts.side === EntranceSide.Start) !== !!opts.rtl;
14925
- const params = {};
14926
- if (spec.distance)
14927
- params[EntranceParam.Distance] = spec.distance;
14928
- if (opts.repeated && spec.stagger) {
14929
- params[EntranceParam.Stagger] = spec.stagger;
14930
- params[EntranceParam.Cap] = spec.cap ?? 1;
14931
- }
14932
- return {
14933
- type: mirrored && spec.mirror ? spec.mirror : spec.type,
14934
- target: 'self',
14935
- duration: spec.duration,
14936
- delay: opts.repeated ? 0 : staggerDelay(spec, opts.index),
14937
- easing: ENTRANCE_EASING,
14938
- once: true,
14939
- ...(Object.keys(params).length ? { params } : {}),
14940
- };
15557
+ const archetype = c.string(raw, 'archetype', path, false);
15558
+ if (archetype && !has$1(PAGE_ARCHETYPES, archetype))
15559
+ c.add(SitePlanIssueCode.Archetype, `${path}.archetype`, `"${archetype}" is not a page type (${Object.keys(PAGE_ARCHETYPES).join(', ')})`);
15560
+ validatePageSeo(c, raw['seo'], `${path}.seo`);
15561
+ const need = c.string(raw, 'need', path, false);
15562
+ if (need && !SITE_NEED_IDS.includes(need))
15563
+ c.add(SitePlanIssueCode.UnknownNeed, `${path}.need`, `"${need}" is not a need (${SITE_NEED_IDS.join(', ')})`);
15564
+ c.array(raw, 'sections', path).forEach((s, j) => {
15565
+ const sp = `${path}.sections[${j}]`;
15566
+ if (!isPlainObject(s))
15567
+ return c.add(SitePlanIssueCode.Shape, sp, 'must be an object');
15568
+ c.keys(s, SECTION_KEYS, sp);
15569
+ const patternId = c.string(s, 'pattern', sp);
15570
+ const pattern = patternById(patternId);
15571
+ if (patternId && !pattern)
15572
+ return c.add(SitePlanIssueCode.UnknownPattern, `${sp}.pattern`, `no pattern "${patternId}"`);
15573
+ if (!pattern)
15574
+ return;
15575
+ if (pattern.global)
15576
+ c.add(SitePlanIssueCode.GlobalPattern, `${sp}.pattern`, `"${patternId}" is a header/footer pattern (globals)`);
15577
+ const slots = s['slots'];
15578
+ if (slots !== undefined) {
15579
+ if (!isPlainObject(slots))
15580
+ c.add(SitePlanIssueCode.Shape, `${sp}.slots`, 'must be an object');
15581
+ else {
15582
+ const declared = patternSlots(pattern);
15583
+ for (const [slot, value] of Object.entries(slots)) {
15584
+ if (!declared.includes(slot))
15585
+ c.add(SitePlanIssueCode.UnknownSlot, `${sp}.slots.${slot}`, `"${patternId}" has no slot "${slot}" (${declared.join(', ') || 'none'})`);
15586
+ else if (typeof value !== 'string')
15587
+ c.add(SitePlanIssueCode.Shape, `${sp}.slots.${slot}`, 'must be a string');
15588
+ else {
15589
+ const budget = slotBudget(pattern, slot, density);
15590
+ if (budget !== null && value.length > budget)
15591
+ c.add(SitePlanIssueCode.SlotTooLong, `${sp}.slots.${slot}`, `${value.length} characters — the slot holds ${budget} at the ${density ?? 'regular'} density`);
15592
+ }
15593
+ }
15594
+ }
15595
+ }
15596
+ const links = s['links'];
15597
+ if (links !== undefined) {
15598
+ if (!isPlainObject(links))
15599
+ c.add(SitePlanIssueCode.Shape, `${sp}.links`, 'must be an object');
15600
+ else {
15601
+ const linkSlots = patternLinkSlots(pattern);
15602
+ for (const [slot, route] of Object.entries(links)) {
15603
+ if (!linkSlots.includes(slot))
15604
+ c.add(SitePlanIssueCode.InvalidLink, `${sp}.links.${slot}`, `"${patternId}" has no linked slot "${slot}" (${linkSlots.join(', ') || 'none'})`);
15605
+ else if (typeof route !== 'string' || !routes.has(route) || routeParams(route).length)
15606
+ c.add(SitePlanIssueCode.InvalidLink, `${sp}.links.${slot}`, `"${String(route)}" is not a page route of the plan`);
15607
+ }
15608
+ }
15609
+ }
15610
+ const form = c.string(s, 'form', sp, false);
15611
+ if (form && !patternHasForm(pattern))
15612
+ c.add(SitePlanIssueCode.InvalidForm, `${sp}.form`, `"${patternId}" holds no form`);
15613
+ else if (form && !formPresetById(form))
15614
+ c.add(SitePlanIssueCode.InvalidForm, `${sp}.form`, `"${form}" is not a form preset`);
15615
+ const enter = c.string(s, 'enter', sp, false);
15616
+ if (enter && !has$1(SPEC_AXES.animations, enter))
15617
+ c.add(SitePlanIssueCode.InvalidEnter, `${sp}.enter`, `must be one of ${Object.keys(SPEC_AXES.animations).join(', ')}`);
15618
+ const without = s['without'];
15619
+ if (without !== undefined) {
15620
+ const parts = patternOptionalParts(pattern);
15621
+ if (!Array.isArray(without))
15622
+ c.add(SitePlanIssueCode.Shape, `${sp}.without`, 'must be an array');
15623
+ else
15624
+ without.forEach((w, k) => {
15625
+ if (!parts.includes(w))
15626
+ c.add(SitePlanIssueCode.UnknownOptionalPart, `${sp}.without[${k}]`, `"${patternId}" has no optional part "${String(w)}"`);
15627
+ });
15628
+ }
15629
+ const binding = c.string(s, 'binding', sp, false);
15630
+ if (patternTakesBinding(pattern)) {
15631
+ if (!binding) {
15632
+ if (patternNeedsBinding(pattern))
15633
+ c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" repeats the section's binding — name a list source`);
15634
+ }
15635
+ else {
15636
+ const src = sources.get(binding);
15637
+ if (!src)
15638
+ c.add(SitePlanIssueCode.UnknownDataSource, `${sp}.binding`, `no data source "${binding}"`);
15639
+ else if (!isListSource(src))
15640
+ c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${binding}" is not a list source`);
15641
+ else {
15642
+ const listed = src.contentType ? types.get(src.contentType) : undefined;
15643
+ const gap = listed ? patternListGap(pattern, listed.described) : null;
15644
+ if (gap)
15645
+ c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${binding}" lists ${src.contentType}, which has no ${gap} — bind "${patternId}" to a list that has${patternNeedsBinding(pattern) ? '' : ', or to none'}`);
15646
+ }
15647
+ }
15648
+ }
15649
+ else if (binding)
15650
+ c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" repeats nothing — it takes no binding`);
15651
+ // Commerce G1: a store section reads the shop — its list from a shop source, its product from the page's.
15652
+ if (pattern.shop) {
15653
+ const listed = binding ? sources.get(binding) : undefined;
15654
+ if (listed && listed.type !== PlanDataSourceType.Shop)
15655
+ c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" shows the shop's products — bind a shop source, not "${binding}"`);
15656
+ if (patternScopes(pattern).has(BindScope.Route) && routeSourceOk && routeSource.type !== PlanDataSourceType.Shop) {
15657
+ c.add(SitePlanIssueCode.RouteSource, `${sp}.pattern`, `"${patternId}" shows one product — its page reads a shop source, not "${routeSourceAlias}"`);
15658
+ }
15659
+ }
15660
+ // A pattern reading the route item needs a routeSource (an INVALID one is reported above, once).
15661
+ const scopes = patternScopes(pattern);
15662
+ const readsRoute = scopes.has(BindScope.Route) || scopes.has(BindScope.Next);
15663
+ if (readsRoute && !routeSourceAlias) {
15664
+ c.add(SitePlanIssueCode.MissingScope, `${sp}.pattern`, `"${patternId}" reads the route item — the page needs a routeSource`);
15665
+ }
15666
+ if (scopes.has(BindScope.Next) && routeSourceOk && !nextSourceOf(sources, routeSourceAlias)) {
15667
+ c.add(SitePlanIssueCode.MissingScope, `${sp}.pattern`, `"${patternId}" reads the next item — the plan needs a ${RelativeOp.SiblingsNext} source of ${routeSourceAlias}`);
15668
+ }
15669
+ // L0-3: the roles a pattern reads must be roles of the item's type — the section's list (`item`), the route
15670
+ // item (`route`) or its next sibling (`next`, the same type). An optional one (`@image?`) is only left out.
15671
+ for (const need of patternRoleNeeds(pattern)) {
15672
+ if (need.optional)
15673
+ continue;
15674
+ const alias = need.scope === BindScope.Item ? binding : routeSourceOk ? routeSourceAlias : null;
15675
+ const typeName = alias ? sources.get(alias)?.contentType : undefined;
15676
+ const type = typeName ? types.get(typeName) : undefined;
15677
+ if (type && !type.roles[need.role]) {
15678
+ c.add(SitePlanIssueCode.MissingRole, `${sp}.pattern`, `"${patternId}" shows each ${typeName} item's ${need.role} — ${typeName} names no ${need.role} field (roles.${need.role})`);
15679
+ }
15680
+ }
15681
+ });
15682
+ });
15683
+ c.unique(list.map(p => (isPlainObject(p) && isNonEmptyString(p['key']) ? p['key'] : null)), i => `pages[${i}].key`, 'page key');
15684
+ c.unique(list.map(p => (isPlainObject(p) && isNonEmptyString(p['route']) ? p['route'] : null)), i => `pages[${i}].route`, 'route');
15685
+ if (homes.length !== 1)
15686
+ c.add(SitePlanIssueCode.Home, 'pages', `exactly one page is the home page (found ${homes.length})`);
14941
15687
  }
14942
- /** The stamp on a node: `viewportEnter`, once, on itself (a duplicated node needs no remap), from the look. */
14943
- function entranceInteraction(nodeId, action) {
14944
- return { id: `${nodeId}-enter`, trigger: ENTRANCE_TRIGGER, actions: [action], origin: ENTRANCE_ORIGIN_LOOK };
15688
+ /** SC6 (premium-sites plan, APPROVED 2026-11-05): who may hold the page — Scenes only at Expressive, one per page, on the
15689
+ * home page and at most one other. A Scene past that is an issue at its pattern, so the pages choose another. */
15690
+ function validateScenes(c, pages, animate) {
15691
+ let otherPages = 0;
15692
+ pages.forEach((raw, i) => {
15693
+ if (!isPlainObject(raw) || !Array.isArray(raw['sections']))
15694
+ return;
15695
+ let onPage = 0;
15696
+ const counted = raw['isHome'] === true;
15697
+ raw['sections'].forEach((s, j) => {
15698
+ const pattern = isPlainObject(s) && typeof s['pattern'] === 'string' ? patternById(s['pattern']) : null;
15699
+ if (!pattern?.scene)
15700
+ return;
15701
+ const at = `pages[${i}].sections[${j}].pattern`;
15702
+ if (animate !== SCENE_LEVEL)
15703
+ return c.add(SitePlanIssueCode.SceneBudget, at, `"${s['pattern']}" holds the page as it scrolls — only on a site whose How animated is Expressive (this one is ${animate ?? 'unset'})`);
15704
+ if (++onPage > 1)
15705
+ return c.add(SitePlanIssueCode.SceneBudget, at, 'one Scene per page — choose a section that does not hold the page');
15706
+ if (!counted && onPage === 1 && ++otherPages > SCENE_OTHER_PAGES)
15707
+ c.add(SitePlanIssueCode.SceneBudget, at, `Scenes on the home page and at most ${SCENE_OTHER_PAGES} other page — choose a section that does not hold the page`);
15708
+ });
15709
+ });
14945
15710
  }
14946
- /**
14947
- * The entrances a composed section gets (AI plan §3p, M1-6b): a level that moves the CONTENT fades the pattern's
14948
- * `content` marks — else every child of the section — together, once; otherwise each marked part its family allows
14949
- * enters on its own (static items a literal delay apart, a Repeater's rows by the runtime), a row picture from its side.
14950
- * Nothing for a header or footer family, Still, or an unknown level. Pure.
14951
- */
14952
- function planEntrances(input) {
14953
- const plan = sectionEntrances(input.level, input.family);
14954
- const stamp = (nodeId, spec, opts) => ({ nodeId, interaction: entranceInteraction(nodeId, entranceAction(spec, { ...opts, rtl: input.rtl })) });
14955
- if (plan.content) {
14956
- const marked = input.marks.filter(m => m.part === EntrancePart.Content).map(m => m.nodeId);
14957
- return (marked.length ? marked : input.contentIds).map(id => stamp(id, plan.content, {}));
15711
+ /** SC6b: a film plays only when its pictures can (and smoothly over the shortest hold); its pattern only with a film, once. */
15712
+ function validateFilm(c, film, pages) {
15713
+ let playable = false;
15714
+ if (film !== undefined) {
15715
+ if (!isPlainObject(film)) {
15716
+ c.add(SitePlanIssueCode.Shape, 'film', 'must be an object');
15717
+ }
15718
+ else {
15719
+ c.keys(film, FILM_KEYS, 'film');
15720
+ const sequence = normalizeFrameSequence(film['sequence']);
15721
+ if (!sequence)
15722
+ c.add(SitePlanIssueCode.Film, 'film.sequence', 'not a film\'s pictures (a media-core FrameSequence)');
15723
+ else if (filmScreensFor(sequence.wide.count) === null)
15724
+ c.add(SitePlanIssueCode.Film, 'film.sequence', `${sequence.wide.count} pictures — too few to play smoothly`);
15725
+ else
15726
+ playable = true;
15727
+ }
14958
15728
  }
14959
- return input.marks.flatMap(m => {
14960
- const spec = m.part === EntrancePart.Content ? undefined : plan.parts[m.part];
14961
- return spec ? [stamp(m.nodeId, spec, { index: m.index, repeated: m.repeated, side: m.side })] : [];
15729
+ let placed = 0;
15730
+ pages.forEach((raw, i) => {
15731
+ if (!isPlainObject(raw) || !Array.isArray(raw['sections']))
15732
+ return;
15733
+ raw['sections'].forEach((s, j) => {
15734
+ const pattern = isPlainObject(s) && typeof s['pattern'] === 'string' ? patternById(s['pattern']) : null;
15735
+ if (!pattern?.film)
15736
+ return;
15737
+ const path = `pages[${i}].sections[${j}].pattern`;
15738
+ if (!playable)
15739
+ c.add(SitePlanIssueCode.Film, path, `"${s['pattern']}" plays the owner's film — this plan has none`);
15740
+ else if (++placed > 1)
15741
+ c.add(SitePlanIssueCode.Film, path, 'the film plays once on a site');
15742
+ });
14962
15743
  });
14963
15744
  }
14964
-
14965
- /**
14966
- * The owner's film on a built site (premium sites SC6b). The owner gives a video in Analysis; the wizard's browser makes
14967
- * it pictures (cms-client `FramesPrepareService`); the build places it. A model never picks the film's pattern — the
14968
- * manifest and the plan wire leave it out — so ONE pure placement decides where it goes, run by the wizard to draw the
14969
- * Plan and by the server to build: they cannot disagree.
14970
- */
14971
- /** The pattern a film plays in: the one whose Video is marked `film` in the contract. */
14972
- const FILM_PATTERN = Object.entries(SITE_PATTERNS).find(([, p]) => p.film)?.[0] ?? '';
14973
- /** Why a film stays off the site. Each is said to the owner on the Plan step. */
14974
- var FilmUnplaced;
14975
- (function (FilmUnplaced) {
14976
- /** How animated is below Expressive: no section holds the page there. */
14977
- FilmUnplaced["NotExpressive"] = "notExpressive";
14978
- /** The home page does not open with a hero to play it in. */
14979
- FilmUnplaced["NoHero"] = "noHero";
14980
- /** The home page already holds the page elsewhere (one Scene per page). */
14981
- FilmUnplaced["AnotherScene"] = "anotherScene";
14982
- /** Too few pictures to play smoothly over the shortest hold (media-core `FILM_MIN_PICTURES`). */
14983
- FilmUnplaced["TooShort"] = "tooShort";
14984
- })(FilmUnplaced || (FilmUnplaced = {}));
14985
- /** Where a film WOULD play on this plan (the Plan step asks before the pictures exist). */
14986
- function filmPlacement(plan) {
14987
- if (plan.design.animate !== SCENE_LEVEL)
14988
- return { unplaced: FilmUnplaced.NotExpressive };
14989
- const page = plan.pages.findIndex(p => p.isHome);
14990
- const sections = page >= 0 ? plan.pages[page].sections : [];
14991
- const first = patternById(sections[0]?.pattern);
14992
- if (!first || first.family !== FILM_FAMILY)
14993
- return { unplaced: FilmUnplaced.NoHero };
14994
- if (sections.slice(1).some(s => patternById(s.pattern)?.scene))
14995
- return { unplaced: FilmUnplaced.AnotherScene };
14996
- return { target: { page, section: 0 } };
15745
+ /** M7: what every picture made for the site shares — a known world and its five parts (`artDirectionIssues`). */
15746
+ function validateArtDirection(c, direction) {
15747
+ if (direction === undefined)
15748
+ return;
15749
+ if (isPlainObject(direction))
15750
+ c.keys(direction, ART_DIRECTION_KEYS, 'artDirection');
15751
+ for (const issue of artDirectionIssues(direction)) {
15752
+ c.add(issue.path ? SitePlanIssueCode.ArtDirection : SitePlanIssueCode.Shape, issue.path ? `artDirection.${issue.path}` : 'artDirection', issue.message);
15753
+ }
15754
+ }
15755
+ function validatePageSeo(c, seo, path) {
15756
+ if (seo === undefined)
15757
+ return;
15758
+ if (!isPlainObject(seo))
15759
+ return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
15760
+ c.keys(seo, PAGE_SEO_KEYS, path);
15761
+ const limits = { title: SEO_TITLE_MAX, description: SEO_DESCRIPTION_MAX };
15762
+ for (const key of PAGE_SEO_KEYS) {
15763
+ const value = c.string(seo, key, path, false);
15764
+ if (value && value.length > limits[key])
15765
+ c.add(SitePlanIssueCode.InvalidSeo, `${path}.${key}`, `${value.length} characters — a search result shows ${limits[key]}`);
15766
+ }
15767
+ }
15768
+ /** The plan's `$siblings.next` source of `routeSource` — what a pattern's `next.*` reads. */
15769
+ function nextSourceOf(sources, routeSource) {
15770
+ for (const [alias, s] of sources)
15771
+ if (s.type === PlanDataSourceType.Relative && s.of === routeSource && s.op === RelativeOp.SiblingsNext)
15772
+ return alias;
15773
+ return null;
15774
+ }
15775
+ function validateGlobals(c, globals) {
15776
+ if (!isPlainObject(globals))
15777
+ return c.add(SitePlanIssueCode.Shape, 'globals', 'must be an object');
15778
+ c.keys(globals, Object.values(GlobalSlot), 'globals');
15779
+ for (const slot of Object.values(GlobalSlot)) {
15780
+ const id = c.string(globals, slot, 'globals');
15781
+ const pattern = patternById(id);
15782
+ if (id && !pattern)
15783
+ c.add(SitePlanIssueCode.UnknownPattern, `globals.${slot}`, `no pattern "${id}"`);
15784
+ else if (pattern && pattern.global !== GLOBAL_POSITION[slot])
15785
+ c.add(SitePlanIssueCode.GlobalPattern, `globals.${slot}`, `"${id}" is not a ${slot} pattern`);
15786
+ }
15787
+ }
15788
+ /** The parts a plan may carry as a mix, and how each reads its words (only the footer until header ingredients HI1). */
15789
+ const MIX_READERS = { footer: footerMixFromWords };
15790
+ /** `mixes`: each part's words parse in its table (list ingredients LI5); absent is fine. */
15791
+ function validateMixes(c, mixes) {
15792
+ if (mixes === undefined)
15793
+ return;
15794
+ if (!isPlainObject(mixes))
15795
+ return c.add(SitePlanIssueCode.Shape, 'mixes', 'must be an object');
15796
+ c.keys(mixes, Object.keys(MIX_READERS), 'mixes');
15797
+ for (const [part, read] of Object.entries(MIX_READERS)) {
15798
+ const words = mixes[part];
15799
+ if (words === undefined)
15800
+ continue;
15801
+ if (!Array.isArray(words) || !words.every(w => typeof w === 'string')) {
15802
+ c.add(SitePlanIssueCode.Shape, `mixes.${part}`, 'a list of <ingredient>:<word> words');
15803
+ continue;
15804
+ }
15805
+ try {
15806
+ read(words);
15807
+ }
15808
+ catch (e) {
15809
+ c.add(SitePlanIssueCode.Mix, `mixes.${part}`, e.message);
15810
+ }
15811
+ }
15812
+ }
15813
+ /** Check a Site Plan against the plan shape and the pattern library. Never throws, never repairs. */
15814
+ function validateSitePlan(plan, ctx = {}) {
15815
+ const c = new Collector$1();
15816
+ if (!isPlainObject(plan)) {
15817
+ c.add(SitePlanIssueCode.Shape, '', 'a site plan is an object');
15818
+ return { valid: false, issues: c.issues };
15819
+ }
15820
+ c.keys(plan, PLAN_KEYS, '');
15821
+ if (plan['version'] !== SITE_PLAN_VERSION)
15822
+ c.add(SitePlanIssueCode.Version, 'version', `must be "${SITE_PLAN_VERSION}"`);
15823
+ validateSource(c, plan['source']);
15824
+ validateBusiness(c, plan['business']);
15825
+ validateLocale(c, plan['locale']);
15826
+ validateDesign(c, plan['design']);
15827
+ const types = validateContentTypes(c, c.array(plan, 'contentTypes', ''));
15828
+ const sources = validateDataSources(c, c.array(plan, 'dataSources', ''), types);
15829
+ const sells = validateShop(c, plan, ctx);
15830
+ const design = isPlainObject(plan['design']) ? plan['design'] : {};
15831
+ validatePages(c, c.array(plan, 'pages', ''), withShopTypes(types, sources), sources, typeof design['density'] === 'string' ? design['density'] : null);
15832
+ if (sells)
15833
+ validateProductPage(c, c.array(plan, 'pages', ''), sources);
15834
+ validateGlobals(c, plan['globals']);
15835
+ validateMixes(c, plan['mixes']);
15836
+ validateScenes(c, c.array(plan, 'pages', ''), typeof design['animate'] === 'string' ? design['animate'] : null);
15837
+ validateFilm(c, plan['film'], c.array(plan, 'pages', ''));
15838
+ validateArtDirection(c, plan['artDirection']);
15839
+ validateDirection(c, plan['direction']);
15840
+ validateComposed(c, c.array(plan, 'pages', ''));
15841
+ return { valid: c.issues.length === 0, issues: c.issues };
15842
+ }
15843
+ /** M8 gate 2: the direction is whole — three sentences and up to three rules — or absent. */
15844
+ function validateDirection(c, direction) {
15845
+ if (direction === undefined)
15846
+ return;
15847
+ if (!isPlainObject(direction))
15848
+ return c.add(SitePlanIssueCode.Shape, 'direction', 'must be an object');
15849
+ c.keys(direction, DIRECTION_KEYS, 'direction');
15850
+ for (const key of ['idea', 'cliche', 'flip'])
15851
+ if (!isNonEmptyString(direction[key]))
15852
+ c.add(SitePlanIssueCode.Direction, `direction.${key}`, 'one sentence');
15853
+ const rules = direction['rules'];
15854
+ if (!Array.isArray(rules) || !rules.length || rules.length > DIRECTION_RULES_MAX || !rules.every(isNonEmptyString)) {
15855
+ c.add(SitePlanIssueCode.Direction, 'direction.rules', `1–${DIRECTION_RULES_MAX} short rules`);
15856
+ }
14997
15857
  }
14998
- const FILM_FAMILY = SITE_PATTERNS[FILM_PATTERN]?.family ?? 'hero';
14999
15858
  /**
15000
- * The plan with the owner's film in it: `film` set, and the home page's hero becomes the film's pattern, keeping the
15001
- * hero's words and links that the film's pattern has. A film that cannot play (unreadable, too few pictures) or a plan
15002
- * with no place for it leaves the plan as it was — the hero keeps its picture, and the builder can add the film later.
15859
+ * M8 gate 2: the composed pages. The home page and at most one other, never a per-item page (its words come from the
15860
+ * item); a layout only on a page marked `compose`, its dial one of the dials and 4–8 sections (the rest is `checkLayout`'s
15861
+ * — the plan stage runs it with the photos, `layoutIssues` on a whole plan).
15003
15862
  */
15004
- function placeFilm(plan, sequence) {
15005
- const film = normalizeFrameSequence(sequence);
15006
- if (!film || filmScreensFor(film.wide.count) === null)
15007
- return { plan, unplaced: FilmUnplaced.TooShort };
15008
- const placement = filmPlacement(plan);
15009
- if (!placement.target)
15010
- return { plan, unplaced: placement.unplaced };
15011
- const { page, section } = placement.target;
15012
- const pages = plan.pages.map((p, i) => i !== page ? p : {
15013
- ...p,
15014
- sections: p.sections.map((s, j) => (j === section ? filmSection(s) : s)),
15863
+ function validateComposed(c, pages) {
15864
+ let composed = 0;
15865
+ pages.forEach((raw, i) => {
15866
+ if (!isPlainObject(raw))
15867
+ return;
15868
+ const path = `pages[${i}]`;
15869
+ c.boolean(raw, 'compose', path);
15870
+ const compose = raw['compose'] === true;
15871
+ if (compose) {
15872
+ composed++;
15873
+ if (raw['template'] !== undefined || raw['routeSource'] !== undefined || (typeof raw['route'] === 'string' && routeParams(raw['route']).length)) {
15874
+ c.add(SitePlanIssueCode.Compose, `${path}.compose`, 'a per-item page shows its item from patterns — it is not composed');
15875
+ }
15876
+ }
15877
+ const layout = raw['layout'];
15878
+ if (layout === undefined)
15879
+ return;
15880
+ if (!compose)
15881
+ c.add(SitePlanIssueCode.Compose, `${path}.layout`, 'a layout only on a page marked compose');
15882
+ if (!isPlainObject(layout))
15883
+ return c.add(SitePlanIssueCode.Shape, `${path}.layout`, 'must be an object');
15884
+ c.keys(layout, LAYOUT_PAGE_KEYS, `${path}.layout`);
15885
+ if (!LAYOUT_DIALS.includes(String(layout['dial'])))
15886
+ c.add(SitePlanIssueCode.Layout, `${path}.layout.dial`, LAYOUT_DIALS.join(' | '));
15887
+ if (!Array.isArray(layout['sections']))
15888
+ c.add(SitePlanIssueCode.Shape, `${path}.layout.sections`, 'must be an array');
15015
15889
  });
15016
- return { plan: { ...plan, pages, film: { sequence: film } } };
15890
+ if (composed > COMPOSED_PAGES_MAX)
15891
+ c.add(SitePlanIssueCode.Compose, 'pages', `${composed} composed pages — the home page and at most ${COMPOSED_PAGES_MAX - 1} other`);
15017
15892
  }
15018
- function filmSection(hero) {
15019
- const pattern = SITE_PATTERNS[FILM_PATTERN];
15020
- const slots = new Set(patternSlots(pattern));
15021
- const links = new Set(patternLinkSlots(pattern));
15022
- const keep = (values, allowed) => {
15023
- const kept = Object.entries(values ?? {}).filter(([key]) => allowed.has(key));
15024
- return kept.length ? Object.fromEntries(kept) : undefined;
15025
- };
15026
- const keptSlots = keep(hero.slots, slots);
15027
- const keptLinks = keep(hero.links, links);
15028
- return { pattern: FILM_PATTERN, ...(keptSlots ? { slots: keptSlots } : {}), ...(keptLinks ? { links: keptLinks } : {}) };
15893
+ /** The plan's content types and, for each shop list a source reads, the shop's own (fixed fields and roles). */
15894
+ function withShopTypes(types, sources) {
15895
+ const out = new Map(types);
15896
+ for (const s of sources.values()) {
15897
+ if (s.type !== PlanDataSourceType.Shop || !isShopResource(s.contentType) || out.has(s.contentType))
15898
+ continue;
15899
+ const shop = shopContentType(s.contentType);
15900
+ out.set(s.contentType, { fields: new Set(shop.fields.map(f => f.name)), described: shop.fields.map(f => ({ ...f })), roles: { ...shop.roles } });
15901
+ }
15902
+ return out;
15029
15903
  }
15030
- /** The film's pictures as the composer stamps them, and the height its Scene holds the page for. */
15031
- function filmOfPlan(plan) {
15032
- const sequence = normalizeFrameSequence(plan.film?.sequence);
15033
- const screens = sequence ? filmScreensFor(sequence.wide.count) : null;
15034
- // A Scene's root holds the page for its height less the one screen its stage fills.
15035
- return sequence && screens !== null ? { sequence, heightVh: Math.round((screens + 1) * 100) } : null;
15904
+ /** Throw a `SitePlanError` carrying every issue unless the plan is valid. */
15905
+ function assertValidSitePlan(plan) {
15906
+ const result = validateSitePlan(plan);
15907
+ if (!result.valid)
15908
+ throw new SitePlanError(result.issues);
15909
+ }
15910
+ /**
15911
+ * A plan's pages against their page types (L0-2): every required slot filled, every section of a family the type takes.
15912
+ * NOT part of `validateSitePlan` — a page type is what the model READS to give a page its shape, and the plan stage
15913
+ * holds the model's plan to it; the owner may then make any page their own (merge About into Contact, drop the
15914
+ * closing band), which the gate must not refuse. Pure; issues carry the same paths.
15915
+ */
15916
+ function archetypeIssues(plan) {
15917
+ const c = new Collector$1();
15918
+ plan.pages.forEach((page, i) => {
15919
+ const type = page.archetype ? PAGE_ARCHETYPES[page.archetype] : undefined;
15920
+ if (!type)
15921
+ return;
15922
+ const families = page.sections.map(s => patternById(s.pattern)?.family ?? '');
15923
+ for (const slot of type.slots) {
15924
+ if (slot.required && !families.some(f => slot.families.includes(f))) {
15925
+ c.add(SitePlanIssueCode.Archetype, `pages[${i}].sections`, `a ${page.archetype} page needs a ${slot.label} section (${slot.families.join(' / ')})`);
15926
+ }
15927
+ }
15928
+ families.forEach((family, j) => {
15929
+ if (!type.slots.some(slot => slot.families.includes(family)))
15930
+ c.add(SitePlanIssueCode.Archetype, `pages[${i}].sections[${j}]`, `a ${family} section does not belong on a ${page.archetype} page`);
15931
+ });
15932
+ });
15933
+ return c.issues;
15036
15934
  }
15037
15935
 
15038
15936
  /**
15039
- * The phone shapes of a navigation bar (complex-components plan CC1, §7a + R1; boards 1–3). ONE pure tree
15040
- * edit, `planNavShape`, turns a site's header into the shape the author (the Navigation bar's "Phone
15041
- * menu" section) or the composer (`nav.inline-cta`'s `phoneMenu`) asks for:
15042
- *
15043
- * - **Drawer** — a menu button in the header opens a slide-in Dialog at the end edge that lists every
15044
- * page (board 1). The drawer is a child of the Navigation bar.
15045
- * - **Bottom bar** — an app-style bar fixed to the bottom of the screen with up to five pages, no drawer
15046
- * (board 2). The phone header keeps only the brand (Q4).
15047
- * - **Both** — the bar with four pages and More, which opens the drawer; the drawer is then its own
15048
- * global, beside the Navigation bar (board 2's layer tree).
15937
+ * How animated (AI plan rev 3.1 §3p) — the ONE reading of the contract's `axes.animations` (what each level
15938
+ * moves, how) and `axes.animationFamilies` (which parts a section family lets move). The pieces every stamper
15939
+ * shares: the Design step's business specimen (H4-4) and `planEntrances`, which the composer runs per section (M1-6b).
15940
+ * When an entrance plays — a static item's literal delay, a Repeater row's share — is design-core's `staggerDelay` /
15941
+ * `entranceDelay`, which both interaction runtimes read too. Pure.
15049
15942
  *
15050
- * Every part is a real node with a `role` (R2): editable, selectable, styled by its element style. Parts
15051
- * a shape keeps are passed through untouched, so an author's edits survive a change of shape; the parts
15052
- * it no longer has are removed (undo brings them back — the caller records ONE history step). Nothing
15053
- * here reads a clock or a random source: ids come from `newId` (deterministic by default, so the
15054
- * composer's output is byte-stable).
15943
+ * A level with `content` moves a section's content together, once; otherwise it names parts (heading, items,
15944
+ * media…) and each part enters on its own, items one after another. Navigation, footers and globals are a family
15945
+ * with no parts, so nothing there ever moves.
15055
15946
  */
15056
- var NavShape;
15057
- (function (NavShape) {
15058
- NavShape["Drawer"] = "drawer";
15059
- NavShape["Bar"] = "bar";
15060
- NavShape["Both"] = "both";
15061
- })(NavShape || (NavShape = {}));
15062
- /** The roles of a navigation's parts (the composite plan's `role` field, here for the nav). */
15063
- var NavRole;
15064
- (function (NavRole) {
15065
- NavRole["Root"] = "nav";
15066
- NavRole["Brand"] = "nav.brand";
15067
- NavRole["Links"] = "nav.links";
15068
- NavRole["Link"] = "nav.link";
15069
- NavRole["Cta"] = "nav.cta";
15070
- NavRole["MenuButton"] = "nav.menu-button";
15071
- NavRole["Drawer"] = "nav.drawer";
15072
- NavRole["DrawerHead"] = "nav.drawer-head";
15073
- NavRole["DrawerClose"] = "nav.drawer-close";
15074
- NavRole["DrawerLinks"] = "nav.drawer-links";
15075
- NavRole["DrawerLink"] = "nav.drawer-link";
15076
- NavRole["DrawerCta"] = "nav.drawer-cta";
15077
- NavRole["Bar"] = "nav.bar";
15078
- NavRole["BarItem"] = "nav.bar-item";
15079
- NavRole["More"] = "nav.more";
15080
- })(NavRole || (NavRole = {}));
15081
- /** The breakpoints a phone menu may switch at (the responsive Breakpoint ids; Q5: Mobile landscape). */
15082
- var PhoneMenuBreakpoint;
15083
- (function (PhoneMenuBreakpoint) {
15084
- PhoneMenuBreakpoint["Tablet"] = "tablet";
15085
- PhoneMenuBreakpoint["Mobile"] = "mobile";
15086
- PhoneMenuBreakpoint["Small"] = "small";
15087
- })(PhoneMenuBreakpoint || (PhoneMenuBreakpoint = {}));
15088
- const DEFAULT_PHONE_MENU_BREAKPOINT = PhoneMenuBreakpoint.Mobile;
15089
- /** The bar's item count, More included (Q2: 3–5; iOS and Material both cap at five). */
15090
- const BAR_ITEMS_MIN = 3;
15091
- const BAR_ITEMS_MAX = 5;
15092
- class NavShapeError extends Error {
15093
- }
15094
- const CONTAINER = 'Container';
15095
- const DIALOG$1 = 'Dialog';
15096
- const LINK = 'Link';
15097
- const LINKED = 'LinkedContainer';
15098
- const BUTTON = 'ButtonBlock';
15099
- const ICON$1 = 'Icon';
15947
+ var EntrancePart;
15948
+ (function (EntrancePart) {
15949
+ EntrancePart["Content"] = "content";
15950
+ EntrancePart["Heading"] = "heading";
15951
+ EntrancePart["Items"] = "items";
15952
+ EntrancePart["Media"] = "media";
15953
+ EntrancePart["RowMedia"] = "rowMedia";
15954
+ EntrancePart["HeroText"] = "heroText";
15955
+ })(EntrancePart || (EntrancePart = {}));
15956
+ /** What an entrance stamp is marked with — a later restamp touches only what the look made (H4-5). */
15957
+ const ENTRANCE_ORIGIN_LOOK = 'look';
15958
+ /** The trigger every entrance plays on. */
15959
+ const ENTRANCE_TRIGGER = 'viewportEnter';
15960
+ /** The easing every entrance plays with (only `opacity` and `transform` move). */
15961
+ const ENTRANCE_EASING = 'ease-out';
15962
+ const LEVELS = SPEC_AXES.animations;
15963
+ const FAMILIES = SPEC_AXES.animationFamilies;
15964
+ const NOTHING = { content: null, parts: {} };
15965
+ /** What a section of `family` moves at `level` — nothing for an unknown level or family. */
15966
+ function sectionEntrances(level, family) {
15967
+ const lv = level ? LEVELS[level] : undefined;
15968
+ const allow = FAMILIES[family] ?? [];
15969
+ if (!lv || !allow.length)
15970
+ return NOTHING;
15971
+ if (lv.parts.content && allow.includes(EntrancePart.Content))
15972
+ return { content: lv.parts.content, parts: {} };
15973
+ const parts = {};
15974
+ for (const part of allow) {
15975
+ if (part === EntrancePart.Content)
15976
+ continue;
15977
+ // A level without its own side-by-side entrance gives a row's picture the plain picture one.
15978
+ const spec = lv.parts[part] ?? (part === EntrancePart.RowMedia ? lv.parts.media : undefined);
15979
+ if (spec)
15980
+ parts[part] = spec;
15981
+ }
15982
+ return { content: null, parts };
15983
+ }
15984
+ /** Which side of its row a picture sits on (`rowMedia`): an end-side picture enters from the end. */
15985
+ var EntranceSide;
15986
+ (function (EntranceSide) {
15987
+ EntranceSide["Start"] = "start";
15988
+ EntranceSide["End"] = "end";
15989
+ })(EntranceSide || (EntranceSide = {}));
15990
+ /** The action a node plays: the spec's type (mirrored for a start-side picture and on a right-to-left page — both
15991
+ * together cancel out), its distance, and its delay (or, for a Repeater's rows, the stagger the runtime adds). */
15992
+ function entranceAction(spec, opts = {}) {
15993
+ const mirrored = (opts.side === EntranceSide.Start) !== !!opts.rtl;
15994
+ const params = {};
15995
+ if (spec.distance)
15996
+ params[EntranceParam.Distance] = spec.distance;
15997
+ if (opts.repeated && spec.stagger) {
15998
+ params[EntranceParam.Stagger] = spec.stagger;
15999
+ params[EntranceParam.Cap] = spec.cap ?? 1;
16000
+ }
16001
+ return {
16002
+ type: mirrored && spec.mirror ? spec.mirror : spec.type,
16003
+ target: 'self',
16004
+ duration: spec.duration,
16005
+ delay: opts.repeated ? 0 : staggerDelay(spec, opts.index),
16006
+ easing: ENTRANCE_EASING,
16007
+ once: true,
16008
+ ...(Object.keys(params).length ? { params } : {}),
16009
+ };
16010
+ }
16011
+ /** The stamp on a node: `viewportEnter`, once, on itself (a duplicated node needs no remap), from the look. */
16012
+ function entranceInteraction(nodeId, action) {
16013
+ return { id: `${nodeId}-enter`, trigger: ENTRANCE_TRIGGER, actions: [action], origin: ENTRANCE_ORIGIN_LOOK };
16014
+ }
16015
+ /**
16016
+ * The entrances a composed section gets (AI plan §3p, M1-6b): a level that moves the CONTENT fades the pattern's
16017
+ * `content` marks — else every child of the section — together, once; otherwise each marked part its family allows
16018
+ * enters on its own (static items a literal delay apart, a Repeater's rows by the runtime), a row picture from its side.
16019
+ * Nothing for a header or footer family, Still, or an unknown level. Pure.
16020
+ */
16021
+ function planEntrances(input) {
16022
+ const plan = sectionEntrances(input.level, input.family);
16023
+ const stamp = (nodeId, spec, opts) => ({ nodeId, interaction: entranceInteraction(nodeId, entranceAction(spec, { ...opts, rtl: input.rtl })) });
16024
+ if (plan.content) {
16025
+ const marked = input.marks.filter(m => m.part === EntrancePart.Content).map(m => m.nodeId);
16026
+ return (marked.length ? marked : input.contentIds).map(id => stamp(id, plan.content, {}));
16027
+ }
16028
+ return input.marks.flatMap(m => {
16029
+ const spec = m.part === EntrancePart.Content ? undefined : plan.parts[m.part];
16030
+ return spec ? [stamp(m.nodeId, spec, { index: m.index, repeated: m.repeated, side: m.side })] : [];
16031
+ });
16032
+ }
16033
+
16034
+ /**
16035
+ * The owner's film on a built site (premium sites SC6b). The owner gives a video in Analysis; the wizard's browser makes
16036
+ * it pictures (cms-client `FramesPrepareService`); the build places it. A model never picks the film's pattern — the
16037
+ * manifest and the plan wire leave it out — so ONE pure placement decides where it goes, run by the wizard to draw the
16038
+ * Plan and by the server to build: they cannot disagree.
16039
+ */
16040
+ /** The pattern a film plays in: the one whose Video is marked `film` in the contract. */
16041
+ const FILM_PATTERN = Object.entries(SITE_PATTERNS).find(([, p]) => p.film)?.[0] ?? '';
16042
+ /** Why a film stays off the site. Each is said to the owner on the Plan step. */
16043
+ var FilmUnplaced;
16044
+ (function (FilmUnplaced) {
16045
+ /** How animated is below Expressive: no section holds the page there. */
16046
+ FilmUnplaced["NotExpressive"] = "notExpressive";
16047
+ /** The home page does not open with a hero to play it in. */
16048
+ FilmUnplaced["NoHero"] = "noHero";
16049
+ /** The home page already holds the page elsewhere (one Scene per page). */
16050
+ FilmUnplaced["AnotherScene"] = "anotherScene";
16051
+ /** Too few pictures to play smoothly over the shortest hold (media-core `FILM_MIN_PICTURES`). */
16052
+ FilmUnplaced["TooShort"] = "tooShort";
16053
+ })(FilmUnplaced || (FilmUnplaced = {}));
16054
+ /** Where a film WOULD play on this plan (the Plan step asks before the pictures exist). */
16055
+ function filmPlacement(plan) {
16056
+ if (plan.design.animate !== SCENE_LEVEL)
16057
+ return { unplaced: FilmUnplaced.NotExpressive };
16058
+ const page = plan.pages.findIndex(p => p.isHome);
16059
+ const sections = page >= 0 ? plan.pages[page].sections : [];
16060
+ const first = patternById(sections[0]?.pattern);
16061
+ if (!first || first.family !== FILM_FAMILY)
16062
+ return { unplaced: FilmUnplaced.NoHero };
16063
+ if (sections.slice(1).some(s => patternById(s.pattern)?.scene))
16064
+ return { unplaced: FilmUnplaced.AnotherScene };
16065
+ return { target: { page, section: 0 } };
16066
+ }
16067
+ const FILM_FAMILY = SITE_PATTERNS[FILM_PATTERN]?.family ?? 'hero';
16068
+ /**
16069
+ * The plan with the owner's film in it: `film` set, and the home page's hero becomes the film's pattern, keeping the
16070
+ * hero's words and links that the film's pattern has. A film that cannot play (unreadable, too few pictures) or a plan
16071
+ * with no place for it leaves the plan as it was — the hero keeps its picture, and the builder can add the film later.
16072
+ */
16073
+ function placeFilm(plan, sequence) {
16074
+ const film = normalizeFrameSequence(sequence);
16075
+ if (!film || filmScreensFor(film.wide.count) === null)
16076
+ return { plan, unplaced: FilmUnplaced.TooShort };
16077
+ const placement = filmPlacement(plan);
16078
+ if (!placement.target)
16079
+ return { plan, unplaced: placement.unplaced };
16080
+ const { page, section } = placement.target;
16081
+ const pages = plan.pages.map((p, i) => i !== page ? p : {
16082
+ ...p,
16083
+ sections: p.sections.map((s, j) => (j === section ? filmSection(s) : s)),
16084
+ });
16085
+ return { plan: { ...plan, pages, film: { sequence: film } } };
16086
+ }
16087
+ function filmSection(hero) {
16088
+ const pattern = SITE_PATTERNS[FILM_PATTERN];
16089
+ const slots = new Set(patternSlots(pattern));
16090
+ const links = new Set(patternLinkSlots(pattern));
16091
+ const keep = (values, allowed) => {
16092
+ const kept = Object.entries(values ?? {}).filter(([key]) => allowed.has(key));
16093
+ return kept.length ? Object.fromEntries(kept) : undefined;
16094
+ };
16095
+ const keptSlots = keep(hero.slots, slots);
16096
+ const keptLinks = keep(hero.links, links);
16097
+ return { pattern: FILM_PATTERN, ...(keptSlots ? { slots: keptSlots } : {}), ...(keptLinks ? { links: keptLinks } : {}) };
16098
+ }
16099
+ /** The film's pictures as the composer stamps them, and the height its Scene holds the page for. */
16100
+ function filmOfPlan(plan) {
16101
+ const sequence = normalizeFrameSequence(plan.film?.sequence);
16102
+ const screens = sequence ? filmScreensFor(sequence.wide.count) : null;
16103
+ // A Scene's root holds the page for its height less the one screen its stage fills.
16104
+ return sequence && screens !== null ? { sequence, heightVh: Math.round((screens + 1) * 100) } : null;
16105
+ }
16106
+
16107
+ /**
16108
+ * The phone shapes of a navigation bar (complex-components plan CC1, §7a + R1; boards 1–3). ONE pure tree
16109
+ * edit, `planNavShape`, turns a site's header into the shape the author (the Navigation bar's "Phone
16110
+ * menu" section) or the composer (`nav.inline-cta`'s `phoneMenu`) asks for:
16111
+ *
16112
+ * - **Drawer** — a menu button in the header opens a slide-in Dialog at the end edge that lists every
16113
+ * page (board 1). The drawer is a child of the Navigation bar.
16114
+ * - **Bottom bar** — an app-style bar fixed to the bottom of the screen with up to five pages, no drawer
16115
+ * (board 2). The phone header keeps only the brand (Q4).
16116
+ * - **Both** — the bar with four pages and More, which opens the drawer; the drawer is then its own
16117
+ * global, beside the Navigation bar (board 2's layer tree).
16118
+ *
16119
+ * Every part is a real node with a `role` (R2): editable, selectable, styled by its element style. Parts
16120
+ * a shape keeps are passed through untouched, so an author's edits survive a change of shape; the parts
16121
+ * it no longer has are removed (undo brings them back — the caller records ONE history step). Nothing
16122
+ * here reads a clock or a random source: ids come from `newId` (deterministic by default, so the
16123
+ * composer's output is byte-stable).
16124
+ */
16125
+ var NavShape;
16126
+ (function (NavShape) {
16127
+ NavShape["Drawer"] = "drawer";
16128
+ NavShape["Bar"] = "bar";
16129
+ NavShape["Both"] = "both";
16130
+ })(NavShape || (NavShape = {}));
16131
+ /** The roles of a navigation's parts (the composite plan's `role` field, here for the nav). */
16132
+ var NavRole;
16133
+ (function (NavRole) {
16134
+ NavRole["Root"] = "nav";
16135
+ NavRole["Brand"] = "nav.brand";
16136
+ NavRole["Links"] = "nav.links";
16137
+ NavRole["Link"] = "nav.link";
16138
+ NavRole["Cta"] = "nav.cta";
16139
+ NavRole["MenuButton"] = "nav.menu-button";
16140
+ NavRole["Drawer"] = "nav.drawer";
16141
+ NavRole["DrawerHead"] = "nav.drawer-head";
16142
+ NavRole["DrawerClose"] = "nav.drawer-close";
16143
+ NavRole["DrawerLinks"] = "nav.drawer-links";
16144
+ NavRole["DrawerLink"] = "nav.drawer-link";
16145
+ NavRole["DrawerCta"] = "nav.drawer-cta";
16146
+ NavRole["Bar"] = "nav.bar";
16147
+ NavRole["BarItem"] = "nav.bar-item";
16148
+ NavRole["More"] = "nav.more";
16149
+ })(NavRole || (NavRole = {}));
16150
+ /** The breakpoints a phone menu may switch at (the responsive Breakpoint ids; Q5: Mobile landscape). */
16151
+ var PhoneMenuBreakpoint;
16152
+ (function (PhoneMenuBreakpoint) {
16153
+ PhoneMenuBreakpoint["Tablet"] = "tablet";
16154
+ PhoneMenuBreakpoint["Mobile"] = "mobile";
16155
+ PhoneMenuBreakpoint["Small"] = "small";
16156
+ })(PhoneMenuBreakpoint || (PhoneMenuBreakpoint = {}));
16157
+ const DEFAULT_PHONE_MENU_BREAKPOINT = PhoneMenuBreakpoint.Mobile;
16158
+ /** The bar's item count, More included (Q2: 3–5; iOS and Material both cap at five). */
16159
+ const BAR_ITEMS_MIN = 3;
16160
+ const BAR_ITEMS_MAX = 5;
16161
+ class NavShapeError extends Error {
16162
+ }
16163
+ const CONTAINER = 'Container';
16164
+ const DIALOG$1 = 'Dialog';
16165
+ const LINK = 'Link';
16166
+ const LINKED = 'LinkedContainer';
16167
+ const BUTTON = 'ButtonBlock';
16168
+ const ICON$1 = 'Icon';
15100
16169
  const TEXT$1 = 'Text';
15101
16170
  const HEADING = 'Heading';
15102
16171
  const NAV_STYLE = 'nav';
@@ -15622,652 +16691,190 @@ function adoptRoles(root) {
15622
16691
  /** Board 3's layer names for the header's own parts, where the author has not named them: Brand, Links,
15623
16692
  * and the call to action by its words ("Get in touch"). */
15624
16693
  function nameParts(root) {
15625
- for (const role of [NavRole.Brand, NavRole.Links]) {
15626
- const part = find([root], role);
15627
- if (part && !part.label)
15628
- part.label = NAV_PART_LABELS[role];
15629
- }
15630
- const cta = find([root], NavRole.Cta);
15631
- if (cta && !cta.label) {
15632
- const words = textOf$3(cta);
15633
- if (words)
15634
- cta.label = words;
15635
- }
15636
- }
15637
- /**
15638
- * The bar's Items list "Add item" (board 2): one more item, before More — the next navigation page the
15639
- * bar does not link to yet (Home when every page is there). Refused at five (Q2). Input not mutated.
15640
- */
15641
- function addBarItem(globals, options = {}) {
15642
- const out = clone$2(globals);
15643
- const root = findNavRoot(out);
15644
- const b = find(out, NavRole.Bar);
15645
- if (!root || !b)
15646
- return { globals: out, added: false };
15647
- const kids = b.children ?? (b.children = []);
15648
- if (kids.length >= BAR_ITEMS_MAX)
15649
- return { globals: out, added: false };
15650
- const linked = new Set(kids.filter(c => c.role === NavRole.BarItem).map(c => prop(c, 'pageRoute')));
15651
- const page = barPages(root, phoneMenuPages(root, options.pages).pages, BAR_ITEMS_MAX + 1).find(p => !linked.has(p.route))
15652
- ?? { label: NAV_SHAPE_COPY.home, route: HOME_ROUTE };
15653
- const item = barItem(makeKit(out, root.id, options.newId), kids.length, page);
15654
- const more = kids.findIndex(c => c.role === NavRole.More);
15655
- if (more >= 0)
15656
- kids.splice(more, 0, item);
15657
- else
15658
- kids.push(item);
15659
- return { globals: out, added: true };
15660
- }
15661
- function barOf(globals) {
15662
- const out = clone$2(globals);
15663
- const b = find(out, NavRole.Bar);
15664
- return { out, kids: b ? (b.children ?? (b.children = [])) : null };
15665
- }
15666
- /**
15667
- * The bar's Items list "Remove" (board 2): the item goes, More included — refused below three items (Q2:
15668
- * 3–5), so the bar never shrinks into something a thumb cannot use. Input not mutated.
15669
- */
15670
- function removeBarItem(globals, itemId) {
15671
- const { out, kids } = barOf(globals);
15672
- const i = kids ? kids.findIndex(c => c.id === itemId) : -1;
15673
- if (!kids || i < 0 || kids.length <= BAR_ITEMS_MIN)
15674
- return { globals: out, changed: false };
15675
- kids.splice(i, 1);
15676
- return { globals: out, changed: true };
15677
- }
15678
- /** The bar's Items list drag-to-reorder (board 2): item `from` moves to `to`. Input not mutated. */
15679
- function moveBarItem(globals, from, to) {
15680
- const { out, kids } = barOf(globals);
15681
- if (!kids || from === to || from < 0 || to < 0 || from >= kids.length || to >= kids.length)
15682
- return { globals: out, changed: false };
15683
- const [item] = kids.splice(from, 1);
15684
- kids.splice(to, 0, item);
15685
- return { globals: out, changed: true };
15686
- }
15687
-
15688
- /**
15689
- * HEADER INGREDIENTS (header-ingredients-plan.md, HI0): a site's header is a MIX — one word per ingredient — never a
15690
- * header pattern. Every word, its meaning, whether the product draws it yet, the named mixes stored plans use, what a CL2
15691
- * `nav.kind` asks for, the fingerprint and Doron's references live in ONE table, the contract's `site.layout.header`
15692
- * (layout.mjs `HEADER`). This module only reads it: adding an option is a row there, not a change here
15693
- * (architecture/ai/ingredients.md). Pure.
15694
- */
15695
- const H = SPEC_SITE_LAYOUT.header;
15696
- /** The ingredients, by the contract's keys (held equal to it by header-mix.spec). */
15697
- var HeaderIngredient;
15698
- (function (HeaderIngredient) {
15699
- HeaderIngredient["Arrange"] = "arrange";
15700
- HeaderIngredient["MenuSide"] = "menuSide";
15701
- HeaderIngredient["Pages"] = "pages";
15702
- HeaderIngredient["Menu"] = "menu";
15703
- HeaderIngredient["MenuShows"] = "menuShows";
15704
- HeaderIngredient["Action"] = "action";
15705
- HeaderIngredient["Ground"] = "ground";
15706
- HeaderIngredient["Shape"] = "shape";
15707
- HeaderIngredient["Brand"] = "brand";
15708
- HeaderIngredient["Scroll"] = "scroll";
15709
- HeaderIngredient["Edge"] = "edge";
15710
- HeaderIngredient["Phone"] = "phone";
15711
- })(HeaderIngredient || (HeaderIngredient = {}));
15712
- class HeaderMixError extends Error {
15713
- }
15714
- const INGREDIENTS = H.ingredients;
15715
- const WAITS$1 = H.waits;
15716
- const MEANINGS$1 = H.meanings;
15717
- /** The words an ingredient may take. */
15718
- function headerWords(ingredient) {
15719
- return INGREDIENTS[ingredient] ?? [];
15720
- }
15721
- /** What a word means, as the brief and the builder say it. */
15722
- function headerMeaning(ingredient, word) {
15723
- return MEANINGS$1[`${ingredient}.${word}`] ?? word;
15724
- }
15725
- /** A whole mix from part of one: what is not named is the default (the Studio header). Refuses a word the table lacks. */
15726
- function headerMix(partial = {}) {
15727
- const mix = { ...H.defaults };
15728
- for (const [k, w] of Object.entries(partial)) {
15729
- if (w === undefined)
15730
- continue;
15731
- if (!INGREDIENTS[k])
15732
- throw new HeaderMixError(`no header ingredient "${k}"`);
15733
- if (!INGREDIENTS[k].includes(w))
15734
- throw new HeaderMixError(`a header's ${k} cannot be "${w}" (${INGREDIENTS[k].join(' · ')})`);
15735
- mix[k] = w;
15736
- }
15737
- return mix;
15738
- }
15739
- /** The mix a stored header pattern id stands for (`nav.inline-cta`, `nav.centered-logo`), or null for an unknown id. */
15740
- function namedHeaderMix(patternId) {
15741
- const named = H.named[patternId];
15742
- return named ? headerMix(named) : null;
15743
- }
15744
- /** The mix a CL2 layout's `nav.kind` asks for (`bar` when it names none). */
15745
- function headerMixOfNavKind(kind) {
15746
- const asked = H.navKinds[kind ?? 'bar'];
15747
- if (!asked)
15748
- throw new HeaderMixError(`no nav kind "${kind}"`);
15749
- return headerMix(asked);
15750
- }
15751
- /** The mix the product DRAWS today: every waiting word becomes its built stand-in, and each one is said as a gap. */
15752
- function drawnHeaderMix(mix) {
15753
- const drawn = { ...mix };
15754
- const gaps = [];
15755
- for (const k of Object.values(HeaderIngredient)) {
15756
- const wait = WAITS$1[`${k}.${mix[k]}`];
15757
- if (!wait)
15758
- continue;
15759
- gaps.push({ ingredient: k, word: mix[k], phase: wait.phase, drawnAs: wait.drawnAs });
15760
- drawn[k] = wait.drawnAs;
15761
- }
15762
- return { drawn, gaps };
15763
- }
15764
- /** The fingerprint's prefix for a header. */
15765
- const HEADER_TOKEN = 'header';
15766
- /** A header as the fingerprint sees it (§7): `header:<arrange>/<pages>/<menu>/<ground>/<shape>` — what a visitor takes in
15767
- * at once, in the contract's order. Two sites with the same token wear the same header. */
15768
- function headerTokenOf(mix) {
15769
- return `${HEADER_TOKEN}:${H.fingerprint.map(k => mix[k]).join('/')}`;
15770
- }
15771
- /** A header token in words: `header:name-only/menu/drawer/solid/bar` → "name-only · menu · drawer · solid · bar". */
15772
- const headerTokenWords = (token) => token.replace(`${HEADER_TOKEN}:`, '').split('/').join(' · ');
15773
- /** Doron's reference headers (§2b), each as a whole mix. */
15774
- function headerReferences() {
15775
- return H.references
15776
- .map(r => ({ id: r.id, after: r.after, added: r.added, mix: headerMix(r.mix) }));
15777
- }
15778
- /** The site plan's header as a mix: its `globals.header` pattern read as a named mix (HI-D4), the Studio header when it
15779
- * names none or one the table does not know. */
15780
- function headerMixOfPlan(plan) {
15781
- return namedHeaderMix(plan.globals?.['header'] ?? '') ?? headerMix();
15782
- }
15783
-
15784
- /**
15785
- * THE LIST TABLE (list-ingredients-plan.md; the contract's `layout.mjs` `LIST`, in the shape every mixed part shares —
15786
- * ingredients.md §2): the words of each ingredient, what each means, and which wait for a later phase and are drawn as
15787
- * a built word meanwhile. Everything that offers, says or draws a list word reads it here; nothing retypes one.
15788
- */
15789
- const LIST_TABLE = SPEC_SITE_LAYOUT.list;
15790
- /** The ingredients, in the table's order. */
15791
- const LIST_INGREDIENTS = Object.keys(LIST_TABLE.ingredients);
15792
- const WAITS = LIST_TABLE.waits;
15793
- const MEANINGS = LIST_TABLE.meanings;
15794
- /** Every word of an ingredient. */
15795
- function listIngredientWords(k) {
15796
- return LIST_TABLE.ingredients[k];
15797
- }
15798
- /** The wait of a word, or null when the product draws it. */
15799
- function listWait(k, word) {
15800
- return WAITS[`${k}.${word}`] ?? null;
15801
- }
15802
- /** The words of an ingredient the product draws — the only ones the wire offers (ingredients.md §3.3). */
15803
- function listBuiltWords(k) {
15804
- return listIngredientWords(k).filter(w => !listWait(k, w));
15805
- }
15806
- /** What a word means, in the words the model and the owner read (the word itself when the table has none). */
15807
- function listMeaning(k, word) {
15808
- return MEANINGS[`${k}.${word}`] ?? word;
15809
- }
15810
-
15811
- /**
15812
- * The LAYOUT LANGUAGE (premium components M8 — the prototype's CL2 / CL2.1, premium-sites plan "Breaking limits"): a page
15813
- * composed as layers of closed kinds placed on a 12-column grid, with closed sizes, the look's five colours, roles, time
15814
- * entrances, a parallax depth, held sections whose layers move by tracks, sideways sections, galleries, forms and a phone
15815
- * reading order. The model writes no CSS and no node tree; `composeLayout` stamps ordinary builder nodes from it.
15816
- *
15817
- * Gate 1 typed the shape the three proof sites were saved in (iox-ai-guidance `prototypes/breaking-limits/round4|round3`).
15818
- * Gate 2 moved the closed lists into the contract (`site.layout`, SPEC_SITE_LAYOUT): these enums are held equal to it by
15819
- * layout-language.spec, and a generated page carries one in `PagePlan.layout` (a `LayoutPage`).
15820
- */
15821
- var LayoutLayerKind;
15822
- (function (LayoutLayerKind) {
15823
- LayoutLayerKind["Word"] = "word";
15824
- LayoutLayerKind["Heading"] = "heading";
15825
- LayoutLayerKind["Text"] = "text";
15826
- LayoutLayerKind["Photo"] = "photo";
15827
- LayoutLayerKind["Gallery"] = "gallery";
15828
- LayoutLayerKind["Button"] = "button";
15829
- LayoutLayerKind["List"] = "list";
15830
- LayoutLayerKind["Number"] = "number";
15831
- LayoutLayerKind["Shape"] = "shape";
15832
- LayoutLayerKind["Label"] = "label";
15833
- LayoutLayerKind["Form"] = "form";
15834
- LayoutLayerKind["Marquee"] = "marquee";
15835
- })(LayoutLayerKind || (LayoutLayerKind = {}));
15836
- var LayoutSize;
15837
- (function (LayoutSize) {
15838
- LayoutSize["Xs"] = "xs";
15839
- LayoutSize["S"] = "s";
15840
- LayoutSize["M"] = "m";
15841
- LayoutSize["L"] = "l";
15842
- LayoutSize["Xl"] = "xl";
15843
- LayoutSize["Xxl"] = "xxl";
15844
- /** As wide as its columns allow — a word, never a sentence. */
15845
- LayoutSize["Screen"] = "screen";
15846
- })(LayoutSize || (LayoutSize = {}));
15847
- /** The look's five colours, by role. */
15848
- var LayoutColour;
15849
- (function (LayoutColour) {
15850
- LayoutColour["Ground"] = "ground";
15851
- LayoutColour["Ink"] = "ink";
15852
- LayoutColour["Accent"] = "accent";
15853
- LayoutColour["Soft"] = "soft";
15854
- LayoutColour["Muted"] = "muted";
15855
- })(LayoutColour || (LayoutColour = {}));
15856
- var LayoutRole;
15857
- (function (LayoutRole) {
15858
- LayoutRole["Lead"] = "lead";
15859
- LayoutRole["Support"] = "support";
15860
- LayoutRole["Decoration"] = "decoration";
15861
- LayoutRole["Static"] = "static";
15862
- })(LayoutRole || (LayoutRole = {}));
15863
- var LayoutEnter;
15864
- (function (LayoutEnter) {
15865
- LayoutEnter["None"] = "none";
15866
- LayoutEnter["Fade"] = "fade";
15867
- LayoutEnter["FadeRise"] = "fadeRise";
15868
- LayoutEnter["ScaleIn"] = "scaleIn";
15869
- LayoutEnter["ClipReveal"] = "clipReveal";
15870
- LayoutEnter["MaskRise"] = "maskRise";
15871
- LayoutEnter["BlurIn"] = "blurIn";
15872
- LayoutEnter["Pop"] = "pop";
15873
- })(LayoutEnter || (LayoutEnter = {}));
15874
- var LayoutDepth;
15875
- (function (LayoutDepth) {
15876
- LayoutDepth["Back"] = "back";
15877
- LayoutDepth["Mid"] = "mid";
15878
- LayoutDepth["Front"] = "front";
15879
- })(LayoutDepth || (LayoutDepth = {}));
15880
- var LayoutTransition;
15881
- (function (LayoutTransition) {
15882
- LayoutTransition["Cut"] = "cut";
15883
- LayoutTransition["Flood"] = "flood";
15884
- LayoutTransition["WipeUp"] = "wipe-up";
15885
- LayoutTransition["WipeDown"] = "wipe-down";
15886
- LayoutTransition["WipeStart"] = "wipe-start";
15887
- LayoutTransition["WipeEnd"] = "wipe-end";
15888
- })(LayoutTransition || (LayoutTransition = {}));
15889
- var LayoutEase;
15890
- (function (LayoutEase) {
15891
- LayoutEase["Out"] = "out";
15892
- LayoutEase["InOut"] = "inOut";
15893
- LayoutEase["Drawer"] = "drawer";
15894
- LayoutEase["Linear"] = "linear";
15895
- })(LayoutEase || (LayoutEase = {}));
15896
- var LayoutPace;
15897
- (function (LayoutPace) {
15898
- LayoutPace["Slow"] = "slow";
15899
- LayoutPace["Normal"] = "normal";
15900
- LayoutPace["Quick"] = "quick";
15901
- })(LayoutPace || (LayoutPace = {}));
15902
- var LayoutSide;
15903
- (function (LayoutSide) {
15904
- LayoutSide["Bottom"] = "bottom";
15905
- LayoutSide["Top"] = "top";
15906
- LayoutSide["Start"] = "start";
15907
- LayoutSide["End"] = "end";
15908
- })(LayoutSide || (LayoutSide = {}));
15909
- var LayoutTrackProp;
15910
- (function (LayoutTrackProp) {
15911
- LayoutTrackProp["X"] = "x";
15912
- LayoutTrackProp["Y"] = "y";
15913
- LayoutTrackProp["Scale"] = "scale";
15914
- LayoutTrackProp["Opacity"] = "opacity";
15915
- LayoutTrackProp["Rotate"] = "rotate";
15916
- LayoutTrackProp["Clip"] = "clip";
15917
- LayoutTrackProp["Blur"] = "blur";
15918
- })(LayoutTrackProp || (LayoutTrackProp = {}));
15919
- var LayoutAlign;
15920
- (function (LayoutAlign) {
15921
- LayoutAlign["Start"] = "start";
15922
- LayoutAlign["Center"] = "center";
15923
- LayoutAlign["End"] = "end";
15924
- })(LayoutAlign || (LayoutAlign = {}));
15925
- var LayoutBleed;
15926
- (function (LayoutBleed) {
15927
- LayoutBleed["None"] = "none";
15928
- LayoutBleed["Start"] = "start";
15929
- LayoutBleed["End"] = "end";
15930
- LayoutBleed["Both"] = "both";
15931
- })(LayoutBleed || (LayoutBleed = {}));
15932
- /** A pool photo's shape (the inventory measures each one): what it keeps where nothing else gives it a height. */
15933
- var LayoutPhotoShape;
15934
- (function (LayoutPhotoShape) {
15935
- LayoutPhotoShape["Wide"] = "wide";
15936
- LayoutPhotoShape["Landscape"] = "landscape";
15937
- LayoutPhotoShape["Square"] = "square";
15938
- LayoutPhotoShape["Portrait"] = "portrait";
15939
- LayoutPhotoShape["Tall"] = "tall";
15940
- })(LayoutPhotoShape || (LayoutPhotoShape = {}));
15941
- const LAYOUT_PHOTO_ASPECT = {
15942
- [LayoutPhotoShape.Wide]: '16 / 9',
15943
- [LayoutPhotoShape.Landscape]: '3 / 2',
15944
- [LayoutPhotoShape.Square]: '1 / 1',
15945
- [LayoutPhotoShape.Portrait]: '2 / 3',
15946
- [LayoutPhotoShape.Tall]: '9 / 16',
15947
- };
15948
- var LayoutSectionKind;
15949
- (function (LayoutSectionKind) {
15950
- LayoutSectionKind["Content"] = "content";
15951
- LayoutSectionKind["Inhale"] = "inhale";
15952
- })(LayoutSectionKind || (LayoutSectionKind = {}));
15953
- var LayoutButtonVariant;
15954
- (function (LayoutButtonVariant) {
15955
- LayoutButtonVariant["Primary"] = "primary";
15956
- LayoutButtonVariant["Secondary"] = "secondary";
15957
- LayoutButtonVariant["Ghost"] = "ghost";
15958
- })(LayoutButtonVariant || (LayoutButtonVariant = {}));
15959
- /** The product SliderContainer's own effects (iox-ui `slider-options.ts`). */
15960
- var LayoutGalleryEffect;
15961
- (function (LayoutGalleryEffect) {
15962
- LayoutGalleryEffect["Slide"] = "slide";
15963
- LayoutGalleryEffect["Fade"] = "fade";
15964
- LayoutGalleryEffect["Cube"] = "cube";
15965
- LayoutGalleryEffect["Flip"] = "flip";
15966
- LayoutGalleryEffect["Coverflow"] = "coverflow";
15967
- LayoutGalleryEffect["Cards"] = "cards";
15968
- LayoutGalleryEffect["Creative"] = "creative";
15969
- })(LayoutGalleryEffect || (LayoutGalleryEffect = {}));
15970
- var LayoutNavKind;
15971
- (function (LayoutNavKind) {
15972
- LayoutNavKind["Bar"] = "bar";
15973
- LayoutNavKind["Corner"] = "corner";
15974
- LayoutNavKind["Index"] = "index";
15975
- LayoutNavKind["Side"] = "side";
15976
- })(LayoutNavKind || (LayoutNavKind = {}));
15977
- /** List ingredients (list-ingredients-plan.md §2): the seven choices a list section mixes. Held equal to the contract's
15978
- * `site.layout.list` by layout-language.spec. */
15979
- var LayoutListItem;
15980
- (function (LayoutListItem) {
15981
- LayoutListItem["Photo"] = "photo";
15982
- LayoutListItem["Card"] = "card";
15983
- })(LayoutListItem || (LayoutListItem = {}));
15984
- var LayoutListArrange;
15985
- (function (LayoutListArrange) {
15986
- LayoutListArrange["Row"] = "row";
15987
- LayoutListArrange["Grid"] = "grid";
15988
- LayoutListArrange["Masonry"] = "masonry";
15989
- LayoutListArrange["Strips"] = "strips";
15990
- LayoutListArrange["Deck"] = "deck";
15991
- })(LayoutListArrange || (LayoutListArrange = {}));
15992
- var LayoutListWho;
15993
- (function (LayoutListWho) {
15994
- LayoutListWho["None"] = "none";
15995
- LayoutListWho["Middle"] = "middle";
15996
- LayoutListWho["First"] = "first";
15997
- LayoutListWho["Pointed"] = "pointed";
15998
- })(LayoutListWho || (LayoutListWho = {}));
15999
- var LayoutListHow;
16000
- (function (LayoutListHow) {
16001
- LayoutListHow["Bigger"] = "bigger";
16002
- LayoutListHow["Wider"] = "wider";
16003
- LayoutListHow["Raised"] = "raised";
16004
- LayoutListHow["Brighter"] = "brighter";
16005
- })(LayoutListHow || (LayoutListHow = {}));
16006
- var LayoutListMove;
16007
- (function (LayoutListMove) {
16008
- LayoutListMove["Arrows"] = "arrows";
16009
- LayoutListMove["Drag"] = "drag";
16010
- LayoutListMove["Auto"] = "auto";
16011
- LayoutListMove["Page"] = "page";
16012
- })(LayoutListMove || (LayoutListMove = {}));
16013
- var LayoutListHover;
16014
- (function (LayoutListHover) {
16015
- LayoutListHover["Rise"] = "rise";
16016
- LayoutListHover["Open"] = "open";
16017
- LayoutListHover["Zoom"] = "zoom";
16018
- LayoutListHover["Dim"] = "dim";
16019
- })(LayoutListHover || (LayoutListHover = {}));
16020
- var LayoutListArrive;
16021
- (function (LayoutListArrive) {
16022
- LayoutListArrive["Together"] = "together";
16023
- LayoutListArrive["OneByOne"] = "one-by-one";
16024
- LayoutListArrive["SlideIn"] = "slide-in";
16025
- })(LayoutListArrive || (LayoutListArrive = {}));
16026
- var LayoutListPhone;
16027
- (function (LayoutListPhone) {
16028
- LayoutListPhone["Swipe"] = "swipe";
16029
- LayoutListPhone["Stack"] = "stack";
16030
- LayoutListPhone["TwoUp"] = "two-up";
16031
- })(LayoutListPhone || (LayoutListPhone = {}));
16032
- /** How far a composed page breaks the usual layout (M8-G2-D5: follows How animated and the type's ceiling). */
16033
- var LayoutDial;
16034
- (function (LayoutDial) {
16035
- LayoutDial["Distinct"] = "distinct";
16036
- LayoutDial["Daring"] = "daring";
16037
- })(LayoutDial || (LayoutDial = {}));
16038
- /** Where a layout's photo comes from (M8-G2-D10): `own:<assetId>` · `stock:<libraryKey>` · `box:<shape>`. */
16039
- var LayoutPhotoSource;
16040
- (function (LayoutPhotoSource) {
16041
- LayoutPhotoSource["Own"] = "own";
16042
- LayoutPhotoSource["Stock"] = "stock";
16043
- LayoutPhotoSource["Box"] = "box";
16044
- })(LayoutPhotoSource || (LayoutPhotoSource = {}));
16045
- /** A photo id read: its source and key (`box:portrait` → box, portrait). Null when it names no source. */
16046
- function parseLayoutPhotoId(id) {
16047
- const m = /^(own|stock|box):(.+)$/.exec(String(id ?? '').trim());
16048
- if (!m)
16049
- return null;
16050
- if (m[1] === LayoutPhotoSource.Box && !Object.values(LayoutPhotoShape).includes(m[2]))
16051
- return null;
16052
- return { source: m[1], key: m[2] };
16053
- }
16054
- /** What can be wrong with a composed page, each refused with a path (`checkLayout`, `expandLayoutWire`). */
16055
- var LayoutIssueCode;
16056
- (function (LayoutIssueCode) {
16057
- /** The answer cannot be read (not an object, no sections). */
16058
- LayoutIssueCode["Shape"] = "shape";
16059
- /** A value outside its closed list or range. */
16060
- LayoutIssueCode["Value"] = "value";
16061
- /** The page's structure (sections, leads, signature, phone order). */
16062
- LayoutIssueCode["Structure"] = "structure";
16063
- /** The look's composition notes (space, type contrast, rotation, accent, what it avoids). */
16064
- LayoutIssueCode["Look"] = "look";
16065
- /** How things move (Emil). */
16066
- LayoutIssueCode["Motion"] = "motion";
16067
- /** Words that would not read: on a photo's busy part, too faint, too long for their box. */
16068
- LayoutIssueCode["Reading"] = "reading";
16069
- /** A photo, a source, a fact or a form that is not the business's. */
16070
- LayoutIssueCode["Content"] = "content";
16071
- /** What daring asks for and the page does not do. */
16072
- LayoutIssueCode["Daring"] = "daring";
16073
- /** It repeats a page already made (the fingerprint). */
16074
- LayoutIssueCode["Sameness"] = "sameness";
16075
- /** The rendered page (the render check): overlap, overflow, a first screen without its lead. */
16076
- LayoutIssueCode["Render"] = "render";
16077
- })(LayoutIssueCode || (LayoutIssueCode = {}));
16078
- /** What the composer may settle by itself, with no word or place changed (`mendLayout`). */
16079
- var LayoutMendKind;
16080
- (function (LayoutMendKind) {
16081
- /** Words over a busy or too-light part of a photo, in a look that allows scrims: the layer gets one. */
16082
- LayoutMendKind["Scrim"] = "scrim";
16083
- /** The accent on more layers than the look allows: the least important words go back to the ink, then — where words
16084
- * cannot give enough back — the least important accent bands take the ground nearest the accent their words read on. */
16085
- LayoutMendKind["Accent"] = "accent";
16086
- /** Words too faint on their ground, where the ink holds there: they go back to the ink. */
16087
- LayoutMendKind["Ink"] = "ink";
16088
- /** Decoration that enters with a move: it fades instead. */
16089
- LayoutMendKind["Fade"] = "fade";
16090
- /** Fewer layers glide than the look asks (iox-ui#63): the layers that may glide and do not get a depth, most important
16091
- * first — exactly as many as are missing. */
16092
- LayoutMendKind["Depth"] = "depth";
16093
- /** A gallery naming a list with no pictures (iox-ui#64): it shows a list that has them — the only one, else the one
16094
- * the section's words name, else the first in plan order. None, or the section's words name the list it named
16095
- * (iox-ui#66): left to the model. */
16096
- LayoutMendKind["Source"] = "source";
16097
- /** A held section where nothing moves by the scroll (the page stops on a still screen, M8 demo): its line — a word,
16098
- * heading or text of at most the kinetic words — is lit word by word as the hold plays. */
16099
- LayoutMendKind["Words"] = "words";
16100
- /** A held section where nothing moves and no line can be lit: it flows, one screen tall — when the page can spare the hold. */
16101
- LayoutMendKind["Unpin"] = "unpin";
16102
- /** …and when it cannot (a daring page needs its holds): its largest photo drifts — a slow scale as the hold plays. */
16103
- LayoutMendKind["Drift"] = "drift";
16104
- /** A shape with no purpose — not a rule, a band, a frame, a backdrop to words, and it does not move: it is dropped. */
16105
- LayoutMendKind["Drop"] = "drop";
16106
- /** A section that leaves a stretch of the laptop's screen with nothing on it: its height comes down (its rows keep
16107
- * their share, the words still fit) until the stretch is gone. */
16108
- LayoutMendKind["Screens"] = "screens";
16109
- /** A daring or Expressive page whose opening has no display: the opening's lead line is set as one (a word). */
16110
- LayoutMendKind["Display"] = "display";
16111
- /** A list section's mix that breaks a list rule the composer can settle (list-ingredients §6, `checkList`): the layer
16112
- * takes the repaired mix — every repair of one list carries the same one. */
16113
- LayoutMendKind["List"] = "list";
16114
- })(LayoutMendKind || (LayoutMendKind = {}));
16115
- /** Which rule chose a mended gallery's list. */
16116
- var LayoutSourceChoice;
16117
- (function (LayoutSourceChoice) {
16118
- /** The plan has exactly one list with pictures. */
16119
- LayoutSourceChoice["Only"] = "only";
16120
- /** Several: the first whose name or type the section's own words name. */
16121
- LayoutSourceChoice["Intent"] = "intent";
16122
- /** Several, none named: the first in plan order. */
16123
- LayoutSourceChoice["Order"] = "order";
16124
- })(LayoutSourceChoice || (LayoutSourceChoice = {}));
16125
- // ── The tables the composer reads (the prototype renderer v4's values, `code/renderer-round4.src.html`) ──────────────
16126
- /** A size as CSS — the prototype's `.s-*` rules. `screen` is computed per word (`screenFontSize`). */
16127
- const LAYOUT_FONT_SIZE = {
16128
- [LayoutSize.Xs]: '12px',
16129
- [LayoutSize.S]: '15px',
16130
- [LayoutSize.M]: '19px',
16131
- [LayoutSize.L]: 'clamp(26px, 2.8vw, 44px)',
16132
- [LayoutSize.Xl]: 'clamp(38px, 5vw, 82px)',
16133
- [LayoutSize.Xxl]: 'clamp(54px, 8.5vw, 150px)',
16134
- };
16135
- /** A colour name as the look's token (what the prototype probed off the preset: `--iox-bg` … `--iox-text-muted`). */
16136
- const LAYOUT_COLOUR_TOKEN = {
16137
- [LayoutColour.Ground]: 'var(--iox-bg)',
16138
- [LayoutColour.Ink]: 'var(--iox-text)',
16139
- [LayoutColour.Accent]: 'var(--iox-accent)',
16140
- [LayoutColour.Soft]: 'var(--iox-surface-2)',
16141
- [LayoutColour.Muted]: 'var(--iox-text-muted)',
16142
- };
16143
- /** Words in the accent colour read the accent's text shade (round four: `accent-text`). */
16144
- const LAYOUT_ACCENT_TEXT = 'var(--iox-accent-text)';
16145
- /** Emil's easing tokens (never ease-in). */
16146
- const LAYOUT_EASING = {
16147
- [LayoutEase.Out]: 'cubic-bezier(0.23, 1, 0.32, 1)',
16148
- [LayoutEase.InOut]: 'cubic-bezier(0.77, 0, 0.175, 1)',
16149
- [LayoutEase.Drawer]: 'cubic-bezier(0.32, 0.72, 0, 1)',
16150
- [LayoutEase.Linear]: 'linear',
16151
- };
16152
- /** How long an entrance takes, by the look's pace and the layer's role, and how far apart the beats are. */
16153
- const LAYOUT_PACE = {
16154
- [LayoutPace.Slow]: { lead: 1100, support: 900, decoration: 900, gap: 1.3 },
16155
- [LayoutPace.Normal]: { lead: 800, support: 650, decoration: 600, gap: 1 },
16156
- [LayoutPace.Quick]: { lead: 560, support: 460, decoration: 420, gap: 0.7 },
16157
- };
16158
- /** A stagger that shrinks as the beats go on, capped at the sixth — never a metronome. */
16159
- const LAYOUT_BEAT_DELAY = [0, 120, 210, 275, 320, 350];
16160
- /** How far a rise travels, by role (px). */
16161
- const LAYOUT_RISE = {
16162
- [LayoutRole.Lead]: 44,
16163
- [LayoutRole.Support]: 22,
16164
- [LayoutRole.Decoration]: 0,
16165
- [LayoutRole.Static]: 0,
16166
- };
16167
- /** The kinds a visitor OPERATES: never moved for style (Emil gate 4). */
16168
- const LAYOUT_OPERATED = new Set([LayoutLayerKind.Gallery, LayoutLayerKind.Button, LayoutLayerKind.Form, LayoutLayerKind.Marquee]);
16169
- const LAYOUT_TEXT_KINDS = new Set([
16170
- LayoutLayerKind.Word, LayoutLayerKind.Heading, LayoutLayerKind.Text, LayoutLayerKind.Label, LayoutLayerKind.Number, LayoutLayerKind.List,
16171
- ]);
16172
- /** The grid's gutter and column gap (the prototype's `--gutter` and `.grid`). */
16173
- const LAYOUT_GUTTER = 'max(4vw, 16px)';
16174
- const LAYOUT_COLUMN_GAP = '1.2vw';
16175
- /** A depth's `params.phone`: scene-core `ParallaxPhone.Rest` — stacked on a phone, a layer never glides into its neighbour.
16176
- * Stamped verbatim and read where it plays (not imported, as `PatternTrack`); compose-layout.spec holds the two equal. */
16177
- const LAYOUT_DEPTH_ON_PHONE = 'rest';
16178
- /** Below this opacity a layer counts as hidden: the static check's rule for an entrance or an exit that hides, and the
16179
- * render check's for words a held section never shows together. */
16180
- const LAYOUT_HIDDEN_OPACITY = 0.3;
16694
+ for (const role of [NavRole.Brand, NavRole.Links]) {
16695
+ const part = find([root], role);
16696
+ if (part && !part.label)
16697
+ part.label = NAV_PART_LABELS[role];
16698
+ }
16699
+ const cta = find([root], NavRole.Cta);
16700
+ if (cta && !cta.label) {
16701
+ const words = textOf$3(cta);
16702
+ if (words)
16703
+ cta.label = words;
16704
+ }
16705
+ }
16181
16706
  /**
16182
- * The stretches of a held section's play (0..1) in which a layer's opacity tracks show it — above
16183
- * `LAYOUT_HIDDEN_OPACITY`, each fade taken as linear. A layer with no opacity track shows throughout. Captions that take
16184
- * turns in one cell (the live café's four, M8 gate 2 fix first part 3) never show together, so they never overlap.
16707
+ * The bar's Items list "Add item" (board 2): one more item, before More — the next navigation page the
16708
+ * bar does not link to yet (Home when every page is there). Refused at five (Q2). Input not mutated.
16185
16709
  */
16186
- function layerShownSpans(l) {
16187
- const fades = (l.motion ?? []).filter(m => m.prop === LayoutTrackProp.Opacity && Array.isArray(m.at) && m.at[1] > m.at[0]).sort((a, b) => a.at[0] - b.at[0]);
16188
- if (!fades.length)
16189
- return [[0, 1]];
16190
- const shows = (v) => v > LAYOUT_HIDDEN_OPACITY;
16191
- const spans = [];
16192
- let from = shows(fades[0].from) ? 0 : null;
16193
- for (const m of fades) {
16194
- if (shows(m.from) === shows(m.to))
16710
+ function addBarItem(globals, options = {}) {
16711
+ const out = clone$2(globals);
16712
+ const root = findNavRoot(out);
16713
+ const b = find(out, NavRole.Bar);
16714
+ if (!root || !b)
16715
+ return { globals: out, added: false };
16716
+ const kids = b.children ?? (b.children = []);
16717
+ if (kids.length >= BAR_ITEMS_MAX)
16718
+ return { globals: out, added: false };
16719
+ const linked = new Set(kids.filter(c => c.role === NavRole.BarItem).map(c => prop(c, 'pageRoute')));
16720
+ const page = barPages(root, phoneMenuPages(root, options.pages).pages, BAR_ITEMS_MAX + 1).find(p => !linked.has(p.route))
16721
+ ?? { label: NAV_SHAPE_COPY.home, route: HOME_ROUTE };
16722
+ const item = barItem(makeKit(out, root.id, options.newId), kids.length, page);
16723
+ const more = kids.findIndex(c => c.role === NavRole.More);
16724
+ if (more >= 0)
16725
+ kids.splice(more, 0, item);
16726
+ else
16727
+ kids.push(item);
16728
+ return { globals: out, added: true };
16729
+ }
16730
+ function barOf(globals) {
16731
+ const out = clone$2(globals);
16732
+ const b = find(out, NavRole.Bar);
16733
+ return { out, kids: b ? (b.children ?? (b.children = [])) : null };
16734
+ }
16735
+ /**
16736
+ * The bar's Items list "Remove" (board 2): the item goes, More included — refused below three items (Q2:
16737
+ * 3–5), so the bar never shrinks into something a thumb cannot use. Input not mutated.
16738
+ */
16739
+ function removeBarItem(globals, itemId) {
16740
+ const { out, kids } = barOf(globals);
16741
+ const i = kids ? kids.findIndex(c => c.id === itemId) : -1;
16742
+ if (!kids || i < 0 || kids.length <= BAR_ITEMS_MIN)
16743
+ return { globals: out, changed: false };
16744
+ kids.splice(i, 1);
16745
+ return { globals: out, changed: true };
16746
+ }
16747
+ /** The bar's Items list drag-to-reorder (board 2): item `from` moves to `to`. Input not mutated. */
16748
+ function moveBarItem(globals, from, to) {
16749
+ const { out, kids } = barOf(globals);
16750
+ if (!kids || from === to || from < 0 || to < 0 || from >= kids.length || to >= kids.length)
16751
+ return { globals: out, changed: false };
16752
+ const [item] = kids.splice(from, 1);
16753
+ kids.splice(to, 0, item);
16754
+ return { globals: out, changed: true };
16755
+ }
16756
+
16757
+ /**
16758
+ * HEADER INGREDIENTS (header-ingredients-plan.md, HI0): a site's header is a MIX — one word per ingredient — never a
16759
+ * header pattern. Every word, its meaning, whether the product draws it yet, the named mixes stored plans use, what a CL2
16760
+ * `nav.kind` asks for, the fingerprint and Doron's references live in ONE table, the contract's `site.layout.header`
16761
+ * (layout.mjs `HEADER`). This module only reads it: adding an option is a row there, not a change here
16762
+ * (architecture/ai/ingredients.md). Pure.
16763
+ */
16764
+ const H = SPEC_SITE_LAYOUT.header;
16765
+ /** The ingredients, by the contract's keys (held equal to it by header-mix.spec). */
16766
+ var HeaderIngredient;
16767
+ (function (HeaderIngredient) {
16768
+ HeaderIngredient["Arrange"] = "arrange";
16769
+ HeaderIngredient["MenuSide"] = "menuSide";
16770
+ HeaderIngredient["Pages"] = "pages";
16771
+ HeaderIngredient["Menu"] = "menu";
16772
+ HeaderIngredient["MenuShows"] = "menuShows";
16773
+ HeaderIngredient["Action"] = "action";
16774
+ HeaderIngredient["Ground"] = "ground";
16775
+ HeaderIngredient["Shape"] = "shape";
16776
+ HeaderIngredient["Brand"] = "brand";
16777
+ HeaderIngredient["Scroll"] = "scroll";
16778
+ HeaderIngredient["Edge"] = "edge";
16779
+ HeaderIngredient["Phone"] = "phone";
16780
+ })(HeaderIngredient || (HeaderIngredient = {}));
16781
+ class HeaderMixError extends Error {
16782
+ }
16783
+ const INGREDIENTS = H.ingredients;
16784
+ const WAITS$1 = H.waits;
16785
+ const MEANINGS$1 = H.meanings;
16786
+ /** The words an ingredient may take. */
16787
+ function headerWords(ingredient) {
16788
+ return INGREDIENTS[ingredient] ?? [];
16789
+ }
16790
+ /** What a word means, as the brief and the builder say it. */
16791
+ function headerMeaning(ingredient, word) {
16792
+ return MEANINGS$1[`${ingredient}.${word}`] ?? word;
16793
+ }
16794
+ /** A whole mix from part of one: what is not named is the default (the Studio header). Refuses a word the table lacks. */
16795
+ function headerMix(partial = {}) {
16796
+ const mix = { ...H.defaults };
16797
+ for (const [k, w] of Object.entries(partial)) {
16798
+ if (w === undefined)
16195
16799
  continue;
16196
- const at = Math.round(Math.min(1, Math.max(0, m.at[0] + ((LAYOUT_HIDDEN_OPACITY - m.from) / (m.to - m.from)) * (m.at[1] - m.at[0]))) * 1000) / 1000;
16197
- if (shows(m.to) && from === null)
16198
- from = at;
16199
- else if (!shows(m.to) && from !== null) {
16200
- if (at > from)
16201
- spans.push([from, at]);
16202
- from = null;
16203
- }
16800
+ if (!INGREDIENTS[k])
16801
+ throw new HeaderMixError(`no header ingredient "${k}"`);
16802
+ if (!INGREDIENTS[k].includes(w))
16803
+ throw new HeaderMixError(`a header's ${k} cannot be "${w}" (${INGREDIENTS[k].join(' · ')})`);
16804
+ mix[k] = w;
16204
16805
  }
16205
- if (from !== null && from < 1)
16206
- spans.push([from, 1]);
16207
- return spans;
16806
+ return mix;
16208
16807
  }
16209
- /** Whether two layers' shown stretches meet for any length (no spans: shown throughout). */
16210
- function shownTogether(a, b) {
16211
- const A = a ?? [[0, 1]], B = b ?? [[0, 1]];
16212
- return A.some(([a0, a1]) => B.some(([b0, b1]) => Math.min(a1, b1) > Math.max(a0, b0)));
16808
+ /** The mix a stored header pattern id stands for (`nav.inline-cta`, `nav.centered-logo`), or null for an unknown id. */
16809
+ function namedHeaderMix(patternId) {
16810
+ const named = H.named[patternId];
16811
+ return named ? headerMix(named) : null;
16213
16812
  }
16214
- /** A control's tooltip words: the main entry's `A11yTrait.Tooltip` (premium M5), held equal by compose-layout.spec. */
16215
- const LAYOUT_TOOLTIP_TRAIT = 'tooltip';
16216
- /** The phone: at or under this breakpoint a section stacks in its `phone` order (the `mobile` breakpoint, ≤ 767px). */
16217
- const LAYOUT_PHONE_BREAKPOINT = 'mobile';
16218
- /** A phone section's padding above and below (M1.3: 56). */
16219
- const LAYOUT_PHONE_PADDING = '56px';
16220
- /** The kind of layer, for the phone's rhythm: the space between two stacked layers says how they belong (M1.3). */
16221
- function phoneGapBefore(prev, next) {
16222
- if (!prev)
16223
- return 0;
16224
- const k = (l) => l.kind;
16225
- if (k(prev) === LayoutLayerKind.Photo || k(prev) === LayoutLayerKind.Gallery || k(next) === LayoutLayerKind.Photo || k(next) === LayoutLayerKind.Gallery)
16226
- return 32;
16227
- if (k(next) === LayoutLayerKind.Button || k(next) === LayoutLayerKind.Form)
16228
- return 28;
16229
- if (k(prev) === LayoutLayerKind.Label || (k(prev) === LayoutLayerKind.Number && k(next) === LayoutLayerKind.Heading))
16230
- return 10;
16231
- if ((k(prev) === LayoutLayerKind.Heading && (k(next) === LayoutLayerKind.Text || k(next) === LayoutLayerKind.List)) || (k(prev) === LayoutLayerKind.Text && k(next) === LayoutLayerKind.Text))
16232
- return 14;
16233
- return 20;
16813
+ /** The mix a CL2 layout's `nav.kind` asks for (`bar` when it names none). */
16814
+ function headerMixOfNavKind(kind) {
16815
+ const asked = H.navKinds[kind ?? 'bar'];
16816
+ if (!asked)
16817
+ throw new HeaderMixError(`no nav kind "${kind}"`);
16818
+ return headerMix(asked);
16234
16819
  }
16235
- /** The grid a laptop page is laid on, in vw: its width inside the gutters (`LAYOUT_GUTTER` 4vw a side), the gap between
16236
- * columns (`LAYOUT_COLUMN_GAP`), and 12 columns. */
16237
- const GRID_VW = 92;
16238
- const COLUMN_GAP_VW = 1.2;
16239
- const GRID_COLUMNS$1 = 12;
16240
- /** A `screen` word's smallest and largest size (px), and the share of its room it fills (the renderer's margin). */
16241
- const LAYOUT_SCREEN_PX = [36, 560];
16242
- const SCREEN_FILL = 0.98;
16243
- const round2 = (n) => Math.round(n * 100) / 100;
16244
- /** How wide `cols` columns of the laptop grid stand, in vw (12 columns: 92vw). */
16245
- function layoutColumnsVw(cols) {
16246
- const column = (GRID_VW - (GRID_COLUMNS$1 - 1) * COLUMN_GAP_VW) / GRID_COLUMNS$1;
16247
- return cols * column + Math.max(0, cols - 1) * COLUMN_GAP_VW;
16820
+ /** The mix the product DRAWS today: every waiting word becomes its built stand-in, and each one is said as a gap. */
16821
+ function drawnHeaderMix(mix) {
16822
+ const drawn = { ...mix };
16823
+ const gaps = [];
16824
+ for (const k of Object.values(HeaderIngredient)) {
16825
+ const wait = WAITS$1[`${k}.${mix[k]}`];
16826
+ if (!wait)
16827
+ continue;
16828
+ gaps.push({ ingredient: k, word: mix[k], phase: wait.phase, drawnAs: wait.drawnAs });
16829
+ drawn[k] = wait.drawnAs;
16830
+ }
16831
+ return { drawn, gaps };
16248
16832
  }
16249
- /** The room a layer of `cols` columns has on a screen `width` px wide, in px — a phone stacks every layer full width
16250
- * inside its gutters (`max(4vw, 16px)` a side). */
16251
- function layoutRoomPx(cols, width, phone) {
16252
- return phone ? width - 2 * Math.max(0.04 * width, 16) : (layoutColumnsVw(cols) * width) / 100;
16833
+ /** The fingerprint's prefix for a header. */
16834
+ const HEADER_TOKEN = 'header';
16835
+ /** A header as the fingerprint sees it (§7): `header:<arrange>/<pages>/<menu>/<ground>/<shape>` — what a visitor takes in
16836
+ * at once, in the contract's order. Two sites with the same token wear the same header. */
16837
+ function headerTokenOf(mix) {
16838
+ return `${HEADER_TOKEN}:${H.fingerprint.map(k => mix[k]).join('/')}`;
16839
+ }
16840
+ /** A header token in words: `header:name-only/menu/drawer/solid/bar` → "name-only · menu · drawer · solid · bar". */
16841
+ const headerTokenWords = (token) => token.replace(`${HEADER_TOKEN}:`, '').split('/').join(' · ');
16842
+ /** Doron's reference headers (§2b), each as a whole mix. */
16843
+ function headerReferences() {
16844
+ return H.references
16845
+ .map(r => ({ id: r.id, after: r.after, added: r.added, mix: headerMix(r.mix) }));
16253
16846
  }
16847
+ /** The site plan's header as a mix: its `globals.header` pattern read as a named mix (HI-D4), the Studio header when it
16848
+ * names none or one the table does not know. */
16849
+ function headerMixOfPlan(plan) {
16850
+ return namedHeaderMix(plan.globals?.['header'] ?? '') ?? headerMix();
16851
+ }
16852
+
16254
16853
  /**
16255
- * A `screen` word's size (iox-ui#46): the word fills its columns' width — `widthEm` is how wide it stands at 1em in its
16256
- * own face (design-core `textWidthEm`, from the face's measured letters) — and never stands taller than its rows; never
16257
- * under 36px or over 560px. `rows` 0 sizes by width alone (a phone's stacked word). Held sections are one screen tall.
16854
+ * THE LIST TABLE (list-ingredients-plan.md; the contract's `layout.mjs` `LIST`, in the shape every mixed part shares —
16855
+ * ingredients.md §2): the words of each ingredient, what each means, and which wait for a later phase and are drawn as
16856
+ * a built word meanwhile. Everything that offers, says or draws a list word reads it here; nothing retypes one.
16258
16857
  */
16259
- function screenFontSize(widthEm, cols, rows, sectionRows, screens) {
16260
- const [min, max] = LAYOUT_SCREEN_PX;
16261
- const widthVw = round2((layoutColumnsVw(cols) / Math.max(widthEm, 0.01)) * SCREEN_FILL);
16262
- if (!rows || !sectionRows)
16263
- return `clamp(${min}px, ${widthVw}vw, ${max}px)`;
16264
- const heightSvh = round2((((rows / sectionRows) * screens * 100) / 0.92) * SCREEN_FILL);
16265
- return `clamp(${min}px, min(${widthVw}vw, ${heightSvh}svh), ${max}px)`;
16858
+ const LIST_TABLE = SPEC_SITE_LAYOUT.list;
16859
+ /** The ingredients, in the table's order. */
16860
+ const LIST_INGREDIENTS = Object.keys(LIST_TABLE.ingredients);
16861
+ const WAITS = LIST_TABLE.waits;
16862
+ const MEANINGS = LIST_TABLE.meanings;
16863
+ /** Every word of an ingredient. */
16864
+ function listIngredientWords(k) {
16865
+ return LIST_TABLE.ingredients[k];
16266
16866
  }
16267
- /** How many px a `screen` word `widthEm` wide runs past its room at its smallest size, on a screen `width` px wide — 0
16268
- * when it fits. The one thing sizing cannot mend: the static check refuses it (a browser would show it cut). */
16269
- function screenWordOverflowPx(widthEm, cols, width, phone) {
16270
- return Math.max(0, Math.round(LAYOUT_SCREEN_PX[0] * widthEm - layoutRoomPx(cols, width, phone)));
16867
+ /** The wait of a word, or null when the product draws it. */
16868
+ function listWait(k, word) {
16869
+ return WAITS[`${k}.${word}`] ?? null;
16870
+ }
16871
+ /** The words of an ingredient the product draws — the only ones the wire offers (ingredients.md §3.3). */
16872
+ function listBuiltWords(k) {
16873
+ return listIngredientWords(k).filter(w => !listWait(k, w));
16874
+ }
16875
+ /** What a word means, in the words the model and the owner read (the word itself when the table has none). */
16876
+ function listMeaning(k, word) {
16877
+ return MEANINGS[`${k}.${word}`] ?? word;
16271
16878
  }
16272
16879
 
16273
16880
  /** The scroll is replayed in steps this long (px). */
@@ -17953,6 +18560,8 @@ var ComposeIssueCode;
17953
18560
  /** A linked box to a page the plan leaves out, with no business email: it keeps its contents as a
17954
18561
  * plain Container and loses only the link. */
17955
18562
  ComposeIssueCode["LinkUnlinked"] = "link-unlinked";
18563
+ /** LI5: the footer's mix broke one of its table's rules and was mended (`checkFooter`): the detail says how. */
18564
+ ComposeIssueCode["FooterMended"] = "footer-mended";
17956
18565
  })(ComposeIssueCode || (ComposeIssueCode = {}));
17957
18566
  /** The issues that are a dangling link (a route the plan has no page for) and what was done about it. */
17958
18567
  const DANGLING_LINK_CODES = new Set([
@@ -19267,8 +19876,15 @@ function composeSite(plan, context) {
19267
19876
  layout,
19268
19877
  };
19269
19878
  });
19879
+ // LI5: the footer is the plan's footer MIX (a stored pattern id is read as one), checked and arranged from the
19880
+ // contract's footer parts; each mend is said.
19881
+ const footer = checkFooter(footerMixOfPlan(plan), { name: plan.business.name, design });
19882
+ for (const r of footer.repairs)
19883
+ issues.push({ code: ComposeIssueCode.FooterMended, nodeId: GlobalSlot.Footer, owner: GlobalSlot.Footer, detail: r.said });
19270
19884
  let globals = Object.values(GlobalSlot).map(slot => {
19271
- const pattern = patternById(plan.globals[slot]);
19885
+ const pattern = slot === GlobalSlot.Footer
19886
+ ? footerPattern(footer.mix, { name: plan.business.name, design })
19887
+ : patternById(plan.globals[slot]);
19272
19888
  const node = composePattern(pattern, slot, { ...base, owner: slot, page: null, section: null, nextAlias: null });
19273
19889
  node.isGlobal = true;
19274
19890
  node.globalPosition = pattern.global;
@@ -19880,6 +20496,10 @@ const inPart = (part, spec) => ({ ...spec, part });
19880
20496
  /** The roles a content type's fields play (`roles` of the plan shape), in the plan shape's order. */
19881
20497
  const ROLE_KEYS = shapeKeys(PLAN_SHAPE['roles']);
19882
20498
  const roleWords = ROLE_KEYS.map(role => `${role}: ${describeShapeKey(PLAN_SHAPE['roles'], role).replace(/^string — /, '')}`).join('; ');
20499
+ /** The footer's words as the model reads them (LI5): each ingredient, its words and their meanings, from the contract. */
20500
+ const FOOTER_WIRE_TEXT = 'string[] — the footer as ONE list of <ingredient>:<word> words: one word per ingredient but "holds", which lists '
20501
+ + `each block it holds (holds:pages, holds:contact); an ingredient left out is the default (${footerMixWords(footerMix()).join(', ')}). `
20502
+ + Object.values(FooterIngredient).map(k => `${k}: ${footerWords(k).map(w => `${w} (${footerMeaning(k, w)})`).join(' | ')}`).join('; ');
19883
20503
  const WIRE_KEYS = {
19884
20504
  plan: {
19885
20505
  business: inPart(PlanPart.Structure, key('plan.business')),
@@ -19979,7 +20599,9 @@ const WIRE_KEYS = {
19979
20599
  },
19980
20600
  globals: {
19981
20601
  header: key('globals.header'),
19982
- footer: key('globals.footer'),
20602
+ // LI5: the footer travels as its MIX — ONE list of `<ingredient>:<word>` words (footer-mix.ts), every word with its
20603
+ // meaning from the contract's footer table; the plan keeps the pattern it reads as (`globals.footer`) and the mix.
20604
+ footer: { refs: ['globals.footer', 'plan.mixes', 'mixes.footer'], text: FOOTER_WIRE_TEXT },
19983
20605
  },
19984
20606
  shopProduct: {
19985
20607
  name: key('shopProduct.name'),
@@ -19994,6 +20616,7 @@ const WIRE_KEYS = {
19994
20616
  };
19995
20617
  /** The plan keys the model does not write, and where the expander takes each from. */
19996
20618
  const PLAN_WIRE_DERIVED = {
20619
+ 'mixes.header': 'header ingredients HI1 — until then the header is its globals pattern',
19997
20620
  'field.type': 'follows from the field\'s control (FIELD_TYPE_OF_CONTROL)',
19998
20621
  'plan.version': `always '${SITE_PLAN_VERSION}'`,
19999
20622
  'plan.source': 'this run (the context)',
@@ -20134,7 +20757,7 @@ const PLAN_TOP_SCHEMAS = {
20134
20757
  pages: () => jsonListOf(wirePageJsonSchema()),
20135
20758
  globals: () => shaped(PlanWireEntry.Globals, {
20136
20759
  [GlobalSlot.Header]: jsonOneOf(globalIds(PatternGlobalPosition.Before)),
20137
- [GlobalSlot.Footer]: jsonOneOf(globalIds(PatternGlobalPosition.After)),
20760
+ [GlobalSlot.Footer]: jsonListOf(jsonOneOf(footerWireWords())),
20138
20761
  }),
20139
20762
  direction: () => shaped(PlanWireEntry.Direction, { idea: jsonText(), cliche: jsonText(), flip: jsonText(), rules: jsonListOf(jsonText()) }),
20140
20763
  shop: () => jsonListOf(wireShopProductJsonSchema()),
@@ -20287,10 +20910,11 @@ function expandPlanWire(parts, context) {
20287
20910
  if (odd !== undefined)
20288
20911
  return odd;
20289
20912
  const wire = Object.assign({}, ...written);
20290
- const { business, contentTypes, dataSources, pages, direction, shop, ...rest } = wire;
20913
+ const { business, contentTypes, dataSources, pages, direction, shop, globals, ...rest } = wire;
20291
20914
  const sells = expandWireShop(shop);
20292
20915
  return withDerivedSources({
20293
20916
  ...rest,
20917
+ ...expandWireGlobals(globals),
20294
20918
  ...(sells === undefined ? {} : { shop: sells }),
20295
20919
  ...(isPlainObject(direction) && direction['idea'] === NONE$1 ? {} : direction === undefined ? {} : { direction }),
20296
20920
  version: SITE_PLAN_VERSION,
@@ -20303,6 +20927,26 @@ function expandPlanWire(parts, context) {
20303
20927
  pages: each(pages, expandWirePage),
20304
20928
  });
20305
20929
  }
20930
+ /** The wire's globals → the plan's: a footer mix that is a stored footer pattern becomes that pattern; any other becomes
20931
+ * `mixes.footer` beside the Studio footer (the mix wins). A footer that is not a word list is left for the validator. */
20932
+ function expandWireGlobals(globals) {
20933
+ if (globals === undefined)
20934
+ return {};
20935
+ if (!isPlainObject(globals))
20936
+ return { globals };
20937
+ const words = globals[GlobalSlot.Footer];
20938
+ if (!Array.isArray(words))
20939
+ return { globals };
20940
+ let named = null;
20941
+ try {
20942
+ named = footerPatternIdOf(footerMixFromWords(words));
20943
+ }
20944
+ catch { /* the validator names the word */ }
20945
+ // A mix that IS a stored footer is kept as that pattern alone (the plan stays as a template would write it).
20946
+ if (named)
20947
+ return { globals: { ...globals, [GlobalSlot.Footer]: named } };
20948
+ return { globals: { ...globals, [GlobalSlot.Footer]: DEFAULT_FOOTER_PATTERN }, mixes: { footer: [...words] } };
20949
+ }
20306
20950
  // ── The plan → the wire ────────────────────────────────────────────────────────────────────────────────────────────
20307
20951
  function fieldToWire(field) {
20308
20952
  return { name: field.name, controller: field.controller, required: field.required ?? false, note: field.note ?? NONE$1 };
@@ -20351,7 +20995,7 @@ const PLAN_TO_WIRE = {
20351
20995
  contentTypes: plan => plan.contentTypes.map(type => contentTypeToWire(type)),
20352
20996
  dataSources: plan => plan.dataSources.map(dataSourceToWire),
20353
20997
  pages: plan => plan.pages.map(page => pageToWire(page)),
20354
- globals: plan => ({ ...plan.globals }),
20998
+ globals: plan => ({ ...plan.globals, [GlobalSlot.Footer]: footerMixWords(footerMixOfPlan(plan)) }),
20355
20999
  direction: plan => ({ idea: plan.direction?.idea ?? NONE$1, cliche: plan.direction?.cliche ?? NONE$1, flip: plan.direction?.flip ?? NONE$1, rules: [...(plan.direction?.rules ?? [])] }),
20356
21000
  shop: plan => (plan.shop?.products ?? []).map(p => ({ name: p.name, category: p.category, description: p.description, options: p.options.map(o => ({ name: o.name, values: [...o.values] })) })),
20357
21001
  };
@@ -25096,9 +25740,9 @@ function openingOf(s) {
25096
25740
  return lead.kind;
25097
25741
  return lead.size ? `${lead.size}-${lead.kind}` : lead.kind;
25098
25742
  }
25099
- /** A page's fingerprint, worn in `preset` and `mode`, under the site's `header` when it is known. A photo ground opens on
25743
+ /** A page's fingerprint, worn in `preset` and `mode`, under the site's `header` and `footer` when they are known. A photo ground opens on
25100
25744
  * the page's own ground colour. */
25101
- function fingerprintOf(page, preset, mode, header) {
25745
+ function fingerprintOf(page, preset, mode, header, footer) {
25102
25746
  const sections = page.sections ?? [];
25103
25747
  const lists = listTokensOf(page);
25104
25748
  const first = sections[0];
@@ -25114,8 +25758,13 @@ function fingerprintOf(page, preset, mode, header) {
25114
25758
  preset,
25115
25759
  ...(lists.length ? { lists } : {}),
25116
25760
  ...(header ? { header: headerTokenOf(header) } : {}),
25761
+ ...(footer ? { footer: footerTokenOf(footer) } : {}),
25117
25762
  };
25118
25763
  }
25764
+ /** A composed page's fingerprint under its site plan's header and footer — the ONE call every reader of a plan makes. */
25765
+ function fingerprintOfPlanPage(page, preset, mode, plan) {
25766
+ return fingerprintOf(page, preset, mode, headerMixOfPlan(plan), footerMixOfPlan(plan));
25767
+ }
25119
25768
  /** The longest common subsequence of two sequences. */
25120
25769
  function lcs(a, b) {
25121
25770
  const d = Array.from({ length: a.length + 1 }, () => new Array(b.length + 1).fill(0));
@@ -25339,5 +25988,5 @@ function layoutRepairJsonSchema() {
25339
25988
  * Generated bundle index. Do not edit.
25340
25989
  */
25341
25990
 
25342
- export { ACCOUNT_ENTRY_ID, ACTION_START_SCALE, ACTIVE_BUILD_STATUSES, AI_COMPOSED_PAGES_ESTIMATED, AI_PLAN_REASKED_PART, AI_REFUSAL_NEXT, AI_REFUSAL_STATUS, AI_STEPS, AI_STEP_FEATURE, AI_STEP_LABELS, AI_STEP_NEEDS, AI_STEP_PART_TOKENS, AI_STEP_TYPICAL_TOKENS, ART_DIRECTION_PARTS, AiCallStatus, AiCapability, AiFeature, AiGenerationStage, AiKeyMode, AiLimit, AiNextKind, AiProviderId, AiRefusalCode, AiStep, BAR_ITEMS_MAX, BAR_ITEMS_MIN, BASELINE_ROLES, BUILD_STEPS, BaselineRole, BindScope, BuildNoticeCode, BuildStep, CONTENT_ROLE_MEANINGS, CREDITS_PER_USD, CardBindTarget, CheckSeverity, ComposeError, ComposeIssueCode, ContentFieldControl, ContentFieldType, ContentRole, ContentTypeAction, CreatedKind, DANGLING_LINK_CODES, DEFAULT_PHONE_MENU_BREAKPOINT, DEFAULT_SITE_LOCALE, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, EntranceSide, FACT_KEYS, FIELD_TYPE_OF_CONTROL, FILL_ASPECT, FILM_PATTERN, FINAL_GENERATION_STAGES, FINDING_SEVERITY, FilmUnplaced, GRAMMAR_TOO_LARGE_MESSAGE, GlobalSlot, HEADER_TOKEN, HEBREW_PREFIXES, HeaderIngredient, HeaderMixError, JSON_SCHEMA_BANNED_KEYWORDS, JsonSchemaShapeError, KeptReason, LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_CHECK_VIEWPORT, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_DRIFT, LAYOUT_EASING, LAYOUT_ENTRANCE_MAX_MS, LAYOUT_FONT_SIZE, LAYOUT_GUTTER, LAYOUT_HIDDEN_OPACITY, LAYOUT_KINETIC_KINDS, LAYOUT_LINE_HEIGHT, LAYOUT_LIST_TOKEN, LAYOUT_MIX_OFFERED, LAYOUT_MIX_WORDS, LAYOUT_OPERATED, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHONE_PADDING, LAYOUT_PHOTO_ASPECT, LAYOUT_READY_MADE_TOKEN, LAYOUT_RISE, LAYOUT_SCREEN_PX, LAYOUT_TEXT_KINDS, LAYOUT_TOOLTIP_TRAIT, LAYOUT_VIEWPORTS, LAYOUT_WIRE_AUTOPLAY_MS, LIST_CARD_PART, LIST_INGREDIENTS, LIST_LONG_WORDS, LIST_ROLE_WORDS, LIST_TABLE, LayoutAlign, LayoutBleed, LayoutButtonVariant, LayoutColour, LayoutColourMode, LayoutDepth, LayoutDial, LayoutEase, LayoutEditOp, LayoutEnter, LayoutGalleryEffect, LayoutGapCode, LayoutIssueCode, LayoutLayerKind, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMove, LayoutListPhone, LayoutListRole, LayoutListWho, LayoutMendKind, LayoutMixIngredient, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutPhotoSource, LayoutRole, LayoutSectionKind, LayoutSequenceToken, LayoutSide, LayoutSignatureId, LayoutSize, LayoutSourceChoice, LayoutTrackProp, LayoutTransition, LayoutViewport, MAX_SITE_PICTURES, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NO_TOKENS, NavPagesSource, NavRole, NavShape, NavShapeError, PAGE_ARCHETYPES, PHOTO_ANALYSIS_WIDTH, PHOTO_CALM_DETAIL, PHOTO_GRID, PHOTO_LIGHT_LUMINANCE, PICTURE_ASPECTS, PICTURE_NEVER, PICTURE_REAL_PLACE_FAMILIES, PICTURE_REROLL_EVERY, PICTURE_REVIEW_FORMAT, PICTURE_REVIEW_SHAPE, PICTURE_TEXT_CONTRAST, PICTURE_WORLDS, PICTURE_WORLD_IDS, PLAN_EDITS_ANSWER_SHAPES, PLAN_EDITS_PART_SCHEMA_NAMES, PLAN_EDIT_OP_PART, PLAN_EDIT_SHAPE, PLAN_EDIT_WIRE_KEYS, PLAN_PARTS, PLAN_PART_KEYS, PLAN_WIRE_DERIVED, PLAN_WIRE_PART_SCHEMA_NAMES, PLAN_WIRE_SHAPE, PRICING_PATTERN, PROOF_FINGERPRINTS, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PhotoTone, PictureRefusal, PictureWorld, PlaceholderKind, PlanChangeAction, PlanChangeKind, PlanDataSourceMode, PlanDataSourceType, PlanEditIssueCode, PlanEditOp, PlanEditsOutcome, PlanPart, PlanWireEntry, PlanWireShapeError, PlanWordIssueCode, PreflightRefusalCode, PriceBindTarget, PublishRefusalCode, PublishScope, RENDER_CHECK, REQUIRED_CONTENT_ROLES, RelativeOp, SAMPLE_IMAGE_REF, SCENE_LEVEL, SCENE_OTHER_PAGES, SCRIM_BACKGROUND, SCRIM_COVER, SCRIM_LEVELS, SHOP_CART_BUTTON_ID, SHOP_CART_DRAWER_ID, SHOP_FIELDS, SHOP_LATEST_LIMIT, SHOP_LIST_LIMIT, SHOP_NEED, SHOP_ONLY_CONTENT_ROLES, SHOP_PRODUCTS_MAX, SHOP_ROLES, SHOP_SLUG_FIELD, SHOWCASE_FILM, SHOWCASE_SHOP, SIGN_IN_DIALOG_ID, SITE_CHECKS, SITE_FACT_LABELS, SITE_HEADER_PATTERN, SITE_LIBRARY, SITE_LOCALES, SITE_NEED_IDS, SITE_PATTERNS, SITE_PLAN_VERSION, SITE_TEMPLATES, SPEC_SITE_ARCHETYPES, SPEC_SITE_COPY_LENGTHS, SPEC_SITE_DENSITY_COPY, SPEC_SITE_FACTS, SPEC_SITE_LAYOUT, SPEC_SITE_LIBRARY, SPEC_SITE_LOCALES, SPEC_SITE_NEED_IDS, SPEC_SITE_PATTERNS, SPEC_SITE_PICTURE_NEVER, SPEC_SITE_PICTURE_WORLDS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_REQUIRED_ROLES, SPEC_SITE_ROLES, SPEC_SITE_TEMPLATES, STOCK_FAMILIES, STOCK_FAMILY_INTENTS, STOCK_INTENT_ORDER, STOCK_INTENT_SUBJECTS, STOCK_ITEM_ASPECT, STOCK_MIN_KEPT, STOCK_PROVIDER_TERMS, STOCK_SEED_MARGIN, STOCK_SUBJECT_WORDS, STORE_CONTACT_CODES, STRICT_SCHEMA_BUDGET, STRICT_SCHEMA_LIMITS, STUDIO_TEMPLATE, ScrimLevel, SectionFallbackLastResort, SectionSwapAction, SectionSwapRule, ShopResource, ShopSourceRole, SiteBuildKind, SiteBuildStatus, SiteCheckId, SiteFindingCode, SiteLocale, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SiteTemplateError, SiteTemplateId, StepState, StockIntent, StockOrientation, StockProviderId, StockReviewFlag, StockReviewVerdict, StockSlotKind, StockSubject, WORDS_AREA_DEFAULT_SHARE, WordsEdge, addBarItem, addStockCredits, aiRefusalNext, aiStepParts, applyLayoutEdits, applyOwnPhotoGalleries, applyPictureScrims, applyPlanEdits, applyStockItemPhotos, applyStockPhotos, archetypeIssues, areaLuminance, artDirectionFor, artDirectionIssues, artDirectionPreamble, aspectRatioOf, assertStyleSlots, assertValidSitePlan, auditLayoutMotion, auditSite, barIconForRoute, blocksPublish, brandHueWord, buildKeys, buildStepFacts, buildStepsOf, builtHomePageId, calmParts, calmUnder, checkLayout, checkList, chooseScrim, composeContextOf, composeLayout, composeNavHeader, composePresetForm, composeSection, composeSite, contentTypeOfSource, contentTypePreviewFields, contentTypeToWire, copyLengthOf, costUsd, coverCrop, createSerializedNode, creditsOfUsd, dataSourceToWire, derivedBeats, derivedDataSources, derivedShopSources, describeInventoryForPrompt, describeListShape, describePlanData, describeShapeKey, drawnHeaderMix, driftAt, driftOverlap, emptyAreaPhrase, entranceAction, entranceInteraction, estimatePictures, estimateStepCredits, expandLayoutWire, expandPlanWire, expandWireContentType, expandWireDataSource, expandWireEdit, expandWireField, expandWirePage, expandWireSection, expandWireShop, factIssues, failedBuildStep, fallBackBySection, fieldToWire, filmOfPlan, filmPlacement, findNavRoot, fingerprintOf, frameWords, headerMeaning, headerMix, headerMixOfNavKind, headerMixOfPlan, headerReferences, headerTokenOf, headerTokenWords, headerWords, isActiveBuild, isLayoutRule, isNonEmptyString, isPictureWorld, isPlainObject, isRtlLocale, isShopResource, jsonAnyOf, jsonBoolean, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonSchemaKeywords, jsonSchemaObjects, jsonShapedObject, jsonText, judgeLayoutRender, layerShownSpans, layoutBandScheme, layoutBoxPx, layoutColumnsVw, layoutDesignOf, layoutDialOf, layoutDriftPhoto, layoutElementStyle, layoutGalleryLists, layoutGallerySources, layoutGlideDepth, layoutHeldStill, layoutListBinding, layoutListShapes, layoutLookChanges, layoutLookOf, layoutMotionOf, layoutNodeClass, layoutOpeningDisplayMend, layoutOpeningDisplays, layoutPathSteps, layoutPhotoIds, layoutPresetColours, layoutPresetOf, layoutRepairJsonSchema, layoutRoomPx, layoutRuleEdge, layoutShapeHasPurpose, layoutStillLine, layoutTextFits, layoutTextWidthEm, layoutToWire, layoutVoidScreens, layoutVoids, layoutWireJsonSchema, layoutWirePartWords, listBuiltWords, listIngredientWords, listMeaning, listTokenOf, listTokensOf, listWait, listWords, luminanceOf, measureLayout, mendLayout, menuAtEveryWidth, modelCanDo, moveBarItem, namedHeaderMix, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, orientationOfRatio, ownPhotoFit, pageListIssues, pageToWire, parseLayoutPhotoId, parsePatternPath, parseSampleImageRef, pathAt, patternById, patternHasForm, patternLinkSlots, patternListGap, patternManifest, patternNeedsBinding, patternNodes, patternOptionalParts, patternRoleNeeds, patternScopes, patternSlotBudgets, patternSlots, patternTakesBinding, phoneGapBefore, phoneMenuPages, phoneWordsColour, photoInventory, photoShapeOf, pictureAspect, pictureItemsOf, picturePrompt, pictureRefusalOf, pictureRerolls, pictureReviewIssues, pictureReviewJsonSchema, pictureReviewPasses, pictureSlotKey, pictureTargets, pictureTryFits, pixelsUnder, placeFilm, planEditOps, planEditToWire, planEditWireGaps, planEditWireKeys, planEditWireOps, planEditWireShape, planEditsFromWire, planEditsJsonSchema, planEditsToWire, planEntrances, planFromTemplate, planHasShopSource, planLayoutPhotos, planNavShape, planOwnPhotos, planPartOfPath, planPartToWire, planPictures, planSells, planStockPhotos, planToWire, planWireGaps, planWirePartJsonSchema, planWirePartShape, planWordIssues, pricesIn, publishRefusal, publishVerdict, readyMadeColumn, recipeListBinds, recomposeAsks, releasedLayoutDefaults, removeBarItem, requiredAcknowledgements, requiredShapeKeys, roleField, routeMatches, routeParams, samenessIssues, sampleImageRef, scoreStockPhoto, screenFontSize, screenWordColumns, screenWordMisfit, screenWordOverflowPx, sectionEntrances, sectionPatternIds, sectionToWire, sectionTokenOf, sectionsNamed, sequenceShare, sequenceTokenOf, setStyleProps, shapeKeys, shopCategoriesOf, shopContentType, shopSourceAliases, showcaseGlobals, showcasePages, showcasePlans, showcaseScenes, showcaseStorePages, shownTogether, signatureOf, siteNavPages, siteSells, slotBudget, splitSide, stockCopyKey, stockCreditLine, stockCreditLines, stockCreditNode, stockCreditNodeId, stockFits, stockGroupOf, stockItemSlots, stockKept, stockPhotoRatio, stockPhotoSubject, stockPhotoUsable, stockPhotoWords, stockSlots, stockWord, stockWords, strictSchemaComplexity, strictSchemaRefusal, toneOf, typicalStepTokens, validatePlanEdits, validateSitePlan, variantNamesOf, walkSerialized, wireContentTypeJsonSchema, wireDataSourceJsonSchema, wireFieldJsonSchema, wirePageJsonSchema, wireSectionJsonSchema, wireShopProductJsonSchema, withDerivedSources, wordPattern, wordsOverPhotos, wordsOverPicture, writtenTexts };
25991
+ export { ACCOUNT_ENTRY_ID, ACTION_START_SCALE, ACTIVE_BUILD_STATUSES, AI_COMPOSED_PAGES_ESTIMATED, AI_PLAN_REASKED_PART, AI_REFUSAL_NEXT, AI_REFUSAL_STATUS, AI_STEPS, AI_STEP_FEATURE, AI_STEP_LABELS, AI_STEP_NEEDS, AI_STEP_PART_TOKENS, AI_STEP_TYPICAL_TOKENS, ART_DIRECTION_PARTS, AiCallStatus, AiCapability, AiFeature, AiGenerationStage, AiKeyMode, AiLimit, AiNextKind, AiProviderId, AiRefusalCode, AiStep, BAR_ITEMS_MAX, BAR_ITEMS_MIN, BASELINE_ROLES, BUILD_STEPS, BaselineRole, BindScope, BuildNoticeCode, BuildStep, CONTENT_ROLE_MEANINGS, CREDITS_PER_USD, CardBindTarget, CheckSeverity, ComposeError, ComposeIssueCode, ContentFieldControl, ContentFieldType, ContentRole, ContentTypeAction, CreatedKind, DANGLING_LINK_CODES, DEFAULT_FOOTER_PATTERN, DEFAULT_PHONE_MENU_BREAKPOINT, DEFAULT_SITE_LOCALE, ENTRANCE_EASING, ENTRANCE_ORIGIN_LOOK, ENTRANCE_TRIGGER, EntrancePart, EntranceSide, FACT_KEYS, FIELD_TYPE_OF_CONTROL, FILL_ASPECT, FILM_PATTERN, FINAL_GENERATION_STAGES, FINDING_SEVERITY, FOOTER_TOKEN, FilmUnplaced, FooterArrange, FooterClosing, FooterGround, FooterHold, FooterIngredient, FooterMixError, FooterRepairCode, GRAMMAR_TOO_LARGE_MESSAGE, GlobalSlot, HEADER_TOKEN, HEBREW_PREFIXES, HeaderIngredient, HeaderMixError, JSON_SCHEMA_BANNED_KEYWORDS, JsonSchemaShapeError, KeptReason, LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_CHECK_VIEWPORT, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_DRIFT, LAYOUT_EASING, LAYOUT_ENTRANCE_MAX_MS, LAYOUT_FONT_SIZE, LAYOUT_GUTTER, LAYOUT_HIDDEN_OPACITY, LAYOUT_KINETIC_KINDS, LAYOUT_LINE_HEIGHT, LAYOUT_LIST_TOKEN, LAYOUT_MIX_OFFERED, LAYOUT_MIX_WORDS, LAYOUT_OPERATED, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHONE_PADDING, LAYOUT_PHOTO_ASPECT, LAYOUT_READY_MADE_TOKEN, LAYOUT_RISE, LAYOUT_SCREEN_PX, LAYOUT_TEXT_KINDS, LAYOUT_TOOLTIP_TRAIT, LAYOUT_VIEWPORTS, LAYOUT_WIRE_AUTOPLAY_MS, LIST_CARD_PART, LIST_INGREDIENTS, LIST_LONG_WORDS, LIST_ROLE_WORDS, LIST_TABLE, LayoutAlign, LayoutBleed, LayoutButtonVariant, LayoutColour, LayoutColourMode, LayoutDepth, LayoutDial, LayoutEase, LayoutEditOp, LayoutEnter, LayoutGalleryEffect, LayoutGapCode, LayoutIssueCode, LayoutLayerKind, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMove, LayoutListPhone, LayoutListRole, LayoutListWho, LayoutMendKind, LayoutMixIngredient, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutPhotoSource, LayoutRole, LayoutSectionKind, LayoutSequenceToken, LayoutSide, LayoutSignatureId, LayoutSize, LayoutSourceChoice, LayoutTrackProp, LayoutTransition, LayoutViewport, MAX_SITE_PICTURES, NAV_PART_LABELS, NAV_SHAPE_COPY, NEUTRAL_STYLE_PROPS, NODE_BASELINES, NO_TOKENS, NavPagesSource, NavRole, NavShape, NavShapeError, PAGE_ARCHETYPES, PHOTO_ANALYSIS_WIDTH, PHOTO_CALM_DETAIL, PHOTO_GRID, PHOTO_LIGHT_LUMINANCE, PICTURE_ASPECTS, PICTURE_NEVER, PICTURE_REAL_PLACE_FAMILIES, PICTURE_REROLL_EVERY, PICTURE_REVIEW_FORMAT, PICTURE_REVIEW_SHAPE, PICTURE_TEXT_CONTRAST, PICTURE_WORLDS, PICTURE_WORLD_IDS, PLAN_EDITS_ANSWER_SHAPES, PLAN_EDITS_PART_SCHEMA_NAMES, PLAN_EDIT_OP_PART, PLAN_EDIT_SHAPE, PLAN_EDIT_WIRE_KEYS, PLAN_PARTS, PLAN_PART_KEYS, PLAN_WIRE_DERIVED, PLAN_WIRE_PART_SCHEMA_NAMES, PLAN_WIRE_SHAPE, PRICING_PATTERN, PROOF_FINGERPRINTS, PUBLISH_BLOCKING_PLACEHOLDERS, PageDataKind, PathIssueCollector, PatternDirective, PatternGlobalPosition, PatternOpens, PatternPlaceholder, PatternRecipe, PhoneMenuBreakpoint, PhotoTone, PictureRefusal, PictureWorld, PlaceholderKind, PlanChangeAction, PlanChangeKind, PlanDataSourceMode, PlanDataSourceType, PlanEditIssueCode, PlanEditOp, PlanEditsOutcome, PlanPart, PlanWireEntry, PlanWireShapeError, PlanWordIssueCode, PreflightRefusalCode, PriceBindTarget, PublishRefusalCode, PublishScope, RENDER_CHECK, REQUIRED_CONTENT_ROLES, RelativeOp, SAMPLE_IMAGE_REF, SCENE_LEVEL, SCENE_OTHER_PAGES, SCRIM_BACKGROUND, SCRIM_COVER, SCRIM_LEVELS, SHOP_CART_BUTTON_ID, SHOP_CART_DRAWER_ID, SHOP_FIELDS, SHOP_LATEST_LIMIT, SHOP_LIST_LIMIT, SHOP_NEED, SHOP_ONLY_CONTENT_ROLES, SHOP_PRODUCTS_MAX, SHOP_ROLES, SHOP_SLUG_FIELD, SHOWCASE_FILM, SHOWCASE_SHOP, SIGN_IN_DIALOG_ID, SITE_CHECKS, SITE_FACT_LABELS, SITE_HEADER_PATTERN, SITE_LIBRARY, SITE_LOCALES, SITE_NEED_IDS, SITE_PATTERNS, SITE_PLAN_VERSION, SITE_TEMPLATES, SPEC_SITE_ARCHETYPES, SPEC_SITE_COPY_LENGTHS, SPEC_SITE_DENSITY_COPY, SPEC_SITE_FACTS, SPEC_SITE_FOOTER_PARTS, SPEC_SITE_LAYOUT, SPEC_SITE_LIBRARY, SPEC_SITE_LOCALES, SPEC_SITE_NEED_IDS, SPEC_SITE_PATTERNS, SPEC_SITE_PICTURE_NEVER, SPEC_SITE_PICTURE_WORLDS, SPEC_SITE_PLAN_SHAPE, SPEC_SITE_REQUIRED_ROLES, SPEC_SITE_ROLES, SPEC_SITE_TEMPLATES, STOCK_FAMILIES, STOCK_FAMILY_INTENTS, STOCK_INTENT_ORDER, STOCK_INTENT_SUBJECTS, STOCK_ITEM_ASPECT, STOCK_MIN_KEPT, STOCK_PROVIDER_TERMS, STOCK_SEED_MARGIN, STOCK_SUBJECT_WORDS, STORE_CONTACT_CODES, STRICT_SCHEMA_BUDGET, STRICT_SCHEMA_LIMITS, STUDIO_TEMPLATE, ScrimLevel, SectionFallbackLastResort, SectionSwapAction, SectionSwapRule, ShopResource, ShopSourceRole, SiteBuildKind, SiteBuildStatus, SiteCheckId, SiteFindingCode, SiteLocale, SitePlanError, SitePlanIssueCode, SitePlanSourceKind, SiteTemplateError, SiteTemplateId, StepState, StockIntent, StockOrientation, StockProviderId, StockReviewFlag, StockReviewVerdict, StockSlotKind, StockSubject, WORDS_AREA_DEFAULT_SHARE, WordsEdge, addBarItem, addStockCredits, aiRefusalNext, aiStepParts, applyLayoutEdits, applyOwnPhotoGalleries, applyPictureScrims, applyPlanEdits, applyStockItemPhotos, applyStockPhotos, archetypeIssues, areaLuminance, artDirectionFor, artDirectionIssues, artDirectionPreamble, aspectRatioOf, assertStyleSlots, assertValidSitePlan, auditLayoutMotion, auditSite, barIconForRoute, blocksPublish, brandHueWord, buildKeys, buildStepFacts, buildStepsOf, builtHomePageId, calmParts, calmUnder, checkFooter, checkLayout, checkList, chooseScrim, composeContextOf, composeLayout, composeNavHeader, composePresetForm, composeSection, composeSite, contentTypeOfSource, contentTypePreviewFields, contentTypeToWire, copyLengthOf, costUsd, coverCrop, createSerializedNode, creditsOfUsd, dataSourceToWire, derivedBeats, derivedDataSources, derivedShopSources, describeInventoryForPrompt, describeListShape, describePlanData, describeShapeKey, distinctFooter, drawnHeaderMix, driftAt, driftOverlap, emptyAreaPhrase, entranceAction, entranceInteraction, estimatePictures, estimateStepCredits, expandLayoutWire, expandPlanWire, expandWireContentType, expandWireDataSource, expandWireEdit, expandWireField, expandWirePage, expandWireSection, expandWireShop, factIssues, failedBuildStep, fallBackBySection, fieldToWire, filmOfPlan, filmPlacement, findNavRoot, fingerprintOf, fingerprintOfPlanPage, footerMeaning, footerMix, footerMixFromWords, footerMixOfPlan, footerMixWords, footerPattern, footerPatternIdOf, footerReferences, footerTokenOf, footerTokenWords, footerWireWords, footerWords, frameWords, headerMeaning, headerMix, headerMixOfNavKind, headerMixOfPlan, headerReferences, headerTokenOf, headerTokenWords, headerWords, isActiveBuild, isLayoutRule, isNonEmptyString, isPictureWorld, isPlainObject, isRtlLocale, isShopResource, jsonAnyOf, jsonBoolean, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonSchemaKeywords, jsonSchemaObjects, jsonShapedObject, jsonText, judgeLayoutRender, layerShownSpans, layoutBandScheme, layoutBoxPx, layoutColumnsVw, layoutDesignOf, layoutDialOf, layoutDriftPhoto, layoutElementStyle, layoutGalleryLists, layoutGallerySources, layoutGlideDepth, layoutHeldStill, layoutListBinding, layoutListShapes, layoutLookChanges, layoutLookOf, layoutMotionOf, layoutNodeClass, layoutOpeningDisplayMend, layoutOpeningDisplays, layoutPathSteps, layoutPhotoIds, layoutPresetColours, layoutPresetOf, layoutRepairJsonSchema, layoutRoomPx, layoutRuleEdge, layoutShapeHasPurpose, layoutStillLine, layoutTextFits, layoutTextWidthEm, layoutToWire, layoutVoidScreens, layoutVoids, layoutWireJsonSchema, layoutWirePartWords, listBuiltWords, listIngredientWords, listMeaning, listTokenOf, listTokensOf, listWait, listWords, luminanceOf, measureLayout, mendLayout, menuAtEveryWidth, modelCanDo, moveBarItem, namedFooterMix, namedHeaderMix, navPages, navShapeBreakpoint, navShapeOf, nextSourceOf, nodeBindPaths, orientationOfRatio, ownPhotoFit, pageListIssues, pageToWire, parseLayoutPhotoId, parsePatternPath, parseSampleImageRef, pathAt, patternById, patternHasForm, patternLinkSlots, patternListGap, patternManifest, patternNeedsBinding, patternNodes, patternOptionalParts, patternRoleNeeds, patternScopes, patternSlotBudgets, patternSlots, patternTakesBinding, phoneGapBefore, phoneMenuPages, phoneWordsColour, photoInventory, photoShapeOf, pictureAspect, pictureItemsOf, picturePrompt, pictureRefusalOf, pictureRerolls, pictureReviewIssues, pictureReviewJsonSchema, pictureReviewPasses, pictureSlotKey, pictureTargets, pictureTryFits, pixelsUnder, placeFilm, planEditOps, planEditToWire, planEditWireGaps, planEditWireKeys, planEditWireOps, planEditWireShape, planEditsFromWire, planEditsJsonSchema, planEditsToWire, planEntrances, planFromTemplate, planHasShopSource, planLayoutPhotos, planNavShape, planOwnPhotos, planPartOfPath, planPartToWire, planPictures, planSells, planStockPhotos, planToWire, planWireGaps, planWirePartJsonSchema, planWirePartShape, planWordIssues, pricesIn, publishRefusal, publishVerdict, readyMadeColumn, recipeListBinds, recomposeAsks, releasedLayoutDefaults, removeBarItem, requiredAcknowledgements, requiredShapeKeys, roleField, routeMatches, routeParams, samenessIssues, sampleImageRef, scoreStockPhoto, screenFontSize, screenWordColumns, screenWordMisfit, screenWordOverflowPx, sectionEntrances, sectionPatternIds, sectionToWire, sectionTokenOf, sectionsNamed, sequenceShare, sequenceTokenOf, setStyleProps, shapeKeys, shopCategoriesOf, shopContentType, shopSourceAliases, showcaseGlobals, showcasePages, showcasePlans, showcaseScenes, showcaseStorePages, shownTogether, signatureOf, siteNavPages, siteSells, slotBudget, splitSide, stockCopyKey, stockCreditLine, stockCreditLines, stockCreditNode, stockCreditNodeId, stockFits, stockGroupOf, stockItemSlots, stockKept, stockPhotoRatio, stockPhotoSubject, stockPhotoUsable, stockPhotoWords, stockSlots, stockWord, stockWords, strictSchemaComplexity, strictSchemaRefusal, toneOf, typicalStepTokens, validatePlanEdits, validateSitePlan, variantNamesOf, walkSerialized, wireContentTypeJsonSchema, wireDataSourceJsonSchema, wireFieldJsonSchema, wirePageJsonSchema, wireSectionJsonSchema, wireShopProductJsonSchema, withDerivedSources, withDistinctFooter, wordPattern, wordsOverPhotos, wordsOverPicture, writtenTexts };
25343
25992
  //# sourceMappingURL=vectoriox-iox-ui-generation-core.mjs.map