@tpitre/story-ui 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/dist/cli/index.js +0 -0
  2. package/dist/cli/index.js.map +1 -0
  3. package/dist/cli/setup.js.map +1 -0
  4. package/dist/cloudflare-edge/src/mcp-session.js +462 -0
  5. package/dist/cloudflare-edge/src/types.js +4 -0
  6. package/dist/cloudflare-edge/src/worker.js +106 -0
  7. package/dist/cloudflare-pages/vite.config.js +14 -0
  8. package/dist/index.d.ts +13 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +12 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/mcp-server/index.js.map +1 -0
  13. package/dist/mcp-server/mcp-stdio-server.js.map +1 -0
  14. package/dist/mcp-server/routes/claude.js.map +1 -0
  15. package/dist/mcp-server/routes/components.js.map +1 -0
  16. package/dist/mcp-server/routes/generateStory.js.map +1 -0
  17. package/dist/mcp-server/routes/hybridStories.d.ts +18 -0
  18. package/dist/mcp-server/routes/hybridStories.d.ts.map +1 -0
  19. package/dist/mcp-server/routes/hybridStories.js +216 -0
  20. package/dist/mcp-server/routes/hybridStories.js.map +1 -0
  21. package/dist/mcp-server/routes/memoryStories.d.ts +26 -0
  22. package/dist/mcp-server/routes/memoryStories.d.ts.map +1 -0
  23. package/dist/mcp-server/routes/memoryStories.js +158 -0
  24. package/dist/mcp-server/routes/memoryStories.js.map +1 -0
  25. package/dist/mcp-server/routes/storySync.d.ts +26 -0
  26. package/dist/mcp-server/routes/storySync.d.ts.map +1 -0
  27. package/dist/mcp-server/routes/storySync.js +147 -0
  28. package/dist/mcp-server/routes/storySync.js.map +1 -0
  29. package/dist/mcp-server/routes/updateStory.js +246 -0
  30. package/dist/mcp-server/sessionManager.d.ts +50 -0
  31. package/dist/mcp-server/sessionManager.d.ts.map +1 -0
  32. package/dist/mcp-server/sessionManager.js +125 -0
  33. package/dist/mcp-server/sessionManager.js.map +1 -0
  34. package/dist/playground/components/AIAssistant/AIAssistant.d.ts +6 -0
  35. package/dist/playground/components/AIAssistant/AIAssistant.d.ts.map +1 -0
  36. package/dist/playground/components/AIAssistant/AIAssistant.js +109 -0
  37. package/dist/playground/components/AIAssistant/AIAssistant.js.map +1 -0
  38. package/dist/playground/components/AIAssistant/AIAssistant.module.css +166 -0
  39. package/dist/playground/components/Canvas/Canvas.d.ts +9 -0
  40. package/dist/playground/components/Canvas/Canvas.d.ts.map +1 -0
  41. package/dist/playground/components/Canvas/Canvas.js +58 -0
  42. package/dist/playground/components/Canvas/Canvas.js.map +1 -0
  43. package/dist/playground/components/Canvas/Canvas.module.css +189 -0
  44. package/dist/playground/components/Canvas/CanvasWithDnd.d.ts +9 -0
  45. package/dist/playground/components/Canvas/CanvasWithDnd.d.ts.map +1 -0
  46. package/dist/playground/components/Canvas/CanvasWithDnd.js +158 -0
  47. package/dist/playground/components/Canvas/CanvasWithDnd.js.map +1 -0
  48. package/dist/playground/components/Canvas/ComponentRenderer.d.ts +15 -0
  49. package/dist/playground/components/Canvas/ComponentRenderer.d.ts.map +1 -0
  50. package/dist/playground/components/Canvas/ComponentRenderer.js +177 -0
  51. package/dist/playground/components/Canvas/ComponentRenderer.js.map +1 -0
  52. package/dist/playground/components/Canvas/DraggableComponent.d.ts +15 -0
  53. package/dist/playground/components/Canvas/DraggableComponent.d.ts.map +1 -0
  54. package/dist/playground/components/Canvas/DraggableComponent.js +49 -0
  55. package/dist/playground/components/Canvas/DraggableComponent.js.map +1 -0
  56. package/dist/playground/components/Canvas/index.d.ts +9 -0
  57. package/dist/playground/components/Canvas/index.d.ts.map +1 -0
  58. package/dist/playground/components/Canvas/index.js +5 -0
  59. package/dist/playground/components/Canvas/index.js.map +1 -0
  60. package/dist/playground/components/CodeView/CodeView.d.ts +12 -0
  61. package/dist/playground/components/CodeView/CodeView.d.ts.map +1 -0
  62. package/dist/playground/components/CodeView/CodeView.js +77 -0
  63. package/dist/playground/components/CodeView/CodeView.js.map +1 -0
  64. package/dist/playground/components/CodeView/CodeView.module.css +178 -0
  65. package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts +17 -0
  66. package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts.map +1 -0
  67. package/dist/playground/components/ComponentPalette/ComponentPalette.js +138 -0
  68. package/dist/playground/components/ComponentPalette/ComponentPalette.js.map +1 -0
  69. package/dist/playground/components/ComponentPalette/ComponentPalette.module.css +217 -0
  70. package/dist/playground/components/ComponentPalette/index.d.ts +3 -0
  71. package/dist/playground/components/ComponentPalette/index.d.ts.map +1 -0
  72. package/dist/playground/components/ComponentPalette/index.js +2 -0
  73. package/dist/playground/components/ComponentPalette/index.js.map +1 -0
  74. package/dist/playground/components/DropZone/DropZone.d.ts +17 -0
  75. package/dist/playground/components/DropZone/DropZone.d.ts.map +1 -0
  76. package/dist/playground/components/DropZone/DropZone.js +73 -0
  77. package/dist/playground/components/DropZone/DropZone.js.map +1 -0
  78. package/dist/playground/components/DropZone/DropZone.module.css +86 -0
  79. package/dist/playground/components/ExportDialog/ExportDialog.d.ts +10 -0
  80. package/dist/playground/components/ExportDialog/ExportDialog.d.ts.map +1 -0
  81. package/dist/playground/components/ExportDialog/ExportDialog.js +57 -0
  82. package/dist/playground/components/ExportDialog/ExportDialog.js.map +1 -0
  83. package/dist/playground/components/ExportDialog/ExportDialog.module.css +328 -0
  84. package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts +134 -0
  85. package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts.map +1 -0
  86. package/dist/playground/components/LayoutHelpers/LayoutHelpers.js +254 -0
  87. package/dist/playground/components/LayoutHelpers/LayoutHelpers.js.map +1 -0
  88. package/dist/playground/components/LayoutHelpers/index.d.ts +3 -0
  89. package/dist/playground/components/LayoutHelpers/index.d.ts.map +1 -0
  90. package/dist/playground/components/LayoutHelpers/index.js +2 -0
  91. package/dist/playground/components/LayoutHelpers/index.js.map +1 -0
  92. package/dist/playground/components/Playground/Playground.d.ts +10 -0
  93. package/dist/playground/components/Playground/Playground.d.ts.map +1 -0
  94. package/dist/playground/components/Playground/Playground.js +128 -0
  95. package/dist/playground/components/Playground/Playground.js.map +1 -0
  96. package/dist/playground/components/Playground/Playground.module.css +308 -0
  97. package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts +10 -0
  98. package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts.map +1 -0
  99. package/dist/playground/components/PropertiesPanel/PropertiesPanel.js +150 -0
  100. package/dist/playground/components/PropertiesPanel/PropertiesPanel.js.map +1 -0
  101. package/dist/playground/components/PropertiesPanel/PropertiesPanel.module.css +155 -0
  102. package/dist/playground/components/PropertiesPanel/index.d.ts +3 -0
  103. package/dist/playground/components/PropertiesPanel/index.d.ts.map +1 -0
  104. package/dist/playground/components/PropertiesPanel/index.js +2 -0
  105. package/dist/playground/components/PropertiesPanel/index.js.map +1 -0
  106. package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts +12 -0
  107. package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts.map +1 -0
  108. package/dist/playground/components/PropertyEditors/BooleanEditor.js +14 -0
  109. package/dist/playground/components/PropertyEditors/BooleanEditor.js.map +1 -0
  110. package/dist/playground/components/PropertyEditors/ColorEditor.d.ts +12 -0
  111. package/dist/playground/components/PropertyEditors/ColorEditor.d.ts.map +1 -0
  112. package/dist/playground/components/PropertyEditors/ColorEditor.js +62 -0
  113. package/dist/playground/components/PropertyEditors/ColorEditor.js.map +1 -0
  114. package/dist/playground/components/PropertyEditors/IconEditor.d.ts +12 -0
  115. package/dist/playground/components/PropertyEditors/IconEditor.d.ts.map +1 -0
  116. package/dist/playground/components/PropertyEditors/IconEditor.js +123 -0
  117. package/dist/playground/components/PropertyEditors/IconEditor.js.map +1 -0
  118. package/dist/playground/components/PropertyEditors/NumberEditor.d.ts +15 -0
  119. package/dist/playground/components/PropertyEditors/NumberEditor.d.ts.map +1 -0
  120. package/dist/playground/components/PropertyEditors/NumberEditor.js +46 -0
  121. package/dist/playground/components/PropertyEditors/NumberEditor.js.map +1 -0
  122. package/dist/playground/components/PropertyEditors/PropertyEditors.module.css +432 -0
  123. package/dist/playground/components/PropertyEditors/SelectEditor.d.ts +19 -0
  124. package/dist/playground/components/PropertyEditors/SelectEditor.d.ts.map +1 -0
  125. package/dist/playground/components/PropertyEditors/SelectEditor.js +17 -0
  126. package/dist/playground/components/PropertyEditors/SelectEditor.js.map +1 -0
  127. package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts +19 -0
  128. package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts.map +1 -0
  129. package/dist/playground/components/PropertyEditors/SpacingEditor.js +162 -0
  130. package/dist/playground/components/PropertyEditors/SpacingEditor.js.map +1 -0
  131. package/dist/playground/components/PropertyEditors/SpacingEditor.module.css +214 -0
  132. package/dist/playground/components/PropertyEditors/TextEditor.d.ts +14 -0
  133. package/dist/playground/components/PropertyEditors/TextEditor.d.ts.map +1 -0
  134. package/dist/playground/components/PropertyEditors/TextEditor.js +38 -0
  135. package/dist/playground/components/PropertyEditors/TextEditor.js.map +1 -0
  136. package/dist/playground/components/PropertyEditors/TokenEditor.d.ts +23 -0
  137. package/dist/playground/components/PropertyEditors/TokenEditor.d.ts.map +1 -0
  138. package/dist/playground/components/PropertyEditors/TokenEditor.js +50 -0
  139. package/dist/playground/components/PropertyEditors/TokenEditor.js.map +1 -0
  140. package/dist/playground/components/PropertyEditors/index.d.ts +20 -0
  141. package/dist/playground/components/PropertyEditors/index.d.ts.map +1 -0
  142. package/dist/playground/components/PropertyEditors/index.js +12 -0
  143. package/dist/playground/components/PropertyEditors/index.js.map +1 -0
  144. package/dist/playground/components/TreeView/TreeView.d.ts +10 -0
  145. package/dist/playground/components/TreeView/TreeView.d.ts.map +1 -0
  146. package/dist/playground/components/TreeView/TreeView.js +146 -0
  147. package/dist/playground/components/TreeView/TreeView.js.map +1 -0
  148. package/dist/playground/components/TreeView/TreeView.module.css +214 -0
  149. package/dist/playground/components/TreeView/index.d.ts +3 -0
  150. package/dist/playground/components/TreeView/index.d.ts.map +1 -0
  151. package/dist/playground/components/TreeView/index.js +2 -0
  152. package/dist/playground/components/TreeView/index.js.map +1 -0
  153. package/dist/playground/config/propertyDefinitions.d.ts +73 -0
  154. package/dist/playground/config/propertyDefinitions.d.ts.map +1 -0
  155. package/dist/playground/config/propertyDefinitions.js +809 -0
  156. package/dist/playground/config/propertyDefinitions.js.map +1 -0
  157. package/dist/playground/hooks/useKeyboardShortcuts.d.ts +38 -0
  158. package/dist/playground/hooks/useKeyboardShortcuts.d.ts.map +1 -0
  159. package/dist/playground/hooks/useKeyboardShortcuts.js +191 -0
  160. package/dist/playground/hooks/useKeyboardShortcuts.js.map +1 -0
  161. package/dist/playground/index.d.ts +21 -0
  162. package/dist/playground/index.d.ts.map +1 -0
  163. package/dist/playground/index.js +23 -0
  164. package/dist/playground/index.js.map +1 -0
  165. package/dist/playground/services/CodeGenerator.d.ts +73 -0
  166. package/dist/playground/services/CodeGenerator.d.ts.map +1 -0
  167. package/dist/playground/services/CodeGenerator.js +359 -0
  168. package/dist/playground/services/CodeGenerator.js.map +1 -0
  169. package/dist/playground/services/DragDropManager.d.ts +95 -0
  170. package/dist/playground/services/DragDropManager.d.ts.map +1 -0
  171. package/dist/playground/services/DragDropManager.js +408 -0
  172. package/dist/playground/services/DragDropManager.js.map +1 -0
  173. package/dist/playground/services/StoryParser.d.ts +73 -0
  174. package/dist/playground/services/StoryParser.d.ts.map +1 -0
  175. package/dist/playground/services/StoryParser.js +419 -0
  176. package/dist/playground/services/StoryParser.js.map +1 -0
  177. package/dist/playground/store/playgroundStore.d.ts +86 -0
  178. package/dist/playground/store/playgroundStore.d.ts.map +1 -0
  179. package/dist/playground/store/playgroundStore.js +337 -0
  180. package/dist/playground/store/playgroundStore.js.map +1 -0
  181. package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts +13 -0
  182. package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts.map +1 -0
  183. package/dist/playground/stories/PlaygroundDragDrop.stories.js +227 -0
  184. package/dist/playground/stories/PlaygroundDragDrop.stories.js.map +1 -0
  185. package/dist/playground/stories/PlaygroundPhase4.stories.d.ts +13 -0
  186. package/dist/playground/stories/PlaygroundPhase4.stories.d.ts.map +1 -0
  187. package/dist/playground/stories/PlaygroundPhase4.stories.js +334 -0
  188. package/dist/playground/stories/PlaygroundPhase4.stories.js.map +1 -0
  189. package/dist/playground/stories/PlaygroundPhase5.stories.d.ts +14 -0
  190. package/dist/playground/stories/PlaygroundPhase5.stories.d.ts.map +1 -0
  191. package/dist/playground/stories/PlaygroundPhase5.stories.js +512 -0
  192. package/dist/playground/stories/PlaygroundPhase5.stories.js.map +1 -0
  193. package/dist/playground/stories/PlaygroundProperties.stories.d.ts +13 -0
  194. package/dist/playground/stories/PlaygroundProperties.stories.d.ts.map +1 -0
  195. package/dist/playground/stories/PlaygroundProperties.stories.js +342 -0
  196. package/dist/playground/stories/PlaygroundProperties.stories.js.map +1 -0
  197. package/dist/playground/types/index.d.ts +251 -0
  198. package/dist/playground/types/index.d.ts.map +1 -0
  199. package/dist/playground/types/index.js +5 -0
  200. package/dist/playground/types/index.js.map +1 -0
  201. package/dist/scripts/verify-framework-adapters.js +105 -0
  202. package/dist/story-generator/componentBlacklist.js.map +1 -0
  203. package/dist/story-generator/componentDiscovery.js.map +1 -0
  204. package/dist/story-generator/configLoader.js.map +1 -0
  205. package/dist/story-generator/considerationsLoader.js.map +1 -0
  206. package/dist/story-generator/documentation-sources.js.map +1 -0
  207. package/dist/story-generator/documentationLoader.js.map +1 -0
  208. package/dist/story-generator/dynamicPackageDiscovery.js.map +1 -0
  209. package/dist/story-generator/enhancedComponentDiscovery.js.map +1 -0
  210. package/dist/story-generator/generateStory.js.map +1 -0
  211. package/dist/story-generator/gitignoreManager.js.map +1 -0
  212. package/dist/story-generator/inMemoryStoryService.d.ts +89 -0
  213. package/dist/story-generator/inMemoryStoryService.d.ts.map +1 -0
  214. package/dist/story-generator/inMemoryStoryService.js +128 -0
  215. package/dist/story-generator/inMemoryStoryService.js.map +1 -0
  216. package/dist/story-generator/logger.js.map +1 -0
  217. package/dist/story-generator/postProcessStory.js.map +1 -0
  218. package/dist/story-generator/postgresStoryService.d.ts +56 -0
  219. package/dist/story-generator/postgresStoryService.d.ts.map +1 -0
  220. package/dist/story-generator/postgresStoryService.js +240 -0
  221. package/dist/story-generator/productionGitignoreManager.d.ts +91 -0
  222. package/dist/story-generator/productionGitignoreManager.d.ts.map +1 -0
  223. package/dist/story-generator/productionGitignoreManager.js +340 -0
  224. package/dist/story-generator/productionGitignoreManager.js.map +1 -0
  225. package/dist/story-generator/promptGenerator.js.map +1 -0
  226. package/dist/story-generator/providerPresets.d.ts +54 -0
  227. package/dist/story-generator/providerPresets.d.ts.map +1 -0
  228. package/dist/story-generator/providerPresets.js +214 -0
  229. package/dist/story-generator/storyHistory.js.map +1 -0
  230. package/dist/story-generator/storyServiceFactory.d.ts +22 -0
  231. package/dist/story-generator/storyServiceFactory.d.ts.map +1 -0
  232. package/dist/story-generator/storyServiceFactory.js +97 -0
  233. package/dist/story-generator/storyServiceInterface.d.ts +85 -0
  234. package/dist/story-generator/storyServiceInterface.d.ts.map +1 -0
  235. package/dist/story-generator/storyServiceInterface.js +5 -0
  236. package/dist/story-generator/storySync.d.ts +68 -0
  237. package/dist/story-generator/storySync.d.ts.map +1 -0
  238. package/dist/story-generator/storySync.js +201 -0
  239. package/dist/story-generator/storySync.js.map +1 -0
  240. package/dist/story-generator/storyTracker.js.map +1 -0
  241. package/dist/story-generator/storyValidator.js.map +1 -0
  242. package/dist/story-generator/test_validation.d.ts +2 -0
  243. package/dist/story-generator/test_validation.d.ts.map +1 -0
  244. package/dist/story-generator/test_validation.js +51 -0
  245. package/dist/story-generator/universalDesignSystemAdapter.js.map +1 -0
  246. package/dist/story-generator/urlRedirectService.js.map +1 -0
  247. package/dist/story-generator/validateStory.js.map +1 -0
  248. package/dist/story-ui.config.js.map +1 -0
  249. package/dist/story-ui.config.loader.d.ts +36 -0
  250. package/dist/story-ui.config.loader.d.ts.map +1 -0
  251. package/dist/story-ui.config.loader.js +205 -0
  252. package/dist/story-ui.config.loader.js.map +1 -0
  253. package/dist/temp/package/templates/StoryUI/StoryUIPanel.js +807 -0
  254. package/dist/temp/package/templates/StoryUI/StoryUIPanel.stories.js +37 -0
  255. package/dist/temp/package/templates/StoryUI/index.js +2 -0
  256. package/dist/templates/StoryUI/StoryUIPanel.js.map +1 -0
  257. package/dist/templates/StoryUI/StoryUIPanel.stories.js.map +1 -0
  258. package/dist/templates/StoryUI/index.js.map +1 -0
  259. package/dist/templates/StoryUI/manager.d.ts +14 -0
  260. package/dist/templates/StoryUI/manager.d.ts.map +1 -0
  261. package/dist/templates/production-app/src/App.d.ts +10 -0
  262. package/dist/templates/production-app/src/App.d.ts.map +1 -0
  263. package/dist/templates/production-app/src/App.js +653 -0
  264. package/dist/templates/production-app/src/LivePreviewRenderer.d.ts +24 -0
  265. package/dist/templates/production-app/src/LivePreviewRenderer.d.ts.map +1 -0
  266. package/dist/templates/production-app/src/LivePreviewRenderer.js +199 -0
  267. package/dist/templates/production-app/src/componentRegistry.d.ts +20 -0
  268. package/dist/templates/production-app/src/componentRegistry.d.ts.map +1 -0
  269. package/dist/templates/production-app/src/componentRegistry.js +316 -0
  270. package/dist/templates/production-app/src/main.d.ts +9 -0
  271. package/dist/templates/production-app/src/main.d.ts.map +1 -0
  272. package/dist/templates/production-app/src/main.js +18 -0
  273. package/dist/templates/production-app/vite.config.d.ts +3 -0
  274. package/dist/templates/production-app/vite.config.d.ts.map +1 -0
  275. package/dist/templates/production-app/vite.config.js +71 -0
  276. package/dist/test-storybooks/angular-material-storybook/src/main.js +66 -0
  277. package/dist/test-storybooks/chakra-storybook/vite.config.js +6 -0
  278. package/dist/test-storybooks/mantine-storybook/vite.config.js +93 -0
  279. package/dist/test-storybooks/web-components-shoelace/vite.config.js +9 -0
  280. package/dist/tsconfig.tsbuildinfo +1 -0
  281. package/package.json +1 -1
@@ -0,0 +1,36 @@
1
+ import { StoryUIConfig } from './story-ui.config.js';
2
+ /**
3
+ * Loads Story UI configuration from various sources
4
+ */
5
+ export declare class StoryUIConfigLoader {
6
+ private static instance;
7
+ private config;
8
+ static getInstance(): StoryUIConfigLoader;
9
+ /**
10
+ * Load configuration from a file
11
+ */
12
+ loadFromFile(configPath: string): Promise<StoryUIConfig>;
13
+ /**
14
+ * Load configuration from package.json
15
+ */
16
+ loadFromPackageJson(packagePath?: string): StoryUIConfig;
17
+ /**
18
+ * Auto-detect configuration from project structure
19
+ */
20
+ autoDetectConfig(projectPath?: string): StoryUIConfig;
21
+ /**
22
+ * Get current configuration
23
+ */
24
+ getConfig(): StoryUIConfig | null;
25
+ /**
26
+ * Set configuration directly
27
+ */
28
+ setConfig(config: StoryUIConfig): void;
29
+ /**
30
+ * Generate a sample configuration file
31
+ */
32
+ generateSampleConfig(outputPath: string, type?: 'json' | 'js'): void;
33
+ }
34
+ export declare const configLoader: StoryUIConfigLoader;
35
+ export declare function loadStoryUIConfig(configPath?: string): Promise<StoryUIConfig>;
36
+ //# sourceMappingURL=story-ui.config.loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-ui.config.loader.d.ts","sourceRoot":"","sources":["../story-ui.config.loader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAgD,MAAM,sBAAsB,CAAC;AAEnG;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAC7C,OAAO,CAAC,MAAM,CAA8B;IAE5C,MAAM,CAAC,WAAW,IAAI,mBAAmB;IAOzC;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAyB9D;;OAEG;IACH,mBAAmB,CAAC,WAAW,GAAE,MAAsB,GAAG,aAAa;IAyDvE;;OAEG;IACH,gBAAgB,CAAC,WAAW,GAAE,MAAsB,GAAG,aAAa;IAiDpE;;OAEG;IACH,SAAS,IAAI,aAAa,GAAG,IAAI;IAIjC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAItC;;OAEG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,GAAG,IAAa,GAAG,IAAI;CAmC7E;AAGD,eAAO,MAAM,YAAY,qBAAoC,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAW7E"}
@@ -0,0 +1,205 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { createStoryUIConfig, GENERIC_CONFIG_TEMPLATE } from './story-ui.config.js';
4
+ /**
5
+ * Loads Story UI configuration from various sources
6
+ */
7
+ export class StoryUIConfigLoader {
8
+ constructor() {
9
+ this.config = null;
10
+ }
11
+ static getInstance() {
12
+ if (!StoryUIConfigLoader.instance) {
13
+ StoryUIConfigLoader.instance = new StoryUIConfigLoader();
14
+ }
15
+ return StoryUIConfigLoader.instance;
16
+ }
17
+ /**
18
+ * Load configuration from a file
19
+ */
20
+ async loadFromFile(configPath) {
21
+ if (!fs.existsSync(configPath)) {
22
+ throw new Error(`Configuration file not found: ${configPath}`);
23
+ }
24
+ try {
25
+ // Support both .js and .json config files
26
+ let userConfig;
27
+ if (configPath.endsWith('.json')) {
28
+ const configContent = fs.readFileSync(configPath, 'utf-8');
29
+ userConfig = JSON.parse(configContent);
30
+ }
31
+ else {
32
+ // Dynamic import for .js/.ts files
33
+ const configModule = await import(configPath);
34
+ userConfig = configModule.default || configModule.config || configModule;
35
+ }
36
+ this.config = createStoryUIConfig(userConfig);
37
+ return this.config;
38
+ }
39
+ catch (error) {
40
+ throw new Error(`Failed to load configuration from ${configPath}: ${error}`);
41
+ }
42
+ }
43
+ /**
44
+ * Load configuration from package.json
45
+ */
46
+ loadFromPackageJson(packagePath = process.cwd()) {
47
+ const packageJsonPath = path.join(packagePath, 'package.json');
48
+ if (!fs.existsSync(packageJsonPath)) {
49
+ throw new Error(`package.json not found at ${packageJsonPath}`);
50
+ }
51
+ try {
52
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
53
+ const storyUIConfig = packageJson.storyUI || {};
54
+ // Auto-detect common paths if not specified
55
+ if (!storyUIConfig.generatedStoriesPath) {
56
+ const possiblePaths = [
57
+ path.join(packagePath, 'src/stories/generated'),
58
+ path.join(packagePath, 'stories/generated'),
59
+ path.join(packagePath, '.storybook/generated'),
60
+ path.join(packagePath, 'src/components/generated')
61
+ ];
62
+ for (const possiblePath of possiblePaths) {
63
+ if (fs.existsSync(path.dirname(possiblePath))) {
64
+ storyUIConfig.generatedStoriesPath = possiblePath;
65
+ break;
66
+ }
67
+ }
68
+ }
69
+ // Auto-detect components path
70
+ if (!storyUIConfig.componentsPath) {
71
+ const possiblePaths = [
72
+ path.join(packagePath, 'src/components'),
73
+ path.join(packagePath, 'lib/components'),
74
+ path.join(packagePath, 'components'),
75
+ path.join(packagePath, 'src')
76
+ ];
77
+ for (const possiblePath of possiblePaths) {
78
+ if (fs.existsSync(possiblePath)) {
79
+ storyUIConfig.componentsPath = possiblePath;
80
+ break;
81
+ }
82
+ }
83
+ }
84
+ // Auto-detect import path from package name
85
+ if (!storyUIConfig.importPath && packageJson.name) {
86
+ storyUIConfig.importPath = packageJson.name;
87
+ }
88
+ this.config = createStoryUIConfig(storyUIConfig);
89
+ return this.config;
90
+ }
91
+ catch (error) {
92
+ throw new Error(`Failed to load configuration from package.json: ${error}`);
93
+ }
94
+ }
95
+ /**
96
+ * Auto-detect configuration from project structure
97
+ */
98
+ autoDetectConfig(projectPath = process.cwd()) {
99
+ const config = { ...GENERIC_CONFIG_TEMPLATE };
100
+ // Try to detect from package.json first
101
+ try {
102
+ return this.loadFromPackageJson(projectPath);
103
+ }
104
+ catch (error) {
105
+ console.warn('Could not load from package.json, using auto-detection');
106
+ }
107
+ // Auto-detect paths
108
+ const possibleComponentPaths = [
109
+ path.join(projectPath, 'src/components'),
110
+ path.join(projectPath, 'lib/components'),
111
+ path.join(projectPath, 'components'),
112
+ path.join(projectPath, 'src')
113
+ ];
114
+ for (const possiblePath of possibleComponentPaths) {
115
+ if (fs.existsSync(possiblePath)) {
116
+ config.componentsPath = possiblePath;
117
+ break;
118
+ }
119
+ }
120
+ // Set generated stories path
121
+ config.generatedStoriesPath = path.join(projectPath, 'src/stories/generated');
122
+ // Try to detect component prefix from existing components
123
+ if (config.componentsPath) {
124
+ const componentDirs = fs.readdirSync(config.componentsPath, { withFileTypes: true })
125
+ .filter(d => d.isDirectory())
126
+ .map(d => d.name)
127
+ .slice(0, 5); // Check first 5 components
128
+ // Look for common prefixes
129
+ const prefixes = ['UI', 'App', 'My', 'Custom'];
130
+ for (const prefix of prefixes) {
131
+ if (componentDirs.some(name => name.startsWith(prefix))) {
132
+ config.componentPrefix = prefix;
133
+ break;
134
+ }
135
+ }
136
+ }
137
+ this.config = createStoryUIConfig(config);
138
+ return this.config;
139
+ }
140
+ /**
141
+ * Get current configuration
142
+ */
143
+ getConfig() {
144
+ return this.config;
145
+ }
146
+ /**
147
+ * Set configuration directly
148
+ */
149
+ setConfig(config) {
150
+ this.config = config;
151
+ }
152
+ /**
153
+ * Generate a sample configuration file
154
+ */
155
+ generateSampleConfig(outputPath, type = 'json') {
156
+ const sampleConfig = {
157
+ generatedStoriesPath: './src/stories/generated',
158
+ componentsPath: './src/components',
159
+ storyPrefix: 'Generated/',
160
+ defaultAuthor: 'Story UI AI',
161
+ importPath: 'your-component-library',
162
+ componentPrefix: 'UI',
163
+ layoutRules: {
164
+ multiColumnWrapper: 'div',
165
+ columnComponent: 'div',
166
+ layoutExamples: {
167
+ twoColumn: `<div style={{display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '1rem'}}>
168
+ <div>Column 1 content</div>
169
+ <div>Column 2 content</div>
170
+ </div>`,
171
+ threeColumn: `<div style={{display: 'grid', gridTemplateColumns: '1fr 1fr 1fr', gap: '1rem'}}>
172
+ <div>Column 1 content</div>
173
+ <div>Column 2 content</div>
174
+ <div>Column 3 content</div>
175
+ </div>`
176
+ },
177
+ prohibitedElements: []
178
+ }
179
+ };
180
+ if (type === 'json') {
181
+ fs.writeFileSync(outputPath, JSON.stringify(sampleConfig, null, 2));
182
+ }
183
+ else {
184
+ const jsContent = `export default ${JSON.stringify(sampleConfig, null, 2)};`;
185
+ fs.writeFileSync(outputPath, jsContent);
186
+ }
187
+ console.log(`Sample configuration written to: ${outputPath}`);
188
+ }
189
+ }
190
+ // Convenience functions
191
+ export const configLoader = StoryUIConfigLoader.getInstance();
192
+ export function loadStoryUIConfig(configPath) {
193
+ if (configPath) {
194
+ return configLoader.loadFromFile(configPath);
195
+ }
196
+ else {
197
+ // Try auto-detection
198
+ try {
199
+ return Promise.resolve(configLoader.loadFromPackageJson());
200
+ }
201
+ catch {
202
+ return Promise.resolve(configLoader.autoDetectConfig());
203
+ }
204
+ }
205
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"story-ui.config.loader.js","sourceRoot":"","sources":["../story-ui.config.loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAiB,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnG;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QAEU,WAAM,GAAyB,IAAI,CAAC;IAyM9C,CAAC;IAvMC,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC;YAClC,mBAAmB,CAAC,QAAQ,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC3D,CAAC;QACD,OAAO,mBAAmB,CAAC,QAAQ,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,UAAkB;QACnC,IAAI,CAAC,EAA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