symbiote-ui 0.3.0-alpha.4
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/CHANGELOG.md +46 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/canvas/AutoLayout.js +731 -0
- package/canvas/Breadcrumb/Breadcrumb.css.js +75 -0
- package/canvas/Breadcrumb/Breadcrumb.js +96 -0
- package/canvas/Breadcrumb/Breadcrumb.tpl.js +7 -0
- package/canvas/CanvasConnectionRenderer.js +971 -0
- package/canvas/CanvasGraph/CanvasGraph.css.js +29 -0
- package/canvas/CanvasGraph/CanvasGraph.js +1697 -0
- package/canvas/CanvasGraph/CanvasGraphDrawState.js +280 -0
- package/canvas/CanvasGraph/CanvasGraphGeometry.js +194 -0
- package/canvas/CanvasViewport.js +550 -0
- package/canvas/ConnectionRenderer.js +1283 -0
- package/canvas/FlowSimulator.js +326 -0
- package/canvas/ForceLayout.js +226 -0
- package/canvas/ForceWorker.js +1303 -0
- package/canvas/FrameManager.js +223 -0
- package/canvas/GraphExplorerShell/GraphExplorerShell.css.js +136 -0
- package/canvas/GraphExplorerShell/GraphExplorerShell.js +129 -0
- package/canvas/GraphExplorerShell/GraphExplorerShell.tpl.js +12 -0
- package/canvas/GraphTabs/GraphTabs.css.js +101 -0
- package/canvas/GraphTabs/GraphTabs.js +189 -0
- package/canvas/GraphTabs/GraphTabs.tpl.js +12 -0
- package/canvas/LODManager.js +88 -0
- package/canvas/Minimap/Minimap.css.js +73 -0
- package/canvas/Minimap/Minimap.js +210 -0
- package/canvas/Minimap/Minimap.tpl.js +7 -0
- package/canvas/NodeCanvas/NodeCanvas.css.js +398 -0
- package/canvas/NodeCanvas/NodeCanvas.js +1499 -0
- package/canvas/NodeCanvas/NodeCanvas.tpl.js +22 -0
- package/canvas/NodeSearch/NodeSearch.css.js +97 -0
- package/canvas/NodeSearch/NodeSearch.js +140 -0
- package/canvas/NodeSearch/NodeSearch.tpl.js +25 -0
- package/canvas/NodeViewManager.js +748 -0
- package/canvas/PcbRouteDiagnostics.js +463 -0
- package/canvas/PcbRouter.js +1127 -0
- package/canvas/PinExpansion.js +134 -0
- package/canvas/PseudoConnection.js +84 -0
- package/canvas/SelectionSync.js +163 -0
- package/canvas/SubgraphManager.js +203 -0
- package/canvas/SubgraphRouter.js +452 -0
- package/canvas/ViewportActions.js +473 -0
- package/canvas/graph-explorer.js +339 -0
- package/canvas/graph-layout.js +148 -0
- package/canvas/graph-model.js +68 -0
- package/canvas/html-in-canvas.js +202 -0
- package/canvas/project-graph-builder.js +440 -0
- package/canvas/project-graph-model.js +183 -0
- package/chat/ChatComposer/ChatComposer.css.js +652 -0
- package/chat/ChatComposer/ChatComposer.js +304 -0
- package/chat/ChatList/ChatList.css.js +102 -0
- package/chat/ChatList/ChatList.js +99 -0
- package/chat/ChatList/ChatList.tpl.js +20 -0
- package/chat/ChatListItem/ChatListItem.css.js +117 -0
- package/chat/ChatListItem/ChatListItem.js +32 -0
- package/chat/ChatListItem/ChatListItem.tpl.js +17 -0
- package/chat/ChatMessageItem/ChatMessageItem.css.js +628 -0
- package/chat/ChatMessageItem/ChatMessageItem.js +156 -0
- package/chat/ChatSidebar/ChatSidebar.css.js +150 -0
- package/chat/ChatSidebar/ChatSidebar.js +230 -0
- package/chat/ChatSidebar/ChatSidebar.tpl.js +18 -0
- package/chat/ChatSidebar/constants.js +11 -0
- package/chat/ChatSidebarItem/ChatSidebarItem.css.js +445 -0
- package/chat/ChatSidebarItem/ChatSidebarItem.js +304 -0
- package/chat/ChatTranscript/ChatTranscript.css.js +90 -0
- package/chat/ChatTranscript/ChatTranscript.js +244 -0
- package/chat/chat-context.js +123 -0
- package/chat/message-model.js +156 -0
- package/cli.js +20 -0
- package/control/Button/Button.css.js +93 -0
- package/control/Button/Button.js +78 -0
- package/control/Button/Button.tpl.js +3 -0
- package/control/Field/Field.css.js +91 -0
- package/control/Field/Field.js +17 -0
- package/control/Field/Field.tpl.js +3 -0
- package/core/Connection.js +47 -0
- package/core/Editor.js +449 -0
- package/core/Frame.js +33 -0
- package/core/GraphMermaid.js +348 -0
- package/core/GraphText.js +228 -0
- package/core/Node.js +145 -0
- package/core/Portal.js +106 -0
- package/core/Socket.js +187 -0
- package/core/SubgraphNode.js +121 -0
- package/core/base-path.js +55 -0
- package/core/dom-utils.js +14 -0
- package/core/index.js +18 -0
- package/core/local-cache.js +26 -0
- package/core/state-sync.js +227 -0
- package/custom-elements.json +6380 -0
- package/discover.js +240 -0
- package/display/Badge/Badge.css.js +44 -0
- package/display/Badge/Badge.js +17 -0
- package/display/Badge/Badge.tpl.js +3 -0
- package/display/Banner/Banner.css.js +61 -0
- package/display/Banner/Banner.js +17 -0
- package/display/Banner/Banner.tpl.js +3 -0
- package/display/CodeBlock/CodeBlock.css.js +194 -0
- package/display/CodeBlock/CodeBlock.js +220 -0
- package/display/CodeBlock/CodeBlock.tpl.js +11 -0
- package/display/DataTable/DataTable.css.js +101 -0
- package/display/DataTable/DataTable.js +136 -0
- package/display/DataTable/DataTable.tpl.js +13 -0
- package/display/EmptyState/EmptyState.css.js +33 -0
- package/display/EmptyState/EmptyState.js +17 -0
- package/display/EmptyState/EmptyState.tpl.js +3 -0
- package/display/EventFeed/EventFeed.css.js +145 -0
- package/display/EventFeed/EventFeed.js +64 -0
- package/display/EventFeed/EventFeed.tpl.js +14 -0
- package/display/EventFeed/EventFeedItem.js +116 -0
- package/display/EventFeed/EventFeedItem.tpl.js +22 -0
- package/display/LoadingOverlay/LoadingOverlay.css.js +91 -0
- package/display/LoadingOverlay/LoadingOverlay.js +48 -0
- package/display/LoadingOverlay/LoadingOverlay.tpl.js +12 -0
- package/display/Metric/Metric.css.js +60 -0
- package/display/Metric/Metric.js +17 -0
- package/display/Metric/Metric.tpl.js +6 -0
- package/display/OutputGraphPreview/OutputGraphPreview.css.js +122 -0
- package/display/OutputGraphPreview/OutputGraphPreview.js +89 -0
- package/display/OutputGraphPreview/OutputGraphPreview.tpl.js +13 -0
- package/display/OutputListPreview/OutputListPreview.css.js +109 -0
- package/display/OutputListPreview/OutputListPreview.js +77 -0
- package/display/OutputListPreview/OutputListPreview.tpl.js +13 -0
- package/display/SourceEditor/SourceEditor.css.js +39 -0
- package/display/SourceEditor/SourceEditor.js +129 -0
- package/display/SourceEditor/SourceEditor.tpl.js +10 -0
- package/display/SourceViewer/SourceViewer.css.js +80 -0
- package/display/SourceViewer/SourceViewer.js +418 -0
- package/display/SourceViewer/SourceViewer.tpl.js +17 -0
- package/display/StatusRibbon/StatusRibbon.css.js +73 -0
- package/display/StatusRibbon/StatusRibbon.js +87 -0
- package/display/StatusRibbon/StatusRibbon.tpl.js +7 -0
- package/display/event-feed-adapter.js +72 -0
- package/display/format-utils.js +29 -0
- package/display/highlight.js +659 -0
- package/display/icons.js +37 -0
- package/display/markdown-formatter.js +60 -0
- package/display/network-approval-page.js +487 -0
- package/display/output-preview.js +261 -0
- package/effects/CellBg/CellBg.css.js +33 -0
- package/effects/CellBg/CellBg.js +410 -0
- package/effects/CellBg/CellBg.tpl.js +5 -0
- package/graph/canvas-adapter.js +223 -0
- package/graph/graph-algorithms.js +31 -0
- package/graph/index.js +46 -0
- package/graph/model.js +176 -0
- package/graph/project-graph-build.js +66 -0
- package/graph/project-graph-metadata.js +253 -0
- package/graph/project-package.js +128 -0
- package/graph/project-runtime.js +116 -0
- package/graph/project-transaction.js +284 -0
- package/graph/skeleton-utils.js +84 -0
- package/graph/theme-contract.js +36 -0
- package/graph/transaction-parser.js +56 -0
- package/icons/MaterialSymbols.js +69 -0
- package/icons/material-symbols-outlined-400.ttf +0 -0
- package/icons/material-symbols.css +24 -0
- package/index.js +95 -0
- package/inspector/InspectorPanel/InspectorPanel.css.js +375 -0
- package/inspector/InspectorPanel/InspectorPanel.js +368 -0
- package/inspector/InspectorPanel/InspectorPanel.tpl.js +96 -0
- package/inspector/TemplatePreview/TemplatePreview.css.js +104 -0
- package/inspector/TemplatePreview/TemplatePreview.js +145 -0
- package/inspector/TemplatePreview/TemplatePreview.tpl.js +33 -0
- package/interactions/ConnectFlow.js +304 -0
- package/interactions/Drag.js +104 -0
- package/interactions/Selector.js +133 -0
- package/interactions/SnapGrid.js +66 -0
- package/interactions/Zoom.js +139 -0
- package/layout/ActionZone/ActionZone.css.js +88 -0
- package/layout/ActionZone/ActionZone.js +261 -0
- package/layout/ActionZone/ActionZone.tpl.js +11 -0
- package/layout/CrossLayoutPortalBridge/CrossLayoutPortalBridge.js +255 -0
- package/layout/Layout/Layout.css.js +91 -0
- package/layout/Layout/Layout.js +637 -0
- package/layout/Layout/Layout.tpl.js +27 -0
- package/layout/LayoutNode/LayoutNode.css.js +302 -0
- package/layout/LayoutNode/LayoutNode.js +509 -0
- package/layout/LayoutNode/LayoutNode.tpl.js +39 -0
- package/layout/LayoutPreview/LayoutPreview.css.js +46 -0
- package/layout/LayoutPreview/LayoutPreview.js +102 -0
- package/layout/LayoutPreview/LayoutPreview.tpl.js +6 -0
- package/layout/LayoutRouter/LayoutRouter.js +274 -0
- package/layout/LayoutRouter/SectionRegistry.js +135 -0
- package/layout/LayoutRouter/routerSync.js +250 -0
- package/layout/LayoutSidebar/LayoutSidebar.css.js +411 -0
- package/layout/LayoutSidebar/LayoutSidebar.js +368 -0
- package/layout/LayoutSidebar/LayoutSidebar.tpl.js +26 -0
- package/layout/LayoutSidebar/SidebarSection.css.js +20 -0
- package/layout/LayoutSidebar/SidebarSection.js +184 -0
- package/layout/LayoutSidebar/SidebarSection.tpl.js +22 -0
- package/layout/LayoutTree.js +373 -0
- package/layout/PanelMenu/PanelMenu.css.js +43 -0
- package/layout/PanelMenu/PanelMenu.js +95 -0
- package/layout/PanelMenu/PanelMenu.tpl.js +17 -0
- package/layout/ProjectTabs/ProjectTabs.css.js +188 -0
- package/layout/ProjectTabs/ProjectTabs.js +77 -0
- package/layout/ProjectTabs/ProjectTabs.tpl.js +15 -0
- package/layout/index.js +40 -0
- package/list/ListDetailShell/ListDetailShell.css.js +128 -0
- package/list/ListDetailShell/ListDetailShell.js +72 -0
- package/list/ListDetailShell/ListDetailShell.tpl.js +36 -0
- package/list/ListItem/ListItem.css.js +111 -0
- package/list/ListItem/ListItem.js +66 -0
- package/list/ListItem/ListItem.tpl.js +18 -0
- package/locale/index.js +503 -0
- package/manifest/component-registry.js +2446 -0
- package/manifest/graph-schema.js +285 -0
- package/manifest/index.js +6 -0
- package/manifest/project-schema-catalog.js +246 -0
- package/manifest/rule-catalog.js +201 -0
- package/manifest/theme-catalog.js +2149 -0
- package/manifest/ui-schema-catalog.js +334 -0
- package/menu/ContextMenu/ContextMenu.css.js +61 -0
- package/menu/ContextMenu/ContextMenu.js +82 -0
- package/menu/ContextMenu/ContextMenu.tpl.js +19 -0
- package/navigation/QuickOpen/QuickOpen.css.js +92 -0
- package/navigation/QuickOpen/QuickOpen.js +185 -0
- package/navigation/QuickOpen/QuickOpen.tpl.js +15 -0
- package/navigation/quick-open-utils.js +101 -0
- package/node/CtrlItem/CtrlItem.css.js +41 -0
- package/node/CtrlItem/CtrlItem.js +24 -0
- package/node/CtrlItem/CtrlItem.tpl.js +17 -0
- package/node/GraphFrame/GraphFrame.css.js +66 -0
- package/node/GraphFrame/GraphFrame.js +32 -0
- package/node/GraphFrame/GraphFrame.tpl.js +13 -0
- package/node/GraphNode/GraphNode.css.js +815 -0
- package/node/GraphNode/GraphNode.js +173 -0
- package/node/GraphNode/GraphNode.tpl.js +33 -0
- package/node/NodeCallout/NodeCallout.css.js +91 -0
- package/node/NodeCallout/NodeCallout.js +281 -0
- package/node/NodeCallout/NodeCallout.tpl.js +8 -0
- package/node/NodeSocket/NodeSocket.css.js +68 -0
- package/node/NodeSocket/NodeSocket.js +26 -0
- package/node/NodeSocket/NodeSocket.tpl.js +7 -0
- package/node/PortItem/PortItem.css.js +93 -0
- package/node/PortItem/PortItem.js +87 -0
- package/node/PortItem/PortItem.tpl.js +10 -0
- package/package.json +165 -0
- package/palette/PaletteBrowser/PaletteBrowser.css.js +143 -0
- package/palette/PaletteBrowser/PaletteBrowser.js +152 -0
- package/palette/PaletteBrowser/PaletteBrowser.tpl.js +23 -0
- package/plugins/History.js +408 -0
- package/plugins/Readonly.js +60 -0
- package/rules/symbiote-3x.json +170 -0
- package/schemas/component-descriptor-v1.json +91 -0
- package/schemas/component-descriptor-v2.json +145 -0
- package/schemas/graph-model-v1.json +179 -0
- package/schemas/graph-v1.json +91 -0
- package/schemas/project-package-v1.json +102 -0
- package/schemas/project-transaction-v1.json +114 -0
- package/schemas/runtime-ui-v1.json +80 -0
- package/schemas/theme-rule-block-v1.json +73 -0
- package/shapes/CircleShape.js +79 -0
- package/shapes/CommentShape.js +35 -0
- package/shapes/DiamondShape.js +130 -0
- package/shapes/NodeShape.js +79 -0
- package/shapes/PillShape.js +91 -0
- package/shapes/RectShape.js +84 -0
- package/shapes/SVGShape.js +525 -0
- package/shapes/index.js +63 -0
- package/surface/Card/Card.css.js +57 -0
- package/surface/Card/Card.js +17 -0
- package/surface/Card/Card.tpl.js +3 -0
- package/themes/Palette.js +30 -0
- package/themes/Skin.js +113 -0
- package/themes/Theme.js +82 -0
- package/themes/carbon.js +135 -0
- package/themes/dark.js +140 -0
- package/themes/default-dark.js +714 -0
- package/themes/default-provider.css +635 -0
- package/themes/default-provider.js +718 -0
- package/themes/ebook.js +136 -0
- package/themes/grey.js +137 -0
- package/themes/light.js +139 -0
- package/themes/neon.js +138 -0
- package/themes/pcb.js +273 -0
- package/themes/synthwave.js +138 -0
- package/tokens/base.json +29 -0
- package/tokens/themes/carbon.json +11 -0
- package/tokens/themes/dark.json +12 -0
- package/tokens/themes/default-dark.json +1543 -0
- package/tokens/themes/default-provider.json +1543 -0
- package/tokens/themes/ebook.json +11 -0
- package/tokens/themes/grey.json +11 -0
- package/tokens/themes/light.json +12 -0
- package/tokens/themes/neon.json +11 -0
- package/tokens/themes/pcb.json +11 -0
- package/tokens/themes/synthwave.json +11 -0
- package/toolbar/QuickToolbar/QuickToolbar.css.js +152 -0
- package/toolbar/QuickToolbar/QuickToolbar.js +529 -0
- package/toolbar/QuickToolbar/QuickToolbar.tpl.js +34 -0
- package/tree/TreePanel/TreePanel.css.js +112 -0
- package/tree/TreePanel/TreePanel.js +147 -0
- package/tree/TreePanel/TreePanel.tpl.js +18 -0
- package/tree/TreeView/TreeView.css.js +122 -0
- package/tree/TreeView/TreeView.js +365 -0
- package/tree/TreeView/TreeView.tpl.js +10 -0
- package/ui/dialogs.js +221 -0
- package/ui/host-adapters.js +114 -0
- package/ui/index.js +660 -0
- package/ui/locale.js +50 -0
- package/ui/overlay-stack.js +89 -0
- package/ui/shared-styles.js +26 -0
- package/webmcp.js +37 -0
- package/xr/deep-graph.js +646 -0
- package/xr/emulation.js +198 -0
- package/xr/gesture.js +228 -0
- package/xr/html-canvas-renderer.js +472 -0
- package/xr/index.js +15 -0
- package/xr/layout-projection.js +1046 -0
- package/xr/panel-frame.js +128 -0
- package/xr/panel-host.js +267 -0
- package/xr/pointer.js +258 -0
- package/xr/scene-controller.js +242 -0
- package/xr/spatial-scene.js +212 -0
- package/xr/theme-bridge.js +105 -0
- package/xr/three-webxr-adapter.js +3439 -0
- package/xr/webgl-layer-renderer.js +419 -0
- package/xr/webxr.js +679 -0
- package/xr/workbench.js +516 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://rnd-pro.github.io/symbiote-node/schemas/project-transaction-v1.json",
|
|
4
|
+
"title": "Symbiote Project Transaction",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version", "id", "operations"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": "project-transaction-v1" },
|
|
10
|
+
"id": { "type": "string", "minLength": 1 },
|
|
11
|
+
"targetProject": { "type": "string" },
|
|
12
|
+
"operations": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": { "$ref": "#/$defs/operation" },
|
|
15
|
+
"minItems": 1
|
|
16
|
+
},
|
|
17
|
+
"metadata": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"$defs": {
|
|
23
|
+
"operation": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{ "$ref": "#/$defs/graphAddNodeOperation" },
|
|
26
|
+
{ "$ref": "#/$defs/graphAddEdgeOperation" },
|
|
27
|
+
{ "$ref": "#/$defs/layoutAddPanelOperation" },
|
|
28
|
+
{ "$ref": "#/$defs/layoutSetRootOperation" },
|
|
29
|
+
{ "$ref": "#/$defs/layoutUpdateNodeOperation" },
|
|
30
|
+
{ "$ref": "#/$defs/themeSetModifierOperation" }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"graphAddNodeOperation": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": true,
|
|
36
|
+
"required": ["type", "graph", "node"],
|
|
37
|
+
"properties": {
|
|
38
|
+
"type": { "const": "graph.addNode" },
|
|
39
|
+
"graph": { "type": "string", "minLength": 1 },
|
|
40
|
+
"node": { "$ref": "graph-model-v1.json#/$defs/node" }
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"graphAddEdgeOperation": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"additionalProperties": true,
|
|
46
|
+
"required": ["type", "graph", "edge"],
|
|
47
|
+
"properties": {
|
|
48
|
+
"type": { "const": "graph.addEdge" },
|
|
49
|
+
"graph": { "type": "string", "minLength": 1 },
|
|
50
|
+
"edge": { "$ref": "graph-model-v1.json#/$defs/edge" }
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"layoutAddPanelOperation": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"additionalProperties": true,
|
|
56
|
+
"required": ["type", "layout", "panel"],
|
|
57
|
+
"properties": {
|
|
58
|
+
"type": { "const": "layout.addPanel" },
|
|
59
|
+
"layout": { "type": "string", "minLength": 1 },
|
|
60
|
+
"parentId": { "type": "string", "minLength": 1 },
|
|
61
|
+
"panel": { "$ref": "runtime-ui-v1.json#/$defs/node" }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"layoutSetRootOperation": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": true,
|
|
67
|
+
"required": ["type", "layout", "root"],
|
|
68
|
+
"properties": {
|
|
69
|
+
"type": { "const": "layout.setRoot" },
|
|
70
|
+
"layout": { "type": "string", "minLength": 1 },
|
|
71
|
+
"root": { "$ref": "runtime-ui-v1.json#/$defs/node" }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"layoutUpdateNodeOperation": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": true,
|
|
77
|
+
"required": ["type", "layout", "nodeId", "patch"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"type": { "const": "layout.updateNode" },
|
|
80
|
+
"layout": { "type": "string", "minLength": 1 },
|
|
81
|
+
"nodeId": { "type": "string", "minLength": 1 },
|
|
82
|
+
"patch": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"minProperties": 1,
|
|
86
|
+
"properties": {
|
|
87
|
+
"layout": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"minProperties": 1,
|
|
91
|
+
"properties": {
|
|
92
|
+
"rect": { "type": "object", "additionalProperties": true },
|
|
93
|
+
"weight": { "type": "number" }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"props": { "type": "object", "additionalProperties": true },
|
|
97
|
+
"attrs": { "type": "object", "additionalProperties": true }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"themeSetModifierOperation": {
|
|
103
|
+
"type": "object",
|
|
104
|
+
"additionalProperties": true,
|
|
105
|
+
"required": ["type", "theme", "name", "value"],
|
|
106
|
+
"properties": {
|
|
107
|
+
"type": { "const": "theme.setModifier" },
|
|
108
|
+
"theme": { "type": "string", "minLength": 1 },
|
|
109
|
+
"name": { "type": "string", "minLength": 1 },
|
|
110
|
+
"value": { "type": ["number", "string", "boolean"] }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://rnd-pro.github.io/symbiote-node/schemas/runtime-ui-v1.json",
|
|
4
|
+
"title": "Symbiote Node Runtime UI Tree",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["version", "root"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": "runtime-ui-v1" },
|
|
10
|
+
"metadata": { "type": "object", "additionalProperties": true },
|
|
11
|
+
"componentRegistries": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": { "$ref": "#/$defs/componentRegistry" },
|
|
14
|
+
"uniqueItems": true
|
|
15
|
+
},
|
|
16
|
+
"theme": { "$ref": "#/$defs/themeRef" },
|
|
17
|
+
"root": { "$ref": "#/$defs/node" }
|
|
18
|
+
},
|
|
19
|
+
"$defs": {
|
|
20
|
+
"componentRegistry": {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"additionalProperties": true,
|
|
23
|
+
"required": ["id"],
|
|
24
|
+
"properties": {
|
|
25
|
+
"id": { "type": "string", "minLength": 1 },
|
|
26
|
+
"provider": { "type": "string", "minLength": 1 },
|
|
27
|
+
"schema": { "type": "string", "minLength": 1 }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"themeRef": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"properties": {
|
|
34
|
+
"name": { "type": "string" },
|
|
35
|
+
"overrides": { "type": "object", "additionalProperties": { "type": "string" } }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"node": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"additionalProperties": false,
|
|
41
|
+
"required": ["component"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"id": { "type": "string" },
|
|
44
|
+
"component": { "type": "string", "minLength": 1 },
|
|
45
|
+
"componentRegistry": { "type": "string", "minLength": 1 },
|
|
46
|
+
"props": { "type": "object", "additionalProperties": true },
|
|
47
|
+
"attrs": { "type": "object", "additionalProperties": { "type": ["string", "number", "boolean"] } },
|
|
48
|
+
"layout": { "$ref": "#/$defs/layout" },
|
|
49
|
+
"bindings": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
50
|
+
"events": { "type": "object", "additionalProperties": { "type": "string" } },
|
|
51
|
+
"theme": { "$ref": "#/$defs/themeRef" },
|
|
52
|
+
"children": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": { "$ref": "#/$defs/node" }
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"layout": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"additionalProperties": false,
|
|
61
|
+
"properties": {
|
|
62
|
+
"direction": { "enum": ["horizontal", "vertical"] },
|
|
63
|
+
"weight": { "type": "number", "minimum": 0 },
|
|
64
|
+
"rect": { "$ref": "#/$defs/relativeRect" },
|
|
65
|
+
"area": { "type": "string", "minLength": 1 }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"relativeRect": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"required": ["x", "y", "width", "height"],
|
|
72
|
+
"properties": {
|
|
73
|
+
"x": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
74
|
+
"y": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
75
|
+
"width": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
76
|
+
"height": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://rnd-pro.github.io/symbiote-node/schemas/theme-rule-block-v1.json",
|
|
4
|
+
"title": "Symbiote Node Theme Rule Block",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["name", "kind", "description"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": { "type": "string", "minLength": 1 },
|
|
10
|
+
"theme": { "type": "string", "minLength": 1 },
|
|
11
|
+
"kind": {
|
|
12
|
+
"enum": [
|
|
13
|
+
"source-accent",
|
|
14
|
+
"color-cascade",
|
|
15
|
+
"geometry-cascade",
|
|
16
|
+
"typography-cascade",
|
|
17
|
+
"motion-effects",
|
|
18
|
+
"semantic-alias",
|
|
19
|
+
"component-alias"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"description": { "type": "string", "minLength": 1 },
|
|
23
|
+
"parameters": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["name", "type", "description"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"name": { "type": "string", "minLength": 1 },
|
|
31
|
+
"type": { "type": "string", "minLength": 1 },
|
|
32
|
+
"description": { "type": "string", "minLength": 1 },
|
|
33
|
+
"default": { "type": "string" },
|
|
34
|
+
"unit": { "type": "string" }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"inputs": {
|
|
39
|
+
"type": "array",
|
|
40
|
+
"items": { "type": "string", "minLength": 1 },
|
|
41
|
+
"uniqueItems": true
|
|
42
|
+
},
|
|
43
|
+
"outputs": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": { "type": "string", "minLength": 1 },
|
|
46
|
+
"uniqueItems": true
|
|
47
|
+
},
|
|
48
|
+
"formula": { "type": "string" },
|
|
49
|
+
"derivations": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"required": ["output", "expression"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"output": { "type": "string", "minLength": 1 },
|
|
57
|
+
"inputs": {
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": { "type": "string", "minLength": 1 },
|
|
60
|
+
"uniqueItems": true
|
|
61
|
+
},
|
|
62
|
+
"expression": { "type": "string", "minLength": 1 },
|
|
63
|
+
"description": { "type": "string" }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"appliesTo": {
|
|
68
|
+
"type": "array",
|
|
69
|
+
"items": { "type": "string", "minLength": 1 },
|
|
70
|
+
"uniqueItems": true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CircleShape — circular hub node
|
|
3
|
+
*
|
|
4
|
+
* Sockets distributed around the perimeter of a circle.
|
|
5
|
+
* Inputs on left semicircle, outputs on right semicircle.
|
|
6
|
+
*
|
|
7
|
+
* @module symbiote-node/shapes/CircleShape
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { NodeShape } from './NodeShape.js';
|
|
11
|
+
|
|
12
|
+
export class CircleShape extends NodeShape {
|
|
13
|
+
name = 'circle';
|
|
14
|
+
|
|
15
|
+
getSocketPosition(side, index, total, { width, height }) {
|
|
16
|
+
let r = Math.min(width, height) / 2;
|
|
17
|
+
let cx = width / 2;
|
|
18
|
+
let cy = height / 2;
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
let arcSpan = Math.PI * 0.8;
|
|
22
|
+
let centerAngle = side === 'input' ? Math.PI : 0;
|
|
23
|
+
let startAngle = centerAngle - arcSpan / 2;
|
|
24
|
+
let step = total > 1 ? arcSpan / (total - 1) : 0;
|
|
25
|
+
let angle = startAngle + step * index;
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
x: cx + r * Math.cos(angle),
|
|
29
|
+
y: cy + r * Math.sin(angle),
|
|
30
|
+
angle: (angle * 180) / Math.PI,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get pin position on a specific side of the circle.
|
|
36
|
+
* Pins follow an arc in the corresponding quadrant.
|
|
37
|
+
*
|
|
38
|
+
* @param {'top'|'right'|'bottom'|'left'} side
|
|
39
|
+
* @param {number} t - position along the side (0..1)
|
|
40
|
+
* @param {{ width: number, height: number }} size
|
|
41
|
+
* @returns {{ x: number, y: number, angle: number }}
|
|
42
|
+
*/
|
|
43
|
+
getSidePosition(side, t, size) {
|
|
44
|
+
let r = Math.min(size.width, size.height) / 2;
|
|
45
|
+
let cx = size.width / 2;
|
|
46
|
+
let cy = size.height / 2;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const CENTERS = { right: 0, bottom: Math.PI / 2, left: Math.PI, top: -Math.PI / 2 };
|
|
50
|
+
const ARC = Math.PI * 0.8;
|
|
51
|
+
const MARGIN = 0.2;
|
|
52
|
+
let effectiveT = MARGIN + t * (1 - 2 * MARGIN);
|
|
53
|
+
|
|
54
|
+
let center = CENTERS[side];
|
|
55
|
+
let a = center - ARC / 2 + ARC * effectiveT;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
x: cx + r * Math.cos(a),
|
|
59
|
+
y: cy + r * Math.sin(a),
|
|
60
|
+
angle: (a * 180) / Math.PI,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getBorderRadius() {
|
|
65
|
+
return '50%';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get hasHeader() {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get hasControls() {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getMinSize() {
|
|
77
|
+
return { minWidth: 80, minHeight: 80 };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommentShape — wide annotation banner node
|
|
3
|
+
*
|
|
4
|
+
* No sockets, no header, no controls.
|
|
5
|
+
* Just text content with semi-transparent background.
|
|
6
|
+
* Used for annotations and documentation on the canvas.
|
|
7
|
+
*
|
|
8
|
+
* @module symbiote-node/shapes/CommentShape
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { NodeShape } from './NodeShape.js';
|
|
12
|
+
|
|
13
|
+
export class CommentShape extends NodeShape {
|
|
14
|
+
name = 'comment';
|
|
15
|
+
|
|
16
|
+
getSocketPosition() {
|
|
17
|
+
return { x: 0, y: 0, angle: 0 };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getBorderRadius() {
|
|
21
|
+
return 'var(--sn-comment-radius, 6px)';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get hasHeader() {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get hasControls() {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getMinSize() {
|
|
33
|
+
return { minWidth: 200, minHeight: 40 };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiamondShape — condition/decision rhombus node
|
|
3
|
+
*
|
|
4
|
+
* Input at top vertex, outputs distributed along bottom edges.
|
|
5
|
+
* Classic if/else, switch/case pattern.
|
|
6
|
+
*
|
|
7
|
+
* @module symbiote-node/shapes/DiamondShape
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { NodeShape } from './NodeShape.js';
|
|
11
|
+
|
|
12
|
+
export class DiamondShape extends NodeShape {
|
|
13
|
+
name = 'diamond';
|
|
14
|
+
|
|
15
|
+
getSocketPosition(side, index, total, { width, height }) {
|
|
16
|
+
let cx = width / 2;
|
|
17
|
+
let cy = height / 2;
|
|
18
|
+
|
|
19
|
+
if (side === 'input') {
|
|
20
|
+
|
|
21
|
+
if (total === 1) {
|
|
22
|
+
return { x: cx, y: 0, angle: 270 };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let t = (index + 1) / (total + 1);
|
|
26
|
+
return {
|
|
27
|
+
x: cx * (1 - t),
|
|
28
|
+
y: cy * t,
|
|
29
|
+
angle: 225 + 90 * (index / (total - 1)),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if (total === 1) {
|
|
35
|
+
return { x: cx, y: height, angle: 90 };
|
|
36
|
+
}
|
|
37
|
+
if (total === 2) {
|
|
38
|
+
|
|
39
|
+
return index === 0
|
|
40
|
+
? { x: cx * 0.35, y: cy + cy * 0.65, angle: 225 }
|
|
41
|
+
: { x: width - cx * 0.35, y: cy + cy * 0.65, angle: 315 };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let t = (index + 1) / (total + 1);
|
|
45
|
+
return {
|
|
46
|
+
x: t < 0.5 ? cx * (1 - 2 * t) : cx + cx * (2 * t - 1),
|
|
47
|
+
y: t < 0.5 ? cy + cy * 2 * t : cy + cy * (2 - 2 * t),
|
|
48
|
+
angle: 135 + 90 * (index / (total - 1)),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get pin position on a specific side of the diamond.
|
|
54
|
+
* Each side maps to two diagonal edges meeting at that cardinal vertex.
|
|
55
|
+
*
|
|
56
|
+
* @param {'top'|'right'|'bottom'|'left'} side
|
|
57
|
+
* @param {number} t - position along the side (0..1)
|
|
58
|
+
* @param {{ width: number, height: number }} size
|
|
59
|
+
* @returns {{ x: number, y: number, angle: number }}
|
|
60
|
+
*/
|
|
61
|
+
getSidePosition(side, t, size) {
|
|
62
|
+
let cx = size.width / 2;
|
|
63
|
+
let cy = size.height / 2;
|
|
64
|
+
const NORMALS = { top: -90, right: 0, bottom: 90, left: 180 };
|
|
65
|
+
const MARGIN = 0.2;
|
|
66
|
+
let effectiveT = MARGIN + t * (1 - 2 * MARGIN);
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
let vertices = {
|
|
70
|
+
top: [
|
|
71
|
+
{ x: 0, y: cy },
|
|
72
|
+
{ x: cx, y: 0 },
|
|
73
|
+
{ x: size.width, y: cy },
|
|
74
|
+
],
|
|
75
|
+
right: [
|
|
76
|
+
{ x: cx, y: 0 },
|
|
77
|
+
{ x: size.width, y: cy },
|
|
78
|
+
{ x: cx, y: size.height },
|
|
79
|
+
],
|
|
80
|
+
bottom: [
|
|
81
|
+
{ x: 0, y: cy },
|
|
82
|
+
{ x: cx, y: size.height },
|
|
83
|
+
{ x: size.width, y: cy },
|
|
84
|
+
],
|
|
85
|
+
left: [
|
|
86
|
+
{ x: cx, y: 0 },
|
|
87
|
+
{ x: 0, y: cy },
|
|
88
|
+
{ x: cx, y: size.height },
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
let [p0, p1, p2] = vertices[side];
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
let x, y;
|
|
96
|
+
if (effectiveT <= 0.5) {
|
|
97
|
+
let segT = effectiveT * 2;
|
|
98
|
+
x = p0.x + (p1.x - p0.x) * segT;
|
|
99
|
+
y = p0.y + (p1.y - p0.y) * segT;
|
|
100
|
+
} else {
|
|
101
|
+
let segT = (effectiveT - 0.5) * 2;
|
|
102
|
+
x = p1.x + (p2.x - p1.x) * segT;
|
|
103
|
+
y = p1.y + (p2.y - p1.y) * segT;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return { x, y, angle: NORMALS[side] };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
getBorderRadius() {
|
|
110
|
+
return '0';
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getClipPath({ width, height }) {
|
|
114
|
+
let cx = width / 2;
|
|
115
|
+
let cy = height / 2;
|
|
116
|
+
return `polygon(${cx}px 0, ${width}px ${cy}px, ${cx}px ${height}px, 0 ${cy}px)`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get hasHeader() {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get hasControls() {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
getMinSize() {
|
|
128
|
+
return { minWidth: 100, minHeight: 100 };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NodeShape — abstract base class for node geometry
|
|
3
|
+
*
|
|
4
|
+
* Defines socket placement strategy and outline path for any node shape.
|
|
5
|
+
* Each shape determines WHERE sockets appear and at WHAT ANGLE
|
|
6
|
+
* connections should exit/enter.
|
|
7
|
+
*
|
|
8
|
+
* @module symbiote-node/shapes/NodeShape
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export class NodeShape {
|
|
12
|
+
/** @type {string} */
|
|
13
|
+
name = 'base';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get socket position on the shape outline
|
|
17
|
+
* @param {'input'|'output'} _side
|
|
18
|
+
* @param {number} _index - ordinal index of this port
|
|
19
|
+
* @param {number} _total - total ports on this side
|
|
20
|
+
* @param {{ width: number, height: number }} _size - node dimensions
|
|
21
|
+
* @returns {{ x: number, y: number, angle: number }}
|
|
22
|
+
* x, y are relative to node top-left corner
|
|
23
|
+
* angle is in degrees: 0 = right, 90 = down, 180 = left, 270 = up
|
|
24
|
+
*/
|
|
25
|
+
getSocketPosition(_side, _index, _total, _size) {
|
|
26
|
+
throw new Error('getSocketPosition must be implemented');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get SVG outline path for the shape
|
|
31
|
+
* @param {{ width: number, height: number }} _size
|
|
32
|
+
* @returns {string} SVG path d attribute
|
|
33
|
+
*/
|
|
34
|
+
getOutlinePath(_size) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* CSS border-radius value for the shape
|
|
40
|
+
* @param {{ width: number, height: number }} _size
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
43
|
+
getBorderRadius(_size) {
|
|
44
|
+
return 'var(--sn-node-radius)';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Whether this shape uses standard header+body layout
|
|
49
|
+
* @returns {boolean}
|
|
50
|
+
*/
|
|
51
|
+
get hasHeader() {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Whether this shape supports embedded controls
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
get hasControls() {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* CSS clip-path for non-rectangular shapes
|
|
65
|
+
* @param {{ width: number, height: number }} _size
|
|
66
|
+
* @returns {string|null} null = no clip
|
|
67
|
+
*/
|
|
68
|
+
getClipPath(_size) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Minimum node dimensions for this shape
|
|
74
|
+
* @returns {{ minWidth: number, minHeight: number }}
|
|
75
|
+
*/
|
|
76
|
+
getMinSize() {
|
|
77
|
+
return { minWidth: 180, minHeight: 60 };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PillShape — compact horizontal pill node
|
|
3
|
+
*
|
|
4
|
+
* Small node with rounded ends, label centered, 1 input left, 1 output right.
|
|
5
|
+
* No header, no controls. Ideal for simple operations (multiply, add, etc.)
|
|
6
|
+
*
|
|
7
|
+
* @module symbiote-node/shapes/PillShape
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { NodeShape } from './NodeShape.js';
|
|
11
|
+
|
|
12
|
+
export class PillShape extends NodeShape {
|
|
13
|
+
name = 'pill';
|
|
14
|
+
|
|
15
|
+
getSocketPosition(side, index, total, { width, height }) {
|
|
16
|
+
let r = height / 2;
|
|
17
|
+
if (total <= 1) {
|
|
18
|
+
return {
|
|
19
|
+
x: side === 'input' ? 0 : width,
|
|
20
|
+
y: height / 2,
|
|
21
|
+
angle: side === 'input' ? 180 : 0,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
let arcAngle = Math.PI * 0.6;
|
|
27
|
+
let startAngle = side === 'input' ? Math.PI - arcAngle / 2 : -arcAngle / 2;
|
|
28
|
+
let step = arcAngle / (total - 1);
|
|
29
|
+
let a = startAngle + step * index;
|
|
30
|
+
|
|
31
|
+
let cx = side === 'input' ? r : width - r;
|
|
32
|
+
return {
|
|
33
|
+
x: cx + r * Math.cos(a),
|
|
34
|
+
y: height / 2 + r * Math.sin(a),
|
|
35
|
+
angle: (a * 180) / Math.PI,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get pin position on a specific side of the pill.
|
|
41
|
+
* Left/right follow the rounded semicircle arc.
|
|
42
|
+
* Top/bottom follow the flat straight edge.
|
|
43
|
+
*
|
|
44
|
+
* @param {'top'|'right'|'bottom'|'left'} side
|
|
45
|
+
* @param {number} t - position along the side (0..1)
|
|
46
|
+
* @param {{ width: number, height: number }} size
|
|
47
|
+
* @returns {{ x: number, y: number, angle: number }}
|
|
48
|
+
*/
|
|
49
|
+
getSidePosition(side, t, size) {
|
|
50
|
+
const NORMALS = { top: -90, right: 0, bottom: 90, left: 180 };
|
|
51
|
+
const MARGIN = 0.2;
|
|
52
|
+
let effectiveT = MARGIN + t * (1 - 2 * MARGIN);
|
|
53
|
+
let r = size.height / 2;
|
|
54
|
+
|
|
55
|
+
if (side === 'top' || side === 'bottom') {
|
|
56
|
+
|
|
57
|
+
let x = r + effectiveT * (size.width - 2 * r);
|
|
58
|
+
let y = side === 'top' ? 0 : size.height;
|
|
59
|
+
return { x, y, angle: NORMALS[side] };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
let arcSpan = Math.PI * 0.8;
|
|
64
|
+
let cx = side === 'left' ? r : size.width - r;
|
|
65
|
+
let centerAngle = side === 'left' ? Math.PI : 0;
|
|
66
|
+
let startAngle = centerAngle - arcSpan / 2;
|
|
67
|
+
let a = startAngle + arcSpan * effectiveT;
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
x: cx + r * Math.cos(a),
|
|
71
|
+
y: size.height / 2 + r * Math.sin(a),
|
|
72
|
+
angle: (a * 180) / Math.PI,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
getBorderRadius({ height }) {
|
|
77
|
+
return `${height / 2}px`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get hasHeader() {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get hasControls() {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
getMinSize() {
|
|
89
|
+
return { minWidth: 100, minHeight: 40 };
|
|
90
|
+
}
|
|
91
|
+
}
|