dishui 0.0.46 → 0.0.48
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/chart.js +35 -33
- package/dist/components/Chart/index.d.ts +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +1 -2
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/themes.js +0 -25
- package/dist/components/pro/CodeEditor/themes.js.map +1 -1
- package/dist/components/pro/CodeEditor/types.d.ts +1 -1
- package/dist/components/pro/DataTable/pivotExtension.d.ts +6 -0
- package/dist/components/pro/DataTable/pivotExtension.js +31 -30
- package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +500 -459
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +526 -524
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/canvas/GridRenderer.d.ts +3 -0
- package/dist/components/pro/Flow/canvas/GridRenderer.js +28 -23
- package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +18 -17
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/PixiApp.d.ts +24 -0
- package/dist/components/pro/Flow/canvas/PixiApp.js +60 -15
- package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
- package/dist/components/pro/Flow/constants.js +7 -7
- package/dist/components/pro/Flow/constants.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowAIContext.d.ts +15 -0
- package/dist/components/pro/Flow/context/FlowAIContext.js +32 -0
- package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -0
- package/dist/components/pro/Flow/context/FlowUIContext.d.ts +4 -1
- package/dist/components/pro/Flow/context/FlowUIContext.js +58 -55
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/edges/EdgeRenderer.js +22 -21
- package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useFlowImportExport.d.ts +6 -0
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js +146 -89
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.d.ts +2 -0
- package/dist/components/pro/Flow/hooks/useLayoutActions.js +94 -65
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePdfExport.d.ts +10 -0
- package/dist/components/pro/Flow/hooks/usePdfExport.js +60 -0
- package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -0
- package/dist/components/pro/Flow/hooks/usePixiApp.d.ts +6 -1
- package/dist/components/pro/Flow/hooks/usePixiApp.js +49 -30
- package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
- package/dist/components/pro/Flow/index.d.ts +5 -2
- package/dist/components/pro/Flow/lines/FreehandTool.js +21 -20
- package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/GeometricLineTool.js +22 -18
- package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/LineRenderer.js +19 -18
- package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/DataNodeView.d.ts +7 -0
- package/dist/components/pro/Flow/nodes/DataNodeView.js +217 -0
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -0
- package/dist/components/pro/Flow/nodes/MediaContent.js +149 -120
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js +22 -17
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeRenderer.js +77 -76
- package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/aiClient.d.ts +22 -0
- package/dist/components/pro/Flow/nodes/aiClient.js +107 -54
- package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
- package/dist/components/pro/Flow/nodes/dataUtils.d.ts +52 -0
- package/dist/components/pro/Flow/nodes/dataUtils.js +270 -0
- package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -0
- package/dist/components/pro/Flow/nodes/svgIcons.js +59 -27
- package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
- package/dist/components/pro/Flow/panels/AIPanel.d.ts +2 -0
- package/dist/components/pro/Flow/panels/AIPanel.js +498 -0
- package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -0
- package/dist/components/pro/Flow/panels/DataInspectorSection.d.ts +11 -0
- package/dist/components/pro/Flow/panels/DataInspectorSection.js +436 -0
- package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -0
- package/dist/components/pro/Flow/panels/ExpandableTextarea.d.ts +16 -0
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js +65 -0
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -0
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js +51 -39
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.d.ts +5 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.js +310 -233
- package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
- package/dist/components/pro/Flow/panels/InspectorPanel.js +358 -363
- package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/OutlinePanel.js +63 -62
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/ProjectTitle.d.ts +8 -0
- package/dist/components/pro/Flow/panels/ProjectTitle.js +49 -0
- package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -0
- package/dist/components/pro/Flow/panels/ShapePalette.js +128 -115
- package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +13 -0
- package/dist/components/pro/Flow/panels/toolbarIcons.js +241 -87
- package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
- package/dist/components/pro/Flow/types.d.ts +77 -1
- package/dist/components/pro/Flow/types.js.map +1 -1
- package/dist/components/pro/Flow/utils/pdfExport.d.ts +20 -0
- package/dist/components/pro/Flow/utils/pdfExport.js +95 -0
- package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -0
- package/dist/components/pro/Flow/utils/themeColor.d.ts +86 -0
- package/dist/components/pro/Flow/utils/themeColor.js +190 -0
- package/dist/components/pro/Flow/utils/themeColor.js.map +1 -0
- package/dist/contexts/AppContext.d.ts +1 -1
- package/dist/contexts/AppContext.js +28 -29
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/favicon.svg +10 -0
- package/dist/flow.js +59 -51
- package/dist/index-nostyled.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles/themeStyles.js +6 -11
- package/dist/styles/themeStyles.js.map +1 -1
- package/dist/utils/themes.js +3 -23
- package/dist/utils/themes.js.map +1 -1
- package/package.json +17 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutlinePanel.js","names":[],"sources":["../../../../../src/components/pro/Flow/panels/OutlinePanel.tsx"],"sourcesContent":["import React, { useMemo, useCallback, useRef, useEffect } from 'react';\nimport { Tree, type TreeNode } from '../../../Tree';\nimport { useFlowUI } from '../context/FlowUIContext';\nimport { useFlowContext } from '../context/FlowContext';\nimport { useDraggablePanel } from '../hooks/useDraggablePanel';\nimport { useResizablePanel } from '../hooks/useResizablePanel';\nimport { PaletteThumbnail } from './ShapePalette';\nimport { buildSvgMarkup } from '../nodes/svgIcons';\nimport type { FlowNode, FlowLine, FlowDocument, FlowCanvasData } from '../types';\n\nconst SUB_CANVAS_ICON = '⧉';\n\nfunction OutlineNodeIcon({ node }: { node: FlowNode }) {\n if (node.data.childCanvasId) return <span style={{ fontSize: 15 }}>{SUB_CANVAS_ICON}</span>;\n if (node.type === 'shapeSvg' && node.data.svgId) {\n const markup = buildSvgMarkup(node.data.svgId, node.data.color || '#475569');\n return markup ? (\n <img\n src={`data:image/svg+xml;utf8,${encodeURIComponent(markup)}`}\n width={24}\n height={20}\n alt=\"\"\n style={{ display: 'block', objectFit: 'contain' }}\n />\n ) : null;\n }\n if (node.type === 'mediaNode') {\n const text = node.data.mediaKind === 'markdown' ? 'M↓'\n : node.data.mediaKind === 'html' ? '</>'\n : node.data.mediaKind === 'mermaid' ? '⎇'\n : node.data.mediaKind === 'math' ? '√x'\n : node.data.mediaKind === 'image' ? 'IMG'\n : node.data.mediaKind === 'model3d' ? '3D'\n : 'AI';\n return <span style={{ width: 24, textAlign: 'center', fontSize: 10, fontWeight: 700 }}>{text}</span>;\n }\n return <PaletteThumbnail type={node.type} />;\n}\n\nfunction buildNodeTree(nodes: FlowNode[], lines: FlowLine[], doc: FlowDocument): { nodeTree: TreeNode[]; assignedLineIds: Set<string> } {\n const childNodesOf = new Map<string, FlowNode[]>();\n const childLinesOf = new Map<string, FlowLine[]>();\n const assignedNodes = new Set<string>();\n const assignedLineIds = new Set<string>();\n\n for (const n of nodes) {\n if (n.parentId) {\n const list = childNodesOf.get(n.parentId) ?? [];\n list.push(n);\n childNodesOf.set(n.parentId, list);\n assignedNodes.add(n.id);\n }\n }\n for (const l of lines) {\n if (l.parentId) {\n const list = childLinesOf.get(l.parentId) ?? [];\n list.push(l);\n childLinesOf.set(l.parentId, list);\n assignedLineIds.add(l.id);\n }\n }\n\n // Spatial containment only for geometryGroup\n const geoGroups = nodes.filter(n => n.type === 'geometryGroup');\n for (const g of geoGroups) {\n const gx = g.position.x, gy = g.position.y;\n const gw = g.width, gh = g.height;\n for (const n of nodes) {\n if (n.id === g.id || assignedNodes.has(n.id)) continue;\n if (n.position.x >= gx && n.position.y >= gy\n && n.position.x + n.width <= gx + gw\n && n.position.y + n.height <= gy + gh) {\n const list = childNodesOf.get(g.id) ?? [];\n list.push(n);\n childNodesOf.set(g.id, list);\n assignedNodes.add(n.id);\n }\n }\n for (const l of lines) {\n if (assignedLineIds.has(l.id)) continue;\n if (l.points.length > 0 && l.points.every(p =>\n p.x >= gx && p.x <= gx + gw && p.y >= gy && p.y <= gy + gh\n )) {\n const list = childLinesOf.get(g.id) ?? [];\n list.push(l);\n childLinesOf.set(g.id, list);\n assignedLineIds.add(l.id);\n }\n }\n }\n\n const roots = nodes.filter(n => !assignedNodes.has(n.id));\n\n const lineToTree = (l: FlowLine): TreeNode => ({\n id: l.id,\n label: `${l.type} line`,\n icon: '〰',\n });\n\n const toTreeNode = (n: FlowNode): TreeNode => {\n const hasSubCanvas = !!n.data.childCanvasId;\n const icon = <OutlineNodeIcon node={n} />;\n const kidNodes = childNodesOf.get(n.id);\n const kidLines = childLinesOf.get(n.id);\n const item: TreeNode = {\n id: n.id,\n label: n.data.label || n.type,\n icon,\n meta: hasSubCanvas ? { childCanvasId: n.data.childCanvasId } : undefined,\n };\n\n const children: TreeNode[] = [];\n if (kidNodes && kidNodes.length > 0) {\n children.push(...kidNodes.map(toTreeNode));\n }\n if (kidLines && kidLines.length > 0) {\n children.push(...kidLines.map(lineToTree));\n }\n if (hasSubCanvas) {\n const subCanvas = doc.canvases[n.data.childCanvasId!];\n if (subCanvas) {\n const subTree = buildCanvasSubtree(subCanvas, doc, n.data.childCanvasId!);\n if (subTree.length > 0) {\n children.push(...subTree);\n }\n }\n }\n if (children.length > 0) {\n item.children = children;\n }\n return item;\n };\n\n return { nodeTree: roots.map(toTreeNode), assignedLineIds };\n}\n\nfunction buildCanvasSubtree(canvas: FlowCanvasData, doc: FlowDocument, canvasId: string): TreeNode[] {\n if (canvas.nodes.length === 0 && canvas.edges.length === 0 && canvas.lines.length === 0) {\n return [{ id: `_empty_${canvasId}`, label: '(empty sub-canvas)', icon: '○' }];\n }\n return buildNodeTree(canvas.nodes, canvas.lines, doc).nodeTree;\n}\n\n/**\n * Standalone panel (legacy). Prefer using OutlinePanelContent inside a FlowPanelGroup.\n */\nexport default function OutlinePanel() {\n const { showOutline } = useFlowUI();\n const { panelStyle, handleProps } = useDraggablePanel();\n const { panelWidth, resizeHandleProps } = useResizablePanel('left', 180);\n\n if (!showOutline) return null;\n\n return (\n <div className=\"flow-palette\" data-flow-panel style={{ ...(panelStyle ?? { top: 56, left: 'auto', right: 248 + 16 }), width: panelWidth }}>\n <div className=\"flow-panel-resize-handle flow-panel-resize-handle--left\" {...resizeHandleProps} />\n <div\n className=\"flow-panel-drag-handle\"\n {...handleProps}\n style={{ fontSize: 11, fontWeight: 600, marginBottom: 6, color: 'oklch(var(--bc) / 0.5)', textTransform: 'uppercase', letterSpacing: '0.05em', cursor: 'grab' }}\n >\n Outline\n </div>\n <div className=\"flow-palette-content\">\n <OutlinePanelContent />\n </div>\n </div>\n );\n}\n\n/** Reusable content for embedding inside FlowPanelGroup tabs. */\nexport function OutlinePanelContent() {\n const { focusOnRect } = useFlowUI();\n const { doc, currentCanvas, currentCanvasId, selection, setSelection, pushCanvas } = useFlowContext();\n\n const treeData = useMemo<TreeNode[]>(() => {\n const { nodeTree, assignedLineIds } = buildNodeTree(currentCanvas.nodes, currentCanvas.lines, doc);\n const edgeItems: TreeNode[] = currentCanvas.edges.map(e => {\n const sn = currentCanvas.nodes.find(n => n.id === e.source);\n const tn = currentCanvas.nodes.find(n => n.id === e.target);\n const srcLabel = sn?.data.label || e.source;\n const tgtLabel = tn?.data.label || e.target;\n return { id: e.id, label: `${srcLabel} → ${tgtLabel}`, icon: '→' };\n });\n const unassignedLines = currentCanvas.lines.filter(l => !assignedLineIds.has(l.id));\n const lineItems: TreeNode[] = unassignedLines.map(l => ({\n id: l.id,\n label: `${l.type} line`,\n icon: '〰',\n }));\n\n const tree: TreeNode[] = [];\n if (nodeTree.length > 0) tree.push({ id: '_nodes', label: `Nodes (${currentCanvas.nodes.length})`, children: nodeTree });\n if (edgeItems.length > 0) tree.push({ id: '_edges', label: `Edges (${edgeItems.length})`, children: edgeItems });\n if (lineItems.length > 0) tree.push({ id: '_lines', label: `Lines (${unassignedLines.length})`, children: lineItems });\n return tree;\n }, [currentCanvas, doc]);\n\n const activeId = useMemo(() => {\n if (selection.nodeIds.size === 1) return [...selection.nodeIds][0];\n if (selection.edgeIds.size === 1) return [...selection.edgeIds][0];\n if (selection.lineIds.size === 1) return [...selection.lineIds][0];\n return undefined;\n }, [selection]);\n\n const defaultExpanded = useMemo(() => {\n const ids: (string | number)[] = ['_nodes', '_edges', '_lines'];\n for (const n of currentCanvas.nodes) {\n if (n.type === 'flowGroup' || n.type === 'geometryGroup' || n.data.isGroup) ids.push(n.id);\n if (n.data.childCanvasId) ids.push(n.id);\n }\n if (activeId) {\n const node = currentCanvas.nodes.find(n => n.id === activeId);\n if (node?.parentId) {\n let pid: string | undefined = node.parentId;\n while (pid) {\n ids.push(pid);\n const parent = currentCanvas.nodes.find(n => n.id === pid);\n pid = parent?.parentId;\n }\n }\n const line = currentCanvas.lines.find(l => l.id === activeId);\n if (line?.parentId) ids.push(line.parentId);\n }\n return ids;\n }, [currentCanvas.nodes, currentCanvas.lines, activeId]);\n\n const handleNodeClick = useCallback((node: TreeNode) => {\n const id = String(node.id);\n if (id.startsWith('_')) return;\n\n const flowNode = currentCanvas.nodes.find(n => n.id === id);\n const flowEdge = currentCanvas.edges.find(e => e.id === id);\n const flowLine = currentCanvas.lines.find(l => l.id === id);\n\n setSelection({\n nodeIds: flowNode ? new Set([id]) : new Set(),\n edgeIds: flowEdge ? new Set([id]) : new Set(),\n lineIds: flowLine ? new Set([id]) : new Set(),\n });\n\n if (flowNode) {\n focusOnRect(flowNode.position.x, flowNode.position.y, flowNode.width, flowNode.height);\n } else if (flowEdge) {\n const sn = currentCanvas.nodes.find(n => n.id === flowEdge.source);\n const tn = currentCanvas.nodes.find(n => n.id === flowEdge.target);\n if (sn && tn) {\n const minX = Math.min(sn.position.x, tn.position.x);\n const minY = Math.min(sn.position.y, tn.position.y);\n const maxX = Math.max(sn.position.x + sn.width, tn.position.x + tn.width);\n const maxY = Math.max(sn.position.y + sn.height, tn.position.y + tn.height);\n focusOnRect(minX, minY, maxX - minX, maxY - minY);\n }\n } else if (flowLine && flowLine.points.length > 0) {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (const p of flowLine.points) {\n minX = Math.min(minX, p.x); minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x); maxY = Math.max(maxY, p.y);\n }\n focusOnRect(minX - 20, minY - 20, maxX - minX + 40, maxY - minY + 40);\n }\n }, [currentCanvas, setSelection, focusOnRect]);\n\n const handleNodeDoubleClick = useCallback((node: TreeNode) => {\n const id = String(node.id);\n if (id.startsWith('_')) return;\n const flowNode = currentCanvas.nodes.find(n => n.id === id);\n if (flowNode?.data.childCanvasId) {\n pushCanvas(flowNode.data.childCanvasId);\n }\n }, [currentCanvas.nodes, pushCanvas]);\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!activeId || !containerRef.current) return;\n const timer = setTimeout(() => {\n const el = containerRef.current?.querySelector(`[data-node-id=\"${activeId}\"]`);\n if (el) el.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }, 60);\n return () => clearTimeout(timer);\n }, [activeId]);\n\n return (\n <div ref={containerRef}>\n <Tree\n data={treeData}\n onNodeClick={handleNodeClick}\n onNodeDoubleClick={handleNodeDoubleClick}\n activeNodeId={activeId}\n defaultExpandedIds={defaultExpanded}\n showSearch={false}\n showExpandAll={false}\n showIcon\n showLine\n indent={16}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,IAAM,IAAkB;AAExB,SAAS,EAAgB,EAAE,MAAA,EAAA,GAA4B;AACrD,MAAI,EAAK,KAAK,cAAe,QAAO,gBAAA,EAAC,QAAD;AAAA,IAAM,OAAO,EAAE,UAAU,GA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,IAAwB,EAAA,CAAa,MAAmB;AAC5D,UAAM,IAAK,OAAO,EAAK,EAAE;AACzB,QAAI,EAAG,WAAW,GAAG,EAAG;AACxB,UAAM,IAAW,EAAc,MAAM,KAAA,CAAK,MAAK,EAAE,OAAO,CAAE;AAC1D,IAAI,GAAU,KAAK,iBACjB,EAAW,EAAS,KAAK,aAAa;AAAA,EAE1C,GAAG,CAAC,EAAc,OAAO,CAAU,CAAC,GAE9B,IAAe,EAAuB,IAAI;AAEhD,SAAA,EAAA,MAAgB;AACd,QAAI,CAAC,KAAY,CAAC,EAAa,QAAS;AACxC,UAAM,IAAQ,WAAA,MAAiB;AAC7B,YAAM,IAAK,EAAa,SAAS,cAAc,kBAAkB,CAAA,IAAY;AAC7E,MAAI,KAAI,EAAG,eAAe;AAAA,QAAE,OAAO;AAAA,QAAW,UAAU;AAAA,MAAS,CAAC;AAAA,IACpE,GAAG,EAAE;AACL,WAAA,MAAa,aAAa,CAAK;AAAA,EACjC,GAAG,CAAC,CAAQ,CAAC,GAGX,gBAAA,EAAC,OAAD;AAAA,IAAK,KAAK;AAAA,cACR,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,aAAa;AAAA,MACb,mBAAmB;AAAA,MACnB,cAAc;AAAA,MACd,oBAAoB;AAAA,MACpB,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,UAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAQ;AAAA,IACT,CAAA;AAAA,EACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"OutlinePanel.js","names":[],"sources":["../../../../../src/components/pro/Flow/panels/OutlinePanel.tsx"],"sourcesContent":["import React, { useMemo, useCallback, useRef, useEffect } from 'react';\nimport { Tree, type TreeNode } from '../../../Tree';\nimport { useFlowUI } from '../context/FlowUIContext';\nimport { useFlowContext } from '../context/FlowContext';\nimport { useDraggablePanel } from '../hooks/useDraggablePanel';\nimport { useResizablePanel } from '../hooks/useResizablePanel';\nimport { PaletteThumbnail } from './ShapePalette';\nimport { buildSvgMarkup } from '../nodes/svgIcons';\nimport { resolveThemeColor } from '../utils/themeColor';\nimport type { FlowNode, FlowLine, FlowDocument, FlowCanvasData } from '../types';\n\nconst SUB_CANVAS_ICON = '⧉';\n\nfunction OutlineNodeIcon({ node }: { node: FlowNode }) {\n if (node.data.childCanvasId) return <span style={{ fontSize: 15 }}>{SUB_CANVAS_ICON}</span>;\n if (node.type === 'shapeSvg' && node.data.svgId) {\n const markup = buildSvgMarkup(node.data.svgId, resolveThemeColor(node.data.color, '#475569') || '#475569');\n return markup ? (\n <img\n src={`data:image/svg+xml;utf8,${encodeURIComponent(markup)}`}\n width={24}\n height={20}\n alt=\"\"\n style={{ display: 'block', objectFit: 'contain' }}\n />\n ) : null;\n }\n if (node.type === 'mediaNode') {\n const text = node.data.mediaKind === 'markdown' ? 'M↓'\n : node.data.mediaKind === 'html' ? '</>'\n : node.data.mediaKind === 'mermaid' ? '⎇'\n : node.data.mediaKind === 'math' ? '√x'\n : node.data.mediaKind === 'image' ? 'IMG'\n : node.data.mediaKind === 'model3d' ? '3D'\n : node.data.mediaKind === 'data' ? '⊞'\n : 'AI';\n return <span style={{ width: 24, textAlign: 'center', fontSize: 10, fontWeight: 700 }}>{text}</span>;\n }\n return <PaletteThumbnail type={node.type} />;\n}\n\nfunction buildNodeTree(nodes: FlowNode[], lines: FlowLine[], doc: FlowDocument): { nodeTree: TreeNode[]; assignedLineIds: Set<string> } {\n const childNodesOf = new Map<string, FlowNode[]>();\n const childLinesOf = new Map<string, FlowLine[]>();\n const assignedNodes = new Set<string>();\n const assignedLineIds = new Set<string>();\n\n for (const n of nodes) {\n if (n.parentId) {\n const list = childNodesOf.get(n.parentId) ?? [];\n list.push(n);\n childNodesOf.set(n.parentId, list);\n assignedNodes.add(n.id);\n }\n }\n for (const l of lines) {\n if (l.parentId) {\n const list = childLinesOf.get(l.parentId) ?? [];\n list.push(l);\n childLinesOf.set(l.parentId, list);\n assignedLineIds.add(l.id);\n }\n }\n\n // Spatial containment only for geometryGroup\n const geoGroups = nodes.filter(n => n.type === 'geometryGroup');\n for (const g of geoGroups) {\n const gx = g.position.x, gy = g.position.y;\n const gw = g.width, gh = g.height;\n for (const n of nodes) {\n if (n.id === g.id || assignedNodes.has(n.id)) continue;\n if (n.position.x >= gx && n.position.y >= gy\n && n.position.x + n.width <= gx + gw\n && n.position.y + n.height <= gy + gh) {\n const list = childNodesOf.get(g.id) ?? [];\n list.push(n);\n childNodesOf.set(g.id, list);\n assignedNodes.add(n.id);\n }\n }\n for (const l of lines) {\n if (assignedLineIds.has(l.id)) continue;\n if (l.points.length > 0 && l.points.every(p =>\n p.x >= gx && p.x <= gx + gw && p.y >= gy && p.y <= gy + gh\n )) {\n const list = childLinesOf.get(g.id) ?? [];\n list.push(l);\n childLinesOf.set(g.id, list);\n assignedLineIds.add(l.id);\n }\n }\n }\n\n const roots = nodes.filter(n => !assignedNodes.has(n.id));\n\n const lineToTree = (l: FlowLine): TreeNode => ({\n id: l.id,\n label: `${l.type} line`,\n icon: '〰',\n });\n\n const toTreeNode = (n: FlowNode): TreeNode => {\n const hasSubCanvas = !!n.data.childCanvasId;\n const icon = <OutlineNodeIcon node={n} />;\n const kidNodes = childNodesOf.get(n.id);\n const kidLines = childLinesOf.get(n.id);\n const item: TreeNode = {\n id: n.id,\n label: n.data.label || n.type,\n icon,\n meta: hasSubCanvas ? { childCanvasId: n.data.childCanvasId } : undefined,\n };\n\n const children: TreeNode[] = [];\n if (kidNodes && kidNodes.length > 0) {\n children.push(...kidNodes.map(toTreeNode));\n }\n if (kidLines && kidLines.length > 0) {\n children.push(...kidLines.map(lineToTree));\n }\n if (hasSubCanvas) {\n const subCanvas = doc.canvases[n.data.childCanvasId!];\n if (subCanvas) {\n const subTree = buildCanvasSubtree(subCanvas, doc, n.data.childCanvasId!);\n if (subTree.length > 0) {\n children.push(...subTree);\n }\n }\n }\n if (children.length > 0) {\n item.children = children;\n }\n return item;\n };\n\n return { nodeTree: roots.map(toTreeNode), assignedLineIds };\n}\n\nfunction buildCanvasSubtree(canvas: FlowCanvasData, doc: FlowDocument, canvasId: string): TreeNode[] {\n if (canvas.nodes.length === 0 && canvas.edges.length === 0 && canvas.lines.length === 0) {\n return [{ id: `_empty_${canvasId}`, label: '(empty sub-canvas)', icon: '○' }];\n }\n return buildNodeTree(canvas.nodes, canvas.lines, doc).nodeTree;\n}\n\n/**\n * Standalone panel (legacy). Prefer using OutlinePanelContent inside a FlowPanelGroup.\n */\nexport default function OutlinePanel() {\n const { showOutline } = useFlowUI();\n const { panelStyle, handleProps } = useDraggablePanel();\n const { panelWidth, resizeHandleProps } = useResizablePanel('left', 180);\n\n if (!showOutline) return null;\n\n return (\n <div className=\"flow-palette\" data-flow-panel style={{ ...(panelStyle ?? { top: 56, left: 'auto', right: 248 + 16 }), width: panelWidth }}>\n <div className=\"flow-panel-resize-handle flow-panel-resize-handle--left\" {...resizeHandleProps} />\n <div\n className=\"flow-panel-drag-handle\"\n {...handleProps}\n style={{ fontSize: 11, fontWeight: 600, marginBottom: 6, color: 'color-mix(in oklch, var(--color-base-content) 50%, transparent)', textTransform: 'uppercase', letterSpacing: '0.05em', cursor: 'grab' }}\n >\n Outline\n </div>\n <div className=\"flow-palette-content\">\n <OutlinePanelContent />\n </div>\n </div>\n );\n}\n\n/** Reusable content for embedding inside FlowPanelGroup tabs. */\nexport function OutlinePanelContent() {\n const { focusOnRect } = useFlowUI();\n const { doc, currentCanvas, currentCanvasId, selection, setSelection, pushCanvas } = useFlowContext();\n\n const treeData = useMemo<TreeNode[]>(() => {\n const { nodeTree, assignedLineIds } = buildNodeTree(currentCanvas.nodes, currentCanvas.lines, doc);\n const edgeItems: TreeNode[] = currentCanvas.edges.map(e => {\n const sn = currentCanvas.nodes.find(n => n.id === e.source);\n const tn = currentCanvas.nodes.find(n => n.id === e.target);\n const srcLabel = sn?.data.label || e.source;\n const tgtLabel = tn?.data.label || e.target;\n return { id: e.id, label: `${srcLabel} → ${tgtLabel}`, icon: '→' };\n });\n const unassignedLines = currentCanvas.lines.filter(l => !assignedLineIds.has(l.id));\n const lineItems: TreeNode[] = unassignedLines.map(l => ({\n id: l.id,\n label: `${l.type} line`,\n icon: '〰',\n }));\n\n const tree: TreeNode[] = [];\n if (nodeTree.length > 0) tree.push({ id: '_nodes', label: `Nodes (${currentCanvas.nodes.length})`, children: nodeTree });\n if (edgeItems.length > 0) tree.push({ id: '_edges', label: `Edges (${edgeItems.length})`, children: edgeItems });\n if (lineItems.length > 0) tree.push({ id: '_lines', label: `Lines (${unassignedLines.length})`, children: lineItems });\n return tree;\n }, [currentCanvas, doc]);\n\n const activeId = useMemo(() => {\n if (selection.nodeIds.size === 1) return [...selection.nodeIds][0];\n if (selection.edgeIds.size === 1) return [...selection.edgeIds][0];\n if (selection.lineIds.size === 1) return [...selection.lineIds][0];\n return undefined;\n }, [selection]);\n\n const defaultExpanded = useMemo(() => {\n const ids: (string | number)[] = ['_nodes', '_edges', '_lines'];\n for (const n of currentCanvas.nodes) {\n if (n.type === 'flowGroup' || n.type === 'geometryGroup' || n.data.isGroup) ids.push(n.id);\n if (n.data.childCanvasId) ids.push(n.id);\n }\n if (activeId) {\n const node = currentCanvas.nodes.find(n => n.id === activeId);\n if (node?.parentId) {\n let pid: string | undefined = node.parentId;\n while (pid) {\n ids.push(pid);\n const parent = currentCanvas.nodes.find(n => n.id === pid);\n pid = parent?.parentId;\n }\n }\n const line = currentCanvas.lines.find(l => l.id === activeId);\n if (line?.parentId) ids.push(line.parentId);\n }\n return ids;\n }, [currentCanvas.nodes, currentCanvas.lines, activeId]);\n\n const handleNodeClick = useCallback((node: TreeNode) => {\n const id = String(node.id);\n if (id.startsWith('_')) return;\n\n const flowNode = currentCanvas.nodes.find(n => n.id === id);\n const flowEdge = currentCanvas.edges.find(e => e.id === id);\n const flowLine = currentCanvas.lines.find(l => l.id === id);\n\n setSelection({\n nodeIds: flowNode ? new Set([id]) : new Set(),\n edgeIds: flowEdge ? new Set([id]) : new Set(),\n lineIds: flowLine ? new Set([id]) : new Set(),\n });\n\n if (flowNode) {\n focusOnRect(flowNode.position.x, flowNode.position.y, flowNode.width, flowNode.height);\n } else if (flowEdge) {\n const sn = currentCanvas.nodes.find(n => n.id === flowEdge.source);\n const tn = currentCanvas.nodes.find(n => n.id === flowEdge.target);\n if (sn && tn) {\n const minX = Math.min(sn.position.x, tn.position.x);\n const minY = Math.min(sn.position.y, tn.position.y);\n const maxX = Math.max(sn.position.x + sn.width, tn.position.x + tn.width);\n const maxY = Math.max(sn.position.y + sn.height, tn.position.y + tn.height);\n focusOnRect(minX, minY, maxX - minX, maxY - minY);\n }\n } else if (flowLine && flowLine.points.length > 0) {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (const p of flowLine.points) {\n minX = Math.min(minX, p.x); minY = Math.min(minY, p.y);\n maxX = Math.max(maxX, p.x); maxY = Math.max(maxY, p.y);\n }\n focusOnRect(minX - 20, minY - 20, maxX - minX + 40, maxY - minY + 40);\n }\n }, [currentCanvas, setSelection, focusOnRect]);\n\n const handleNodeDoubleClick = useCallback((node: TreeNode) => {\n const id = String(node.id);\n if (id.startsWith('_')) return;\n const flowNode = currentCanvas.nodes.find(n => n.id === id);\n if (flowNode?.data.childCanvasId) {\n pushCanvas(flowNode.data.childCanvasId);\n }\n }, [currentCanvas.nodes, pushCanvas]);\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!activeId || !containerRef.current) return;\n const timer = setTimeout(() => {\n const el = containerRef.current?.querySelector(`[data-node-id=\"${activeId}\"]`);\n if (el) el.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }, 60);\n return () => clearTimeout(timer);\n }, [activeId]);\n\n return (\n <div ref={containerRef}>\n <Tree\n data={treeData}\n onNodeClick={handleNodeClick}\n onNodeDoubleClick={handleNodeDoubleClick}\n activeNodeId={activeId}\n defaultExpandedIds={defaultExpanded}\n showSearch={false}\n showExpandAll={false}\n showIcon\n showLine\n indent={16}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
|
+
* Editable project title shown in the top-left. Renders as plain-looking text
|
|
4
|
+
* (a borderless input) and only becomes editable on double-click, committing on
|
|
5
|
+
* blur or Enter and reverting on Escape. The title is stored on the document
|
|
6
|
+
* and used as the base filename for all exports.
|
|
7
|
+
*/
|
|
8
|
+
export default function ProjectTitle(): React.JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useFlowContext as m } from "../context/FlowContext.js";
|
|
2
|
+
import { useEffect as r, useRef as v, useState as f } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
var D = "未命名流程图";
|
|
5
|
+
function h() {
|
|
6
|
+
const { doc: l, setDoc: u } = m(), [e, o] = f(!1), [n, i] = f(l.title ?? ""), c = v(null);
|
|
7
|
+
r(() => {
|
|
8
|
+
e || i(l.title ?? "");
|
|
9
|
+
}, [l.title, e]), r(() => {
|
|
10
|
+
if (e) {
|
|
11
|
+
const t = c.current;
|
|
12
|
+
t?.focus(), t?.select();
|
|
13
|
+
}
|
|
14
|
+
}, [e]);
|
|
15
|
+
const s = () => {
|
|
16
|
+
const t = n.trim();
|
|
17
|
+
o(!1), u((d) => ({
|
|
18
|
+
...d,
|
|
19
|
+
title: t || void 0
|
|
20
|
+
}));
|
|
21
|
+
}, p = () => {
|
|
22
|
+
i(l.title ?? ""), o(!1);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ a("div", {
|
|
25
|
+
className: "flow-project-title",
|
|
26
|
+
title: "双击编辑标题",
|
|
27
|
+
children: /* @__PURE__ */ a("input", {
|
|
28
|
+
ref: c,
|
|
29
|
+
className: `flow-project-title-input${e ? " flow-project-title-input--editing" : ""}`,
|
|
30
|
+
value: e ? n : l.title ?? "",
|
|
31
|
+
placeholder: D,
|
|
32
|
+
readOnly: !e,
|
|
33
|
+
onDoubleClick: () => o(!0),
|
|
34
|
+
onChange: (t) => i(t.target.value),
|
|
35
|
+
onBlur: () => {
|
|
36
|
+
e && s();
|
|
37
|
+
},
|
|
38
|
+
onKeyDown: (t) => {
|
|
39
|
+
t.key === "Enter" ? (t.preventDefault(), s()) : t.key === "Escape" && (t.preventDefault(), p());
|
|
40
|
+
},
|
|
41
|
+
spellCheck: !1
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
h as default
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=ProjectTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectTitle.js","names":[],"sources":["../../../../../src/components/pro/Flow/panels/ProjectTitle.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { useFlowContext } from '../context/FlowContext';\n\nconst DEFAULT_TITLE = '未命名流程图';\n\n/**\n * Editable project title shown in the top-left. Renders as plain-looking text\n * (a borderless input) and only becomes editable on double-click, committing on\n * blur or Enter and reverting on Escape. The title is stored on the document\n * and used as the base filename for all exports.\n */\nexport default function ProjectTitle() {\n const { doc, setDoc } = useFlowContext();\n const [editing, setEditing] = useState(false);\n const [draft, setDraft] = useState(doc.title ?? '');\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Keep the draft in sync when the document title changes externally\n // (import / undo / new document) while not actively editing.\n useEffect(() => {\n if (!editing) setDraft(doc.title ?? '');\n }, [doc.title, editing]);\n\n useEffect(() => {\n if (editing) {\n const el = inputRef.current;\n el?.focus();\n el?.select();\n }\n }, [editing]);\n\n const commit = () => {\n const next = draft.trim();\n setEditing(false);\n setDoc((prev) => ({ ...prev, title: next || undefined }));\n };\n\n const cancel = () => {\n setDraft(doc.title ?? '');\n setEditing(false);\n };\n\n return (\n <div className=\"flow-project-title\" title=\"双击编辑标题\">\n <input\n ref={inputRef}\n className={`flow-project-title-input${editing ? ' flow-project-title-input--editing' : ''}`}\n value={editing ? draft : (doc.title ?? '')}\n placeholder={DEFAULT_TITLE}\n readOnly={!editing}\n onDoubleClick={() => setEditing(true)}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={() => { if (editing) commit(); }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') { e.preventDefault(); commit(); }\n else if (e.key === 'Escape') { e.preventDefault(); cancel(); }\n }}\n spellCheck={false}\n />\n </div>\n );\n}\n"],"mappings":";;;AAGA,IAAM,IAAgB;AAQtB,SAAwB,IAAe;AACrC,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,EAAe,GACjC,CAAC,GAAS,CAAA,IAAc,EAAS,EAAK,GACtC,CAAC,GAAO,CAAA,IAAY,EAAS,EAAI,SAAS,EAAE,GAC5C,IAAW,EAAyB,IAAI;AAI9C,EAAA,EAAA,MAAgB;AACd,IAAK,KAAS,EAAS,EAAI,SAAS,EAAE;AAAA,EACxC,GAAG,CAAC,EAAI,OAAO,CAAO,CAAC,GAEvB,EAAA,MAAgB;AACd,QAAI,GAAS;AACX,YAAM,IAAK,EAAS;AACpB,MAAA,GAAI,MAAM,GACV,GAAI,OAAO;AAAA,IACb;AAAA,EACF,GAAG,CAAC,CAAO,CAAC;AAEZ,QAAM,IAAA,MAAe;AACnB,UAAM,IAAO,EAAM,KAAK;AACxB,IAAA,EAAW,EAAK,GAChB,EAAA,CAAQ,OAAU;AAAA,MAAE,GAAG;AAAA,MAAM,OAAO,KAAQ;AAAA,IAAU,EAAE;AAAA,EAC1D,GAEM,IAAA,MAAe;AACnB,IAAA,EAAS,EAAI,SAAS,EAAE,GACxB,EAAW,EAAK;AAAA,EAClB;AAEA,SACE,gBAAA,EAAC,OAAD;AAAA,IAAK,WAAU;AAAA,IAAqB,OAAM;AAAA,cACxC,gBAAA,EAAC,SAAD;AAAA,MACE,KAAK;AAAA,MACL,WAAW,2BAA2B,IAAU,uCAAuC,EAAA;AAAA,MACvF,OAAO,IAAU,IAAS,EAAI,SAAS;AAAA,MACvC,aAAa;AAAA,MACb,UAAU,CAAC;AAAA,MACX,eAAA,MAAqB,EAAW,EAAI;AAAA,MACpC,UAAA,CAAW,MAAM,EAAS,EAAE,OAAO,KAAK;AAAA,MACxC,QAAA,MAAc;AAAE,QAAI,KAAS,EAAO;AAAA,MAAG;AAAA,MACvC,WAAA,CAAY,MAAM;AAChB,QAAI,EAAE,QAAQ,WAAW,EAAE,eAAe,GAAG,EAAO,KAC3C,EAAE,QAAQ,aAAY,EAAE,eAAe,GAAG,EAAO;AAAA,MAC5D;AAAA,MACA,YAAY;AAAA,IACb,CAAA;AAAA,EACE,CAAA;AAET"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { PALETTE_ITEMS as $ } from "../constants.js";
|
|
2
|
-
import { useFlowUI as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
2
|
+
import { useFlowUI as y } from "../context/FlowUIContext.js";
|
|
3
|
+
import { resolveThemeColor as b } from "../utils/themeColor.js";
|
|
4
|
+
import { SVG_ICON_CATEGORIES as v, buildSvgMarkup as M, getSvgIcon as x, getSvgIconsByCategory as S } from "../nodes/svgIcons.js";
|
|
5
|
+
import { useDraggablePanel as C } from "../hooks/useDraggablePanel.js";
|
|
6
|
+
import { useResizablePanel as P } from "../hooks/useResizablePanel.js";
|
|
7
|
+
import { makeStarterDataConfig as W } from "../nodes/dataUtils.js";
|
|
8
|
+
import { useCallback as u, useState as I } from "react";
|
|
9
|
+
import { Fragment as g, jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
10
|
+
var T = [
|
|
9
11
|
{
|
|
10
12
|
mode: "freehand",
|
|
11
13
|
label: "Freehand"
|
|
@@ -23,13 +25,13 @@ var W = [
|
|
|
23
25
|
label: "Arrow"
|
|
24
26
|
}
|
|
25
27
|
];
|
|
26
|
-
function
|
|
27
|
-
const { showPalette: l } =
|
|
28
|
-
return l ? /* @__PURE__ */
|
|
28
|
+
function V() {
|
|
29
|
+
const { showPalette: l } = y(), { panelStyle: r, handleProps: a } = C(), { panelWidth: t, resizeHandleProps: o } = P("right", 180);
|
|
30
|
+
return l ? /* @__PURE__ */ c("div", {
|
|
29
31
|
className: "flow-palette",
|
|
30
32
|
"data-flow-panel": !0,
|
|
31
33
|
style: {
|
|
32
|
-
...
|
|
34
|
+
...r,
|
|
33
35
|
width: t
|
|
34
36
|
},
|
|
35
37
|
children: [
|
|
@@ -39,12 +41,12 @@ function F() {
|
|
|
39
41
|
}),
|
|
40
42
|
/* @__PURE__ */ e("div", {
|
|
41
43
|
className: "flow-panel-drag-handle",
|
|
42
|
-
...
|
|
44
|
+
...a,
|
|
43
45
|
style: {
|
|
44
46
|
fontSize: 11,
|
|
45
47
|
fontWeight: 600,
|
|
46
48
|
marginBottom: 6,
|
|
47
|
-
color: "oklch
|
|
49
|
+
color: "color-mix(in oklch, var(--color-base-content) 50%, transparent)",
|
|
48
50
|
textTransform: "uppercase",
|
|
49
51
|
letterSpacing: "0.05em",
|
|
50
52
|
cursor: "grab"
|
|
@@ -53,45 +55,45 @@ function F() {
|
|
|
53
55
|
}),
|
|
54
56
|
/* @__PURE__ */ e("div", {
|
|
55
57
|
className: "flow-palette-content",
|
|
56
|
-
children: /* @__PURE__ */ e(
|
|
58
|
+
children: /* @__PURE__ */ e(N, {})
|
|
57
59
|
})
|
|
58
60
|
]
|
|
59
61
|
}) : null;
|
|
60
62
|
}
|
|
61
|
-
function
|
|
62
|
-
const { toolMode: l, setToolMode:
|
|
63
|
-
t?.type === n ?
|
|
63
|
+
function N() {
|
|
64
|
+
const { toolMode: l, setToolMode: r, setPendingPlacement: a, pendingPlacement: t } = y(), o = u((n, s, p, h) => {
|
|
65
|
+
t?.type === n ? a(null) : (a({
|
|
64
66
|
type: n,
|
|
65
|
-
width:
|
|
67
|
+
width: s,
|
|
66
68
|
height: p,
|
|
67
|
-
data: { ...
|
|
68
|
-
}),
|
|
69
|
+
data: { ...h }
|
|
70
|
+
}), r("select"));
|
|
69
71
|
}, [
|
|
70
|
-
i,
|
|
71
72
|
a,
|
|
73
|
+
r,
|
|
72
74
|
t
|
|
73
75
|
]);
|
|
74
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ c(g, { children: [
|
|
75
77
|
/* @__PURE__ */ e("div", {
|
|
76
78
|
className: "flow-palette-grid",
|
|
77
|
-
children: $.map((n) => /* @__PURE__ */
|
|
79
|
+
children: $.map((n) => /* @__PURE__ */ c("div", {
|
|
78
80
|
className: `flow-palette-item${t?.type === n.type ? " flow-palette-item--active" : ""}`,
|
|
79
81
|
onClick: () => o(n.type, n.width, n.height, n.data),
|
|
80
|
-
children: [/* @__PURE__ */ e(
|
|
82
|
+
children: [/* @__PURE__ */ e(D, { type: n.type }), /* @__PURE__ */ e("span", {
|
|
81
83
|
className: "flow-palette-item-label",
|
|
82
84
|
children: n.data.label
|
|
83
85
|
})]
|
|
84
86
|
}, n.type))
|
|
85
87
|
}),
|
|
86
|
-
/* @__PURE__ */ e(
|
|
88
|
+
/* @__PURE__ */ e(z, { children: "Lines" }),
|
|
87
89
|
/* @__PURE__ */ e("div", {
|
|
88
90
|
className: "flow-palette-grid",
|
|
89
|
-
children:
|
|
91
|
+
children: T.map((n) => /* @__PURE__ */ c("div", {
|
|
90
92
|
className: `flow-palette-item${l === n.mode ? " flow-palette-item--active" : ""}`,
|
|
91
93
|
onClick: () => {
|
|
92
|
-
|
|
94
|
+
a(null), r(l === n.mode ? "select" : n.mode);
|
|
93
95
|
},
|
|
94
|
-
children: [/* @__PURE__ */ e(
|
|
96
|
+
children: [/* @__PURE__ */ e(E, { mode: n.mode }), /* @__PURE__ */ e("span", {
|
|
95
97
|
className: "flow-palette-item-label",
|
|
96
98
|
children: n.label
|
|
97
99
|
})]
|
|
@@ -99,76 +101,78 @@ function I() {
|
|
|
99
101
|
})
|
|
100
102
|
] });
|
|
101
103
|
}
|
|
102
|
-
function
|
|
103
|
-
const { setPendingPlacement: l, setToolMode:
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
104
|
+
function Z() {
|
|
105
|
+
const { setPendingPlacement: l, setToolMode: r, pendingPlacement: a } = y(), [t, o] = I({ lang: !0 }), n = u((s, p) => {
|
|
106
|
+
const h = a?.data.svgId;
|
|
107
|
+
if (a?.type === "shapeSvg" && h === s) {
|
|
106
108
|
l(null);
|
|
107
109
|
return;
|
|
108
110
|
}
|
|
111
|
+
const i = {
|
|
112
|
+
label: p,
|
|
113
|
+
fill: "transparent",
|
|
114
|
+
stroke: "theme:base-content",
|
|
115
|
+
strokeWidth: 1.5,
|
|
116
|
+
color: x(s)?.brandColor ?? "theme:base-content",
|
|
117
|
+
labelColor: "theme:base-content",
|
|
118
|
+
fontSize: 12,
|
|
119
|
+
svgId: s,
|
|
120
|
+
iconBox: !1,
|
|
121
|
+
labelPlacement: "bottom",
|
|
122
|
+
borderStyle: "none"
|
|
123
|
+
};
|
|
109
124
|
l({
|
|
110
125
|
type: "shapeSvg",
|
|
111
126
|
width: 56,
|
|
112
127
|
height: 56,
|
|
113
|
-
data:
|
|
114
|
-
|
|
115
|
-
fill: "transparent",
|
|
116
|
-
stroke: "#64748b",
|
|
117
|
-
strokeWidth: 1.5,
|
|
118
|
-
color: "#334155",
|
|
119
|
-
fontSize: 12,
|
|
120
|
-
svgId: h,
|
|
121
|
-
iconBox: !1,
|
|
122
|
-
labelPlacement: "bottom",
|
|
123
|
-
borderStyle: "none"
|
|
124
|
-
}
|
|
125
|
-
}), a("select");
|
|
128
|
+
data: i
|
|
129
|
+
}), r("select");
|
|
126
130
|
}, [
|
|
127
|
-
|
|
131
|
+
a,
|
|
128
132
|
l,
|
|
129
|
-
|
|
133
|
+
r
|
|
130
134
|
]);
|
|
131
|
-
return /* @__PURE__ */ e(g, { children:
|
|
132
|
-
const p =
|
|
133
|
-
return /* @__PURE__ */
|
|
135
|
+
return /* @__PURE__ */ e(g, { children: v.map((s) => {
|
|
136
|
+
const p = S(s.id), h = t[s.id];
|
|
137
|
+
return /* @__PURE__ */ c("div", { children: [/* @__PURE__ */ c("button", {
|
|
134
138
|
type: "button",
|
|
135
139
|
className: "flow-palette-section-toggle",
|
|
136
|
-
onClick: () => o((
|
|
137
|
-
...
|
|
138
|
-
[
|
|
140
|
+
onClick: () => o((i) => ({
|
|
141
|
+
...i,
|
|
142
|
+
[s.id]: !i[s.id]
|
|
139
143
|
})),
|
|
140
144
|
children: [/* @__PURE__ */ e("span", {
|
|
141
145
|
style: {
|
|
142
|
-
transform:
|
|
146
|
+
transform: h ? "rotate(90deg)" : "none",
|
|
143
147
|
transition: "transform .15s"
|
|
144
148
|
},
|
|
145
149
|
children: "▸"
|
|
146
|
-
}),
|
|
147
|
-
}),
|
|
150
|
+
}), s.label]
|
|
151
|
+
}), h && /* @__PURE__ */ e("div", {
|
|
148
152
|
className: "flow-palette-grid",
|
|
149
|
-
children: p.map((
|
|
150
|
-
className: `flow-palette-item${
|
|
151
|
-
onClick: () => n(
|
|
152
|
-
title:
|
|
153
|
-
children: [/* @__PURE__ */ e(
|
|
153
|
+
children: p.map((i) => /* @__PURE__ */ c("div", {
|
|
154
|
+
className: `flow-palette-item${a?.type === "shapeSvg" && a.data.svgId === i.id ? " flow-palette-item--active" : ""}`,
|
|
155
|
+
onClick: () => n(i.id, i.label),
|
|
156
|
+
title: i.label,
|
|
157
|
+
children: [/* @__PURE__ */ e(A, { id: i.id }), /* @__PURE__ */ e("span", {
|
|
154
158
|
className: "flow-palette-item-label",
|
|
155
|
-
children:
|
|
159
|
+
children: i.label
|
|
156
160
|
})]
|
|
157
|
-
},
|
|
158
|
-
})] },
|
|
161
|
+
}, i.id))
|
|
162
|
+
})] }, s.id);
|
|
159
163
|
}) });
|
|
160
164
|
}
|
|
161
|
-
function
|
|
162
|
-
const
|
|
163
|
-
return
|
|
164
|
-
src: `data:image/svg+xml;utf8,${encodeURIComponent(
|
|
165
|
-
width:
|
|
166
|
-
height:
|
|
165
|
+
function A({ id: l }) {
|
|
166
|
+
const r = M(l, b(x(l)?.brandColor, "") || "#475569");
|
|
167
|
+
return r ? /* @__PURE__ */ e("img", {
|
|
168
|
+
src: `data:image/svg+xml;utf8,${encodeURIComponent(r)}`,
|
|
169
|
+
width: 20,
|
|
170
|
+
height: 16,
|
|
167
171
|
alt: "",
|
|
168
172
|
style: { objectFit: "contain" }
|
|
169
173
|
}) : null;
|
|
170
174
|
}
|
|
171
|
-
var
|
|
175
|
+
var L = [
|
|
172
176
|
{
|
|
173
177
|
kind: "markdown",
|
|
174
178
|
label: "Markdown",
|
|
@@ -235,37 +239,46 @@ var N = [
|
|
|
235
239
|
height: 340,
|
|
236
240
|
content: "",
|
|
237
241
|
icon: /* @__PURE__ */ e(m, { text: "AI" })
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
kind: "data",
|
|
245
|
+
label: "Data",
|
|
246
|
+
width: 420,
|
|
247
|
+
height: 300,
|
|
248
|
+
content: "",
|
|
249
|
+
icon: /* @__PURE__ */ e(m, { text: "⊞" })
|
|
238
250
|
}
|
|
239
251
|
];
|
|
240
252
|
function m({ text: l }) {
|
|
241
253
|
return /* @__PURE__ */ e("div", {
|
|
242
254
|
style: {
|
|
243
|
-
width:
|
|
244
|
-
height:
|
|
255
|
+
width: 20,
|
|
256
|
+
height: 16,
|
|
245
257
|
display: "flex",
|
|
246
258
|
alignItems: "center",
|
|
247
259
|
justifyContent: "center",
|
|
248
|
-
fontSize:
|
|
260
|
+
fontSize: 9,
|
|
249
261
|
fontWeight: 700,
|
|
250
|
-
color: "oklch
|
|
251
|
-
border: "1px solid oklch
|
|
252
|
-
borderRadius:
|
|
262
|
+
color: "color-mix(in oklch, var(--color-base-content) 60%, transparent)",
|
|
263
|
+
border: "1px solid color-mix(in oklch, var(--color-base-content) 20%, transparent)",
|
|
264
|
+
borderRadius: 3,
|
|
265
|
+
flexShrink: 0
|
|
253
266
|
},
|
|
254
267
|
children: l
|
|
255
268
|
});
|
|
256
269
|
}
|
|
257
|
-
function
|
|
258
|
-
const { setPendingPlacement: l, setToolMode:
|
|
259
|
-
if (
|
|
270
|
+
function q() {
|
|
271
|
+
const { setPendingPlacement: l, setToolMode: r, pendingPlacement: a } = y(), t = u((o) => {
|
|
272
|
+
if (a?.type === "mediaNode" && a.data.mediaKind === o.kind) {
|
|
260
273
|
l(null);
|
|
261
274
|
return;
|
|
262
275
|
}
|
|
263
276
|
const n = {
|
|
264
277
|
label: o.label,
|
|
265
|
-
fill: "
|
|
266
|
-
stroke: "
|
|
278
|
+
fill: "theme:base-100",
|
|
279
|
+
stroke: "theme:base-content",
|
|
267
280
|
strokeWidth: 1.5,
|
|
268
|
-
color: "
|
|
281
|
+
color: "theme:base-content",
|
|
269
282
|
fontSize: 13,
|
|
270
283
|
borderStyle: "solid",
|
|
271
284
|
mediaKind: o.kind,
|
|
@@ -274,23 +287,23 @@ function O() {
|
|
|
274
287
|
gateway: "",
|
|
275
288
|
protocol: "openai",
|
|
276
289
|
model: ""
|
|
277
|
-
} } : o.kind === "model3d" ? { modelFormat: "stl" } : {}
|
|
290
|
+
} } : o.kind === "model3d" ? { modelFormat: "stl" } : o.kind === "data" ? { dataConfig: W() } : {}
|
|
278
291
|
};
|
|
279
292
|
l({
|
|
280
293
|
type: "mediaNode",
|
|
281
294
|
width: o.width,
|
|
282
295
|
height: o.height,
|
|
283
296
|
data: n
|
|
284
|
-
}),
|
|
297
|
+
}), r("select");
|
|
285
298
|
}, [
|
|
286
|
-
|
|
299
|
+
a,
|
|
287
300
|
l,
|
|
288
|
-
|
|
301
|
+
r
|
|
289
302
|
]);
|
|
290
303
|
return /* @__PURE__ */ e("div", {
|
|
291
304
|
className: "flow-palette-grid",
|
|
292
|
-
children:
|
|
293
|
-
className: `flow-palette-item${
|
|
305
|
+
children: L.map((o) => /* @__PURE__ */ c("div", {
|
|
306
|
+
className: `flow-palette-item${a?.type === "mediaNode" && a.data.mediaKind === o.kind ? " flow-palette-item--active" : ""}`,
|
|
294
307
|
onClick: () => t(o),
|
|
295
308
|
title: o.label,
|
|
296
309
|
children: [o.icon, /* @__PURE__ */ e("span", {
|
|
@@ -300,20 +313,20 @@ function O() {
|
|
|
300
313
|
}, o.kind))
|
|
301
314
|
});
|
|
302
315
|
}
|
|
303
|
-
function
|
|
316
|
+
function z({ children: l }) {
|
|
304
317
|
return /* @__PURE__ */ e("div", {
|
|
305
318
|
style: {
|
|
306
319
|
fontSize: 11,
|
|
307
320
|
fontWeight: 600,
|
|
308
321
|
margin: "10px 0 6px",
|
|
309
|
-
color: "oklch
|
|
322
|
+
color: "color-mix(in oklch, var(--color-base-content) 50%, transparent)",
|
|
310
323
|
textTransform: "uppercase",
|
|
311
324
|
letterSpacing: "0.05em"
|
|
312
325
|
},
|
|
313
326
|
children: l
|
|
314
327
|
});
|
|
315
328
|
}
|
|
316
|
-
function
|
|
329
|
+
function D({ type: l }) {
|
|
317
330
|
const t = "currentColor", n = {
|
|
318
331
|
shapeRect: /* @__PURE__ */ e("rect", {
|
|
319
332
|
x: "3",
|
|
@@ -375,11 +388,11 @@ function A({ type: l }) {
|
|
|
375
388
|
strokeWidth: 1.5
|
|
376
389
|
}),
|
|
377
390
|
shapePentagon: (() => {
|
|
378
|
-
const
|
|
391
|
+
const h = Math.min(18, 14) - 4;
|
|
379
392
|
return /* @__PURE__ */ e("polygon", {
|
|
380
|
-
points: Array.from({ length: 5 }, (
|
|
381
|
-
const
|
|
382
|
-
return `${18 +
|
|
393
|
+
points: Array.from({ length: 5 }, (i, k) => {
|
|
394
|
+
const d = Math.PI * 2 * k / 5 - Math.PI / 2;
|
|
395
|
+
return `${18 + h * Math.cos(d)},${14 + h * Math.sin(d)}`;
|
|
383
396
|
}).join(" "),
|
|
384
397
|
fill: "none",
|
|
385
398
|
stroke: t,
|
|
@@ -387,8 +400,8 @@ function A({ type: l }) {
|
|
|
387
400
|
});
|
|
388
401
|
})(),
|
|
389
402
|
shapeHexagon: /* @__PURE__ */ e("polygon", {
|
|
390
|
-
points: Array.from({ length: 6 }, (
|
|
391
|
-
const w = Math.PI * 2 *
|
|
403
|
+
points: Array.from({ length: 6 }, (k, d) => {
|
|
404
|
+
const w = Math.PI * 2 * d / 6 - Math.PI / 6;
|
|
392
405
|
return `${18 + 14 * Math.cos(w)},${14 + 10 * Math.sin(w)}`;
|
|
393
406
|
}).join(" "),
|
|
394
407
|
fill: "none",
|
|
@@ -396,10 +409,10 @@ function A({ type: l }) {
|
|
|
396
409
|
strokeWidth: 1.5
|
|
397
410
|
}),
|
|
398
411
|
shapeStar: (() => {
|
|
399
|
-
const
|
|
412
|
+
const h = Math.min(18, 14) - 3, i = h * 0.4;
|
|
400
413
|
return /* @__PURE__ */ e("polygon", {
|
|
401
|
-
points: Array.from({ length: 10 }, (
|
|
402
|
-
const w = Math.PI *
|
|
414
|
+
points: Array.from({ length: 10 }, (k, d) => {
|
|
415
|
+
const w = Math.PI * d / 5 - Math.PI / 2, f = d % 2 === 0 ? h : i;
|
|
403
416
|
return `${18 + f * Math.cos(w)},${14 + f * Math.sin(w)}`;
|
|
404
417
|
}).join(" "),
|
|
405
418
|
fill: "none",
|
|
@@ -408,10 +421,10 @@ function A({ type: l }) {
|
|
|
408
421
|
});
|
|
409
422
|
})(),
|
|
410
423
|
shapeHexagram: (() => {
|
|
411
|
-
const
|
|
424
|
+
const h = Math.min(18, 14) - 3, i = h * 0.55;
|
|
412
425
|
return /* @__PURE__ */ e("polygon", {
|
|
413
|
-
points: Array.from({ length: 12 }, (
|
|
414
|
-
const w = Math.PI *
|
|
426
|
+
points: Array.from({ length: 12 }, (k, d) => {
|
|
427
|
+
const w = Math.PI * d / 6 - Math.PI / 2, f = d % 2 === 0 ? h : i;
|
|
415
428
|
return `${18 + f * Math.cos(w)},${14 + f * Math.sin(w)}`;
|
|
416
429
|
}).join(" "),
|
|
417
430
|
fill: "none",
|
|
@@ -440,7 +453,7 @@ function A({ type: l }) {
|
|
|
440
453
|
fill: "currentColor",
|
|
441
454
|
children: "Aa"
|
|
442
455
|
}),
|
|
443
|
-
animAnchor: /* @__PURE__ */
|
|
456
|
+
animAnchor: /* @__PURE__ */ c(g, { children: [
|
|
444
457
|
/* @__PURE__ */ e("rect", {
|
|
445
458
|
x: "3",
|
|
446
459
|
y: "4",
|
|
@@ -486,13 +499,13 @@ function A({ type: l }) {
|
|
|
486
499
|
width: 36,
|
|
487
500
|
height: 28,
|
|
488
501
|
viewBox: "0 0 36 28",
|
|
489
|
-
style: { color: "oklch
|
|
502
|
+
style: { color: "color-mix(in oklch, var(--color-base-content) 55%, transparent)" },
|
|
490
503
|
children: n[l] ?? n.shapeRect
|
|
491
504
|
});
|
|
492
505
|
}
|
|
493
|
-
function
|
|
506
|
+
function E({ mode: l }) {
|
|
494
507
|
const t = "currentColor", n = {
|
|
495
|
-
connect: /* @__PURE__ */
|
|
508
|
+
connect: /* @__PURE__ */ c(g, { children: [/* @__PURE__ */ e("line", {
|
|
496
509
|
x1: "6",
|
|
497
510
|
y1: 22,
|
|
498
511
|
x2: 30,
|
|
@@ -525,7 +538,7 @@ function L({ mode: l }) {
|
|
|
525
538
|
strokeWidth: 1.5,
|
|
526
539
|
strokeLinejoin: "round"
|
|
527
540
|
}),
|
|
528
|
-
arrow: /* @__PURE__ */
|
|
541
|
+
arrow: /* @__PURE__ */ c(g, { children: [/* @__PURE__ */ e("line", {
|
|
529
542
|
x1: "6",
|
|
530
543
|
y1: 22,
|
|
531
544
|
x2: 30,
|
|
@@ -541,16 +554,16 @@ function L({ mode: l }) {
|
|
|
541
554
|
width: 36,
|
|
542
555
|
height: 28,
|
|
543
556
|
viewBox: "0 0 36 28",
|
|
544
|
-
style: { color: "oklch
|
|
557
|
+
style: { color: "color-mix(in oklch, var(--color-base-content) 55%, transparent)" },
|
|
545
558
|
children: n[l] ?? n.line
|
|
546
559
|
});
|
|
547
560
|
}
|
|
548
561
|
export {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
562
|
+
q as MediaStampContent,
|
|
563
|
+
D as PaletteThumbnail,
|
|
564
|
+
N as ShapePaletteContent,
|
|
565
|
+
Z as SvgStampContent,
|
|
566
|
+
V as default
|
|
554
567
|
};
|
|
555
568
|
|
|
556
569
|
//# sourceMappingURL=ShapePalette.js.map
|