@tpitre/story-ui 3.4.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +0 -0
- package/dist/mcp-server/index.js +32 -0
- package/package.json +2 -1
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/setup.js.map +0 -1
- package/dist/cloudflare-edge/src/mcp-session.js +0 -462
- package/dist/cloudflare-edge/src/types.js +0 -4
- package/dist/cloudflare-edge/src/worker.js +0 -106
- package/dist/cloudflare-pages/vite.config.js +0 -14
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/mcp-server/index.js.map +0 -1
- package/dist/mcp-server/mcp-stdio-server.js.map +0 -1
- package/dist/mcp-server/routes/claude.js.map +0 -1
- package/dist/mcp-server/routes/components.js.map +0 -1
- package/dist/mcp-server/routes/generateStory.js.map +0 -1
- package/dist/mcp-server/routes/hybridStories.d.ts +0 -18
- package/dist/mcp-server/routes/hybridStories.d.ts.map +0 -1
- package/dist/mcp-server/routes/hybridStories.js +0 -216
- package/dist/mcp-server/routes/hybridStories.js.map +0 -1
- package/dist/mcp-server/routes/memoryStories.d.ts +0 -26
- package/dist/mcp-server/routes/memoryStories.d.ts.map +0 -1
- package/dist/mcp-server/routes/memoryStories.js +0 -158
- package/dist/mcp-server/routes/memoryStories.js.map +0 -1
- package/dist/mcp-server/routes/storySync.d.ts +0 -26
- package/dist/mcp-server/routes/storySync.d.ts.map +0 -1
- package/dist/mcp-server/routes/storySync.js +0 -147
- package/dist/mcp-server/routes/storySync.js.map +0 -1
- package/dist/mcp-server/routes/updateStory.js +0 -246
- package/dist/mcp-server/sessionManager.d.ts +0 -50
- package/dist/mcp-server/sessionManager.d.ts.map +0 -1
- package/dist/mcp-server/sessionManager.js +0 -125
- package/dist/mcp-server/sessionManager.js.map +0 -1
- package/dist/playground/components/AIAssistant/AIAssistant.d.ts +0 -6
- package/dist/playground/components/AIAssistant/AIAssistant.d.ts.map +0 -1
- package/dist/playground/components/AIAssistant/AIAssistant.js +0 -109
- package/dist/playground/components/AIAssistant/AIAssistant.js.map +0 -1
- package/dist/playground/components/AIAssistant/AIAssistant.module.css +0 -166
- package/dist/playground/components/Canvas/Canvas.d.ts +0 -9
- package/dist/playground/components/Canvas/Canvas.d.ts.map +0 -1
- package/dist/playground/components/Canvas/Canvas.js +0 -58
- package/dist/playground/components/Canvas/Canvas.js.map +0 -1
- package/dist/playground/components/Canvas/Canvas.module.css +0 -189
- package/dist/playground/components/Canvas/CanvasWithDnd.d.ts +0 -9
- package/dist/playground/components/Canvas/CanvasWithDnd.d.ts.map +0 -1
- package/dist/playground/components/Canvas/CanvasWithDnd.js +0 -158
- package/dist/playground/components/Canvas/CanvasWithDnd.js.map +0 -1
- package/dist/playground/components/Canvas/ComponentRenderer.d.ts +0 -15
- package/dist/playground/components/Canvas/ComponentRenderer.d.ts.map +0 -1
- package/dist/playground/components/Canvas/ComponentRenderer.js +0 -177
- package/dist/playground/components/Canvas/ComponentRenderer.js.map +0 -1
- package/dist/playground/components/Canvas/DraggableComponent.d.ts +0 -15
- package/dist/playground/components/Canvas/DraggableComponent.d.ts.map +0 -1
- package/dist/playground/components/Canvas/DraggableComponent.js +0 -49
- package/dist/playground/components/Canvas/DraggableComponent.js.map +0 -1
- package/dist/playground/components/Canvas/index.d.ts +0 -9
- package/dist/playground/components/Canvas/index.d.ts.map +0 -1
- package/dist/playground/components/Canvas/index.js +0 -5
- package/dist/playground/components/Canvas/index.js.map +0 -1
- package/dist/playground/components/CodeView/CodeView.d.ts +0 -12
- package/dist/playground/components/CodeView/CodeView.d.ts.map +0 -1
- package/dist/playground/components/CodeView/CodeView.js +0 -77
- package/dist/playground/components/CodeView/CodeView.js.map +0 -1
- package/dist/playground/components/CodeView/CodeView.module.css +0 -178
- package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts +0 -17
- package/dist/playground/components/ComponentPalette/ComponentPalette.d.ts.map +0 -1
- package/dist/playground/components/ComponentPalette/ComponentPalette.js +0 -138
- package/dist/playground/components/ComponentPalette/ComponentPalette.js.map +0 -1
- package/dist/playground/components/ComponentPalette/ComponentPalette.module.css +0 -217
- package/dist/playground/components/ComponentPalette/index.d.ts +0 -3
- package/dist/playground/components/ComponentPalette/index.d.ts.map +0 -1
- package/dist/playground/components/ComponentPalette/index.js +0 -2
- package/dist/playground/components/ComponentPalette/index.js.map +0 -1
- package/dist/playground/components/DropZone/DropZone.d.ts +0 -17
- package/dist/playground/components/DropZone/DropZone.d.ts.map +0 -1
- package/dist/playground/components/DropZone/DropZone.js +0 -73
- package/dist/playground/components/DropZone/DropZone.js.map +0 -1
- package/dist/playground/components/DropZone/DropZone.module.css +0 -86
- package/dist/playground/components/ExportDialog/ExportDialog.d.ts +0 -10
- package/dist/playground/components/ExportDialog/ExportDialog.d.ts.map +0 -1
- package/dist/playground/components/ExportDialog/ExportDialog.js +0 -57
- package/dist/playground/components/ExportDialog/ExportDialog.js.map +0 -1
- package/dist/playground/components/ExportDialog/ExportDialog.module.css +0 -328
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts +0 -134
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.d.ts.map +0 -1
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.js +0 -254
- package/dist/playground/components/LayoutHelpers/LayoutHelpers.js.map +0 -1
- package/dist/playground/components/LayoutHelpers/index.d.ts +0 -3
- package/dist/playground/components/LayoutHelpers/index.d.ts.map +0 -1
- package/dist/playground/components/LayoutHelpers/index.js +0 -2
- package/dist/playground/components/LayoutHelpers/index.js.map +0 -1
- package/dist/playground/components/Playground/Playground.d.ts +0 -10
- package/dist/playground/components/Playground/Playground.d.ts.map +0 -1
- package/dist/playground/components/Playground/Playground.js +0 -128
- package/dist/playground/components/Playground/Playground.js.map +0 -1
- package/dist/playground/components/Playground/Playground.module.css +0 -308
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts +0 -10
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.d.ts.map +0 -1
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.js +0 -150
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.js.map +0 -1
- package/dist/playground/components/PropertiesPanel/PropertiesPanel.module.css +0 -155
- package/dist/playground/components/PropertiesPanel/index.d.ts +0 -3
- package/dist/playground/components/PropertiesPanel/index.d.ts.map +0 -1
- package/dist/playground/components/PropertiesPanel/index.js +0 -2
- package/dist/playground/components/PropertiesPanel/index.js.map +0 -1
- package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts +0 -12
- package/dist/playground/components/PropertyEditors/BooleanEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/BooleanEditor.js +0 -14
- package/dist/playground/components/PropertyEditors/BooleanEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/ColorEditor.d.ts +0 -12
- package/dist/playground/components/PropertyEditors/ColorEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/ColorEditor.js +0 -62
- package/dist/playground/components/PropertyEditors/ColorEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/IconEditor.d.ts +0 -12
- package/dist/playground/components/PropertyEditors/IconEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/IconEditor.js +0 -123
- package/dist/playground/components/PropertyEditors/IconEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/NumberEditor.d.ts +0 -15
- package/dist/playground/components/PropertyEditors/NumberEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/NumberEditor.js +0 -46
- package/dist/playground/components/PropertyEditors/NumberEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/PropertyEditors.module.css +0 -432
- package/dist/playground/components/PropertyEditors/SelectEditor.d.ts +0 -19
- package/dist/playground/components/PropertyEditors/SelectEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/SelectEditor.js +0 -17
- package/dist/playground/components/PropertyEditors/SelectEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts +0 -19
- package/dist/playground/components/PropertyEditors/SpacingEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/SpacingEditor.js +0 -162
- package/dist/playground/components/PropertyEditors/SpacingEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/SpacingEditor.module.css +0 -214
- package/dist/playground/components/PropertyEditors/TextEditor.d.ts +0 -14
- package/dist/playground/components/PropertyEditors/TextEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/TextEditor.js +0 -38
- package/dist/playground/components/PropertyEditors/TextEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/TokenEditor.d.ts +0 -23
- package/dist/playground/components/PropertyEditors/TokenEditor.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/TokenEditor.js +0 -50
- package/dist/playground/components/PropertyEditors/TokenEditor.js.map +0 -1
- package/dist/playground/components/PropertyEditors/index.d.ts +0 -20
- package/dist/playground/components/PropertyEditors/index.d.ts.map +0 -1
- package/dist/playground/components/PropertyEditors/index.js +0 -12
- package/dist/playground/components/PropertyEditors/index.js.map +0 -1
- package/dist/playground/components/TreeView/TreeView.d.ts +0 -10
- package/dist/playground/components/TreeView/TreeView.d.ts.map +0 -1
- package/dist/playground/components/TreeView/TreeView.js +0 -146
- package/dist/playground/components/TreeView/TreeView.js.map +0 -1
- package/dist/playground/components/TreeView/TreeView.module.css +0 -214
- package/dist/playground/components/TreeView/index.d.ts +0 -3
- package/dist/playground/components/TreeView/index.d.ts.map +0 -1
- package/dist/playground/components/TreeView/index.js +0 -2
- package/dist/playground/components/TreeView/index.js.map +0 -1
- package/dist/playground/config/propertyDefinitions.d.ts +0 -73
- package/dist/playground/config/propertyDefinitions.d.ts.map +0 -1
- package/dist/playground/config/propertyDefinitions.js +0 -809
- package/dist/playground/config/propertyDefinitions.js.map +0 -1
- package/dist/playground/hooks/useKeyboardShortcuts.d.ts +0 -38
- package/dist/playground/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/dist/playground/hooks/useKeyboardShortcuts.js +0 -191
- package/dist/playground/hooks/useKeyboardShortcuts.js.map +0 -1
- package/dist/playground/index.d.ts +0 -21
- package/dist/playground/index.d.ts.map +0 -1
- package/dist/playground/index.js +0 -23
- package/dist/playground/index.js.map +0 -1
- package/dist/playground/services/CodeGenerator.d.ts +0 -73
- package/dist/playground/services/CodeGenerator.d.ts.map +0 -1
- package/dist/playground/services/CodeGenerator.js +0 -359
- package/dist/playground/services/CodeGenerator.js.map +0 -1
- package/dist/playground/services/DragDropManager.d.ts +0 -95
- package/dist/playground/services/DragDropManager.d.ts.map +0 -1
- package/dist/playground/services/DragDropManager.js +0 -408
- package/dist/playground/services/DragDropManager.js.map +0 -1
- package/dist/playground/services/StoryParser.d.ts +0 -73
- package/dist/playground/services/StoryParser.d.ts.map +0 -1
- package/dist/playground/services/StoryParser.js +0 -419
- package/dist/playground/services/StoryParser.js.map +0 -1
- package/dist/playground/store/playgroundStore.d.ts +0 -86
- package/dist/playground/store/playgroundStore.d.ts.map +0 -1
- package/dist/playground/store/playgroundStore.js +0 -337
- package/dist/playground/store/playgroundStore.js.map +0 -1
- package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts +0 -13
- package/dist/playground/stories/PlaygroundDragDrop.stories.d.ts.map +0 -1
- package/dist/playground/stories/PlaygroundDragDrop.stories.js +0 -227
- package/dist/playground/stories/PlaygroundDragDrop.stories.js.map +0 -1
- package/dist/playground/stories/PlaygroundPhase4.stories.d.ts +0 -13
- package/dist/playground/stories/PlaygroundPhase4.stories.d.ts.map +0 -1
- package/dist/playground/stories/PlaygroundPhase4.stories.js +0 -334
- package/dist/playground/stories/PlaygroundPhase4.stories.js.map +0 -1
- package/dist/playground/stories/PlaygroundPhase5.stories.d.ts +0 -14
- package/dist/playground/stories/PlaygroundPhase5.stories.d.ts.map +0 -1
- package/dist/playground/stories/PlaygroundPhase5.stories.js +0 -512
- package/dist/playground/stories/PlaygroundPhase5.stories.js.map +0 -1
- package/dist/playground/stories/PlaygroundProperties.stories.d.ts +0 -13
- package/dist/playground/stories/PlaygroundProperties.stories.d.ts.map +0 -1
- package/dist/playground/stories/PlaygroundProperties.stories.js +0 -342
- package/dist/playground/stories/PlaygroundProperties.stories.js.map +0 -1
- package/dist/playground/types/index.d.ts +0 -251
- package/dist/playground/types/index.d.ts.map +0 -1
- package/dist/playground/types/index.js +0 -5
- package/dist/playground/types/index.js.map +0 -1
- package/dist/scripts/verify-framework-adapters.js +0 -105
- package/dist/story-generator/componentBlacklist.js.map +0 -1
- package/dist/story-generator/componentDiscovery.js.map +0 -1
- package/dist/story-generator/configLoader.js.map +0 -1
- package/dist/story-generator/considerationsLoader.js.map +0 -1
- package/dist/story-generator/documentation-sources.js.map +0 -1
- package/dist/story-generator/documentationLoader.js.map +0 -1
- package/dist/story-generator/dynamicPackageDiscovery.js.map +0 -1
- package/dist/story-generator/enhancedComponentDiscovery.js.map +0 -1
- package/dist/story-generator/generateStory.js.map +0 -1
- package/dist/story-generator/gitignoreManager.js.map +0 -1
- package/dist/story-generator/inMemoryStoryService.d.ts +0 -89
- package/dist/story-generator/inMemoryStoryService.d.ts.map +0 -1
- package/dist/story-generator/inMemoryStoryService.js +0 -128
- package/dist/story-generator/inMemoryStoryService.js.map +0 -1
- package/dist/story-generator/logger.js.map +0 -1
- package/dist/story-generator/postProcessStory.js.map +0 -1
- package/dist/story-generator/postgresStoryService.d.ts +0 -56
- package/dist/story-generator/postgresStoryService.d.ts.map +0 -1
- package/dist/story-generator/postgresStoryService.js +0 -240
- package/dist/story-generator/productionGitignoreManager.d.ts +0 -91
- package/dist/story-generator/productionGitignoreManager.d.ts.map +0 -1
- package/dist/story-generator/productionGitignoreManager.js +0 -340
- package/dist/story-generator/productionGitignoreManager.js.map +0 -1
- package/dist/story-generator/promptGenerator.js.map +0 -1
- package/dist/story-generator/providerPresets.d.ts +0 -54
- package/dist/story-generator/providerPresets.d.ts.map +0 -1
- package/dist/story-generator/providerPresets.js +0 -214
- package/dist/story-generator/storyHistory.js.map +0 -1
- package/dist/story-generator/storyServiceFactory.d.ts +0 -22
- package/dist/story-generator/storyServiceFactory.d.ts.map +0 -1
- package/dist/story-generator/storyServiceFactory.js +0 -97
- package/dist/story-generator/storyServiceInterface.d.ts +0 -85
- package/dist/story-generator/storyServiceInterface.d.ts.map +0 -1
- package/dist/story-generator/storyServiceInterface.js +0 -5
- package/dist/story-generator/storySync.d.ts +0 -68
- package/dist/story-generator/storySync.d.ts.map +0 -1
- package/dist/story-generator/storySync.js +0 -201
- package/dist/story-generator/storySync.js.map +0 -1
- package/dist/story-generator/storyTracker.js.map +0 -1
- package/dist/story-generator/storyValidator.js.map +0 -1
- package/dist/story-generator/test_validation.d.ts +0 -2
- package/dist/story-generator/test_validation.d.ts.map +0 -1
- package/dist/story-generator/test_validation.js +0 -51
- package/dist/story-generator/universalDesignSystemAdapter.js.map +0 -1
- package/dist/story-generator/urlRedirectService.js.map +0 -1
- package/dist/story-generator/validateStory.js.map +0 -1
- package/dist/story-ui.config.js.map +0 -1
- package/dist/story-ui.config.loader.d.ts +0 -36
- package/dist/story-ui.config.loader.d.ts.map +0 -1
- package/dist/story-ui.config.loader.js +0 -205
- package/dist/story-ui.config.loader.js.map +0 -1
- package/dist/temp/package/templates/StoryUI/StoryUIPanel.js +0 -807
- package/dist/temp/package/templates/StoryUI/StoryUIPanel.stories.js +0 -37
- package/dist/temp/package/templates/StoryUI/index.js +0 -2
- package/dist/templates/StoryUI/StoryUIPanel.js.map +0 -1
- package/dist/templates/StoryUI/StoryUIPanel.stories.js.map +0 -1
- package/dist/templates/StoryUI/index.js.map +0 -1
- package/dist/templates/StoryUI/manager.d.ts +0 -14
- package/dist/templates/StoryUI/manager.d.ts.map +0 -1
- package/dist/templates/production-app/src/App.d.ts +0 -10
- package/dist/templates/production-app/src/App.d.ts.map +0 -1
- package/dist/templates/production-app/src/App.js +0 -653
- package/dist/templates/production-app/src/LivePreviewRenderer.d.ts +0 -24
- package/dist/templates/production-app/src/LivePreviewRenderer.d.ts.map +0 -1
- package/dist/templates/production-app/src/LivePreviewRenderer.js +0 -199
- package/dist/templates/production-app/src/componentRegistry.d.ts +0 -20
- package/dist/templates/production-app/src/componentRegistry.d.ts.map +0 -1
- package/dist/templates/production-app/src/componentRegistry.js +0 -316
- package/dist/templates/production-app/src/main.d.ts +0 -9
- package/dist/templates/production-app/src/main.d.ts.map +0 -1
- package/dist/templates/production-app/src/main.js +0 -18
- package/dist/templates/production-app/vite.config.d.ts +0 -3
- package/dist/templates/production-app/vite.config.d.ts.map +0 -1
- package/dist/templates/production-app/vite.config.js +0 -71
- package/dist/test-storybooks/angular-material-storybook/src/main.js +0 -66
- package/dist/test-storybooks/chakra-storybook/vite.config.js +0 -6
- package/dist/test-storybooks/mantine-storybook/vite.config.js +0 -93
- package/dist/test-storybooks/web-components-shoelace/vite.config.js +0 -9
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/* Canvas styles */
|
|
2
|
-
|
|
3
|
-
.canvas {
|
|
4
|
-
flex: 1;
|
|
5
|
-
position: relative;
|
|
6
|
-
background: #fafafa;
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
height: 100%;
|
|
9
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.viewport {
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
|
-
position: relative;
|
|
16
|
-
transition: transform 0.2s ease-out;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.grid {
|
|
20
|
-
position: absolute;
|
|
21
|
-
top: 0;
|
|
22
|
-
left: 0;
|
|
23
|
-
right: 0;
|
|
24
|
-
bottom: 0;
|
|
25
|
-
background-image:
|
|
26
|
-
linear-gradient(0deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px),
|
|
27
|
-
linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
|
|
28
|
-
background-size: 8px 8px;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.componentContainer {
|
|
33
|
-
position: relative;
|
|
34
|
-
width: 100%;
|
|
35
|
-
min-height: 100vh;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.component {
|
|
39
|
-
position: relative;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
transition: outline 0.2s ease;
|
|
42
|
-
font-family: inherit;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.component:hover {
|
|
46
|
-
outline: 1px solid #93c5fd;
|
|
47
|
-
outline-offset: 2px;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.component.selected {
|
|
51
|
-
outline: 2px solid #3b82f6;
|
|
52
|
-
outline-offset: 2px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.component.hovered {
|
|
56
|
-
outline: 1px dashed #60a5fa;
|
|
57
|
-
outline-offset: 2px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.component.root {
|
|
61
|
-
cursor: default;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.emptyState {
|
|
65
|
-
display: flex;
|
|
66
|
-
flex-direction: column;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
height: 100%;
|
|
70
|
-
color: #6b7280;
|
|
71
|
-
text-align: center;
|
|
72
|
-
padding: 32px;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.emptyState p {
|
|
76
|
-
margin: 8px 0;
|
|
77
|
-
font-size: 16px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.emptyState .hint {
|
|
81
|
-
font-size: 14px;
|
|
82
|
-
color: #9ca3af;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.selectionOverlay {
|
|
86
|
-
position: absolute;
|
|
87
|
-
top: 0;
|
|
88
|
-
left: 0;
|
|
89
|
-
right: 0;
|
|
90
|
-
bottom: 0;
|
|
91
|
-
pointer-events: none;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/* Mode-specific styles */
|
|
95
|
-
.canvas[data-mode="view"] .component {
|
|
96
|
-
cursor: default;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.canvas[data-mode="view"] .component:hover {
|
|
100
|
-
outline: none;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/* Helper component indicators */
|
|
104
|
-
[data-helper] {
|
|
105
|
-
position: relative;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
[data-helper]::before {
|
|
109
|
-
content: attr(data-helper);
|
|
110
|
-
position: absolute;
|
|
111
|
-
top: 2px;
|
|
112
|
-
right: 2px;
|
|
113
|
-
font-size: 10px;
|
|
114
|
-
color: #9ca3af;
|
|
115
|
-
background: rgba(255, 255, 255, 0.9);
|
|
116
|
-
padding: 2px 4px;
|
|
117
|
-
border-radius: 2px;
|
|
118
|
-
pointer-events: none;
|
|
119
|
-
z-index: 1;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/* Draggable Component */
|
|
123
|
-
.draggableComponent {
|
|
124
|
-
position: relative;
|
|
125
|
-
cursor: move;
|
|
126
|
-
transition: opacity 0.2s;
|
|
127
|
-
font-family: inherit;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.draggableComponent.root {
|
|
131
|
-
cursor: default;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.draggableComponent.dragging {
|
|
135
|
-
opacity: 0.5;
|
|
136
|
-
cursor: grabbing;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.draggableComponent.selected {
|
|
140
|
-
outline: 2px solid #3b82f6;
|
|
141
|
-
outline-offset: 2px;
|
|
142
|
-
position: relative;
|
|
143
|
-
z-index: 10;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.draggableComponent.hovered {
|
|
147
|
-
outline: 1px dashed #93c5fd;
|
|
148
|
-
outline-offset: 2px;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.componentChildren {
|
|
152
|
-
position: relative;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.childWrapper {
|
|
156
|
-
position: relative;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* Insertion zones for drag and drop */
|
|
160
|
-
.insertionZone {
|
|
161
|
-
min-height: 4px;
|
|
162
|
-
transition: all 0.2s;
|
|
163
|
-
position: relative;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.insertionZone.active {
|
|
167
|
-
min-height: 24px;
|
|
168
|
-
background: rgba(59, 130, 246, 0.1);
|
|
169
|
-
border: 2px dashed #3b82f6;
|
|
170
|
-
border-radius: 4px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/* Drag ghost */
|
|
174
|
-
.dragGhost {
|
|
175
|
-
pointer-events: none;
|
|
176
|
-
opacity: 0.8;
|
|
177
|
-
transform: scale(1.05);
|
|
178
|
-
filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.newComponentGhost {
|
|
182
|
-
padding: 12px 24px;
|
|
183
|
-
background: white;
|
|
184
|
-
border: 2px solid #3b82f6;
|
|
185
|
-
border-radius: 8px;
|
|
186
|
-
font-weight: 500;
|
|
187
|
-
color: #3b82f6;
|
|
188
|
-
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
|
|
189
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CanvasWithDnd - Canvas with drag and drop support
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
export interface CanvasWithDndProps {
|
|
6
|
-
onReady?: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const CanvasWithDnd: React.FC<CanvasWithDndProps>;
|
|
9
|
-
//# sourceMappingURL=CanvasWithDnd.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasWithDnd.d.ts","sourceRoot":"","sources":["../../../../playground/components/Canvas/CanvasWithDnd.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAkD,MAAM,OAAO,CAAC;AAyBvE,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsQtD,CAAC"}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* CanvasWithDnd - Canvas with drag and drop support
|
|
4
|
-
*/
|
|
5
|
-
import { useEffect, useRef, useCallback } from 'react';
|
|
6
|
-
import { DndContext, DragOverlay, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
7
|
-
import { sortableKeyboardCoordinates, } from '@dnd-kit/sortable';
|
|
8
|
-
import { usePlaygroundStore } from '../../store/playgroundStore';
|
|
9
|
-
import { DragDropManager } from '../../services/DragDropManager';
|
|
10
|
-
import { ComponentRenderer } from './ComponentRenderer';
|
|
11
|
-
import { DropZone } from '../DropZone/DropZone';
|
|
12
|
-
import { DraggableComponent } from './DraggableComponent';
|
|
13
|
-
import styles from './Canvas.module.css';
|
|
14
|
-
export const CanvasWithDnd = ({ onReady }) => {
|
|
15
|
-
const canvasRef = useRef(null);
|
|
16
|
-
const dragDropManagerRef = useRef(null);
|
|
17
|
-
const store = usePlaygroundStore();
|
|
18
|
-
const { components, rootId, selectedIds, hoveredId, canvasZoom, canvasOffset, showGrid, gridSize, mode, draggedItem, selectComponent, deselectAll, setHoveredComponent } = store;
|
|
19
|
-
// Initialize DragDropManager
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!dragDropManagerRef.current) {
|
|
22
|
-
dragDropManagerRef.current = new DragDropManager(store);
|
|
23
|
-
}
|
|
24
|
-
}, [store]);
|
|
25
|
-
// Configure drag sensors
|
|
26
|
-
const sensors = useSensors(useSensor(PointerSensor, {
|
|
27
|
-
activationConstraint: {
|
|
28
|
-
distance: 8,
|
|
29
|
-
},
|
|
30
|
-
}), useSensor(KeyboardSensor, {
|
|
31
|
-
coordinateGetter: sortableKeyboardCoordinates,
|
|
32
|
-
}));
|
|
33
|
-
// Handle drag start
|
|
34
|
-
const handleDragStart = useCallback((event) => {
|
|
35
|
-
const { active } = event;
|
|
36
|
-
// Create dragged item based on what's being dragged
|
|
37
|
-
let draggedItem;
|
|
38
|
-
if (active.data.current?.type === 'component') {
|
|
39
|
-
// Dragging from palette
|
|
40
|
-
draggedItem = {
|
|
41
|
-
type: 'new-component',
|
|
42
|
-
componentType: active.data.current.componentType,
|
|
43
|
-
source: 'palette'
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
else if (active.data.current?.type === 'canvas-component') {
|
|
47
|
-
// Dragging existing component
|
|
48
|
-
const component = components.get(active.id);
|
|
49
|
-
if (component) {
|
|
50
|
-
draggedItem = {
|
|
51
|
-
id: component.id,
|
|
52
|
-
type: 'move-component',
|
|
53
|
-
component,
|
|
54
|
-
source: 'canvas'
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
dragDropManagerRef.current?.startDrag(draggedItem);
|
|
65
|
-
}, [components]);
|
|
66
|
-
// Handle drag move
|
|
67
|
-
const handleDragMove = useCallback((event) => {
|
|
68
|
-
// Update drag position for drop zone detection
|
|
69
|
-
// This would be enhanced with actual mouse position tracking
|
|
70
|
-
}, []);
|
|
71
|
-
// Handle drag end
|
|
72
|
-
const handleDragEnd = useCallback((event) => {
|
|
73
|
-
const { active, over } = event;
|
|
74
|
-
if (over && dragDropManagerRef.current) {
|
|
75
|
-
// Perform the drop
|
|
76
|
-
const result = dragDropManagerRef.current.endDrag();
|
|
77
|
-
if (result?.success) {
|
|
78
|
-
// Select the dropped component
|
|
79
|
-
if (active.data.current?.type === 'component') {
|
|
80
|
-
// New component was created, select it
|
|
81
|
-
// We'd need to track the created component ID
|
|
82
|
-
}
|
|
83
|
-
else if (active.data.current?.type === 'canvas-component') {
|
|
84
|
-
// Existing component was moved, keep it selected
|
|
85
|
-
selectComponent(active.id);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
// Cancelled drop
|
|
91
|
-
dragDropManagerRef.current?.cancelDrag();
|
|
92
|
-
}
|
|
93
|
-
}, [selectComponent]);
|
|
94
|
-
// Handle drag cancel
|
|
95
|
-
const handleDragCancel = useCallback((event) => {
|
|
96
|
-
dragDropManagerRef.current?.cancelDrag();
|
|
97
|
-
}, []);
|
|
98
|
-
// Handle canvas click for deselection
|
|
99
|
-
const handleCanvasClick = useCallback((e) => {
|
|
100
|
-
if (e.target === e.currentTarget) {
|
|
101
|
-
deselectAll();
|
|
102
|
-
}
|
|
103
|
-
}, [deselectAll]);
|
|
104
|
-
// Handle keyboard shortcuts
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
const handleKeyDown = (e) => {
|
|
107
|
-
// Delete selected components
|
|
108
|
-
if ((e.key === 'Delete' || e.key === 'Backspace') && selectedIds.size > 0) {
|
|
109
|
-
e.preventDefault();
|
|
110
|
-
selectedIds.forEach(id => {
|
|
111
|
-
if (id !== rootId) {
|
|
112
|
-
store.deleteComponent(id);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
// Select all
|
|
117
|
-
if (e.metaKey && e.key === 'a') {
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
store.selectAll();
|
|
120
|
-
}
|
|
121
|
-
// Deselect all
|
|
122
|
-
if (e.key === 'Escape') {
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
deselectAll();
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
128
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
129
|
-
}, [selectedIds, rootId, deselectAll, store]);
|
|
130
|
-
// Notify when ready
|
|
131
|
-
useEffect(() => {
|
|
132
|
-
onReady?.();
|
|
133
|
-
}, [onReady]);
|
|
134
|
-
// Get root component
|
|
135
|
-
const rootComponent = components.get(rootId);
|
|
136
|
-
if (!rootComponent) {
|
|
137
|
-
return (_jsx("div", { className: styles.canvas, children: _jsxs("div", { className: styles.emptyState, children: [_jsx("p", { children: "No components to display" }), _jsx("p", { className: styles.hint, children: "Use the AI Assistant to generate a layout or drag components from the palette" })] }) }));
|
|
138
|
-
}
|
|
139
|
-
// Render dragged component overlay
|
|
140
|
-
const renderDragOverlay = () => {
|
|
141
|
-
if (!draggedItem)
|
|
142
|
-
return null;
|
|
143
|
-
if (draggedItem.type === 'move-component' && draggedItem.component) {
|
|
144
|
-
return (_jsx("div", { className: styles.dragGhost, children: _jsx(ComponentRenderer, { component: draggedItem.component, isSelected: false, isHovered: false }) }));
|
|
145
|
-
}
|
|
146
|
-
if (draggedItem.type === 'new-component') {
|
|
147
|
-
return (_jsx("div", { className: styles.dragGhost, children: _jsx("div", { className: styles.newComponentGhost, children: draggedItem.componentType }) }));
|
|
148
|
-
}
|
|
149
|
-
return null;
|
|
150
|
-
};
|
|
151
|
-
return (_jsxs(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragMove: handleDragMove, onDragEnd: handleDragEnd, onDragCancel: handleDragCancel, children: [_jsx("div", { ref: canvasRef, className: styles.canvas, onClick: handleCanvasClick, "data-mode": mode, children: _jsxs("div", { className: styles.viewport, style: {
|
|
152
|
-
transform: `scale(${canvasZoom}) translate(${canvasOffset.x}px, ${canvasOffset.y}px)`,
|
|
153
|
-
transformOrigin: 'center center'
|
|
154
|
-
}, children: [showGrid && (_jsx("div", { className: styles.grid, style: {
|
|
155
|
-
backgroundSize: `${gridSize}px ${gridSize}px`
|
|
156
|
-
} })), _jsx("div", { className: styles.componentContainer, children: _jsx(DropZone, { id: "root-drop-zone", componentId: rootId, accepts: ['all'], showIndicator: mode === 'edit', children: _jsx(DraggableComponent, { component: rootComponent, isRoot: true, isSelected: selectedIds.has(rootId), isHovered: hoveredId === rootId, onSelect: (id) => selectComponent(id), onHover: (id) => setHoveredComponent(id) }) }) }), selectedIds.size > 0 && (_jsx("div", { className: styles.selectionOverlay }))] }) }), _jsx(DragOverlay, { children: renderDragOverlay() })] }));
|
|
157
|
-
};
|
|
158
|
-
//# sourceMappingURL=CanvasWithDnd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CanvasWithDnd.js","sourceRoot":"","sources":["../../../../playground/components/Canvas/CanvasWithDnd.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAW,MAAM,OAAO,CAAC;AACvE,OAAO,EACL,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACT,UAAU,EAKX,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,2BAA2B,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAMzC,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACzE,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;I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CAAC,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,GACxC,GACO,GACP,EAGL,WAAW,CAAC,IAAI,GAAG,CAAC,IAAI,CACvB,cAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,GAEjC,CACP,IACG,GACF,EAGN,KAAC,WAAW,cACT,iBAAiB,EAAE,GACR,IACH,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ComponentRenderer - Renders playground components recursively
|
|
3
|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import type { PlaygroundComponent } from '../../types';
|
|
6
|
-
export interface ComponentRendererProps {
|
|
7
|
-
component: PlaygroundComponent;
|
|
8
|
-
isRoot?: boolean;
|
|
9
|
-
isSelected?: boolean;
|
|
10
|
-
isHovered?: boolean;
|
|
11
|
-
onSelect?: (id: string) => void;
|
|
12
|
-
onHover?: (id: string | null) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const ComponentRenderer: React.FC<ComponentRendererProps>;
|
|
15
|
-
//# sourceMappingURL=ComponentRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentRenderer.d.ts","sourceRoot":"","sources":["../../../../playground/components/Canvas/ComponentRenderer.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmS9D,CAAC"}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* ComponentRenderer - Renders playground components recursively
|
|
4
|
-
*/
|
|
5
|
-
import { useMemo, useCallback } from 'react';
|
|
6
|
-
import { usePlaygroundStore } from '../../store/playgroundStore';
|
|
7
|
-
import styles from './Canvas.module.css';
|
|
8
|
-
export const ComponentRenderer = ({ component, isRoot = false, isSelected = false, isHovered = false, onSelect, onHover }) => {
|
|
9
|
-
const { components } = usePlaygroundStore();
|
|
10
|
-
// Handle component click
|
|
11
|
-
const handleClick = useCallback((e) => {
|
|
12
|
-
e.stopPropagation();
|
|
13
|
-
onSelect?.(component.id);
|
|
14
|
-
}, [component.id, onSelect]);
|
|
15
|
-
// Handle hover
|
|
16
|
-
const handleMouseEnter = useCallback(() => {
|
|
17
|
-
onHover?.(component.id);
|
|
18
|
-
}, [component.id, onHover]);
|
|
19
|
-
const handleMouseLeave = useCallback(() => {
|
|
20
|
-
onHover?.(null);
|
|
21
|
-
}, [onHover]);
|
|
22
|
-
// Combine styles with font inheritance
|
|
23
|
-
const combinedStyles = useMemo(() => ({
|
|
24
|
-
fontFamily: 'inherit',
|
|
25
|
-
...component.style,
|
|
26
|
-
...(isRoot ? { minHeight: '100vh', width: '100%' } : {})
|
|
27
|
-
}), [component.style, isRoot]);
|
|
28
|
-
// Render based on component type
|
|
29
|
-
const renderComponent = () => {
|
|
30
|
-
// Handle text nodes
|
|
31
|
-
if (component.type === 'Text') {
|
|
32
|
-
return _jsx("span", { children: component.textContent });
|
|
33
|
-
}
|
|
34
|
-
// Handle layout helper components
|
|
35
|
-
if (component.isHelper) {
|
|
36
|
-
return renderHelperComponent();
|
|
37
|
-
}
|
|
38
|
-
// For now, render as a div with placeholder
|
|
39
|
-
// In production, this would dynamically load the actual component
|
|
40
|
-
return renderPlaceholderComponent();
|
|
41
|
-
};
|
|
42
|
-
// Render helper components (FlexContainer, GridContainer, etc.)
|
|
43
|
-
const renderHelperComponent = () => {
|
|
44
|
-
const { type, props, children } = component;
|
|
45
|
-
switch (type) {
|
|
46
|
-
case 'FlexContainer':
|
|
47
|
-
return (_jsx("div", { style: {
|
|
48
|
-
display: 'flex',
|
|
49
|
-
flexDirection: props.direction || 'row',
|
|
50
|
-
justifyContent: props.justify || 'flex-start',
|
|
51
|
-
alignItems: props.align || 'stretch',
|
|
52
|
-
gap: props.gap ? `${props.gap}px` : undefined,
|
|
53
|
-
flexWrap: props.wrap || 'nowrap',
|
|
54
|
-
...combinedStyles
|
|
55
|
-
}, "data-helper": "flex", children: renderChildren() }));
|
|
56
|
-
case 'GridContainer':
|
|
57
|
-
return (_jsx("div", { style: {
|
|
58
|
-
display: 'grid',
|
|
59
|
-
gridTemplateColumns: props.columns || 'auto',
|
|
60
|
-
gridTemplateRows: props.rows || 'auto',
|
|
61
|
-
gap: props.gap ? `${props.gap}px` : undefined,
|
|
62
|
-
...combinedStyles
|
|
63
|
-
}, "data-helper": "grid", children: renderChildren() }));
|
|
64
|
-
case 'Spacer':
|
|
65
|
-
return (_jsx("div", { style: {
|
|
66
|
-
width: props.width || 'auto',
|
|
67
|
-
height: props.height || '16px',
|
|
68
|
-
...combinedStyles
|
|
69
|
-
}, "data-helper": "spacer" }));
|
|
70
|
-
default:
|
|
71
|
-
return renderPlaceholderComponent();
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
// Render placeholder for actual components
|
|
75
|
-
const renderPlaceholderComponent = () => {
|
|
76
|
-
const { type, props, children } = component;
|
|
77
|
-
// Common component rendering
|
|
78
|
-
switch (type) {
|
|
79
|
-
case 'Container':
|
|
80
|
-
case 'Box':
|
|
81
|
-
case 'div':
|
|
82
|
-
return (_jsx("div", { style: combinedStyles, ...props, children: renderChildren() }));
|
|
83
|
-
case 'Button':
|
|
84
|
-
return (_jsx("button", { style: {
|
|
85
|
-
fontFamily: 'inherit',
|
|
86
|
-
border: '1px solid #d1d5db',
|
|
87
|
-
borderRadius: '6px',
|
|
88
|
-
padding: '8px 16px',
|
|
89
|
-
backgroundColor: '#3b82f6',
|
|
90
|
-
color: 'white',
|
|
91
|
-
cursor: 'pointer',
|
|
92
|
-
...combinedStyles
|
|
93
|
-
}, ...props, disabled: props.disabled || false, children: props.children || props.text || 'Button' }));
|
|
94
|
-
case 'Card':
|
|
95
|
-
return (_jsxs("div", { style: {
|
|
96
|
-
padding: '16px',
|
|
97
|
-
borderRadius: '8px',
|
|
98
|
-
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
99
|
-
backgroundColor: 'white',
|
|
100
|
-
...combinedStyles
|
|
101
|
-
}, ...props, children: [props.title && _jsx("h3", { children: props.title }), props.children || renderChildren()] }));
|
|
102
|
-
case 'Input':
|
|
103
|
-
return (_jsx("input", { type: props.type || 'text', placeholder: props.placeholder, value: props.value || '', style: {
|
|
104
|
-
fontFamily: 'inherit',
|
|
105
|
-
border: '1px solid #d1d5db',
|
|
106
|
-
borderRadius: '4px',
|
|
107
|
-
padding: '8px 12px',
|
|
108
|
-
fontSize: '14px',
|
|
109
|
-
...combinedStyles
|
|
110
|
-
}, ...props, readOnly: true }));
|
|
111
|
-
case 'Text':
|
|
112
|
-
case 'Typography':
|
|
113
|
-
case 'p':
|
|
114
|
-
return (_jsx("p", { style: {
|
|
115
|
-
fontFamily: 'inherit',
|
|
116
|
-
margin: '0',
|
|
117
|
-
...combinedStyles
|
|
118
|
-
}, ...props, children: props.children || component.textContent }));
|
|
119
|
-
case 'Heading':
|
|
120
|
-
case 'h1':
|
|
121
|
-
return (_jsx("h1", { style: {
|
|
122
|
-
fontFamily: 'inherit',
|
|
123
|
-
margin: '0 0 16px 0',
|
|
124
|
-
fontSize: '2rem',
|
|
125
|
-
fontWeight: 'bold',
|
|
126
|
-
...combinedStyles
|
|
127
|
-
}, ...props, children: props.children || component.textContent }));
|
|
128
|
-
case 'h2':
|
|
129
|
-
return (_jsx("h2", { style: {
|
|
130
|
-
fontFamily: 'inherit',
|
|
131
|
-
margin: '0 0 14px 0',
|
|
132
|
-
fontSize: '1.5rem',
|
|
133
|
-
fontWeight: 'bold',
|
|
134
|
-
...combinedStyles
|
|
135
|
-
}, ...props, children: props.children || component.textContent }));
|
|
136
|
-
case 'h3':
|
|
137
|
-
return (_jsx("h3", { style: {
|
|
138
|
-
fontFamily: 'inherit',
|
|
139
|
-
margin: '0 0 12px 0',
|
|
140
|
-
fontSize: '1.25rem',
|
|
141
|
-
fontWeight: 'bold',
|
|
142
|
-
...combinedStyles
|
|
143
|
-
}, ...props, children: props.children || component.textContent }));
|
|
144
|
-
default:
|
|
145
|
-
// Generic component placeholder
|
|
146
|
-
return (_jsxs("div", { style: {
|
|
147
|
-
fontFamily: 'inherit',
|
|
148
|
-
padding: '8px',
|
|
149
|
-
border: '1px dashed #ccc',
|
|
150
|
-
borderRadius: '4px',
|
|
151
|
-
backgroundColor: '#f9f9f9',
|
|
152
|
-
minHeight: '40px',
|
|
153
|
-
...combinedStyles
|
|
154
|
-
}, ...props, children: [_jsx("span", { style: { fontSize: '12px', color: '#666', fontFamily: 'inherit' }, children: type }), renderChildren()] }));
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
// Render children recursively
|
|
158
|
-
const renderChildren = () => {
|
|
159
|
-
if (!component.children || component.children.length === 0) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
return component.children.map((childId) => {
|
|
163
|
-
const child = components.get(childId);
|
|
164
|
-
if (!child)
|
|
165
|
-
return null;
|
|
166
|
-
return (_jsx(ComponentRenderer, { component: child, isSelected: isSelected, isHovered: isHovered, onSelect: onSelect, onHover: onHover }, child.id));
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
// Main render
|
|
170
|
-
return (_jsx("div", { className: `
|
|
171
|
-
${styles.component}
|
|
172
|
-
${isSelected ? styles.selected : ''}
|
|
173
|
-
${isHovered ? styles.hovered : ''}
|
|
174
|
-
${isRoot ? styles.root : ''}
|
|
175
|
-
`, onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, "data-component-id": component.id, "data-component-type": component.type, children: renderComponent() }));
|
|
176
|
-
};
|
|
177
|
-
//# sourceMappingURL=ComponentRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentRenderer.js","sourceRoot":"","sources":["../../../../playground/components/Canvas/ComponentRenderer.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAc,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAWzC,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,SAAS,EACT,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,OAAO,EACR,EAAE,EAAE;IACH,MAAM,EAAE,UAAU,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAC5C,yBAAyB;IACzB,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAmB,EAAE,EAAE;QACtD,CAAC,CAAC,eAAe,EAAE,CAAC;QACpB,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE7B,eAAe;IACf,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,EAAE;QACxC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5B,MAAM,gBA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|
-
*/
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import type { PlaygroundComponent } from '../../types';
|
|
6
|
-
export interface DraggableComponentProps {
|
|
7
|
-
component: PlaygroundComponent;
|
|
8
|
-
isRoot?: boolean;
|
|
9
|
-
isSelected?: boolean;
|
|
10
|
-
isHovered?: boolean;
|
|
11
|
-
onSelect?: (id: string) => void;
|
|
12
|
-
onHover?: (id: string | null) => void;
|
|
13
|
-
}
|
|
14
|
-
export declare const DraggableComponent: React.FC<DraggableComponentProps>;
|
|
15
|
-
//# sourceMappingURL=DraggableComponent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableComponent.d.ts","sourceRoot":"","sources":["../../../../playground/components/Canvas/DraggableComponent.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAsB,MAAM,OAAO,CAAC;AAK3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA0GhE,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* DraggableComponent - Wrapper for draggable components in the canvas
|
|
4
|
-
*/
|
|
5
|
-
import { useCallback } from 'react';
|
|
6
|
-
import { useDraggable } from '@dnd-kit/core';
|
|
7
|
-
import { ComponentRenderer } from './ComponentRenderer';
|
|
8
|
-
import { DropZone } from '../DropZone/DropZone';
|
|
9
|
-
import { usePlaygroundStore } from '../../store/playgroundStore';
|
|
10
|
-
import styles from './Canvas.module.css';
|
|
11
|
-
export const DraggableComponent = ({ component, isRoot = false, isSelected = false, isHovered = false, onSelect, onHover }) => {
|
|
12
|
-
const { components, canvasZoom, canvasOffset } = usePlaygroundStore();
|
|
13
|
-
const { attributes, listeners, setNodeRef, transform, isDragging } = useDraggable({
|
|
14
|
-
id: component.id,
|
|
15
|
-
disabled: isRoot, // Root component should not be draggable
|
|
16
|
-
data: {
|
|
17
|
-
type: 'canvas-component',
|
|
18
|
-
component
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
const handleClick = useCallback((e) => {
|
|
22
|
-
e.stopPropagation();
|
|
23
|
-
onSelect?.(component.id);
|
|
24
|
-
}, [component.id, onSelect]);
|
|
25
|
-
const handleMouseEnter = useCallback(() => {
|
|
26
|
-
onHover?.(component.id);
|
|
27
|
-
}, [component.id, onHover]);
|
|
28
|
-
const handleMouseLeave = useCallback(() => {
|
|
29
|
-
onHover?.(null);
|
|
30
|
-
}, [onHover]);
|
|
31
|
-
const style = transform ? {
|
|
32
|
-
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,
|
|
33
|
-
opacity: isDragging ? 0.5 : undefined,
|
|
34
|
-
zIndex: isDragging ? 1000 : undefined
|
|
35
|
-
} : undefined;
|
|
36
|
-
return (_jsxs("div", { ref: setNodeRef, style: style, className: `
|
|
37
|
-
${styles.draggableComponent}
|
|
38
|
-
${isSelected ? styles.selected : ''}
|
|
39
|
-
${isHovered ? styles.hovered : ''}
|
|
40
|
-
${isDragging ? styles.dragging : ''}
|
|
41
|
-
${isRoot ? styles.root : ''}
|
|
42
|
-
`, onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, "data-component-id": component.id, ...(!isRoot ? listeners : {}), ...(!isRoot ? attributes : {}), children: [_jsx(ComponentRenderer, { component: component, isSelected: isSelected, isHovered: isHovered }), component.children && component.children.length > 0 && (_jsx("div", { className: styles.componentChildren, children: component.children.map((childId, index) => {
|
|
43
|
-
const child = components.get(childId);
|
|
44
|
-
if (!child)
|
|
45
|
-
return null;
|
|
46
|
-
return (_jsxs("div", { className: styles.childWrapper, children: [_jsx(DropZone, { id: `${component.id}-before-${index}`, componentId: component.id, insertIndex: index, accepts: ['all'], showIndicator: false, className: styles.insertionZone }), _jsx(DraggableComponent, { component: child, isSelected: false, isHovered: false, onSelect: onSelect, onHover: onHover }), index === component.children.length - 1 && (_jsx(DropZone, { id: `${component.id}-after-${index}`, componentId: component.id, insertIndex: index + 1, accepts: ['all'], showIndicator: false, className: styles.insertionZone }))] }, child.id));
|
|
47
|
-
}) }))] }));
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=DraggableComponent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableComponent.js","sourceRoot":"","sources":["../../../../playground/components/Canvas/DraggableComponent.tsx"],"names":[],"mappings":";AAAA;;GAEG;AAEH,OAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAWzC,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,SAAS,EACT,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,OAAO,EACR,EAAE,EAAE;IACH,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACtE,MA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