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.
Files changed (115) hide show
  1. package/dist/chart.js +35 -33
  2. package/dist/components/Chart/index.d.ts +1 -1
  3. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +1 -2
  4. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
  5. package/dist/components/pro/CodeEditor/themes.js +0 -25
  6. package/dist/components/pro/CodeEditor/themes.js.map +1 -1
  7. package/dist/components/pro/CodeEditor/types.d.ts +1 -1
  8. package/dist/components/pro/DataTable/pivotExtension.d.ts +6 -0
  9. package/dist/components/pro/DataTable/pivotExtension.js +31 -30
  10. package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
  11. package/dist/components/pro/Flow/Flow.js +500 -459
  12. package/dist/components/pro/Flow/Flow.js.map +1 -1
  13. package/dist/components/pro/Flow/FlowCanvas.js +526 -524
  14. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  15. package/dist/components/pro/Flow/canvas/GridRenderer.d.ts +3 -0
  16. package/dist/components/pro/Flow/canvas/GridRenderer.js +28 -23
  17. package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
  18. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +18 -17
  19. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
  20. package/dist/components/pro/Flow/canvas/PixiApp.d.ts +24 -0
  21. package/dist/components/pro/Flow/canvas/PixiApp.js +60 -15
  22. package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
  23. package/dist/components/pro/Flow/constants.js +7 -7
  24. package/dist/components/pro/Flow/constants.js.map +1 -1
  25. package/dist/components/pro/Flow/context/FlowAIContext.d.ts +15 -0
  26. package/dist/components/pro/Flow/context/FlowAIContext.js +32 -0
  27. package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -0
  28. package/dist/components/pro/Flow/context/FlowUIContext.d.ts +4 -1
  29. package/dist/components/pro/Flow/context/FlowUIContext.js +58 -55
  30. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  31. package/dist/components/pro/Flow/edges/EdgeRenderer.js +22 -21
  32. package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
  33. package/dist/components/pro/Flow/hooks/useFlowImportExport.d.ts +6 -0
  34. package/dist/components/pro/Flow/hooks/useFlowImportExport.js +146 -89
  35. package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
  36. package/dist/components/pro/Flow/hooks/useLayoutActions.d.ts +2 -0
  37. package/dist/components/pro/Flow/hooks/useLayoutActions.js +94 -65
  38. package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
  39. package/dist/components/pro/Flow/hooks/usePdfExport.d.ts +10 -0
  40. package/dist/components/pro/Flow/hooks/usePdfExport.js +60 -0
  41. package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -0
  42. package/dist/components/pro/Flow/hooks/usePixiApp.d.ts +6 -1
  43. package/dist/components/pro/Flow/hooks/usePixiApp.js +49 -30
  44. package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
  45. package/dist/components/pro/Flow/index.d.ts +5 -2
  46. package/dist/components/pro/Flow/lines/FreehandTool.js +21 -20
  47. package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
  48. package/dist/components/pro/Flow/lines/GeometricLineTool.js +22 -18
  49. package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
  50. package/dist/components/pro/Flow/lines/LineRenderer.js +19 -18
  51. package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
  52. package/dist/components/pro/Flow/nodes/DataNodeView.d.ts +7 -0
  53. package/dist/components/pro/Flow/nodes/DataNodeView.js +217 -0
  54. package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -0
  55. package/dist/components/pro/Flow/nodes/MediaContent.js +149 -120
  56. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  57. package/dist/components/pro/Flow/nodes/MediaOverlay.js +22 -17
  58. package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
  59. package/dist/components/pro/Flow/nodes/NodeRenderer.js +77 -76
  60. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  61. package/dist/components/pro/Flow/nodes/aiClient.d.ts +22 -0
  62. package/dist/components/pro/Flow/nodes/aiClient.js +107 -54
  63. package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
  64. package/dist/components/pro/Flow/nodes/dataUtils.d.ts +52 -0
  65. package/dist/components/pro/Flow/nodes/dataUtils.js +270 -0
  66. package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -0
  67. package/dist/components/pro/Flow/nodes/svgIcons.js +59 -27
  68. package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
  69. package/dist/components/pro/Flow/panels/AIPanel.d.ts +2 -0
  70. package/dist/components/pro/Flow/panels/AIPanel.js +498 -0
  71. package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -0
  72. package/dist/components/pro/Flow/panels/DataInspectorSection.d.ts +11 -0
  73. package/dist/components/pro/Flow/panels/DataInspectorSection.js +436 -0
  74. package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -0
  75. package/dist/components/pro/Flow/panels/ExpandableTextarea.d.ts +16 -0
  76. package/dist/components/pro/Flow/panels/ExpandableTextarea.js +65 -0
  77. package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -0
  78. package/dist/components/pro/Flow/panels/FlowPanelGroup.js +51 -39
  79. package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
  80. package/dist/components/pro/Flow/panels/FlowToolbar.d.ts +5 -1
  81. package/dist/components/pro/Flow/panels/FlowToolbar.js +310 -233
  82. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  83. package/dist/components/pro/Flow/panels/InspectorPanel.js +358 -363
  84. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  85. package/dist/components/pro/Flow/panels/OutlinePanel.js +63 -62
  86. package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
  87. package/dist/components/pro/Flow/panels/ProjectTitle.d.ts +8 -0
  88. package/dist/components/pro/Flow/panels/ProjectTitle.js +49 -0
  89. package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -0
  90. package/dist/components/pro/Flow/panels/ShapePalette.js +128 -115
  91. package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
  92. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +13 -0
  93. package/dist/components/pro/Flow/panels/toolbarIcons.js +241 -87
  94. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  95. package/dist/components/pro/Flow/types.d.ts +77 -1
  96. package/dist/components/pro/Flow/types.js.map +1 -1
  97. package/dist/components/pro/Flow/utils/pdfExport.d.ts +20 -0
  98. package/dist/components/pro/Flow/utils/pdfExport.js +95 -0
  99. package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -0
  100. package/dist/components/pro/Flow/utils/themeColor.d.ts +86 -0
  101. package/dist/components/pro/Flow/utils/themeColor.js +190 -0
  102. package/dist/components/pro/Flow/utils/themeColor.js.map +1 -0
  103. package/dist/contexts/AppContext.d.ts +1 -1
  104. package/dist/contexts/AppContext.js +28 -29
  105. package/dist/contexts/AppContext.js.map +1 -1
  106. package/dist/dishui.css +1 -1
  107. package/dist/favicon.svg +10 -0
  108. package/dist/flow.js +59 -51
  109. package/dist/index-nostyled.d.ts +1 -1
  110. package/dist/index.d.ts +1 -1
  111. package/dist/styles/themeStyles.js +6 -11
  112. package/dist/styles/themeStyles.js.map +1 -1
  113. package/dist/utils/themes.js +3 -23
  114. package/dist/utils/themes.js.map +1 -1
  115. package/package.json +17 -18
@@ -1,92 +1,95 @@
1
- import { createContext as ce, useCallback as o, useContext as ie, useMemo as ue, useRef as u, useState as e } from "react";
2
- import { jsx as ae } from "react/jsx-runtime";
3
- var G = ce(null);
4
- function he() {
5
- const n = ie(G);
1
+ import { createContext as ae, useCallback as o, useContext as le, useMemo as we, useRef as i, useState as e } from "react";
2
+ import { jsx as de } from "react/jsx-runtime";
3
+ var G = ae(null);
4
+ function fe() {
5
+ const n = le(G);
6
6
  if (!n) throw new Error("useFlowUI must be used within FlowUIProvider");
7
7
  return n;
8
8
  }
9
- function ge({ showMiniMap: n = !0, showGrid: b = !0, gridSize: y = 20, children: A }) {
10
- const [a, E] = e("select"), [l, V] = e("smoothstep"), [d, w] = e({
9
+ function Se({ showMiniMap: n = !0, showGrid: b = !0, gridSize: y = 20, showAI: E = !0, children: V }) {
10
+ const [a, J] = e("select"), [l, j] = e("smoothstep"), [w, d] = e({
11
11
  x: 0,
12
12
  y: 0,
13
13
  zoom: 1
14
- }), h = u(0), J = o((t) => {
15
- h.current += 1, w(t);
16
- }, []), j = o((t) => {
17
- w(t);
18
- }, []), [g, k] = e(!1), [p, q] = e(null), r = u(0), [c, f] = e(!1), S = o(() => {
14
+ }), h = i(0), k = o((t) => {
15
+ h.current += 1, d(t);
16
+ }, []), q = o((t) => {
17
+ d(t);
18
+ }, []), [g, B] = e(!1), [p, H] = e(null), r = i(0), [c, f] = e(!1), S = o(() => {
19
19
  r.current += 1, c || f(!0);
20
- }, [c]), M = o(() => {
20
+ }, [c]), I = o(() => {
21
21
  r.current = Math.max(0, r.current - 1), r.current === 0 && f(!1);
22
- }, []), [m, B] = e(!0), [x, H] = e(!0), [I, K] = e(!0), [P, L] = e(!0), [R, Q] = e(n), [F, W] = e(b), [v, X] = e(!0), [C, Y] = e(y), [D, Z] = e(null), [N, _] = e(null), [O, $] = e(null), [T, ee] = e(/* @__PURE__ */ new Set()), U = o((t) => {
23
- ee((i) => {
24
- const s = new Set(i);
22
+ }, []), [M, K] = e(!0), [m, L] = e(!0), [x, Q] = e(!0), [P, W] = e(!0), [R, X] = e(E), [F, Y] = e(n), [v, Z] = e(b), [A, _] = e(!0), [C, $] = e(y), [D, ee] = e(null), [N, te] = e(null), [O, oe] = e(null), [T, se] = e(/* @__PURE__ */ new Set()), U = o((t) => {
23
+ se((u) => {
24
+ const s = new Set(u);
25
25
  return s.has(t) ? s.delete(t) : s.add(t), s;
26
26
  });
27
- }, []), z = u(() => {
28
- }), te = o((t, i, s, ne, re) => {
29
- z.current(t, i, s, ne, re);
30
- }, []), oe = o((t) => {
27
+ }, []), z = i(() => {
28
+ }), ne = o((t, u, s, ue, ie) => {
29
+ z.current(t, u, s, ue, ie);
30
+ }, []), re = o((t) => {
31
31
  z.current = t;
32
- }, []), se = ue(() => ({
32
+ }, []), ce = we(() => ({
33
33
  toolMode: a,
34
- setToolMode: E,
34
+ setToolMode: J,
35
35
  edgeType: l,
36
- setEdgeType: V,
37
- viewport: d,
38
- setViewport: J,
39
- setViewportInternal: j,
36
+ setEdgeType: j,
37
+ viewport: w,
38
+ setViewport: k,
39
+ setViewportInternal: q,
40
40
  viewportReqRef: h,
41
- focusOnRect: te,
42
- setFocusOnRect: oe,
41
+ focusOnRect: ne,
42
+ setFocusOnRect: re,
43
43
  autoFocus: g,
44
- setAutoFocus: k,
44
+ setAutoFocus: B,
45
45
  editingNodeId: p,
46
- setEditingNodeId: q,
46
+ setEditingNodeId: H,
47
47
  isNodeDragging: c,
48
48
  beginNodeDrag: S,
49
- endNodeDrag: M,
50
- showPalette: m,
51
- setShowPalette: B,
52
- showInspector: x,
53
- setShowInspector: H,
54
- showOutline: I,
55
- setShowOutline: K,
49
+ endNodeDrag: I,
50
+ showPalette: M,
51
+ setShowPalette: K,
52
+ showInspector: m,
53
+ setShowInspector: L,
54
+ showOutline: x,
55
+ setShowOutline: Q,
56
56
  showJson: P,
57
- setShowJson: L,
58
- showMiniMap: R,
59
- setShowMiniMap: Q,
60
- showGrid: F,
61
- setShowGrid: W,
62
- showAnchors: v,
63
- setShowAnchors: X,
57
+ setShowJson: W,
58
+ showAI: R,
59
+ setShowAI: X,
60
+ showMiniMap: F,
61
+ setShowMiniMap: Y,
62
+ showGrid: v,
63
+ setShowGrid: Z,
64
+ showAnchors: A,
65
+ setShowAnchors: _,
64
66
  gridSize: C,
65
- setGridSize: Y,
67
+ setGridSize: $,
66
68
  pendingPlacement: D,
67
- setPendingPlacement: Z,
69
+ setPendingPlacement: ee,
68
70
  contextMenu: N,
69
- setContextMenu: _,
71
+ setContextMenu: te,
70
72
  presentation: O,
71
- setPresentation: $,
73
+ setPresentation: oe,
72
74
  detachedTabs: T,
73
75
  toggleDetach: U
74
76
  }), [
75
77
  a,
76
78
  l,
77
- d,
79
+ w,
78
80
  g,
79
81
  p,
80
82
  c,
81
83
  S,
84
+ I,
82
85
  M,
83
86
  m,
84
87
  x,
85
- I,
86
88
  P,
87
89
  R,
88
90
  F,
89
91
  v,
92
+ A,
90
93
  C,
91
94
  D,
92
95
  N,
@@ -94,14 +97,14 @@ function ge({ showMiniMap: n = !0, showGrid: b = !0, gridSize: y = 20, children:
94
97
  T,
95
98
  U
96
99
  ]);
97
- return /* @__PURE__ */ ae(G.Provider, {
98
- value: se,
99
- children: A
100
+ return /* @__PURE__ */ de(G.Provider, {
101
+ value: ce,
102
+ children: V
100
103
  });
101
104
  }
102
105
  export {
103
- ge as FlowUIProvider,
104
- he as useFlowUI
106
+ Se as FlowUIProvider,
107
+ fe as useFlowUI
105
108
  };
106
109
 
107
110
  //# sourceMappingURL=FlowUIContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowUIContext.js","names":[],"sources":["../../../../../src/components/pro/Flow/context/FlowUIContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo, useState, useRef, useCallback } from 'react';\nimport type { FlowToolMode, FlowEdgeTypeName, FlowShapeType, FlowNodeData, ViewportState } from '../types';\n\nexport interface ContextMenuState {\n x: number;\n y: number;\n nodeId: string | null;\n}\n\nexport interface FocusOnRectOptions {\n /** Screen-space padding around the focused rectangle, in pixels. */\n padding?: number;\n /** Maximum zoom allowed for this focus operation. */\n maxZoom?: number;\n /** Viewport transition duration in milliseconds. */\n duration?: number;\n /** Keep the current zoom and only animate the focused rectangle to center. */\n preserveZoom?: boolean;\n}\n\nexport interface FlowUIContextValue {\n toolMode: FlowToolMode;\n setToolMode: (mode: FlowToolMode) => void;\n edgeType: FlowEdgeTypeName;\n setEdgeType: (type: FlowEdgeTypeName) => void;\n viewport: ViewportState;\n setViewport: (v: ViewportState) => void;\n /** Internal VM→React bridge setter (does not request a VM apply). */\n setViewportInternal: (v: ViewportState) => void;\n /** Monotonic counter of external viewport commands. */\n viewportReqRef: React.MutableRefObject<number>;\n focusOnRect: (wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void;\n setFocusOnRect: (fn: (wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void) => void;\n autoFocus: boolean;\n setAutoFocus: (v: boolean) => void;\n editingNodeId: string | null;\n setEditingNodeId: (id: string | null) => void;\n /** True while any node/line is being dragged. Used to suppress interactive\n * DOM overlays (e.g. HTML iframes) that would otherwise swallow pointerup. */\n isNodeDragging: boolean;\n beginNodeDrag: () => void;\n endNodeDrag: () => void;\n showPalette: boolean;\n setShowPalette: (v: boolean) => void;\n showInspector: boolean;\n setShowInspector: (v: boolean) => void;\n showOutline: boolean;\n setShowOutline: (v: boolean) => void;\n showJson: boolean;\n setShowJson: (v: boolean) => void;\n showMiniMap: boolean;\n setShowMiniMap: (v: boolean) => void;\n showGrid: boolean;\n setShowGrid: (v: boolean) => void;\n /** Global editor-only visibility for animation anchor objects. */\n showAnchors: boolean;\n setShowAnchors: (v: boolean) => void;\n gridSize: number;\n setGridSize: (s: number) => void;\n pendingPlacement: PendingPlacement | null;\n setPendingPlacement: (p: PendingPlacement | null) => void;\n contextMenu: ContextMenuState | null;\n setContextMenu: (m: ContextMenuState | null) => void;\n detachedTabs: Set<string>;\n toggleDetach: (tabId: string) => void;\n /** PPT-style presentation mode. When set, the overlay animates the viewport\n * between animation anchors, navigable via arrow keys. */\n presentation: PresentationState | null;\n setPresentation: (p: PresentationState | null) => void;\n}\n\nexport interface PresentationState {\n /** Index into the anchor sequence (0-based). */\n current: number;\n /** Whether to show the active anchor frame and sequence badge in preview. */\n showAnchor?: boolean;\n}\n\nexport interface PendingPlacement {\n type: FlowShapeType;\n width: number;\n height: number;\n data: FlowNodeData;\n}\n\nconst FlowUIContext = createContext<FlowUIContextValue | null>(null);\n\nexport function useFlowUI(): FlowUIContextValue {\n const ctx = useContext(FlowUIContext);\n if (!ctx) throw new Error('useFlowUI must be used within FlowUIProvider');\n return ctx;\n}\n\nexport interface FlowUIProviderProps {\n showMiniMap?: boolean;\n showGrid?: boolean;\n gridSize?: number;\n children: React.ReactNode;\n}\n\nexport function FlowUIProvider({ showMiniMap: initMiniMap = true, showGrid: initGrid = true, gridSize: initGridSize = 20, children }: FlowUIProviderProps) {\n const [toolMode, setToolMode] = useState<FlowToolMode>('select');\n const [edgeType, setEdgeType] = useState<FlowEdgeTypeName>('smoothstep');\n const [viewport, setViewportState] = useState<ViewportState>({ x: 0, y: 0, zoom: 1 });\n // Distinguishes EXTERNAL viewport commands (toolbar, minimap, outline) from\n // internal echoes emitted by the ViewportManager. Only external commands\n // should be pushed back into the VM; echoing VM changes causes jitter.\n const viewportReqRef = useRef(0);\n const setViewport = useCallback((v: ViewportState) => {\n viewportReqRef.current += 1;\n setViewportState(v);\n }, []);\n // Internal setter used by the VM→React bridge; does NOT bump the request\n // counter, so the sync effect will not echo it back to the VM.\n const setViewportInternal = useCallback((v: ViewportState) => {\n setViewportState(v);\n }, []);\n const [autoFocus, setAutoFocus] = useState(false);\n const [editingNodeId, setEditingNodeId] = useState<string | null>(null);\n // Counter so concurrent drags (multi-node) don't flip the flag early.\n const dragCountRef = useRef(0);\n const [isNodeDragging, setIsNodeDragging] = useState(false);\n const beginNodeDrag = useCallback(() => {\n dragCountRef.current += 1;\n if (!isNodeDragging) setIsNodeDragging(true);\n }, [isNodeDragging]);\n const endNodeDrag = useCallback(() => {\n dragCountRef.current = Math.max(0, dragCountRef.current - 1);\n if (dragCountRef.current === 0) setIsNodeDragging(false);\n }, []);\n const [showPalette, setShowPalette] = useState(true);\n const [showInspector, setShowInspector] = useState(true);\n const [showOutline, setShowOutline] = useState(true);\n const [showJson, setShowJson] = useState(true);\n const [showMiniMap, setShowMiniMap] = useState(initMiniMap);\n const [showGrid, setShowGrid] = useState(initGrid);\n const [showAnchors, setShowAnchors] = useState(true);\n const [gridSize, setGridSize] = useState(initGridSize);\n const [pendingPlacement, setPendingPlacement] = useState<PendingPlacement | null>(null);\n const [contextMenu, setContextMenu] = useState<ContextMenuState | null>(null);\n const [presentation, setPresentation] = useState<PresentationState | null>(null);\n const [detachedTabs, setDetachedTabs] = useState<Set<string>>(new Set());\n const toggleDetach = useCallback((tabId: string) => {\n setDetachedTabs(prev => {\n const next = new Set(prev);\n if (next.has(tabId)) next.delete(tabId); else next.add(tabId);\n return next;\n });\n }, []);\n\n const focusOnRectRef = useRef<(wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void>(() => {});\n const focusOnRect = useCallback((wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => {\n focusOnRectRef.current(wx, wy, ww, wh, options);\n }, []);\n const setFocusOnRect = useCallback((fn: (wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void) => {\n focusOnRectRef.current = fn;\n }, []);\n\n const value = useMemo<FlowUIContextValue>(() => ({\n toolMode, setToolMode,\n edgeType, setEdgeType,\n viewport, setViewport,\n setViewportInternal,\n viewportReqRef,\n focusOnRect, setFocusOnRect,\n autoFocus, setAutoFocus,\n editingNodeId, setEditingNodeId,\n isNodeDragging, beginNodeDrag, endNodeDrag,\n showPalette, setShowPalette,\n showInspector, setShowInspector,\n showOutline, setShowOutline,\n showJson, setShowJson,\n showMiniMap, setShowMiniMap,\n showGrid, setShowGrid,\n showAnchors, setShowAnchors,\n gridSize, setGridSize,\n pendingPlacement, setPendingPlacement,\n contextMenu, setContextMenu,\n presentation, setPresentation,\n detachedTabs, toggleDetach,\n }), [toolMode, edgeType, viewport, autoFocus, editingNodeId, isNodeDragging, beginNodeDrag, endNodeDrag, showPalette, showInspector, showOutline, showJson, showMiniMap, showGrid, showAnchors, gridSize, pendingPlacement, contextMenu, presentation, detachedTabs, toggleDetach]);\n\n return <FlowUIContext.Provider value={value}>{children}</FlowUIContext.Provider>;\n}\n"],"mappings":";;AAqFA,IAAM,IAAgB,GAAyC,IAAI;AAEnE,SAAgB,KAAgC;AAC9C,QAAM,IAAM,GAAW,CAAa;AACpC,MAAI,CAAC,EAAK,OAAM,IAAI,MAAM,8CAA8C;AACxE,SAAO;AACT;AASA,SAAgB,GAAe,EAAE,aAAa,IAAc,IAAM,UAAU,IAAW,IAAM,UAAU,IAAe,IAAI,UAAA,EAAA,GAAiC;AACzJ,QAAM,CAAC,GAAU,CAAA,IAAe,EAAuB,QAAQ,GACzD,CAAC,GAAU,CAAA,IAAe,EAA2B,YAAY,GACjE,CAAC,GAAU,CAAA,IAAoB,EAAwB;AAAA,IAAE,GAAG;AAAA,IAAG,GAAG;AAAA,IAAG,MAAM;AAAA,EAAE,CAAC,GAI9E,IAAiB,EAAO,CAAC,GACzB,IAAc,EAAA,CAAa,MAAqB;AACpD,IAAA,EAAe,WAAW,GAC1B,EAAiB,CAAC;AAAA,EACpB,GAAG,CAAC,CAAC,GAGC,IAAsB,EAAA,CAAa,MAAqB;AAC5D,IAAA,EAAiB,CAAC;AAAA,EACpB,GAAG,CAAC,CAAC,GACC,CAAC,GAAW,CAAA,IAAgB,EAAS,EAAK,GAC1C,CAAC,GAAe,CAAA,IAAoB,EAAwB,IAAI,GAEhE,IAAe,EAAO,CAAC,GACvB,CAAC,GAAgB,CAAA,IAAqB,EAAS,EAAK,GACpD,IAAgB,EAAA,MAAkB;AACtC,IAAA,EAAa,WAAW,GACnB,KAAgB,EAAkB,EAAI;AAAA,EAC7C,GAAG,CAAC,CAAc,CAAC,GACb,IAAc,EAAA,MAAkB;AACpC,IAAA,EAAa,UAAU,KAAK,IAAI,GAAG,EAAa,UAAU,CAAC,GACvD,E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aAAA;AAAA,IACV,qBAAA;AAAA,IACA,gBAAA;AAAA,IACA,aAAA;AAAA,IAAa,gBAAA;AAAA,IACb,WAAA;AAAA,IAAW,cAAA;AAAA,IACX,eAAA;AAAA,IAAe,kBAAA;AAAA,IACf,gBAAA;AAAA,IAAgB,eAAA;AAAA,IAAe,aAAA;AAAA,IAC/B,aAAA;AAAA,IAAa,gBAAA;AAAA,IACb,eAAA;AAAA,IAAe,kBAAA;AAAA,IACf,aAAA;AAAA,IAAa,gBAAA;AAAA,IACb,UAAA;AAAA,IAAU,aAAA;AAAA,IACV,aAAA;AAAA,IAAa,gBAAA;AAAA,IACb,UAAA;AAAA,IAAU,aAAA;AAAA,IACV,aAAA;AAAA,IAAa,gBAAA;AAAA,IACb,UAAA;AAAA,IAAU,aAAA;AAAA,IACV,kBAAA;AAAA,IAAkB,qBAAA;AAAA,IAClB,aAAA;AAAA,IAAa,gBAAA;AAAA,IACb,cAAA;AAAA,IAAc,iBAAA;AAAA,IACd,cAAA;AAAA,IAAc,cAAA;AAAA,EAChB,IAAI;AAAA,IAAC;AAAA,IAAU;AAAA,IAAU;AAAA,IAAU;AAAA,IAAW;AAAA,IAAe;AAAA,IAAgB;AAAA,IAAe;AAAA,IAAa;AAAA,IAAa;AAAA,IAAe;AAAA,IAAa;AAAA,IAAU;AAAA,IAAa;AAAA,IAAU;AAAA,IAAa;AAAA,IAAU;AAAA,IAAkB;AAAA,IAAa;AAAA,IAAc;AAAA,IAAc;AAAA,EAAY,CAAC;AAElR,SAAO,gBAAA,GAAC,EAAc,UAAf;AAAA,IAA+B,OAAA;AAAA,IAAQ,UAAA;AAAA,EAAiC,CAAA;AACjF"}
1
+ {"version":3,"file":"FlowUIContext.js","names":[],"sources":["../../../../../src/components/pro/Flow/context/FlowUIContext.tsx"],"sourcesContent":["import React, { createContext, useContext, useMemo, useState, useRef, useCallback } from 'react';\nimport type { FlowToolMode, FlowEdgeTypeName, FlowShapeType, FlowNodeData, ViewportState } from '../types';\n\nexport interface ContextMenuState {\n x: number;\n y: number;\n nodeId: string | null;\n}\n\nexport interface FocusOnRectOptions {\n /** Screen-space padding around the focused rectangle, in pixels. */\n padding?: number;\n /** Maximum zoom allowed for this focus operation. */\n maxZoom?: number;\n /** Viewport transition duration in milliseconds. */\n duration?: number;\n /** Keep the current zoom and only animate the focused rectangle to center. */\n preserveZoom?: boolean;\n}\n\nexport interface FlowUIContextValue {\n toolMode: FlowToolMode;\n setToolMode: (mode: FlowToolMode) => void;\n edgeType: FlowEdgeTypeName;\n setEdgeType: (type: FlowEdgeTypeName) => void;\n viewport: ViewportState;\n setViewport: (v: ViewportState) => void;\n /** Internal VM→React bridge setter (does not request a VM apply). */\n setViewportInternal: (v: ViewportState) => void;\n /** Monotonic counter of external viewport commands. */\n viewportReqRef: React.MutableRefObject<number>;\n focusOnRect: (wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void;\n setFocusOnRect: (fn: (wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void) => void;\n autoFocus: boolean;\n setAutoFocus: (v: boolean) => void;\n editingNodeId: string | null;\n setEditingNodeId: (id: string | null) => void;\n /** True while any node/line is being dragged. Used to suppress interactive\n * DOM overlays (e.g. HTML iframes) that would otherwise swallow pointerup. */\n isNodeDragging: boolean;\n beginNodeDrag: () => void;\n endNodeDrag: () => void;\n showPalette: boolean;\n setShowPalette: (v: boolean) => void;\n showInspector: boolean;\n setShowInspector: (v: boolean) => void;\n showOutline: boolean;\n setShowOutline: (v: boolean) => void;\n showJson: boolean;\n setShowJson: (v: boolean) => void;\n showAI: boolean;\n setShowAI: (v: boolean) => void;\n showMiniMap: boolean;\n setShowMiniMap: (v: boolean) => void;\n showGrid: boolean;\n setShowGrid: (v: boolean) => void;\n /** Global editor-only visibility for animation anchor objects. */\n showAnchors: boolean;\n setShowAnchors: (v: boolean) => void;\n gridSize: number;\n setGridSize: (s: number) => void;\n pendingPlacement: PendingPlacement | null;\n setPendingPlacement: (p: PendingPlacement | null) => void;\n contextMenu: ContextMenuState | null;\n setContextMenu: (m: ContextMenuState | null) => void;\n detachedTabs: Set<string>;\n toggleDetach: (tabId: string) => void;\n /** PPT-style presentation mode. When set, the overlay animates the viewport\n * between animation anchors, navigable via arrow keys. */\n presentation: PresentationState | null;\n setPresentation: (p: PresentationState | null) => void;\n}\n\nexport interface PresentationState {\n /** Index into the anchor sequence (0-based). */\n current: number;\n /** Whether to show the active anchor frame and sequence badge in preview. */\n showAnchor?: boolean;\n}\n\nexport interface PendingPlacement {\n type: FlowShapeType;\n width: number;\n height: number;\n data: FlowNodeData;\n}\n\nconst FlowUIContext = createContext<FlowUIContextValue | null>(null);\n\nexport function useFlowUI(): FlowUIContextValue {\n const ctx = useContext(FlowUIContext);\n if (!ctx) throw new Error('useFlowUI must be used within FlowUIProvider');\n return ctx;\n}\n\nexport interface FlowUIProviderProps {\n showMiniMap?: boolean;\n showGrid?: boolean;\n gridSize?: number;\n showAI?: boolean;\n children: React.ReactNode;\n}\n\nexport function FlowUIProvider({ showMiniMap: initMiniMap = true, showGrid: initGrid = true, gridSize: initGridSize = 20, showAI: initShowAI = true, children }: FlowUIProviderProps) {\n const [toolMode, setToolMode] = useState<FlowToolMode>('select');\n const [edgeType, setEdgeType] = useState<FlowEdgeTypeName>('smoothstep');\n const [viewport, setViewportState] = useState<ViewportState>({ x: 0, y: 0, zoom: 1 });\n // Distinguishes EXTERNAL viewport commands (toolbar, minimap, outline) from\n // internal echoes emitted by the ViewportManager. Only external commands\n // should be pushed back into the VM; echoing VM changes causes jitter.\n const viewportReqRef = useRef(0);\n const setViewport = useCallback((v: ViewportState) => {\n viewportReqRef.current += 1;\n setViewportState(v);\n }, []);\n // Internal setter used by the VM→React bridge; does NOT bump the request\n // counter, so the sync effect will not echo it back to the VM.\n const setViewportInternal = useCallback((v: ViewportState) => {\n setViewportState(v);\n }, []);\n const [autoFocus, setAutoFocus] = useState(false);\n const [editingNodeId, setEditingNodeId] = useState<string | null>(null);\n // Counter so concurrent drags (multi-node) don't flip the flag early.\n const dragCountRef = useRef(0);\n const [isNodeDragging, setIsNodeDragging] = useState(false);\n const beginNodeDrag = useCallback(() => {\n dragCountRef.current += 1;\n if (!isNodeDragging) setIsNodeDragging(true);\n }, [isNodeDragging]);\n const endNodeDrag = useCallback(() => {\n dragCountRef.current = Math.max(0, dragCountRef.current - 1);\n if (dragCountRef.current === 0) setIsNodeDragging(false);\n }, []);\n const [showPalette, setShowPalette] = useState(true);\n const [showInspector, setShowInspector] = useState(true);\n const [showOutline, setShowOutline] = useState(true);\n const [showJson, setShowJson] = useState(true);\n const [showAI, setShowAI] = useState(initShowAI);\n const [showMiniMap, setShowMiniMap] = useState(initMiniMap);\n const [showGrid, setShowGrid] = useState(initGrid);\n const [showAnchors, setShowAnchors] = useState(true);\n const [gridSize, setGridSize] = useState(initGridSize);\n const [pendingPlacement, setPendingPlacement] = useState<PendingPlacement | null>(null);\n const [contextMenu, setContextMenu] = useState<ContextMenuState | null>(null);\n const [presentation, setPresentation] = useState<PresentationState | null>(null);\n const [detachedTabs, setDetachedTabs] = useState<Set<string>>(new Set());\n const toggleDetach = useCallback((tabId: string) => {\n setDetachedTabs(prev => {\n const next = new Set(prev);\n if (next.has(tabId)) next.delete(tabId); else next.add(tabId);\n return next;\n });\n }, []);\n\n const focusOnRectRef = useRef<(wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void>(() => {});\n const focusOnRect = useCallback((wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => {\n focusOnRectRef.current(wx, wy, ww, wh, options);\n }, []);\n const setFocusOnRect = useCallback((fn: (wx: number, wy: number, ww: number, wh: number, options?: FocusOnRectOptions) => void) => {\n focusOnRectRef.current = fn;\n }, []);\n\n const value = useMemo<FlowUIContextValue>(() => ({\n toolMode, setToolMode,\n edgeType, setEdgeType,\n viewport, setViewport,\n setViewportInternal,\n viewportReqRef,\n focusOnRect, setFocusOnRect,\n autoFocus, setAutoFocus,\n editingNodeId, setEditingNodeId,\n isNodeDragging, beginNodeDrag, endNodeDrag,\n showPalette, setShowPalette,\n showInspector, setShowInspector,\n showOutline, setShowOutline,\n showJson, setShowJson,\n showAI, setShowAI,\n showMiniMap, setShowMiniMap,\n showGrid, setShowGrid,\n showAnchors, setShowAnchors,\n gridSize, setGridSize,\n pendingPlacement, setPendingPlacement,\n contextMenu, setContextMenu,\n presentation, setPresentation,\n detachedTabs, toggleDetach,\n }), [toolMode, edgeType, viewport, autoFocus, editingNodeId, isNodeDragging, beginNodeDrag, endNodeDrag, showPalette, showInspector, showOutline, showJson, showAI, showMiniMap, showGrid, showAnchors, gridSize, pendingPlacement, contextMenu, presentation, detachedTabs, toggleDetach]);\n\n return <FlowUIContext.Provider value={value}>{children}</FlowUIContext.Provider>;\n}\n"],"mappings":";;AAuFA,IAAM,IAAgB,GAAyC,IAAI;AAEnE,SAAgB,KAAgC;AAC9C,QAAM,IAAM,GAAW,CAAa;AACpC,MAAI,CAAC,EAAK,OAAM,IAAI,MAAM,8CAA8C;AACxE,SAAO;AACT;AAUA,SAAgB,GAAe,EAAE,aAAa,IAAc,IAAM,UAAU,IAAW,IAAM,UAAU,IAAe,IAAI,QAAQ,IAAa,IAAM,UAAA,EAAA,GAAiC;AACpL,QAAM,CAAC,GAAU,CAAA,IAAe,EAAuB,QAAQ,GACzD,CAAC,GAAU,CAAA,IAAe,EAA2B,YAAY,GACjE,CAAC,GAAU,CAAA,IAAoB,EAAwB;AAAA,IAAE,GAAG;AAAA,IAAG,GAAG;AAAA,IAAG,MAAM;AAAA,EAAE,CAAC,GAI9E,IAAiB,EAAO,CAAC,GACzB,IAAc,EAAA,CAAa,MAAqB;AACpD,IAAA,EAAe,WAAW,GAC1B,EAAiB,CAAC;AAAA,EACpB,GAAG,CAAC,CAAC,GAGC,IAAsB,EAAA,CAAa,MAAqB;AAC5D,IAAA,EAAiB,CAAC;AAAA,EACpB,GAAG,CAAC,CAAC,GACC,CAAC,GAAW,CAAA,IAAgB,EAAS,EAAK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AA,IAAa;AAAA,IAAU;AAAA,IAAa;AAAA,IAAU;AAAA,IAAkB;AAAA,IAAa;AAAA,IAAc;AAAA,IAAc;AAAA,EAAY,CAAC;AAE1R,SAAO,gBAAA,GAAC,EAAc,UAAf;AAAA,IAA+B,OAAA;AAAA,IAAQ,UAAA;AAAA,EAAiC,CAAA;AACjF"}
@@ -1,12 +1,13 @@
1
- import { buildEdgePath as v, getPathCenter as B, resolveEdgeEndpoints as T } from "./edgePaths.js";
1
+ import { resolveThemeColor as E } from "../utils/themeColor.js";
2
+ import { buildEdgePath as T, getPathCenter as B, resolveEdgeEndpoints as M } from "./edgePaths.js";
2
3
  import { angleBetween as k, drawMarker as _ } from "./edgeMarkers.js";
3
4
  import { drawDashedPath as y } from "../utils/dashedLine.js";
4
- import { Container as E, Graphics as x, Text as M, TextStyle as L } from "pixi.js";
5
- function O(e, l, a = 2) {
5
+ import { Container as v, Graphics as x, Text as L, TextStyle as O } from "pixi.js";
6
+ function P(e, l, a = 2) {
6
7
  if (!(!e || e === "solid"))
7
8
  return e === "dynamic" ? [a * 4, a * 3] : [e === "dotted" ? a : a * 3, l === "dense" ? a : l === "sparse" ? a * 4 : a * 2];
8
9
  }
9
- var F = class {
10
+ var R = class {
10
11
  world;
11
12
  edgeLayer;
12
13
  edges = /* @__PURE__ */ new Map();
@@ -15,13 +16,13 @@ var F = class {
15
16
  this._dynamicOffset = (this._dynamicOffset + e * 0.06) % 1e3;
16
17
  }
17
18
  constructor(e) {
18
- this.world = e, this.edgeLayer = new E({ label: "edges" }), this.world.addChildAt(this.edgeLayer, 0);
19
+ this.world = e, this.edgeLayer = new v({ label: "edges" }), this.world.addChildAt(this.edgeLayer, 0);
19
20
  }
20
21
  sync(e, l, a, i, c) {
21
22
  const g = /* @__PURE__ */ new Set();
22
23
  for (const r of e) {
23
24
  g.add(r.id);
24
- const t = T(r, l);
25
+ const t = M(r, l);
25
26
  if (!t) continue;
26
27
  let h = this.edges.get(r.id);
27
28
  h || (h = this._createEdge(r), this.edges.set(r.id, h)), this._updateEdge(h, r, t, a.has(r.id), i === r.id, c?.presentation ?? !1);
@@ -29,7 +30,7 @@ var F = class {
29
30
  for (const [r, t] of this.edges) g.has(r) || (this.edgeLayer.removeChild(t.container), t.container.destroy({ children: !0 }), this.edges.delete(r));
30
31
  }
31
32
  _createEdge(e) {
32
- const l = new E({ label: `edge-${e.id}` }), a = new x();
33
+ const l = new v({ label: `edge-${e.id}` }), a = new x();
33
34
  a.label = "edge-hitarea", a.eventMode = "static", a.cursor = "pointer", a.alpha = 0, l.addChild(a);
34
35
  const i = new x();
35
36
  i.label = "edge-line", l.addChild(i);
@@ -45,8 +46,8 @@ var F = class {
45
46
  };
46
47
  }
47
48
  _updateEdge(e, l, a, i, c, g) {
48
- const { line: r, animation: t, hitArea: h } = e, o = l.data, b = i ? "#3b82f6" : o.strokeColor ?? "#374151", f = o.strokeWidth ?? 2, s = v(l.type, a, o.waypoints, o.bezierControls);
49
- if (r.clear(), this._drawPath(r, s, b, f, o.lineStyle, o.dashDensity), t.clear(), g && o.animated) {
49
+ const { line: r, animation: t, hitArea: h } = e, o = l.data, m = i ? "#3b82f6" : E(o.strokeColor, "#374151"), f = o.strokeWidth ?? 2, s = T(l.type, a, o.waypoints, o.bezierControls);
50
+ if (r.clear(), this._drawPath(r, s, m, f, o.lineStyle, o.dashDensity), t.clear(), g && o.animated) {
50
51
  const n = [Math.max(18, f * 12), Math.max(90, f * 45)];
51
52
  y(t, s, n, -this._dynamicOffset * 2.2), t.stroke({
52
53
  color: 6333946,
@@ -66,33 +67,33 @@ var F = class {
66
67
  });
67
68
  }
68
69
  if (o.markerStart && o.markerStart !== "none" && s.length >= 2) {
69
- const n = s[0], d = s[1], m = k(d.type === "C" ? d.cp1x : d.x, d.type === "C" ? d.cp1y : d.y, n.x, n.y);
70
- _(r, o.markerStart, n.x, n.y, m, b);
70
+ const n = s[0], d = s[1], b = k(d.type === "C" ? d.cp1x : d.x, d.type === "C" ? d.cp1y : d.y, n.x, n.y);
71
+ _(r, o.markerStart, n.x, n.y, b, m);
71
72
  }
72
73
  if (o.markerEnd && o.markerEnd !== "none" && s.length >= 2) {
73
74
  const n = s[s.length - 1], d = k(n.type === "C" ? n.cp2x : s[s.length - 2].x, n.type === "C" ? n.cp2y : s[s.length - 2].y, n.x, n.y);
74
- _(r, o.markerEnd, n.x, n.y, d, b);
75
+ _(r, o.markerEnd, n.x, n.y, d, m);
75
76
  }
76
77
  if (h.clear(), this._drawPath(h, s, "#000000", Math.max(f + 10, 14), "solid"), h.alpha = 1e-3, o.labelText) {
77
78
  const n = B(s);
78
79
  if (!e.label) {
79
80
  const p = new x();
80
81
  p.label = "edge-label-bg", e.container.addChild(p), e.labelBg = p;
81
- const u = new L({
82
+ const u = new O({
82
83
  fontFamily: o.labelFontFamily ?? "system-ui, -apple-system, sans-serif",
83
84
  fontSize: o.labelFontSize ?? 12,
84
- fill: b
85
+ fill: m
85
86
  });
86
- e.label = new M({
87
+ e.label = new L({
87
88
  text: o.labelText,
88
89
  style: u
89
90
  }), e.label.anchor.set(0.5, 0.5), e.container.addChild(e.label);
90
91
  }
91
92
  e.label.text = o.labelText;
92
- const d = n.x, m = n.y - 10;
93
- if (e.label.position.set(d, m), e.label.style.fill = b, e.labelBg) {
94
- const w = e.label.width + 10, C = e.label.height + 4;
95
- e.labelBg.clear(), e.labelBg.roundRect(d - w / 2, m - C / 2, w, C, 4).fill({
93
+ const d = n.x, b = n.y - 10;
94
+ if (e.label.position.set(d, b), e.label.style.fill = m, e.labelBg) {
95
+ const C = e.label.width + 10, w = e.label.height + 4;
96
+ e.labelBg.clear(), e.labelBg.roundRect(d - C / 2, b - w / 2, C, w, 4).fill({
96
97
  color: 16777215,
97
98
  alpha: 0.92
98
99
  });
@@ -101,7 +102,7 @@ var F = class {
101
102
  e.label && (e.label.text = ""), e.labelBg && e.labelBg.clear();
102
103
  }
103
104
  _drawPath(e, l, a, i, c, g) {
104
- const r = O(c, g, i);
105
+ const r = P(c, g, i);
105
106
  if (r)
106
107
  y(e, l, r, c === "dynamic" ? this._dynamicOffset : 0), e.stroke({
107
108
  color: a,
@@ -135,7 +136,7 @@ var F = class {
135
136
  }
136
137
  };
137
138
  export {
138
- F as EdgeRenderer
139
+ R as EdgeRenderer
139
140
  };
140
141
 
141
142
  //# sourceMappingURL=EdgeRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeRenderer.js","names":[],"sources":["../../../../../src/components/pro/Flow/edges/EdgeRenderer.ts"],"sourcesContent":["import { Container, Graphics, Text, TextStyle } from 'pixi.js';\nimport type { FlowEdge, FlowNode } from '../types';\nimport { buildEdgePath, getPathCenter, resolveEdgeEndpoints, type PathSegment, type EdgeEndpoints } from './edgePaths';\nimport { drawMarker, angleBetween } from './edgeMarkers';\nimport { drawDashedPath, type PathSeg } from '../utils/dashedLine';\n\ninterface EdgeDisplay {\n container: Container;\n line: Graphics;\n animation: Graphics;\n hitArea: Graphics;\n labelBg: Graphics | null;\n label: Text | null;\n edgeId: string;\n}\n\nfunction getDashPattern(style?: string, density?: string, width = 2): number[] | undefined {\n if (!style || style === 'solid') return undefined;\n if (style === 'dynamic') return [width * 4, width * 3];\n const base = style === 'dotted' ? width : width * 3;\n const gap = density === 'dense' ? width : density === 'sparse' ? width * 4 : width * 2;\n return [base, gap];\n}\n\n/**\n * Manages PixiJS display objects for all edges.\n */\nexport class EdgeRenderer {\n private world: Container;\n private edgeLayer: Container;\n private edges = new Map<string, EdgeDisplay>();\n private _dynamicOffset = 0;\n\n /** Call once per frame to advance the dynamic dash animation. */\n advanceAnimation(deltaMs: number): void {\n this._dynamicOffset = (this._dynamicOffset + deltaMs * 0.06) % 1000;\n }\n\n constructor(world: Container) {\n this.world = world;\n this.edgeLayer = new Container({ label: 'edges' });\n // Edges below nodes\n this.world.addChildAt(this.edgeLayer, 0);\n }\n\n sync(\n flowEdges: FlowEdge[],\n nodeMap: Map<string, FlowNode>,\n selectedIds: Set<string>,\n hoveredId: string | null,\n options?: { presentation?: boolean },\n ): void {\n const seen = new Set<string>();\n\n for (const edge of flowEdges) {\n seen.add(edge.id);\n const endpoints = resolveEdgeEndpoints(edge, nodeMap);\n if (!endpoints) continue;\n\n let display = this.edges.get(edge.id);\n if (!display) {\n display = this._createEdge(edge);\n this.edges.set(edge.id, display);\n }\n this._updateEdge(\n display,\n edge,\n endpoints,\n selectedIds.has(edge.id),\n hoveredId === edge.id,\n options?.presentation ?? false,\n );\n }\n\n for (const [id, display] of this.edges) {\n if (!seen.has(id)) {\n this.edgeLayer.removeChild(display.container);\n display.container.destroy({ children: true });\n this.edges.delete(id);\n }\n }\n }\n\n private _createEdge(edge: FlowEdge): EdgeDisplay {\n const container = new Container({ label: `edge-${edge.id}` });\n\n const hitArea = new Graphics();\n hitArea.label = 'edge-hitarea';\n hitArea.eventMode = 'static';\n hitArea.cursor = 'pointer';\n hitArea.alpha = 0;\n container.addChild(hitArea);\n\n const line = new Graphics();\n line.label = 'edge-line';\n container.addChild(line);\n\n const animation = new Graphics();\n animation.label = 'edge-animation';\n container.addChild(animation);\n\n this.edgeLayer.addChild(container);\n return { container, line, animation, hitArea, labelBg: null, label: null, edgeId: edge.id };\n }\n\n private _updateEdge(\n display: EdgeDisplay,\n edge: FlowEdge,\n endpoints: EdgeEndpoints,\n selected: boolean,\n hovered: boolean,\n presentation: boolean,\n ): void {\n const { line, animation, hitArea } = display;\n const data = edge.data;\n const color = selected ? '#3b82f6' : (data.strokeColor ?? '#374151');\n const width = data.strokeWidth ?? 2;\n\n const segments = buildEdgePath(edge.type, endpoints, data.waypoints, data.bezierControls);\n\n // Draw visible line\n line.clear();\n this._drawPath(line, segments, color, width, data.lineStyle, data.dashDensity);\n\n // Presentation animation: a bright gradient-like pulse travels from source\n // to target. A short dashed segment plus soft outer stroke gives the pulse\n // a leading highlight and fading tail without requiring SVG filters.\n animation.clear();\n if (presentation && data.animated) {\n const pattern = [Math.max(18, width * 12), Math.max(90, width * 45)];\n drawDashedPath(animation, segments as PathSeg[], pattern, -this._dynamicOffset * 2.2);\n animation.stroke({ color: 0x60a5fa, width: width + 5, alpha: 0.18, cap: 'round' as const });\n drawDashedPath(animation, segments as PathSeg[], pattern, -this._dynamicOffset * 2.2);\n animation.stroke({ color: 0x38bdf8, width: width + 2, alpha: 0.55, cap: 'round' as const });\n drawDashedPath(animation, segments as PathSeg[], pattern, -this._dynamicOffset * 2.2);\n animation.stroke({ color: 0xffffff, width: Math.max(1, width * 0.7), alpha: 0.9, cap: 'round' as const });\n }\n\n // Draw markers — use curve tangent for accurate arrow direction\n if (data.markerStart && data.markerStart !== 'none' && segments.length >= 2) {\n const tip = segments[0];\n const next = segments[1];\n // For curves the tangent at t=0 is tip→cp1; for lines it's tip→next\n const fromX = next.type === 'C' ? next.cp1x! : next.x;\n const fromY = next.type === 'C' ? next.cp1y! : next.y;\n const angle = angleBetween(fromX, fromY, tip.x, tip.y);\n drawMarker(line, data.markerStart, tip.x, tip.y, angle, color);\n }\n if (data.markerEnd && data.markerEnd !== 'none' && segments.length >= 2) {\n const tip = segments[segments.length - 1];\n // For curves the tangent at t=1 is cp2→endpoint\n const fromX = tip.type === 'C' ? tip.cp2x! : segments[segments.length - 2].x;\n const fromY = tip.type === 'C' ? tip.cp2y! : segments[segments.length - 2].y;\n const angle = angleBetween(fromX, fromY, tip.x, tip.y);\n drawMarker(line, data.markerEnd, tip.x, tip.y, angle, color);\n }\n\n // Wider invisible hit area\n hitArea.clear();\n this._drawPath(hitArea, segments, '#000000', Math.max(width + 10, 14), 'solid');\n hitArea.alpha = 0.001;\n\n // Edge label\n if (data.labelText) {\n const center = getPathCenter(segments);\n if (!display.label) {\n // Background chip drawn first so it sits behind the text.\n const labelBg = new Graphics();\n labelBg.label = 'edge-label-bg';\n display.container.addChild(labelBg);\n display.labelBg = labelBg;\n\n const style = new TextStyle({\n fontFamily: data.labelFontFamily ?? 'system-ui, -apple-system, sans-serif',\n fontSize: data.labelFontSize ?? 12,\n fill: color,\n });\n display.label = new Text({ text: data.labelText, style });\n display.label.anchor.set(0.5, 0.5);\n display.container.addChild(display.label);\n }\n display.label.text = data.labelText;\n const lx = center.x;\n const ly = center.y - 10;\n display.label.position.set(lx, ly);\n (display.label.style as TextStyle).fill = color;\n\n // Draw a rounded background chip behind the label so the line / waypoints\n // don't show through the text.\n if (display.labelBg) {\n const padX = 5;\n const padY = 2;\n const tw = display.label.width + padX * 2;\n const th = display.label.height + padY * 2;\n display.labelBg.clear();\n display.labelBg\n .roundRect(lx - tw / 2, ly - th / 2, tw, th, 4)\n .fill({ color: 0xffffff, alpha: 0.92 });\n }\n } else {\n if (display.label) display.label.text = '';\n if (display.labelBg) display.labelBg.clear();\n }\n }\n\n private _drawPath(\n g: Graphics,\n segs: PathSegment[],\n color: string,\n width: number,\n lineStyle?: string,\n dashDensity?: string,\n ): void {\n const dash = getDashPattern(lineStyle, dashDensity, width);\n if (dash) {\n const offset = lineStyle === 'dynamic' ? this._dynamicOffset : 0;\n drawDashedPath(g, segs as PathSeg[], dash, offset);\n g.stroke({ color, width, cap: 'round' as const });\n } else {\n for (const seg of segs) {\n switch (seg.type) {\n case 'M': g.moveTo(seg.x, seg.y); break;\n case 'L': g.lineTo(seg.x, seg.y); break;\n case 'C': g.bezierCurveTo(seg.cp1x!, seg.cp1y!, seg.cp2x!, seg.cp2y!, seg.x, seg.y); break;\n case 'Q': g.quadraticCurveTo(seg.cp1x!, seg.cp1y!, seg.x, seg.y); break;\n }\n }\n g.stroke({ color, width });\n }\n }\n\n destroy(): void {\n for (const [, display] of this.edges) {\n display.container.destroy({ children: true });\n }\n this.edges.clear();\n this.edgeLayer.destroy({ children: true });\n }\n}\n"],"mappings":";;;;AAgBA,SAAS,EAAe,GAAgB,GAAkB,IAAQ,GAAyB;AACzF,MAAI,GAAC,KAAS,MAAU;AACxB,WAAI,MAAU,YAAkB,CAAC,IAAQ,GAAG,IAAQ,CAAC,IAG9C,CAFM,MAAU,WAAW,IAAQ,IAAQ,GACtC,MAAY,UAAU,IAAQ,M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EAAE,OAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,QAClC,KAAK;AAAK,UAAA,EAAE,OAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,QAClC,KAAK;AAAK,UAAA,EAAE,cAAc,EAAI,MAAO,EAAI,MAAO,EAAI,MAAO,EAAI,MAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,QACrF,KAAK;AAAK,UAAA,EAAE,iBAAiB,EAAI,MAAO,EAAI,MAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,MACpE;AAEF,MAAA,EAAE,OAAO;AAAA,QAAE,OAAA;AAAA,QAAO,OAAA;AAAA,MAAM,CAAC;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,UAAgB;AACd,eAAW,CAAA,EAAG,CAAA,KAAY,KAAK,MAC7B,CAAA,EAAQ,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;AAE9C,SAAK,MAAM,MAAM,GACjB,KAAK,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;AAAA,EAC3C;AACF"}
1
+ {"version":3,"file":"EdgeRenderer.js","names":[],"sources":["../../../../../src/components/pro/Flow/edges/EdgeRenderer.ts"],"sourcesContent":["import { Container, Graphics, Text, TextStyle } from 'pixi.js';\nimport type { FlowEdge, FlowNode } from '../types';\nimport { buildEdgePath, getPathCenter, resolveEdgeEndpoints, type PathSegment, type EdgeEndpoints } from './edgePaths';\nimport { drawMarker, angleBetween } from './edgeMarkers';\nimport { drawDashedPath, type PathSeg } from '../utils/dashedLine';\nimport { resolveThemeColor } from '../utils/themeColor';\n\ninterface EdgeDisplay {\n container: Container;\n line: Graphics;\n animation: Graphics;\n hitArea: Graphics;\n labelBg: Graphics | null;\n label: Text | null;\n edgeId: string;\n}\n\nfunction getDashPattern(style?: string, density?: string, width = 2): number[] | undefined {\n if (!style || style === 'solid') return undefined;\n if (style === 'dynamic') return [width * 4, width * 3];\n const base = style === 'dotted' ? width : width * 3;\n const gap = density === 'dense' ? width : density === 'sparse' ? width * 4 : width * 2;\n return [base, gap];\n}\n\n/**\n * Manages PixiJS display objects for all edges.\n */\nexport class EdgeRenderer {\n private world: Container;\n private edgeLayer: Container;\n private edges = new Map<string, EdgeDisplay>();\n private _dynamicOffset = 0;\n\n /** Call once per frame to advance the dynamic dash animation. */\n advanceAnimation(deltaMs: number): void {\n this._dynamicOffset = (this._dynamicOffset + deltaMs * 0.06) % 1000;\n }\n\n constructor(world: Container) {\n this.world = world;\n this.edgeLayer = new Container({ label: 'edges' });\n // Edges below nodes\n this.world.addChildAt(this.edgeLayer, 0);\n }\n\n sync(\n flowEdges: FlowEdge[],\n nodeMap: Map<string, FlowNode>,\n selectedIds: Set<string>,\n hoveredId: string | null,\n options?: { presentation?: boolean },\n ): void {\n const seen = new Set<string>();\n\n for (const edge of flowEdges) {\n seen.add(edge.id);\n const endpoints = resolveEdgeEndpoints(edge, nodeMap);\n if (!endpoints) continue;\n\n let display = this.edges.get(edge.id);\n if (!display) {\n display = this._createEdge(edge);\n this.edges.set(edge.id, display);\n }\n this._updateEdge(\n display,\n edge,\n endpoints,\n selectedIds.has(edge.id),\n hoveredId === edge.id,\n options?.presentation ?? false,\n );\n }\n\n for (const [id, display] of this.edges) {\n if (!seen.has(id)) {\n this.edgeLayer.removeChild(display.container);\n display.container.destroy({ children: true });\n this.edges.delete(id);\n }\n }\n }\n\n private _createEdge(edge: FlowEdge): EdgeDisplay {\n const container = new Container({ label: `edge-${edge.id}` });\n\n const hitArea = new Graphics();\n hitArea.label = 'edge-hitarea';\n hitArea.eventMode = 'static';\n hitArea.cursor = 'pointer';\n hitArea.alpha = 0;\n container.addChild(hitArea);\n\n const line = new Graphics();\n line.label = 'edge-line';\n container.addChild(line);\n\n const animation = new Graphics();\n animation.label = 'edge-animation';\n container.addChild(animation);\n\n this.edgeLayer.addChild(container);\n return { container, line, animation, hitArea, labelBg: null, label: null, edgeId: edge.id };\n }\n\n private _updateEdge(\n display: EdgeDisplay,\n edge: FlowEdge,\n endpoints: EdgeEndpoints,\n selected: boolean,\n hovered: boolean,\n presentation: boolean,\n ): void {\n const { line, animation, hitArea } = display;\n const data = edge.data;\n const color = selected ? '#3b82f6' : resolveThemeColor(data.strokeColor, '#374151');\n const width = data.strokeWidth ?? 2;\n\n const segments = buildEdgePath(edge.type, endpoints, data.waypoints, data.bezierControls);\n\n // Draw visible line\n line.clear();\n this._drawPath(line, segments, color, width, data.lineStyle, data.dashDensity);\n\n // Presentation animation: a bright gradient-like pulse travels from source\n // to target. A short dashed segment plus soft outer stroke gives the pulse\n // a leading highlight and fading tail without requiring SVG filters.\n animation.clear();\n if (presentation && data.animated) {\n const pattern = [Math.max(18, width * 12), Math.max(90, width * 45)];\n drawDashedPath(animation, segments as PathSeg[], pattern, -this._dynamicOffset * 2.2);\n animation.stroke({ color: 0x60a5fa, width: width + 5, alpha: 0.18, cap: 'round' as const });\n drawDashedPath(animation, segments as PathSeg[], pattern, -this._dynamicOffset * 2.2);\n animation.stroke({ color: 0x38bdf8, width: width + 2, alpha: 0.55, cap: 'round' as const });\n drawDashedPath(animation, segments as PathSeg[], pattern, -this._dynamicOffset * 2.2);\n animation.stroke({ color: 0xffffff, width: Math.max(1, width * 0.7), alpha: 0.9, cap: 'round' as const });\n }\n\n // Draw markers — use curve tangent for accurate arrow direction\n if (data.markerStart && data.markerStart !== 'none' && segments.length >= 2) {\n const tip = segments[0];\n const next = segments[1];\n // For curves the tangent at t=0 is tip→cp1; for lines it's tip→next\n const fromX = next.type === 'C' ? next.cp1x! : next.x;\n const fromY = next.type === 'C' ? next.cp1y! : next.y;\n const angle = angleBetween(fromX, fromY, tip.x, tip.y);\n drawMarker(line, data.markerStart, tip.x, tip.y, angle, color);\n }\n if (data.markerEnd && data.markerEnd !== 'none' && segments.length >= 2) {\n const tip = segments[segments.length - 1];\n // For curves the tangent at t=1 is cp2→endpoint\n const fromX = tip.type === 'C' ? tip.cp2x! : segments[segments.length - 2].x;\n const fromY = tip.type === 'C' ? tip.cp2y! : segments[segments.length - 2].y;\n const angle = angleBetween(fromX, fromY, tip.x, tip.y);\n drawMarker(line, data.markerEnd, tip.x, tip.y, angle, color);\n }\n\n // Wider invisible hit area\n hitArea.clear();\n this._drawPath(hitArea, segments, '#000000', Math.max(width + 10, 14), 'solid');\n hitArea.alpha = 0.001;\n\n // Edge label\n if (data.labelText) {\n const center = getPathCenter(segments);\n if (!display.label) {\n // Background chip drawn first so it sits behind the text.\n const labelBg = new Graphics();\n labelBg.label = 'edge-label-bg';\n display.container.addChild(labelBg);\n display.labelBg = labelBg;\n\n const style = new TextStyle({\n fontFamily: data.labelFontFamily ?? 'system-ui, -apple-system, sans-serif',\n fontSize: data.labelFontSize ?? 12,\n fill: color,\n });\n display.label = new Text({ text: data.labelText, style });\n display.label.anchor.set(0.5, 0.5);\n display.container.addChild(display.label);\n }\n display.label.text = data.labelText;\n const lx = center.x;\n const ly = center.y - 10;\n display.label.position.set(lx, ly);\n (display.label.style as TextStyle).fill = color;\n\n // Draw a rounded background chip behind the label so the line / waypoints\n // don't show through the text.\n if (display.labelBg) {\n const padX = 5;\n const padY = 2;\n const tw = display.label.width + padX * 2;\n const th = display.label.height + padY * 2;\n display.labelBg.clear();\n display.labelBg\n .roundRect(lx - tw / 2, ly - th / 2, tw, th, 4)\n .fill({ color: 0xffffff, alpha: 0.92 });\n }\n } else {\n if (display.label) display.label.text = '';\n if (display.labelBg) display.labelBg.clear();\n }\n }\n\n private _drawPath(\n g: Graphics,\n segs: PathSegment[],\n color: string,\n width: number,\n lineStyle?: string,\n dashDensity?: string,\n ): void {\n const dash = getDashPattern(lineStyle, dashDensity, width);\n if (dash) {\n const offset = lineStyle === 'dynamic' ? this._dynamicOffset : 0;\n drawDashedPath(g, segs as PathSeg[], dash, offset);\n g.stroke({ color, width, cap: 'round' as const });\n } else {\n for (const seg of segs) {\n switch (seg.type) {\n case 'M': g.moveTo(seg.x, seg.y); break;\n case 'L': g.lineTo(seg.x, seg.y); break;\n case 'C': g.bezierCurveTo(seg.cp1x!, seg.cp1y!, seg.cp2x!, seg.cp2y!, seg.x, seg.y); break;\n case 'Q': g.quadraticCurveTo(seg.cp1x!, seg.cp1y!, seg.x, seg.y); break;\n }\n }\n g.stroke({ color, width });\n }\n }\n\n destroy(): void {\n for (const [, display] of this.edges) {\n display.container.destroy({ children: true });\n }\n this.edges.clear();\n this.edgeLayer.destroy({ children: true });\n }\n}\n"],"mappings":";;;;;AAiBA,SAAS,EAAe,GAAgB,GAAkB,IAAQ,GAAyB;AACzF,MAAI,GAAC,KAAS,MAAU;AACxB,WAAI,MAAU,YAAkB,CAAC,IAAQ,GAAG,IAAQ,CAAC,IAG9C,CAFM,MAAU,WAAW,IAAQ,IAAQ,GACtC,MAAY,UAAU,IAAQ,MAAY,WAAW,IAAQ,IAAI,IAAQ,CACpE;AACnB;AAKA,IAAa,IAAb,MAA0B;AAAA,EACxB;AAAA,EACA;AAAA,EACA,QAAgB,oBAAI,IAAyB;AAAA,EAC7C,iBAAyB;AAAA,EAGzB,iBAAiB,GAAuB;AACtC,SAAK,kBAAkB,KAAK,iBAAiB,IAAU,QAAQ;AAAA,EACjE;AAAA,EAEA,YAAY,GAAkB;AAC5B,SAAK,QAAQ,GACb,KAAK,YAAY,IAAI,EAAU,EAAE,OAAO,QAAQ,CAAC,GAEjD,KAAK,MAAM,WAAW,KAAK,WAAW,CAAC;AAAA,EACzC;AAAA,EAEA,KACE,GACA,GACA,GACA,GACA,GACM;AACN,UAAM,IAAO,oBAAI,IAAY;AAE7B,eAAW,KAAQ,GAAW;AAC5B,MAAA,EAAK,IAAI,EAAK,EAAE;AAChB,YAAM,IAAY,EAAqB,GAAM,CAAO;AACpD,UAAI,CAAC,EAAW;AAEhB,UAAI,IAAU,KAAK,MAAM,IAAI,EAAK,EAAE;AACpC,MAAK,MACH,IAAU,KAAK,YAAY,CAAI,GAC/B,KAAK,MAAM,IAAI,EAAK,IAAI,CAAO,IAEjC,KAAK,YACH,GACA,GACA,GACA,EAAY,IAAI,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AAA,QAAK,CAAC;AAAA,MAC1C;AAAA,IACF;AACE,MAAI,EAAQ,UAAO,EAAQ,MAAM,OAAO,KACpC,EAAQ,WAAS,EAAQ,QAAQ,MAAM;AAAA,EAE/C;AAAA,EAEA,UACE,GACA,GACA,GACA,GACA,GACA,GACM;AACN,UAAM,IAAO,EAAe,GAAW,GAAa,CAAK;AACzD,QAAI;AAEF,MAAA,EAAe,GAAG,GAAmB,GADtB,MAAc,YAAY,KAAK,iBAAiB,CACd,GACjD,EAAE,OAAO;AAAA,QAAE,OAAA;AAAA,QAAO,OAAA;AAAA,QAAO,KAAK;AAAA,MAAiB,CAAC;AAAA,SAC3C;AACL,iBAAW,KAAO,EAChB,SAAQ,EAAI,MAAZ;AAAA,QACE,KAAK;AAAK,UAAA,EAAE,OAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,QAClC,KAAK;AAAK,UAAA,EAAE,OAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,QAClC,KAAK;AAAK,UAAA,EAAE,cAAc,EAAI,MAAO,EAAI,MAAO,EAAI,MAAO,EAAI,MAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,QACrF,KAAK;AAAK,UAAA,EAAE,iBAAiB,EAAI,MAAO,EAAI,MAAO,EAAI,GAAG,EAAI,CAAC;AAAG;AAAA,MACpE;AAEF,MAAA,EAAE,OAAO;AAAA,QAAE,OAAA;AAAA,QAAO,OAAA;AAAA,MAAM,CAAC;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,UAAgB;AACd,eAAW,CAAA,EAAG,CAAA,KAAY,KAAK,MAC7B,CAAA,EAAQ,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;AAE9C,SAAK,MAAM,MAAM,GACjB,KAAK,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;AAAA,EAC3C;AACF"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Sanitize a project title into a safe file base name, falling back to a
3
+ * default when empty. Shared by all export paths so filenames stay consistent.
4
+ */
5
+ export declare function safeFileBaseName(title: string | undefined, fallback?: string): string;
1
6
  /**
2
7
  * Serialize/deserialize FlowDocument to/from JSON.
3
8
  * Also includes Mermaid flowchart import.
@@ -6,6 +11,7 @@ export declare function useFlowImportExport(): {
6
11
  exportJSON: () => string;
7
12
  importJSON: (json: string) => void;
8
13
  importMermaid: (mermaidCode: string) => void;
14
+ exportMarkdown: () => string;
9
15
  clearDocument: () => void;
10
16
  };
11
17
  /**