@tpitre/story-ui 4.8.0 → 4.8.1

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 CHANGED
@@ -154,6 +154,28 @@ export default {
154
154
  };
155
155
  ```
156
156
 
157
+ ### Advanced Configuration: Import Examples (Web Components / Custom Libraries)
158
+
159
+ For component libraries with non-standard import paths (especially Web Components with local imports), use `importExamples` to teach the AI your import patterns:
160
+
161
+ ```javascript
162
+ export default {
163
+ framework: 'web-components',
164
+ importPath: '../../../components',
165
+
166
+ // Teach the AI your library's import structure
167
+ importExamples: [
168
+ "import '../../../components/button/button'; // For <my-button>",
169
+ "import '../../../components/card/card'; // For <my-card>",
170
+ "import '../../../components/icon/icons/check'; // For <my-icon-check>",
171
+ ],
172
+
173
+ // ... other config
174
+ };
175
+ ```
176
+
177
+ The AI uses these examples to understand your component library's folder structure and generate correct imports.
178
+
157
179
  ---
158
180
 
159
181
  ## Usage
@@ -443,6 +465,30 @@ For simpler setups, use `story-ui-considerations.md`:
443
465
  - Use Card with shadow="sm" for content containers
444
466
  ```
445
467
 
468
+ ### Component-Specific Behaviors (Critical for Web Components)
469
+
470
+ For libraries where components have specific requirements (like attributes needed for visibility), document these behaviors:
471
+
472
+ ```markdown
473
+ # Component-Specific Behaviors
474
+
475
+ ## Alert Component (`<my-alert>`)
476
+ **IMPORTANT**: The alert requires `is-active` attribute to be visible.
477
+
478
+ <!-- WRONG - will not render -->
479
+ <my-alert variant="success">Message</my-alert>
480
+
481
+ <!-- CORRECT -->
482
+ <my-alert variant="success" is-active>Message</my-alert>
483
+
484
+ ## Import Patterns
485
+ Components are in individual folders:
486
+ - import '../../../components/alert/alert';
487
+ - import '../../../components/icon/icons/check';
488
+ ```
489
+
490
+ The AI reads this file before every story generation, ensuring component-specific rules are followed.
491
+
446
492
  ---
447
493
 
448
494
  ## CLI Reference
@@ -457,8 +503,37 @@ npx story-ui start --port 4002 # Custom port
457
503
 
458
504
  # Run MCP STDIO server (for Claude Desktop local integration)
459
505
  npx story-ui mcp
506
+
507
+ # Check installation status and version
508
+ npx story-ui status
509
+
510
+ # Update Story UI files to latest version
511
+ npx story-ui update
460
512
  ```
461
513
 
514
+ ### Resetting / Uninstalling Story UI
515
+
516
+ To completely remove Story UI from your project and start fresh:
517
+
518
+ ```bash
519
+ # Remove Story UI configuration and panel files
520
+ rm -f story-ui.config.js
521
+ rm -f story-ui-considerations.md
522
+ rm -rf story-ui-docs/
523
+ rm -rf src/stories/StoryUI/
524
+ rm -rf src/stories/generated/
525
+
526
+ # Remove package.json script entries (manual)
527
+ # Delete "story-ui" and "storybook-with-ui" from scripts
528
+
529
+ # Optionally remove the package
530
+ npm uninstall @tpitre/story-ui
531
+
532
+ # Optionally clean .env (remove VITE_STORY_UI_PORT, API keys)
533
+ ```
534
+
535
+ After removal, run `npx story-ui init` to start fresh with a clean installation.
536
+
462
537
  ---
463
538
 
464
539
  ## API Reference
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../cli/setup.ts"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,iCAAiC,SA8ChD;AAiWD,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,iBA4zB5D"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../cli/setup.ts"],"names":[],"mappings":"AAmDA;;GAEG;AACH,wBAAgB,iCAAiC,SA8ChD;AAiWD,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,iBA45B5D"}
package/dist/cli/setup.js CHANGED
@@ -424,7 +424,7 @@ export async function setupCommand(options = {}) {
424
424
  '@storybook/react', '@storybook/react-vite', '@storybook/react-webpack5', '@storybook/nextjs',
425
425
  '@storybook/angular', '@storybook/vue3', '@storybook/vue3-vite',
426
426
  '@storybook/svelte', '@storybook/svelte-vite',
427
- '@storybook/web-components', '@storybook/web-components-vite'
427
+ '@storybook/web-components', '@storybook/web-components-vite', '@storybook/web-components-webpack5'
428
428
  ];
429
429
  const hasStorybook = storybookPackages.some(pkg => devDeps[pkg] || deps[pkg]) ||
430
430
  fs.existsSync(path.join(process.cwd(), '.storybook'));
@@ -479,7 +479,12 @@ export async function setupCommand(options = {}) {
479
479
  componentFramework = 'svelte';
480
480
  console.log(chalk.green('✅ Detected Svelte Storybook'));
481
481
  }
482
- // Check for Web Components Storybook (vite variant first)
482
+ // Check for Web Components Storybook (webpack5 first, then vite, then generic)
483
+ else if (devDeps['@storybook/web-components-webpack5'] || deps['@storybook/web-components-webpack5']) {
484
+ storybookFramework = '@storybook/web-components-webpack5';
485
+ componentFramework = 'web-components';
486
+ console.log(chalk.green('✅ Detected Webpack 5-based Web Components Storybook'));
487
+ }
483
488
  else if (devDeps['@storybook/web-components-vite'] || deps['@storybook/web-components-vite']) {
484
489
  storybookFramework = '@storybook/web-components-vite';
485
490
  componentFramework = 'web-components';
@@ -875,6 +880,15 @@ Material UI (MUI) is a React component library implementing Material Design.
875
880
  config.componentFramework = componentFramework; // react, angular, vue, svelte, or web-components
876
881
  config.storybookFramework = storybookFramework; // e.g., @storybook/react-vite, @storybook/angular
877
882
  config.llmProvider = answers.llmProvider || 'claude'; // claude, openai, or gemini
883
+ // For web-components with local imports, add importExamples guidance
884
+ if (componentFramework === 'web-components' && config.importPath?.startsWith('.')) {
885
+ config.importExamples = [
886
+ `import '${config.importPath}/alert/alert'; // For <your-prefix-alert> component`,
887
+ `import '${config.importPath}/button/button'; // For <your-prefix-button> component`,
888
+ `// IMPORTANT: Update these examples to match your component library's folder structure`,
889
+ `// The AI uses these patterns to generate correct import statements`
890
+ ];
891
+ }
878
892
  // Add version tracking for update command
879
893
  config._storyUIVersion = getStoryUIVersion();
880
894
  config._lastUpdated = new Date().toISOString();
@@ -882,6 +896,14 @@ Material UI (MUI) is a React component library implementing Material Design.
882
896
  const configContent = `module.exports = ${JSON.stringify(config, null, 2)};`;
883
897
  const configPath = path.join(process.cwd(), 'story-ui.config.js');
884
898
  fs.writeFileSync(configPath, configContent);
899
+ console.log(chalk.green('✅ Created story-ui.config.js'));
900
+ // For web-components, provide guidance about importExamples
901
+ if (componentFramework === 'web-components' && config.importPath?.startsWith('.')) {
902
+ console.log(chalk.yellow('\n⚠️ Web Components Setup - Important:'));
903
+ console.log(chalk.gray(' Update "importExamples" in story-ui.config.js to match your component library\'s structure.'));
904
+ console.log(chalk.gray(' This helps the AI generate correct import statements for your components.'));
905
+ console.log(chalk.gray(' Also update story-ui-considerations.md with component-specific behaviors.'));
906
+ }
885
907
  // Create generated stories directory
886
908
  const storiesDir = path.dirname(config.generatedStoriesPath);
887
909
  if (!fs.existsSync(storiesDir)) {
@@ -921,6 +943,21 @@ Material UI (MUI) is a React component library implementing Material Design.
921
943
  if (actualMainPath) {
922
944
  let mainContent = fs.readFileSync(actualMainPath, 'utf-8');
923
945
  let configUpdated = false;
946
+ // Add Story UI path to stories array if not already present
947
+ const storyUIStoriesPath = `'../src/stories/**/*.@(mdx|stories.@(js|jsx|ts|tsx))'`;
948
+ if (!mainContent.includes('src/stories/**/*')) {
949
+ // Find the stories array and add our path
950
+ const storiesArrayPattern = /(stories\s*:\s*\[[\s\S]*?)(\],?)/;
951
+ const match = mainContent.match(storiesArrayPattern);
952
+ if (match) {
953
+ // Check if the array has content
954
+ const arrayContent = match[1];
955
+ // Add Story UI path at the end of the stories array
956
+ mainContent = mainContent.replace(storiesArrayPattern, `$1,\n ${storyUIStoriesPath}\n $2`);
957
+ configUpdated = true;
958
+ console.log(chalk.green('✅ Added Story UI path to Storybook stories array'));
959
+ }
960
+ }
924
961
  // Check if StoryUI config already exists
925
962
  if (mainContent.includes('@tpitre/story-ui') || mainContent.includes('StoryUIPanel')) {
926
963
  console.log(chalk.blue('ℹ️ Storybook already configured for Story UI'));
@@ -952,8 +989,57 @@ Material UI (MUI) is a React component library implementing Material Design.
952
989
  console.warn(chalk.yellow('⚠️ Could not install CSS loaders. You may need to run: npm install --save-dev style-loader css-loader'));
953
990
  }
954
991
  }
992
+ else if (storybookFramework === '@storybook/web-components-webpack5') {
993
+ // Web Components with Webpack5 - needs babel-loader for TSX
994
+ const hasBabelConfig = mainContent.includes('babel-loader') && mainContent.includes('StoryUI');
995
+ if (!hasBabelConfig) {
996
+ const babelLoaderRule = `
997
+ // Story UI: Add babel-loader for TSX/JSX support (React panel in Web Components project)
998
+ config.module?.rules?.push({
999
+ test: /stories\\/StoryUI\\/.*\\.tsx$/,
1000
+ use: {
1001
+ loader: 'babel-loader',
1002
+ options: {
1003
+ presets: [
1004
+ ['@babel/preset-react', { runtime: 'automatic' }],
1005
+ '@babel/preset-typescript'
1006
+ ]
1007
+ }
1008
+ }
1009
+ });`;
1010
+ if (mainContent.includes('webpackFinal')) {
1011
+ // webpackFinal exists - inject babel-loader rule before return statement
1012
+ // Look for the return statement in webpackFinal and insert before it
1013
+ const returnPattern = /(webpackFinal[\s\S]*?)(return\s+config\s*;)/;
1014
+ if (mainContent.match(returnPattern)) {
1015
+ mainContent = mainContent.replace(returnPattern, `$1${babelLoaderRule}\n\n $2`);
1016
+ configUpdated = true;
1017
+ }
1018
+ }
1019
+ else {
1020
+ // webpackFinal doesn't exist - add a complete block
1021
+ const webpackConfig = `webpackFinal: async (config) => {${babelLoaderRule}
1022
+ return config;
1023
+ },`;
1024
+ // Insert webpackFinal inside the config object, before the closing };
1025
+ if (mainContent.match(/};\s*\n+\s*export\s+default/)) {
1026
+ mainContent = mainContent.replace(/(\n)(};\s*\n+\s*export\s+default)/, `\n ${webpackConfig}\n$2`);
1027
+ configUpdated = true;
1028
+ }
1029
+ }
1030
+ }
1031
+ // Install required loaders for Web Components Webpack5
1032
+ console.log(chalk.blue('📦 Installing babel loaders for Web Components Webpack5...'));
1033
+ try {
1034
+ execSync('npm install --save-dev babel-loader @babel/preset-react @babel/preset-typescript @babel/core', { stdio: 'inherit' });
1035
+ console.log(chalk.green('✅ Installed babel-loader and presets'));
1036
+ }
1037
+ catch (error) {
1038
+ console.warn(chalk.yellow('⚠️ Could not install babel loaders. You may need to run: npm install --save-dev babel-loader @babel/preset-react @babel/preset-typescript @babel/core'));
1039
+ }
1040
+ }
955
1041
  else {
956
- // Vite-based frameworks (React, Vue, Svelte, Web Components)
1042
+ // Vite-based frameworks (React, Vue, Svelte, Web Components with Vite)
957
1043
  if (!mainContent.includes('viteFinal')) {
958
1044
  const viteConfig = `viteFinal: async (config) => {
959
1045
  // Story UI: Exclude from dependency optimization to handle CSS imports correctly
@@ -1 +1 @@
1
- {"version":3,"file":"generateStory.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/generateStory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAyd5C,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DA2mBxE"}
1
+ {"version":3,"file":"generateStory.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/generateStory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAyd5C,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,2DA8mBxE"}
@@ -558,7 +558,10 @@ export async function generateStoryFromPrompt(req, res) {
558
558
  const validationFileName = `story${frameworkAdapter?.defaultExtension || '.stories.tsx'}`;
559
559
  const astValidation = validateStoryCode(aiText, validationFileName, config);
560
560
  // 3. Import validation (check against discovered components)
561
- const importValidation = await preValidateImports(aiText, config, discovery);
561
+ // Skip for web-components - they use custom element tags, not imported component classes
562
+ const importValidation = detectedFramework === 'web-components'
563
+ ? { isValid: true, errors: [] }
564
+ : await preValidateImports(aiText, config, discovery);
562
565
  // Aggregate all errors
563
566
  const aggregatedErrors = aggregateValidationErrors(astValidation, validationErrors, importValidation.isValid ? [] : importValidation.errors);
564
567
  // Track this attempt
@@ -1 +1 @@
1
- {"version":3,"file":"generateStoryStream.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/generateStoryStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA0c5C,wBAAsB,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBA2qB9E"}
1
+ {"version":3,"file":"generateStoryStream.d.ts","sourceRoot":"","sources":["../../../mcp-server/routes/generateStoryStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA0c5C,wBAAsB,6BAA6B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,iBA8qB9E"}
@@ -620,7 +620,10 @@ export async function generateStoryFromPromptStream(req, res) {
620
620
  logger.error('AST validation error:', astError);
621
621
  }
622
622
  // 3. Import validation
623
- const importValidation = await preValidateImports(codeToValidate, config, discovery);
623
+ // Skip for web-components - they use custom element tags, not imported component classes
624
+ const importValidation = detectedFramework === 'web-components'
625
+ ? { isValid: true, errors: [] }
626
+ : await preValidateImports(codeToValidate, config, discovery);
624
627
  const importErrors = importValidation.isValid ? [] : importValidation.errors;
625
628
  // Aggregate all errors
626
629
  const currentErrors = aggregateValidationErrors(astResult, patternErrors, importErrors);
@@ -1 +1 @@
1
- {"version":3,"file":"web-components-adapter.d.ts","sourceRoot":"","sources":["../../../story-generator/framework-adapters/web-components-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,qBAAa,oBAAqB,SAAQ,oBAAoB;IAC5D,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAoB;IAChD,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,wBAAwB,EAAE,cAAc,EAAE,CAGjD;IACF,QAAQ,CAAC,gBAAgB,iBAAiB;IAE1C;;OAEG;IACH,wBAAwB,IAAI,MAAM,EAAE;IAIpC;;;OAGG;IACH,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAoE1E;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB,oBAAoB,CAClB,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM;IA4FT,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM;IA0G/C,mBAAmB,CACjB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,mBAAmB,EAAE,GAChC,MAAM;IA8CT,gBAAgB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAwB1D;;OAEG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAuCzC;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAiCjC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IAwBpE;;OAEG;IACH,eAAe,CACb,UAAU,EAAE,mBAAmB,EAAE,EACjC,MAAM,EAAE,aAAa,GACpB,MAAM;CAYV;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAEjE"}
1
+ {"version":3,"file":"web-components-adapter.d.ts","sourceRoot":"","sources":["../../../story-generator/framework-adapters/web-components-adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,qBAAa,oBAAqB,SAAQ,oBAAoB;IAC5D,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAoB;IAChD,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,wBAAwB,EAAE,cAAc,EAAE,CAGjD;IACF,QAAQ,CAAC,gBAAgB,iBAAiB;IAE1C;;OAEG;IACH,wBAAwB,IAAI,MAAM,EAAE;IAIpC;;;OAGG;IACH,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAoE1E;;OAEG;IACH,OAAO,CAAC,eAAe;IAOvB,oBAAoB,CAClB,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,MAAM;IAuHT,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM;IA0G/C,mBAAmB,CACjB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,mBAAmB,EAAE,GAChC,MAAM;IA8CT,gBAAgB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAwB1D;;OAEG;IACH,WAAW,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAuCzC;;;;;;;;OAQG;IACH,OAAO,CAAC,yBAAyB;IAiCjC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;IAwBpE;;OAEG;IACH,eAAe,CACb,UAAU,EAAE,mBAAmB,EAAE,EACjC,MAAM,EAAE,aAAa,GACpB,MAAM;CAYV;AAED;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAEjE"}
@@ -103,13 +103,40 @@ export class WebComponentsAdapter extends BaseFrameworkAdapter {
103
103
  const componentSystemName = config.componentPrefix
104
104
  ? `${config.componentPrefix.replace(/^[A-Z]+/, '')} design system`
105
105
  : 'component library';
106
+ // Detect if this is a local/relative import path
107
+ const isLocalImport = config.importPath?.startsWith('.') || config.importPath?.startsWith('/');
108
+ const importPath = config.importPath || 'your-library';
109
+ // Build import guidance based on config and import path type
110
+ let importGuidance;
111
+ if (config.importExamples && config.importExamples.length > 0) {
112
+ // Use user-provided examples from config (design-system agnostic)
113
+ importGuidance = `COMPONENT IMPORTS - Follow these examples EXACTLY:
114
+ ${config.importExamples.map(ex => `- ${ex}`).join('\n')}
115
+ - Import ONLY the components you actually use in your story
116
+ - Follow the exact pattern shown in the examples above`;
117
+ }
118
+ else if (isLocalImport) {
119
+ // Generic guidance for local imports (no assumptions about folder structure)
120
+ importGuidance = `COMPONENT IMPORTS - Local Import Pattern:
121
+ - Import pattern: import '${importPath}/{component-path}';
122
+ - Check the component discovery list for the exact import path for each component
123
+ - Import ONLY the components you actually use in your story
124
+ - Web Components auto-register when their file is imported`;
125
+ }
126
+ else {
127
+ // npm package imports
128
+ importGuidance = `COMPONENT IMPORTS:
129
+ - Import the main library: import '${importPath}';
130
+ - Or import specific components: import '${importPath}/button';`;
131
+ }
106
132
  return `You are an expert Web Components developer creating Storybook stories using CSF 3.0 format.
107
133
  Use ONLY the Web Components from the ${componentSystemName} listed below.
108
134
 
109
135
  MANDATORY IMPORTS - First lines of every story file:
110
136
  1. import { html } from 'lit';
111
137
  2. import type { Meta, StoryObj } from '@storybook/web-components';
112
- 3. import '${config.importPath || 'your-library'}'; // Register custom elements
138
+
139
+ ${importGuidance}
113
140
 
114
141
  WEB COMPONENTS STORY FORMAT:
115
142
  - Use the html template literal from Lit for rendering
@@ -118,9 +145,8 @@ WEB COMPONENTS STORY FORMAT:
118
145
  - Events use @ prefix (e.g., @click)
119
146
 
120
147
  COMPONENT REGISTRATION:
121
- - Web Components must be registered before use
122
- - Import the component file to auto-register: import 'my-library/my-button';
123
- - Or import the class and define: customElements.define('my-button', MyButton);
148
+ - Web Components auto-register when imported
149
+ - Import each component file you need to use it in your story
124
150
 
125
151
  STORY STRUCTURE (CSF 3.0):
126
152
  - Meta object with title and optional component reference
@@ -137,7 +163,7 @@ Example structure:
137
163
  \`\`\`typescript
138
164
  import { html } from 'lit';
139
165
  import type { Meta, StoryObj } from '@storybook/web-components';
140
- import 'your-library/button';
166
+ ${isLocalImport ? `import '${importPath}/button/button'; // Import path for your component` : `import '${importPath}/button';`}
141
167
 
142
168
  const meta: Meta = {
143
169
  title: 'Components/Button',
@@ -1 +1 @@
1
- {"version":3,"file":"selfHealingLoop.d.ts","sourceRoot":"","sources":["../../story-generator/selfHealingLoop.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mCAAmC;IACnC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,wDAAwD;IACxD,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,6BAA6B;IA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GAEG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,gBAAgB,EAAE,GAC/B;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA2C1C;AAuED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAwIR;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAcnE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,gBAAgB,EAAE,EAChC,cAAc,EAAE,OAAO,EAAE,GACxB,iBAAiB,CAYnB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,GAC1D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,GAAG,IAAI,CAenD"}
@@ -262,6 +262,14 @@ export function buildSelfHealingPrompt(originalCode, errors, attempt, options) {
262
262
  sections.push(`9. Return the COMPLETE corrected code in a \`\`\`svelte code block`);
263
263
  sections.push('10. Do NOT include any explanation - just the corrected code block');
264
264
  }
265
+ else if (options.framework === 'web-components') {
266
+ // Web Components use side-effect imports and often require deep paths
267
+ sections.push('6. Use Lit html template literal for rendering');
268
+ sections.push('7. Web Component imports register custom elements as side-effects');
269
+ sections.push('8. Use correct import path for each component (deep paths are allowed for web components)');
270
+ sections.push(`9. Return the COMPLETE corrected code in a \`\`\`${codeBlockLang} code block`);
271
+ sections.push('10. Do NOT include any explanation - just the corrected code block');
272
+ }
265
273
  else {
266
274
  sections.push('6. Ensure all JSX elements are properly opened and closed');
267
275
  sections.push(`7. Only import components that exist in "${options.importPath}"`);
@@ -1 +1 @@
1
- {"version":3,"file":"validateStory.d.ts","sourceRoot":"","sources":["../../story-generator/validateStory.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAoB,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAsH9G;AAgrBD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAoFjH;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,CA+BvE"}
1
+ {"version":3,"file":"validateStory.d.ts","sourceRoot":"","sources":["../../story-generator/validateStory.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAoB,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAsH9G;AAirBD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAoFjH;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,CA+BvE"}
@@ -121,7 +121,8 @@ function performSemanticChecks(sourceFile, config) {
121
121
  const importPath = moduleSpecifier.text;
122
122
  // CRITICAL: Check for incorrect import paths that contain the configured importPath but with extra segments
123
123
  // This catches LLM errors like: vuetify/components/lib/components/VAlert instead of vuetify/components
124
- if (config && config.importPath) {
124
+ // NOTE: Web Components often require deep imports to register custom elements, so we skip this check for them
125
+ if (config && config.importPath && config.componentFramework !== 'web-components') {
125
126
  const configuredPath = config.importPath;
126
127
  // Check if LLM used a deep/incorrect path instead of the configured one
127
128
  if (importPath !== configuredPath &&
@@ -100,6 +100,12 @@ export interface StoryUIConfig {
100
100
  designSystemGuidelines?: DesignSystemGuidelines;
101
101
  /** Icon imports configuration (auto-detected from package.json or manually configured) */
102
102
  iconImports?: IconImportsConfig;
103
+ /**
104
+ * Example import statements to guide the LLM on correct import patterns.
105
+ * Useful for Web Components or custom folder structures.
106
+ * Example: ["import '../../../components/alert/alert'; // For <al-alert> component"]
107
+ */
108
+ importExamples?: string[];
103
109
  }
104
110
  export declare const DEFAULT_CONFIG: StoryUIConfig;
105
111
  export declare const GENERIC_CONFIG_TEMPLATE: Partial<StoryUIConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"story-ui.config.d.ts","sourceRoot":"","sources":["../story-ui.config.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,GAAG,SA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E,CAAC;IAC9B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACvC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IACtC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD,0FAA0F;IAC1F,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAGD,eAAO,MAAM,cAAc,EAAE,aA4E5B,CAAC;AAGF,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAAC,aAAa,CAoB1D,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,aAA8B,CAAC;AAG7D,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAarF"}
@@ -993,6 +993,28 @@
993
993
  font-style: italic;
994
994
  }
995
995
 
996
+ /* CRITICAL: Force text color on all child elements
997
+ Storybook's design system aggressively overrides paragraph colors.
998
+ These rules MUST use !important and high specificity to win. */
999
+
1000
+ /* Light mode: Ensure AI message text is dark on light background */
1001
+ .sui-message-ai .sui-message-bubble p,
1002
+ .sui-message-ai .sui-message-bubble strong,
1003
+ .sui-message-ai .sui-message-bubble em,
1004
+ .sui-message-ai .sui-message-bubble span,
1005
+ .sui-message-ai .sui-message-bubble li {
1006
+ color: #18181b !important;
1007
+ }
1008
+
1009
+ /* Dark mode: Ensure AI message text is light on dark background */
1010
+ .sui-root.dark .sui-message-ai .sui-message-bubble p,
1011
+ .sui-root.dark .sui-message-ai .sui-message-bubble strong,
1012
+ .sui-root.dark .sui-message-ai .sui-message-bubble em,
1013
+ .sui-root.dark .sui-message-ai .sui-message-bubble span,
1014
+ .sui-root.dark .sui-message-ai .sui-message-bubble li {
1015
+ color: #fafafa !important;
1016
+ }
1017
+
996
1018
  /* Inline code styling */
997
1019
  .sui-message-bubble code {
998
1020
  font-family: var(--font-mono);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpitre/story-ui",
3
- "version": "4.8.0",
3
+ "version": "4.8.1",
4
4
  "description": "AI-powered Storybook story generator with dynamic component discovery",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -993,6 +993,28 @@
993
993
  font-style: italic;
994
994
  }
995
995
 
996
+ /* CRITICAL: Force text color on all child elements
997
+ Storybook's design system aggressively overrides paragraph colors.
998
+ These rules MUST use !important and high specificity to win. */
999
+
1000
+ /* Light mode: Ensure AI message text is dark on light background */
1001
+ .sui-message-ai .sui-message-bubble p,
1002
+ .sui-message-ai .sui-message-bubble strong,
1003
+ .sui-message-ai .sui-message-bubble em,
1004
+ .sui-message-ai .sui-message-bubble span,
1005
+ .sui-message-ai .sui-message-bubble li {
1006
+ color: #18181b !important;
1007
+ }
1008
+
1009
+ /* Dark mode: Ensure AI message text is light on dark background */
1010
+ .sui-root.dark .sui-message-ai .sui-message-bubble p,
1011
+ .sui-root.dark .sui-message-ai .sui-message-bubble strong,
1012
+ .sui-root.dark .sui-message-ai .sui-message-bubble em,
1013
+ .sui-root.dark .sui-message-ai .sui-message-bubble span,
1014
+ .sui-root.dark .sui-message-ai .sui-message-bubble li {
1015
+ color: #fafafa !important;
1016
+ }
1017
+
996
1018
  /* Inline code styling */
997
1019
  .sui-message-bubble code {
998
1020
  font-family: var(--font-mono);