dishui 0.0.64 → 0.0.66

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 (504) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +10 -11
  2. package/dist/chart.js +12 -46
  3. package/dist/code-editor.js +16 -43
  4. package/dist/components/Badge/index.js +11 -13
  5. package/dist/components/Badge/index.js.map +1 -1
  6. package/dist/components/Button/index.js +62 -86
  7. package/dist/components/Button/index.js.map +1 -1
  8. package/dist/components/Card/index.d.ts +87 -0
  9. package/dist/components/Card/index.js +178 -44
  10. package/dist/components/Card/index.js.map +1 -1
  11. package/dist/components/Chart/Chart.js +25 -25
  12. package/dist/components/Chart/Chart.js.map +1 -1
  13. package/dist/components/Checkbox/index.js +57 -63
  14. package/dist/components/Checkbox/index.js.map +1 -1
  15. package/dist/components/ChoicePicker/index.d.ts +44 -0
  16. package/dist/components/ChoicePicker/index.js +81 -0
  17. package/dist/components/ChoicePicker/index.js.map +1 -0
  18. package/dist/components/Column/index.d.ts +28 -0
  19. package/dist/components/Column/index.js +30 -0
  20. package/dist/components/Column/index.js.map +1 -0
  21. package/dist/components/DateTimeInput/index.d.ts +44 -0
  22. package/dist/components/DateTimeInput/index.js +48 -0
  23. package/dist/components/DateTimeInput/index.js.map +1 -0
  24. package/dist/components/Demo/index.js +107 -107
  25. package/dist/components/Demo/index.js.map +1 -1
  26. package/dist/components/Divider/index.d.ts +20 -0
  27. package/dist/components/Divider/index.js +30 -0
  28. package/dist/components/Divider/index.js.map +1 -0
  29. package/dist/components/EmptyState/index.d.ts +4 -1
  30. package/dist/components/EmptyState/index.js +24 -24
  31. package/dist/components/EmptyState/index.js.map +1 -1
  32. package/dist/components/FileUploader/DropZone.js +134 -136
  33. package/dist/components/FileUploader/DropZone.js.map +1 -1
  34. package/dist/components/FileUploader/FileItem.js +159 -163
  35. package/dist/components/FileUploader/FileItem.js.map +1 -1
  36. package/dist/components/FileUploader/FileUploader.js +126 -127
  37. package/dist/components/FileUploader/FileUploader.js.map +1 -1
  38. package/dist/components/FileUploader/UploadQueue.js +62 -62
  39. package/dist/components/FileUploader/UploadQueue.js.map +1 -1
  40. package/dist/components/FloatWindow/index.d.ts +28 -0
  41. package/dist/components/GridLayout/index.d.ts +42 -0
  42. package/dist/components/Icon/index.d.ts +24 -0
  43. package/dist/components/Icon/index.js +26 -0
  44. package/dist/components/Icon/index.js.map +1 -0
  45. package/dist/components/Image/index.d.ts +33 -0
  46. package/dist/components/Image/index.js +44 -0
  47. package/dist/components/Image/index.js.map +1 -0
  48. package/dist/components/Input/index.js +196 -197
  49. package/dist/components/Input/index.js.map +1 -1
  50. package/dist/components/Label/index.js +62 -73
  51. package/dist/components/Label/index.js.map +1 -1
  52. package/dist/components/Layout/index.js +134 -139
  53. package/dist/components/Layout/index.js.map +1 -1
  54. package/dist/components/List/index.js +45 -43
  55. package/dist/components/List/index.js.map +1 -1
  56. package/dist/components/Markdown/Markdown.js +106 -103
  57. package/dist/components/Markdown/Markdown.js.map +1 -1
  58. package/dist/components/Markdown/codeThemes.js +24 -33
  59. package/dist/components/Markdown/codeThemes.js.map +1 -1
  60. package/dist/components/Markdown/markdownComponents.js +203 -208
  61. package/dist/components/Markdown/markdownComponents.js.map +1 -1
  62. package/dist/components/Markdown/parseCodeBlockMeta.js +22 -22
  63. package/dist/components/Markdown/parseCodeBlockMeta.js.map +1 -1
  64. package/dist/components/Markdown/useMarkdownSource.js +46 -46
  65. package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
  66. package/dist/components/Markdown/useMarkmapRenderer.js +35 -36
  67. package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
  68. package/dist/components/Markdown/useMermaidRenderer.js +41 -42
  69. package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
  70. package/dist/components/Modal/index.d.ts +7 -3
  71. package/dist/components/Modal/index.js +82 -70
  72. package/dist/components/Modal/index.js.map +1 -1
  73. package/dist/components/MultipleChoice/index.d.ts +44 -0
  74. package/dist/components/MultipleChoice/index.js +52 -0
  75. package/dist/components/MultipleChoice/index.js.map +1 -0
  76. package/dist/components/Notification/index.d.ts +17 -0
  77. package/dist/components/Page/index.d.ts +58 -0
  78. package/dist/components/Page/index.js +43 -0
  79. package/dist/components/Page/index.js.map +1 -0
  80. package/dist/components/PageHeader/index.js +28 -28
  81. package/dist/components/PageHeader/index.js.map +1 -1
  82. package/dist/components/ProtectedRoute/index.js +8 -9
  83. package/dist/components/ProtectedRoute/index.js.map +1 -1
  84. package/dist/components/Row/index.d.ts +28 -0
  85. package/dist/components/Row/index.js +30 -0
  86. package/dist/components/Row/index.js.map +1 -0
  87. package/dist/components/Select/index.js +251 -257
  88. package/dist/components/Select/index.js.map +1 -1
  89. package/dist/components/SidebarToggleButton/index.js +56 -59
  90. package/dist/components/SidebarToggleButton/index.js.map +1 -1
  91. package/dist/components/Slider/index.d.ts +39 -0
  92. package/dist/components/Slider/index.js +52 -0
  93. package/dist/components/Slider/index.js.map +1 -0
  94. package/dist/components/StatCard/index.d.ts +31 -1
  95. package/dist/components/StatCard/index.js +189 -58
  96. package/dist/components/StatCard/index.js.map +1 -1
  97. package/dist/components/Switch/index.d.ts +34 -0
  98. package/dist/components/Switch/index.js +55 -0
  99. package/dist/components/Switch/index.js.map +1 -0
  100. package/dist/components/Tab/index.d.ts +40 -0
  101. package/dist/components/Table/index.js +109 -103
  102. package/dist/components/Table/index.js.map +1 -1
  103. package/dist/components/Tabs/index.d.ts +19 -5
  104. package/dist/components/Tabs/index.js +30 -21
  105. package/dist/components/Tabs/index.js.map +1 -1
  106. package/dist/components/Text/index.d.ts +43 -0
  107. package/dist/components/Text/index.js +55 -0
  108. package/dist/components/Text/index.js.map +1 -0
  109. package/dist/components/Tooltip/index.d.ts +23 -0
  110. package/dist/components/Tooltip/index.js +34 -0
  111. package/dist/components/Tooltip/index.js.map +1 -0
  112. package/dist/components/Tree/Tree.js +205 -205
  113. package/dist/components/Tree/Tree.js.map +1 -1
  114. package/dist/components/pro/ArticleContextMenu/index.js +86 -87
  115. package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
  116. package/dist/components/pro/ArticleControl/ArticleControl2.js +250 -250
  117. package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
  118. package/dist/components/pro/ArticleControl/buildHeadingTree.js +31 -32
  119. package/dist/components/pro/ArticleControl/buildHeadingTree.js.map +1 -1
  120. package/dist/components/pro/ArticleControl/useArticleToc.js +100 -102
  121. package/dist/components/pro/ArticleControl/useArticleToc.js.map +1 -1
  122. package/dist/components/pro/Calendar/Calendar.d.ts +10 -0
  123. package/dist/components/pro/Calendar/hooks/useCalendarDrag.d.ts +47 -0
  124. package/dist/components/pro/Calendar/hooks/useCalendarState.d.ts +56 -0
  125. package/dist/components/pro/Calendar/index.d.ts +7 -0
  126. package/dist/components/pro/Calendar/types.d.ts +151 -0
  127. package/dist/components/pro/Calendar/utils.d.ts +94 -0
  128. package/dist/components/pro/Chat/Chat.d.ts +6 -0
  129. package/dist/components/pro/Chat/index.d.ts +2 -0
  130. package/dist/components/pro/Chat/types.d.ts +84 -0
  131. package/dist/components/pro/CodeEditor/editors/CodeEditor.js +287 -320
  132. package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
  133. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +167 -221
  134. package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
  135. package/dist/components/pro/CodeEditor/editors/markdownExtensions.js +594 -613
  136. package/dist/components/pro/CodeEditor/editors/markdownExtensions.js.map +1 -1
  137. package/dist/components/pro/CodeEditor/extensions/contextMenu.js +54 -55
  138. package/dist/components/pro/CodeEditor/extensions/contextMenu.js.map +1 -1
  139. package/dist/components/pro/CodeEditor/extensions/index.js +152 -160
  140. package/dist/components/pro/CodeEditor/extensions/index.js.map +1 -1
  141. package/dist/components/pro/CodeEditor/langs/index.js +7 -15
  142. package/dist/components/pro/CodeEditor/langs/index.js.map +1 -1
  143. package/dist/components/pro/CodeEditor/langs/javascript.js +11 -48
  144. package/dist/components/pro/CodeEditor/langs/javascript.js.map +1 -1
  145. package/dist/components/pro/CodeEditor/langs/python.js +4 -40
  146. package/dist/components/pro/CodeEditor/langs/python.js.map +1 -1
  147. package/dist/components/pro/CodeEditor/langs/snippets.js +118 -147
  148. package/dist/components/pro/CodeEditor/langs/snippets.js.map +1 -1
  149. package/dist/components/pro/CodeEditor/panels/FootnotePanel.js +153 -153
  150. package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
  151. package/dist/components/pro/CodeEditor/panels/HistoryPanel.js +180 -190
  152. package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
  153. package/dist/components/pro/CodeEditor/panels/OutlinePanel.js +130 -137
  154. package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
  155. package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js +228 -242
  156. package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
  157. package/dist/components/pro/CodeEditor/panels/VariablePanel.js +208 -248
  158. package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
  159. package/dist/components/pro/CodeEditor/themes.js +513 -483
  160. package/dist/components/pro/CodeEditor/themes.js.map +1 -1
  161. package/dist/components/pro/CodeEditor/types.d.ts +1 -1
  162. package/dist/components/pro/CodeEditor/utils.js +171 -175
  163. package/dist/components/pro/CodeEditor/utils.js.map +1 -1
  164. package/dist/components/pro/DataTable/DataTable.js +305 -305
  165. package/dist/components/pro/DataTable/DataTable.js.map +1 -1
  166. package/dist/components/pro/DataTable/Filters.js +299 -314
  167. package/dist/components/pro/DataTable/Filters.js.map +1 -1
  168. package/dist/components/pro/DataTable/PivotPanel.js +203 -204
  169. package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
  170. package/dist/components/pro/DataTable/PivotView.js +142 -141
  171. package/dist/components/pro/DataTable/PivotView.js.map +1 -1
  172. package/dist/components/pro/DataTable/components/BulkActions.js +42 -42
  173. package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
  174. package/dist/components/pro/DataTable/components/ColumnSelector.js +84 -84
  175. package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
  176. package/dist/components/pro/DataTable/components/FilterBar.js +58 -58
  177. package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
  178. package/dist/components/pro/DataTable/components/TableBody.js +93 -94
  179. package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
  180. package/dist/components/pro/DataTable/components/TableHeader.js +78 -78
  181. package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
  182. package/dist/components/pro/DataTable/components/TablePagination.js +77 -77
  183. package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
  184. package/dist/components/pro/DataTable/components/TableToolbar.js +40 -40
  185. package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
  186. package/dist/components/pro/DataTable/extension.js +5 -5
  187. package/dist/components/pro/DataTable/extension.js.map +1 -1
  188. package/dist/components/pro/DataTable/pivotEngine.js +84 -92
  189. package/dist/components/pro/DataTable/pivotEngine.js.map +1 -1
  190. package/dist/components/pro/DataTable/pivotExtension.js +93 -93
  191. package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
  192. package/dist/components/pro/DataTable/rowDetailExtension.js +30 -30
  193. package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
  194. package/dist/components/pro/DataTable/tanstack-table.js +45 -62
  195. package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
  196. package/dist/components/pro/DataTable/treeDataUtils.js +37 -48
  197. package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
  198. package/dist/components/pro/DataTable/useColumnDragReorder.js +68 -68
  199. package/dist/components/pro/DataTable/useColumnDragReorder.js.map +1 -1
  200. package/dist/components/pro/DataTable/utils.js +156 -168
  201. package/dist/components/pro/DataTable/utils.js.map +1 -1
  202. package/dist/components/pro/FileExplorer/Breadcrumb.js +180 -180
  203. package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
  204. package/dist/components/pro/FileExplorer/CreateDialog.js +78 -78
  205. package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
  206. package/dist/components/pro/FileExplorer/FileExplorer.js +202 -205
  207. package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
  208. package/dist/components/pro/FileExplorer/FileIcon.js +190 -190
  209. package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
  210. package/dist/components/pro/FileExplorer/GridView.js +100 -100
  211. package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
  212. package/dist/components/pro/FileExplorer/ListView.js +209 -209
  213. package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
  214. package/dist/components/pro/FileExplorer/Toolbar.js +199 -199
  215. package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
  216. package/dist/components/pro/Flow/Flow.js +920 -946
  217. package/dist/components/pro/Flow/Flow.js.map +1 -1
  218. package/dist/components/pro/Flow/FlowCanvas.js +1626 -1663
  219. package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
  220. package/dist/components/pro/Flow/archify/build.js +85 -94
  221. package/dist/components/pro/Flow/archify/build.js.map +1 -1
  222. package/dist/components/pro/Flow/archify/convert.js +512 -519
  223. package/dist/components/pro/Flow/archify/convert.js.map +1 -1
  224. package/dist/components/pro/Flow/archify/palette.js +87 -104
  225. package/dist/components/pro/Flow/archify/palette.js.map +1 -1
  226. package/dist/components/pro/Flow/archify/presets.js +34 -37
  227. package/dist/components/pro/Flow/archify/presets.js.map +1 -1
  228. package/dist/components/pro/Flow/archify/spec.js +7 -7
  229. package/dist/components/pro/Flow/archify/spec.js.map +1 -1
  230. package/dist/components/pro/Flow/canvas/AlignmentGuides.js +25 -25
  231. package/dist/components/pro/Flow/canvas/AlignmentGuides.js.map +1 -1
  232. package/dist/components/pro/Flow/canvas/GridRenderer.js +54 -55
  233. package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
  234. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +54 -58
  235. package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
  236. package/dist/components/pro/Flow/canvas/PixiApp.js +105 -102
  237. package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
  238. package/dist/components/pro/Flow/canvas/SelectionOverlay.js +38 -38
  239. package/dist/components/pro/Flow/canvas/SelectionOverlay.js.map +1 -1
  240. package/dist/components/pro/Flow/canvas/ViewportContainer.js +117 -117
  241. package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
  242. package/dist/components/pro/Flow/constants.js +266 -278
  243. package/dist/components/pro/Flow/constants.js.map +1 -1
  244. package/dist/components/pro/Flow/context/FlowAIContext.js +27 -28
  245. package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
  246. package/dist/components/pro/Flow/context/FlowContext.js +60 -61
  247. package/dist/components/pro/Flow/context/FlowContext.js.map +1 -1
  248. package/dist/components/pro/Flow/context/FlowUIContext.js +115 -117
  249. package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
  250. package/dist/components/pro/Flow/edges/EdgeRenderer.js +135 -138
  251. package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
  252. package/dist/components/pro/Flow/edges/edgeMarkers.js +11 -14
  253. package/dist/components/pro/Flow/edges/edgeMarkers.js.map +1 -1
  254. package/dist/components/pro/Flow/edges/edgePaths.js +351 -367
  255. package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
  256. package/dist/components/pro/Flow/hooks/useAlignmentGuides.js +49 -52
  257. package/dist/components/pro/Flow/hooks/useAlignmentGuides.js.map +1 -1
  258. package/dist/components/pro/Flow/hooks/useClipboard.js +154 -154
  259. package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
  260. package/dist/components/pro/Flow/hooks/useCompactMode.js +17 -17
  261. package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -1
  262. package/dist/components/pro/Flow/hooks/useDeleteSelection.js +40 -40
  263. package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
  264. package/dist/components/pro/Flow/hooks/useDraggablePanel.js +51 -51
  265. package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
  266. package/dist/components/pro/Flow/hooks/useEdgeMutations.js +157 -157
  267. package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
  268. package/dist/components/pro/Flow/hooks/useFlowImportExport.js +190 -201
  269. package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
  270. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +32 -38
  271. package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
  272. package/dist/components/pro/Flow/hooks/useLayoutActions.js +172 -182
  273. package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
  274. package/dist/components/pro/Flow/hooks/useLineMutations.js +57 -57
  275. package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
  276. package/dist/components/pro/Flow/hooks/useMindMap.js +229 -238
  277. package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
  278. package/dist/components/pro/Flow/hooks/useNodeMutations.js +102 -102
  279. package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
  280. package/dist/components/pro/Flow/hooks/usePdfExport.js +55 -56
  281. package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -1
  282. package/dist/components/pro/Flow/hooks/usePixiApp.js +55 -57
  283. package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
  284. package/dist/components/pro/Flow/hooks/useResizablePanel.js +31 -31
  285. package/dist/components/pro/Flow/hooks/useResizablePanel.js.map +1 -1
  286. package/dist/components/pro/Flow/hooks/useSelection.js +69 -69
  287. package/dist/components/pro/Flow/hooks/useSelection.js.map +1 -1
  288. package/dist/components/pro/Flow/hooks/useUndoRedo.js +27 -27
  289. package/dist/components/pro/Flow/hooks/useUndoRedo.js.map +1 -1
  290. package/dist/components/pro/Flow/hooks/useViewport.js +28 -28
  291. package/dist/components/pro/Flow/hooks/useViewport.js.map +1 -1
  292. package/dist/components/pro/Flow/lines/FreehandTool.js +63 -63
  293. package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
  294. package/dist/components/pro/Flow/lines/GeometricLineTool.js +80 -80
  295. package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
  296. package/dist/components/pro/Flow/lines/LineRenderer.js +88 -88
  297. package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
  298. package/dist/components/pro/Flow/lines/lineSmoothing.js +32 -34
  299. package/dist/components/pro/Flow/lines/lineSmoothing.js.map +1 -1
  300. package/dist/components/pro/Flow/nodes/DataNodeView.js +236 -222
  301. package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
  302. package/dist/components/pro/Flow/nodes/MediaContent.js +236 -246
  303. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  304. package/dist/components/pro/Flow/nodes/MediaOverlay.js +63 -63
  305. package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
  306. package/dist/components/pro/Flow/nodes/Model3DView.js +111 -113
  307. package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
  308. package/dist/components/pro/Flow/nodes/NodeHandles.js +74 -80
  309. package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
  310. package/dist/components/pro/Flow/nodes/NodeRenderer.js +303 -314
  311. package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
  312. package/dist/components/pro/Flow/nodes/NodeText.js +25 -29
  313. package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
  314. package/dist/components/pro/Flow/nodes/aiClient.js +124 -137
  315. package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
  316. package/dist/components/pro/Flow/nodes/animAnchors.js +42 -49
  317. package/dist/components/pro/Flow/nodes/animAnchors.js.map +1 -1
  318. package/dist/components/pro/Flow/nodes/dataUtils.js +246 -267
  319. package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
  320. package/dist/components/pro/Flow/nodes/nodeUtils.js +23 -28
  321. package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
  322. package/dist/components/pro/Flow/nodes/shapes.js +556 -591
  323. package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
  324. package/dist/components/pro/Flow/nodes/svgIconTexture.js +37 -39
  325. package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
  326. package/dist/components/pro/Flow/nodes/svgIcons.js +684 -689
  327. package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
  328. package/dist/components/pro/Flow/panels/AIPanel.js +464 -491
  329. package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
  330. package/dist/components/pro/Flow/panels/Breadcrumb.js +41 -41
  331. package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
  332. package/dist/components/pro/Flow/panels/ContextMenu.js +37 -37
  333. package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
  334. package/dist/components/pro/Flow/panels/DataInspectorSection.js +428 -432
  335. package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
  336. package/dist/components/pro/Flow/panels/ExpandableTextarea.js +61 -62
  337. package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
  338. package/dist/components/pro/Flow/panels/FlowPanelGroup.js +114 -114
  339. package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
  340. package/dist/components/pro/Flow/panels/FlowToolbar.js +347 -391
  341. package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
  342. package/dist/components/pro/Flow/panels/InspectorPanel.js +1792 -1798
  343. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  344. package/dist/components/pro/Flow/panels/OutlinePanel.js +242 -244
  345. package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
  346. package/dist/components/pro/Flow/panels/PresentationMode.js +137 -138
  347. package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
  348. package/dist/components/pro/Flow/panels/ProjectTitle.js +46 -46
  349. package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
  350. package/dist/components/pro/Flow/panels/ShapePalette.js +557 -567
  351. package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
  352. package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +0 -1
  353. package/dist/components/pro/Flow/panels/toolbarIcons.js +508 -557
  354. package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
  355. package/dist/components/pro/Flow/types.js +26 -26
  356. package/dist/components/pro/Flow/types.js.map +1 -1
  357. package/dist/components/pro/Flow/utils/dashedLine.js +113 -117
  358. package/dist/components/pro/Flow/utils/dashedLine.js.map +1 -1
  359. package/dist/components/pro/Flow/utils/gradient.js +55 -55
  360. package/dist/components/pro/Flow/utils/gradient.js.map +1 -1
  361. package/dist/components/pro/Flow/utils/pdfExport.js +50 -89
  362. package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -1
  363. package/dist/components/pro/Flow/utils/themeColor.js +185 -195
  364. package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
  365. package/dist/components/pro/Gantt/Gantt.d.ts +7 -0
  366. package/dist/components/pro/Gantt/hooks/useGanttDrag.d.ts +31 -0
  367. package/dist/components/pro/Gantt/hooks/useGanttState.d.ts +58 -0
  368. package/dist/components/pro/Gantt/index.d.ts +6 -0
  369. package/dist/components/pro/Gantt/types.d.ts +478 -0
  370. package/dist/components/pro/Gantt/utils.d.ts +124 -0
  371. package/dist/components/pro/Resizable/Resizable.d.ts +30 -0
  372. package/dist/components/pro/Resizable/index.d.ts +2 -0
  373. package/dist/components/pro/RichTextEditor/AIRewrite.js +323 -334
  374. package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
  375. package/dist/components/pro/RichTextEditor/BlockHandle.js +314 -316
  376. package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
  377. package/dist/components/pro/RichTextEditor/BubbleToolbar.js +97 -97
  378. package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
  379. package/dist/components/pro/RichTextEditor/CommentDialog.js +88 -88
  380. package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
  381. package/dist/components/pro/RichTextEditor/CommentPanel.js +240 -240
  382. package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
  383. package/dist/components/pro/RichTextEditor/CommentPopover.js +234 -234
  384. package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
  385. package/dist/components/pro/RichTextEditor/ContextMenu.js +251 -252
  386. package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
  387. package/dist/components/pro/RichTextEditor/RichTextEditor.js +267 -271
  388. package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
  389. package/dist/components/pro/RichTextEditor/SlashMenu.js +214 -214
  390. package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
  391. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -75
  392. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
  393. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +261 -261
  394. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
  395. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +172 -526
  396. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
  397. package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js +112 -114
  398. package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
  399. package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +194 -194
  400. package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
  401. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +970 -973
  402. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
  403. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +11 -12
  404. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
  405. package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +310 -344
  406. package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
  407. package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +38 -39
  408. package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
  409. package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +620 -625
  410. package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
  411. package/dist/components/pro/RichTextEditor/extensions/FontSize.js +25 -25
  412. package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
  413. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +167 -176
  414. package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
  415. package/dist/components/pro/RichTextEditor/types.js +75 -75
  416. package/dist/components/pro/RichTextEditor/types.js.map +1 -1
  417. package/dist/contexts/AppContext.d.ts +1 -1
  418. package/dist/contexts/AppContext.js +216 -221
  419. package/dist/contexts/AppContext.js.map +1 -1
  420. package/dist/data-table.js +15 -41
  421. package/dist/data-table.js.map +1 -1
  422. package/dist/dishui.css +1 -1
  423. package/dist/flow.js +27 -83
  424. package/dist/hooks/useClickOutside.js +18 -18
  425. package/dist/hooks/useClickOutside.js.map +1 -1
  426. package/dist/hooks/useContainerElement.js +9 -9
  427. package/dist/hooks/useContainerElement.js.map +1 -1
  428. package/dist/hooks/useControllableState.js +33 -35
  429. package/dist/hooks/useControllableState.js.map +1 -1
  430. package/dist/hooks/useCopyToClipboard.js +16 -16
  431. package/dist/hooks/useCopyToClipboard.js.map +1 -1
  432. package/dist/hooks/useDebounce.js +14 -14
  433. package/dist/hooks/useDebounce.js.map +1 -1
  434. package/dist/hooks/useDraggable.js +50 -50
  435. package/dist/hooks/useDraggable.js.map +1 -1
  436. package/dist/hooks/useTableColumns.js +39 -42
  437. package/dist/hooks/useTableColumns.js.map +1 -1
  438. package/dist/hooks/useTableData.js +67 -68
  439. package/dist/hooks/useTableData.js.map +1 -1
  440. package/dist/index-nostyled.d.ts +8 -0
  441. package/dist/index.d.ts +29 -1
  442. package/dist/index.js +106 -236
  443. package/dist/layouts/MainLayout.js +56 -56
  444. package/dist/layouts/MainLayout.js.map +1 -1
  445. package/dist/layouts/Navbar.js +214 -214
  446. package/dist/layouts/Navbar.js.map +1 -1
  447. package/dist/layouts/Sidebar.js +184 -165
  448. package/dist/layouts/Sidebar.js.map +1 -1
  449. package/dist/layouts/headbar/Headbar.js +25 -25
  450. package/dist/layouts/headbar/Headbar.js.map +1 -1
  451. package/dist/layouts/headbar/HeadbarLangSwitcher.js +39 -39
  452. package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
  453. package/dist/layouts/headbar/HeadbarSearch.js +120 -120
  454. package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
  455. package/dist/layouts/headbar/HeadbarThemeSwitcher.js +27 -27
  456. package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
  457. package/dist/layouts/headbar/HeadbarTitle.js +26 -26
  458. package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
  459. package/dist/lite.js +9 -24
  460. package/dist/markdown.js +4 -9
  461. package/dist/pages/components/Calendar/index.d.ts +3 -0
  462. package/dist/pages/components/Calendar/index.en.d.ts +3 -0
  463. package/dist/pages/components/Calendar/index.zh.d.ts +3 -0
  464. package/dist/pages/components/Chat/index.d.ts +3 -0
  465. package/dist/pages/components/Chat/index.en.d.ts +3 -0
  466. package/dist/pages/components/Chat/index.zh.d.ts +3 -0
  467. package/dist/pages/components/FloatWindow/index.d.ts +3 -0
  468. package/dist/pages/components/FloatWindow/index.en.d.ts +3 -0
  469. package/dist/pages/components/FloatWindow/index.zh.d.ts +3 -0
  470. package/dist/pages/components/Gantt/index.d.ts +3 -0
  471. package/dist/pages/components/Gantt/index.en.d.ts +3 -0
  472. package/dist/pages/components/Gantt/index.zh.d.ts +3 -0
  473. package/dist/pages/components/GridLayout/index.d.ts +3 -0
  474. package/dist/pages/components/GridLayout/index.en.d.ts +3 -0
  475. package/dist/pages/components/GridLayout/index.zh.d.ts +3 -0
  476. package/dist/pages/components/Notification/index.d.ts +3 -0
  477. package/dist/pages/components/Notification/index.en.d.ts +3 -0
  478. package/dist/pages/components/Notification/index.zh.d.ts +3 -0
  479. package/dist/pages/components/Resizable/index.d.ts +3 -0
  480. package/dist/pages/components/Resizable/index.en.d.ts +3 -0
  481. package/dist/pages/components/Resizable/index.zh.d.ts +3 -0
  482. package/dist/pages/components/Tab/index.d.ts +3 -0
  483. package/dist/pages/components/Tab/index.en.d.ts +3 -0
  484. package/dist/pages/components/Tab/index.zh.d.ts +3 -0
  485. package/dist/styles/themeStyles.js +87 -86
  486. package/dist/styles/themeStyles.js.map +1 -1
  487. package/dist/utils/cn.d.ts +13 -0
  488. package/dist/utils/cn.js +16 -0
  489. package/dist/utils/cn.js.map +1 -0
  490. package/dist/utils/i18n.js +690 -602
  491. package/dist/utils/i18n.js.map +1 -1
  492. package/dist/utils/menu.js +94 -94
  493. package/dist/utils/menu.js.map +1 -1
  494. package/dist/utils/rehype-code-meta.js +14 -14
  495. package/dist/utils/rehype-code-meta.js.map +1 -1
  496. package/dist/utils/remark-code-meta.js +9 -9
  497. package/dist/utils/remark-code-meta.js.map +1 -1
  498. package/dist/utils/routerBuilder.js +59 -58
  499. package/dist/utils/routerBuilder.js.map +1 -1
  500. package/dist/utils/selection.js +28 -29
  501. package/dist/utils/selection.js.map +1 -1
  502. package/dist/utils/themes.js +275 -255
  503. package/dist/utils/themes.js.map +1 -1
  504. package/package.json +23 -10
@@ -1 +1 @@
1
- {"version":3,"file":"NodeRenderer.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/NodeRenderer.ts"],"sourcesContent":["import { Container, Graphics, Text, Sprite, TextStyle } from 'pixi.js';\nimport type { FlowNode, FlowTextPlacement } from '../types';\nimport { drawRoundRectBorder, shapeDrawers, hasBorderSideOverrides, drawBorderSides, type ShapeDrawOptions } from './shapes';\nimport { createNodeText, formatIconLabel, normalizeIconLabelPlacement, updateNodeText } from './NodeText';\nimport { getHandlePositions, createHandleGraphics, updateHandleGraphics, type HandleDef } from './NodeHandles';\nimport { getRotationRad, getFlipScale } from './nodeUtils';\nimport { getIconTexture, subscribeIconTextureReady, ICON_TEXTURE_SIZE } from './svgIconTexture';\nimport { getSvgIcon } from './svgIcons';\nimport { resolveThemeColor } from '../utils/themeColor';\n\n/**\n * Resolve the center point of a text block (title + optional sublabel) inside a\n * node of the given size, for a 9-way placement. Non-center placements pull the\n * block against the corresponding edge/corner with a small inset.\n */\nfunction resolveTextBlockCenter(\n placement: FlowTextPlacement,\n nodeW: number,\n nodeH: number,\n blockW: number,\n blockH: number,\n): { x: number; y: number } {\n const inset = 6;\n const left = inset + blockW / 2;\n const right = nodeW - inset - blockW / 2;\n const cx = nodeW / 2;\n const top = inset + blockH / 2;\n const bottom = nodeH - inset - blockH / 2;\n const cy = nodeH / 2;\n switch (placement) {\n case 'top': return { x: cx, y: top };\n case 'bottom': return { x: cx, y: bottom };\n case 'left': return { x: left, y: cy };\n case 'right': return { x: right, y: cy };\n case 'top-left': return { x: left, y: top };\n case 'top-right': return { x: right, y: top };\n case 'bottom-left': return { x: left, y: bottom };\n case 'bottom-right': return { x: right, y: bottom };\n case 'center':\n default:\n return { x: cx, y: cy };\n }\n}\n\nexport interface NodeContainer {\n container: Container;\n shape: Graphics;\n /** Rotated/flipped visual content for SVG icon stamps. */\n svgTransform: Container;\n icon: Sprite;\n text: Text;\n /** Optional registry glyph rendered beside the title text (left/right). */\n titleIcon: Sprite;\n /** Optional muted second line (Archify card sublabel). */\n subtext: Text;\n /** Optional top-right pill background + label (Archify card tag). */\n tagBg: Graphics;\n tagText: Text;\n /** Sequence badge shown on `animAnchor` nodes. */\n animBadge: Text;\n handles: Graphics;\n handleDefs: HandleDef[];\n nodeId: string;\n subCanvasGlow: Graphics;\n}\n\n/**\n * Manages PixiJS display objects for all nodes on the current canvas.\n * Syncs from FlowNode[] data → PixiJS scene graph.\n */\nexport class NodeRenderer {\n private world: Container;\n private nodeLayer: Container;\n private nodes = new Map<string, NodeContainer>();\n private _dynamicOffset = 0;\n private _unsubscribeTextureReady: () => void;\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.nodeLayer = new Container({ label: 'nodes', sortableChildren: true });\n this.world.addChild(this.nodeLayer);\n this._unsubscribeTextureReady = subscribeIconTextureReady(() => this._resync?.());\n }\n\n private _resync: (() => void) | null = null;\n\n /**\n * Reconcile PixiJS containers with the current node data.\n * Creates new containers, updates existing, removes stale.\n */\n sync(\n flowNodes: FlowNode[],\n selectedIds: Set<string>,\n hoveredId: string | null,\n animSeqMap?: Map<string, number>,\n options?: {\n showAnchors?: boolean;\n presentation?: boolean;\n presentationAnchorId?: string;\n presentationAnchorVisible?: boolean;\n },\n ): void {\n const seen = new Set<string>();\n this._resync = () => this.sync(flowNodes, selectedIds, hoveredId, animSeqMap, options);\n\n // Animation-anchor display sequence (1-based). When a global map is\n // provided (document-wide, shared across sub-canvases) it is used directly;\n // otherwise derive a per-canvas order from stable creation index.\n const seqOf = animSeqMap ?? (() => {\n const anchors = flowNodes\n .filter((n) => n.type === 'animAnchor')\n .sort((a, b) => (a.data.animIndex ?? 0) - (b.data.animIndex ?? 0));\n const m = new Map<string, number>();\n anchors.forEach((n, i) => m.set(n.id, i + 1));\n return m;\n })();\n\n for (const node of flowNodes) {\n seen.add(node.id);\n let nc = this.nodes.get(node.id);\n if (!nc) {\n nc = this._createNode(node);\n this.nodes.set(node.id, nc);\n }\n this._updateNode(\n nc,\n node,\n selectedIds.has(node.id),\n hoveredId === node.id,\n seqOf.get(node.id),\n options,\n );\n }\n\n // Remove nodes no longer in data\n for (const [id, nc] of this.nodes) {\n if (!seen.has(id)) {\n this.nodeLayer.removeChild(nc.container);\n nc.container.destroy({ children: true });\n this.nodes.delete(id);\n }\n }\n }\n\n getNodeContainer(id: string): NodeContainer | undefined {\n return this.nodes.get(id);\n }\n\n getAllNodeContainers(): NodeContainer[] {\n return [...this.nodes.values()];\n }\n\n private _createNode(node: FlowNode): NodeContainer {\n const container = new Container({ label: `node-${node.id}` });\n container.eventMode = 'static';\n container.cursor = 'pointer';\n\n const svgTransform = new Container({ label: 'svg-transform' });\n container.addChild(svgTransform);\n\n const subCanvasGlow = new Graphics();\n subCanvasGlow.label = 'sub-canvas-glow';\n container.addChild(subCanvasGlow);\n\n const shape = new Graphics();\n shape.label = 'shape';\n container.addChild(shape);\n\n const icon = new Sprite();\n icon.label = 'svg-icon';\n icon.anchor.set(0.5, 0.5);\n icon.visible = false;\n container.addChild(icon);\n\n const text = createNodeText({\n label: node.data.label,\n color: resolveThemeColor(node.data.labelColor ?? node.data.color, '#111827'),\n fontSize: node.data.fontSize,\n width: node.width,\n height: node.height,\n });\n container.addChild(text);\n\n // Optional glyph beside the title (lazy-rasterized registry texture).\n const titleIcon = new Sprite();\n titleIcon.label = 'node-title-icon';\n titleIcon.anchor.set(0.5, 0.5);\n titleIcon.visible = false;\n container.addChild(titleIcon);\n\n // Optional muted second line (Archify card sublabel).\n const subtext = new Text({\n text: '',\n style: {\n fontFamily: 'system-ui, -apple-system, sans-serif',\n fontSize: 11,\n fill: '#94a3b8',\n align: 'center',\n },\n });\n subtext.label = 'node-subtext';\n subtext.anchor.set(0.5, 0.5);\n subtext.visible = false;\n container.addChild(subtext);\n\n // Optional top-right pill (Archify card tag).\n const tagBg = new Graphics();\n tagBg.label = 'node-tag-bg';\n tagBg.visible = false;\n container.addChild(tagBg);\n const tagText = new Text({\n text: '',\n style: {\n fontFamily: 'system-ui, -apple-system, sans-serif',\n fontSize: 9,\n fill: '#cbd5e1',\n },\n });\n tagText.label = 'node-tag-text';\n tagText.anchor.set(0.5, 0.5);\n tagText.visible = false;\n container.addChild(tagText);\n\n const handleDefs = getHandlePositions(node.width, node.height);\n const handles = createHandleGraphics(container, handleDefs, false);\n\n // Sequence badge for animation anchors (top-left corner).\n const animBadge = new Text({\n text: '',\n style: { fontFamily: 'system-ui, sans-serif', fontSize: 13, fill: '#ffffff', fontWeight: '700' },\n });\n animBadge.label = 'anim-badge';\n animBadge.anchor.set(0.5, 0.5);\n animBadge.visible = false;\n container.addChild(animBadge);\n\n this.nodeLayer.addChild(container);\n\n return { container, shape, svgTransform, icon, text, titleIcon, subtext, tagBg, tagText, animBadge, handles, handleDefs, nodeId: node.id, subCanvasGlow };\n }\n\n private _updateNode(\n nc: NodeContainer,\n node: FlowNode,\n selected: boolean,\n hovered: boolean,\n animSeq?: number,\n options?: {\n showAnchors?: boolean;\n presentation?: boolean;\n presentationAnchorId?: string;\n presentationAnchorVisible?: boolean;\n },\n ): void {\n const { container, svgTransform, shape, icon, text, titleIcon, subtext, tagBg, tagText, animBadge, handles, subCanvasGlow } = nc;\n\n const isSvg = node.type === 'shapeSvg';\n const rad = getRotationRad(node.data);\n const flip = getFlipScale(node.data);\n\n container.zIndex = node.zIndex ?? 0;\n if (isSvg) {\n // Keep the label in the untransformed root. Only the icon box, icon and\n // connection handles rotate/flip around the node center.\n if (shape.parent !== svgTransform) svgTransform.addChild(shape);\n if (icon.parent !== svgTransform) svgTransform.addChild(icon);\n if (handles.parent !== svgTransform) svgTransform.addChild(handles);\n container.position.set(node.position.x, node.position.y);\n container.rotation = 0;\n container.scale.set(1, 1);\n container.pivot.set(0, 0);\n svgTransform.position.set(node.width / 2, node.height / 2);\n svgTransform.pivot.set(node.width / 2, node.height / 2);\n svgTransform.rotation = rad;\n svgTransform.scale.set(flip.sx, flip.sy);\n } else {\n if (shape.parent !== container) container.addChildAt(shape, Math.min(2, container.children.length));\n if (icon.parent !== container) container.addChild(icon);\n if (handles.parent !== container) container.addChild(handles);\n svgTransform.rotation = 0;\n svgTransform.scale.set(1, 1);\n container.position.set(node.position.x, node.position.y);\n container.rotation = rad;\n container.scale.set(flip.sx, flip.sy);\n if (rad !== 0 || flip.sx < 0 || flip.sy < 0) {\n container.pivot.set(node.width / 2, node.height / 2);\n container.position.set(node.position.x + node.width / 2, node.position.y + node.height / 2);\n } else {\n container.pivot.set(0, 0);\n }\n }\n\n const isMedia = node.type === 'mediaNode';\n const isAnchor = node.type === 'animAnchor';\n // Anchors only show their label/badge when the anchor itself is visible.\n let anchorVisible = true;\n\n // Redraw shape\n shape.clear();\n shape.alpha = 1;\n if (isSvg) {\n this._updateSvgNode(nc, node, selected);\n } else if (isMedia) {\n // Media nodes render their content in a synced DOM overlay; PixiJS only\n // draws the frame (background + border) beneath the overlay.\n icon.visible = false;\n const r = 6;\n const fill = node.data.fill && node.data.fill !== 'transparent' ? resolveThemeColor(node.data.fill, '#ffffff') : '#ffffff';\n const borderHidden = node.data.borderStyle === 'none';\n const perSideBorders = hasBorderSideOverrides(node.data, node.type);\n const strokeColor = selected ? '#3b82f6' : resolveThemeColor(node.data.stroke, '#374151');\n const strokeW = selected ? Math.max(node.data.strokeWidth, 2) : node.data.strokeWidth;\n shapeDrawers.shapeRoundRect(shape, {\n width: node.width,\n height: node.height,\n fill,\n stroke: perSideBorders ? 'transparent' : strokeColor,\n strokeWidth: strokeW,\n borderStyle: selected && borderHidden ? 'solid' : node.data.borderStyle,\n dashOffset: this._dynamicOffset,\n });\n if (perSideBorders) {\n // Independent sides replace the full outline; the selection ring is\n // drawn separately so selection stays visible.\n const stroke = resolveThemeColor(node.data.stroke, '#374151');\n if (selected) {\n shape.roundRect(0, 0, node.width, node.height, r).stroke({ color: '#3b82f6', width: Math.max(node.data.strokeWidth, 2) });\n }\n drawBorderSides(shape, 'mediaNode', node.width, node.height, node.data.borderSides, stroke, node.data.strokeWidth, borderHidden ? undefined : node.data.borderStyle, this._dynamicOffset);\n }\n } else if (isAnchor) {\n // Animation anchors are globally visible/hidden in editing mode. During\n // presentation the current frame remains as a subtle dashed overlay.\n icon.visible = false;\n const accent = '#8b5cf6';\n const presentation = options?.presentation ?? false;\n anchorVisible = presentation\n ? (options?.presentationAnchorVisible ?? false) && options?.presentationAnchorId === node.id\n : (options?.showAnchors ?? true);\n if (anchorVisible) {\n shape.alpha = presentation ? 0.48 : 0.9;\n shapeDrawers.shapeRoundRect(shape, {\n width: node.width,\n height: node.height,\n fill: 'transparent',\n stroke: selected && !presentation ? '#3b82f6' : accent,\n strokeWidth: selected && !presentation ? 2.5 : 1.5,\n borderStyle: 'dashed',\n });\n shape.circle(0, 0, presentation ? 11 : 13).fill({\n color: selected && !presentation ? '#3b82f6' : accent,\n });\n }\n animBadge.text = String(animSeq ?? '');\n animBadge.alpha = presentation ? 0.7 : 1;\n animBadge.visible = anchorVisible;\n animBadge.position.set(0, 0);\n } else {\n icon.visible = false;\n const drawFn = shapeDrawers[node.type] ?? shapeDrawers.shapeRect;\n // Independent per-side borders (top/right/bottom/left) replace the full\n // outline for shapes with four well-defined sides; the drawer then only\n // fills and the sides are stroked separately below.\n const perSideBorders = hasBorderSideOverrides(node.data, node.type);\n const borderHidden = node.data.borderStyle === 'none';\n const baseStroke = resolveThemeColor(node.data.stroke, '#374151');\n const opts: ShapeDrawOptions = {\n width: node.width,\n height: node.height,\n fill: resolveThemeColor(node.data.fill, '#ffffff'),\n stroke: perSideBorders ? 'transparent' : (selected ? '#3b82f6' : baseStroke),\n strokeWidth: selected ? Math.max(node.data.strokeWidth, 2) : node.data.strokeWidth,\n borderStyle: (selected && borderHidden) ? 'solid' : node.data.borderStyle,\n dashOffset: this._dynamicOffset,\n };\n drawFn(shape, opts);\n if (perSideBorders) {\n if (selected) {\n const r = node.type === 'shapeRect' ? 0 : Math.min(12, node.width * 0.1, node.height * 0.1);\n shape.roundRect(0, 0, node.width, node.height, r).stroke({ color: '#3b82f6', width: Math.max(node.data.strokeWidth, 2) });\n }\n const style = (selected && borderHidden) ? 'solid' : node.data.borderStyle;\n drawBorderSides(shape, node.type, node.width, node.height, node.data.borderSides, baseStroke, node.data.strokeWidth, style, this._dynamicOffset);\n }\n }\n if (!isAnchor) animBadge.visible = false;\n\n // Sub-canvas glow indicator\n subCanvasGlow.clear();\n if (node.data.childCanvasId) {\n const pad = 4;\n const w = node.width + pad * 2;\n const h = node.height + pad * 2;\n const pulse = 0.5 + 0.3 * Math.sin(this._dynamicOffset * 0.008);\n subCanvasGlow.roundRect(-pad, -pad, w, h, 6);\n subCanvasGlow.stroke({ color: 0x8b5cf6, width: 2.5, alpha: pulse });\n subCanvasGlow.roundRect(-pad - 2, -pad - 2, w + 4, h + 4, 8);\n subCanvasGlow.stroke({ color: 0x8b5cf6, width: 1, alpha: pulse * 0.4 });\n }\n\n // Text: counter-rotate and counter-flip so it stays upright\n const iconLabelPlacement = normalizeIconLabelPlacement(node.data.labelPlacement);\n // SVG-icon labels default to the theme font color (so they read on any\n // theme) even when the icon body uses a brand color; other node types fall\n // back to the node's own text color.\n const labelColor = node.data.labelColor\n ?? (isSvg ? 'theme:base-content' : node.data.color);\n updateNodeText(text, {\n label: isMedia\n ? ''\n : isSvg\n ? formatIconLabel(node.data.label, iconLabelPlacement)\n : node.data.label,\n color: resolveThemeColor(labelColor, '#111827'),\n fontSize: node.data.fontSize,\n width: node.width,\n height: node.height,\n });\n text.visible = !isMedia && (!isAnchor || anchorVisible);\n\n // Card extras: muted sublabel line + tag pill. Available on ordinary\n // shapes, group frames, and (when shown) animation anchors.\n const showExtras = !isSvg && !isMedia && (!isAnchor || anchorVisible);\n const sublabel = showExtras ? (node.data.sublabel ?? '').trim() : '';\n const hasSub = sublabel.length > 0;\n\n // Title icon: optional registry glyph beside the title text. Ordinary\n // shapes, group frames and (visible) anchors only — SVG stamps already are\n // an icon, and media nodes render their own overlay.\n const titleIconId = showExtras ? (node.data.titleIcon ?? '').trim() : '';\n const titleIconGap = 6;\n const titleIconSize = Math.max(8, node.data.titleIconSize ?? Math.round(node.data.fontSize * 1.15));\n const titleIconScale = titleIconSize / ICON_TEXTURE_SIZE;\n const hasTitleIcon = titleIconId.length > 0;\n if (hasTitleIcon) {\n // Default tint keeps each icon's own identity: brand icons (languages /\n // frameworks) use their authentic brandColor, everything else follows the\n // title color (a theme token, so it tracks theme switches). An explicit\n // `titleIconColor` always wins.\n const fallbackTint = getSvgIcon(titleIconId)?.brandColor ?? labelColor;\n const tint = resolveThemeColor(node.data.titleIconColor ?? fallbackTint, '#111827') || '#111827';\n const tex = getIconTexture(titleIconId, tint);\n if (tex) {\n titleIcon.texture = tex;\n titleIcon.visible = true;\n } else {\n titleIcon.visible = false;\n }\n } else {\n titleIcon.visible = false;\n }\n\n if (node.type === 'shapeCorner') {\n titleIcon.visible = false;\n const half = Math.min(node.width, node.height) * 0.4;\n text.position.set((half + node.width) / 2, (half + node.height) / 2);\n } else if (isSvg) {\n const gap = 4;\n const halfTextWidth = text.width / 2;\n const halfTextHeight = text.height / 2;\n if (iconLabelPlacement === 'top') {\n text.position.set(node.width / 2, -gap - halfTextHeight);\n } else if (iconLabelPlacement === 'bottom') {\n text.position.set(node.width / 2, node.height + gap + halfTextHeight);\n } else if (iconLabelPlacement === 'left') {\n text.position.set(-gap - halfTextWidth, node.height / 2);\n } else if (iconLabelPlacement === 'right') {\n text.position.set(node.width + gap + halfTextWidth, node.height / 2);\n } else {\n text.position.set(node.width / 2, node.height / 2);\n }\n text.position.x += node.data.labelOffsetX ?? 0;\n text.position.y += node.data.labelOffsetY ?? 0;\n } else if (!isMedia) {\n // Ordinary shapes, group frames, and anchors: 9-way text placement, with\n // an optional sublabel line stacked beneath the title. Both lines stay\n // center-anchored; only the block's center point moves per placement.\n const gap = 3;\n const subFont = Math.max(9, node.data.fontSize - 3);\n if (hasSub) {\n const s = subtext.style as TextStyle;\n s.fill = resolveThemeColor(node.data.sublabelColor ?? '#94a3b8', '#94a3b8');\n s.fontSize = subFont;\n subtext.text = sublabel;\n subtext.anchor.set(0.5, 0.5);\n subtext.visible = true;\n subtext.rotation = -rad;\n subtext.scale.set(flip.sx, flip.sy);\n }\n text.anchor.set(0.5, 0.5);\n // Title + optional icon form a horizontally centered group; a sublabel\n // (when present) stays centered under the whole block.\n const iconInBlock = titleIcon.visible;\n const titleGroupW = text.width + (iconInBlock ? titleIconSize + titleIconGap : 0);\n const blockH = Math.max(text.height, iconInBlock ? titleIconSize : 0) + (hasSub ? gap + subtext.height : 0);\n const blockW = Math.max(titleGroupW, hasSub ? subtext.width : 0);\n // Anchors and group frames default their text to the top band; ordinary\n // shapes default to centered.\n const isGroupFrame = node.data.isGroup || node.type === 'flowGroup' || node.type === 'geometryGroup';\n const placement = node.data.textPlacement ?? (isAnchor || isGroupFrame ? 'top' : 'center');\n const c = resolveTextBlockCenter(\n placement,\n node.width,\n node.height,\n blockW,\n blockH,\n );\n const bx = c.x + (node.data.labelOffsetX ?? 0);\n const by = c.y + (node.data.labelOffsetY ?? 0);\n const titleCy = by - blockH / 2 + text.height / 2;\n if (iconInBlock) {\n const groupLeft = bx - titleGroupW / 2;\n if ((node.data.titleIconSide ?? 'left') === 'right') {\n text.position.set(groupLeft + text.width / 2, titleCy);\n titleIcon.position.set(groupLeft + text.width + titleIconGap + titleIconSize / 2, titleCy);\n } else {\n titleIcon.position.set(groupLeft + titleIconSize / 2, titleCy);\n text.position.set(groupLeft + titleIconSize + titleIconGap + text.width / 2, titleCy);\n }\n } else {\n text.position.set(bx, titleCy);\n }\n if (hasSub) subtext.position.set(bx, by + blockH / 2 - subtext.height / 2);\n }\n if (!hasSub) subtext.visible = false;\n\n if (isSvg) {\n text.rotation = 0;\n text.scale.set(1, 1);\n } else {\n text.rotation = -rad;\n text.scale.set(flip.sx, flip.sy);\n // Keep the glyph upright and mirrored with the title, like the text.\n // Scale (not width/height — those are scale setters in disguise and the\n // write here would clobber them) is derived from the texture's natural\n // raster size so `titleIconSize` stays authoritative.\n titleIcon.rotation = -rad;\n titleIcon.scale.set(titleIconScale * flip.sx, titleIconScale * flip.sy);\n }\n\n // Tag pill: placed in one of four corners with its own color.\n const tag = showExtras ? (node.data.tag ?? '').trim() : '';\n if (tag) {\n tagText.text = tag;\n tagText.visible = true;\n const padX = 5;\n const padY = 2;\n const tw = tagText.width + padX * 2;\n const th = tagText.height + padY * 2;\n const margin = 6;\n const placement = node.data.tagPlacement ?? 'top-right';\n const tx = placement === 'top-left' || placement === 'bottom-left'\n ? margin\n : node.width - tw - margin;\n const ty = placement === 'top-left' || placement === 'top-right'\n ? margin\n : node.height - th - margin;\n const tagColor = resolveThemeColor(node.data.tagColor ?? node.data.stroke, '#334155');\n tagBg.clear();\n tagBg\n .roundRect(tx, ty, tw, th, 3)\n .fill({ color: tagColor, alpha: 0.18 })\n .stroke({ color: tagColor, width: 1, alpha: 0.55 });\n tagBg.visible = true;\n (tagText.style as TextStyle).fill = tagColor;\n tagText.position.set(tx + tw / 2, ty + th / 2);\n tagText.rotation = 0;\n tagText.scale.set(1, 1);\n } else {\n tagBg.visible = false;\n tagText.visible = false;\n }\n\n // Handles visibility\n handles.visible = (hovered || selected) && !(isAnchor && options?.presentation);\n if (handles.visible) {\n const defs = getHandlePositions(node.width, node.height);\n nc.handleDefs = defs;\n updateHandleGraphics(handles, defs);\n }\n }\n\n /**\n * Draw an SVG-stamp node: optional bordered box + centered icon sprite.\n * The icon texture is rasterized lazily; a redraw is requested when ready.\n */\n private _updateSvgNode(nc: NodeContainer, node: FlowNode, selected: boolean): void {\n const { shape, icon } = nc;\n const { width, height, data } = node;\n\n // Render the configured icon box independently from the solid selection\n // outline. Otherwise selecting an icon makes dotted/dashed borders appear\n // solid and hides whether the chosen border style is actually applied.\n const showBox = data.iconBox ?? false;\n const borderStyle = data.borderStyle ?? (showBox ? 'solid' : 'none');\n const borderHidden = borderStyle === 'none';\n const r = Math.min(8, width * 0.12, height * 0.12);\n if (data.fill && data.fill !== 'transparent' && (showBox || !borderHidden)) {\n shape.roundRect(0, 0, width, height, r).fill({ color: resolveThemeColor(data.fill, '#ffffff') });\n }\n if (!borderHidden && data.stroke && data.stroke !== 'transparent' && data.strokeWidth > 0) {\n drawRoundRectBorder(shape, {\n width,\n height,\n fill: 'transparent',\n stroke: resolveThemeColor(data.stroke, '#374151'),\n strokeWidth: data.strokeWidth,\n borderStyle,\n dashOffset: this._dynamicOffset,\n }, r);\n }\n if (selected) {\n shape.roundRect(0, 0, width, height, r).stroke({\n color: '#3b82f6',\n width: Math.max(data.strokeWidth, 2),\n });\n }\n\n // Icon sprite: fit within the box with padding, centered. The texture is\n // rasterized lazily; because the ticker re-runs sync every frame, it will\n // be picked up automatically once cached.\n const iconColor = resolveThemeColor(data.color, '#334155') || '#334155';\n const tex = getIconTexture(data.svgId ?? '', iconColor);\n if (tex) {\n icon.texture = tex;\n icon.visible = true;\n const pad = showBox ? Math.min(width, height) * 0.18 : 2;\n const box = Math.max(4, Math.min(width, height) - pad * 2);\n icon.width = box;\n icon.height = box;\n icon.position.set(width / 2, height / 2);\n } else {\n icon.visible = false;\n }\n }\n\n destroy(): void {\n this._unsubscribeTextureReady();\n this._resync = null;\n for (const [, nc] of this.nodes) {\n nc.container.destroy({ children: true });\n }\n this.nodes.clear();\n this.nodeLayer.destroy({ children: true });\n }\n}\n"],"mappings":";;;;;;;;AAeA,SAAS,GACP,GACA,GACA,GACA,GACA,GAC0B;AAE1B,QAAM,IAAO,IAAQ,IAAS,GACxB,IAAQ,IAAQ,IAAQ,IAAS,GACjC,IAAK,IAAQ,GACb,IAAM,IAAQ,IAAS,GACvB,IAAS,IAAQ,IAAQ,IAAS,GAClC,IAAK,IAAQ;AACnB,UAAQ,GAAR;AAAA,IACE,KAAK;AAAO,aAAO;AAAA,QAAE,GAAG;AAAA,QAAI,GAAG;AAAA,MAAI;AAAA,IACnC,KAAK;AAAU,aAAO;AAAA,QAAE,GAAG;AAAA,QAAI,GAAG;AAAA,MAAO;AAAA,IACzC,KAAK;AAAQ,aAAO;AAAA,QAAE,GAAG;AAAA,QAAM,GAAG;AAAA,MAAG;AAAA,IACrC,KAAK;AAAS,aAAO;AAAA,QAAE,GAAG;AAAA,QAAO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,UAAU;AACf,eAAW,CAAA,EAAG,CAAA,KAAO,KAAK,MACxB,CAAA,EAAG,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;AAEzC,SAAK,MAAM,MAAM,GACjB,KAAK,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;AAAA,EAC3C;AACF"}
1
+ {"version":3,"file":"NodeRenderer.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/NodeRenderer.ts"],"sourcesContent":["import { Container, Graphics, Text, Sprite, TextStyle } from 'pixi.js';\nimport type { FlowNode, FlowTextPlacement } from '../types';\nimport { drawRoundRectBorder, shapeDrawers, hasBorderSideOverrides, drawBorderSides, type ShapeDrawOptions } from './shapes';\nimport { createNodeText, formatIconLabel, normalizeIconLabelPlacement, updateNodeText } from './NodeText';\nimport { getHandlePositions, createHandleGraphics, updateHandleGraphics, type HandleDef } from './NodeHandles';\nimport { getRotationRad, getFlipScale } from './nodeUtils';\nimport { getIconTexture, subscribeIconTextureReady, ICON_TEXTURE_SIZE } from './svgIconTexture';\nimport { getSvgIcon } from './svgIcons';\nimport { resolveThemeColor } from '../utils/themeColor';\n\n/**\n * Resolve the center point of a text block (title + optional sublabel) inside a\n * node of the given size, for a 9-way placement. Non-center placements pull the\n * block against the corresponding edge/corner with a small inset.\n */\nfunction resolveTextBlockCenter(\n placement: FlowTextPlacement,\n nodeW: number,\n nodeH: number,\n blockW: number,\n blockH: number,\n): { x: number; y: number } {\n const inset = 6;\n const left = inset + blockW / 2;\n const right = nodeW - inset - blockW / 2;\n const cx = nodeW / 2;\n const top = inset + blockH / 2;\n const bottom = nodeH - inset - blockH / 2;\n const cy = nodeH / 2;\n switch (placement) {\n case 'top': return { x: cx, y: top };\n case 'bottom': return { x: cx, y: bottom };\n case 'left': return { x: left, y: cy };\n case 'right': return { x: right, y: cy };\n case 'top-left': return { x: left, y: top };\n case 'top-right': return { x: right, y: top };\n case 'bottom-left': return { x: left, y: bottom };\n case 'bottom-right': return { x: right, y: bottom };\n case 'center':\n default:\n return { x: cx, y: cy };\n }\n}\n\nexport interface NodeContainer {\n container: Container;\n shape: Graphics;\n /** Rotated/flipped visual content for SVG icon stamps. */\n svgTransform: Container;\n icon: Sprite;\n text: Text;\n /** Optional registry glyph rendered beside the title text (left/right). */\n titleIcon: Sprite;\n /** Optional muted second line (Archify card sublabel). */\n subtext: Text;\n /** Optional top-right pill background + label (Archify card tag). */\n tagBg: Graphics;\n tagText: Text;\n /** Sequence badge shown on `animAnchor` nodes. */\n animBadge: Text;\n handles: Graphics;\n handleDefs: HandleDef[];\n nodeId: string;\n subCanvasGlow: Graphics;\n}\n\n/**\n * Manages PixiJS display objects for all nodes on the current canvas.\n * Syncs from FlowNode[] data → PixiJS scene graph.\n */\nexport class NodeRenderer {\n private world: Container;\n private nodeLayer: Container;\n private nodes = new Map<string, NodeContainer>();\n private _dynamicOffset = 0;\n private _unsubscribeTextureReady: () => void;\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.nodeLayer = new Container({ label: 'nodes', sortableChildren: true });\n this.world.addChild(this.nodeLayer);\n this._unsubscribeTextureReady = subscribeIconTextureReady(() => this._resync?.());\n }\n\n private _resync: (() => void) | null = null;\n\n /**\n * Reconcile PixiJS containers with the current node data.\n * Creates new containers, updates existing, removes stale.\n */\n sync(\n flowNodes: FlowNode[],\n selectedIds: Set<string>,\n hoveredId: string | null,\n animSeqMap?: Map<string, number>,\n options?: {\n showAnchors?: boolean;\n presentation?: boolean;\n presentationAnchorId?: string;\n presentationAnchorVisible?: boolean;\n },\n ): void {\n const seen = new Set<string>();\n this._resync = () => this.sync(flowNodes, selectedIds, hoveredId, animSeqMap, options);\n\n // Animation-anchor display sequence (1-based). When a global map is\n // provided (document-wide, shared across sub-canvases) it is used directly;\n // otherwise derive a per-canvas order from stable creation index.\n const seqOf = animSeqMap ?? (() => {\n const anchors = flowNodes\n .filter((n) => n.type === 'animAnchor')\n .sort((a, b) => (a.data.animIndex ?? 0) - (b.data.animIndex ?? 0));\n const m = new Map<string, number>();\n anchors.forEach((n, i) => m.set(n.id, i + 1));\n return m;\n })();\n\n for (const node of flowNodes) {\n seen.add(node.id);\n let nc = this.nodes.get(node.id);\n if (!nc) {\n nc = this._createNode(node);\n this.nodes.set(node.id, nc);\n }\n this._updateNode(\n nc,\n node,\n selectedIds.has(node.id),\n hoveredId === node.id,\n seqOf.get(node.id),\n options,\n );\n }\n\n // Remove nodes no longer in data\n for (const [id, nc] of this.nodes) {\n if (!seen.has(id)) {\n this.nodeLayer.removeChild(nc.container);\n nc.container.destroy({ children: true });\n this.nodes.delete(id);\n }\n }\n }\n\n getNodeContainer(id: string): NodeContainer | undefined {\n return this.nodes.get(id);\n }\n\n getAllNodeContainers(): NodeContainer[] {\n return [...this.nodes.values()];\n }\n\n private _createNode(node: FlowNode): NodeContainer {\n const container = new Container({ label: `node-${node.id}` });\n container.eventMode = 'static';\n container.cursor = 'pointer';\n\n const svgTransform = new Container({ label: 'svg-transform' });\n container.addChild(svgTransform);\n\n const subCanvasGlow = new Graphics();\n subCanvasGlow.label = 'sub-canvas-glow';\n container.addChild(subCanvasGlow);\n\n const shape = new Graphics();\n shape.label = 'shape';\n container.addChild(shape);\n\n const icon = new Sprite();\n icon.label = 'svg-icon';\n icon.anchor.set(0.5, 0.5);\n icon.visible = false;\n container.addChild(icon);\n\n const text = createNodeText({\n label: node.data.label,\n color: resolveThemeColor(node.data.labelColor ?? node.data.color, '#111827'),\n fontSize: node.data.fontSize,\n width: node.width,\n height: node.height,\n });\n container.addChild(text);\n\n // Optional glyph beside the title (lazy-rasterized registry texture).\n const titleIcon = new Sprite();\n titleIcon.label = 'node-title-icon';\n titleIcon.anchor.set(0.5, 0.5);\n titleIcon.visible = false;\n container.addChild(titleIcon);\n\n // Optional muted second line (Archify card sublabel).\n const subtext = new Text({\n text: '',\n style: {\n fontFamily: 'system-ui, -apple-system, sans-serif',\n fontSize: 11,\n fill: '#94a3b8',\n align: 'center',\n },\n });\n subtext.label = 'node-subtext';\n subtext.anchor.set(0.5, 0.5);\n subtext.visible = false;\n container.addChild(subtext);\n\n // Optional top-right pill (Archify card tag).\n const tagBg = new Graphics();\n tagBg.label = 'node-tag-bg';\n tagBg.visible = false;\n container.addChild(tagBg);\n const tagText = new Text({\n text: '',\n style: {\n fontFamily: 'system-ui, -apple-system, sans-serif',\n fontSize: 9,\n fill: '#cbd5e1',\n },\n });\n tagText.label = 'node-tag-text';\n tagText.anchor.set(0.5, 0.5);\n tagText.visible = false;\n container.addChild(tagText);\n\n const handleDefs = getHandlePositions(node.width, node.height);\n const handles = createHandleGraphics(container, handleDefs, false);\n\n // Sequence badge for animation anchors (top-left corner).\n const animBadge = new Text({\n text: '',\n style: { fontFamily: 'system-ui, sans-serif', fontSize: 13, fill: '#ffffff', fontWeight: '700' },\n });\n animBadge.label = 'anim-badge';\n animBadge.anchor.set(0.5, 0.5);\n animBadge.visible = false;\n container.addChild(animBadge);\n\n this.nodeLayer.addChild(container);\n\n return { container, shape, svgTransform, icon, text, titleIcon, subtext, tagBg, tagText, animBadge, handles, handleDefs, nodeId: node.id, subCanvasGlow };\n }\n\n private _updateNode(\n nc: NodeContainer,\n node: FlowNode,\n selected: boolean,\n hovered: boolean,\n animSeq?: number,\n options?: {\n showAnchors?: boolean;\n presentation?: boolean;\n presentationAnchorId?: string;\n presentationAnchorVisible?: boolean;\n },\n ): void {\n const { container, svgTransform, shape, icon, text, titleIcon, subtext, tagBg, tagText, animBadge, handles, subCanvasGlow } = nc;\n\n const isSvg = node.type === 'shapeSvg';\n const rad = getRotationRad(node.data);\n const flip = getFlipScale(node.data);\n\n container.zIndex = node.zIndex ?? 0;\n if (isSvg) {\n // Keep the label in the untransformed root. Only the icon box, icon and\n // connection handles rotate/flip around the node center.\n if (shape.parent !== svgTransform) svgTransform.addChild(shape);\n if (icon.parent !== svgTransform) svgTransform.addChild(icon);\n if (handles.parent !== svgTransform) svgTransform.addChild(handles);\n container.position.set(node.position.x, node.position.y);\n container.rotation = 0;\n container.scale.set(1, 1);\n container.pivot.set(0, 0);\n svgTransform.position.set(node.width / 2, node.height / 2);\n svgTransform.pivot.set(node.width / 2, node.height / 2);\n svgTransform.rotation = rad;\n svgTransform.scale.set(flip.sx, flip.sy);\n } else {\n if (shape.parent !== container) container.addChildAt(shape, Math.min(2, container.children.length));\n if (icon.parent !== container) container.addChild(icon);\n if (handles.parent !== container) container.addChild(handles);\n svgTransform.rotation = 0;\n svgTransform.scale.set(1, 1);\n container.position.set(node.position.x, node.position.y);\n container.rotation = rad;\n container.scale.set(flip.sx, flip.sy);\n if (rad !== 0 || flip.sx < 0 || flip.sy < 0) {\n container.pivot.set(node.width / 2, node.height / 2);\n container.position.set(node.position.x + node.width / 2, node.position.y + node.height / 2);\n } else {\n container.pivot.set(0, 0);\n }\n }\n\n const isMedia = node.type === 'mediaNode';\n const isAnchor = node.type === 'animAnchor';\n // Anchors only show their label/badge when the anchor itself is visible.\n let anchorVisible = true;\n\n // Redraw shape\n shape.clear();\n shape.alpha = 1;\n if (isSvg) {\n this._updateSvgNode(nc, node, selected);\n } else if (isMedia) {\n // Media nodes render their content in a synced DOM overlay; PixiJS only\n // draws the frame (background + border) beneath the overlay.\n icon.visible = false;\n const r = 6;\n const fill = node.data.fill && node.data.fill !== 'transparent' ? resolveThemeColor(node.data.fill, '#ffffff') : '#ffffff';\n const borderHidden = node.data.borderStyle === 'none';\n const perSideBorders = hasBorderSideOverrides(node.data, node.type);\n const strokeColor = selected ? '#3b82f6' : resolveThemeColor(node.data.stroke, '#374151');\n const strokeW = selected ? Math.max(node.data.strokeWidth, 2) : node.data.strokeWidth;\n shapeDrawers.shapeRoundRect(shape, {\n width: node.width,\n height: node.height,\n fill,\n stroke: perSideBorders ? 'transparent' : strokeColor,\n strokeWidth: strokeW,\n borderStyle: selected && borderHidden ? 'solid' : node.data.borderStyle,\n dashOffset: this._dynamicOffset,\n });\n if (perSideBorders) {\n // Independent sides replace the full outline; the selection ring is\n // drawn separately so selection stays visible.\n const stroke = resolveThemeColor(node.data.stroke, '#374151');\n if (selected) {\n shape.roundRect(0, 0, node.width, node.height, r).stroke({ color: '#3b82f6', width: Math.max(node.data.strokeWidth, 2) });\n }\n drawBorderSides(shape, 'mediaNode', node.width, node.height, node.data.borderSides, stroke, node.data.strokeWidth, borderHidden ? undefined : node.data.borderStyle, this._dynamicOffset);\n }\n } else if (isAnchor) {\n // Animation anchors are globally visible/hidden in editing mode. During\n // presentation the current frame remains as a subtle dashed overlay.\n icon.visible = false;\n const accent = '#8b5cf6';\n const presentation = options?.presentation ?? false;\n anchorVisible = presentation\n ? (options?.presentationAnchorVisible ?? false) && options?.presentationAnchorId === node.id\n : (options?.showAnchors ?? true);\n if (anchorVisible) {\n shape.alpha = presentation ? 0.48 : 0.9;\n shapeDrawers.shapeRoundRect(shape, {\n width: node.width,\n height: node.height,\n fill: 'transparent',\n stroke: selected && !presentation ? '#3b82f6' : accent,\n strokeWidth: selected && !presentation ? 2.5 : 1.5,\n borderStyle: 'dashed',\n });\n shape.circle(0, 0, presentation ? 11 : 13).fill({\n color: selected && !presentation ? '#3b82f6' : accent,\n });\n }\n animBadge.text = String(animSeq ?? '');\n animBadge.alpha = presentation ? 0.7 : 1;\n animBadge.visible = anchorVisible;\n animBadge.position.set(0, 0);\n } else {\n icon.visible = false;\n const drawFn = shapeDrawers[node.type] ?? shapeDrawers.shapeRect;\n // Independent per-side borders (top/right/bottom/left) replace the full\n // outline for shapes with four well-defined sides; the drawer then only\n // fills and the sides are stroked separately below.\n const perSideBorders = hasBorderSideOverrides(node.data, node.type);\n const borderHidden = node.data.borderStyle === 'none';\n const baseStroke = resolveThemeColor(node.data.stroke, '#374151');\n const opts: ShapeDrawOptions = {\n width: node.width,\n height: node.height,\n fill: resolveThemeColor(node.data.fill, '#ffffff'),\n stroke: perSideBorders ? 'transparent' : (selected ? '#3b82f6' : baseStroke),\n strokeWidth: selected ? Math.max(node.data.strokeWidth, 2) : node.data.strokeWidth,\n borderStyle: (selected && borderHidden) ? 'solid' : node.data.borderStyle,\n dashOffset: this._dynamicOffset,\n };\n drawFn(shape, opts);\n if (perSideBorders) {\n if (selected) {\n const r = node.type === 'shapeRect' ? 0 : Math.min(12, node.width * 0.1, node.height * 0.1);\n shape.roundRect(0, 0, node.width, node.height, r).stroke({ color: '#3b82f6', width: Math.max(node.data.strokeWidth, 2) });\n }\n const style = (selected && borderHidden) ? 'solid' : node.data.borderStyle;\n drawBorderSides(shape, node.type, node.width, node.height, node.data.borderSides, baseStroke, node.data.strokeWidth, style, this._dynamicOffset);\n }\n }\n if (!isAnchor) animBadge.visible = false;\n\n // Sub-canvas glow indicator\n subCanvasGlow.clear();\n if (node.data.childCanvasId) {\n const pad = 4;\n const w = node.width + pad * 2;\n const h = node.height + pad * 2;\n const pulse = 0.5 + 0.3 * Math.sin(this._dynamicOffset * 0.008);\n subCanvasGlow.roundRect(-pad, -pad, w, h, 6);\n subCanvasGlow.stroke({ color: 0x8b5cf6, width: 2.5, alpha: pulse });\n subCanvasGlow.roundRect(-pad - 2, -pad - 2, w + 4, h + 4, 8);\n subCanvasGlow.stroke({ color: 0x8b5cf6, width: 1, alpha: pulse * 0.4 });\n }\n\n // Text: counter-rotate and counter-flip so it stays upright\n const iconLabelPlacement = normalizeIconLabelPlacement(node.data.labelPlacement);\n // SVG-icon labels default to the theme font color (so they read on any\n // theme) even when the icon body uses a brand color; other node types fall\n // back to the node's own text color.\n const labelColor = node.data.labelColor\n ?? (isSvg ? 'theme:base-content' : node.data.color);\n updateNodeText(text, {\n label: isMedia\n ? ''\n : isSvg\n ? formatIconLabel(node.data.label, iconLabelPlacement)\n : node.data.label,\n color: resolveThemeColor(labelColor, '#111827'),\n fontSize: node.data.fontSize,\n width: node.width,\n height: node.height,\n });\n text.visible = !isMedia && (!isAnchor || anchorVisible);\n\n // Card extras: muted sublabel line + tag pill. Available on ordinary\n // shapes, group frames, and (when shown) animation anchors.\n const showExtras = !isSvg && !isMedia && (!isAnchor || anchorVisible);\n const sublabel = showExtras ? (node.data.sublabel ?? '').trim() : '';\n const hasSub = sublabel.length > 0;\n\n // Title icon: optional registry glyph beside the title text. Ordinary\n // shapes, group frames and (visible) anchors only — SVG stamps already are\n // an icon, and media nodes render their own overlay.\n const titleIconId = showExtras ? (node.data.titleIcon ?? '').trim() : '';\n const titleIconGap = 6;\n const titleIconSize = Math.max(8, node.data.titleIconSize ?? Math.round(node.data.fontSize * 1.15));\n const titleIconScale = titleIconSize / ICON_TEXTURE_SIZE;\n const hasTitleIcon = titleIconId.length > 0;\n if (hasTitleIcon) {\n // Default tint keeps each icon's own identity: brand icons (languages /\n // frameworks) use their authentic brandColor, everything else follows the\n // title color (a theme token, so it tracks theme switches). An explicit\n // `titleIconColor` always wins.\n const fallbackTint = getSvgIcon(titleIconId)?.brandColor ?? labelColor;\n const tint = resolveThemeColor(node.data.titleIconColor ?? fallbackTint, '#111827') || '#111827';\n const tex = getIconTexture(titleIconId, tint);\n if (tex) {\n titleIcon.texture = tex;\n titleIcon.visible = true;\n } else {\n titleIcon.visible = false;\n }\n } else {\n titleIcon.visible = false;\n }\n\n if (node.type === 'shapeCorner') {\n titleIcon.visible = false;\n const half = Math.min(node.width, node.height) * 0.4;\n text.position.set((half + node.width) / 2, (half + node.height) / 2);\n } else if (isSvg) {\n const gap = 4;\n const halfTextWidth = text.width / 2;\n const halfTextHeight = text.height / 2;\n if (iconLabelPlacement === 'top') {\n text.position.set(node.width / 2, -gap - halfTextHeight);\n } else if (iconLabelPlacement === 'bottom') {\n text.position.set(node.width / 2, node.height + gap + halfTextHeight);\n } else if (iconLabelPlacement === 'left') {\n text.position.set(-gap - halfTextWidth, node.height / 2);\n } else if (iconLabelPlacement === 'right') {\n text.position.set(node.width + gap + halfTextWidth, node.height / 2);\n } else {\n text.position.set(node.width / 2, node.height / 2);\n }\n text.position.x += node.data.labelOffsetX ?? 0;\n text.position.y += node.data.labelOffsetY ?? 0;\n } else if (!isMedia) {\n // Ordinary shapes, group frames, and anchors: 9-way text placement, with\n // an optional sublabel line stacked beneath the title. Both lines stay\n // center-anchored; only the block's center point moves per placement.\n const gap = 3;\n const subFont = Math.max(9, node.data.fontSize - 3);\n if (hasSub) {\n const s = subtext.style as TextStyle;\n s.fill = resolveThemeColor(node.data.sublabelColor ?? '#94a3b8', '#94a3b8');\n s.fontSize = subFont;\n subtext.text = sublabel;\n subtext.anchor.set(0.5, 0.5);\n subtext.visible = true;\n subtext.rotation = -rad;\n subtext.scale.set(flip.sx, flip.sy);\n }\n text.anchor.set(0.5, 0.5);\n // Title + optional icon form a horizontally centered group; a sublabel\n // (when present) stays centered under the whole block.\n const iconInBlock = titleIcon.visible;\n const titleGroupW = text.width + (iconInBlock ? titleIconSize + titleIconGap : 0);\n const blockH = Math.max(text.height, iconInBlock ? titleIconSize : 0) + (hasSub ? gap + subtext.height : 0);\n const blockW = Math.max(titleGroupW, hasSub ? subtext.width : 0);\n // Anchors and group frames default their text to the top band; ordinary\n // shapes default to centered.\n const isGroupFrame = node.data.isGroup || node.type === 'flowGroup' || node.type === 'geometryGroup';\n const placement = node.data.textPlacement ?? (isAnchor || isGroupFrame ? 'top' : 'center');\n const c = resolveTextBlockCenter(\n placement,\n node.width,\n node.height,\n blockW,\n blockH,\n );\n const bx = c.x + (node.data.labelOffsetX ?? 0);\n const by = c.y + (node.data.labelOffsetY ?? 0);\n const titleCy = by - blockH / 2 + text.height / 2;\n if (iconInBlock) {\n const groupLeft = bx - titleGroupW / 2;\n if ((node.data.titleIconSide ?? 'left') === 'right') {\n text.position.set(groupLeft + text.width / 2, titleCy);\n titleIcon.position.set(groupLeft + text.width + titleIconGap + titleIconSize / 2, titleCy);\n } else {\n titleIcon.position.set(groupLeft + titleIconSize / 2, titleCy);\n text.position.set(groupLeft + titleIconSize + titleIconGap + text.width / 2, titleCy);\n }\n } else {\n text.position.set(bx, titleCy);\n }\n if (hasSub) subtext.position.set(bx, by + blockH / 2 - subtext.height / 2);\n }\n if (!hasSub) subtext.visible = false;\n\n if (isSvg) {\n text.rotation = 0;\n text.scale.set(1, 1);\n } else {\n text.rotation = -rad;\n text.scale.set(flip.sx, flip.sy);\n // Keep the glyph upright and mirrored with the title, like the text.\n // Scale (not width/height — those are scale setters in disguise and the\n // write here would clobber them) is derived from the texture's natural\n // raster size so `titleIconSize` stays authoritative.\n titleIcon.rotation = -rad;\n titleIcon.scale.set(titleIconScale * flip.sx, titleIconScale * flip.sy);\n }\n\n // Tag pill: placed in one of four corners with its own color.\n const tag = showExtras ? (node.data.tag ?? '').trim() : '';\n if (tag) {\n tagText.text = tag;\n tagText.visible = true;\n const padX = 5;\n const padY = 2;\n const tw = tagText.width + padX * 2;\n const th = tagText.height + padY * 2;\n const margin = 6;\n const placement = node.data.tagPlacement ?? 'top-right';\n const tx = placement === 'top-left' || placement === 'bottom-left'\n ? margin\n : node.width - tw - margin;\n const ty = placement === 'top-left' || placement === 'top-right'\n ? margin\n : node.height - th - margin;\n const tagColor = resolveThemeColor(node.data.tagColor ?? node.data.stroke, '#334155');\n tagBg.clear();\n tagBg\n .roundRect(tx, ty, tw, th, 3)\n .fill({ color: tagColor, alpha: 0.18 })\n .stroke({ color: tagColor, width: 1, alpha: 0.55 });\n tagBg.visible = true;\n (tagText.style as TextStyle).fill = tagColor;\n tagText.position.set(tx + tw / 2, ty + th / 2);\n tagText.rotation = 0;\n tagText.scale.set(1, 1);\n } else {\n tagBg.visible = false;\n tagText.visible = false;\n }\n\n // Handles visibility\n handles.visible = (hovered || selected) && !(isAnchor && options?.presentation);\n if (handles.visible) {\n const defs = getHandlePositions(node.width, node.height);\n nc.handleDefs = defs;\n updateHandleGraphics(handles, defs);\n }\n }\n\n /**\n * Draw an SVG-stamp node: optional bordered box + centered icon sprite.\n * The icon texture is rasterized lazily; a redraw is requested when ready.\n */\n private _updateSvgNode(nc: NodeContainer, node: FlowNode, selected: boolean): void {\n const { shape, icon } = nc;\n const { width, height, data } = node;\n\n // Render the configured icon box independently from the solid selection\n // outline. Otherwise selecting an icon makes dotted/dashed borders appear\n // solid and hides whether the chosen border style is actually applied.\n const showBox = data.iconBox ?? false;\n const borderStyle = data.borderStyle ?? (showBox ? 'solid' : 'none');\n const borderHidden = borderStyle === 'none';\n const r = Math.min(8, width * 0.12, height * 0.12);\n if (data.fill && data.fill !== 'transparent' && (showBox || !borderHidden)) {\n shape.roundRect(0, 0, width, height, r).fill({ color: resolveThemeColor(data.fill, '#ffffff') });\n }\n if (!borderHidden && data.stroke && data.stroke !== 'transparent' && data.strokeWidth > 0) {\n drawRoundRectBorder(shape, {\n width,\n height,\n fill: 'transparent',\n stroke: resolveThemeColor(data.stroke, '#374151'),\n strokeWidth: data.strokeWidth,\n borderStyle,\n dashOffset: this._dynamicOffset,\n }, r);\n }\n if (selected) {\n shape.roundRect(0, 0, width, height, r).stroke({\n color: '#3b82f6',\n width: Math.max(data.strokeWidth, 2),\n });\n }\n\n // Icon sprite: fit within the box with padding, centered. The texture is\n // rasterized lazily; because the ticker re-runs sync every frame, it will\n // be picked up automatically once cached.\n const iconColor = resolveThemeColor(data.color, '#334155') || '#334155';\n const tex = getIconTexture(data.svgId ?? '', iconColor);\n if (tex) {\n icon.texture = tex;\n icon.visible = true;\n const pad = showBox ? Math.min(width, height) * 0.18 : 2;\n const box = Math.max(4, Math.min(width, height) - pad * 2);\n icon.width = box;\n icon.height = box;\n icon.position.set(width / 2, height / 2);\n } else {\n icon.visible = false;\n }\n }\n\n destroy(): void {\n this._unsubscribeTextureReady();\n this._resync = null;\n for (const [, nc] of this.nodes) {\n nc.container.destroy({ children: true });\n }\n this.nodes.clear();\n this.nodeLayer.destroy({ children: true });\n }\n}\n"],"mappings":";;;;;;;;;AAeA,SAAS,EACP,GACA,GACA,GACA,GACA,GAC0B;CAC1B,IACM,IAAO,IAAQ,IAAS,GACxB,IAAQ,IAAQ,IAAQ,IAAS,GACjC,IAAK,IAAQ,GACb,IAA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AAM,IAAI,IAAM,CAAC;GAGzD,AAFA,EAAK,QAAQ,GACb,EAAK,SAAS,GACd,EAAK,SAAS,IAAI,IAAQ,GAAG,IAAS,CAAC;EACzC,OACE,EAAK,UAAU;CAEnB;CAEA,UAAgB;EAEd,AADA,KAAK,yBAAyB,GAC9B,KAAK,UAAU;EACf,KAAK,IAAM,GAAG,MAAO,KAAK,OACxB,EAAG,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;EAGzC,AADA,KAAK,MAAM,MAAM,GACjB,KAAK,UAAU,QAAQ,EAAE,UAAU,GAAK,CAAC;CAC3C;AACF"}
@@ -1,35 +1,31 @@
1
- import { Text as r, TextStyle as i } from "pixi.js";
2
- function f(t) {
3
- const e = new i({
4
- fontFamily: t.fontFamily ?? "system-ui, -apple-system, sans-serif",
5
- fontSize: t.fontSize,
6
- fill: t.color,
7
- align: "center",
8
- wordWrap: !0,
9
- wordWrapWidth: t.width - 16
10
- }), n = new r({
11
- text: t.label,
12
- style: e
13
- });
14
- return n.anchor.set(0.5, 0.5), n.position.set(t.width / 2, t.height / 2), n.label = "node-text", n;
1
+ import { Text as e, TextStyle as t } from "pixi.js";
2
+ //#region src/components/pro/Flow/nodes/NodeText.ts
3
+ function n(n) {
4
+ let r = new t({
5
+ fontFamily: n.fontFamily ?? "system-ui, -apple-system, sans-serif",
6
+ fontSize: n.fontSize,
7
+ fill: n.color,
8
+ align: "center",
9
+ wordWrap: !0,
10
+ wordWrapWidth: n.width - 16
11
+ }), i = new e({
12
+ text: n.label,
13
+ style: r
14
+ });
15
+ return i.anchor.set(.5, .5), i.position.set(n.width / 2, n.height / 2), i.label = "node-text", i;
15
16
  }
16
- function d(t) {
17
- return t === "above" ? "top" : t === "center" ? "middle" : t === "below" ? "bottom" : t === "top" || t === "middle" || t === "bottom" || t === "left" || t === "right" ? t : "bottom";
17
+ function r(e) {
18
+ return e === "above" ? "top" : e === "center" ? "middle" : e === "below" ? "bottom" : e === "top" || e === "middle" || e === "bottom" || e === "left" || e === "right" ? e : "bottom";
18
19
  }
19
- function m(t, e) {
20
- return e !== "left" && e !== "right" ? t : (typeof Intl < "u" && "Segmenter" in Intl ? Array.from(new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(t), (n) => n.segment) : Array.from(t)).join(`
21
- `);
20
+ function i(e, t) {
21
+ return t !== "left" && t !== "right" ? e : (typeof Intl < "u" && "Segmenter" in Intl ? Array.from(new Intl.Segmenter(void 0, { granularity: "grapheme" }).segment(e), (e) => e.segment) : Array.from(e)).join("\n");
22
22
  }
23
- function l(t, e) {
24
- t.text = e.label;
25
- const n = t.style;
26
- n.fontSize = e.fontSize, n.fill = e.color, n.wordWrapWidth = e.width - 16, t.position.set(e.width / 2, e.height / 2);
23
+ function a(e, t) {
24
+ e.text = t.label;
25
+ let n = e.style;
26
+ n.fontSize = t.fontSize, n.fill = t.color, n.wordWrapWidth = t.width - 16, e.position.set(t.width / 2, t.height / 2);
27
27
  }
28
- export {
29
- f as createNodeText,
30
- m as formatIconLabel,
31
- d as normalizeIconLabelPlacement,
32
- l as updateNodeText
33
- };
28
+ //#endregion
29
+ export { n as createNodeText, i as formatIconLabel, r as normalizeIconLabelPlacement, a as updateNodeText };
34
30
 
35
31
  //# sourceMappingURL=NodeText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeText.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/NodeText.ts"],"sourcesContent":["import { Text, TextStyle, Container } from 'pixi.js';\nimport type { FlowIconLabelPlacement } from '../types';\n\nexport interface NodeTextOptions {\n label: string;\n color: string;\n fontSize: number;\n width: number;\n height: number;\n fontFamily?: string;\n}\n\n/**\n * Creates or updates a PixiJS Text object for a node label,\n * centered within the node bounds.\n */\nexport function createNodeText(opts: NodeTextOptions): Text {\n const style = new TextStyle({\n fontFamily: opts.fontFamily ?? 'system-ui, -apple-system, sans-serif',\n fontSize: opts.fontSize,\n fill: opts.color,\n align: 'center',\n wordWrap: true,\n wordWrapWidth: opts.width - 16,\n });\n\n const text = new Text({ text: opts.label, style });\n text.anchor.set(0.5, 0.5);\n text.position.set(opts.width / 2, opts.height / 2);\n text.label = 'node-text';\n return text;\n}\n\nexport function normalizeIconLabelPlacement(value: unknown): FlowIconLabelPlacement {\n if (value === 'above') return 'top';\n if (value === 'center') return 'middle';\n if (value === 'below') return 'bottom';\n return value === 'top' || value === 'middle' || value === 'bottom' || value === 'left' || value === 'right'\n ? value\n : 'bottom';\n}\n\nexport function formatIconLabel(label: string, placement: FlowIconLabelPlacement): string {\n if (placement !== 'left' && placement !== 'right') return label;\n const segments = typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? Array.from(new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(label), item => item.segment)\n : Array.from(label);\n return segments.join('\\n');\n}\n\nexport function updateNodeText(text: Text, opts: NodeTextOptions): void {\n text.text = opts.label;\n const s = text.style as TextStyle;\n s.fontSize = opts.fontSize;\n s.fill = opts.color;\n s.wordWrapWidth = opts.width - 16;\n text.position.set(opts.width / 2, opts.height / 2);\n}\n"],"mappings":";AAgBA,SAAgB,EAAe,GAA6B;AAC1D,QAAM,IAAQ,IAAI,EAAU;AAAA,IAC1B,YAAY,EAAK,cAAc;AAAA,IAC/B,UAAU,EAAK;AAAA,IACf,MAAM,EAAK;AAAA,IACX,OAAO;AAAA,IACP,UAAU;AAAA,IACV,eAAe,EAAK,QAAQ;AAAA,EAC9B,CAAC,GAEK,IAAO,IAAI,EAAK;AAAA,IAAE,MAAM,EAAK;AAAA,IAAO,OAAA;AAAA,EAAM,CAAC;AACjD,SAAA,EAAK,OAAO,IAAI,KAAK,GAAG,GACxB,EAAK,SAAS,IAAI,EAAK,QAAQ,GAAG,EAAK,SAAS,CAAC,GACjD,EAAK,QAAQ,aACN;AACT;AAEA,SAAgB,EAA4B,GAAwC;AAClF,SAAI,MAAU,UAAgB,QAC1B,MAAU,WAAiB,WAC3B,MAAU,UAAgB,WACvB,MAAU,SAAS,MAAU,YAAY,MAAU,YAAY,MAAU,UAAU,MAAU,UAChG,IACA;AACN;AAEA,SAAgB,EAAgB,GAAe,GAA2C;AACxF,SAAI,MAAc,UAAU,MAAc,UAAgB,KACzC,OAAO,OAAS,OAAe,eAAe,OAC3D,MAAM,KAAK,IAAI,KAAK,UAAU,QAAW,EAAE,aAAa,WAAW,CAAC,EAAE,QAAQ,CAAK,GAAA,CAAG,MAAQ,EAAK,OAAO,IAC1G,MAAM,KAAK,CAAK,GACJ,KAAK;AAAA,CAAI;AAC3B;AAEA,SAAgB,EAAe,GAAY,GAA6B;AACtE,EAAA,EAAK,OAAO,EAAK;AACjB,QAAM,IAAI,EAAK;AACf,EAAA,EAAE,WAAW,EAAK,UAClB,EAAE,OAAO,EAAK,OACd,EAAE,gBAAgB,EAAK,QAAQ,IAC/B,EAAK,SAAS,IAAI,EAAK,QAAQ,GAAG,EAAK,SAAS,CAAC;AACnD"}
1
+ {"version":3,"file":"NodeText.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/NodeText.ts"],"sourcesContent":["import { Text, TextStyle, Container } from 'pixi.js';\nimport type { FlowIconLabelPlacement } from '../types';\n\nexport interface NodeTextOptions {\n label: string;\n color: string;\n fontSize: number;\n width: number;\n height: number;\n fontFamily?: string;\n}\n\n/**\n * Creates or updates a PixiJS Text object for a node label,\n * centered within the node bounds.\n */\nexport function createNodeText(opts: NodeTextOptions): Text {\n const style = new TextStyle({\n fontFamily: opts.fontFamily ?? 'system-ui, -apple-system, sans-serif',\n fontSize: opts.fontSize,\n fill: opts.color,\n align: 'center',\n wordWrap: true,\n wordWrapWidth: opts.width - 16,\n });\n\n const text = new Text({ text: opts.label, style });\n text.anchor.set(0.5, 0.5);\n text.position.set(opts.width / 2, opts.height / 2);\n text.label = 'node-text';\n return text;\n}\n\nexport function normalizeIconLabelPlacement(value: unknown): FlowIconLabelPlacement {\n if (value === 'above') return 'top';\n if (value === 'center') return 'middle';\n if (value === 'below') return 'bottom';\n return value === 'top' || value === 'middle' || value === 'bottom' || value === 'left' || value === 'right'\n ? value\n : 'bottom';\n}\n\nexport function formatIconLabel(label: string, placement: FlowIconLabelPlacement): string {\n if (placement !== 'left' && placement !== 'right') return label;\n const segments = typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? Array.from(new Intl.Segmenter(undefined, { granularity: 'grapheme' }).segment(label), item => item.segment)\n : Array.from(label);\n return segments.join('\\n');\n}\n\nexport function updateNodeText(text: Text, opts: NodeTextOptions): void {\n text.text = opts.label;\n const s = text.style as TextStyle;\n s.fontSize = opts.fontSize;\n s.fill = opts.color;\n s.wordWrapWidth = opts.width - 16;\n text.position.set(opts.width / 2, opts.height / 2);\n}\n"],"mappings":";;AAgBA,SAAgB,EAAe,GAA6B;CAC1D,IAAM,IAAQ,IAAI,EAAU;EAC1B,YAAY,EAAK,cAAc;EAC/B,UAAU,EAAK;EACf,MAAM,EAAK;EACX,OAAO;EACP,UAAU;EACV,eAAe,EAAK,QAAQ;CAC9B,CAAC,GAEK,IAAO,IAAI,EAAK;EAAE,MAAM,EAAK;EAAO;CAAM,CAAC;CAIjD,OAHA,EAAK,OAAO,IAAI,IAAK,EAAG,GACxB,EAAK,SAAS,IAAI,EAAK,QAAQ,GAAG,EAAK,SAAS,CAAC,GACjD,EAAK,QAAQ,aACN;AACT;AAEA,SAAgB,EAA4B,GAAwC;CAIlF,OAHI,MAAU,UAAgB,QAC1B,MAAU,WAAiB,WAC3B,MAAU,UAAgB,WACvB,MAAU,SAAS,MAAU,YAAY,MAAU,YAAY,MAAU,UAAU,MAAU,UAChG,IACA;AACN;AAEA,SAAgB,EAAgB,GAAe,GAA2C;CAKxF,OAJI,MAAc,UAAU,MAAc,UAAgB,KACzC,OAAO,OAAS,OAAe,eAAe,OAC3D,MAAM,KAAK,IAAI,KAAK,UAAU,KAAA,GAAW,EAAE,aAAa,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAK,IAAG,MAAQ,EAAK,OAAO,IAC1G,MAAM,KAAK,CAAK,EAAA,CACJ,KAAK,IAAI;AAC3B;AAEA,SAAgB,EAAe,GAAY,GAA6B;CACtE,EAAK,OAAO,EAAK;CACjB,IAAM,IAAI,EAAK;CAIf,AAHA,EAAE,WAAW,EAAK,UAClB,EAAE,OAAO,EAAK,OACd,EAAE,gBAAgB,EAAK,QAAQ,IAC/B,EAAK,SAAS,IAAI,EAAK,QAAQ,GAAG,EAAK,SAAS,CAAC;AACnD"}
@@ -1,144 +1,131 @@
1
- function u(t) {
2
- const e = (t.gateway || "").trim().replace(/\/+$/, "");
3
- if (!e) return e;
4
- const r = t.protocol === "anthropic" ? "/messages" : "/chat/completions";
5
- if (/\/(chat\/completions|messages|responses|completions)$/i.test(e)) return e;
6
- if (/\/v\d+$/i.test(e)) return e + r;
7
- try {
8
- const n = new URL(e);
9
- if (n.pathname === "" || n.pathname === "/") return e + "/v1" + r;
10
- } catch {
11
- }
12
- return e + r;
1
+ //#region src/components/pro/Flow/nodes/aiClient.ts
2
+ function e(e) {
3
+ let t = (e.gateway || "").trim().replace(/\/+$/, "");
4
+ if (!t) return t;
5
+ let n = e.protocol === "anthropic" ? "/messages" : "/chat/completions";
6
+ if (/\/(chat\/completions|messages|responses|completions)$/i.test(t)) return t;
7
+ if (/\/v\d+$/i.test(t)) return t + n;
8
+ try {
9
+ let e = new URL(t);
10
+ if (e.pathname === "" || e.pathname === "/") return t + "/v1" + n;
11
+ } catch {}
12
+ return t + n;
13
13
  }
14
- async function* h(t, e, r) {
15
- const n = JSON.stringify({
16
- model: t.model,
17
- messages: [...t.systemPrompt ? [{
18
- role: "system",
19
- content: t.systemPrompt
20
- }] : [], ...e],
21
- stream: !0
22
- }), s = await fetch(u(t), {
23
- method: "POST",
24
- headers: {
25
- "Content-Type": "application/json",
26
- ...t.apiKey ? { Authorization: `Bearer ${t.apiKey}` } : {},
27
- ...t.headers
28
- },
29
- body: n,
30
- signal: r
31
- });
32
- if (!s.ok) throw new Error(`AI API error: ${s.status} ${s.statusText}`);
33
- const c = s.body?.getReader();
34
- if (!c) throw new Error("No response body");
35
- const i = new TextDecoder();
36
- let o = "";
37
- for (; ; ) {
38
- const { done: y, value: p } = await c.read();
39
- if (y) break;
40
- o += i.decode(p, { stream: !0 });
41
- const a = o.split(`
42
- `);
43
- o = a.pop() || "";
44
- for (const m of a) {
45
- const d = m.trim();
46
- if (!(!d || d === "data: [DONE]" || !d.startsWith("data: ")))
47
- try {
48
- const l = JSON.parse(d.slice(6)).choices?.[0]?.delta?.content;
49
- l && (yield l);
50
- } catch {
51
- }
52
- }
53
- }
14
+ async function* t(t, n, r) {
15
+ let i = JSON.stringify({
16
+ model: t.model,
17
+ messages: [...t.systemPrompt ? [{
18
+ role: "system",
19
+ content: t.systemPrompt
20
+ }] : [], ...n],
21
+ stream: !0
22
+ }), a = await fetch(e(t), {
23
+ method: "POST",
24
+ headers: {
25
+ "Content-Type": "application/json",
26
+ ...t.apiKey ? { Authorization: `Bearer ${t.apiKey}` } : {},
27
+ ...t.headers
28
+ },
29
+ body: i,
30
+ signal: r
31
+ });
32
+ if (!a.ok) throw Error(`AI API error: ${a.status} ${a.statusText}`);
33
+ let o = a.body?.getReader();
34
+ if (!o) throw Error("No response body");
35
+ let s = new TextDecoder(), c = "";
36
+ for (;;) {
37
+ let { done: e, value: t } = await o.read();
38
+ if (e) break;
39
+ c += s.decode(t, { stream: !0 });
40
+ let n = c.split("\n");
41
+ c = n.pop() || "";
42
+ for (let e of n) {
43
+ let t = e.trim();
44
+ if (t && t !== "data: [DONE]" && t.startsWith("data: ")) try {
45
+ let e = JSON.parse(t.slice(6)).choices?.[0]?.delta?.content;
46
+ e && (yield e);
47
+ } catch {}
48
+ }
49
+ }
54
50
  }
55
- async function* f(t, e, r) {
56
- const n = JSON.stringify({
57
- model: t.model,
58
- max_tokens: 8192,
59
- ...t.systemPrompt ? { system: t.systemPrompt } : {},
60
- messages: e,
61
- stream: !0
62
- }), s = await fetch(u(t), {
63
- method: "POST",
64
- headers: {
65
- "Content-Type": "application/json",
66
- ...t.apiKey ? { "x-api-key": t.apiKey } : {},
67
- "anthropic-version": "2023-06-01",
68
- "anthropic-dangerous-direct-browser-access": "true",
69
- ...t.headers
70
- },
71
- body: n,
72
- signal: r
73
- });
74
- if (!s.ok) throw new Error(`AI API error: ${s.status} ${s.statusText}`);
75
- const c = s.body?.getReader();
76
- if (!c) throw new Error("No response body");
77
- const i = new TextDecoder();
78
- let o = "";
79
- for (; ; ) {
80
- const { done: y, value: p } = await c.read();
81
- if (y) break;
82
- o += i.decode(p, { stream: !0 });
83
- const a = o.split(`
84
- `);
85
- o = a.pop() || "";
86
- for (const m of a) {
87
- const d = m.trim();
88
- if (d.startsWith("data: "))
89
- try {
90
- const l = JSON.parse(d.slice(6));
91
- l.type === "content_block_delta" && l.delta?.text && (yield l.delta.text);
92
- } catch {
93
- }
94
- }
95
- }
51
+ async function* n(t, n, r) {
52
+ let i = JSON.stringify({
53
+ model: t.model,
54
+ max_tokens: 8192,
55
+ ...t.systemPrompt ? { system: t.systemPrompt } : {},
56
+ messages: n,
57
+ stream: !0
58
+ }), a = await fetch(e(t), {
59
+ method: "POST",
60
+ headers: {
61
+ "Content-Type": "application/json",
62
+ ...t.apiKey ? { "x-api-key": t.apiKey } : {},
63
+ "anthropic-version": "2023-06-01",
64
+ "anthropic-dangerous-direct-browser-access": "true",
65
+ ...t.headers
66
+ },
67
+ body: i,
68
+ signal: r
69
+ });
70
+ if (!a.ok) throw Error(`AI API error: ${a.status} ${a.statusText}`);
71
+ let o = a.body?.getReader();
72
+ if (!o) throw Error("No response body");
73
+ let s = new TextDecoder(), c = "";
74
+ for (;;) {
75
+ let { done: e, value: t } = await o.read();
76
+ if (e) break;
77
+ c += s.decode(t, { stream: !0 });
78
+ let n = c.split("\n");
79
+ c = n.pop() || "";
80
+ for (let e of n) {
81
+ let t = e.trim();
82
+ if (t.startsWith("data: ")) try {
83
+ let e = JSON.parse(t.slice(6));
84
+ e.type === "content_block_delta" && e.delta?.text && (yield e.delta.text);
85
+ } catch {}
86
+ }
87
+ }
96
88
  }
97
- function w(t, e, r) {
98
- return t.protocol === "anthropic" ? f(t, e, r) : h(t, e, r);
89
+ function r(e, r, i) {
90
+ return e.protocol === "anthropic" ? n(e, r, i) : t(e, r, i);
99
91
  }
100
- async function b(t, e, r) {
101
- const n = r?.systemPrompt ?? t.systemPrompt, s = r?.imageDataUrl;
102
- let c = e;
103
- if (t.protocol === "anthropic") {
104
- const a = [{
105
- type: "text",
106
- text: e
107
- }];
108
- if (s) {
109
- const m = /^data:(.+?);base64,(.*)$/.exec(s);
110
- m && a.unshift({
111
- type: "image",
112
- source: {
113
- type: "base64",
114
- media_type: m[1],
115
- data: m[2]
116
- }
117
- });
118
- }
119
- c = a;
120
- } else s && (c = [{
121
- type: "text",
122
- text: e
123
- }, {
124
- type: "image_url",
125
- image_url: { url: s }
126
- }]);
127
- const i = n ? {
128
- ...t,
129
- systemPrompt: n
130
- } : t, o = [{
131
- role: "user",
132
- content: c
133
- }], y = i.protocol === "anthropic" ? f(i, o, r?.signal) : h(i, o, r?.signal);
134
- let p = "";
135
- for await (const a of y)
136
- p += a, r?.onDelta?.(p);
137
- return p;
92
+ async function i(e, r, i) {
93
+ let a = i?.systemPrompt ?? e.systemPrompt, o = i?.imageDataUrl, s = r;
94
+ if (e.protocol === "anthropic") {
95
+ let e = [{
96
+ type: "text",
97
+ text: r
98
+ }];
99
+ if (o) {
100
+ let t = /^data:(.+?);base64,(.*)$/.exec(o);
101
+ t && e.unshift({
102
+ type: "image",
103
+ source: {
104
+ type: "base64",
105
+ media_type: t[1],
106
+ data: t[2]
107
+ }
108
+ });
109
+ }
110
+ s = e;
111
+ } else o && (s = [{
112
+ type: "text",
113
+ text: r
114
+ }, {
115
+ type: "image_url",
116
+ image_url: { url: o }
117
+ }]);
118
+ let c = a ? {
119
+ ...e,
120
+ systemPrompt: a
121
+ } : e, l = [{
122
+ role: "user",
123
+ content: s
124
+ }], u = c.protocol === "anthropic" ? n(c, l, i?.signal) : t(c, l, i?.signal), d = "";
125
+ for await (let e of u) d += e, i?.onDelta?.(d);
126
+ return d;
138
127
  }
139
- export {
140
- b as completeAIChatStream,
141
- w as streamAIChat
142
- };
128
+ //#endregion
129
+ export { i as completeAIChatStream, r as streamAIChat };
143
130
 
144
131
  //# sourceMappingURL=aiClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aiClient.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/aiClient.ts"],"sourcesContent":["import type { FlowAIConfig } from '../types';\n\n/**\n * Minimal streaming chat client for the Flow AI media node. Supports\n * OpenAI-compatible `/chat/completions` and Anthropic `/messages` endpoints.\n *\n * Yields incremental text deltas. Callers accumulate them to render a live,\n * streaming response. This intentionally mirrors the RichTextEditor AIRewrite\n * streaming logic but is scoped to the Flow package (no tiptap dependency).\n */\nexport interface AIChatMessage {\n role: 'user' | 'assistant';\n content: string;\n}\n\n/**\n * Resolve the full request URL from a possibly-partial gateway.\n *\n * Users often paste a base URL (e.g. `https://api.moonshot.cn/v1`) instead of\n * the full endpoint, which then 404s. We append the protocol's default path\n * when the gateway doesn't already point at a completions/messages endpoint.\n */\nfunction resolveEndpoint(config: FlowAIConfig): string {\n const raw = (config.gateway || '').trim().replace(/\\/+$/, '');\n if (!raw) return raw;\n const path = config.protocol === 'anthropic' ? '/messages' : '/chat/completions';\n // Already a full endpoint.\n if (/\\/(chat\\/completions|messages|responses|completions)$/i.test(raw)) return raw;\n // Bare `/v1` (or version segment) base URL → append the default path.\n if (/\\/v\\d+$/i.test(raw)) return raw + path;\n // Host root with no path → assume `/v1` + default path.\n try {\n const u = new URL(raw);\n if (u.pathname === '' || u.pathname === '/') return raw + '/v1' + path;\n } catch { /* not a parseable URL; fall through */ }\n // Some other path was given; append the default endpoint segment.\n return raw + path;\n}\n\nasync function* streamOpenAI(\n config: FlowAIConfig,\n messages: ReadonlyArray<{ role: string; content: unknown }>,\n signal?: AbortSignal,\n): AsyncGenerator<string> {\n const body = JSON.stringify({\n model: config.model,\n messages: [\n ...(config.systemPrompt ? [{ role: 'system', content: config.systemPrompt }] : []),\n ...messages,\n ],\n stream: true,\n });\n\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}),\n ...config.headers,\n },\n body,\n signal,\n });\n\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const reader = response.body?.getReader();\n if (!reader) throw new Error('No response body');\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed === 'data: [DONE]' || !trimmed.startsWith('data: ')) continue;\n try {\n const data = JSON.parse(trimmed.slice(6));\n const content = data.choices?.[0]?.delta?.content;\n if (content) yield content;\n } catch { /* skip malformed chunk */ }\n }\n }\n}\n\nasync function* streamAnthropic(\n config: FlowAIConfig,\n messages: ReadonlyArray<{ role: string; content: unknown }>,\n signal?: AbortSignal,\n): AsyncGenerator<string> {\n const body = JSON.stringify({\n model: config.model,\n max_tokens: 8192,\n ...(config.systemPrompt ? { system: config.systemPrompt } : {}),\n messages,\n stream: true,\n });\n\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { 'x-api-key': config.apiKey } : {}),\n 'anthropic-version': '2023-06-01',\n 'anthropic-dangerous-direct-browser-access': 'true',\n ...config.headers,\n },\n body,\n signal,\n });\n\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const reader = response.body?.getReader();\n if (!reader) throw new Error('No response body');\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith('data: ')) continue;\n try {\n const data = JSON.parse(trimmed.slice(6));\n if (data.type === 'content_block_delta' && data.delta?.text) yield data.delta.text;\n } catch { /* skip malformed chunk */ }\n }\n }\n}\n\nexport function streamAIChat(\n config: FlowAIConfig,\n messages: AIChatMessage[],\n signal: AbortSignal,\n): AsyncIterable<string> {\n if (config.protocol === 'anthropic') return streamAnthropic(config, messages, signal);\n return streamOpenAI(config, messages, signal);\n}\n\n/**\n * Non-streaming completion used by the AI flow generator. Accepts an optional\n * image (data URL) for \"reconstruct this diagram\" requests. Returns the full\n * assistant text.\n */\nexport async function completeAIChat(\n config: FlowAIConfig,\n userText: string,\n options?: { imageDataUrl?: string; systemPrompt?: string; signal?: AbortSignal },\n): Promise<string> {\n const system = options?.systemPrompt ?? config.systemPrompt;\n const image = options?.imageDataUrl;\n\n if (config.protocol === 'anthropic') {\n const content: any[] = [{ type: 'text', text: userText }];\n if (image) {\n const m = /^data:(.+?);base64,(.*)$/.exec(image);\n if (m) {\n content.unshift({\n type: 'image',\n source: { type: 'base64', media_type: m[1], data: m[2] },\n });\n }\n }\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { 'x-api-key': config.apiKey } : {}),\n 'anthropic-version': '2023-06-01',\n 'anthropic-dangerous-direct-browser-access': 'true',\n ...config.headers,\n },\n body: JSON.stringify({\n model: config.model,\n max_tokens: 4096,\n ...(system ? { system } : {}),\n messages: [{ role: 'user', content }],\n }),\n signal: options?.signal,\n });\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const json = await response.json();\n return json.content?.map((c: any) => c.text ?? '').join('') ?? '';\n }\n\n // OpenAI-compatible (supports multimodal `image_url` content parts).\n const userContent: any = image\n ? [\n { type: 'text', text: userText },\n { type: 'image_url', image_url: { url: image } },\n ]\n : userText;\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}),\n ...config.headers,\n },\n body: JSON.stringify({\n model: config.model,\n messages: [\n ...(system ? [{ role: 'system', content: system }] : []),\n { role: 'user', content: userContent },\n ],\n }),\n signal: options?.signal,\n });\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const json = await response.json();\n return json.choices?.[0]?.message?.content ?? '';\n}\n\n/**\n * Streaming variant of `completeAIChat`: same multimodal request shape\n * (optional image + system prompt override), but the reply is consumed as SSE\n * deltas. `onDelta` fires with the accumulated text after every chunk so\n * callers can render the response live. Returns the full assistant text.\n */\nexport async function completeAIChatStream(\n config: FlowAIConfig,\n userText: string,\n options?: {\n imageDataUrl?: string;\n systemPrompt?: string;\n signal?: AbortSignal;\n onDelta?: (accumulated: string) => void;\n },\n): Promise<string> {\n const system = options?.systemPrompt ?? config.systemPrompt;\n const image = options?.imageDataUrl;\n\n let content: unknown = userText;\n if (config.protocol === 'anthropic') {\n const parts: any[] = [{ type: 'text', text: userText }];\n if (image) {\n const m = /^data:(.+?);base64,(.*)$/.exec(image);\n if (m) {\n parts.unshift({\n type: 'image',\n source: { type: 'base64', media_type: m[1], data: m[2] },\n });\n }\n }\n content = parts;\n } else if (image) {\n content = [\n { type: 'text', text: userText },\n { type: 'image_url', image_url: { url: image } },\n ];\n }\n\n const effective = system ? { ...config, systemPrompt: system } : config;\n const messages = [{ role: 'user', content }];\n const stream = effective.protocol === 'anthropic'\n ? streamAnthropic(effective, messages, options?.signal)\n : streamOpenAI(effective, messages, options?.signal);\n\n let acc = '';\n for await (const delta of stream) {\n acc += delta;\n options?.onDelta?.(acc);\n }\n return acc;\n}\n"],"mappings":"AAsBA,SAAS,EAAgB,GAA8B;AACrD,QAAM,KAAO,EAAO,WAAW,IAAI,KAAK,EAAE,QAAQ,QAAQ,EAAE;AAC5D,MAAI,CAAC,EAAK,QAAO;AACjB,QAAM,IAAO,EAAO,aAAa,cAAc,cAAc;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IAAI,GAC3D,IAAW,CAAC;AAAA,IAAE,MAAM;AAAA,IAAQ,SAAA;AAAA,EAAQ,CAAC,GACrC,IAAS,EAAU,aAAa,cAClC,EAAgB,GAAW,GAAU,GAAS,MAAM,IACpD,EAAa,GAAW,GAAU,GAAS,MAAM;AAErD,MAAI,IAAM;AACV,mBAAiB,KAAS;AACxB,IAAA,KAAO,GACP,GAAS,UAAU,CAAG;AAExB,SAAO;AACT"}
1
+ {"version":3,"file":"aiClient.js","names":[],"sources":["../../../../../src/components/pro/Flow/nodes/aiClient.ts"],"sourcesContent":["import type { FlowAIConfig } from '../types';\n\n/**\n * Minimal streaming chat client for the Flow AI media node. Supports\n * OpenAI-compatible `/chat/completions` and Anthropic `/messages` endpoints.\n *\n * Yields incremental text deltas. Callers accumulate them to render a live,\n * streaming response. This intentionally mirrors the RichTextEditor AIRewrite\n * streaming logic but is scoped to the Flow package (no tiptap dependency).\n */\nexport interface AIChatMessage {\n role: 'user' | 'assistant';\n content: string;\n}\n\n/**\n * Resolve the full request URL from a possibly-partial gateway.\n *\n * Users often paste a base URL (e.g. `https://api.moonshot.cn/v1`) instead of\n * the full endpoint, which then 404s. We append the protocol's default path\n * when the gateway doesn't already point at a completions/messages endpoint.\n */\nfunction resolveEndpoint(config: FlowAIConfig): string {\n const raw = (config.gateway || '').trim().replace(/\\/+$/, '');\n if (!raw) return raw;\n const path = config.protocol === 'anthropic' ? '/messages' : '/chat/completions';\n // Already a full endpoint.\n if (/\\/(chat\\/completions|messages|responses|completions)$/i.test(raw)) return raw;\n // Bare `/v1` (or version segment) base URL → append the default path.\n if (/\\/v\\d+$/i.test(raw)) return raw + path;\n // Host root with no path → assume `/v1` + default path.\n try {\n const u = new URL(raw);\n if (u.pathname === '' || u.pathname === '/') return raw + '/v1' + path;\n } catch { /* not a parseable URL; fall through */ }\n // Some other path was given; append the default endpoint segment.\n return raw + path;\n}\n\nasync function* streamOpenAI(\n config: FlowAIConfig,\n messages: ReadonlyArray<{ role: string; content: unknown }>,\n signal?: AbortSignal,\n): AsyncGenerator<string> {\n const body = JSON.stringify({\n model: config.model,\n messages: [\n ...(config.systemPrompt ? [{ role: 'system', content: config.systemPrompt }] : []),\n ...messages,\n ],\n stream: true,\n });\n\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}),\n ...config.headers,\n },\n body,\n signal,\n });\n\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const reader = response.body?.getReader();\n if (!reader) throw new Error('No response body');\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed || trimmed === 'data: [DONE]' || !trimmed.startsWith('data: ')) continue;\n try {\n const data = JSON.parse(trimmed.slice(6));\n const content = data.choices?.[0]?.delta?.content;\n if (content) yield content;\n } catch { /* skip malformed chunk */ }\n }\n }\n}\n\nasync function* streamAnthropic(\n config: FlowAIConfig,\n messages: ReadonlyArray<{ role: string; content: unknown }>,\n signal?: AbortSignal,\n): AsyncGenerator<string> {\n const body = JSON.stringify({\n model: config.model,\n max_tokens: 8192,\n ...(config.systemPrompt ? { system: config.systemPrompt } : {}),\n messages,\n stream: true,\n });\n\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { 'x-api-key': config.apiKey } : {}),\n 'anthropic-version': '2023-06-01',\n 'anthropic-dangerous-direct-browser-access': 'true',\n ...config.headers,\n },\n body,\n signal,\n });\n\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const reader = response.body?.getReader();\n if (!reader) throw new Error('No response body');\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (!trimmed.startsWith('data: ')) continue;\n try {\n const data = JSON.parse(trimmed.slice(6));\n if (data.type === 'content_block_delta' && data.delta?.text) yield data.delta.text;\n } catch { /* skip malformed chunk */ }\n }\n }\n}\n\nexport function streamAIChat(\n config: FlowAIConfig,\n messages: AIChatMessage[],\n signal: AbortSignal,\n): AsyncIterable<string> {\n if (config.protocol === 'anthropic') return streamAnthropic(config, messages, signal);\n return streamOpenAI(config, messages, signal);\n}\n\n/**\n * Non-streaming completion used by the AI flow generator. Accepts an optional\n * image (data URL) for \"reconstruct this diagram\" requests. Returns the full\n * assistant text.\n */\nexport async function completeAIChat(\n config: FlowAIConfig,\n userText: string,\n options?: { imageDataUrl?: string; systemPrompt?: string; signal?: AbortSignal },\n): Promise<string> {\n const system = options?.systemPrompt ?? config.systemPrompt;\n const image = options?.imageDataUrl;\n\n if (config.protocol === 'anthropic') {\n const content: any[] = [{ type: 'text', text: userText }];\n if (image) {\n const m = /^data:(.+?);base64,(.*)$/.exec(image);\n if (m) {\n content.unshift({\n type: 'image',\n source: { type: 'base64', media_type: m[1], data: m[2] },\n });\n }\n }\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { 'x-api-key': config.apiKey } : {}),\n 'anthropic-version': '2023-06-01',\n 'anthropic-dangerous-direct-browser-access': 'true',\n ...config.headers,\n },\n body: JSON.stringify({\n model: config.model,\n max_tokens: 4096,\n ...(system ? { system } : {}),\n messages: [{ role: 'user', content }],\n }),\n signal: options?.signal,\n });\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const json = await response.json();\n return json.content?.map((c: any) => c.text ?? '').join('') ?? '';\n }\n\n // OpenAI-compatible (supports multimodal `image_url` content parts).\n const userContent: any = image\n ? [\n { type: 'text', text: userText },\n { type: 'image_url', image_url: { url: image } },\n ]\n : userText;\n const response = await fetch(resolveEndpoint(config), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(config.apiKey ? { Authorization: `Bearer ${config.apiKey}` } : {}),\n ...config.headers,\n },\n body: JSON.stringify({\n model: config.model,\n messages: [\n ...(system ? [{ role: 'system', content: system }] : []),\n { role: 'user', content: userContent },\n ],\n }),\n signal: options?.signal,\n });\n if (!response.ok) throw new Error(`AI API error: ${response.status} ${response.statusText}`);\n const json = await response.json();\n return json.choices?.[0]?.message?.content ?? '';\n}\n\n/**\n * Streaming variant of `completeAIChat`: same multimodal request shape\n * (optional image + system prompt override), but the reply is consumed as SSE\n * deltas. `onDelta` fires with the accumulated text after every chunk so\n * callers can render the response live. Returns the full assistant text.\n */\nexport async function completeAIChatStream(\n config: FlowAIConfig,\n userText: string,\n options?: {\n imageDataUrl?: string;\n systemPrompt?: string;\n signal?: AbortSignal;\n onDelta?: (accumulated: string) => void;\n },\n): Promise<string> {\n const system = options?.systemPrompt ?? config.systemPrompt;\n const image = options?.imageDataUrl;\n\n let content: unknown = userText;\n if (config.protocol === 'anthropic') {\n const parts: any[] = [{ type: 'text', text: userText }];\n if (image) {\n const m = /^data:(.+?);base64,(.*)$/.exec(image);\n if (m) {\n parts.unshift({\n type: 'image',\n source: { type: 'base64', media_type: m[1], data: m[2] },\n });\n }\n }\n content = parts;\n } else if (image) {\n content = [\n { type: 'text', text: userText },\n { type: 'image_url', image_url: { url: image } },\n ];\n }\n\n const effective = system ? { ...config, systemPrompt: system } : config;\n const messages = [{ role: 'user', content }];\n const stream = effective.protocol === 'anthropic'\n ? streamAnthropic(effective, messages, options?.signal)\n : streamOpenAI(effective, messages, options?.signal);\n\n let acc = '';\n for await (const delta of stream) {\n acc += delta;\n options?.onDelta?.(acc);\n }\n return acc;\n}\n"],"mappings":";AAsBA,SAAS,EAAgB,GAA8B;CACrD,IAAM,KAAO,EAAO,WAAW,GAAA,CAAI,KAAK,CAA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