@thorprovider/storefront 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -8
- package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +18 -3
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-main-menu.ts +3 -1
- package/assets/templates/app/public/images/README.md +43 -0
- package/assets/templates/app/public/images/banners/banner-aurora-deal.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-guia-regalo.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-mesa-decor.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-nuevas-llegadas.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-salon-oferta.webp +0 -0
- package/assets/templates/app/public/images/categories/accessories.webp +0 -0
- package/assets/templates/app/public/images/categories/dresses.webp +0 -0
- package/assets/templates/app/public/images/categories/furniture.webp +0 -0
- package/assets/templates/app/public/images/categories/home.webp +0 -0
- package/assets/templates/app/public/images/categories/jackets.webp +0 -0
- package/assets/templates/app/public/images/editorial/studio.webp +0 -0
- package/assets/templates/app/public/images/products/alpine-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/amber-dress.webp +0 -0
- package/assets/templates/app/public/images/products/atlas-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/atlas-sofa.webp +0 -0
- package/assets/templates/app/public/images/products/aurora-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/boreal-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/camille-dress.webp +0 -0
- package/assets/templates/app/public/images/products/ceramic-table-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/cinder-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/copper-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/cove-bag.webp +0 -0
- package/assets/templates/app/public/images/products/dahlia-dress.webp +0 -0
- package/assets/templates/app/public/images/products/drift-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/dune-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/elara-dress.webp +0 -0
- package/assets/templates/app/public/images/products/ember-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/fable-bag.webp +0 -0
- package/assets/templates/app/public/images/products/fjord-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/floor-cushion.webp +0 -0
- package/assets/templates/app/public/images/products/harbor-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/helios-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/iris-dress.webp +0 -0
- package/assets/templates/app/public/images/products/juniper-bag.webp +0 -0
- package/assets/templates/app/public/images/products/kestrel-bag.webp +0 -0
- package/assets/templates/app/public/images/products/linen-armchair.webp +0 -0
- package/assets/templates/app/public/images/products/lumen-dress.webp +0 -0
- package/assets/templates/app/public/images/products/luna-bag.webp +0 -0
- package/assets/templates/app/public/images/products/marble-coffee-table.webp +0 -0
- package/assets/templates/app/public/images/products/marlowe-bag.webp +0 -0
- package/assets/templates/app/public/images/products/meridian-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/nomad-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/nova-dress.webp +0 -0
- package/assets/templates/app/public/images/products/oak-dining-table.webp +0 -0
- package/assets/templates/app/public/images/products/onyx-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/piper-bag.webp +0 -0
- package/assets/templates/app/public/images/products/quill-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/rosalind-dress.webp +0 -0
- package/assets/templates/app/public/images/products/rune-bag.webp +0 -0
- package/assets/templates/app/public/images/products/side-table.webp +0 -0
- package/assets/templates/app/public/images/products/slate-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/solis-dress.webp +0 -0
- package/assets/templates/app/public/images/products/storage-shelf.webp +0 -0
- package/assets/templates/app/public/images/products/terra-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/tundra-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/vantage-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/vera-dress.webp +0 -0
- package/assets/templates/app/public/images/products/verdant-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/wall-mirror.webp +0 -0
- package/assets/templates/app/public/images/products/wool-rug.webp +0 -0
- package/assets/templates/views/account/address-book-advanced.defaults.ts +1 -1
- package/assets/templates/views/home/assembly/assembly.json +0 -1
- package/assets/templates/views/home/assembly/index.skeleton.tsx +3 -7
- package/assets/templates/views/home/assembly/registry.skeleton.tsx +0 -3
- package/assets/templates/views/home/content.ts +34 -80
- package/assets/templates/views/home/data.ts +12 -0
- package/assets/templates/views/home/index.tsx +4 -21
- package/assets/templates/views/home/props.ts +1 -7
- package/assets/templates/views/home/registry.tsx +0 -35
- package/assets/templates/views/home/schema.ts +0 -36
- package/bin/storefront.js +12 -27
- package/package.json +3 -2
- package/recipes/archetypes.json +0 -21
- package/recipes/catalog.json +0 -22
- package/recipes/features.json +0 -2
- package/recipes/recipe.schema.json +5 -0
- package/recipes/recipes.json +19 -16
- package/recipes/validate.mjs +7 -0
- package/scripts/candidate.mjs +3 -3
- package/scripts/default-sections.mjs +1 -0
- package/scripts/env-file.mjs +5 -0
- package/scripts/file-classes.mjs +3 -0
- package/scripts/generate-demo-images.mjs +507 -0
- package/scripts/reconcile.mjs +32 -1
- package/scripts/render-templates.mjs +13 -1
- package/scripts/section-compat.mjs +10 -1
- package/scripts/section-operations.mjs +3 -0
- package/scripts/starter.mjs +25 -1
- package/scripts/theme/starter-theme.mjs +118 -0
- package/skills/sf-view-gen/assets/recipes/archetypes.json +0 -21
- package/skills/sf-view-gen/assets/recipes/catalog.json +0 -22
- package/skills/sf-view-gen/assets/recipes/features.json +0 -2
- package/skills/sf-view-gen/assets/recipes/recipes.json +19 -16
- package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-main-menu.ts +3 -1
- package/skills/sf-view-gen/scripts/validate.mjs +7 -0
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +0 -8
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/element.part +0 -5
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +0 -31
|
@@ -40,4 +40,16 @@ export const sectionSources: Record<string, unknown> = {
|
|
|
40
40
|
query: { collections: ['new-arrivals'], pageSize: 8 },
|
|
41
41
|
maxItems: 8,
|
|
42
42
|
},
|
|
43
|
+
// The closing shelves read two further canonical collections: the gift guide
|
|
44
|
+
// renders as a plain grid, the studio selection as the paged showcase.
|
|
45
|
+
'home-products-4': {
|
|
46
|
+
kind: 'products',
|
|
47
|
+
query: { collections: ['gift-guide'], pageSize: 8 },
|
|
48
|
+
maxItems: 8,
|
|
49
|
+
},
|
|
50
|
+
'home-products-5': {
|
|
51
|
+
kind: 'products',
|
|
52
|
+
query: { collections: ['studio-essentials'], pageSize: 8 },
|
|
53
|
+
maxItems: 8,
|
|
54
|
+
},
|
|
43
55
|
}
|
|
@@ -11,14 +11,12 @@ import type { StorefrontElement } from '../../spec/types'
|
|
|
11
11
|
import type { ViewModule } from '../types'
|
|
12
12
|
import { registry } from './registry'
|
|
13
13
|
import { sectionData } from './sections-data'
|
|
14
|
-
import { benefitsProps,
|
|
14
|
+
import { benefitsProps, heroProps } from './props'
|
|
15
15
|
import * as homeProps from './props'
|
|
16
16
|
import * as homeData from './data'
|
|
17
|
-
import {
|
|
17
|
+
import { toFeaturedProduct } from '../../mappers'
|
|
18
18
|
import { resolveSectionSources, resolveSectionViewStates } from '../../section-sources'
|
|
19
19
|
import {
|
|
20
|
-
categoryCardPropsSchema,
|
|
21
|
-
categoryGridPropsSchema,
|
|
22
20
|
featurePropsSchema,
|
|
23
21
|
storefrontHeroPropsSchema,
|
|
24
22
|
} from './schema'
|
|
@@ -31,11 +29,6 @@ const elements: Record<string, StorefrontElement> = {
|
|
|
31
29
|
type: 'UniversalBanner',
|
|
32
30
|
props: homeProps.heroBannerProps,
|
|
33
31
|
},
|
|
34
|
-
'home.categories': {
|
|
35
|
-
type: 'CategoryGrid',
|
|
36
|
-
props: categoriesProps,
|
|
37
|
-
on: { openCategory: { action: 'openCategory' } },
|
|
38
|
-
},
|
|
39
32
|
'home.benefits': {
|
|
40
33
|
type: 'Feature',
|
|
41
34
|
props: benefitsProps,
|
|
@@ -47,14 +40,6 @@ const catalog = {
|
|
|
47
40
|
props: homeSchemas.universalBannerPropsSchema,
|
|
48
41
|
description: 'Campaign banner collection (presentations: single, grid, carousel).',
|
|
49
42
|
},
|
|
50
|
-
CategoryGrid: {
|
|
51
|
-
props: categoryGridPropsSchema,
|
|
52
|
-
description: 'Category listing that renders category cells.',
|
|
53
|
-
},
|
|
54
|
-
CategoryCard: {
|
|
55
|
-
props: categoryCardPropsSchema,
|
|
56
|
-
description: 'One category cell, without listing section chrome.',
|
|
57
|
-
},
|
|
58
43
|
Feature: {
|
|
59
44
|
props: featurePropsSchema,
|
|
60
45
|
description: 'Benefit highlights.',
|
|
@@ -74,7 +59,7 @@ export const home: ViewModule = {
|
|
|
74
59
|
title: 'Inicio',
|
|
75
60
|
description: 'Descubre los productos de __SITE_NAME__.',
|
|
76
61
|
},
|
|
77
|
-
entry: pageRoot('home', ['home.hero', 'home.
|
|
62
|
+
entry: pageRoot('home', ['home.hero', 'home.benefits'], elements),
|
|
78
63
|
},
|
|
79
64
|
loader: {
|
|
80
65
|
home: async () => {
|
|
@@ -94,10 +79,9 @@ export const home: ViewModule = {
|
|
|
94
79
|
sections = {}
|
|
95
80
|
}
|
|
96
81
|
try {
|
|
97
|
-
const { products,
|
|
82
|
+
const { products, source } = await getCatalog()
|
|
98
83
|
return {
|
|
99
84
|
heroProducts: homeData.selectHeroProducts(products).map(toFeaturedProduct),
|
|
100
|
-
categories: categories.map(toCategoryCard),
|
|
101
85
|
dataSource: source,
|
|
102
86
|
dataError: null,
|
|
103
87
|
sections,
|
|
@@ -107,7 +91,6 @@ export const home: ViewModule = {
|
|
|
107
91
|
// data. Mock mode is labelled by `dataSource`.
|
|
108
92
|
return {
|
|
109
93
|
heroProducts: [],
|
|
110
|
-
categories: [],
|
|
111
94
|
dataSource: getDataSource(),
|
|
112
95
|
dataError:
|
|
113
96
|
error instanceof Error ? error.message : 'No se pudo cargar el catálogo.',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// and binds them into the element tree, so edits here survive `storefront sync`
|
|
5
5
|
// and unit removal. Plain data only: no React and no server imports.
|
|
6
6
|
|
|
7
|
-
import { benefitsContent,
|
|
7
|
+
import { benefitsContent, heroContent, heroBannerData, heroImage } from './content'
|
|
8
8
|
|
|
9
9
|
export const heroProps = {
|
|
10
10
|
...heroContent,
|
|
@@ -21,9 +21,3 @@ export const heroBannerProps = {
|
|
|
21
21
|
export const benefitsProps = {
|
|
22
22
|
...benefitsContent,
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export const categoriesProps = {
|
|
26
|
-
...categoriesContent,
|
|
27
|
-
categories: { $state: '/categories' },
|
|
28
|
-
query: { $state: '/categoryQuery' },
|
|
29
|
-
}
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
// schema (./schema.ts) before binding, so a contract mismatch fails loudly at
|
|
11
11
|
// the boundary instead of rendering undefined fields or literal icon tags.
|
|
12
12
|
|
|
13
|
-
import { CategoryCard as CategoryCardBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/category-card'
|
|
14
13
|
import { UniversalBanner as UniversalBannerBlock } from '@thorprovider/blocks'
|
|
15
|
-
import { CategoryGrid as CategoryGridBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/product-category-grid'
|
|
16
14
|
import { Feature as FeatureBlock } from '@thorprovider/blocks/blocks/marketing/features/feature'
|
|
17
15
|
import { useEffect, useState } from 'react'
|
|
18
16
|
import { useStateStore } from '@json-render/react'
|
|
@@ -20,8 +18,6 @@ import { resolveIcon } from '../../icon-map'
|
|
|
20
18
|
import type { ViewRegistry } from '../types'
|
|
21
19
|
import * as featureSchemas from './schema'
|
|
22
20
|
import {
|
|
23
|
-
categoryCardPropsSchema,
|
|
24
|
-
categoryGridPropsSchema,
|
|
25
21
|
featurePropsSchema,
|
|
26
22
|
storefrontHeroPropsSchema,
|
|
27
23
|
} from './schema'
|
|
@@ -37,37 +33,6 @@ export const registry: ViewRegistry = {
|
|
|
37
33
|
}, [])
|
|
38
34
|
return <UniversalBannerBlock data={{ ...parsed.data, now }} />
|
|
39
35
|
},
|
|
40
|
-
CategoryCard: ({ props, emit }) => {
|
|
41
|
-
const { set } = useStateStore()
|
|
42
|
-
const card = categoryCardPropsSchema.parse(props)
|
|
43
|
-
return (
|
|
44
|
-
<CategoryCardBlock
|
|
45
|
-
{...card}
|
|
46
|
-
onBrowse={(category) => {
|
|
47
|
-
set('/lastCategory', category.handle ?? String(category.id))
|
|
48
|
-
emit('openCategory')
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
51
|
-
)
|
|
52
|
-
},
|
|
53
|
-
CategoryGrid: ({ props, emit }) => {
|
|
54
|
-
const { set } = useStateStore()
|
|
55
|
-
const grid = categoryGridPropsSchema.parse(props)
|
|
56
|
-
return (
|
|
57
|
-
<CategoryGridBlock
|
|
58
|
-
{...grid}
|
|
59
|
-
onBrowse={(category) => {
|
|
60
|
-
set('/lastCategory', category.handle ?? String(category.id))
|
|
61
|
-
emit('openCategory')
|
|
62
|
-
}}
|
|
63
|
-
onViewAll={() => {
|
|
64
|
-
set('/lastCategory', '/categories')
|
|
65
|
-
emit('openCategory')
|
|
66
|
-
}}
|
|
67
|
-
onQueryChange={(query) => set('/categoryQuery', query)}
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
70
|
-
},
|
|
71
36
|
Feature: ({ props }) => {
|
|
72
37
|
const feature = featureSchemas.featureCardsSpecSchema.parse({
|
|
73
38
|
...props,
|
|
@@ -160,40 +160,6 @@ export const featureSplitSpecSchema = z.object({
|
|
|
160
160
|
|
|
161
161
|
export const featurePropsSchema = z.union([featureSplitSpecSchema, featureCardsSpecSchema])
|
|
162
162
|
|
|
163
|
-
export const categoryCardPropsSchema = z.object({
|
|
164
|
-
category: categoryCardSchema,
|
|
165
|
-
presentation: z.enum(['grid', 'icons', 'list']).optional(),
|
|
166
|
-
browseLabel: z.string().optional(),
|
|
167
|
-
itemsLabel: z.string().optional(),
|
|
168
|
-
trendingLabel: z.string().optional(),
|
|
169
|
-
featuredLabel: z.string().optional(),
|
|
170
|
-
imageFallback: z.string().optional(),
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
export const categoryGridPropsSchema = z.object({
|
|
174
|
-
title: z.string().optional(),
|
|
175
|
-
description: z.string().optional(),
|
|
176
|
-
badge: z.string().optional(),
|
|
177
|
-
presentation: z.enum(['grid', 'icons', 'list']).optional(),
|
|
178
|
-
categories: z.array(categoryCardSchema),
|
|
179
|
-
cta: ctaSchema.optional(),
|
|
180
|
-
query: z.string().optional(),
|
|
181
|
-
searchPlaceholder: z.string().optional(),
|
|
182
|
-
searchLabel: z.string().optional(),
|
|
183
|
-
emptyLabel: z.string().optional(),
|
|
184
|
-
noResultsLabel: z.string().optional(),
|
|
185
|
-
browseLabel: z.string().optional(),
|
|
186
|
-
viewAllLabel: z.string().optional(),
|
|
187
|
-
trendingLabel: z.string().optional(),
|
|
188
|
-
featuredLabel: z.string().optional(),
|
|
189
|
-
itemsLabel: z.string().optional(),
|
|
190
|
-
imageFallback: z.string().optional(),
|
|
191
|
-
className: z.string().optional(),
|
|
192
|
-
maxItems: z.number().int().positive().optional(),
|
|
193
|
-
loading: z.boolean().optional(),
|
|
194
|
-
skeletonCount: z.number().int().positive().optional(),
|
|
195
|
-
})
|
|
196
|
-
|
|
197
163
|
// Local mirror of the canonical UniversalBanner contract (delivery
|
|
198
164
|
// universal-banner, contract version 4.1.0) — the same shape the editorial
|
|
199
165
|
// section fragment mirrors. Kept local (not imported from the section module)
|
|
@@ -367,7 +333,5 @@ export type StorefrontHeroProps = z.infer<typeof storefrontHeroPropsSchema>
|
|
|
367
333
|
export type FeatureProps = z.infer<typeof featurePropsSchema>
|
|
368
334
|
export type FeatureCardsSpecProps = z.infer<typeof featureCardsSpecSchema>
|
|
369
335
|
export type FeatureSplitSpecProps = z.infer<typeof featureSplitSpecSchema>
|
|
370
|
-
export type CategoryCardProps = z.infer<typeof categoryCardPropsSchema>
|
|
371
|
-
export type CategoryGridProps = z.infer<typeof categoryGridPropsSchema>
|
|
372
336
|
export type UniversalBannerData = z.infer<typeof universalBannerDataSchema>
|
|
373
337
|
export type UniversalBannerProps = z.infer<typeof universalBannerPropsSchema>
|
package/bin/storefront.js
CHANGED
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
classifyImportSource,
|
|
41
41
|
} from '../scripts/theme/import-export.mjs'
|
|
42
42
|
import { resolvePreset, makeShadcnRunner } from '../scripts/theme/preset.mjs'
|
|
43
|
+
import { applyStarterTheme } from '../scripts/theme/starter-theme.mjs'
|
|
43
44
|
import { THEME_COLOR_TOKENS, FONT_VARS, DEFAULT_GLOBALS_TOKENS } from '../scripts/theme/tokens.mjs'
|
|
44
45
|
import { NAMED_COLOR_NAMES, parseColor, formatOklch } from '../scripts/theme/color.mjs'
|
|
45
46
|
import {
|
|
@@ -48,7 +49,6 @@ import {
|
|
|
48
49
|
looksLikeStorefront,
|
|
49
50
|
readManifest,
|
|
50
51
|
validateManifest,
|
|
51
|
-
createManifest,
|
|
52
52
|
writeManifest,
|
|
53
53
|
} from '../scripts/manifest.mjs'
|
|
54
54
|
import { reconcile } from '../scripts/reconcile.mjs'
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
scaffoldTempEnv,
|
|
58
58
|
} from '../scripts/scaffold-env.mjs'
|
|
59
59
|
import { preflightManifest } from '../scripts/preflight.mjs'
|
|
60
|
-
import {
|
|
60
|
+
import { initialManifest } from '../scripts/starter.mjs'
|
|
61
61
|
import {
|
|
62
62
|
buildInstallPlan,
|
|
63
63
|
CANDIDATE_TOOLSET,
|
|
@@ -193,7 +193,7 @@ create options:
|
|
|
193
193
|
--mode <mode> light | dark | system (default: system)
|
|
194
194
|
--starter install every curated view and feature (a full store),
|
|
195
195
|
not just the home+cart baseline
|
|
196
|
-
--brand <color> brand color over
|
|
196
|
+
--brand <color> brand color over the starter theme (not prompted by the wizard)
|
|
197
197
|
--packs <dir> directory of local @thorprovider/* .tgz tarballs; installs
|
|
198
198
|
the local candidate via Yarn resolutions (no publish)
|
|
199
199
|
-f, --force overwrite files that already exist
|
|
@@ -806,19 +806,13 @@ function runYarn(yarnSpec, cmdArgs, cwd, env) {
|
|
|
806
806
|
return res.status ?? 1
|
|
807
807
|
}
|
|
808
808
|
|
|
809
|
-
// Apply
|
|
810
|
-
//
|
|
811
|
-
//
|
|
812
|
-
//
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
const error = diagnostics.find((d) => d.severity === 'error')
|
|
817
|
-
if (error) return { error: error.message }
|
|
818
|
-
const planned = planCss(globalsCss, operation)
|
|
819
|
-
const planError = planned.diagnostics.find((d) => d.severity === 'error')
|
|
820
|
-
if (planError) return { error: planError.message }
|
|
821
|
-
return { css: planned.css }
|
|
809
|
+
// Apply the starter marketplace palette and then a named brand color, both
|
|
810
|
+
// through the same theme-plan pipeline the `theme` command uses. The starter is
|
|
811
|
+
// the default every scaffold ships (orange CTA, navy chrome, tight corners); a
|
|
812
|
+
// `--brand` on top of it overrides the primary family, so `create --brand` and
|
|
813
|
+
// `theme --brand` still agree. Returns `{ css }` or `{ error }`.
|
|
814
|
+
function applyCreateTheme(globalsCss, brand) {
|
|
815
|
+
return applyStarterTheme(globalsCss, { brand })
|
|
822
816
|
}
|
|
823
817
|
|
|
824
818
|
async function promptScaffoldInputs(args) {
|
|
@@ -1010,16 +1004,7 @@ async function create(args) {
|
|
|
1010
1004
|
// same preflight as every other write boundary — and it must run before any
|
|
1011
1005
|
// mkdir, external scaffold, or write so rejected input leaves no trace.
|
|
1012
1006
|
const starter = args.starter === true
|
|
1013
|
-
const
|
|
1014
|
-
const manifest = seedDefaultSections(
|
|
1015
|
-
createManifest({
|
|
1016
|
-
name,
|
|
1017
|
-
siteName,
|
|
1018
|
-
mode,
|
|
1019
|
-
views: composition.views,
|
|
1020
|
-
features: composition.features,
|
|
1021
|
-
}),
|
|
1022
|
-
)
|
|
1007
|
+
const manifest = seedDefaultSections(initialManifest({ name, siteName, mode, starter }))
|
|
1023
1008
|
const preflight = preflightManifest(manifest)
|
|
1024
1009
|
if (!preflight.ok) return rejectComposition(preflight.errors)
|
|
1025
1010
|
|
|
@@ -1217,7 +1202,7 @@ async function create(args) {
|
|
|
1217
1202
|
const globalsPath = join(target, 'app', 'globals.css')
|
|
1218
1203
|
if (existsSync(globalsPath)) {
|
|
1219
1204
|
const css = readFileSync(globalsPath, 'utf8')
|
|
1220
|
-
const branded =
|
|
1205
|
+
const branded = applyCreateTheme(css, brand)
|
|
1221
1206
|
if (branded.error) {
|
|
1222
1207
|
console.error(`Unknown brand color: ${branded.error}`)
|
|
1223
1208
|
return 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thorprovider/storefront",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Deterministic storefront scaffolder and installable OpenCode skill suite for Thor Commerce (Next.js, @thorprovider/blocks, @thorprovider/adapters, Medusa)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "bin/storefront.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"test": "vitest run --config vitest.config.ts",
|
|
25
25
|
"test:integration": "vitest run --config vitest.config.ts tests/scaffold-integration.test.ts tests/starter-integration.test.ts",
|
|
26
26
|
"test:registry": "RUN_SCAFFOLD_INTEGRATION=1 STOREFRONT_ACCEPTANCE_CLI=registry vitest run --config vitest.config.ts tests/scaffold-integration.test.ts tests/starter-integration.test.ts",
|
|
27
|
-
"test:browser": "node ./tests/support/projection-ownership.browser.mjs"
|
|
27
|
+
"test:browser": "node ./tests/support/projection-ownership.browser.mjs",
|
|
28
|
+
"demo:images": "node scripts/generate-demo-images.mjs"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public",
|
package/recipes/archetypes.json
CHANGED
|
@@ -41,27 +41,6 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"home.categories": {
|
|
45
|
-
"default": "standard",
|
|
46
|
-
"intents": {
|
|
47
|
-
"standard": {
|
|
48
|
-
"variant": "CategoryGrid",
|
|
49
|
-
"when": "A balanced grid of category cards with image and label (canonical `presentation: 'grid'`)."
|
|
50
|
-
},
|
|
51
|
-
"iconGrid": {
|
|
52
|
-
"variant": "CategoryGrid",
|
|
53
|
-
"when": "A compact icon-based category grid for many small categories (canonical `presentation: 'icons'`)."
|
|
54
|
-
},
|
|
55
|
-
"featured": {
|
|
56
|
-
"variant": "CategoryGrid",
|
|
57
|
-
"when": "Few, large featured category tiles that act as primary navigation (canonical `presentation: 'icons'`)."
|
|
58
|
-
},
|
|
59
|
-
"editorial": {
|
|
60
|
-
"variant": "CategoryGrid",
|
|
61
|
-
"when": "Category tiles presented as a searchable list with subcategory chips (canonical `presentation: 'list'`)."
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
44
|
"product.overview": {
|
|
66
45
|
"default": "standard",
|
|
67
46
|
"intents": {
|
package/recipes/catalog.json
CHANGED
|
@@ -70,28 +70,6 @@
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
|
-
"home.categories": {
|
|
74
|
-
"default": "CategoryGrid",
|
|
75
|
-
"legacyAliases": {
|
|
76
|
-
"ProductCategory": "CategoryGrid"
|
|
77
|
-
},
|
|
78
|
-
"variants": {
|
|
79
|
-
"CategoryGrid": {
|
|
80
|
-
"status": "executable",
|
|
81
|
-
"block": "CategoryGrid",
|
|
82
|
-
"dataShape": "CategoryCard[]",
|
|
83
|
-
"events": [
|
|
84
|
-
"browse",
|
|
85
|
-
"viewAll",
|
|
86
|
-
"queryChange"
|
|
87
|
-
],
|
|
88
|
-
"state": "controlled",
|
|
89
|
-
"requirements": [
|
|
90
|
-
"categories"
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
73
|
"product.overview": {
|
|
96
74
|
"default": "ProductOverview",
|
|
97
75
|
"variants": {
|
package/recipes/features.json
CHANGED
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
{
|
|
50
50
|
"name": "customer-profile",
|
|
51
51
|
"mvp": true,
|
|
52
|
-
"starter": false,
|
|
53
52
|
"status": "gated",
|
|
54
53
|
"description": "Signed-in profile editor for the account area (name, phone, and email only where the backend supports changing it). Module of customer-auth.",
|
|
55
54
|
"views": [],
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
{
|
|
65
64
|
"name": "customer-addresses",
|
|
66
65
|
"mvp": true,
|
|
67
|
-
"starter": false,
|
|
68
66
|
"status": "gated",
|
|
69
67
|
"description": "Signed-in address book for the account area (list, create, edit, delete, default shipping and billing). Module of customer-auth.",
|
|
70
68
|
"views": [],
|
|
@@ -56,6 +56,11 @@
|
|
|
56
56
|
"type": "array",
|
|
57
57
|
"items": { "type": "string" }
|
|
58
58
|
},
|
|
59
|
+
"retiredSlots": {
|
|
60
|
+
"type": "array",
|
|
61
|
+
"items": { "type": "string" },
|
|
62
|
+
"description": "Slots the view used to register. A manifest entry naming one of them is dropped during normalization instead of rejected."
|
|
63
|
+
},
|
|
59
64
|
"allowedSections": {
|
|
60
65
|
"type": "array",
|
|
61
66
|
"items": { "type": "string" }
|
package/recipes/recipes.json
CHANGED
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
{
|
|
6
6
|
"name": "home",
|
|
7
7
|
"mvp": true,
|
|
8
|
-
"description": "Marketplace-style landing page: campaign hero,
|
|
8
|
+
"description": "Marketplace-style landing page: campaign hero, four merchandising shelves (three rails, a product grid and a product showcase), a mid-page campaign band, and the trust band",
|
|
9
9
|
"route": "/",
|
|
10
10
|
"loader": "home",
|
|
11
11
|
"requiredDataKeys": [
|
|
12
|
-
"heroProducts"
|
|
13
|
-
"categories"
|
|
12
|
+
"heroProducts"
|
|
14
13
|
],
|
|
15
14
|
"defaultVariants": {
|
|
16
15
|
"hero": "UniversalBanner",
|
|
17
|
-
"benefits": "cards"
|
|
18
|
-
"categories": "CategoryGrid"
|
|
16
|
+
"benefits": "cards"
|
|
19
17
|
},
|
|
20
18
|
"allowedVariants": {
|
|
21
19
|
"hero": [
|
|
@@ -26,9 +24,6 @@
|
|
|
26
24
|
"cards",
|
|
27
25
|
"split"
|
|
28
26
|
],
|
|
29
|
-
"categories": [
|
|
30
|
-
"CategoryGrid"
|
|
31
|
-
],
|
|
32
27
|
"productCard": [
|
|
33
28
|
"ProductGrid"
|
|
34
29
|
]
|
|
@@ -42,9 +37,11 @@
|
|
|
42
37
|
],
|
|
43
38
|
"registeredSlots": [
|
|
44
39
|
"hero",
|
|
45
|
-
"categories",
|
|
46
40
|
"benefits"
|
|
47
41
|
],
|
|
42
|
+
"retiredSlots": [
|
|
43
|
+
"categories"
|
|
44
|
+
],
|
|
48
45
|
"allowedSections": [
|
|
49
46
|
"faq",
|
|
50
47
|
"cta",
|
|
@@ -59,28 +56,34 @@
|
|
|
59
56
|
{
|
|
60
57
|
"type": "products",
|
|
61
58
|
"variant": "ProductSlider",
|
|
62
|
-
"after": "
|
|
59
|
+
"after": "hero"
|
|
63
60
|
},
|
|
64
61
|
{
|
|
65
62
|
"type": "universal-banner",
|
|
66
|
-
"after": "
|
|
63
|
+
"after": "hero"
|
|
67
64
|
},
|
|
68
65
|
{
|
|
69
66
|
"type": "products",
|
|
70
67
|
"variant": "ProductSlider",
|
|
71
|
-
"after": "
|
|
68
|
+
"after": "hero"
|
|
72
69
|
},
|
|
73
70
|
{
|
|
74
71
|
"type": "products",
|
|
75
72
|
"variant": "ProductSlider",
|
|
76
|
-
"after": "
|
|
73
|
+
"after": "hero"
|
|
77
74
|
},
|
|
78
75
|
{
|
|
79
|
-
"type": "
|
|
80
|
-
"
|
|
76
|
+
"type": "products",
|
|
77
|
+
"variant": "ProductGrid",
|
|
78
|
+
"after": "hero"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"type": "products",
|
|
82
|
+
"variant": "ProductShowcase1",
|
|
83
|
+
"after": "hero"
|
|
81
84
|
}
|
|
82
85
|
],
|
|
83
|
-
"maxSections":
|
|
86
|
+
"maxSections": 6
|
|
84
87
|
},
|
|
85
88
|
{
|
|
86
89
|
"name": "product",
|
package/recipes/validate.mjs
CHANGED
|
@@ -861,6 +861,10 @@ export function validateComposition(composition) {
|
|
|
861
861
|
const optionalSections = Array.isArray(recipe.optionalSections) ? recipe.optionalSections : []
|
|
862
862
|
const allowedSections = Array.isArray(recipe.allowedSections) ? recipe.allowedSections : []
|
|
863
863
|
const registeredSlots = Array.isArray(recipe.registeredSlots) ? recipe.registeredSlots : []
|
|
864
|
+
// A retired slot (for example `categories` on home) may still appear in a
|
|
865
|
+
// manifest written against an earlier registry version: it is dropped by the
|
|
866
|
+
// normalizer, so validating it here must not refuse the whole manifest.
|
|
867
|
+
const retiredSlots = Array.isArray(recipe.retiredSlots) ? recipe.retiredSlots : []
|
|
864
868
|
const maxSections = typeof recipe.maxSections === 'number' ? recipe.maxSections : null
|
|
865
869
|
const seenSectionIds = new Set()
|
|
866
870
|
let editorialCount = 0
|
|
@@ -883,6 +887,9 @@ export function validateComposition(composition) {
|
|
|
883
887
|
errors.push(
|
|
884
888
|
`Reserved slot id "${section.id}" in view "${viewName}" must equal "slot:${section.type}".`
|
|
885
889
|
)
|
|
890
|
+
} else if (!registeredSlots.includes(section.type) && retiredSlots.includes(section.type)) {
|
|
891
|
+
// Retired slot: tolerated here and dropped by the composition
|
|
892
|
+
// normalizer, so it never renders and never blocks a sync.
|
|
886
893
|
} else if (!registeredSlots.includes(section.type)) {
|
|
887
894
|
errors.push(
|
|
888
895
|
`Slot "${section.type}" is not a registered slot of view "${viewName}".`
|
package/scripts/candidate.mjs
CHANGED
|
@@ -47,9 +47,9 @@ export const CANDIDATE_TOOLSET = Object.freeze({
|
|
|
47
47
|
'@json-render/next': '0.21.0',
|
|
48
48
|
}),
|
|
49
49
|
local: Object.freeze({
|
|
50
|
-
'@thorprovider/blocks': '4.
|
|
51
|
-
'@thorprovider/adapters': '5.
|
|
52
|
-
'@thorprovider/runtime': '0.
|
|
50
|
+
'@thorprovider/blocks': '4.8.0',
|
|
51
|
+
'@thorprovider/adapters': '5.8.0',
|
|
52
|
+
'@thorprovider/runtime': '0.10.0',
|
|
53
53
|
'@thorprovider/types': '7.8.0',
|
|
54
54
|
}),
|
|
55
55
|
})
|
package/scripts/env-file.mjs
CHANGED
|
@@ -17,6 +17,7 @@ export function initialEnvLocal(name, sessionSecret) {
|
|
|
17
17
|
'THOR_DATA_SOURCE=mock',
|
|
18
18
|
`THOR_STORE_ID=${name}`,
|
|
19
19
|
`THOR_SESSION_SECRET=${sessionSecret}`,
|
|
20
|
+
'THOR_MOCK_ASSETS=/images',
|
|
20
21
|
].join('\n') + '\n'
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -28,6 +29,10 @@ export function envExample(name) {
|
|
|
28
29
|
'THOR_DATA_SOURCE=mock',
|
|
29
30
|
'# Store identity (written by create; required only in real mode).',
|
|
30
31
|
`THOR_STORE_ID=${name}`,
|
|
32
|
+
'# Demo imagery base (mock mode only). The starter ships local product,',
|
|
33
|
+
'# category and banner shots under public/images; drop this to fall back to',
|
|
34
|
+
'# the generated SVG placeholders.',
|
|
35
|
+
'THOR_MOCK_ASSETS=/images',
|
|
31
36
|
'# Real backend configuration (required only when THOR_DATA_SOURCE=medusa).',
|
|
32
37
|
'# Run `storefront setup` to write these: it takes the sales channel id (from the',
|
|
33
38
|
'# Medusa admin) and derives the currency from the selected region.',
|
package/scripts/file-classes.mjs
CHANGED
|
@@ -36,6 +36,9 @@ const RULES = [
|
|
|
36
36
|
'views/*/sections/**',
|
|
37
37
|
'app/lib/*/mappers.ts',
|
|
38
38
|
'app/lib/*/icon-map.ts',
|
|
39
|
+
// Demo imagery: local static files the developer replaces in place, so a
|
|
40
|
+
// sync must never overwrite a swapped shot.
|
|
41
|
+
'app/public/images/**',
|
|
39
42
|
// The shell brand/newsletter seam is user-owned so its edits survive sync.
|
|
40
43
|
'app/lib/*/shell/**',
|
|
41
44
|
],
|