@salesforce/b2c-dx-mcp 3.2.1 → 3.3.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/bin/run.js +5 -9
- package/content/guidance/b2c/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +1 -1
- package/content/guidance/b2c/b2c-onboarding/SKILL.md +4 -4
- package/content/guidance/b2c/b2c-ordering/SKILL.md +2 -2
- package/content/guidance/b2c/b2c-querying-data/SKILL.md +2 -2
- package/content/guidance/b2c/b2c-scapi-admin/SKILL.md +3 -3
- package/content/guidance/b2c/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +4 -4
- package/content/guidance/b2c/b2c-scapi-shopper/SKILL.md +6 -6
- package/content/guidance/b2c/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +8 -9
- package/content/guidance/b2c-cli/b2c-cip/SKILL.md +3 -3
- package/content/guidance/b2c-cli/b2c-cip/references/SALES_ANALYSIS.md +1 -1
- package/content/guidance/b2c-cli/b2c-config/SKILL.md +31 -21
- package/content/guidance/b2c-cli/b2c-content/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-debug/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-docs/SKILL.md +23 -2
- package/content/guidance/b2c-cli/b2c-ecdn/references/ADVANCED.md +1 -1
- package/content/guidance/b2c-cli/b2c-job/references/IMPORT.md +1 -1
- package/content/guidance/b2c-cli/b2c-metrics/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-mrt/SKILL.md +3 -3
- package/content/guidance/b2c-cli/b2c-scapi-custom/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-scapi-schemas/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-site-import-export/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-sites/SKILL.md +1 -1
- package/content/guidance/b2c-cli/b2c-slas/SKILL.md +1 -1
- package/content/guidance/b2c-ops/b2c-checkout-triage/SKILL.md +2 -2
- package/content/guidance/b2c-ops/b2c-job-health/SKILL.md +2 -2
- package/content/guidance/b2c-ops/b2c-order-failure-triage/SKILL.md +1 -1
- package/content/guidance/b2c-ops/b2c-order-failure-triage/references/order-evidence.md +2 -2
- package/content/guidance/b2c-ops/b2c-production-triage/SKILL.md +4 -4
- package/content/guidance/index.json +935 -258
- package/content/guidance/mcp/{cip → b2c-mcp-cip}/SKILL.md +10 -8
- package/content/guidance/mcp/{b2c-config → b2c-mcp-config}/SKILL.md +10 -9
- package/content/guidance/mcp/{debugger → b2c-mcp-debugger}/SKILL.md +9 -8
- package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/SKILL.md +81 -10
- package/content/guidance/mcp/{server → b2c-mcp-server}/SKILL.md +49 -25
- package/content/guidance/storefront-next/sfnext-accessibility/SKILL.md +103 -0
- package/content/guidance/storefront-next/sfnext-accessibility/references/checklist.md +64 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/SKILL.md +91 -0
- package/content/guidance/storefront-next/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
- package/content/guidance/storefront-next/sfnext-authentication/SKILL.md +86 -79
- package/content/guidance/storefront-next/sfnext-authentication/references/COOKIES.md +39 -0
- package/content/guidance/storefront-next/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/SKILL.md +67 -0
- package/content/guidance/storefront-next/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
- package/content/guidance/storefront-next/sfnext-components/SKILL.md +98 -136
- package/content/guidance/storefront-next/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
- package/content/guidance/storefront-next/sfnext-components/references/SHAPE-TOKENS.md +51 -0
- package/content/guidance/storefront-next/sfnext-components/references/STORYBOOK.md +54 -0
- package/content/guidance/storefront-next/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
- package/content/guidance/storefront-next/sfnext-components/references/TROUBLESHOOTING.md +19 -0
- package/content/guidance/storefront-next/sfnext-configuration/SKILL.md +116 -113
- package/content/guidance/storefront-next/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
- package/content/guidance/storefront-next/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/SKILL.md +100 -150
- package/content/guidance/storefront-next/sfnext-data-fetching/references/ACTIONS.md +53 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADERS.md +73 -0
- package/content/guidance/storefront-next/sfnext-data-fetching/references/SCAPI-FETCHER.md +23 -77
- package/content/guidance/storefront-next/sfnext-deployment/SKILL.md +83 -97
- package/content/guidance/storefront-next/sfnext-deployment/references/MRT-DEPLOYMENT.md +37 -68
- package/content/guidance/storefront-next/sfnext-extensions/SKILL.md +73 -97
- package/content/guidance/storefront-next/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/BASE-AUDIT.md +47 -44
- package/content/guidance/storefront-next/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
- package/content/guidance/storefront-next/sfnext-extensions/references/EXTENSION-EXAMPLES.md +49 -86
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/SKILL.md +59 -114
- package/content/guidance/storefront-next/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +53 -90
- package/content/guidance/storefront-next/sfnext-i18n/SKILL.md +96 -131
- package/content/guidance/storefront-next/sfnext-i18n/references/locale-config.md +35 -0
- package/content/guidance/storefront-next/sfnext-overview/SKILL.md +101 -0
- package/content/guidance/storefront-next/sfnext-page-designer/SKILL.md +152 -131
- package/content/guidance/storefront-next/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/COMPONENT-REGISTRY.md +86 -53
- package/content/guidance/storefront-next/sfnext-page-designer/references/DECORATOR-PATTERNS.md +119 -131
- package/content/guidance/storefront-next/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
- package/content/guidance/storefront-next/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
- package/content/guidance/storefront-next/sfnext-performance/SKILL.md +75 -105
- package/content/guidance/storefront-next/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
- package/content/guidance/storefront-next/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
- package/content/guidance/storefront-next/sfnext-project-setup/SKILL.md +103 -116
- package/content/guidance/storefront-next/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -99
- package/content/guidance/storefront-next/sfnext-project-setup/references/SCRIPTS.md +47 -0
- package/content/guidance/storefront-next/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/SKILL.md +70 -0
- package/content/guidance/storefront-next/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
- package/content/guidance/storefront-next/sfnext-revalidation/SKILL.md +121 -0
- package/content/guidance/storefront-next/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
- package/content/guidance/storefront-next/sfnext-routing/SKILL.md +86 -143
- package/content/guidance/storefront-next/sfnext-routing/references/ROUTE-CONVENTIONS.md +51 -51
- package/content/guidance/storefront-next/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
- package/content/guidance/storefront-next/sfnext-scapi/SKILL.md +126 -0
- package/content/guidance/storefront-next/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/SKILL.md +129 -0
- package/content/guidance/storefront-next/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
- package/content/guidance/storefront-next/sfnext-security/references/TURNSTILE.md +43 -0
- package/content/guidance/storefront-next/sfnext-seo/SKILL.md +95 -0
- package/content/guidance/storefront-next/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
- package/content/guidance/storefront-next/sfnext-seo/references/SEO-ROUTES.md +31 -0
- package/content/guidance/storefront-next/sfnext-state-management/SKILL.md +80 -89
- package/content/guidance/storefront-next/sfnext-state-management/references/PATTERNS.md +45 -0
- package/content/guidance/storefront-next/sfnext-testing/SKILL.md +105 -138
- package/content/guidance/storefront-next/sfnext-testing/references/E2E.md +38 -0
- package/content/guidance/storefront-next/sfnext-testing/references/STORYBOOK-PATTERNS.md +73 -94
- package/content/guidance/storefront-next/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
- package/content/guidance/storefront-next/sfnext-theming/SKILL.md +104 -0
- package/content/guidance/storefront-next/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
- package/dist/commands/mcp.d.ts +8 -2
- package/dist/commands/mcp.js +54 -20
- package/dist/guidance.d.ts +4 -1
- package/dist/guidance.js +23 -5
- package/dist/registry.d.ts +2 -1
- package/dist/registry.js +3 -3
- package/dist/server.d.ts +10 -0
- package/dist/server.js +21 -0
- package/dist/skill-references.js +5 -5
- package/dist/tools/cartridges/index.js +1 -0
- package/dist/tools/cip/index.js +6 -3
- package/dist/tools/diagnostics/debug-capture-at-breakpoint.js +1 -1
- package/dist/tools/diagnostics/debug-set-breakpoints.js +1 -1
- package/dist/tools/diagnostics/debug-start-session.js +1 -1
- package/dist/tools/scapi/index.d.ts +4 -1
- package/dist/tools/scapi/index.js +4 -2
- package/dist/tools/scapi/scapi-code.d.ts +2 -2
- package/dist/tools/scapi/scapi-code.js +17 -61
- package/dist/utils/types.d.ts +6 -0
- package/node_modules/@salesforce/b2c-agent-plugins/CHANGELOG.md +20 -0
- package/node_modules/@salesforce/b2c-agent-plugins/README.md +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/.codex-plugin/plugin.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/plugin.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-hooks/references/ORDER-HOOK-LIFECYCLE.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-onboarding/SKILL.md +4 -4
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-ordering/SKILL.md +2 -2
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-querying-data/SKILL.md +2 -2
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-admin/SKILL.md +3 -3
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-admin/references/CLIENT-EXAMPLES.md +4 -4
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-shopper/SKILL.md +6 -6
- package/node_modules/@salesforce/b2c-agent-plugins/b2c/skills/b2c-scapi-shopper/references/CLIENT-EXAMPLES.md +8 -9
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/.codex-plugin/plugin.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/plugin.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-cip/SKILL.md +3 -3
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-cip/references/SALES_ANALYSIS.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-config/SKILL.md +31 -21
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-content/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-debug/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-docs/SKILL.md +23 -2
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-ecdn/references/ADVANCED.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-job/references/IMPORT.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-metrics/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-mrt/SKILL.md +3 -3
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-scapi-custom/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-scapi-schemas/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-site-import-export/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-sites/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-cli/skills/b2c-slas/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/.codex-plugin/plugin.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/plugin.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-checkout-triage/SKILL.md +2 -2
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-job-health/SKILL.md +2 -2
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-order-failure-triage/SKILL.md +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-order-failure-triage/references/order-evidence.md +2 -2
- package/node_modules/@salesforce/b2c-agent-plugins/b2c-ops/skills/b2c-production-triage/SKILL.md +4 -4
- package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/README.md +4 -4
- package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/skills/figma-to-sfnext-pagedesigner/SKILL.md +76 -73
- package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/skills/figma-to-sfnext-pagedesigner/evals/trigger-evals.json +12 -10
- package/node_modules/@salesforce/b2c-agent-plugins/figma-to-sfnext-pagedesigner/skills/figma-to-sfnext-pagedesigner/references/PAGE-DESIGNER-SFN.md +49 -74
- package/node_modules/@salesforce/b2c-agent-plugins/package.json +1 -1
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/.codex-plugin/plugin.json +9 -6
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/README.md +43 -22
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/plugin.json +9 -6
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-accessibility/SKILL.md +103 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-accessibility/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-accessibility/references/checklist.md +64 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-analytics-consent/SKILL.md +91 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-analytics-consent/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-analytics-consent/references/CUSTOM-ADAPTER.md +49 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/SKILL.md +86 -79
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/references/COOKIES.md +39 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-authentication/references/LOGIN-FLOWS.md +59 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-commerce-features/SKILL.md +67 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-commerce-features/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-commerce-features/references/FEATURE-PREREQUISITES.md +37 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/SKILL.md +98 -136
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/COMPONENT-AUTHORING.md +118 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/SHAPE-TOKENS.md +51 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/STORYBOOK.md +54 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/TOKEN-SYSTEM.md +53 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/references/TROUBLESHOOTING.md +19 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/SKILL.md +116 -113
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/references/ENV-VARIABLES.md +55 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-configuration/references/MULTI-SITE-URLS.md +137 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/SKILL.md +100 -150
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/ACTIONS.md +53 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/API-CLIENTS.md +34 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/LOADERS.md +73 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/SCAPI-FETCHER.md +23 -77
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-deployment/SKILL.md +83 -97
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-deployment/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-deployment/references/MRT-DEPLOYMENT.md +37 -68
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/SKILL.md +73 -97
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/ACTION-HOOKS.md +57 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/BASE-AUDIT.md +47 -44
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/CLI-AND-INSTALL.md +58 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-extensions/references/EXTENSION-EXAMPLES.md +49 -86
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-hybrid-storefronts/SKILL.md +59 -114
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-hybrid-storefronts/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-hybrid-storefronts/references/HYBRID-PROXY-CONFIG.md +53 -90
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-i18n/SKILL.md +96 -131
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-i18n/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-i18n/references/locale-config.md +35 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-overview/SKILL.md +101 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-overview/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/SKILL.md +152 -131
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/BUSINESS-MANAGER.md +46 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/COMPONENT-REGISTRY.md +86 -53
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/DECORATOR-PATTERNS.md +119 -131
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/REVIEW-CHECKLIST.md +83 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-page-designer/references/TROUBLESHOOTING.md +35 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/SKILL.md +75 -105
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/references/PERFORMANCE-REVIEW-CHECKLIST.md +85 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-performance/references/SUSPENSE-AND-STREAMING.md +58 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/SKILL.md +103 -116
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/PROJECT-STRUCTURE.md +61 -99
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/SCRIPTS.md +47 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/SFNEXT-CLI.md +63 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-quality-gates/SKILL.md +70 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-quality-gates/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-quality-gates/references/lint-and-budgets.md +39 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-revalidation/SKILL.md +121 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-revalidation/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-revalidation/references/POLICIES-AND-TAGS.md +55 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/SKILL.md +86 -143
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/references/ROUTE-CONVENTIONS.md +51 -51
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-routing/references/URLS-AND-SEO-ROUTES.md +22 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi/SKILL.md +126 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi/references/WORKED-EXAMPLE.md +39 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/SKILL.md +129 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/references/COOKIE-DOMAIN.md +39 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-security/references/TURNSTILE.md +43 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/SKILL.md +95 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/references/MULTI-DOMAIN-BASE-PATH.md +17 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-seo/references/SEO-ROUTES.md +31 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-state-management/SKILL.md +80 -89
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-state-management/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-state-management/references/PATTERNS.md +45 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/SKILL.md +105 -138
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/references/E2E.md +38 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/references/STORYBOOK-PATTERNS.md +73 -94
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-testing/references/UNIT-AND-ROUTE-TESTS.md +60 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-theming/SKILL.md +104 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-theming/evals/trigger-evals.json +5 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-theming/references/REBRAND-CHECKLIST.md +29 -0
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next-figma/skills/sfnext-create-figma-kit/SKILL.md +3 -3
- package/oclif.manifest.json +21 -4
- package/package.json +3 -3
- package/content/guidance/storefront-next/sfnext-create-component/SKILL.md +0 -195
- package/content/guidance/storefront-next/sfnext-create-component/references/COMPONENT-AUTHORING.md +0 -206
- package/content/guidance/storefront-next/sfnext-create-component/references/PROJECT-STRUCTURE.md +0 -43
- package/content/guidance/storefront-next/sfnext-create-component/references/TOKEN-SYSTEM.md +0 -130
- package/content/guidance/storefront-next/sfnext-create-component/references/TROUBLESHOOTING.md +0 -34
- package/content/guidance/storefront-next/sfnext-create-vertical/SKILL.md +0 -135
- package/content/guidance/storefront-next/sfnext-create-vertical/references/COMPONENT-AUTHORING.md +0 -206
- package/content/guidance/storefront-next/sfnext-create-vertical/references/PROJECT-STRUCTURE.md +0 -43
- package/content/guidance/storefront-next/sfnext-create-vertical/references/TOKEN-SYSTEM.md +0 -130
- package/content/guidance/storefront-next/sfnext-create-vertical/references/TROUBLESHOOTING.md +0 -34
- package/content/guidance/storefront-next/sfnext-custom-apis/SKILL.md +0 -221
- package/content/guidance/storefront-next/sfnext-custom-apis/references/WORKFLOW-EXAMPLES.md +0 -294
- package/content/guidance/storefront-next/sfnext-data-fetching/references/LOADER-PATTERNS.md +0 -102
- package/content/guidance/storefront-next/sfnext-project-setup/references/ENV-VARIABLES.md +0 -82
- package/content/guidance/storefront-next/sfnext-scapi-management/SKILL.md +0 -203
- package/content/guidance/storefront-next/sfnext-scapi-management/references/CLI-COMMANDS.md +0 -122
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/SKILL.md +0 -195
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/evals/trigger-evals.json +0 -12
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/COMPONENT-AUTHORING.md +0 -206
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/PROJECT-STRUCTURE.md +0 -43
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/TOKEN-SYSTEM.md +0 -130
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-component/references/TROUBLESHOOTING.md +0 -34
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/SKILL.md +0 -135
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/evals/trigger-evals.json +0 -12
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/COMPONENT-AUTHORING.md +0 -206
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/PROJECT-STRUCTURE.md +0 -43
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/TOKEN-SYSTEM.md +0 -130
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-create-vertical/references/TROUBLESHOOTING.md +0 -34
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-custom-apis/SKILL.md +0 -221
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-custom-apis/evals/trigger-evals.json +0 -12
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-custom-apis/references/WORKFLOW-EXAMPLES.md +0 -294
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-data-fetching/references/LOADER-PATTERNS.md +0 -102
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-project-setup/references/ENV-VARIABLES.md +0 -82
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi-management/SKILL.md +0 -203
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi-management/evals/trigger-evals.json +0 -12
- package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-scapi-management/references/CLI-COMMANDS.md +0 -122
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/custom-apis.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/custom-properties.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/jobs.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/products.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/promotions.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/saving.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/snippets.md +0 -0
- /package/content/guidance/mcp/{scapi → b2c-mcp-scapi}/references/tokens.md +0 -0
- /package/content/guidance/mcp/{server → b2c-mcp-server}/references/files.md +0 -0
package/node_modules/@salesforce/b2c-agent-plugins/storefront-next/skills/sfnext-components/SKILL.md
CHANGED
|
@@ -1,191 +1,153 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sfnext-components
|
|
3
|
-
description:
|
|
3
|
+
description: >-
|
|
4
|
+
Build and modify UI components in a Storefront Next storefront: page components with Suspense and use()/Await, createPage and withSuspense, Tailwind v4 token classes, shape tokens (rounded-ui, shadow-ui, border-ui), shadcn/ui primitives in src/components/ui (sync-shadcn), CVA variants, data-slot, DynamicImage, lazy-loaded overlays, and Storybook stories with snapshot tests. Use when creating or editing a component in src/components, adding a shadcn primitive, fixing styling that ignores the theme, writing a *.stories.tsx file, or running pnpm storybook:test. Do not use for re-branding colors, fonts, or logos (use `storefront-next:sfnext-theming`), route loaders (use `storefront-next:sfnext-data-fetching`), or Page Designer registration (use `storefront-next:sfnext-page-designer`).
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Components
|
|
7
|
+
# Storefront Next Components
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
How to write, style, and verify components in your storefront. Your project already ships the rules in `AGENTS.md`, `docs/README-UI-STYLING.md`, `docs/README-SHAPE-TOKENS.md`, `docs/README-SUSPENSE.md`, and `docs/README-STORYBOOK.md`; this skill is the task-oriented path through them.
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Before you create anything
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
1. Search `src/components/` for an existing component (`ls src/components`). Extend or compose it before adding a new one.
|
|
14
|
+
2. Decide the layer:
|
|
15
|
+
- **Primitive** (Button, Card, Dialog): a shadcn fork in `src/components/ui/`. Only shadcn forks live there.
|
|
16
|
+
- **Composite / domain component**: everything else, in `src/components/<kebab-name>/`.
|
|
17
|
+
- **Optional feature**: a folder under `src/extensions/` (see `storefront-next:sfnext-extensions`).
|
|
18
|
+
3. Match the folder shape already used by neighbors:
|
|
13
19
|
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
```
|
|
21
|
+
src/components/my-widget/
|
|
22
|
+
├── index.tsx # implementation (default or named export)
|
|
23
|
+
├── index.test.tsx # Vitest + Testing Library
|
|
24
|
+
└── stories/
|
|
25
|
+
├── index.stories.tsx # Storybook (stories/ subfolder is required)
|
|
26
|
+
├── my-widget-snapshot.tsx # optional snapshot fixture
|
|
27
|
+
└── __snapshots__/ # generated baselines, commit them
|
|
28
|
+
```
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
product: Promise<Product>;
|
|
21
|
-
reviews: Promise<Reviews>;
|
|
22
|
-
};
|
|
30
|
+
Every `.ts`/`.tsx` file needs the Apache header enforced by the `custom/header-format` lint rule. Copy it from any existing file (or `AGENTS.md`).
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<>
|
|
27
|
-
<SeoMeta title="Product" />
|
|
28
|
-
<Suspense fallback={<ProductHeaderSkeleton />}>
|
|
29
|
-
<Await resolve={loaderData.product}>
|
|
30
|
-
{(product) => <ProductHeader product={product} />}
|
|
31
|
-
</Await>
|
|
32
|
-
</Suspense>
|
|
33
|
-
<Suspense fallback={<ReviewsSkeleton />}>
|
|
34
|
-
<Await resolve={loaderData.reviews}>
|
|
35
|
-
{(reviews) => <ProductReviews reviews={reviews} />}
|
|
36
|
-
</Await>
|
|
37
|
-
</Suspense>
|
|
38
|
-
</>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
```
|
|
32
|
+
## Styling rules
|
|
42
33
|
|
|
43
|
-
|
|
34
|
+
- Tailwind utility classes only; merge with `cn()` from `@/lib/utils`. No CSS modules, no per-component CSS files, no `style={{}}` (a truly dynamic API-driven value is the only exception).
|
|
35
|
+
- Global/theme CSS lives in `src/theme/` only (entry `src/theme/index.css`). There is no `src/app.css`.
|
|
36
|
+
- Use semantic token classes, never hard-coded colors. The `custom/color-linter` rule fails `pnpm lint` on raw palette classes such as `text-white` or `bg-red-500`; use `text-primary-foreground`, `text-destructive-foreground`, `bg-card`, `text-muted-foreground`, `border-border`.
|
|
37
|
+
- Header/footer chrome has its own classes: `bg-header-background`, `text-header-foreground`, `bg-header-menu-background`, `bg-footer-background`. Do not write `bg-[--header-background]`.
|
|
38
|
+
- A new token needs two edits: the value in `src/theme/tokens/*.css` and a `--color-x: var(--x)` line inside `@theme inline` in `src/theme/tailwind.css`. See [TOKEN-SYSTEM.md](references/TOKEN-SYSTEM.md).
|
|
39
|
+
- The shipped theme defines one (light) palette; there is no `.dark` token block. Do not promise dark mode in component work.
|
|
40
|
+
- Breakpoints are mobile-first (`sm`, `md`, `lg`, `xl`, `2xl`).
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
### Shape tokens (read before touching Card, Button, Input, Dialog)
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
import { createPage } from '@/components/create-page';
|
|
44
|
+
Radius, shadow, and card border width come from three variables in `src/theme/tokens/core.css`: `--ui-radius`, `--ui-shadow`, `--ui-border-width`, consumed through `rounded-ui`, `shadow-ui`, `border-ui`.
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
```
|
|
46
|
+
- Never add `rounded-xl`, `rounded-none`, `shadow-md`, `shadow-none`, or `border-0` to a primitive or a Card to force a shape. Change the token, or scope it: `<Card className="[--ui-radius:var(--radius-xl)]">`.
|
|
47
|
+
- Always write the source names (`--ui-radius`). Writing the bridge names `--radius-ui` / `--shadow-ui` is a silent no-op.
|
|
48
|
+
- `border-ui` is Card-only. To show a Card border use `[--ui-border-width:1px]`, not `border`.
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
Full mechanism and scoped-override recipes: [SHAPE-TOKENS.md](references/SHAPE-TOKENS.md).
|
|
57
51
|
|
|
58
|
-
|
|
52
|
+
## Page components and Suspense
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
import { lazy, Suspense } from 'react';
|
|
54
|
+
Route components receive `loaderData` with deferred fields as unresolved promises. Rules from `AGENTS.md`: one `<Suspense>` per async operation, stable promise identity (never `Promise.all`/`.then` in render; compose in the loader), skeletons where layout is known.
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
);
|
|
56
|
+
```tsx
|
|
57
|
+
import { Suspense, use } from 'react';
|
|
58
|
+
import { Await } from 'react-router';
|
|
67
59
|
|
|
68
|
-
|
|
60
|
+
function Reviews({ promise }: { promise: Promise<ReviewsData> }) {
|
|
61
|
+
const reviews = use(promise);
|
|
62
|
+
return <ReviewList reviews={reviews} />;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default function ProductPage({ loaderData }: { loaderData: PageData }) {
|
|
69
66
|
return (
|
|
70
67
|
<>
|
|
71
|
-
{/*
|
|
72
|
-
<Suspense fallback={<
|
|
73
|
-
<
|
|
74
|
-
{(product) => <ProductHeader product={product} />}
|
|
75
|
-
</Await>
|
|
68
|
+
{/* use() needs a small child component */}
|
|
69
|
+
<Suspense fallback={<ReviewsSkeleton />}>
|
|
70
|
+
<Reviews promise={loaderData.reviews} />
|
|
76
71
|
</Suspense>
|
|
77
72
|
|
|
78
|
-
{/*
|
|
79
|
-
<Suspense fallback={<
|
|
80
|
-
<
|
|
73
|
+
{/* Await resolves inline and supports a local errorElement */}
|
|
74
|
+
<Suspense fallback={<RecsSkeleton />}>
|
|
75
|
+
<Await resolve={loaderData.recommendations}>{(recs) => <Recommendations items={recs} />}</Await>
|
|
81
76
|
</Suspense>
|
|
82
77
|
</>
|
|
83
78
|
);
|
|
84
79
|
}
|
|
85
80
|
```
|
|
86
81
|
|
|
87
|
-
|
|
82
|
+
`createPage` (`@/components/create-page`) wraps a component with the standard Suspense fallback and keys the page so navigations remount it:
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
```tsx
|
|
85
|
+
import { createPage } from '@/components/create-page';
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
export default createPage({
|
|
88
|
+
component: CategoryView,
|
|
89
|
+
fallback: <CategorySkeleton />, // optional; default is a generic skeleton
|
|
90
|
+
getPageKey: (data) => data?.categoryId, // optional; default is pathname+search+hash
|
|
91
|
+
});
|
|
95
92
|
```
|
|
96
93
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- Add components via CLI only (do not manually create files in `src/components/ui/`)
|
|
100
|
-
- `src/components/ui/` components are copied into your project and can be customized directly
|
|
101
|
-
- Keep app/domain components outside `src/components/ui/`:
|
|
102
|
-
|
|
103
|
-
```typescript
|
|
104
|
-
// Optional wrapper for app-specific styling
|
|
105
|
-
import { Button } from '@/components/ui/button';
|
|
106
|
-
|
|
107
|
-
export function PrimaryButton(props: React.ComponentProps<typeof Button>) {
|
|
108
|
-
return <Button {...props} className={cn('rounded-full', props.className)} />;
|
|
109
|
-
}
|
|
110
|
-
```
|
|
94
|
+
`withSuspense` (`@/components/with-suspense`) is the lower-level HOC for a single async child. Details: `docs/README-SUSPENSE.md`.
|
|
111
95
|
|
|
112
|
-
##
|
|
96
|
+
## Links, navigation, text
|
|
113
97
|
|
|
114
|
-
|
|
98
|
+
- Import `Link`/`NavLink` from `@/components/link` and `useNavigate` from `@/hooks/use-navigate`, never from `react-router`. The wrappers add the site/locale URL prefix; the originals silently drop it. Combine with `href()` for typed params.
|
|
99
|
+
- Strings go through `react-i18next` (`useTranslation`) and prices through `formatCurrency` in `@/lib/currency`. Do not hard-code `'en-US'` or `$`. See `storefront-next:sfnext-i18n`.
|
|
115
100
|
|
|
116
|
-
|
|
117
|
-
import { cn } from '@/lib/utils';
|
|
101
|
+
## Images
|
|
118
102
|
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<div className={cn(
|
|
122
|
-
'rounded-lg border border-border bg-card p-4',
|
|
123
|
-
featured && 'ring-2 ring-primary'
|
|
124
|
-
)}>
|
|
125
|
-
<h2 className="text-lg font-semibold text-card-foreground">
|
|
126
|
-
Product Name
|
|
127
|
-
</h2>
|
|
128
|
-
</div>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
```
|
|
103
|
+
Use `<DynamicImage>` (`@/components/dynamic-image`) with `widths` (and `heights` for cropping) for product and content images; add `priority="high"` to the LCP image. Behavior is configured under the `images` key of `config.server.ts` (`quality`, `formats`, `fallbackFormat`, `host`, `enableDis`, `realmHostMappings`); see `docs/README-IMAGES.md`. Wrap grids in `DynamicImageProvider` (`@/providers/dynamic-image`) instead of prop-drilling sizes.
|
|
132
104
|
|
|
133
|
-
|
|
105
|
+
## Overlays
|
|
134
106
|
|
|
135
|
-
-
|
|
136
|
-
- Use `cn()` for conditional class merging
|
|
137
|
-
- Follow mobile-first responsive design (`md:`, `lg:` breakpoints)
|
|
138
|
-
- Prefer Tailwind over inline styles; inline styles are acceptable for truly dynamic values (e.g., `backgroundColor` from API data)
|
|
139
|
-
- No CSS modules or separate CSS files
|
|
140
|
-
- Custom global CSS only in `src/app.css`
|
|
107
|
+
Modals, drawers, and dialogs hidden on first render must be `React.lazy()` and mounted only after first interaction, gated on `open` with `useDeferredUnmount` from `@/hooks/use-deferred-unmount`. Do not keep a sticky "loaded" latch. Pattern: `docs/README-PERFORMANCE.md` ("Lazy Loading for Overlays").
|
|
141
108
|
|
|
142
|
-
|
|
109
|
+
## shadcn primitives
|
|
143
110
|
|
|
144
|
-
|
|
111
|
+
`src/components/ui/` files are forks of shadcn/ui that you own and may edit in place (shape tokens, `data-slot`, extra props). Do not put non-shadcn components there, and do not hand-copy from the shadcn docs. Use the in-project `sync-shadcn` skill (`.claude/skills/sync-shadcn/`):
|
|
145
112
|
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
113
|
+
```bash
|
|
114
|
+
S=.claude/skills/sync-shadcn/sync.mjs
|
|
115
|
+
node $S add slider # fetch from shadcn, apply shape tokens + import convention, seed baseline
|
|
116
|
+
node $S restyle --all --check # gate: exit 1 if any fork has drifted off the shape-token rules
|
|
117
|
+
node $S restyle src/components/ui/toggle.tsx # normalize one file
|
|
150
118
|
```
|
|
151
119
|
|
|
152
|
-
|
|
120
|
+
Prefer `add` over `npx shadcn@latest add`: `npx` pulls the older `new-york` registry style and leaves raw `rounded-md`/`shadow-sm` classes you then have to restyle. To pull upstream fixes into an existing fork, use `status` / `sync <name>` / `diff <name>` / `advance <name>` (a 3-way merge that keeps your edits); these need a merge baseline in `.shadcn-baseline/`, which `add` and `sync <name> --bootstrap` create. Read `.claude/skills/sync-shadcn/SKILL.md` for conflict handling. If it mentions a path that does not exist in your project, use the `ui` directory configured in `components.json`.
|
|
153
121
|
|
|
154
|
-
|
|
155
|
-
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
156
|
-
{products.map(p => <ProductCard key={p.id} product={p} />)}
|
|
157
|
-
</div>
|
|
158
|
-
```
|
|
122
|
+
## Stories and verification
|
|
159
123
|
|
|
160
|
-
|
|
124
|
+
Each reusable component needs `stories/*.stories.tsx` using `@storybook/react-vite` and a title from the fixed taxonomy (`Products/Product Tile/Product Tile`). `src/components/ui/` is excluded from story coverage. Details and the snapshot fixture pattern: [STORYBOOK.md](references/STORYBOOK.md).
|
|
161
125
|
|
|
126
|
+
```bash
|
|
127
|
+
pnpm typecheck
|
|
128
|
+
pnpm lint # oxlint (color-linter, header, a11y rules) + biome format check
|
|
129
|
+
pnpm test # Vitest
|
|
130
|
+
pnpm storybook:test --type=snapshot # add --update only for intended DOM changes
|
|
131
|
+
pnpm storybook:test --type=a11y # axe-core; new stories must pass
|
|
162
132
|
```
|
|
163
|
-
src/components/product-tile/
|
|
164
|
-
├── index.tsx # Component implementation
|
|
165
|
-
├── index.test.tsx # Vitest unit tests
|
|
166
|
-
└── stories/
|
|
167
|
-
├── index.stories.tsx # Storybook stories
|
|
168
|
-
└── __snapshots__/ # Storybook snapshots (optional)
|
|
169
133
|
|
|
170
|
-
|
|
171
|
-
├── index.tsx # Skeleton component (separate from main)
|
|
172
|
-
├── index.test.tsx
|
|
173
|
-
└── stories/
|
|
174
|
-
└── index.stories.tsx
|
|
175
|
-
```
|
|
134
|
+
Interaction and a11y runs need Chromium once (`pnpm exec playwright install chromium`).
|
|
176
135
|
|
|
177
|
-
##
|
|
136
|
+
## More detail
|
|
178
137
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
6. **TypeScript interfaces** — Define proper types for all props
|
|
138
|
+
- [COMPONENT-AUTHORING.md](references/COMPONENT-AUTHORING.md): worked example, CVA variants, accessibility checklist, CSS component classes vs React components, mask icons
|
|
139
|
+
- [TOKEN-SYSTEM.md](references/TOKEN-SYSTEM.md): token files, bridge, class names
|
|
140
|
+
- [SHAPE-TOKENS.md](references/SHAPE-TOKENS.md): shape token mechanism and traps
|
|
141
|
+
- [STORYBOOK.md](references/STORYBOOK.md): story layout, titles, snapshots
|
|
142
|
+
- [TROUBLESHOOTING.md](references/TROUBLESHOOTING.md): symptom to fix
|
|
185
143
|
|
|
186
144
|
## Related Skills
|
|
187
145
|
|
|
188
|
-
- `storefront-next:sfnext-
|
|
189
|
-
- `storefront-next:sfnext-
|
|
190
|
-
- `storefront-next:sfnext-page-designer` -
|
|
146
|
+
- `storefront-next:sfnext-theming` - Change palette, fonts, logo, and shape for your brand
|
|
147
|
+
- `storefront-next:sfnext-data-fetching` - Loaders that feed data to components
|
|
148
|
+
- `storefront-next:sfnext-page-designer` - Make a component Page Designer-editable
|
|
149
|
+
- `storefront-next:sfnext-extensions` - Extension folders and UI targets
|
|
150
|
+
- `storefront-next:sfnext-testing` - Vitest, Storybook, and e2e testing
|
|
151
|
+
- `storefront-next:sfnext-accessibility` - Accessibility requirements and scans
|
|
191
152
|
- `storefront-next:sfnext-i18n` - Translating component text
|
|
153
|
+
- `storefront-next:sfnext-performance` - Lazy loading, images, bundle size
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
[
|
|
2
|
+
{"query": "I need a new PromoBanner component in src/components with primary and muted variants, Tailwind token classes, and a Storybook story. What do I run to verify it?", "should_trigger": true},
|
|
3
|
+
{"query": "pnpm lint fails with a hard-coded color error on text-white in my Button variant, and my Card ignores the rounded corners I set. How do I fix both?", "should_trigger": true},
|
|
4
|
+
{"query": "Rebrand the storefront: new primary color, a different web font, and a dark header with my logo.", "should_trigger": false}
|
|
5
|
+
]
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Component Authoring
|
|
2
|
+
|
|
3
|
+
## Workflow
|
|
4
|
+
|
|
5
|
+
1. **Search first.** `ls src/components`, and grep for the behavior you need. Prefer composing or extending.
|
|
6
|
+
2. **Pick the layer.** shadcn fork in `src/components/ui/`, or a composite in `src/components/<name>/`, or an extension under `src/extensions/`.
|
|
7
|
+
3. **Implement** with token classes, `cn()`, project link wrappers, i18n, `formatCurrency`.
|
|
8
|
+
4. **Add a test** (`index.test.tsx`, Vitest + Testing Library) and a **story** (see [STORYBOOK.md](STORYBOOK.md)).
|
|
9
|
+
5. **Verify** with `pnpm typecheck`, `pnpm lint`, `pnpm test`, `pnpm storybook:test --type=snapshot`.
|
|
10
|
+
|
|
11
|
+
## Composite example
|
|
12
|
+
|
|
13
|
+
A small presentational component with a variant, token classes, a `data-slot` root, translated text, and a safe price format. Names here are illustrative; check that a component of that name does not already exist.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
/* Apache header (copy from any existing file) */
|
|
17
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { cn } from '@/lib/utils';
|
|
20
|
+
import { formatCurrency } from '@/lib/currency';
|
|
21
|
+
|
|
22
|
+
const promoVariants = cva('inline-flex items-center gap-1 px-2 py-1 text-sm font-medium rounded-ui', {
|
|
23
|
+
variants: {
|
|
24
|
+
tone: {
|
|
25
|
+
default: 'bg-primary text-primary-foreground',
|
|
26
|
+
muted: 'bg-muted text-muted-foreground',
|
|
27
|
+
danger: 'bg-destructive text-destructive-foreground',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: { tone: 'default' },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
interface PromoPriceProps extends VariantProps<typeof promoVariants> {
|
|
34
|
+
amount: number;
|
|
35
|
+
currency: string;
|
|
36
|
+
locale: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function PromoPrice({ amount, currency, locale, tone, className }: PromoPriceProps) {
|
|
41
|
+
const { t } = useTranslation();
|
|
42
|
+
return (
|
|
43
|
+
<span data-slot="promo-price" className={cn(promoVariants({ tone }), className)}>
|
|
44
|
+
{t('promoPrice.label', { defaultValue: 'Now' })} {formatCurrency(amount, locale, currency)}
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Add real translation keys to `src/locales/<locale>/translations.json` for every supported locale (see `storefront-next:sfnext-i18n`); do not rely on `defaultValue` in shipped code.
|
|
51
|
+
|
|
52
|
+
## Rules of thumb
|
|
53
|
+
|
|
54
|
+
- **Props over globals.** Keep components presentational; data arrives through props or a narrow hook.
|
|
55
|
+
- **`asChild`** (Radix `Slot`) for polymorphism; do not add an `as` prop.
|
|
56
|
+
- **`data-slot`** on the root and named regions. It is the stable hook for theme CSS and shape-token overrides. It is a convention of the shadcn forks, not a lint rule.
|
|
57
|
+
- **Variants** with `cva`; variant classes use semantic tokens (`text-destructive-foreground`, not `text-white`).
|
|
58
|
+
- **Shape**: no raw `rounded-*`/`shadow-*` on primitives or Cards; see [SHAPE-TOKENS.md](SHAPE-TOKENS.md). `rounded-full` on a pill or avatar and `rounded-t-*` style directional radii are fine.
|
|
59
|
+
- **Context**: split React contexts by concern; avoid one large `AppContext` (every change re-renders every consumer).
|
|
60
|
+
- **Client-only data** goes through loaders or `useFetcher`, not `useEffect` fetches for first render.
|
|
61
|
+
- **Links**: `@/components/link`, `@/hooks/use-navigate`.
|
|
62
|
+
- **Icons**: `lucide-react` (and `@icons-pack/react-simple-icons` for brand icons).
|
|
63
|
+
|
|
64
|
+
## Editing a shadcn primitive
|
|
65
|
+
|
|
66
|
+
Primitives are your fork. It is fine to edit them in place: add a variant, a prop, or a `data-slot`. Keep shape tokens (`rounded-ui`, `shadow-ui`, `border-ui`) and `@/` imports. After editing or syncing, run `node .claude/skills/sync-shadcn/sync.mjs restyle --all --check`. Do not add app-specific components to `src/components/ui/`; wrap the primitive in `src/components/` instead:
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { Button } from '@/components/ui/button';
|
|
70
|
+
import { cn } from '@/lib/utils';
|
|
71
|
+
|
|
72
|
+
export function PillButton(props: React.ComponentProps<typeof Button>) {
|
|
73
|
+
return <Button {...props} className={cn('rounded-full', props.className)} />;
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## CSS component class, utility, or React component?
|
|
78
|
+
|
|
79
|
+
Default to a React component when there is markup, props, or logic. Use a CSS component class only for a pure layout bag of properties applied to many different elements, defined in `@layer components` in `src/theme/base.css` so utilities can still override it. The shipped example is `.section-container` (horizontal padding, max width, centered). Do not use `@utility` for overridable multi-property compositions; the utilities layer has the highest specificity and overrides lose.
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
/* src/theme/base.css */
|
|
83
|
+
@layer components {
|
|
84
|
+
.section-container {
|
|
85
|
+
@apply px-4 sm:px-8 lg:px-16 max-w-screen-2xl mx-auto;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Decorative icons from CSS
|
|
91
|
+
|
|
92
|
+
To add a purely decorative icon to a component you do not want to fork, define the SVG once as a token (a percent-encoded `data:image/svg+xml` URI, with `stroke="black"` because only alpha matters in a mask) in `src/theme/tokens/core.css`, then paint it with a pseudo-element in `src/theme/base.css`:
|
|
93
|
+
|
|
94
|
+
```css
|
|
95
|
+
[data-slot="section-title"]::before {
|
|
96
|
+
content: "";
|
|
97
|
+
display: inline-block;
|
|
98
|
+
width: 1rem;
|
|
99
|
+
height: 1rem;
|
|
100
|
+
background-color: currentColor; /* tracks the text color */
|
|
101
|
+
-webkit-mask: var(--icon-star) center / contain no-repeat;
|
|
102
|
+
mask: var(--icon-star) center / contain no-repeat;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Use `mask` plus `background-color`, not `content: url()` (which cannot inherit `currentColor`). Keep the hooked structure stable. Full write-up with state swapping: `docs/README-UI-STYLING.md`.
|
|
107
|
+
|
|
108
|
+
## Accessibility checklist
|
|
109
|
+
|
|
110
|
+
- Semantic HTML first (`button`, `nav`, `main`, `ul`), ARIA only to fill gaps.
|
|
111
|
+
- Interactive elements are keyboard reachable with a visible focus ring (`focus-visible:ring-ring/50 focus-visible:ring-[3px]`).
|
|
112
|
+
- Text and UI boundaries meet WCAG AA contrast using theme tokens (the token comments in `core.css` record ratios).
|
|
113
|
+
- Images have `alt` (empty string for decorative).
|
|
114
|
+
- Run `pnpm lint:a11y` and `pnpm storybook:test --type=a11y`. See `storefront-next:sfnext-accessibility`.
|
|
115
|
+
|
|
116
|
+
## Page Designer
|
|
117
|
+
|
|
118
|
+
To make a component editable in Page Designer, use the decorators and registry described in `storefront-next:sfnext-page-designer`; do not hand-roll metadata.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Shape Tokens
|
|
2
|
+
|
|
3
|
+
Radius, shadow, and Card border width are driven by three variables so one edit re-skins every shadcn primitive. The project doc is `docs/README-SHAPE-TOKENS.md`; this is the working summary.
|
|
4
|
+
|
|
5
|
+
| Variable | Defined in | Utility |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `--ui-radius` | `src/theme/tokens/core.css` | `rounded-ui` (about 19 primitives) |
|
|
8
|
+
| `--ui-shadow` | `src/theme/tokens/core.css` | `shadow-ui` |
|
|
9
|
+
| `--ui-border-width` | `src/theme/tokens/core.css` | `border-ui` (Card only) |
|
|
10
|
+
|
|
11
|
+
Your starter theme's values are the ones in `core.css` (a square, flat, borderless default is `0` / `none` / `0`). For a rounded, raised look set for example `--ui-radius: var(--radius-xl)` and a soft `--ui-shadow`.
|
|
12
|
+
|
|
13
|
+
## The bridge-variable trap
|
|
14
|
+
|
|
15
|
+
`src/theme/tailwind.css` contains `--radius-ui: var(--ui-radius)` and `--shadow-ui: var(--ui-shadow)` inside `@theme inline`. Tailwind inlines these at compile time, so `--radius-ui` and `--shadow-ui` do not exist at runtime. Writing them is a silent no-op that passes lint and typecheck. Always write `--ui-radius`, `--ui-shadow`, `--ui-border-width`. `border-ui` is an `@utility` that reads `--ui-border-width` at runtime.
|
|
16
|
+
|
|
17
|
+
## Overrides
|
|
18
|
+
|
|
19
|
+
Per instance (Tailwind arbitrary property):
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<Card className="[--ui-border-width:2px] border-primary">
|
|
23
|
+
<Card className="[--ui-radius:var(--radius-2xl)]">
|
|
24
|
+
<Card className="[--ui-shadow:none]">
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Per component or section, in `src/theme/base.css`. Use `[data-slot="card"]` as the hook, and `:where()` to keep specificity low so className overrides still win:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
.product-card[data-slot="card"] {
|
|
31
|
+
--ui-radius: var(--radius-2xl);
|
|
32
|
+
--ui-shadow: 0 4px 16px -4px rgb(0 0 0 / 0.12);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:where([data-section="auth"]) [data-slot="card"] {
|
|
36
|
+
--ui-border-width: 1px;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The shipped `base.css` already re-enables a 1px Card border for account, auth, checkout, and order-confirmation sections because the default border width is 0. Place later `:where()` blocks after earlier ones that target the same `data-slot`; equal specificity means the later block wins.
|
|
41
|
+
|
|
42
|
+
## Don't
|
|
43
|
+
|
|
44
|
+
| Don't | Why | Do |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `className="rounded-xl"` or `rounded-none` on a primitive | Fights the token; breaks when the token changes | Set `[--ui-radius:...]` or change `core.css` |
|
|
47
|
+
| `className="border"` / `border-2` on Card | `border-ui` reads the variable, both classes coexist | `[--ui-border-width:1px]` |
|
|
48
|
+
| `!rounded-none`, hard-coded `border-radius` / `box-shadow` in CSS | Not token-driven | Override the variable |
|
|
49
|
+
| Styling via Tailwind class selectors (`.bg-cover`) | Breaks on refactor | Target `data-slot` |
|
|
50
|
+
|
|
51
|
+
`cn()` in `src/lib/utils.ts` registers `border-ui` as its own tailwind-merge group, so `cn('border-ui border-border', 'border-primary')` keeps width and swaps color.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Stories and Storybook Checks
|
|
2
|
+
|
|
3
|
+
Project reference: `docs/README-STORYBOOK.md` (taxonomy, decorators, mock routes, play functions) and `docs/README-STORY-COVERAGE.md`.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
- Stories go in a `stories/` subfolder beside the component: `cart/cart-content.tsx` is matched by `cart/stories/cart-content.stories.tsx`; `cart/index.tsx` by `cart/stories/index.stories.tsx`. Coverage tooling only recognizes stories there.
|
|
8
|
+
- `src/components/ui/` (shadcn forks) is excluded from story coverage and generated story tests.
|
|
9
|
+
- Snapshot baselines use a fixture file `<name>-snapshot.tsx` next to the story and write to `stories/__snapshots__/`. Copy the small wrapper from `src/components/collapsible-section/stories/collapsible-section-snapshot.tsx`; `product-tile/stories/` shows a richer one.
|
|
10
|
+
|
|
11
|
+
## Minimal story
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
15
|
+
import { PromoBadge } from '../index';
|
|
16
|
+
|
|
17
|
+
const meta: Meta<typeof PromoBadge> = {
|
|
18
|
+
title: 'Products/Promo Badge',
|
|
19
|
+
component: PromoBadge,
|
|
20
|
+
tags: ['autodocs'],
|
|
21
|
+
args: { label: '20% off' },
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {};
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Import types from `@storybook/react-vite` (not `@storybook/react`). Include the Apache header.
|
|
31
|
+
|
|
32
|
+
## Titles
|
|
33
|
+
|
|
34
|
+
`meta.title` is `Domain/Component` or `Domain/Subgroup/Component`, Title Case With Spaces. Use an existing top-level group: Account, Authentication, Cart, Category, Checkout, Content, Core, Design System, Extensions, Home, Layout, Products, Search. Pick by purpose, not folder. Titles are convention, not lint-enforced; you may restructure the sidebar for your brand.
|
|
35
|
+
|
|
36
|
+
## Writing good stories
|
|
37
|
+
|
|
38
|
+
- Props first; mock at the route boundary via story parameters (`routeLoaderData`, `scapiMock`, `mockRoutes`), not `vi.mock` of hooks.
|
|
39
|
+
- Reuse fixtures from `@/components/__mocks__` and config from `@/test-utils/config` instead of inventing data shapes.
|
|
40
|
+
- No promises or other non-serializable values in `args`.
|
|
41
|
+
- Hide `className` and ReactNode props from Controls (`control: false, table: { disable: true }`).
|
|
42
|
+
- Interactive components: add a `play` function and the `'interaction'` tag.
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pnpm storybook # dev server on :6006
|
|
48
|
+
pnpm storybook:test --type=snapshot # jsdom snapshot gate
|
|
49
|
+
pnpm storybook:test --type=snapshot --update # refresh baselines after an intended DOM change
|
|
50
|
+
pnpm storybook:test --type=interaction # real Chromium, runs play()
|
|
51
|
+
pnpm storybook:test --type=a11y # axe-core
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Only run `--update` for changes you meant to make, and check the diff is additive before committing. After a theme change (colors, shape), snapshots of DOM markup normally do not change, but visual review in the `Design System/Theme/*` stories is worthwhile.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Token System
|
|
2
|
+
|
|
3
|
+
Your theme lives in `src/theme/`. `src/theme/index.css` is the entry point (it sets Tailwind `@source` scoping and imports `shared.css`). `shared.css` imports, in order: `tw-animate-css`, `tailwind.css`, `tokens/*.css`, `animations.css`, `base.css`, then `overrides/*.css`. `storybook.css` is a second entry used by Storybook with wider `@source` globs.
|
|
4
|
+
|
|
5
|
+
## How a token becomes a class
|
|
6
|
+
|
|
7
|
+
1. A CSS variable is defined in a token file: `--primary: #131315;` (in `:root`).
|
|
8
|
+
2. `src/theme/tailwind.css` bridges it inside an `@theme inline { ... }` block: `--color-primary: var(--primary);`.
|
|
9
|
+
3. Components use the generated utilities: `bg-primary`, `text-primary-foreground`, `border-primary`.
|
|
10
|
+
|
|
11
|
+
To add a token, do both steps 1 and 2. Then use the class. Never use arbitrary values such as `bg-[#131315]` or `bg-[--primary]`.
|
|
12
|
+
|
|
13
|
+
## Token files (`src/theme/tokens/`)
|
|
14
|
+
|
|
15
|
+
| File | Contents |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `core.css` | Surface and text palette (`--background`, `--foreground`, `--card`, `--popover`, `--primary`, `--secondary`, `--tertiary`, `--muted`, `--accent`), `--destructive`/`--success`/`--warning`/`--info` pairs, borders/input/ring/separator, rating, and the shape tokens `--ui-radius`, `--ui-shadow`, `--ui-border-width`. WCAG contrast ratios are annotated in comments. |
|
|
18
|
+
| `status.css` | Warning/active backgrounds, account action colors, `--status-*` (positive, warning, critical, info) |
|
|
19
|
+
| `header.css` | Header, header-menu, footer, and newsletter band colors; `--header-logo-filter` |
|
|
20
|
+
| `swatch.css` | Product swatch and color-pill sizing/colors |
|
|
21
|
+
| `brand.css` | `--brand-*` palette primitives and the hero scrims `--hero-overlay-dark`, `--hero-overlay-light`, `--hero-scrim` |
|
|
22
|
+
| `components.css` | Component-scoped tokens (payment brand colors, cart, product badge) |
|
|
23
|
+
| `custom.css` | Focus and input-background helpers |
|
|
24
|
+
| `sidebar.css`, `agentic.css` | Sidebar palette; agentic-shopping UI palette |
|
|
25
|
+
|
|
26
|
+
Other theme files: `tailwind.css` (font stacks `--font-sans/-serif/-mono`, color bridge, `border-ui` utility), `base.css` (`@font-face`, base layer, `.section-container`, section-scoped shape rules), `animations.css`, and `overrides/*.css` for component-level CSS (navigation, cart sheet, toasts, store locator).
|
|
27
|
+
|
|
28
|
+
## Class cheat sheet
|
|
29
|
+
|
|
30
|
+
| Need | Classes |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Page surface | `bg-background text-foreground` |
|
|
33
|
+
| Card / popover | `bg-card text-card-foreground`, `bg-popover text-popover-foreground` |
|
|
34
|
+
| Primary action | `bg-primary text-primary-foreground hover:bg-primary/90` |
|
|
35
|
+
| Secondary / muted | `bg-secondary text-secondary-foreground`, `bg-muted text-muted-foreground` |
|
|
36
|
+
| Borders | `border-border`, `border-border-subtle`, `border-input`; focus `ring-ring` |
|
|
37
|
+
| Destructive / success / warning / info | `bg-destructive text-destructive-foreground`, and the same pairs for `success`, `warning`, `info` |
|
|
38
|
+
| Status text | `text-status-positive`, `text-status-critical`, `bg-status-critical-bg`, `bg-warning-bg`, `bg-active-bg` |
|
|
39
|
+
| Header | `bg-header-background text-header-foreground border-header-border`, `bg-header-menu-background`, `bg-header-menu-hover-background` |
|
|
40
|
+
| Footer / newsletter | `bg-footer-background text-footer-foreground`, `bg-newsletter-background` |
|
|
41
|
+
| Brand primitives | `bg-brand-black`, `text-brand-white`, `bg-brand-gray-100` (prefer semantic tokens when one fits) |
|
|
42
|
+
|
|
43
|
+
Opacity modifiers work on bridged colors (`bg-primary/90`). Focus ring convention from the shipped Button: `focus-visible:ring-ring/50 focus-visible:ring-[3px]`.
|
|
44
|
+
|
|
45
|
+
`--border` is the darker tier and `--border-subtle` the lighter one; both are set to meet 3:1 contrast against white. If you change them, re-check contrast.
|
|
46
|
+
|
|
47
|
+
## Hard-coded colors
|
|
48
|
+
|
|
49
|
+
`custom/color-linter` (OxLint) rejects raw Tailwind palette utilities in `className` and `cn()` string literals. Fix by picking a semantic token or adding a token as above. Use `pnpm lint` to check.
|
|
50
|
+
|
|
51
|
+
## Dark mode
|
|
52
|
+
|
|
53
|
+
The shipped theme defines a single palette in `:root`; there is no `.dark` token block. Some shadcn primitives still carry `dark:` utilities inherited from upstream, which are inert unless you add a dark palette yourself.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
| Symptom | Cause | Fix |
|
|
4
|
+
|---|---|---|
|
|
5
|
+
| New color class renders nothing | Token defined but not bridged | Add `--color-x: var(--x)` in `@theme inline` in `src/theme/tailwind.css` |
|
|
6
|
+
| `pnpm lint` reports a hard-coded color utility | `custom/color-linter` | Use a semantic token class (`text-primary-foreground` instead of `text-white`) |
|
|
7
|
+
| Header class like `bg-[--header-background]` does nothing | Wrong syntax | Use `bg-header-background` |
|
|
8
|
+
| Setting `--radius-ui` / `--shadow-ui` has no effect | Bridge variables are compile-time only | Set `--ui-radius` / `--ui-shadow` |
|
|
9
|
+
| Card border will not appear | `border` / `border-2` used | `[--ui-border-width:1px]` on the Card |
|
|
10
|
+
| Links lose the site/locale prefix | `Link`/`useNavigate` imported from `react-router` | Import from `@/components/link` and `@/hooks/use-navigate` |
|
|
11
|
+
| Page flickers or re-suspends forever | Several promises in one `<Suspense>`, or promises composed during render | One boundary per promise; compose in the loader |
|
|
12
|
+
| Tailwind class works in dev but not in build or Storybook | File outside the `@source` globs in `src/theme/index.css` / `storybook.css` | Move the file under `src/` or extend the globs; run `pnpm lint:css` |
|
|
13
|
+
| Story not counted or not found | Not in a `stories/` subfolder | Move it to `<component>/stories/` |
|
|
14
|
+
| `pnpm test-storybook:...` not found | Script does not exist | `pnpm storybook:test --type=snapshot` |
|
|
15
|
+
| Snapshot failure after an intended change | Baseline is stale | `pnpm storybook:test --type=snapshot --update`, review the diff |
|
|
16
|
+
| shadcn fork has raw `rounded-md` / `shadow-sm` | Added with `npx shadcn add` | `node .claude/skills/sync-shadcn/sync.mjs restyle <file>` |
|
|
17
|
+
| `sync`/`status` reports no baseline | `.shadcn-baseline/` not seeded | `node .claude/skills/sync-shadcn/sync.mjs sync <name> --bootstrap` |
|
|
18
|
+
| Overlay code appears in the main bundle | Imported synchronously | `React.lazy` + `useDeferredUnmount`; check with `pnpm bundlesize` |
|
|
19
|
+
| Typecheck passes locally, fails after route changes | Stale generated types | `pnpm typecheck` runs `react-router typegen` first; run it, not bare `tsc` |
|