@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.
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cloudflare-edge/src/mcp-session.js +462 -0
- package/dist/cloudflare-edge/src/types.js +4 -0
- package/dist/cloudflare-edge/src/worker.js +106 -0
- package/dist/cloudflare-pages/vite.config.js +14 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/index.js.map +1 -0
- package/dist/mcp-server/mcp-stdio-server.js.map +1 -0
- package/dist/mcp-server/routes/claude.js.map +1 -0
- package/dist/mcp-server/routes/components.js.map +1 -0
- package/dist/mcp-server/routes/generateStory.js.map +1 -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/hybridStories.js +216 -0
- package/dist/mcp-server/routes/hybridStories.js.map +1 -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/memoryStories.js +158 -0
- package/dist/mcp-server/routes/memoryStories.js.map +1 -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/storySync.js +147 -0
- package/dist/mcp-server/routes/storySync.js.map +1 -0
- package/dist/mcp-server/routes/updateStory.js +246 -0
- package/dist/mcp-server/sessionManager.d.ts +50 -0
- package/dist/mcp-server/sessionManager.d.ts.map +1 -0
- package/dist/mcp-server/sessionManager.js +125 -0
- package/dist/mcp-server/sessionManager.js.map +1 -0
- package/dist/playground/components/AIAssistant/AIAssistant.d.ts +6 -0
- package/dist/playground/components/AIAssistant/AIAssistant.d.ts.map +1 -0
- package/dist/playground/components/AIAssistant/AIAssistant.js +109 -0
- package/dist/playground/components/AIAssistant/AIAssistant.js.map +1 -0
- package/dist/playground/components/AIAssistant/AIAssistant.module.css +166 -0
- package/dist/playground/components/Canvas/Canvas.d.ts +9 -0
- package/dist/playground/components/Canvas/Canvas.d.ts.map +1 -0
- package/dist/playground/components/Canvas/Canvas.js +58 -0
- package/dist/playground/components/Canvas/Canvas.js.map +1 -0
- package/dist/playground/components/Canvas/Canvas.module.css +189 -0
- package/dist/playground/components/Canvas/CanvasWithDnd.d.ts +9 -0
- package/dist/playground/components/Canvas/CanvasWithDnd.d.ts.map +1 -0
- package/dist/playground/components/Canvas/CanvasWithDnd.js +158 -0
- package/dist/playground/components/Canvas/CanvasWithDnd.js.map +1 -0
- package/dist/playground/components/Canvas/ComponentRenderer.d.ts +15 -0
- package/dist/playground/components/Canvas/ComponentRenderer.d.ts.map +1 -0
- package/dist/playground/components/Canvas/ComponentRenderer.js +177 -0
- package/dist/playground/components/Canvas/ComponentRenderer.js.map +1 -0
- package/dist/playground/components/Canvas/DraggableComponent.d.ts +15 -0
- package/dist/playground/components/Canvas/DraggableComponent.d.ts.map +1 -0
- package/dist/playground/components/Canvas/DraggableComponent.js +49 -0
- package/dist/playground/components/Canvas/DraggableComponent.js.map +1 -0
- package/dist/playground/components/Canvas/index.d.ts +9 -0
- package/dist/playground/components/Canvas/index.d.ts.map +1 -0
- package/dist/playground/components/Canvas/index.js +5 -0
- package/dist/playground/components/Canvas/index.js.map +1 -0
- package/dist/playground/components/CodeView/CodeView.d.ts +12 -0
- package/dist/playground/components/CodeView/CodeView.d.ts.map +1 -0
- package/dist/playground/components/CodeView/CodeView.js +77 -0
- package/dist/playground/components/CodeView/CodeView.js.map +1 -0
- package/dist/playground/components/CodeView/CodeView.module.css +178 -0
- package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts +17 -0
- package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts.map +1 -0
- package/dist/playground/components/ComponentPalette/ComponentPalette.js +138 -0
- package/dist/playground/components/ComponentPalette/ComponentPalette.js.map +1 -0
- package/dist/playground/components/ComponentPalette/ComponentPalette.module.css +217 -0
- package/dist/playground/components/ComponentPalette/index.d.ts +3 -0
- package/dist/playground/components/ComponentPalette/index.d.ts.map +1 -0
- package/dist/playground/components/ComponentPalette/index.js +2 -0
- package/dist/playground/components/ComponentPalette/index.js.map +1 -0
- package/dist/playground/components/DropZone/DropZone.d.ts +17 -0
- package/dist/playground/components/DropZone/DropZone.d.ts.map +1 -0
- package/dist/playground/components/DropZone/DropZone.js +73 -0
- package/dist/playground/components/DropZone/DropZone.js.map +1 -0
- package/dist/playground/components/DropZone/DropZone.module.css +86 -0
- package/dist/playground/components/ExportDialog/ExportDialog.d.ts +10 -0
- package/dist/playground/components/ExportDialog/ExportDialog.d.ts.map +1 -0
- package/dist/playground/components/ExportDialog/ExportDialog.js +57 -0
- package/dist/playground/components/ExportDialog/ExportDialog.js.map +1 -0
- package/dist/playground/components/ExportDialog/ExportDialog.module.css +328 -0
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts +134 -0
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts.map +1 -0
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.js +254 -0
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.js.map +1 -0
- package/dist/playground/components/LayoutHelpers/index.d.ts +3 -0
- package/dist/playground/components/LayoutHelpers/index.d.ts.map +1 -0
- package/dist/playground/components/LayoutHelpers/index.js +2 -0
- package/dist/playground/components/LayoutHelpers/index.js.map +1 -0
- package/dist/playground/components/Playground/Playground.d.ts +10 -0
- package/dist/playground/components/Playground/Playground.d.ts.map +1 -0
- package/dist/playground/components/Playground/Playground.js +128 -0
- package/dist/playground/components/Playground/Playground.js.map +1 -0
- package/dist/playground/components/Playground/Playground.module.css +308 -0
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts +10 -0
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts.map +1 -0
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.js +150 -0
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.js.map +1 -0
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.module.css +155 -0
- package/dist/playground/components/PropertiesPanel/index.d.ts +3 -0
- package/dist/playground/components/PropertiesPanel/index.d.ts.map +1 -0
- package/dist/playground/components/PropertiesPanel/index.js +2 -0
- package/dist/playground/components/PropertiesPanel/index.js.map +1 -0
- package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts +12 -0
- package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/BooleanEditor.js +14 -0
- package/dist/playground/components/PropertyEditors/BooleanEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/ColorEditor.d.ts +12 -0
- package/dist/playground/components/PropertyEditors/ColorEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/ColorEditor.js +62 -0
- package/dist/playground/components/PropertyEditors/ColorEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/IconEditor.d.ts +12 -0
- package/dist/playground/components/PropertyEditors/IconEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/IconEditor.js +123 -0
- package/dist/playground/components/PropertyEditors/IconEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/NumberEditor.d.ts +15 -0
- package/dist/playground/components/PropertyEditors/NumberEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/NumberEditor.js +46 -0
- package/dist/playground/components/PropertyEditors/NumberEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/PropertyEditors.module.css +432 -0
- package/dist/playground/components/PropertyEditors/SelectEditor.d.ts +19 -0
- package/dist/playground/components/PropertyEditors/SelectEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/SelectEditor.js +17 -0
- package/dist/playground/components/PropertyEditors/SelectEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts +19 -0
- package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/SpacingEditor.js +162 -0
- package/dist/playground/components/PropertyEditors/SpacingEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/SpacingEditor.module.css +214 -0
- package/dist/playground/components/PropertyEditors/TextEditor.d.ts +14 -0
- package/dist/playground/components/PropertyEditors/TextEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/TextEditor.js +38 -0
- package/dist/playground/components/PropertyEditors/TextEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/TokenEditor.d.ts +23 -0
- package/dist/playground/components/PropertyEditors/TokenEditor.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/TokenEditor.js +50 -0
- package/dist/playground/components/PropertyEditors/TokenEditor.js.map +1 -0
- package/dist/playground/components/PropertyEditors/index.d.ts +20 -0
- package/dist/playground/components/PropertyEditors/index.d.ts.map +1 -0
- package/dist/playground/components/PropertyEditors/index.js +12 -0
- package/dist/playground/components/PropertyEditors/index.js.map +1 -0
- package/dist/playground/components/TreeView/TreeView.d.ts +10 -0
- package/dist/playground/components/TreeView/TreeView.d.ts.map +1 -0
- package/dist/playground/components/TreeView/TreeView.js +146 -0
- package/dist/playground/components/TreeView/TreeView.js.map +1 -0
- package/dist/playground/components/TreeView/TreeView.module.css +214 -0
- package/dist/playground/components/TreeView/index.d.ts +3 -0
- package/dist/playground/components/TreeView/index.d.ts.map +1 -0
- package/dist/playground/components/TreeView/index.js +2 -0
- package/dist/playground/components/TreeView/index.js.map +1 -0
- package/dist/playground/config/propertyDefinitions.d.ts +73 -0
- package/dist/playground/config/propertyDefinitions.d.ts.map +1 -0
- package/dist/playground/config/propertyDefinitions.js +809 -0
- package/dist/playground/config/propertyDefinitions.js.map +1 -0
- package/dist/playground/hooks/useKeyboardShortcuts.d.ts +38 -0
- package/dist/playground/hooks/useKeyboardShortcuts.d.ts.map +1 -0
- package/dist/playground/hooks/useKeyboardShortcuts.js +191 -0
- package/dist/playground/hooks/useKeyboardShortcuts.js.map +1 -0
- package/dist/playground/index.d.ts +21 -0
- package/dist/playground/index.d.ts.map +1 -0
- package/dist/playground/index.js +23 -0
- package/dist/playground/index.js.map +1 -0
- package/dist/playground/services/CodeGenerator.d.ts +73 -0
- package/dist/playground/services/CodeGenerator.d.ts.map +1 -0
- package/dist/playground/services/CodeGenerator.js +359 -0
- package/dist/playground/services/CodeGenerator.js.map +1 -0
- package/dist/playground/services/DragDropManager.d.ts +95 -0
- package/dist/playground/services/DragDropManager.d.ts.map +1 -0
- package/dist/playground/services/DragDropManager.js +408 -0
- package/dist/playground/services/DragDropManager.js.map +1 -0
- package/dist/playground/services/StoryParser.d.ts +73 -0
- package/dist/playground/services/StoryParser.d.ts.map +1 -0
- package/dist/playground/services/StoryParser.js +419 -0
- package/dist/playground/services/StoryParser.js.map +1 -0
- package/dist/playground/store/playgroundStore.d.ts +86 -0
- package/dist/playground/store/playgroundStore.d.ts.map +1 -0
- package/dist/playground/store/playgroundStore.js +337 -0
- package/dist/playground/store/playgroundStore.js.map +1 -0
- package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts +13 -0
- package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts.map +1 -0
- package/dist/playground/stories/PlaygroundDragDrop.stories.js +227 -0
- package/dist/playground/stories/PlaygroundDragDrop.stories.js.map +1 -0
- package/dist/playground/stories/PlaygroundPhase4.stories.d.ts +13 -0
- package/dist/playground/stories/PlaygroundPhase4.stories.d.ts.map +1 -0
- package/dist/playground/stories/PlaygroundPhase4.stories.js +334 -0
- package/dist/playground/stories/PlaygroundPhase4.stories.js.map +1 -0
- package/dist/playground/stories/PlaygroundPhase5.stories.d.ts +14 -0
- package/dist/playground/stories/PlaygroundPhase5.stories.d.ts.map +1 -0
- package/dist/playground/stories/PlaygroundPhase5.stories.js +512 -0
- package/dist/playground/stories/PlaygroundPhase5.stories.js.map +1 -0
- package/dist/playground/stories/PlaygroundProperties.stories.d.ts +13 -0
- package/dist/playground/stories/PlaygroundProperties.stories.d.ts.map +1 -0
- package/dist/playground/stories/PlaygroundProperties.stories.js +342 -0
- package/dist/playground/stories/PlaygroundProperties.stories.js.map +1 -0
- package/dist/playground/types/index.d.ts +251 -0
- package/dist/playground/types/index.d.ts.map +1 -0
- package/dist/playground/types/index.js +5 -0
- package/dist/playground/types/index.js.map +1 -0
- package/dist/scripts/verify-framework-adapters.js +105 -0
- package/dist/story-generator/componentBlacklist.js.map +1 -0
- package/dist/story-generator/componentDiscovery.js.map +1 -0
- package/dist/story-generator/configLoader.js.map +1 -0
- package/dist/story-generator/considerationsLoader.js.map +1 -0
- package/dist/story-generator/documentation-sources.js.map +1 -0
- package/dist/story-generator/documentationLoader.js.map +1 -0
- package/dist/story-generator/dynamicPackageDiscovery.js.map +1 -0
- package/dist/story-generator/enhancedComponentDiscovery.js.map +1 -0
- package/dist/story-generator/generateStory.js.map +1 -0
- package/dist/story-generator/gitignoreManager.js.map +1 -0
- package/dist/story-generator/inMemoryStoryService.d.ts +89 -0
- package/dist/story-generator/inMemoryStoryService.d.ts.map +1 -0
- package/dist/story-generator/inMemoryStoryService.js +128 -0
- package/dist/story-generator/inMemoryStoryService.js.map +1 -0
- package/dist/story-generator/logger.js.map +1 -0
- package/dist/story-generator/postProcessStory.js.map +1 -0
- package/dist/story-generator/postgresStoryService.d.ts +56 -0
- package/dist/story-generator/postgresStoryService.d.ts.map +1 -0
- package/dist/story-generator/postgresStoryService.js +240 -0
- package/dist/story-generator/productionGitignoreManager.d.ts +91 -0
- package/dist/story-generator/productionGitignoreManager.d.ts.map +1 -0
- package/dist/story-generator/productionGitignoreManager.js +340 -0
- package/dist/story-generator/productionGitignoreManager.js.map +1 -0
- package/dist/story-generator/promptGenerator.js.map +1 -0
- package/dist/story-generator/providerPresets.d.ts +54 -0
- package/dist/story-generator/providerPresets.d.ts.map +1 -0
- package/dist/story-generator/providerPresets.js +214 -0
- package/dist/story-generator/storyHistory.js.map +1 -0
- package/dist/story-generator/storyServiceFactory.d.ts +22 -0
- package/dist/story-generator/storyServiceFactory.d.ts.map +1 -0
- package/dist/story-generator/storyServiceFactory.js +97 -0
- package/dist/story-generator/storyServiceInterface.d.ts +85 -0
- package/dist/story-generator/storyServiceInterface.d.ts.map +1 -0
- package/dist/story-generator/storyServiceInterface.js +5 -0
- package/dist/story-generator/storySync.d.ts +68 -0
- package/dist/story-generator/storySync.d.ts.map +1 -0
- package/dist/story-generator/storySync.js +201 -0
- package/dist/story-generator/storySync.js.map +1 -0
- package/dist/story-generator/storyTracker.js.map +1 -0
- package/dist/story-generator/storyValidator.js.map +1 -0
- package/dist/story-generator/test_validation.d.ts +2 -0
- package/dist/story-generator/test_validation.d.ts.map +1 -0
- package/dist/story-generator/test_validation.js +51 -0
- package/dist/story-generator/universalDesignSystemAdapter.js.map +1 -0
- package/dist/story-generator/urlRedirectService.js.map +1 -0
- package/dist/story-generator/validateStory.js.map +1 -0
- package/dist/story-ui.config.js.map +1 -0
- package/dist/story-ui.config.loader.d.ts +36 -0
- package/dist/story-ui.config.loader.d.ts.map +1 -0
- package/dist/story-ui.config.loader.js +205 -0
- package/dist/story-ui.config.loader.js.map +1 -0
- package/dist/temp/package/templates/StoryUI/StoryUIPanel.js +807 -0
- package/dist/temp/package/templates/StoryUI/StoryUIPanel.stories.js +37 -0
- package/dist/temp/package/templates/StoryUI/index.js +2 -0
- package/dist/templates/StoryUI/StoryUIPanel.js.map +1 -0
- package/dist/templates/StoryUI/StoryUIPanel.stories.js.map +1 -0
- package/dist/templates/StoryUI/index.js.map +1 -0
- package/dist/templates/StoryUI/manager.d.ts +14 -0
- package/dist/templates/StoryUI/manager.d.ts.map +1 -0
- package/dist/templates/production-app/src/App.d.ts +10 -0
- package/dist/templates/production-app/src/App.d.ts.map +1 -0
- package/dist/templates/production-app/src/App.js +653 -0
- package/dist/templates/production-app/src/LivePreviewRenderer.d.ts +24 -0
- package/dist/templates/production-app/src/LivePreviewRenderer.d.ts.map +1 -0
- package/dist/templates/production-app/src/LivePreviewRenderer.js +199 -0
- package/dist/templates/production-app/src/componentRegistry.d.ts +20 -0
- package/dist/templates/production-app/src/componentRegistry.d.ts.map +1 -0
- package/dist/templates/production-app/src/componentRegistry.js +316 -0
- package/dist/templates/production-app/src/main.d.ts +9 -0
- package/dist/templates/production-app/src/main.d.ts.map +1 -0
- package/dist/templates/production-app/src/main.js +18 -0
- package/dist/templates/production-app/vite.config.d.ts +3 -0
- package/dist/templates/production-app/vite.config.d.ts.map +1 -0
- package/dist/templates/production-app/vite.config.js +71 -0
- package/dist/test-storybooks/angular-material-storybook/src/main.js +66 -0
- package/dist/test-storybooks/chakra-storybook/vite.config.js +6 -0
- package/dist/test-storybooks/mantine-storybook/vite.config.js +93 -0
- package/dist/test-storybooks/web-components-shoelace/vite.config.js +9 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live Preview Renderer
|
|
3
|
+
*
|
|
4
|
+
* This component takes generated JSX code as a string and renders it live
|
|
5
|
+
* using Babel standalone for JSX compilation and the component registry
|
|
6
|
+
* for component resolution.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
interface LivePreviewRendererProps {
|
|
10
|
+
/** The JSX code string to render */
|
|
11
|
+
code: string;
|
|
12
|
+
/** Optional error handler */
|
|
13
|
+
onError?: (error: Error) => void;
|
|
14
|
+
/** Optional success handler */
|
|
15
|
+
onSuccess?: () => void;
|
|
16
|
+
/** Custom styles for the container */
|
|
17
|
+
containerStyle?: React.CSSProperties;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Live Preview Renderer Component
|
|
21
|
+
*/
|
|
22
|
+
export declare const LivePreviewRenderer: React.FC<LivePreviewRendererProps>;
|
|
23
|
+
export default LivePreviewRenderer;
|
|
24
|
+
//# sourceMappingURL=LivePreviewRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivePreviewRenderer.d.ts","sourceRoot":"","sources":["../../../../templates/production-app/src/LivePreviewRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AAKjF,UAAU,wBAAwB;IAChC,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,sCAAsC;IACtC,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACtC;AAuJD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAgGlE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Live Preview Renderer
|
|
4
|
+
*
|
|
5
|
+
* This component takes generated JSX code as a string and renders it live
|
|
6
|
+
* using Babel standalone for JSX compilation and the component registry
|
|
7
|
+
* for component resolution.
|
|
8
|
+
*/
|
|
9
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
10
|
+
import * as Babel from '@babel/standalone';
|
|
11
|
+
// This import will be replaced with the actual component registry at build time
|
|
12
|
+
import { componentRegistry, React as ReactExport } from './componentRegistry';
|
|
13
|
+
// Error boundary to catch render errors
|
|
14
|
+
class ErrorBoundary extends React.Component {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.state = { hasError: false, error: null };
|
|
18
|
+
}
|
|
19
|
+
static getDerivedStateFromError(error) {
|
|
20
|
+
return { hasError: true, error };
|
|
21
|
+
}
|
|
22
|
+
componentDidCatch(error) {
|
|
23
|
+
this.props.onError?.(error);
|
|
24
|
+
}
|
|
25
|
+
componentDidUpdate(prevProps) {
|
|
26
|
+
// Reset error state when children change
|
|
27
|
+
if (prevProps.children !== this.props.children && this.state.hasError) {
|
|
28
|
+
this.setState({ hasError: false, error: null });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
if (this.state.hasError) {
|
|
33
|
+
return (_jsxs("div", { style: {
|
|
34
|
+
padding: '16px',
|
|
35
|
+
background: 'rgba(239, 68, 68, 0.1)',
|
|
36
|
+
borderLeft: '3px solid #ef4444',
|
|
37
|
+
borderRadius: '4px',
|
|
38
|
+
color: '#ef4444',
|
|
39
|
+
fontFamily: 'monospace',
|
|
40
|
+
fontSize: '13px',
|
|
41
|
+
whiteSpace: 'pre-wrap',
|
|
42
|
+
}, children: [_jsx("strong", { children: "Render Error:" }), _jsx("br", {}), this.state.error?.message] }));
|
|
43
|
+
}
|
|
44
|
+
return this.props.children;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Extract JSX from generated code
|
|
49
|
+
* The AI typically returns a full story file, but we only need the JSX render content
|
|
50
|
+
*/
|
|
51
|
+
function extractJSX(code) {
|
|
52
|
+
// Remove markdown code blocks if present
|
|
53
|
+
let cleanCode = code.trim();
|
|
54
|
+
if (cleanCode.startsWith('```')) {
|
|
55
|
+
cleanCode = cleanCode
|
|
56
|
+
.replace(/^```(?:jsx|tsx|javascript|js|typescript|ts)?\n?/, '')
|
|
57
|
+
.replace(/\n?```$/, '');
|
|
58
|
+
}
|
|
59
|
+
// Try to extract JSX from a render function
|
|
60
|
+
const renderMatch = cleanCode.match(/render:\s*\(\)\s*=>\s*\(?([\s\S]*?)\)?\s*,?\s*\}/);
|
|
61
|
+
if (renderMatch) {
|
|
62
|
+
const jsx = renderMatch[1].trim();
|
|
63
|
+
// Remove trailing paren if present
|
|
64
|
+
return jsx.endsWith(')') && !jsx.includes('(') ? jsx.slice(0, -1) : jsx;
|
|
65
|
+
}
|
|
66
|
+
// Try to extract from args.children
|
|
67
|
+
const childrenMatch = cleanCode.match(/children:\s*\(?([\s\S]*?)\)?\s*\}/);
|
|
68
|
+
if (childrenMatch) {
|
|
69
|
+
const jsx = childrenMatch[1].trim();
|
|
70
|
+
return jsx.endsWith(')') && !jsx.includes('(') ? jsx.slice(0, -1) : jsx;
|
|
71
|
+
}
|
|
72
|
+
// If it looks like a JSX expression (starts with <), use it directly
|
|
73
|
+
if (cleanCode.trim().startsWith('<')) {
|
|
74
|
+
return cleanCode;
|
|
75
|
+
}
|
|
76
|
+
// Try to extract any JSX from the code
|
|
77
|
+
const jsxMatch = cleanCode.match(/<[A-Z][^]*$/);
|
|
78
|
+
if (jsxMatch) {
|
|
79
|
+
return jsxMatch[0];
|
|
80
|
+
}
|
|
81
|
+
// Return as-is and let Babel fail if it's not valid
|
|
82
|
+
return cleanCode;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Compile JSX code string to a React component
|
|
86
|
+
*/
|
|
87
|
+
function compileJSX(jsxCode) {
|
|
88
|
+
try {
|
|
89
|
+
// Create a scope object with all available components and React
|
|
90
|
+
const scope = {
|
|
91
|
+
React: ReactExport,
|
|
92
|
+
...componentRegistry,
|
|
93
|
+
// Add common React hooks
|
|
94
|
+
useState: React.useState,
|
|
95
|
+
useEffect: React.useEffect,
|
|
96
|
+
useCallback: React.useCallback,
|
|
97
|
+
useMemo: React.useMemo,
|
|
98
|
+
useRef: React.useRef,
|
|
99
|
+
};
|
|
100
|
+
// Extract the JSX to render
|
|
101
|
+
const extractedJSX = extractJSX(jsxCode);
|
|
102
|
+
// Wrap in a function component
|
|
103
|
+
const wrappedCode = `
|
|
104
|
+
(function() {
|
|
105
|
+
const { ${Object.keys(scope).join(', ')} } = scope;
|
|
106
|
+
return function PreviewComponent() {
|
|
107
|
+
return (${extractedJSX});
|
|
108
|
+
};
|
|
109
|
+
})()
|
|
110
|
+
`;
|
|
111
|
+
// Transform JSX to JavaScript
|
|
112
|
+
const transformed = Babel.transform(wrappedCode, {
|
|
113
|
+
presets: ['react'],
|
|
114
|
+
filename: 'preview.tsx',
|
|
115
|
+
});
|
|
116
|
+
if (!transformed.code) {
|
|
117
|
+
throw new Error('Babel transformation produced no output');
|
|
118
|
+
}
|
|
119
|
+
// Create the component using Function constructor
|
|
120
|
+
// eslint-disable-next-line no-new-func
|
|
121
|
+
const createComponent = new Function('scope', `return ${transformed.code}`);
|
|
122
|
+
const Component = createComponent(scope);
|
|
123
|
+
return Component;
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error('JSX compilation error:', error);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Live Preview Renderer Component
|
|
132
|
+
*/
|
|
133
|
+
export const LivePreviewRenderer = ({ code, onError, onSuccess, containerStyle, }) => {
|
|
134
|
+
const [compiledComponent, setCompiledComponent] = useState(null);
|
|
135
|
+
const [error, setError] = useState(null);
|
|
136
|
+
const previousCodeRef = useRef('');
|
|
137
|
+
// Compile the code when it changes
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!code || code === previousCodeRef.current) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
previousCodeRef.current = code;
|
|
143
|
+
setError(null);
|
|
144
|
+
try {
|
|
145
|
+
const Component = compileJSX(code);
|
|
146
|
+
setCompiledComponent(() => Component);
|
|
147
|
+
onSuccess?.();
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
151
|
+
setError(error);
|
|
152
|
+
setCompiledComponent(null);
|
|
153
|
+
onError?.(error);
|
|
154
|
+
}
|
|
155
|
+
}, [code, onError, onSuccess]);
|
|
156
|
+
// Render error state
|
|
157
|
+
if (error) {
|
|
158
|
+
return (_jsx("div", { style: {
|
|
159
|
+
padding: '24px',
|
|
160
|
+
...containerStyle,
|
|
161
|
+
}, children: _jsxs("div", { style: {
|
|
162
|
+
padding: '16px',
|
|
163
|
+
background: 'rgba(239, 68, 68, 0.1)',
|
|
164
|
+
borderLeft: '3px solid #ef4444',
|
|
165
|
+
borderRadius: '4px',
|
|
166
|
+
color: '#ef4444',
|
|
167
|
+
}, children: [_jsx("div", { style: {
|
|
168
|
+
fontWeight: 600,
|
|
169
|
+
marginBottom: '8px',
|
|
170
|
+
fontSize: '14px',
|
|
171
|
+
}, children: "Compilation Error" }), _jsx("pre", { style: {
|
|
172
|
+
margin: 0,
|
|
173
|
+
fontFamily: '"Fira Code", Monaco, monospace',
|
|
174
|
+
fontSize: '12px',
|
|
175
|
+
lineHeight: 1.5,
|
|
176
|
+
whiteSpace: 'pre-wrap',
|
|
177
|
+
wordBreak: 'break-word',
|
|
178
|
+
}, children: error.message })] }) }));
|
|
179
|
+
}
|
|
180
|
+
// Render empty state
|
|
181
|
+
if (!compiledComponent) {
|
|
182
|
+
return (_jsx("div", { style: {
|
|
183
|
+
display: 'flex',
|
|
184
|
+
alignItems: 'center',
|
|
185
|
+
justifyContent: 'center',
|
|
186
|
+
height: '100%',
|
|
187
|
+
color: '#71717a',
|
|
188
|
+
...containerStyle,
|
|
189
|
+
}, children: "Waiting for code..." }));
|
|
190
|
+
}
|
|
191
|
+
// Render the compiled component
|
|
192
|
+
const Component = compiledComponent;
|
|
193
|
+
return (_jsx("div", { style: {
|
|
194
|
+
padding: '24px',
|
|
195
|
+
minHeight: '200px',
|
|
196
|
+
...containerStyle,
|
|
197
|
+
}, children: _jsx(ErrorBoundary, { onError: onError, children: _jsx(Component, {}) }) }));
|
|
198
|
+
};
|
|
199
|
+
export default LivePreviewRenderer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Registry
|
|
3
|
+
*
|
|
4
|
+
* AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
5
|
+
* This file is generated at build time by story-ui
|
|
6
|
+
*
|
|
7
|
+
* It exports all components from your component library
|
|
8
|
+
* for use in the live preview renderer.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This is a sample/placeholder registry for development.
|
|
11
|
+
* When you run `story-ui deploy`, this file will be regenerated
|
|
12
|
+
* with your actual component library imports.
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react';
|
|
15
|
+
export declare const componentRegistry: Record<string, React.ComponentType<any>>;
|
|
16
|
+
export declare const availableComponents: string[];
|
|
17
|
+
export { React };
|
|
18
|
+
export declare function getComponent(name: string): React.ComponentType<any> | undefined;
|
|
19
|
+
export declare function hasComponent(name: string): boolean;
|
|
20
|
+
//# sourceMappingURL=componentRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentRegistry.d.ts","sourceRoot":"","sources":["../../../../templates/production-app/src/componentRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AA0Q1B,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAStE,CAAC;AAGF,eAAO,MAAM,mBAAmB,UAS/B,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC;AAGjB,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,SAAS,CAE/E;AAGD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Registry
|
|
3
|
+
*
|
|
4
|
+
* AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
5
|
+
* This file is generated at build time by story-ui
|
|
6
|
+
*
|
|
7
|
+
* It exports all components from your component library
|
|
8
|
+
* for use in the live preview renderer.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This is a sample/placeholder registry for development.
|
|
11
|
+
* When you run `story-ui deploy`, this file will be regenerated
|
|
12
|
+
* with your actual component library imports.
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react';
|
|
15
|
+
// Sample placeholder components for development/testing
|
|
16
|
+
// These will be replaced with actual component imports from your library
|
|
17
|
+
const PlaceholderButton = ({ children, variant = 'filled', color = '#6366f1', size = 'md', disabled, onClick }) => {
|
|
18
|
+
const sizes = {
|
|
19
|
+
xs: { padding: '4px 8px', fontSize: '11px' },
|
|
20
|
+
sm: { padding: '6px 12px', fontSize: '12px' },
|
|
21
|
+
md: { padding: '8px 16px', fontSize: '14px' },
|
|
22
|
+
lg: { padding: '10px 20px', fontSize: '16px' },
|
|
23
|
+
xl: { padding: '12px 24px', fontSize: '18px' },
|
|
24
|
+
};
|
|
25
|
+
const baseStyles = {
|
|
26
|
+
...sizes[size],
|
|
27
|
+
borderRadius: '6px',
|
|
28
|
+
fontWeight: 500,
|
|
29
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
30
|
+
opacity: disabled ? 0.5 : 1,
|
|
31
|
+
transition: 'all 150ms ease',
|
|
32
|
+
border: 'none',
|
|
33
|
+
fontFamily: 'inherit',
|
|
34
|
+
};
|
|
35
|
+
const variantStyles = {
|
|
36
|
+
filled: { backgroundColor: color, color: 'white' },
|
|
37
|
+
outline: { backgroundColor: 'transparent', border: `1px solid ${color}`, color },
|
|
38
|
+
subtle: { backgroundColor: `${color}20`, color },
|
|
39
|
+
light: { backgroundColor: `${color}15`, color },
|
|
40
|
+
};
|
|
41
|
+
return style = {};
|
|
42
|
+
{
|
|
43
|
+
baseStyles, ;
|
|
44
|
+
variantStyles[variant];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
disabled = { disabled };
|
|
48
|
+
onClick = { onClick }
|
|
49
|
+
>
|
|
50
|
+
{ children }
|
|
51
|
+
< /button>;
|
|
52
|
+
;
|
|
53
|
+
;
|
|
54
|
+
const PlaceholderCard = ({ children, shadow = 'sm', padding = 'md', radius = 'md', withBorder = false }) => {
|
|
55
|
+
const paddings = { xs: '8px', sm: '12px', md: '16px', lg: '24px', xl: '32px' };
|
|
56
|
+
const radii = { xs: '4px', sm: '6px', md: '8px', lg: '12px', xl: '16px' };
|
|
57
|
+
const shadows = {
|
|
58
|
+
xs: '0 1px 2px rgba(0,0,0,0.05)',
|
|
59
|
+
sm: '0 1px 3px rgba(0,0,0,0.1)',
|
|
60
|
+
md: '0 4px 6px rgba(0,0,0,0.1)',
|
|
61
|
+
lg: '0 10px 15px rgba(0,0,0,0.1)',
|
|
62
|
+
xl: '0 20px 25px rgba(0,0,0,0.15)',
|
|
63
|
+
};
|
|
64
|
+
return style = {};
|
|
65
|
+
{
|
|
66
|
+
backgroundColor: '#1e1e1e',
|
|
67
|
+
padding;
|
|
68
|
+
paddings[padding],
|
|
69
|
+
borderRadius;
|
|
70
|
+
radii[radius],
|
|
71
|
+
boxShadow;
|
|
72
|
+
shadows[shadow],
|
|
73
|
+
border;
|
|
74
|
+
withBorder ? '1px solid #27272a' : 'none',
|
|
75
|
+
;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
>
|
|
79
|
+
{ children }
|
|
80
|
+
< /div>;
|
|
81
|
+
;
|
|
82
|
+
;
|
|
83
|
+
const PlaceholderText = ({ children, size = 'md', weight = 400, color, align = 'left' }) => {
|
|
84
|
+
const sizes = { xs: '11px', sm: '13px', md: '14px', lg: '16px', xl: '18px' };
|
|
85
|
+
return style = {};
|
|
86
|
+
{
|
|
87
|
+
fontSize: sizes[size],
|
|
88
|
+
fontWeight;
|
|
89
|
+
weight,
|
|
90
|
+
color;
|
|
91
|
+
color || '#fafafa',
|
|
92
|
+
textAlign;
|
|
93
|
+
align,
|
|
94
|
+
margin;
|
|
95
|
+
0,
|
|
96
|
+
lineHeight;
|
|
97
|
+
1.5,
|
|
98
|
+
;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
>
|
|
102
|
+
{ children }
|
|
103
|
+
< /p>;
|
|
104
|
+
;
|
|
105
|
+
;
|
|
106
|
+
const PlaceholderTitle = ({ children, order = 1, color, align = 'left' }) => {
|
|
107
|
+
const sizes = {
|
|
108
|
+
1: '32px',
|
|
109
|
+
2: '28px',
|
|
110
|
+
3: '24px',
|
|
111
|
+
4: '20px',
|
|
112
|
+
5: '18px',
|
|
113
|
+
6: '16px',
|
|
114
|
+
};
|
|
115
|
+
const Tag = `h${order}`;
|
|
116
|
+
return style = {};
|
|
117
|
+
{
|
|
118
|
+
fontSize: sizes[order],
|
|
119
|
+
fontWeight;
|
|
120
|
+
700,
|
|
121
|
+
color;
|
|
122
|
+
color || '#fafafa',
|
|
123
|
+
textAlign;
|
|
124
|
+
align,
|
|
125
|
+
margin;
|
|
126
|
+
0,
|
|
127
|
+
lineHeight;
|
|
128
|
+
1.25,
|
|
129
|
+
;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
>
|
|
133
|
+
{ children }
|
|
134
|
+
< /Tag>;
|
|
135
|
+
;
|
|
136
|
+
;
|
|
137
|
+
const PlaceholderStack = ({ children, spacing = 'md', align = 'stretch' }) => {
|
|
138
|
+
const spacings = { xs: '4px', sm: '8px', md: '16px', lg: '24px', xl: '32px' };
|
|
139
|
+
return style = {};
|
|
140
|
+
{
|
|
141
|
+
display: 'flex',
|
|
142
|
+
flexDirection;
|
|
143
|
+
'column',
|
|
144
|
+
gap;
|
|
145
|
+
spacings[spacing],
|
|
146
|
+
alignItems;
|
|
147
|
+
align,
|
|
148
|
+
;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
>
|
|
152
|
+
{ children }
|
|
153
|
+
< /div>;
|
|
154
|
+
;
|
|
155
|
+
;
|
|
156
|
+
const PlaceholderGroup = ({ children, spacing = 'md', justify = 'flex-start', align = 'center', wrap = 'wrap' }) => {
|
|
157
|
+
const spacings = { xs: '4px', sm: '8px', md: '16px', lg: '24px', xl: '32px' };
|
|
158
|
+
return style = {};
|
|
159
|
+
{
|
|
160
|
+
display: 'flex',
|
|
161
|
+
flexDirection;
|
|
162
|
+
'row',
|
|
163
|
+
gap;
|
|
164
|
+
spacings[spacing],
|
|
165
|
+
justifyContent;
|
|
166
|
+
justify,
|
|
167
|
+
alignItems;
|
|
168
|
+
align,
|
|
169
|
+
flexWrap;
|
|
170
|
+
wrap,
|
|
171
|
+
;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
>
|
|
175
|
+
{ children }
|
|
176
|
+
< /div>;
|
|
177
|
+
;
|
|
178
|
+
;
|
|
179
|
+
const PlaceholderBadge = ({ children, color = '#6366f1', variant = 'light', size = 'md' }) => {
|
|
180
|
+
const sizes = {
|
|
181
|
+
xs: { padding: '2px 6px', fontSize: '10px' },
|
|
182
|
+
sm: { padding: '3px 8px', fontSize: '11px' },
|
|
183
|
+
md: { padding: '4px 10px', fontSize: '12px' },
|
|
184
|
+
lg: { padding: '5px 12px', fontSize: '13px' },
|
|
185
|
+
xl: { padding: '6px 14px', fontSize: '14px' },
|
|
186
|
+
};
|
|
187
|
+
const variantStyles = {
|
|
188
|
+
filled: { backgroundColor: color, color: 'white' },
|
|
189
|
+
outline: { backgroundColor: 'transparent', border: `1px solid ${color}`, color },
|
|
190
|
+
light: { backgroundColor: `${color}20`, color },
|
|
191
|
+
};
|
|
192
|
+
return style = {};
|
|
193
|
+
{
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
sizes[size],
|
|
197
|
+
;
|
|
198
|
+
variantStyles[variant],
|
|
199
|
+
borderRadius;
|
|
200
|
+
'9999px',
|
|
201
|
+
fontWeight;
|
|
202
|
+
500,
|
|
203
|
+
display;
|
|
204
|
+
'inline-flex',
|
|
205
|
+
alignItems;
|
|
206
|
+
'center',
|
|
207
|
+
justifyContent;
|
|
208
|
+
'center',
|
|
209
|
+
;
|
|
210
|
+
>
|
|
211
|
+
{ children }
|
|
212
|
+
< /span>;
|
|
213
|
+
;
|
|
214
|
+
;
|
|
215
|
+
const PlaceholderTextInput = ({ label, placeholder, value, onChange, disabled, error, description }) => {
|
|
216
|
+
return style = {};
|
|
217
|
+
{
|
|
218
|
+
display: 'flex', flexDirection;
|
|
219
|
+
'column', gap;
|
|
220
|
+
'4px';
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
>
|
|
224
|
+
{ label } && style;
|
|
225
|
+
{
|
|
226
|
+
{
|
|
227
|
+
fontSize: '14px', fontWeight;
|
|
228
|
+
500, color;
|
|
229
|
+
'#fafafa';
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
>
|
|
233
|
+
{ label }
|
|
234
|
+
< /label>;
|
|
235
|
+
{
|
|
236
|
+
description && style;
|
|
237
|
+
{
|
|
238
|
+
{
|
|
239
|
+
fontSize: '12px', color;
|
|
240
|
+
'#71717a';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
> { description } < /span>;
|
|
244
|
+
}
|
|
245
|
+
type;
|
|
246
|
+
"text";
|
|
247
|
+
placeholder = { placeholder };
|
|
248
|
+
value = { value };
|
|
249
|
+
onChange = { onChange };
|
|
250
|
+
disabled = { disabled };
|
|
251
|
+
style = {};
|
|
252
|
+
{
|
|
253
|
+
padding: '8px 12px',
|
|
254
|
+
fontSize;
|
|
255
|
+
'14px',
|
|
256
|
+
borderRadius;
|
|
257
|
+
'6px',
|
|
258
|
+
border;
|
|
259
|
+
`1px solid ${error ? '#ef4444' : '#27272a'}`,
|
|
260
|
+
backgroundColor;
|
|
261
|
+
'#1a1a1a',
|
|
262
|
+
color;
|
|
263
|
+
'#fafafa',
|
|
264
|
+
outline;
|
|
265
|
+
'none',
|
|
266
|
+
opacity;
|
|
267
|
+
disabled ? 0.5 : 1,
|
|
268
|
+
;
|
|
269
|
+
}
|
|
270
|
+
/>;
|
|
271
|
+
{
|
|
272
|
+
error && style;
|
|
273
|
+
{
|
|
274
|
+
{
|
|
275
|
+
fontSize: '12px', color;
|
|
276
|
+
'#ef4444';
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
> { error } < /span>;
|
|
280
|
+
}
|
|
281
|
+
/div>;
|
|
282
|
+
;
|
|
283
|
+
;
|
|
284
|
+
// Component registry - maps component names to their implementations
|
|
285
|
+
// This will be replaced with actual component imports at build time
|
|
286
|
+
export const componentRegistry = {
|
|
287
|
+
Button: PlaceholderButton,
|
|
288
|
+
Card: PlaceholderCard,
|
|
289
|
+
Text: PlaceholderText,
|
|
290
|
+
Title: PlaceholderTitle,
|
|
291
|
+
Stack: PlaceholderStack,
|
|
292
|
+
Group: PlaceholderGroup,
|
|
293
|
+
Badge: PlaceholderBadge,
|
|
294
|
+
TextInput: PlaceholderTextInput,
|
|
295
|
+
};
|
|
296
|
+
// List of available component names
|
|
297
|
+
export const availableComponents = [
|
|
298
|
+
'Button',
|
|
299
|
+
'Card',
|
|
300
|
+
'Text',
|
|
301
|
+
'Title',
|
|
302
|
+
'Stack',
|
|
303
|
+
'Group',
|
|
304
|
+
'Badge',
|
|
305
|
+
'TextInput',
|
|
306
|
+
];
|
|
307
|
+
// Export React for use in compiled code
|
|
308
|
+
export { React };
|
|
309
|
+
// Helper to get a component by name
|
|
310
|
+
export function getComponent(name) {
|
|
311
|
+
return componentRegistry[name];
|
|
312
|
+
}
|
|
313
|
+
// Check if a component exists
|
|
314
|
+
export function hasComponent(name) {
|
|
315
|
+
return name in componentRegistry;
|
|
316
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production App Entry Point
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the Story UI production app.
|
|
5
|
+
* It renders the main App component which provides the Lovable/Bolt-style
|
|
6
|
+
* interface for generating and previewing UI components.
|
|
7
|
+
*/
|
|
8
|
+
import './index.css';
|
|
9
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../templates/production-app/src/main.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Production App Entry Point
|
|
4
|
+
*
|
|
5
|
+
* This is the main entry point for the Story UI production app.
|
|
6
|
+
* It renders the main App component which provides the Lovable/Bolt-style
|
|
7
|
+
* interface for generating and previewing UI components.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import ReactDOM from 'react-dom/client';
|
|
11
|
+
import App from './App';
|
|
12
|
+
import './index.css';
|
|
13
|
+
// Mount the app
|
|
14
|
+
const rootElement = document.getElementById('root');
|
|
15
|
+
if (!rootElement) {
|
|
16
|
+
throw new Error('Root element not found. Make sure there is a <div id="root"></div> in your HTML.');
|
|
17
|
+
}
|
|
18
|
+
ReactDOM.createRoot(rootElement).render(_jsx(React.StrictMode, { children: _jsx(App, {}) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../../../templates/production-app/vite.config.ts"],"names":[],"mappings":";AAKA,wBA6EG"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
// https://vitejs.dev/config/
|
|
5
|
+
export default defineConfig(({ mode }) => {
|
|
6
|
+
// Load env file based on mode
|
|
7
|
+
const env = loadEnv(mode, process.cwd(), '');
|
|
8
|
+
return {
|
|
9
|
+
plugins: [react()],
|
|
10
|
+
// Define environment variables to expose to the client
|
|
11
|
+
define: {
|
|
12
|
+
// Backend API URL - required for production
|
|
13
|
+
'import.meta.env.VITE_BACKEND_URL': JSON.stringify(env.VITE_BACKEND_URL || 'http://localhost:4001'),
|
|
14
|
+
// App title customization
|
|
15
|
+
'import.meta.env.VITE_APP_TITLE': JSON.stringify(env.VITE_APP_TITLE || 'Story UI'),
|
|
16
|
+
},
|
|
17
|
+
// Resolve aliases for cleaner imports
|
|
18
|
+
resolve: {
|
|
19
|
+
alias: {
|
|
20
|
+
'@': path.resolve(__dirname, './src'),
|
|
21
|
+
'@components': path.resolve(__dirname, './src/components'),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
// Server configuration for development
|
|
25
|
+
server: {
|
|
26
|
+
port: 5173,
|
|
27
|
+
strictPort: false,
|
|
28
|
+
host: true, // Listen on all addresses
|
|
29
|
+
// Proxy API requests to backend in development
|
|
30
|
+
proxy: {
|
|
31
|
+
'/mcp': {
|
|
32
|
+
target: env.VITE_BACKEND_URL || 'http://localhost:4001',
|
|
33
|
+
changeOrigin: true,
|
|
34
|
+
},
|
|
35
|
+
'/story-ui': {
|
|
36
|
+
target: env.VITE_BACKEND_URL || 'http://localhost:4001',
|
|
37
|
+
changeOrigin: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
// Build configuration
|
|
42
|
+
build: {
|
|
43
|
+
outDir: 'dist',
|
|
44
|
+
sourcemap: mode === 'development',
|
|
45
|
+
// Optimize chunk size
|
|
46
|
+
rollupOptions: {
|
|
47
|
+
output: {
|
|
48
|
+
manualChunks: {
|
|
49
|
+
// Split vendor chunks for better caching
|
|
50
|
+
'vendor-react': ['react', 'react-dom'],
|
|
51
|
+
'vendor-babel': ['@babel/standalone'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
// Target modern browsers
|
|
56
|
+
target: 'es2020',
|
|
57
|
+
// Minification
|
|
58
|
+
minify: 'esbuild',
|
|
59
|
+
},
|
|
60
|
+
// Optimize dependencies
|
|
61
|
+
optimizeDeps: {
|
|
62
|
+
include: ['react', 'react-dom', '@babel/standalone'],
|
|
63
|
+
},
|
|
64
|
+
// Preview server configuration (for testing production build locally)
|
|
65
|
+
preview: {
|
|
66
|
+
port: 4173,
|
|
67
|
+
strictPort: false,
|
|
68
|
+
host: true,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
});
|