@thorprovider/storefront 0.4.0-mvp.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +10 -12
  2. package/assets/templates/app/app/[[...slug]]/page.tsx +14 -1
  3. package/assets/templates/app/app/[[...slug]]/renderer.tsx +43 -12
  4. package/assets/templates/app/lib/__STOREFRONT__/account-boundary.client.tsx +76 -0
  5. package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +461 -0
  6. package/assets/templates/app/lib/__STOREFRONT__/account-mutation.client.ts +46 -0
  7. package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +103 -0
  8. package/assets/templates/app/lib/__STOREFRONT__/account-reconcile.client.ts +465 -0
  9. package/assets/templates/app/lib/__STOREFRONT__/account-session.core.ts +177 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/account-session.ts +44 -0
  11. package/assets/templates/app/lib/__STOREFRONT__/account-user.core.ts +65 -0
  12. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +76 -27
  13. package/assets/templates/app/lib/__STOREFRONT__/catalog.ts +4 -4
  14. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +0 -10
  15. package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +3 -3
  16. package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +17 -18
  17. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +209 -0
  18. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.ts +247 -0
  19. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +48 -19
  20. package/assets/templates/app/lib/__STOREFRONT__/schema.ts +49 -11
  21. package/assets/templates/app/lib/__STOREFRONT__/section-sources.ts +3 -5
  22. package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +25 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +4 -2
  24. package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +1 -1
  25. package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +1 -1
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +1 -1
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +1 -1
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.client.tsx +16 -16
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.products.ts +1 -1
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +1 -1
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +1 -1
  32. package/assets/templates/features/customer-auth/handlers.ts +19 -23
  33. package/assets/templates/features/customer-auth/state.ts +21 -0
  34. package/assets/templates/views/account/index.tsx +19 -7
  35. package/assets/templates/views/account/registry.tsx +234 -155
  36. package/assets/templates/views/cart/data.ts +7 -7
  37. package/assets/templates/views/cart/registry.tsx +4 -3
  38. package/assets/templates/views/category/assembly/assembly.json +1 -1
  39. package/assets/templates/views/category/assembly/registry.skeleton.tsx +6 -6
  40. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/binding.json +1 -1
  41. package/assets/templates/views/category/registry.tsx +7 -7
  42. package/assets/templates/views/checkout/registry.tsx +3 -5
  43. package/assets/templates/views/home/assembly/assembly.json +4 -4
  44. package/assets/templates/views/home/assembly/index.skeleton.tsx +2 -1
  45. package/assets/templates/views/home/assembly/registry.skeleton.tsx +4 -1
  46. package/assets/templates/views/home/assembly/slots/benefits/cards/binding.json +5 -0
  47. package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/registry.part +7 -1
  48. package/assets/templates/views/home/assembly/slots/benefits/split/binding.json +5 -0
  49. package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/registry.part +6 -1
  50. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +5 -0
  51. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +8 -0
  52. package/assets/templates/views/home/assembly/slots/categories/{ProductCategory2 → CategoryGrid}/element.part +1 -1
  53. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +31 -0
  54. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/binding.json +5 -0
  55. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/catalog.part +4 -0
  56. package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/registry.part +3 -1
  57. package/assets/templates/views/home/content.ts +22 -0
  58. package/assets/templates/views/home/index.tsx +11 -6
  59. package/assets/templates/views/home/props.ts +1 -0
  60. package/assets/templates/views/home/registry.tsx +39 -15
  61. package/assets/templates/views/home/schema.ts +141 -24
  62. package/assets/templates/views/product/data.ts +1 -1
  63. package/assets/templates/views/product/registry.tsx +10 -6
  64. package/assets/templates/views/product/schema.ts +36 -1
  65. package/package.json +4 -5
  66. package/recipes/archetypes.json +25 -25
  67. package/recipes/catalog.json +213 -160
  68. package/recipes/catalog.mjs +10 -0
  69. package/recipes/catalog.schema.json +4 -0
  70. package/recipes/features.json +3 -3
  71. package/recipes/recipes.json +138 -40
  72. package/recipes/sections.json +2 -2
  73. package/recipes/validate.mjs +21 -4
  74. package/scripts/candidate.mjs +2 -2
  75. package/scripts/file-classes.mjs +10 -0
  76. package/scripts/ownership-conflict.mjs +5 -2
  77. package/scripts/view-assembly.mjs +10 -2
  78. package/scripts/view-selection.mjs +1 -1
  79. package/skills/sf-view-gen/assets/recipes/archetypes.json +25 -25
  80. package/skills/sf-view-gen/assets/recipes/catalog.json +213 -160
  81. package/skills/sf-view-gen/assets/recipes/catalog.schema.json +4 -0
  82. package/skills/sf-view-gen/assets/recipes/features.json +3 -3
  83. package/skills/sf-view-gen/assets/recipes/recipes.json +138 -40
  84. package/skills/sf-view-gen/assets/recipes/sections.json +2 -2
  85. package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +1 -1
  86. package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +1 -1
  87. package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +1 -1
  88. package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +1 -1
  89. package/skills/sf-view-gen/assets/templates/views/sections/products.client.tsx +16 -16
  90. package/skills/sf-view-gen/assets/templates/views/sections/schema.products.ts +1 -1
  91. package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +1 -1
  92. package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +1 -1
  93. package/skills/sf-view-gen/scripts/catalog.mjs +10 -0
  94. package/skills/sf-view-gen/scripts/validate.mjs +21 -4
  95. package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +0 -5
  96. package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +0 -5
  97. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +0 -5
  98. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +0 -4
  99. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +0 -16
  100. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +0 -5
  101. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +0 -4
  102. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part +0 -0
  103. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part +0 -0
  104. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part +0 -0
  105. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part +0 -0
  106. /package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/element.part +0 -0
@@ -8,21 +8,47 @@
8
8
  "description": "Storefront landing page with hero, benefits, and category highlights",
9
9
  "route": "/",
10
10
  "loader": "home",
11
- "requiredDataKeys": ["heroProducts", "categories"],
11
+ "requiredDataKeys": [
12
+ "heroProducts",
13
+ "categories"
14
+ ],
12
15
  "defaultVariants": {
13
- "hero": "StorefrontHero1",
14
- "benefits": "Feature1",
15
- "categories": "ProductCategory2"
16
+ "hero": "StorefrontHero",
17
+ "benefits": "cards",
18
+ "categories": "CategoryGrid"
16
19
  },
17
20
  "allowedVariants": {
18
- "hero": ["StorefrontHero1", "StorefrontHero2", "StorefrontHero5", "StorefrontHero6"],
19
- "benefits": ["Feature1", "Feature2"],
20
- "categories": ["ProductCategory1", "ProductCategory2", "ProductCategory4", "ProductCategory5"],
21
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"]
21
+ "hero": [
22
+ "StorefrontHero"
23
+ ],
24
+ "benefits": [
25
+ "cards",
26
+ "split"
27
+ ],
28
+ "categories": [
29
+ "CategoryGrid"
30
+ ],
31
+ "productCard": [
32
+ "ProductGrid"
33
+ ]
22
34
  },
23
- "optionalSections": ["testimonials", "faq", "statistics", "logoCloud", "pricing"],
24
- "registeredSlots": ["hero", "benefits", "categories"],
25
- "allowedSections": ["faq", "cta", "products"],
35
+ "optionalSections": [
36
+ "testimonials",
37
+ "faq",
38
+ "statistics",
39
+ "logoCloud",
40
+ "pricing"
41
+ ],
42
+ "registeredSlots": [
43
+ "hero",
44
+ "benefits",
45
+ "categories"
46
+ ],
47
+ "allowedSections": [
48
+ "faq",
49
+ "cta",
50
+ "products"
51
+ ],
26
52
  "maxSections": 4
27
53
  },
28
54
  {
@@ -31,20 +57,39 @@
31
57
  "description": "Single product detail page with overview, gallery, and reviews",
32
58
  "route": "/products/[id]",
33
59
  "loader": "product",
34
- "requiredDataKeys": ["selectedProduct"],
60
+ "requiredDataKeys": [
61
+ "selectedProduct"
62
+ ],
35
63
  "defaultVariants": {
36
- "overview": "ProductOverview1",
64
+ "overview": "ProductOverview",
37
65
  "reviews": "ReviewRating1",
38
66
  "breadcrumb": "Breadcrumb"
39
67
  },
40
68
  "allowedVariants": {
41
- "overview": ["ProductOverview1", "ProductOverview2", "ProductOverview5"],
42
- "reviews": ["ReviewRating1", "ReviewRating2"],
43
- "breadcrumb": ["Breadcrumb"],
44
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"]
69
+ "overview": [
70
+ "ProductOverview"
71
+ ],
72
+ "reviews": [
73
+ "ReviewRating1",
74
+ "ReviewRating2"
75
+ ],
76
+ "breadcrumb": [
77
+ "Breadcrumb"
78
+ ],
79
+ "productCard": [
80
+ "ProductGrid"
81
+ ]
45
82
  },
46
- "optionalSections": ["testimonials", "faq", "statistics"],
47
- "registeredSlots": ["overview", "reviews", "breadcrumb"],
83
+ "optionalSections": [
84
+ "testimonials",
85
+ "faq",
86
+ "statistics"
87
+ ],
88
+ "registeredSlots": [
89
+ "overview",
90
+ "reviews",
91
+ "breadcrumb"
92
+ ],
48
93
  "allowedSections": [],
49
94
  "maxSections": 4
50
95
  },
@@ -54,15 +99,21 @@
54
99
  "description": "Standalone cart review page with authoritative totals and quantity editing",
55
100
  "route": "/cart",
56
101
  "loader": "cart",
57
- "requiredDataKeys": ["cart"],
102
+ "requiredDataKeys": [
103
+ "cart"
104
+ ],
58
105
  "defaultVariants": {
59
- "view": "ShoppingCart4"
106
+ "view": "ShoppingCart"
60
107
  },
61
108
  "allowedVariants": {
62
- "view": ["ShoppingCart4"]
109
+ "view": [
110
+ "ShoppingCart"
111
+ ]
63
112
  },
64
113
  "optionalSections": [],
65
- "registeredSlots": ["view"],
114
+ "registeredSlots": [
115
+ "view"
116
+ ],
66
117
  "allowedSections": [],
67
118
  "maxSections": 0
68
119
  },
@@ -72,20 +123,41 @@
72
123
  "description": "Product listing filtered by category with filters and sorting",
73
124
  "route": "/categories/[[...slug]]",
74
125
  "loader": "category",
75
- "requiredDataKeys": ["categoryProducts", "storeCategories"],
126
+ "requiredDataKeys": [
127
+ "categoryProducts",
128
+ "storeCategories"
129
+ ],
76
130
  "defaultVariants": {
77
131
  "filter": "CategoryFilter2",
78
- "productCard": "ProductCard1",
132
+ "productCard": "ProductGrid",
79
133
  "breadcrumb": "Breadcrumb"
80
134
  },
81
135
  "allowedVariants": {
82
- "filter": ["CategoryFilter1", "CategoryFilter2", "CategoryFilter4"],
83
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"],
84
- "breadcrumb": ["Breadcrumb"]
136
+ "filter": [
137
+ "CategoryFilter1",
138
+ "CategoryFilter2",
139
+ "CategoryFilter4"
140
+ ],
141
+ "productCard": [
142
+ "ProductGrid"
143
+ ],
144
+ "breadcrumb": [
145
+ "Breadcrumb"
146
+ ]
85
147
  },
86
- "optionalSections": ["logoCloud", "testimonials"],
87
- "registeredSlots": ["breadcrumb", "filter", "productCard"],
88
- "allowedSections": ["faq", "cta"],
148
+ "optionalSections": [
149
+ "logoCloud",
150
+ "testimonials"
151
+ ],
152
+ "registeredSlots": [
153
+ "breadcrumb",
154
+ "filter",
155
+ "productCard"
156
+ ],
157
+ "allowedSections": [
158
+ "faq",
159
+ "cta"
160
+ ],
89
161
  "maxSections": 4
90
162
  },
91
163
  {
@@ -94,17 +166,29 @@
94
166
  "description": "Multi-step checkout with cart summary, shipping, and payment",
95
167
  "route": "/checkout",
96
168
  "loader": "checkout",
97
- "requiredDataKeys": ["checkoutCountries", "checkoutPaymentMethods"],
169
+ "requiredDataKeys": [
170
+ "checkoutCountries",
171
+ "checkoutPaymentMethods"
172
+ ],
98
173
  "defaultVariants": {
99
174
  "checkout": "CheckoutForm1",
100
175
  "confirmation": "CheckoutConfirmation"
101
176
  },
102
177
  "allowedVariants": {
103
- "checkout": ["CheckoutForm1", "CheckoutForm2", "CheckoutForm3"],
104
- "confirmation": ["CheckoutConfirmation"]
178
+ "checkout": [
179
+ "CheckoutForm1",
180
+ "CheckoutForm2",
181
+ "CheckoutForm3"
182
+ ],
183
+ "confirmation": [
184
+ "CheckoutConfirmation"
185
+ ]
105
186
  },
106
187
  "optionalSections": [],
107
- "registeredSlots": ["checkout", "confirmation"],
188
+ "registeredSlots": [
189
+ "checkout",
190
+ "confirmation"
191
+ ],
108
192
  "allowedSections": [],
109
193
  "maxSections": 4
110
194
  },
@@ -114,18 +198,32 @@
114
198
  "description": "Customer account area with sign-in, registration, and a minimal signed-in state",
115
199
  "route": "/account",
116
200
  "loader": "account",
117
- "requiredDataKeys": ["accountCustomer"],
201
+ "requiredDataKeys": [
202
+ "accountCustomer"
203
+ ],
118
204
  "defaultVariants": {
119
205
  "login": "LoginPage1",
120
206
  "register": "SignUpPage1"
121
207
  },
122
208
  "allowedVariants": {
123
- "login": ["LoginPage1", "LoginPage2"],
124
- "register": ["SignUpPage1"],
125
- "orders": ["OrderHistory1", "OrderHistory2"]
209
+ "login": [
210
+ "LoginPage1",
211
+ "LoginPage2"
212
+ ],
213
+ "register": [
214
+ "SignUpPage1"
215
+ ],
216
+ "orders": [
217
+ "OrderHistory1",
218
+ "OrderHistory2"
219
+ ]
126
220
  },
127
221
  "optionalSections": [],
128
- "registeredSlots": ["login", "register", "orders"],
222
+ "registeredSlots": [
223
+ "login",
224
+ "register",
225
+ "orders"
226
+ ],
129
227
  "allowedSections": [],
130
228
  "maxSections": 4
131
229
  },
@@ -35,8 +35,8 @@
35
35
  "name": "products",
36
36
  "description": "Data-bound product presentation (grid or combined grid-and-carousel) whose selection is configured independently per instance",
37
37
  "elementType": "Products",
38
- "variants": ["ProductCard1", "ProductShowcase1"],
39
- "defaultVariant": "ProductCard1",
38
+ "variants": ["ProductGrid", "ProductShowcase1"],
39
+ "defaultVariant": "ProductGrid",
40
40
  "dataBound": true,
41
41
  "propsHint": "per-instance selection configured in views/<view>/data.ts sectionSources[id] (canonical category/collection/search/ordering query); heading, description, objective, ctaLabel/ctaHref are editorial content",
42
42
  "status": "executable"
@@ -550,15 +550,30 @@ export function getCatalogSlot(viewName, slot) {
550
550
  return hasOwn(slots, key) ? slots[key] : null
551
551
  }
552
552
 
553
+ /**
554
+ * The legacy alias target for a slot variant name, or the input unchanged when
555
+ * it is not an alias. The canonical selection surface is the catalog's variant
556
+ * set (the canonical block's presentations); retired numbered names survive
557
+ * only as slot-level `legacyAliases` and resolve here, at the single catalog
558
+ * authority, before any validation or fragment lookup.
559
+ */
560
+ export function resolveLegacyVariant(viewName, slot, variant) {
561
+ const slotEntry = getCatalogSlot(viewName, slot)
562
+ const aliases = isPlainObject(slotEntry?.legacyAliases) ? slotEntry.legacyAliases : {}
563
+ return hasOwn(aliases, variant) ? aliases[variant] : variant
564
+ }
565
+
553
566
  /**
554
567
  * The catalog entry for one variant of a slot, or null when the slot or the
555
568
  * variant is outside the catalog scope. Used to name a held variant's reason at
556
- * the point a selection is rejected (E1 task 1.4 / CU-07).
569
+ * the point a selection is rejected (E1 task 1.4 / CU-07). Legacy alias names
570
+ * resolve to their canonical variant's entry.
557
571
  */
558
572
  export function getCatalogVariant(viewName, slot, variant) {
559
573
  const slotEntry = getCatalogSlot(viewName, slot)
560
574
  const variants = isPlainObject(slotEntry?.variants) ? slotEntry.variants : {}
561
- return hasOwn(variants, variant) ? variants[variant] : null
575
+ const canonical = resolveLegacyVariant(viewName, slot, variant)
576
+ return hasOwn(variants, canonical) ? variants[canonical] : null
562
577
  }
563
578
 
564
579
  /**
@@ -630,7 +645,7 @@ export function supportedVariant(viewName, slot) {
630
645
  }
631
646
 
632
647
  export function isSupportedVariant(viewName, slot, variant) {
633
- return executableVariants(viewName, slot).includes(variant)
648
+ return executableVariants(viewName, slot).includes(resolveLegacyVariant(viewName, slot, variant))
634
649
  }
635
650
 
636
651
  /**
@@ -662,7 +677,9 @@ export function isAllowedVariant(viewName, slot, variant) {
662
677
  const allowedBySlot = isPlainObject(recipe.allowedVariants) ? recipe.allowedVariants : {}
663
678
  if (!hasOwn(allowedBySlot, slot)) return false
664
679
  const allowed = allowedBySlot[slot]
665
- return Array.isArray(allowed) && allowed.includes(variant)
680
+ return (
681
+ Array.isArray(allowed) && allowed.includes(resolveLegacyVariant(viewName, slot, variant))
682
+ )
666
683
  }
667
684
 
668
685
  export function isAllowedSection(viewName, sectionName) {
@@ -42,10 +42,10 @@ export const CANDIDATE_TOOLSET = Object.freeze({
42
42
  '@json-render/next': '0.21.0',
43
43
  }),
44
44
  local: Object.freeze({
45
- '@thorprovider/blocks': '0.1.2',
45
+ '@thorprovider/blocks': '0.1.4',
46
46
  '@thorprovider/adapters': '5.0.12',
47
47
  '@thorprovider/runtime': '0.1.4',
48
- '@thorprovider/types': '5.8.0',
48
+ '@thorprovider/types': '5.9.0',
49
49
  }),
50
50
  })
51
51
 
@@ -53,6 +53,16 @@ const RULES = [
53
53
  'app/lib/*/composition.ts',
54
54
  'app/lib/*/session.ts',
55
55
  'app/lib/*/session.core.ts',
56
+ 'app/lib/*/account-session.ts',
57
+ 'app/lib/*/account-session.core.ts',
58
+ 'app/lib/*/account-private.core.ts',
59
+ 'app/lib/*/account-user.core.ts',
60
+ 'app/lib/*/account-lifecycle.client.tsx',
61
+ 'app/lib/*/account-boundary.client.tsx',
62
+ 'app/lib/*/account-mutation.client.ts',
63
+ 'app/lib/*/account-reconcile.client.ts',
64
+ 'app/lib/*/projection-ownership.ts',
65
+ 'app/lib/*/projection-ownership.client.tsx',
56
66
  'app/lib/*/store-context.ts',
57
67
  'app/lib/*/commerce.ts',
58
68
  'app/lib/*/cart-state.ts',
@@ -27,7 +27,7 @@
27
27
 
28
28
  import { existsSync, readFileSync } from 'node:fs'
29
29
  import path from 'node:path'
30
- import { getCatalogVariant } from '../recipes/validate.mjs'
30
+ import { getCatalogVariant, resolveLegacyVariant } from '../recipes/validate.mjs'
31
31
  import { DEFAULT_THEME_MODE } from './manifest.mjs'
32
32
  import { replacePlaceholders } from './render-templates.mjs'
33
33
  import { viewTemplateDir } from './reconcile.mjs'
@@ -316,7 +316,10 @@ export function detectOwnershipConflicts(projectDir, manifest, options = {}) {
316
316
  const projectRel = toPosix(path.relative(projectDir, abs))
317
317
 
318
318
  for (const slot of selectedSlots) {
319
- const variant = resolved.selection[slot]
319
+ // The manifest may still store a retired numbered name; the fragment
320
+ // lookup needs the canonical variant directory (legacy aliases resolve
321
+ // at the catalog authority, the same seam every lookup translates at).
322
+ const variant = resolveLegacyVariant(viewName, slot, resolved.selection[slot])
320
323
  const rootIds = [...referencedIdentifiers(templateDir, slot, variant)].filter((id) =>
321
324
  kind === 'schema' ? /Schema$/.test(id) : /Props$/.test(id),
322
325
  )
@@ -21,6 +21,7 @@ import { existsSync, readFileSync, readdirSync } from 'node:fs'
21
21
  import { mkdir, writeFile } from 'node:fs/promises'
22
22
  import path from 'node:path'
23
23
  import { isSlotSectionEntry } from './section-compat.mjs'
24
+ import { resolveLegacyVariant } from '../recipes/validate.mjs'
24
25
 
25
26
  export const ASSEMBLY_DIRNAME = 'assembly'
26
27
 
@@ -69,7 +70,14 @@ export function resolveViewSelection(templateDir, selection = {}) {
69
70
  const resolved = {}
70
71
  for (const slot of slots) {
71
72
  if (slot.nested === true) continue
72
- const chosen = selection[slot.slot] ?? slot.default
73
+ // A stored selection may name a retired numbered variant; the catalog's
74
+ // legacy alias map translates it to the canonical presentation before the
75
+ // fragment lookup, so an old manifest regenerates the same structure.
76
+ const chosen = resolveLegacyVariant(
77
+ meta.view,
78
+ slot.slot,
79
+ selection[slot.slot] ?? slot.default,
80
+ )
73
81
  const variants = fragmentVariants(templateDir, slot.slot)
74
82
  if (!variants.includes(chosen)) {
75
83
  throw new Error(
@@ -93,7 +101,7 @@ function readPart(fragmentDir, name) {
93
101
 
94
102
  // Merge the per-variant block bindings into one import statement per module,
95
103
  // sorted by imported name so the output is deterministic. This is what makes
96
- // swapping a variant (Feature1 -> Feature2) change exactly one binding.
104
+ // swapping a presentation (cards -> split) changes exactly one binding.
97
105
  function renderBlockImports(bindings) {
98
106
  const byModule = new Map()
99
107
  for (const binding of bindings) {
@@ -85,7 +85,7 @@ export function resolveViewSelection(viewName, entry = {}) {
85
85
  * mount imposes on its host view (E1 task 3.3). A registry feature declares
86
86
  * `mounts: [{ id, host, slot }]` and a `presentations` map; generation owns the
87
87
  * block wiring by mapping the feature's `config.presentation` through that map
88
- * (`compact` -> `Feature1`, `detailed` -> `Feature2`). A mount never carries an
88
+ * (`compact` -> `cards`, `detailed` -> `split`). A mount never carries an
89
89
  * element. Returns
90
90
  * `{ ok, byView: Map<host, { [slot]: { variant, mountId, featureName } }>, errors }`.
91
91
  *
@@ -7,20 +7,20 @@
7
7
  "default": "compact",
8
8
  "intents": {
9
9
  "compact": {
10
- "variant": "StorefrontHero1",
11
- "when": "A simple, text-forward hero with a single call to action and no product showcase."
10
+ "variant": "StorefrontHero",
11
+ "when": "A simple, text-forward hero with a single call to action (canonical `presentation: 'compact'`)."
12
12
  },
13
13
  "showcase": {
14
- "variant": "StorefrontHero2",
15
- "when": "A product-led hero that displays featured products alongside the headline."
14
+ "variant": "StorefrontHero",
15
+ "when": "A product-led hero with a search affordance and rotating featured products (canonical `presentation: 'showcase'`)."
16
16
  },
17
17
  "editorial": {
18
- "variant": "StorefrontHero5",
19
- "when": "A storytelling or brand-editorial hero with strong imagery and a narrative tone."
18
+ "variant": "StorefrontHero",
19
+ "when": "A storytelling hero with department navigation and optional curated deals (canonical `presentation: 'editorial'`)."
20
20
  },
21
21
  "promotional": {
22
- "variant": "StorefrontHero6",
23
- "when": "A campaign hero built around an offer, discount, or seasonal promotion."
22
+ "variant": "StorefrontHero",
23
+ "when": "A campaign hero built around real, host-supplied offers (canonical `presentation: 'promotional'`)."
24
24
  }
25
25
  }
26
26
  },
@@ -28,11 +28,11 @@
28
28
  "default": "compact",
29
29
  "intents": {
30
30
  "compact": {
31
- "variant": "Feature1",
31
+ "variant": "cards",
32
32
  "when": "A short list of benefits with icons and one-line descriptions."
33
33
  },
34
34
  "detailed": {
35
- "variant": "Feature2",
35
+ "variant": "split",
36
36
  "when": "Benefits that need longer explanations, richer layout, or supporting media."
37
37
  }
38
38
  }
@@ -41,20 +41,20 @@
41
41
  "default": "standard",
42
42
  "intents": {
43
43
  "standard": {
44
- "variant": "ProductCategory2",
45
- "when": "A balanced grid of category cards with image and label."
44
+ "variant": "CategoryGrid",
45
+ "when": "A balanced grid of category cards with image and label (canonical `presentation: 'grid'`)."
46
46
  },
47
47
  "iconGrid": {
48
- "variant": "ProductCategory1",
49
- "when": "A compact icon-based category grid for many small categories."
48
+ "variant": "CategoryGrid",
49
+ "when": "A compact icon-based category grid for many small categories (canonical `presentation: 'icons'`)."
50
50
  },
51
51
  "featured": {
52
- "variant": "ProductCategory4",
53
- "when": "Few, large featured category tiles that act as primary navigation."
52
+ "variant": "CategoryGrid",
53
+ "when": "Few, large featured category tiles that act as primary navigation (canonical `presentation: 'icons'`)."
54
54
  },
55
55
  "editorial": {
56
- "variant": "ProductCategory5",
57
- "when": "Category tiles presented as editorial imagery blocks."
56
+ "variant": "CategoryGrid",
57
+ "when": "Category tiles presented as a searchable list with subcategory chips (canonical `presentation: 'list'`)."
58
58
  }
59
59
  }
60
60
  },
@@ -62,16 +62,16 @@
62
62
  "default": "standard",
63
63
  "intents": {
64
64
  "standard": {
65
- "variant": "ProductOverview1",
66
- "when": "A straightforward product detail layout: gallery, title, price, add to cart."
65
+ "variant": "ProductOverview",
66
+ "when": "A straightforward product detail layout: gallery, title, price, add to cart (canonical `presentation: 'standard'`)."
67
67
  },
68
68
  "gallery": {
69
- "variant": "ProductOverview2",
70
- "when": "The product needs emphasis on a large image gallery with thumbnails."
69
+ "variant": "ProductOverview",
70
+ "when": "The product needs emphasis on a large image gallery with thumbnails (canonical `presentation: 'gallery'`)."
71
71
  },
72
72
  "rich": {
73
- "variant": "ProductOverview5",
74
- "when": "A detailed product page with tabs, specs, and extensive structured information."
73
+ "variant": "ProductOverview",
74
+ "when": "A detailed product page with tabs, specs, and extensive structured information (canonical `presentation: 'rich'`)."
75
75
  }
76
76
  }
77
77
  },
@@ -92,7 +92,7 @@
92
92
  "default": "review",
93
93
  "intents": {
94
94
  "review": {
95
- "variant": "ShoppingCart4",
95
+ "variant": "ShoppingCart",
96
96
  "when": "A standalone cart review page: line editing plus backend-authoritative totals before checkout."
97
97
  }
98
98
  }