@tpitre/story-ui 2.2.0 → 2.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/.env.sample +82 -11
- package/README.md +89 -0
- package/dist/cli/deploy.d.ts +17 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/deploy.js +696 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +26 -2
- package/dist/cli/setup.d.ts +11 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +437 -110
- package/dist/mcp-server/index.d.ts +2 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/index.js +120 -2
- package/dist/mcp-server/mcp-stdio-server.d.ts +3 -0
- package/dist/mcp-server/mcp-stdio-server.d.ts.map +1 -0
- package/dist/mcp-server/mcp-stdio-server.js +8 -1
- package/dist/mcp-server/routes/claude.d.ts +3 -0
- package/dist/mcp-server/routes/claude.d.ts.map +1 -0
- package/dist/mcp-server/routes/claude.js +60 -23
- package/dist/mcp-server/routes/components.d.ts +4 -0
- package/dist/mcp-server/routes/components.d.ts.map +1 -0
- package/dist/mcp-server/routes/frameworks.d.ts +38 -0
- package/dist/mcp-server/routes/frameworks.d.ts.map +1 -0
- package/dist/mcp-server/routes/frameworks.js +183 -0
- package/dist/mcp-server/routes/generateStory.d.ts +3 -0
- package/dist/mcp-server/routes/generateStory.d.ts.map +1 -0
- package/dist/mcp-server/routes/generateStory.js +160 -76
- package/dist/mcp-server/routes/generateStoryStream.d.ts +12 -0
- package/dist/mcp-server/routes/generateStoryStream.d.ts.map +1 -0
- package/dist/mcp-server/routes/generateStoryStream.js +947 -0
- package/dist/mcp-server/routes/hybridStories.d.ts +18 -0
- package/dist/mcp-server/routes/hybridStories.d.ts.map +1 -0
- package/dist/mcp-server/routes/mcpRemote.d.ts +14 -0
- package/dist/mcp-server/routes/mcpRemote.d.ts.map +1 -0
- package/dist/mcp-server/routes/mcpRemote.js +489 -0
- package/dist/mcp-server/routes/memoryStories.d.ts +26 -0
- package/dist/mcp-server/routes/memoryStories.d.ts.map +1 -0
- package/dist/mcp-server/routes/providers.d.ts +89 -0
- package/dist/mcp-server/routes/providers.d.ts.map +1 -0
- package/dist/mcp-server/routes/providers.js +369 -0
- package/dist/mcp-server/routes/storySync.d.ts +26 -0
- package/dist/mcp-server/routes/storySync.d.ts.map +1 -0
- package/dist/mcp-server/routes/streamTypes.d.ts +110 -0
- package/dist/mcp-server/routes/streamTypes.d.ts.map +1 -0
- package/dist/mcp-server/routes/streamTypes.js +18 -0
- package/dist/mcp-server/sessionManager.d.ts +50 -0
- package/dist/mcp-server/sessionManager.d.ts.map +1 -0
- package/dist/story-generator/componentBlacklist.d.ts +21 -0
- package/dist/story-generator/componentBlacklist.d.ts.map +1 -0
- package/dist/story-generator/componentDiscovery.d.ts +28 -0
- package/dist/story-generator/componentDiscovery.d.ts.map +1 -0
- package/dist/story-generator/componentRegistryGenerator.d.ts +49 -0
- package/dist/story-generator/componentRegistryGenerator.d.ts.map +1 -0
- package/dist/story-generator/componentRegistryGenerator.js +205 -0
- package/dist/story-generator/configLoader.d.ts +33 -0
- package/dist/story-generator/configLoader.d.ts.map +1 -0
- package/dist/story-generator/considerationsLoader.d.ts +32 -0
- package/dist/story-generator/considerationsLoader.d.ts.map +1 -0
- package/dist/story-generator/documentation-sources.d.ts +28 -0
- package/dist/story-generator/documentation-sources.d.ts.map +1 -0
- package/dist/story-generator/documentationLoader.d.ts +64 -0
- package/dist/story-generator/documentationLoader.d.ts.map +1 -0
- package/dist/story-generator/dynamicPackageDiscovery.d.ts +97 -0
- package/dist/story-generator/dynamicPackageDiscovery.d.ts.map +1 -0
- package/dist/story-generator/enhancedComponentDiscovery.d.ts +125 -0
- package/dist/story-generator/enhancedComponentDiscovery.d.ts.map +1 -0
- package/dist/story-generator/enhancedComponentDiscovery.js +111 -11
- package/dist/story-generator/framework-adapters/angular-adapter.d.ts +40 -0
- package/dist/story-generator/framework-adapters/angular-adapter.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/angular-adapter.js +427 -0
- package/dist/story-generator/framework-adapters/base-adapter.d.ts +75 -0
- package/dist/story-generator/framework-adapters/base-adapter.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/base-adapter.js +147 -0
- package/dist/story-generator/framework-adapters/framework-detector.d.ts +55 -0
- package/dist/story-generator/framework-adapters/framework-detector.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/framework-detector.js +323 -0
- package/dist/story-generator/framework-adapters/index.d.ts +97 -0
- package/dist/story-generator/framework-adapters/index.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/index.js +198 -0
- package/dist/story-generator/framework-adapters/react-adapter.d.ts +40 -0
- package/dist/story-generator/framework-adapters/react-adapter.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/react-adapter.js +316 -0
- package/dist/story-generator/framework-adapters/svelte-adapter.d.ts +40 -0
- package/dist/story-generator/framework-adapters/svelte-adapter.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/svelte-adapter.js +372 -0
- package/dist/story-generator/framework-adapters/types.d.ts +182 -0
- package/dist/story-generator/framework-adapters/types.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/types.js +8 -0
- package/dist/story-generator/framework-adapters/vue-adapter.d.ts +36 -0
- package/dist/story-generator/framework-adapters/vue-adapter.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/vue-adapter.js +336 -0
- package/dist/story-generator/framework-adapters/web-components-adapter.d.ts +54 -0
- package/dist/story-generator/framework-adapters/web-components-adapter.d.ts.map +1 -0
- package/dist/story-generator/framework-adapters/web-components-adapter.js +387 -0
- package/dist/story-generator/generateStory.d.ts +7 -0
- package/dist/story-generator/generateStory.d.ts.map +1 -0
- package/dist/story-generator/gitignoreManager.d.ts +50 -0
- package/dist/story-generator/gitignoreManager.d.ts.map +1 -0
- package/dist/story-generator/imageProcessor.d.ts +80 -0
- package/dist/story-generator/imageProcessor.d.ts.map +1 -0
- package/dist/story-generator/imageProcessor.js +391 -0
- package/dist/story-generator/inMemoryStoryService.d.ts +89 -0
- package/dist/story-generator/inMemoryStoryService.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/base-provider.d.ts +36 -0
- package/dist/story-generator/llm-providers/base-provider.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/base-provider.js +135 -0
- package/dist/story-generator/llm-providers/claude-provider.d.ts +23 -0
- package/dist/story-generator/llm-providers/claude-provider.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/claude-provider.js +414 -0
- package/dist/story-generator/llm-providers/gemini-provider.d.ts +24 -0
- package/dist/story-generator/llm-providers/gemini-provider.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/gemini-provider.js +406 -0
- package/dist/story-generator/llm-providers/index.d.ts +63 -0
- package/dist/story-generator/llm-providers/index.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/index.js +169 -0
- package/dist/story-generator/llm-providers/openai-provider.d.ts +24 -0
- package/dist/story-generator/llm-providers/openai-provider.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/openai-provider.js +458 -0
- package/dist/story-generator/llm-providers/settings-manager.d.ts +75 -0
- package/dist/story-generator/llm-providers/settings-manager.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/settings-manager.js +173 -0
- package/dist/story-generator/llm-providers/story-llm-service.d.ts +79 -0
- package/dist/story-generator/llm-providers/story-llm-service.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/story-llm-service.js +240 -0
- package/dist/story-generator/llm-providers/types.d.ts +153 -0
- package/dist/story-generator/llm-providers/types.d.ts.map +1 -0
- package/dist/story-generator/llm-providers/types.js +8 -0
- package/dist/story-generator/logger.d.ts +14 -0
- package/dist/story-generator/logger.d.ts.map +1 -0
- package/dist/story-generator/logger.js +96 -29
- package/dist/story-generator/postProcessStory.d.ts +6 -0
- package/dist/story-generator/postProcessStory.d.ts.map +1 -0
- package/dist/story-generator/productionGitignoreManager.d.ts +91 -0
- package/dist/story-generator/productionGitignoreManager.d.ts.map +1 -0
- package/dist/story-generator/promptGenerator.d.ts +48 -0
- package/dist/story-generator/promptGenerator.d.ts.map +1 -0
- package/dist/story-generator/promptGenerator.js +186 -1
- package/dist/story-generator/storyHistory.d.ts +44 -0
- package/dist/story-generator/storyHistory.d.ts.map +1 -0
- package/dist/story-generator/storySync.d.ts +68 -0
- package/dist/story-generator/storySync.d.ts.map +1 -0
- package/dist/story-generator/storyTracker.d.ts +48 -0
- package/dist/story-generator/storyTracker.d.ts.map +1 -0
- package/dist/story-generator/storyValidator.d.ts +6 -0
- package/dist/story-generator/storyValidator.d.ts.map +1 -0
- package/dist/story-generator/universalDesignSystemAdapter.d.ts +68 -0
- package/dist/story-generator/universalDesignSystemAdapter.d.ts.map +1 -0
- package/dist/story-generator/universalDesignSystemAdapter.js +138 -1
- package/dist/story-generator/urlRedirectService.d.ts +21 -0
- package/dist/story-generator/urlRedirectService.d.ts.map +1 -0
- package/dist/story-generator/validateStory.d.ts +19 -0
- package/dist/story-generator/validateStory.d.ts.map +1 -0
- package/dist/story-generator/validateStory.js +6 -2
- package/dist/story-generator/visionPrompts.d.ts +88 -0
- package/dist/story-generator/visionPrompts.d.ts.map +1 -0
- package/dist/story-generator/visionPrompts.js +462 -0
- package/dist/story-ui.config.d.ts +78 -0
- package/dist/story-ui.config.d.ts.map +1 -0
- package/dist/templates/StoryUI/StoryUIPanel.d.ts +4 -0
- package/dist/templates/StoryUI/StoryUIPanel.d.ts.map +1 -0
- package/dist/templates/StoryUI/StoryUIPanel.js +1874 -0
- package/dist/templates/StoryUI/StoryUIPanel.stories.d.ts +18 -0
- package/dist/templates/StoryUI/StoryUIPanel.stories.d.ts.map +1 -0
- package/dist/templates/StoryUI/StoryUIPanel.stories.js +37 -0
- package/dist/templates/StoryUI/index.d.ts +3 -0
- package/dist/templates/StoryUI/index.d.ts.map +1 -0
- package/dist/templates/StoryUI/index.js +2 -0
- package/package.json +17 -3
- package/templates/StoryUI/StoryUIPanel.tsx +1960 -384
- package/templates/StoryUI/index.tsx +1 -1
- package/templates/StoryUI/manager.tsx +264 -0
- package/templates/production-app/.env.example +11 -0
- package/templates/production-app/index.html +66 -0
- package/templates/production-app/package.json +30 -0
- package/templates/production-app/public/favicon.svg +5 -0
- package/templates/production-app/src/App.tsx +1157 -0
- package/templates/production-app/src/LivePreviewRenderer.tsx +420 -0
- package/templates/production-app/src/componentRegistry.ts +315 -0
- package/templates/production-app/src/considerations.ts +16 -0
- package/templates/production-app/src/index.css +284 -0
- package/templates/production-app/src/main.tsx +25 -0
- package/templates/production-app/tsconfig.json +32 -0
- package/templates/production-app/tsconfig.node.json +11 -0
- package/templates/production-app/vite.config.ts +83 -0
- package/templates/react-import-rule.json +2 -2
- package/dist/index.js +0 -12
- package/dist/story-ui.config.loader.js +0 -205
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Registry Generator
|
|
3
|
+
*
|
|
4
|
+
* This module generates a component registry at build time.
|
|
5
|
+
* The registry imports all discovered components from the user's component library
|
|
6
|
+
* and makes them available for runtime JSX compilation in the production app.
|
|
7
|
+
*/
|
|
8
|
+
export interface ComponentRegistryEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
importPath: string;
|
|
11
|
+
namedExport: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ComponentRegistryConfig {
|
|
14
|
+
importPath: string;
|
|
15
|
+
components: ComponentRegistryEntry[];
|
|
16
|
+
additionalImports?: Array<{
|
|
17
|
+
path: string;
|
|
18
|
+
components: string[];
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generate the component registry configuration from discovered components
|
|
23
|
+
* Uses EnhancedComponentDiscovery for comprehensive component detection
|
|
24
|
+
* including external NPM packages like @mantine/core, @chakra-ui/react, etc.
|
|
25
|
+
*/
|
|
26
|
+
export declare function generateRegistryConfig(): Promise<ComponentRegistryConfig>;
|
|
27
|
+
/**
|
|
28
|
+
* Synchronous version for backward compatibility
|
|
29
|
+
* Falls back to basic discovery if enhanced discovery fails
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateRegistryConfigSync(): ComponentRegistryConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Generate the component registry TypeScript file content
|
|
34
|
+
*/
|
|
35
|
+
export declare function generateRegistryFileContent(registryConfig: ComponentRegistryConfig): string;
|
|
36
|
+
/**
|
|
37
|
+
* Generate the component registry file and write it to disk
|
|
38
|
+
* Uses async EnhancedComponentDiscovery for comprehensive component detection
|
|
39
|
+
*/
|
|
40
|
+
export declare function generateComponentRegistry(outputPath: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Synchronous version for backward compatibility
|
|
43
|
+
*/
|
|
44
|
+
export declare function generateComponentRegistrySync(outputPath: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Generate a minimal registry for development/testing
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateMinimalRegistry(importPath: string, componentNames: string[], outputPath: string): void;
|
|
49
|
+
//# sourceMappingURL=componentRegistryGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentRegistryGenerator.d.ts","sourceRoot":"","sources":["../../story-generator/componentRegistryGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,sBAAsB,EAAE,CAAC;IACrC,iBAAiB,CAAC,EAAE,KAAK,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;CACJ;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,uBAAuB,CAAC,CA6D/E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,uBAAuB,CA4BpE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,cAAc,EAAE,uBAAuB,GAAG,MAAM,CAyD3F;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAajF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAYtE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EAAE,EACxB,UAAU,EAAE,MAAM,GACjB,IAAI,CAkBN"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Registry Generator
|
|
3
|
+
*
|
|
4
|
+
* This module generates a component registry at build time.
|
|
5
|
+
* The registry imports all discovered components from the user's component library
|
|
6
|
+
* and makes them available for runtime JSX compilation in the production app.
|
|
7
|
+
*/
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { loadUserConfig } from './configLoader.js';
|
|
11
|
+
import { discoverComponents } from './componentDiscovery.js';
|
|
12
|
+
import { EnhancedComponentDiscovery } from './enhancedComponentDiscovery.js';
|
|
13
|
+
/**
|
|
14
|
+
* Generate the component registry configuration from discovered components
|
|
15
|
+
* Uses EnhancedComponentDiscovery for comprehensive component detection
|
|
16
|
+
* including external NPM packages like @mantine/core, @chakra-ui/react, etc.
|
|
17
|
+
*/
|
|
18
|
+
export async function generateRegistryConfig() {
|
|
19
|
+
const config = loadUserConfig();
|
|
20
|
+
// Use EnhancedComponentDiscovery for better external package support
|
|
21
|
+
const discovery = new EnhancedComponentDiscovery(config);
|
|
22
|
+
const enhancedComponents = await discovery.discoverAll();
|
|
23
|
+
// Group components by their source/import path
|
|
24
|
+
const componentsByPath = new Map();
|
|
25
|
+
for (const comp of enhancedComponents) {
|
|
26
|
+
// Determine the import path for this component
|
|
27
|
+
let importPath = config.importPath;
|
|
28
|
+
// If component has a specific source path (for NPM packages), use that
|
|
29
|
+
if (comp.source && comp.source.type === 'npm' && comp.source.path) {
|
|
30
|
+
importPath = comp.source.path;
|
|
31
|
+
}
|
|
32
|
+
const existing = componentsByPath.get(importPath) || [];
|
|
33
|
+
if (!existing.includes(comp.name)) {
|
|
34
|
+
existing.push(comp.name);
|
|
35
|
+
}
|
|
36
|
+
componentsByPath.set(importPath, existing);
|
|
37
|
+
}
|
|
38
|
+
// Convert to registry entries
|
|
39
|
+
const entries = [];
|
|
40
|
+
for (const [importPath, components] of componentsByPath) {
|
|
41
|
+
for (const compName of components) {
|
|
42
|
+
entries.push({
|
|
43
|
+
name: compName,
|
|
44
|
+
importPath,
|
|
45
|
+
namedExport: true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Add components from additionalImports (manual overrides)
|
|
50
|
+
if (config.additionalImports) {
|
|
51
|
+
for (const additionalImport of config.additionalImports) {
|
|
52
|
+
for (const compName of additionalImport.components) {
|
|
53
|
+
// Check if not already added
|
|
54
|
+
if (!entries.find(e => e.name === compName && e.importPath === additionalImport.path)) {
|
|
55
|
+
entries.push({
|
|
56
|
+
name: compName,
|
|
57
|
+
importPath: additionalImport.path,
|
|
58
|
+
namedExport: true,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
console.log(`📦 Registry config generated with ${entries.length} components from ${componentsByPath.size} source(s)`);
|
|
65
|
+
return {
|
|
66
|
+
importPath: config.importPath,
|
|
67
|
+
components: entries,
|
|
68
|
+
additionalImports: config.additionalImports,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Synchronous version for backward compatibility
|
|
73
|
+
* Falls back to basic discovery if enhanced discovery fails
|
|
74
|
+
*/
|
|
75
|
+
export function generateRegistryConfigSync() {
|
|
76
|
+
const config = loadUserConfig();
|
|
77
|
+
const discoveredComponents = discoverComponents(config);
|
|
78
|
+
const entries = discoveredComponents.map((comp) => ({
|
|
79
|
+
name: comp.name,
|
|
80
|
+
importPath: config.importPath,
|
|
81
|
+
namedExport: true,
|
|
82
|
+
}));
|
|
83
|
+
// Add components from additionalImports
|
|
84
|
+
if (config.additionalImports) {
|
|
85
|
+
for (const additionalImport of config.additionalImports) {
|
|
86
|
+
for (const compName of additionalImport.components) {
|
|
87
|
+
entries.push({
|
|
88
|
+
name: compName,
|
|
89
|
+
importPath: additionalImport.path,
|
|
90
|
+
namedExport: true,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
importPath: config.importPath,
|
|
97
|
+
components: entries,
|
|
98
|
+
additionalImports: config.additionalImports,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Generate the component registry TypeScript file content
|
|
103
|
+
*/
|
|
104
|
+
export function generateRegistryFileContent(registryConfig) {
|
|
105
|
+
// Group components by import path
|
|
106
|
+
const componentsByPath = new Map();
|
|
107
|
+
for (const comp of registryConfig.components) {
|
|
108
|
+
const existingComponents = componentsByPath.get(comp.importPath) || [];
|
|
109
|
+
existingComponents.push(comp.name);
|
|
110
|
+
componentsByPath.set(comp.importPath, existingComponents);
|
|
111
|
+
}
|
|
112
|
+
// Generate import statements
|
|
113
|
+
const imports = [];
|
|
114
|
+
const registryEntries = [];
|
|
115
|
+
for (const [importPath, components] of componentsByPath) {
|
|
116
|
+
const uniqueComponents = [...new Set(components)];
|
|
117
|
+
imports.push(`import { ${uniqueComponents.join(', ')} } from '${importPath}';`);
|
|
118
|
+
registryEntries.push(...uniqueComponents);
|
|
119
|
+
}
|
|
120
|
+
// Generate the registry file
|
|
121
|
+
const content = `/**
|
|
122
|
+
* Component Registry
|
|
123
|
+
*
|
|
124
|
+
* AUTO-GENERATED FILE - DO NOT EDIT
|
|
125
|
+
* This file is generated at build time by story-ui
|
|
126
|
+
*
|
|
127
|
+
* It exports all components from your component library
|
|
128
|
+
* for use in the live preview renderer.
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
import React from 'react';
|
|
132
|
+
${imports.join('\n')}
|
|
133
|
+
|
|
134
|
+
// Component registry - maps component names to their implementations
|
|
135
|
+
export const componentRegistry: Record<string, React.ComponentType<any>> = {
|
|
136
|
+
${registryEntries.map(name => `${name}`).join(',\n ')},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// List of available component names
|
|
140
|
+
export const availableComponents = ${JSON.stringify(registryEntries, null, 2)};
|
|
141
|
+
|
|
142
|
+
// Export React for use in compiled code
|
|
143
|
+
export { React };
|
|
144
|
+
|
|
145
|
+
// Helper to get a component by name
|
|
146
|
+
export function getComponent(name: string): React.ComponentType<any> | undefined {
|
|
147
|
+
return componentRegistry[name];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Check if a component exists
|
|
151
|
+
export function hasComponent(name: string): boolean {
|
|
152
|
+
return name in componentRegistry;
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
return content;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Generate the component registry file and write it to disk
|
|
159
|
+
* Uses async EnhancedComponentDiscovery for comprehensive component detection
|
|
160
|
+
*/
|
|
161
|
+
export async function generateComponentRegistry(outputPath) {
|
|
162
|
+
const registryConfig = await generateRegistryConfig();
|
|
163
|
+
const content = generateRegistryFileContent(registryConfig);
|
|
164
|
+
// Ensure directory exists
|
|
165
|
+
const dir = path.dirname(outputPath);
|
|
166
|
+
if (!fs.existsSync(dir)) {
|
|
167
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
168
|
+
}
|
|
169
|
+
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
170
|
+
console.log(`✅ Generated component registry with ${registryConfig.components.length} components`);
|
|
171
|
+
console.log(` Output: ${outputPath}`);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Synchronous version for backward compatibility
|
|
175
|
+
*/
|
|
176
|
+
export function generateComponentRegistrySync(outputPath) {
|
|
177
|
+
const registryConfig = generateRegistryConfigSync();
|
|
178
|
+
const content = generateRegistryFileContent(registryConfig);
|
|
179
|
+
const dir = path.dirname(outputPath);
|
|
180
|
+
if (!fs.existsSync(dir)) {
|
|
181
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
182
|
+
}
|
|
183
|
+
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
184
|
+
console.log(`✅ Generated component registry with ${registryConfig.components.length} components`);
|
|
185
|
+
console.log(` Output: ${outputPath}`);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Generate a minimal registry for development/testing
|
|
189
|
+
*/
|
|
190
|
+
export function generateMinimalRegistry(importPath, componentNames, outputPath) {
|
|
191
|
+
const registryConfig = {
|
|
192
|
+
importPath,
|
|
193
|
+
components: componentNames.map(name => ({
|
|
194
|
+
name,
|
|
195
|
+
importPath,
|
|
196
|
+
namedExport: true,
|
|
197
|
+
})),
|
|
198
|
+
};
|
|
199
|
+
const content = generateRegistryFileContent(registryConfig);
|
|
200
|
+
const dir = path.dirname(outputPath);
|
|
201
|
+
if (!fs.existsSync(dir)) {
|
|
202
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
203
|
+
}
|
|
204
|
+
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
205
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StoryUIConfig } from '../story-ui.config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Loads Story UI configuration from the user's project
|
|
4
|
+
* Looks for story-ui.config.js in the current working directory
|
|
5
|
+
* Uses caching to prevent excessive loading
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadUserConfig(): StoryUIConfig;
|
|
8
|
+
/**
|
|
9
|
+
* Validates that the configuration has the necessary paths and components
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateConfig(config: StoryUIConfig): {
|
|
12
|
+
isValid: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Analyzes existing Storybook files to detect design system patterns
|
|
17
|
+
*/
|
|
18
|
+
export declare function analyzeExistingStories(projectRoot?: string): {
|
|
19
|
+
storyFiles: string[];
|
|
20
|
+
componentDirs: string[];
|
|
21
|
+
importPaths: string[];
|
|
22
|
+
componentPrefixes: string[];
|
|
23
|
+
layoutPatterns: string[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Detects the Storybook framework being used
|
|
27
|
+
*/
|
|
28
|
+
export declare function detectStorybookFramework(dependencies: Record<string, string>): string;
|
|
29
|
+
/**
|
|
30
|
+
* Auto-detects design system configuration by analyzing the project structure
|
|
31
|
+
*/
|
|
32
|
+
export declare function autoDetectDesignSystem(): Partial<StoryUIConfig> | null;
|
|
33
|
+
//# sourceMappingURL=configLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configLoader.d.ts","sourceRoot":"","sources":["../../story-generator/configLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAuC,MAAM,uBAAuB,CAAC;AAO3F;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,aAAa,CAkG9C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAsD5F;AA0DD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,MAAsB,GAAG;IAC3E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAkGA;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWrF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAqEtE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface AIConsiderations {
|
|
2
|
+
libraryName?: string;
|
|
3
|
+
importPath?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
corePrinciples?: string[];
|
|
6
|
+
componentRules?: Record<string, any>;
|
|
7
|
+
imports?: Record<string, any>;
|
|
8
|
+
patterns?: Record<string, any>;
|
|
9
|
+
dos?: string[];
|
|
10
|
+
donts?: string[];
|
|
11
|
+
specialConsiderations?: string[];
|
|
12
|
+
commonMistakes?: Array<{
|
|
13
|
+
issue: string;
|
|
14
|
+
wrong: string;
|
|
15
|
+
correct: string;
|
|
16
|
+
explanation: string;
|
|
17
|
+
}>;
|
|
18
|
+
aiInstructions?: {
|
|
19
|
+
general?: string[];
|
|
20
|
+
codeGeneration?: string[];
|
|
21
|
+
testing?: string[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Loads AI considerations from a markdown or JSON file
|
|
26
|
+
*/
|
|
27
|
+
export declare function loadConsiderations(considerationsPath?: string): AIConsiderations | null;
|
|
28
|
+
/**
|
|
29
|
+
* Converts considerations to prompt additions
|
|
30
|
+
*/
|
|
31
|
+
export declare function considerationsToPrompt(considerations: AIConsiderations): string;
|
|
32
|
+
//# sourceMappingURL=considerationsLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"considerationsLoader.d.ts","sourceRoot":"","sources":["../../story-generator/considerationsLoader.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAqCvF;AA+HD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,gBAAgB,GAAG,MAAM,CA6D/E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Documentation sources for design systems
|
|
3
|
+
* Provides fallback documentation when custom docs aren't available
|
|
4
|
+
*/
|
|
5
|
+
export interface DocumentationSource {
|
|
6
|
+
version?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
lastUpdated?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Pre-bundled documentation for popular design systems
|
|
12
|
+
* Users should provide their own documentation in story-ui-docs/ directory for best results
|
|
13
|
+
*/
|
|
14
|
+
export declare const BUNDLED_DOCUMENTATION: Record<string, any>;
|
|
15
|
+
/**
|
|
16
|
+
* Get documentation for a design system
|
|
17
|
+
* Falls back to bundled docs if no scraped docs exist
|
|
18
|
+
*/
|
|
19
|
+
export declare function getDocumentation(importPath: string): any;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a component is deprecated for a given design system
|
|
22
|
+
*/
|
|
23
|
+
export declare function isDeprecatedComponent(importPath: string, componentName: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get replacement suggestion for a deprecated component
|
|
26
|
+
*/
|
|
27
|
+
export declare function getComponentReplacement(importPath: string, componentName: string): string | null;
|
|
28
|
+
//# sourceMappingURL=documentation-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentation-sources.d.ts","sourceRoot":"","sources":["../../story-generator/documentation-sources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAGrD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAMxD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAGxF;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhG"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface DocumentationSource {
|
|
2
|
+
type: 'markdown' | 'json' | 'html' | 'txt';
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
category?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface LoadedDocumentation {
|
|
8
|
+
sources: DocumentationSource[];
|
|
9
|
+
guidelines: string[];
|
|
10
|
+
tokens: Record<string, any>;
|
|
11
|
+
patterns: Record<string, string>;
|
|
12
|
+
components: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
export declare class DocumentationLoader {
|
|
15
|
+
private docsDir;
|
|
16
|
+
private cache;
|
|
17
|
+
private lastModified;
|
|
18
|
+
constructor(projectRoot: string);
|
|
19
|
+
/**
|
|
20
|
+
* Check if documentation directory exists
|
|
21
|
+
*/
|
|
22
|
+
hasDocumentation(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Load all documentation from the directory
|
|
25
|
+
*/
|
|
26
|
+
loadDocumentation(): Promise<LoadedDocumentation>;
|
|
27
|
+
/**
|
|
28
|
+
* Categorize file based on path and name
|
|
29
|
+
*/
|
|
30
|
+
private categorizeFile;
|
|
31
|
+
/**
|
|
32
|
+
* Process a documentation source based on its type and category
|
|
33
|
+
*/
|
|
34
|
+
private processSource;
|
|
35
|
+
/**
|
|
36
|
+
* Format documentation for AI prompt
|
|
37
|
+
*/
|
|
38
|
+
formatForPrompt(docs: LoadedDocumentation): string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Example directory structure:
|
|
42
|
+
*
|
|
43
|
+
* story-ui-docs/
|
|
44
|
+
* ├── README.md # Overview and getting started
|
|
45
|
+
* ├── guidelines/
|
|
46
|
+
* │ ├── accessibility.md # Accessibility guidelines
|
|
47
|
+
* │ ├── responsive-design.md # Responsive design rules
|
|
48
|
+
* │ └── brand-guidelines.md # Brand usage
|
|
49
|
+
* ├── tokens/
|
|
50
|
+
* │ ├── colors.json # Color tokens
|
|
51
|
+
* │ ├── spacing.md # Spacing system
|
|
52
|
+
* │ ├── typography.json # Typography tokens
|
|
53
|
+
* │ └── shadows.json # Shadow tokens
|
|
54
|
+
* ├── components/
|
|
55
|
+
* │ ├── button.md # Button documentation
|
|
56
|
+
* │ ├── form-fields.md # Form component docs
|
|
57
|
+
* │ └── navigation.md # Navigation patterns
|
|
58
|
+
* └── patterns/
|
|
59
|
+
* ├── forms.md # Form patterns
|
|
60
|
+
* ├── cards.md # Card layouts
|
|
61
|
+
* ├── data-tables.md # Table patterns
|
|
62
|
+
* └── authentication.md # Auth flow patterns
|
|
63
|
+
*/
|
|
64
|
+
//# sourceMappingURL=documentationLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentationLoader.d.ts","sourceRoot":"","sources":["../../story-generator/documentationLoader.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,YAAY,CAAa;gBAErB,WAAW,EAAE,MAAM;IAK/B;;OAEG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;OAEG;IACG,iBAAiB,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAmFvD;;OAEG;IACH,OAAO,CAAC,cAAc;IAqBtB;;OAEG;IACH,OAAO,CAAC,aAAa;IA2CrB;;OAEG;IACH,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM;CA0BnD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export interface RealPackageComponent {
|
|
2
|
+
name: string;
|
|
3
|
+
isComponent: boolean;
|
|
4
|
+
type: 'function' | 'class' | 'object' | 'unknown';
|
|
5
|
+
__componentPath?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface PackageExports {
|
|
8
|
+
components: RealPackageComponent[];
|
|
9
|
+
allExports: string[];
|
|
10
|
+
packageVersion: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Dynamically discovers what components are actually available in an installed package
|
|
14
|
+
*/
|
|
15
|
+
export declare class DynamicPackageDiscovery {
|
|
16
|
+
private packageName;
|
|
17
|
+
private projectRoot;
|
|
18
|
+
constructor(packageName: string, projectRoot?: string);
|
|
19
|
+
/**
|
|
20
|
+
* Get the real exports from the installed package
|
|
21
|
+
*/
|
|
22
|
+
getRealPackageExports(): Promise<PackageExports | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Require the package safely
|
|
25
|
+
*/
|
|
26
|
+
private requirePackage;
|
|
27
|
+
/**
|
|
28
|
+
* Determine if an export is likely a React component
|
|
29
|
+
*/
|
|
30
|
+
private isLikelyComponent;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a name indicates a utility export (not a component)
|
|
33
|
+
*/
|
|
34
|
+
private isUtilityExport;
|
|
35
|
+
/**
|
|
36
|
+
* Check if a function looks like a React component
|
|
37
|
+
*/
|
|
38
|
+
private looksLikeReactComponent;
|
|
39
|
+
/**
|
|
40
|
+
* Check if an object has component-like properties
|
|
41
|
+
*/
|
|
42
|
+
private hasComponentLikeProperties;
|
|
43
|
+
/**
|
|
44
|
+
* Get the type of an export
|
|
45
|
+
*/
|
|
46
|
+
private getExportType;
|
|
47
|
+
/**
|
|
48
|
+
* Get only the component names that should be used for story generation
|
|
49
|
+
*/
|
|
50
|
+
getAvailableComponentNames(): Promise<string[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Validate that a list of component names are actually available
|
|
53
|
+
*/
|
|
54
|
+
validateComponentNames(componentNames: string[]): Promise<{
|
|
55
|
+
valid: string[];
|
|
56
|
+
invalid: string[];
|
|
57
|
+
suggestions: Map<string, string>;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Find a similar component name
|
|
61
|
+
*/
|
|
62
|
+
private findSimilarComponent;
|
|
63
|
+
/**
|
|
64
|
+
* Alternative discovery method when package imports fail due to CSS
|
|
65
|
+
* Analyzes package.json exports and TypeScript definitions
|
|
66
|
+
*/
|
|
67
|
+
private discoverFromPackageStructure;
|
|
68
|
+
/**
|
|
69
|
+
* Scan package subdirectories for components (e.g., antd/button, chakra-ui/input)
|
|
70
|
+
*/
|
|
71
|
+
private scanComponentSubdirectories;
|
|
72
|
+
/**
|
|
73
|
+
* Extract component names from TypeScript declaration content
|
|
74
|
+
*/
|
|
75
|
+
private extractComponentsFromTypings;
|
|
76
|
+
/**
|
|
77
|
+
* Check if a name looks like a React component
|
|
78
|
+
*/
|
|
79
|
+
private isComponentName;
|
|
80
|
+
/**
|
|
81
|
+
* Extract component exports from package.json exports field
|
|
82
|
+
*/
|
|
83
|
+
private extractExportsFromPackageJson;
|
|
84
|
+
/**
|
|
85
|
+
* Extract component declarations from TypeScript definition files
|
|
86
|
+
*/
|
|
87
|
+
private extractExportsFromTypeDefinitions;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a dynamic discovery instance for a package
|
|
91
|
+
*/
|
|
92
|
+
export declare function createDynamicDiscovery(packageName: string, projectRoot?: string): DynamicPackageDiscovery;
|
|
93
|
+
/**
|
|
94
|
+
* Quick function to get available components for a package
|
|
95
|
+
*/
|
|
96
|
+
export declare function getPackageComponents(packageName: string, projectRoot?: string): Promise<string[]>;
|
|
97
|
+
//# sourceMappingURL=dynamicPackageDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamicPackageDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/dynamicPackageDiscovery.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAClD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,uBAAuB;IAClC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,EAAE,MAAM,EAAE,WAAW,GAAE,MAAsB;IAKpE;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IA0G7D;;OAEG;YACW,cAAc;IAiD5B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyB/B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IASlC;;OAEG;IACH,OAAO,CAAC,aAAa;IA6BrB;;OAEG;IACG,0BAA0B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAYrD;;OAEG;IACG,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC9D,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;IAyBF;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkC5B;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IA2CpC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAiDnC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAoCpC;;OAEG;IACH,OAAO,CAAC,eAAe;IAcvB;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAyBrC;;OAEG;IACH,OAAO,CAAC,iCAAiC;CA+B1C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAEzG;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAGvG"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { DiscoveredComponent } from './componentDiscovery.js';
|
|
2
|
+
import { StoryUIConfig } from '../story-ui.config.js';
|
|
3
|
+
export interface ComponentSource {
|
|
4
|
+
type: 'npm' | 'local' | 'custom-elements' | 'typescript';
|
|
5
|
+
path: string;
|
|
6
|
+
patterns?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface EnhancedComponent extends DiscoveredComponent {
|
|
9
|
+
source: ComponentSource;
|
|
10
|
+
docUrl?: string;
|
|
11
|
+
examples?: string[];
|
|
12
|
+
dependencies?: string[];
|
|
13
|
+
isComposite?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class EnhancedComponentDiscovery {
|
|
16
|
+
private config;
|
|
17
|
+
private discoveredComponents;
|
|
18
|
+
private validateAvailableComponents;
|
|
19
|
+
constructor(config: StoryUIConfig);
|
|
20
|
+
/**
|
|
21
|
+
* Discover components from all available sources
|
|
22
|
+
* Priority: 1. Dynamic Discovery 2. Static Lists 3. Manual Config
|
|
23
|
+
*/
|
|
24
|
+
discoverAll(): Promise<EnhancedComponent[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Resolve naming conflicts between different sources
|
|
27
|
+
* Priority: Local > Manual Config > npm packages
|
|
28
|
+
*/
|
|
29
|
+
private resolveComponentConflicts;
|
|
30
|
+
/**
|
|
31
|
+
* Log discovery summary for debugging
|
|
32
|
+
*/
|
|
33
|
+
private logDiscoverySummary;
|
|
34
|
+
/**
|
|
35
|
+
* Get the project root directory from the config
|
|
36
|
+
*/
|
|
37
|
+
private getProjectRoot;
|
|
38
|
+
/**
|
|
39
|
+
* Identify all potential component sources
|
|
40
|
+
*/
|
|
41
|
+
private identifySources;
|
|
42
|
+
/**
|
|
43
|
+
* Auto-discovery removed - now handled by guided installation during init
|
|
44
|
+
* This function is kept for backward compatibility but does nothing
|
|
45
|
+
*/
|
|
46
|
+
private addDesignSystemPackages;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a package is likely to contain React components (not utilities, types, etc.)
|
|
49
|
+
*/
|
|
50
|
+
private isLikelyComponentPackage;
|
|
51
|
+
/**
|
|
52
|
+
* Discover components from npm packages using dynamic runtime discovery
|
|
53
|
+
*/
|
|
54
|
+
private discoverFromNpmPackage;
|
|
55
|
+
/**
|
|
56
|
+
* Get known components for popular design systems
|
|
57
|
+
* Returns a fallback list when dynamic discovery fails
|
|
58
|
+
*/
|
|
59
|
+
private getKnownDesignSystemComponents;
|
|
60
|
+
/**
|
|
61
|
+
* Discover components from local files
|
|
62
|
+
*/
|
|
63
|
+
private discoverFromLocalFiles;
|
|
64
|
+
/**
|
|
65
|
+
* Check if a file should be skipped (stories, tests, etc.)
|
|
66
|
+
*/
|
|
67
|
+
private isNonComponentFile;
|
|
68
|
+
/**
|
|
69
|
+
* Check if a component should be skipped based on name or content
|
|
70
|
+
*/
|
|
71
|
+
private shouldSkipComponent;
|
|
72
|
+
/**
|
|
73
|
+
* Find component files recursively
|
|
74
|
+
*/
|
|
75
|
+
private findComponentFiles;
|
|
76
|
+
/**
|
|
77
|
+
* Extract component name from file
|
|
78
|
+
*/
|
|
79
|
+
private extractComponentName;
|
|
80
|
+
/**
|
|
81
|
+
* Extract props from file content
|
|
82
|
+
*/
|
|
83
|
+
private extractPropsFromFile;
|
|
84
|
+
/**
|
|
85
|
+
* Extract slots from content
|
|
86
|
+
*/
|
|
87
|
+
private extractSlots;
|
|
88
|
+
/**
|
|
89
|
+
* Categorize component based on name and content
|
|
90
|
+
*/
|
|
91
|
+
private categorizeComponent;
|
|
92
|
+
/**
|
|
93
|
+
* Discover from custom elements JSON
|
|
94
|
+
*/
|
|
95
|
+
private discoverFromCustomElements;
|
|
96
|
+
/**
|
|
97
|
+
* Extract props from custom element declaration
|
|
98
|
+
*/
|
|
99
|
+
private extractPropsFromDeclaration;
|
|
100
|
+
/**
|
|
101
|
+
* Discover from TypeScript definitions
|
|
102
|
+
*/
|
|
103
|
+
private discoverFromTypeScript;
|
|
104
|
+
/**
|
|
105
|
+
* Apply manual component configurations
|
|
106
|
+
*/
|
|
107
|
+
private applyManualConfigurations;
|
|
108
|
+
/**
|
|
109
|
+
* Validate that component names actually exist in the discovered package
|
|
110
|
+
*/
|
|
111
|
+
validateComponentNames(componentNames: string[]): Promise<{
|
|
112
|
+
valid: string[];
|
|
113
|
+
invalid: string[];
|
|
114
|
+
suggestions: Map<string, string>;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Find a similar component name
|
|
118
|
+
*/
|
|
119
|
+
private findSimilarComponent;
|
|
120
|
+
/**
|
|
121
|
+
* Get the available component names for validation
|
|
122
|
+
*/
|
|
123
|
+
getAvailableComponentNames(): string[];
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=enhancedComponentDiscovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enhancedComponentDiscovery.d.ts","sourceRoot":"","sources":["../../story-generator/enhancedComponentDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,iBAAiB,GAAG,YAAY,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qBAAa,0BAA0B;IACrC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,oBAAoB,CAA6C;IACzE,OAAO,CAAC,2BAA2B,CAA0B;gBAEjD,MAAM,EAAE,aAAa;IAIjC;;;OAGG;IACG,WAAW,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA2CjD;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAyCjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAWvB;;GAED;IACH,OAAO,CAAC,cAAc;IAmBtB;;OAEG;IACH,OAAO,CAAC,eAAe;IA6GvB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAI/B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IA6B9B;;KAEC;YACW,sBAAsB;IAsEpC;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IAmJtC;;OAEG;YACW,sBAAsB;IAsCpC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAmB3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAgB5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IA0B5B;;OAEG;IACH,OAAO,CAAC,YAAY;IAiBpB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAkC3B;;OAEG;YACW,0BAA0B;IAmCxC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAcnC;;OAEG;YACW,sBAAsB;IAMpC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA4CjC;;OAEG;IACG,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC9D,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,CAAC;IAwCF;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwC5B;;OAEG;IACH,0BAA0B,IAAI,MAAM,EAAE;CAMvC"}
|