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,212 +1,202 @@
1
- var l = null;
2
- function d() {
3
- if (l) return l;
4
- if (typeof document > "u") return null;
5
- const e = document.createElement("canvas");
6
- return e.width = 1, e.height = 1, l = e.getContext("2d", { willReadFrequently: !0 }), l;
1
+ //#region src/components/pro/Flow/utils/themeColor.ts
2
+ var e = null;
3
+ function t() {
4
+ if (e) return e;
5
+ if (typeof document > "u") return null;
6
+ let t = document.createElement("canvas");
7
+ return t.width = 1, t.height = 1, e = t.getContext("2d", { willReadFrequently: !0 }), e;
7
8
  }
8
- function v(e) {
9
- const r = d();
10
- if (!r) return null;
11
- try {
12
- r.clearRect(0, 0, 1, 1), r.fillStyle = "#000000", r.fillStyle = e, r.fillRect(0, 0, 1, 1);
13
- const { data: t } = r.getImageData(0, 0, 1, 1);
14
- return [
15
- t[0],
16
- t[1],
17
- t[2]
18
- ];
19
- } catch {
20
- return null;
21
- }
9
+ function n(e) {
10
+ let n = t();
11
+ if (!n) return null;
12
+ try {
13
+ n.clearRect(0, 0, 1, 1), n.fillStyle = "#000000", n.fillStyle = e, n.fillRect(0, 0, 1, 1);
14
+ let { data: t } = n.getImageData(0, 0, 1, 1);
15
+ return [
16
+ t[0],
17
+ t[1],
18
+ t[2]
19
+ ];
20
+ } catch {
21
+ return null;
22
+ }
22
23
  }
23
- function o(e) {
24
- return Math.max(0, Math.min(255, Math.round(e)));
24
+ function r(e) {
25
+ return Math.max(0, Math.min(255, Math.round(e)));
25
26
  }
26
- function h(e) {
27
- const r = /^rgba?\(\s*([\d.eE+-]+)[\s,]+([\d.eE+-]+)[\s,]+([\d.eE+-]+)/.exec(e);
28
- if (r) return [
29
- o(+r[1]),
30
- o(+r[2]),
31
- o(+r[3])
32
- ];
33
- const t = /^color\(\s*srgb\s+([\d.eE+-]+)\s+([\d.eE+-]+)\s+([\d.eE+-]+)/i.exec(e);
34
- return t ? [
35
- o(+t[1] * 255),
36
- o(+t[2] * 255),
37
- o(+t[3] * 255)
38
- ] : null;
27
+ function i(e) {
28
+ let t = /^rgba?\(\s*([\d.eE+-]+)[\s,]+([\d.eE+-]+)[\s,]+([\d.eE+-]+)/.exec(e);
29
+ if (t) return [
30
+ r(+t[1]),
31
+ r(+t[2]),
32
+ r(+t[3])
33
+ ];
34
+ let n = /^color\(\s*srgb\s+([\d.eE+-]+)\s+([\d.eE+-]+)\s+([\d.eE+-]+)/i.exec(e);
35
+ return n ? [
36
+ r(n[1] * 255),
37
+ r(n[2] * 255),
38
+ r(n[3] * 255)
39
+ ] : null;
39
40
  }
40
- var p = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("color", "color-mix(in srgb, red, blue)");
41
- function i(e, r) {
42
- if (typeof document > "u") return null;
43
- try {
44
- const t = document.createElement("span");
45
- t.style.position = "absolute", t.style.width = "0", t.style.height = "0", t.style.overflow = "hidden", t.style.pointerEvents = "none", (e ?? document.body).appendChild(t);
46
- const n = /^var\(\s*(--[\w-]+)\s*\)$/.exec(r);
47
- if (n && !getComputedStyle(t).getPropertyValue(n[1]).trim())
48
- return t.remove(), null;
49
- t.style.color = p ? `color-mix(in srgb, ${r} 100%, transparent)` : r;
50
- const a = getComputedStyle(t).color;
51
- return t.remove(), h(a) ?? v(a);
52
- } catch {
53
- return null;
54
- }
41
+ var a = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("color", "color-mix(in srgb, red, blue)");
42
+ function o(e, t) {
43
+ if (typeof document > "u") return null;
44
+ try {
45
+ let r = document.createElement("span");
46
+ r.style.position = "absolute", r.style.width = "0", r.style.height = "0", r.style.overflow = "hidden", r.style.pointerEvents = "none", (e ?? document.body).appendChild(r);
47
+ let o = /^var\(\s*(--[\w-]+)\s*\)$/.exec(t);
48
+ if (o && !getComputedStyle(r).getPropertyValue(o[1]).trim()) return r.remove(), null;
49
+ r.style.color = a ? `color-mix(in srgb, ${t} 100%, transparent)` : t;
50
+ let s = getComputedStyle(r).color;
51
+ return r.remove(), i(s) ?? n(s);
52
+ } catch {
53
+ return null;
54
+ }
55
55
  }
56
- function u(e, r, t) {
57
- const n = i(e, r);
58
- return n ? n[0] << 16 | n[1] << 8 | n[2] : t;
56
+ function s(e, t, n) {
57
+ let r = o(e, t);
58
+ return r ? r[0] << 16 | r[1] << 8 | r[2] : n;
59
59
  }
60
- function s(e, r, t) {
61
- const n = i(e, r);
62
- return n ? "#" + n.map((a) => a.toString(16).padStart(2, "0")).join("") : t;
60
+ function c(e, t, n) {
61
+ let r = o(e, t);
62
+ return r ? "#" + r.map((e) => e.toString(16).padStart(2, "0")).join("") : n;
63
63
  }
64
- function g(e) {
65
- return {
66
- background: u(e, "var(--color-base-200)", 16316922),
67
- gridDot: u(e, "var(--color-base-content)", 13751771),
68
- nodeFill: s(e, "var(--color-base-100)", "#ffffff"),
69
- nodeText: s(e, "var(--color-base-content)", "#111827")
70
- };
64
+ function l(e) {
65
+ return {
66
+ background: s(e, "var(--color-base-200)", 16316922),
67
+ gridDot: s(e, "var(--color-base-content)", 13751771),
68
+ nodeFill: c(e, "var(--color-base-100)", "#ffffff"),
69
+ nodeText: c(e, "var(--color-base-content)", "#111827")
70
+ };
71
71
  }
72
- var y = "theme:", c = [
73
- {
74
- token: "theme:base-100",
75
- cssVar: "var(--color-base-100)",
76
- label: "Base 100"
77
- },
78
- {
79
- token: "theme:base-200",
80
- cssVar: "var(--color-base-200)",
81
- label: "Base 200"
82
- },
83
- {
84
- token: "theme:base-300",
85
- cssVar: "var(--color-base-300)",
86
- label: "Base 300"
87
- },
88
- {
89
- token: "theme:base-content",
90
- cssVar: "var(--color-base-content)",
91
- label: "Base Content"
92
- },
93
- {
94
- token: "theme:primary",
95
- cssVar: "var(--color-primary)",
96
- label: "Primary"
97
- },
98
- {
99
- token: "theme:secondary",
100
- cssVar: "var(--color-secondary)",
101
- label: "Secondary"
102
- },
103
- {
104
- token: "theme:accent",
105
- cssVar: "var(--color-accent)",
106
- label: "Accent"
107
- },
108
- {
109
- token: "theme:neutral",
110
- cssVar: "var(--color-neutral)",
111
- label: "Neutral"
112
- },
113
- {
114
- token: "theme:info",
115
- cssVar: "var(--color-info)",
116
- label: "Info"
117
- },
118
- {
119
- token: "theme:success",
120
- cssVar: "var(--color-success)",
121
- label: "Success"
122
- },
123
- {
124
- token: "theme:warning",
125
- cssVar: "var(--color-warning)",
126
- label: "Warning"
127
- },
128
- {
129
- token: "theme:error",
130
- cssVar: "var(--color-error)",
131
- label: "Error"
132
- }
133
- ], f = new Map(c.map((e) => [e.token, e.cssVar])), C = new Map(c.map((e) => [e.token, e.label])), S = {
134
- fill: "theme:base-100",
135
- stroke: "theme:base-content",
136
- text: "theme:base-content",
137
- line: "theme:base-content"
72
+ var u = "theme:", d = [
73
+ {
74
+ token: "theme:base-100",
75
+ cssVar: "var(--color-base-100)",
76
+ label: "Base 100"
77
+ },
78
+ {
79
+ token: "theme:base-200",
80
+ cssVar: "var(--color-base-200)",
81
+ label: "Base 200"
82
+ },
83
+ {
84
+ token: "theme:base-300",
85
+ cssVar: "var(--color-base-300)",
86
+ label: "Base 300"
87
+ },
88
+ {
89
+ token: "theme:base-content",
90
+ cssVar: "var(--color-base-content)",
91
+ label: "Base Content"
92
+ },
93
+ {
94
+ token: "theme:primary",
95
+ cssVar: "var(--color-primary)",
96
+ label: "Primary"
97
+ },
98
+ {
99
+ token: "theme:secondary",
100
+ cssVar: "var(--color-secondary)",
101
+ label: "Secondary"
102
+ },
103
+ {
104
+ token: "theme:accent",
105
+ cssVar: "var(--color-accent)",
106
+ label: "Accent"
107
+ },
108
+ {
109
+ token: "theme:neutral",
110
+ cssVar: "var(--color-neutral)",
111
+ label: "Neutral"
112
+ },
113
+ {
114
+ token: "theme:info",
115
+ cssVar: "var(--color-info)",
116
+ label: "Info"
117
+ },
118
+ {
119
+ token: "theme:success",
120
+ cssVar: "var(--color-success)",
121
+ label: "Success"
122
+ },
123
+ {
124
+ token: "theme:warning",
125
+ cssVar: "var(--color-warning)",
126
+ label: "Warning"
127
+ },
128
+ {
129
+ token: "theme:error",
130
+ cssVar: "var(--color-error)",
131
+ label: "Error"
132
+ }
133
+ ], f = new Map(d.map((e) => [e.token, e.cssVar]));
134
+ new Map(d.map((e) => [e.token, e.label]));
135
+ var p = {
136
+ fill: "theme:base-100",
137
+ stroke: "theme:base-content",
138
+ text: "theme:base-content",
139
+ line: "theme:base-content"
138
140
  };
139
- function E(e) {
140
- return f.get(e);
141
+ function m(e) {
142
+ return f.get(e);
141
143
  }
142
- var T = [
143
- {
144
- value: "#000000",
145
- label: "黑"
146
- },
147
- {
148
- value: "#ffffff",
149
- label: "白"
150
- },
151
- {
152
- value: "#ef4444",
153
- label: "赤"
154
- },
155
- {
156
- value: "#f97316",
157
- label: "橙"
158
- },
159
- {
160
- value: "#eab308",
161
- label: "黄"
162
- },
163
- {
164
- value: "#22c55e",
165
- label: "绿"
166
- },
167
- {
168
- value: "#06b6d4",
169
- label: "青"
170
- },
171
- {
172
- value: "#3b82f6",
173
- label: "蓝"
174
- },
175
- {
176
- value: "#8b5cf6",
177
- label: "紫"
178
- },
179
- {
180
- value: "#ec4899",
181
- label: "粉"
182
- }
144
+ var h = [
145
+ {
146
+ value: "#000000",
147
+ label: "黑"
148
+ },
149
+ {
150
+ value: "#ffffff",
151
+ label: "白"
152
+ },
153
+ {
154
+ value: "#ef4444",
155
+ label: "赤"
156
+ },
157
+ {
158
+ value: "#f97316",
159
+ label: "橙"
160
+ },
161
+ {
162
+ value: "#eab308",
163
+ label: "黄"
164
+ },
165
+ {
166
+ value: "#22c55e",
167
+ label: "绿"
168
+ },
169
+ {
170
+ value: "#06b6d4",
171
+ label: "青"
172
+ },
173
+ {
174
+ value: "#3b82f6",
175
+ label: "蓝"
176
+ },
177
+ {
178
+ value: "#8b5cf6",
179
+ label: "紫"
180
+ },
181
+ {
182
+ value: "#ec4899",
183
+ label: "粉"
184
+ }
183
185
  ];
184
- function b(e) {
185
- return typeof e == "string" && e.startsWith("theme:");
186
+ function g(e) {
187
+ return typeof e == "string" && e.startsWith("theme:");
186
188
  }
187
- var m = /* @__PURE__ */ new Map();
188
- function k(e) {
189
- for (const { token: r, cssVar: t } of c) m.set(r, s(e, t, "#000000"));
189
+ var _ = /* @__PURE__ */ new Map();
190
+ function v(e) {
191
+ for (let { token: t, cssVar: n } of d) _.set(t, c(e, n, "#000000"));
190
192
  }
191
- function O(e, r = "#000000") {
192
- return e ? b(e) ? m.get(e) ?? r : e : r;
193
+ function y(e, t = "#000000") {
194
+ return e ? g(e) ? _.get(e) ?? t : e : t;
193
195
  }
194
- function V(e, r = "#000000") {
195
- return e ? b(e) ? f.get(e) ?? r : e : r;
196
+ function b(e, t = "#000000") {
197
+ return e ? g(e) ? f.get(e) ?? t : e : t;
196
198
  }
197
- export {
198
- T as COMMON_COLORS,
199
- y as THEME_COLOR_PREFIX,
200
- c as THEME_COLOR_TOKENS,
201
- S as THEME_SYNC_TOKEN,
202
- s as cssColorToHexString,
203
- u as cssColorToNumber,
204
- b as isThemeToken,
205
- k as refreshThemePalette,
206
- g as resolveFlowThemeColors,
207
- O as resolveThemeColor,
208
- V as resolveThemeColorCss,
209
- E as themeTokenCssVar
210
- };
199
+ //#endregion
200
+ export { h as COMMON_COLORS, u as THEME_COLOR_PREFIX, d as THEME_COLOR_TOKENS, p as THEME_SYNC_TOKEN, c as cssColorToHexString, s as cssColorToNumber, g as isThemeToken, v as refreshThemePalette, l as resolveFlowThemeColors, y as resolveThemeColor, b as resolveThemeColorCss, m as themeTokenCssVar };
211
201
 
212
202
  //# sourceMappingURL=themeColor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"themeColor.js","names":[],"sources":["../../../../../src/components/pro/Flow/utils/themeColor.ts"],"sourcesContent":["/**\n * Resolve a CSS color value (including theme custom properties like\n * `var(--color-base-100)` that may use `oklch(...)`) into a concrete sRGB color\n * for the WebGL canvas.\n *\n * PixiJS needs a numeric/hex color and cannot read CSS variables. Resolution:\n * 1. A hidden probe element inherits the themed scope. Its `color` is set to\n * `color-mix(in srgb, <value> 100%, transparent)`, which forces the\n * browser to convert the color into the sRGB space at computed-value\n * time. `getComputedStyle` then serializes it as a plain `rgb(...)` or\n * `color(srgb ...)` string.\n * 2. That string is parsed directly (no canvas). Canvas rasterization is\n * only a last resort: some engines silently reject CSS Color 4 functions\n * (`oklch()`, `lab()`, `color()`) in `fillStyle`, which previously turned\n * every probed theme color black.\n */\n\nlet _rasterCtx: CanvasRenderingContext2D | null = null;\nfunction getRasterCtx(): CanvasRenderingContext2D | null {\n if (_rasterCtx) return _rasterCtx;\n if (typeof document === 'undefined') return null;\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n _rasterCtx = canvas.getContext('2d', { willReadFrequently: true });\n return _rasterCtx;\n}\n\n/** Rasterize any CSS color string to concrete sRGB bytes. */\nfunction rasterizeColor(cssColor: string): [number, number, number] | null {\n const ctx = getRasterCtx();\n if (!ctx) return null;\n try {\n ctx.clearRect(0, 0, 1, 1);\n ctx.fillStyle = '#000000';\n ctx.fillStyle = cssColor; // ignored if the browser can't parse it\n ctx.fillRect(0, 0, 1, 1);\n const { data } = ctx.getImageData(0, 0, 1, 1);\n return [data[0], data[1], data[2]];\n } catch {\n return null;\n }\n}\n\nfunction byte(v: number): number {\n return Math.max(0, Math.min(255, Math.round(v)));\n}\n\n/**\n * Parse the sRGB strings a browser serializes a computed color to when the\n * color was forced into the sRGB space: `rgb(...)` / `rgba(...)` (0-255\n * channels) or `color(srgb r g b / a)` (0-1 float channels).\n */\nfunction parseSrgbString(value: string): [number, number, number] | null {\n const rgb = /^rgba?\\(\\s*([\\d.eE+-]+)[\\s,]+([\\d.eE+-]+)[\\s,]+([\\d.eE+-]+)/.exec(value);\n if (rgb) return [byte(+rgb[1]), byte(+rgb[2]), byte(+rgb[3])];\n const fn = /^color\\(\\s*srgb\\s+([\\d.eE+-]+)\\s+([\\d.eE+-]+)\\s+([\\d.eE+-]+)/i.exec(value);\n if (fn) return [byte(+fn[1] * 255), byte(+fn[2] * 255), byte(+fn[3] * 255)];\n return null;\n}\n\n/** Whether the browser computes color-mix() (used to force sRGB output). */\nconst SUPPORTS_COLOR_MIX =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('color', 'color-mix(in srgb, red, blue)');\n\nfunction parseRgb(host: HTMLElement | null, cssValue: string): [number, number, number] | null {\n if (typeof document === 'undefined') return null;\n try {\n const probe = document.createElement('span');\n // Keep out of layout without `display:none` so `color` still resolves.\n probe.style.position = 'absolute';\n probe.style.width = '0';\n probe.style.height = '0';\n probe.style.overflow = 'hidden';\n probe.style.pointerEvents = 'none';\n (host ?? document.body).appendChild(probe);\n // Bail out when the requested custom property is undefined in this scope:\n // var() would invalidate the declaration and the probe would report its\n // inherited text color instead of the theme color.\n const varMatch = /^var\\(\\s*(--[\\w-]+)\\s*\\)$/.exec(cssValue);\n if (varMatch && !getComputedStyle(probe).getPropertyValue(varMatch[1]).trim()) {\n probe.remove();\n return null;\n }\n // Force the resolved color into the sRGB space at computed-value time, so\n // the serialized result is a plain rgb()/color(srgb) string we can parse\n // ourselves. Do NOT rasterize oklch()/lab() via canvas fillStyle here:\n // some engines (e.g. WebKit) silently reject CSS Color 4 functions in\n // canvas, which used to turn every probed theme color black.\n probe.style.color = SUPPORTS_COLOR_MIX\n ? `color-mix(in srgb, ${cssValue} 100%, transparent)`\n : cssValue;\n const resolved = getComputedStyle(probe).color;\n probe.remove();\n return parseSrgbString(resolved) ?? rasterizeColor(resolved);\n } catch {\n return null;\n }\n}\n\n/** Resolve a CSS color to a 0xRRGGBB number (for PixiJS). */\nexport function cssColorToNumber(host: HTMLElement | null, cssValue: string, fallback: number): number {\n const rgb = parseRgb(host, cssValue);\n if (!rgb) return fallback;\n return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];\n}\n\n/** Resolve a CSS color to a `#rrggbb` string (for persisted node data). */\nexport function cssColorToHexString(host: HTMLElement | null, cssValue: string, fallback: string): string {\n const rgb = parseRgb(host, cssValue);\n if (!rgb) return fallback;\n return '#' + rgb.map((c) => c.toString(16).padStart(2, '0')).join('');\n}\n\n/**\n * The colors the Flow canvas derives from the active theme:\n * - `background`: the canvas backdrop, follows the theme's muted background.\n * - `gridDot`: grid dots, derived from the theme foreground color.\n * - `nodeFill`: default fill for new shapes, follows the theme base background.\n */\nexport interface FlowThemeColors {\n background: number;\n gridDot: number;\n nodeFill: string;\n nodeText: string;\n}\n\nexport function resolveFlowThemeColors(host: HTMLElement | null): FlowThemeColors {\n return {\n background: cssColorToNumber(host, 'var(--color-base-200)', 0xf8f9fa),\n gridDot: cssColorToNumber(host, 'var(--color-base-content)', 0xd1d5db),\n nodeFill: cssColorToHexString(host, 'var(--color-base-100)', '#ffffff'),\n nodeText: cssColorToHexString(host, 'var(--color-base-content)', '#111827'),\n };\n}\n\n/* ============================================================================\n * Theme color tokens\n *\n * Node/edge colors may be stored either as a literal color (`#rrggbb`,\n * `transparent`, …) or as a THEME TOKEN of the form `theme:<name>` (e.g.\n * `theme:base-100`). Theme tokens are resolved to the live theme color at\n * render time, so shapes that use them re-color automatically whenever the\n * DishUI theme changes. These tokens are the default colors for new shapes.\n * ========================================================================== */\n\nexport const THEME_COLOR_PREFIX = 'theme:';\n\n/** A selectable theme color, shown as a swatch in the inspector. */\nexport interface ThemeColorToken {\n /** Stored value, e.g. `theme:base-100`. */\n token: string;\n /** CSS custom property backing the token. */\n cssVar: string;\n /** Short label for the inspector tooltip. */\n label: string;\n}\n\n/** The theme colors offered as presets/defaults for Flow color fields. */\nexport const THEME_COLOR_TOKENS: ThemeColorToken[] = [\n { token: 'theme:base-100', cssVar: 'var(--color-base-100)', label: 'Base 100' },\n { token: 'theme:base-200', cssVar: 'var(--color-base-200)', label: 'Base 200' },\n { token: 'theme:base-300', cssVar: 'var(--color-base-300)', label: 'Base 300' },\n { token: 'theme:base-content', cssVar: 'var(--color-base-content)', label: 'Base Content' },\n { token: 'theme:primary', cssVar: 'var(--color-primary)', label: 'Primary' },\n { token: 'theme:secondary', cssVar: 'var(--color-secondary)', label: 'Secondary' },\n { token: 'theme:accent', cssVar: 'var(--color-accent)', label: 'Accent' },\n { token: 'theme:neutral', cssVar: 'var(--color-neutral)', label: 'Neutral' },\n { token: 'theme:info', cssVar: 'var(--color-info)', label: 'Info' },\n { token: 'theme:success', cssVar: 'var(--color-success)', label: 'Success' },\n { token: 'theme:warning', cssVar: 'var(--color-warning)', label: 'Warning' },\n { token: 'theme:error', cssVar: 'var(--color-error)', label: 'Error' },\n];\n\nconst TOKEN_TO_CSSVAR = new Map(THEME_COLOR_TOKENS.map((t) => [t.token, t.cssVar]));\nconst TOKEN_TO_LABEL = new Map(THEME_COLOR_TOKENS.map((t) => [t.token, t.label]));\n\n/**\n * The \"follow theme\" default token for each color field type. Each field syncs\n * to a theme role so shapes stay legible against the canvas:\n * - `fill` -> theme background (base-100)\n * - `stroke` -> theme font color (base-content) — a visible outline\n * - `text` -> theme font color (base-content)\n * - `line` -> theme font color (base-content) — lines/edges\n */\nexport type ThemeColorFieldKind = 'fill' | 'stroke' | 'text' | 'line';\n\nexport const THEME_SYNC_TOKEN: Record<ThemeColorFieldKind, string> = {\n fill: 'theme:base-100',\n stroke: 'theme:base-content',\n text: 'theme:base-content',\n line: 'theme:base-content',\n};\n\n/** The CSS var backing a given theme token (for live-updating DOM swatches). */\nexport function themeTokenCssVar(token: string): string | undefined {\n return TOKEN_TO_CSSVAR.get(token);\n}\n\n/** Human label for a theme token (for tooltips). */\nexport function themeTokenLabel(token: string): string | undefined {\n return TOKEN_TO_LABEL.get(token);\n}\n\n/**\n * Common named colors offered after the theme-sync swatch: a compact rainbow\n * plus black/white. Order follows 黑白赤橙黄绿青蓝紫粉 (black, white, red,\n * orange, yellow, green, cyan, blue, purple, pink).\n */\nexport interface NamedColor {\n value: string;\n /** Chinese label shown on hover. */\n label: string;\n}\n\nexport const COMMON_COLORS: NamedColor[] = [\n { value: '#000000', label: '黑' },\n { value: '#ffffff', label: '白' },\n { value: '#ef4444', label: '赤' },\n { value: '#f97316', label: '橙' },\n { value: '#eab308', label: '黄' },\n { value: '#22c55e', label: '绿' },\n { value: '#06b6d4', label: '青' },\n { value: '#3b82f6', label: '蓝' },\n { value: '#8b5cf6', label: '紫' },\n { value: '#ec4899', label: '粉' },\n];\n\n/** True when `value` is a `theme:*` token. */\nexport function isThemeToken(value: string | undefined | null): value is string {\n return typeof value === 'string' && value.startsWith(THEME_COLOR_PREFIX);\n}\n\n// Module-level cache of the currently resolved token -> `#rrggbb` mapping. The\n// render loop resolves tokens against this cache (cheap, synchronous) instead\n// of probing the DOM every frame. `refreshThemePalette` rebuilds it whenever\n// the theme changes.\nconst _palette = new Map<string, string>();\n\n/**\n * Re-resolve every theme token against the given host's themed scope and cache\n * the results. Call on init and whenever the active theme changes.\n */\nexport function refreshThemePalette(host: HTMLElement | null): void {\n for (const { token, cssVar } of THEME_COLOR_TOKENS) {\n _palette.set(token, cssColorToHexString(host, cssVar, '#000000'));\n }\n}\n\n/**\n * Resolve a stored color value to a concrete `#rrggbb`/literal color. Theme\n * tokens are looked up in the cached palette; anything else is returned as-is.\n */\nexport function resolveThemeColor(value: string | undefined | null, fallback = '#000000'): string {\n if (!value) return fallback;\n if (isThemeToken(value)) return _palette.get(value) ?? fallback;\n return value;\n}\n\n/**\n * Resolve a stored color to a value usable directly in the DOM. Theme tokens\n * map to their CSS variable so the browser tracks theme changes natively.\n */\nexport function resolveThemeColorCss(value: string | undefined | null, fallback = '#000000'): string {\n if (!value) return fallback;\n if (isThemeToken(value)) return TOKEN_TO_CSSVAR.get(value) ?? fallback;\n return value;\n}\n"],"mappings":"AAiBA,IAAI,IAA8C;AAClD,SAAS,IAAgD;AACvD,MAAI,EAAY,QAAO;AACvB,MAAI,OAAO,WAAa,IAAa,QAAO;AAC5C,QAAM,IAAS,SAAS,cAAc,QAAQ;AAC9C,SAAA,EAAO,QAAQ,GACf,EAAO,SAAS,GAChB,IAAa,EAAO,WAAW,MAAM,EAAE,oBAAoB,GAAK,CAAC,GAC1D;AACT;AAGA,SAAS,EAAe,GAAmD;AACzE,QAAM,IAAM,EAAa;AACzB,MAAI,CAAC,EAAK,QAAO;AACjB,MAAI;AACF,IAAA,EAAI,UAAU,GAAG,GAAG,GAAG,CAAC,GACxB,EAAI,YAAY,WAChB,EAAI,YAAY,GAChB,EAAI,SAAS,GAAG,GAAG,GAAG,CAAC;AACvB,UAAM,EAAE,M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AC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AAAA,EAC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AAAA,EAC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AAAA,EAC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AAAA,EAC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AAAA,EAC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AAAA,EAC/B;AAAA,IAAE,OAAO;AAAA,IAAW,OAAO;AAAA,EAAI;AACjC;AAGA,SAAgB,EAAa,GAAmD;AAC9E,SAAO,OAAO,KAAU,YAAY,EAAM,WAAA,QAA6B;AACzE;AAMA,IAAM,IAAW,oBAAI,IAAoB;AAMzC,SAAgB,EAAoB,GAAgC;AAClE,aAAW,EAAE,OAAA,GAAO,QAAA,EAAA,KAAY,EAC9B,CAAA,EAAS,IAAI,GAAO,EAAoB,GAAM,GAAQ,SAAS,CAAC;AAEpE;AAMA,SAAgB,EAAkB,GAAkC,IAAW,WAAmB;AAChG,SAAK,IACD,EAAa,CAAK,IAAU,EAAS,IAAI,CAAK,KAAK,IAChD,IAFY;AAGrB;AAMA,SAAgB,EAAqB,GAAkC,IAAW,WAAmB;AACnG,SAAK,IACD,EAAa,CAAK,IAAU,EAAgB,IAAI,CAAK,KAAK,IACvD,IAFY;AAGrB"}
1
+ {"version":3,"file":"themeColor.js","names":[],"sources":["../../../../../src/components/pro/Flow/utils/themeColor.ts"],"sourcesContent":["/**\n * Resolve a CSS color value (including theme custom properties like\n * `var(--color-base-100)` that may use `oklch(...)`) into a concrete sRGB color\n * for the WebGL canvas.\n *\n * PixiJS needs a numeric/hex color and cannot read CSS variables. Resolution:\n * 1. A hidden probe element inherits the themed scope. Its `color` is set to\n * `color-mix(in srgb, <value> 100%, transparent)`, which forces the\n * browser to convert the color into the sRGB space at computed-value\n * time. `getComputedStyle` then serializes it as a plain `rgb(...)` or\n * `color(srgb ...)` string.\n * 2. That string is parsed directly (no canvas). Canvas rasterization is\n * only a last resort: some engines silently reject CSS Color 4 functions\n * (`oklch()`, `lab()`, `color()`) in `fillStyle`, which previously turned\n * every probed theme color black.\n */\n\nlet _rasterCtx: CanvasRenderingContext2D | null = null;\nfunction getRasterCtx(): CanvasRenderingContext2D | null {\n if (_rasterCtx) return _rasterCtx;\n if (typeof document === 'undefined') return null;\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n _rasterCtx = canvas.getContext('2d', { willReadFrequently: true });\n return _rasterCtx;\n}\n\n/** Rasterize any CSS color string to concrete sRGB bytes. */\nfunction rasterizeColor(cssColor: string): [number, number, number] | null {\n const ctx = getRasterCtx();\n if (!ctx) return null;\n try {\n ctx.clearRect(0, 0, 1, 1);\n ctx.fillStyle = '#000000';\n ctx.fillStyle = cssColor; // ignored if the browser can't parse it\n ctx.fillRect(0, 0, 1, 1);\n const { data } = ctx.getImageData(0, 0, 1, 1);\n return [data[0], data[1], data[2]];\n } catch {\n return null;\n }\n}\n\nfunction byte(v: number): number {\n return Math.max(0, Math.min(255, Math.round(v)));\n}\n\n/**\n * Parse the sRGB strings a browser serializes a computed color to when the\n * color was forced into the sRGB space: `rgb(...)` / `rgba(...)` (0-255\n * channels) or `color(srgb r g b / a)` (0-1 float channels).\n */\nfunction parseSrgbString(value: string): [number, number, number] | null {\n const rgb = /^rgba?\\(\\s*([\\d.eE+-]+)[\\s,]+([\\d.eE+-]+)[\\s,]+([\\d.eE+-]+)/.exec(value);\n if (rgb) return [byte(+rgb[1]), byte(+rgb[2]), byte(+rgb[3])];\n const fn = /^color\\(\\s*srgb\\s+([\\d.eE+-]+)\\s+([\\d.eE+-]+)\\s+([\\d.eE+-]+)/i.exec(value);\n if (fn) return [byte(+fn[1] * 255), byte(+fn[2] * 255), byte(+fn[3] * 255)];\n return null;\n}\n\n/** Whether the browser computes color-mix() (used to force sRGB output). */\nconst SUPPORTS_COLOR_MIX =\n typeof CSS !== 'undefined' &&\n typeof CSS.supports === 'function' &&\n CSS.supports('color', 'color-mix(in srgb, red, blue)');\n\nfunction parseRgb(host: HTMLElement | null, cssValue: string): [number, number, number] | null {\n if (typeof document === 'undefined') return null;\n try {\n const probe = document.createElement('span');\n // Keep out of layout without `display:none` so `color` still resolves.\n probe.style.position = 'absolute';\n probe.style.width = '0';\n probe.style.height = '0';\n probe.style.overflow = 'hidden';\n probe.style.pointerEvents = 'none';\n (host ?? document.body).appendChild(probe);\n // Bail out when the requested custom property is undefined in this scope:\n // var() would invalidate the declaration and the probe would report its\n // inherited text color instead of the theme color.\n const varMatch = /^var\\(\\s*(--[\\w-]+)\\s*\\)$/.exec(cssValue);\n if (varMatch && !getComputedStyle(probe).getPropertyValue(varMatch[1]).trim()) {\n probe.remove();\n return null;\n }\n // Force the resolved color into the sRGB space at computed-value time, so\n // the serialized result is a plain rgb()/color(srgb) string we can parse\n // ourselves. Do NOT rasterize oklch()/lab() via canvas fillStyle here:\n // some engines (e.g. WebKit) silently reject CSS Color 4 functions in\n // canvas, which used to turn every probed theme color black.\n probe.style.color = SUPPORTS_COLOR_MIX\n ? `color-mix(in srgb, ${cssValue} 100%, transparent)`\n : cssValue;\n const resolved = getComputedStyle(probe).color;\n probe.remove();\n return parseSrgbString(resolved) ?? rasterizeColor(resolved);\n } catch {\n return null;\n }\n}\n\n/** Resolve a CSS color to a 0xRRGGBB number (for PixiJS). */\nexport function cssColorToNumber(host: HTMLElement | null, cssValue: string, fallback: number): number {\n const rgb = parseRgb(host, cssValue);\n if (!rgb) return fallback;\n return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];\n}\n\n/** Resolve a CSS color to a `#rrggbb` string (for persisted node data). */\nexport function cssColorToHexString(host: HTMLElement | null, cssValue: string, fallback: string): string {\n const rgb = parseRgb(host, cssValue);\n if (!rgb) return fallback;\n return '#' + rgb.map((c) => c.toString(16).padStart(2, '0')).join('');\n}\n\n/**\n * The colors the Flow canvas derives from the active theme:\n * - `background`: the canvas backdrop, follows the theme's muted background.\n * - `gridDot`: grid dots, derived from the theme foreground color.\n * - `nodeFill`: default fill for new shapes, follows the theme base background.\n */\nexport interface FlowThemeColors {\n background: number;\n gridDot: number;\n nodeFill: string;\n nodeText: string;\n}\n\nexport function resolveFlowThemeColors(host: HTMLElement | null): FlowThemeColors {\n return {\n background: cssColorToNumber(host, 'var(--color-base-200)', 0xf8f9fa),\n gridDot: cssColorToNumber(host, 'var(--color-base-content)', 0xd1d5db),\n nodeFill: cssColorToHexString(host, 'var(--color-base-100)', '#ffffff'),\n nodeText: cssColorToHexString(host, 'var(--color-base-content)', '#111827'),\n };\n}\n\n/* ============================================================================\n * Theme color tokens\n *\n * Node/edge colors may be stored either as a literal color (`#rrggbb`,\n * `transparent`, …) or as a THEME TOKEN of the form `theme:<name>` (e.g.\n * `theme:base-100`). Theme tokens are resolved to the live theme color at\n * render time, so shapes that use them re-color automatically whenever the\n * DishUI theme changes. These tokens are the default colors for new shapes.\n * ========================================================================== */\n\nexport const THEME_COLOR_PREFIX = 'theme:';\n\n/** A selectable theme color, shown as a swatch in the inspector. */\nexport interface ThemeColorToken {\n /** Stored value, e.g. `theme:base-100`. */\n token: string;\n /** CSS custom property backing the token. */\n cssVar: string;\n /** Short label for the inspector tooltip. */\n label: string;\n}\n\n/** The theme colors offered as presets/defaults for Flow color fields. */\nexport const THEME_COLOR_TOKENS: ThemeColorToken[] = [\n { token: 'theme:base-100', cssVar: 'var(--color-base-100)', label: 'Base 100' },\n { token: 'theme:base-200', cssVar: 'var(--color-base-200)', label: 'Base 200' },\n { token: 'theme:base-300', cssVar: 'var(--color-base-300)', label: 'Base 300' },\n { token: 'theme:base-content', cssVar: 'var(--color-base-content)', label: 'Base Content' },\n { token: 'theme:primary', cssVar: 'var(--color-primary)', label: 'Primary' },\n { token: 'theme:secondary', cssVar: 'var(--color-secondary)', label: 'Secondary' },\n { token: 'theme:accent', cssVar: 'var(--color-accent)', label: 'Accent' },\n { token: 'theme:neutral', cssVar: 'var(--color-neutral)', label: 'Neutral' },\n { token: 'theme:info', cssVar: 'var(--color-info)', label: 'Info' },\n { token: 'theme:success', cssVar: 'var(--color-success)', label: 'Success' },\n { token: 'theme:warning', cssVar: 'var(--color-warning)', label: 'Warning' },\n { token: 'theme:error', cssVar: 'var(--color-error)', label: 'Error' },\n];\n\nconst TOKEN_TO_CSSVAR = new Map(THEME_COLOR_TOKENS.map((t) => [t.token, t.cssVar]));\nconst TOKEN_TO_LABEL = new Map(THEME_COLOR_TOKENS.map((t) => [t.token, t.label]));\n\n/**\n * The \"follow theme\" default token for each color field type. Each field syncs\n * to a theme role so shapes stay legible against the canvas:\n * - `fill` -> theme background (base-100)\n * - `stroke` -> theme font color (base-content) — a visible outline\n * - `text` -> theme font color (base-content)\n * - `line` -> theme font color (base-content) — lines/edges\n */\nexport type ThemeColorFieldKind = 'fill' | 'stroke' | 'text' | 'line';\n\nexport const THEME_SYNC_TOKEN: Record<ThemeColorFieldKind, string> = {\n fill: 'theme:base-100',\n stroke: 'theme:base-content',\n text: 'theme:base-content',\n line: 'theme:base-content',\n};\n\n/** The CSS var backing a given theme token (for live-updating DOM swatches). */\nexport function themeTokenCssVar(token: string): string | undefined {\n return TOKEN_TO_CSSVAR.get(token);\n}\n\n/** Human label for a theme token (for tooltips). */\nexport function themeTokenLabel(token: string): string | undefined {\n return TOKEN_TO_LABEL.get(token);\n}\n\n/**\n * Common named colors offered after the theme-sync swatch: a compact rainbow\n * plus black/white. Order follows 黑白赤橙黄绿青蓝紫粉 (black, white, red,\n * orange, yellow, green, cyan, blue, purple, pink).\n */\nexport interface NamedColor {\n value: string;\n /** Chinese label shown on hover. */\n label: string;\n}\n\nexport const COMMON_COLORS: NamedColor[] = [\n { value: '#000000', label: '黑' },\n { value: '#ffffff', label: '白' },\n { value: '#ef4444', label: '赤' },\n { value: '#f97316', label: '橙' },\n { value: '#eab308', label: '黄' },\n { value: '#22c55e', label: '绿' },\n { value: '#06b6d4', label: '青' },\n { value: '#3b82f6', label: '蓝' },\n { value: '#8b5cf6', label: '紫' },\n { value: '#ec4899', label: '粉' },\n];\n\n/** True when `value` is a `theme:*` token. */\nexport function isThemeToken(value: string | undefined | null): value is string {\n return typeof value === 'string' && value.startsWith(THEME_COLOR_PREFIX);\n}\n\n// Module-level cache of the currently resolved token -> `#rrggbb` mapping. The\n// render loop resolves tokens against this cache (cheap, synchronous) instead\n// of probing the DOM every frame. `refreshThemePalette` rebuilds it whenever\n// the theme changes.\nconst _palette = new Map<string, string>();\n\n/**\n * Re-resolve every theme token against the given host's themed scope and cache\n * the results. Call on init and whenever the active theme changes.\n */\nexport function refreshThemePalette(host: HTMLElement | null): void {\n for (const { token, cssVar } of THEME_COLOR_TOKENS) {\n _palette.set(token, cssColorToHexString(host, cssVar, '#000000'));\n }\n}\n\n/**\n * Resolve a stored color value to a concrete `#rrggbb`/literal color. Theme\n * tokens are looked up in the cached palette; anything else is returned as-is.\n */\nexport function resolveThemeColor(value: string | undefined | null, fallback = '#000000'): string {\n if (!value) return fallback;\n if (isThemeToken(value)) return _palette.get(value) ?? fallback;\n return value;\n}\n\n/**\n * Resolve a stored color to a value usable directly in the DOM. Theme tokens\n * map to their CSS variable so the browser tracks theme changes natively.\n */\nexport function resolveThemeColorCss(value: string | undefined | null, fallback = '#000000'): string {\n if (!value) return fallback;\n if (isThemeToken(value)) return TOKEN_TO_CSSVAR.get(value) ?? fallback;\n return value;\n}\n"],"mappings":";AAiBA,IAAI,IAA8C;AAClD,SAAS,IAAgD;CACvD,IAAI,GAAY,OAAO;CACvB,IAAI,OAAO,WAAa,KAAa,OAAO;CAC5C,IAAM,IAAS,SAAS,cAAc,QAAQ;CAI9C,OAHA,EAAO,QAAQ,GACf,EAAO,SAAS,GAChB,IAAa,EAAO,WAAW,MAAM,EAAE,oBAAoB,GAAK,CAAC,GAC1D;AACT;AAGA,SAAS,EAAe,GAAmD;CACzE,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,GAAQ,SAAS,CAAC;AAEpE;AAMA,SAAgB,EAAkB,GAAkC,IAAW,WAAmB;CAGhG,OAFK,IACD,EAAa,CAAK,IAAU,EAAS,IAAI,CAAK,KAAK,IAChD,IAFY;AAGrB;AAMA,SAAgB,EAAqB,GAAkC,IAAW,WAAmB;CAGnG,OAFK,IACD,EAAa,CAAK,IAAU,EAAgB,IAAI,CAAK,KAAK,IACvD,IAFY;AAGrB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * DishUI Gantt Chart Component
3
+ */
4
+ import React from "react";
5
+ import type { GanttProps, GanttHandle } from "./types";
6
+ declare const Gantt: React.ForwardRefExoticComponent<GanttProps & React.RefAttributes<GanttHandle>>;
7
+ export default Gantt;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Drag and resize interaction hook for Gantt bars.
3
+ * Handles move (translate) and resize-start/resize-end operations.
4
+ */
5
+ import type { GanttNode, GanttScaleConfig, GanttBarChangeEvent, HolidayCalendar } from '../types';
6
+ export type DragMode = 'move' | 'resize-start' | 'resize-end' | null;
7
+ export interface DragState {
8
+ nodeId: string | number;
9
+ mode: DragMode;
10
+ startX: number;
11
+ startBarLeft: number;
12
+ startBarWidth: number;
13
+ originalNode: GanttNode;
14
+ }
15
+ export interface UseGanttDragOptions {
16
+ scaleConfig: GanttScaleConfig;
17
+ timelineStart: Date;
18
+ onBarChange?: (event: GanttBarChangeEvent) => void;
19
+ calendar?: HolidayCalendar;
20
+ minBarWidth?: number;
21
+ }
22
+ export declare function useGanttDrag(options: UseGanttDragOptions): {
23
+ isDragging: boolean;
24
+ draggingNodeId: string | number | null;
25
+ dragMode: "move" | "resize-end" | "resize-start" | null;
26
+ startDrag: (e: React.MouseEvent, node: GanttNode, mode: DragMode, barLeft: number, barWidth: number) => void;
27
+ getAdjustedBar: (nodeId: string | number, barLeft: number, barWidth: number) => {
28
+ left: number;
29
+ width: number;
30
+ };
31
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Core state management hook for the Gantt component.
3
+ * Manages expansion, selection, scale, date range, and scroll synchronization.
4
+ */
5
+ import type { GanttNode, GanttNodeId, GanttScaleLevel, GanttScaleConfig, GanttCategoryConfig, HolidayCalendar, TimeWindow, FlatGanttNode } from '../types';
6
+ export interface UseGanttStateOptions {
7
+ data: GanttNode[];
8
+ defaultScale?: GanttScaleLevel;
9
+ defaultExpandedIds?: GanttNodeId[];
10
+ defaultExpandAll?: boolean;
11
+ scaleConfigs?: Partial<Record<GanttScaleLevel, GanttScaleConfig>>;
12
+ categories?: Record<string, GanttCategoryConfig>;
13
+ holidays?: HolidayCalendar;
14
+ timeWindow?: TimeWindow;
15
+ availableScales?: GanttScaleLevel[];
16
+ onScaleChange?: (scale: GanttScaleLevel) => void;
17
+ onNodeToggle?: (nodeId: GanttNodeId, expanded: boolean) => void;
18
+ onViewChange?: (start: Date, end: Date, scale: GanttScaleLevel) => void;
19
+ }
20
+ export declare function useGanttState(options: UseGanttStateOptions): {
21
+ scale: GanttScaleLevel;
22
+ setScale: (newScale: GanttScaleLevel) => void;
23
+ scales: GanttScaleLevel[];
24
+ currentScaleConfig: GanttScaleConfig;
25
+ mergedScaleConfigs: {
26
+ day: GanttScaleConfig;
27
+ halfday: GanttScaleConfig;
28
+ hour: GanttScaleConfig;
29
+ month: GanttScaleConfig;
30
+ quarter: GanttScaleConfig;
31
+ week: GanttScaleConfig;
32
+ year: GanttScaleConfig;
33
+ };
34
+ expandedIds: Set<GanttNodeId>;
35
+ toggleNode: (nodeId: GanttNodeId, expanded?: boolean) => void;
36
+ expandAll: () => void;
37
+ collapseAll: () => void;
38
+ selectedNodeId: GanttNodeId | null;
39
+ setSelectedNodeId: import("react").Dispatch<import("react").SetStateAction<GanttNodeId | null>>;
40
+ dateRange: {
41
+ start: Date;
42
+ end: Date;
43
+ };
44
+ dates: Date[];
45
+ headerGroups: import("..").TimelineHeaderGroup[];
46
+ today: Date;
47
+ todayX: number;
48
+ totalTimelineWidth: number;
49
+ flatNodes: FlatGanttNode[];
50
+ treeBodyRef: import("react").RefObject<HTMLDivElement | null>;
51
+ timelineBodyRef: import("react").RefObject<HTMLDivElement | null>;
52
+ timelineHeaderRef: import("react").RefObject<HTMLDivElement | null>;
53
+ syncScrollVertical: (source: 'tree' | 'timeline') => void;
54
+ syncScrollHorizontal: () => void;
55
+ scrollToDate: (date: Date) => void;
56
+ scrollToToday: () => void;
57
+ scrollToNode: (nodeId: GanttNodeId) => void;
58
+ };
@@ -0,0 +1,6 @@
1
+ export { default as Gantt } from "./Gantt";
2
+ export * from "./types";
3
+ export { DEFAULT_SCALE_CONFIGS, DEFAULT_CATEGORY_CONFIG, DEFAULT_TIME_WINDOW, parseDate, formatDate, isWeekend, isNonWorkingDay, calculateWorkingDays, addWorkingDays, daysBetween, addDays, startOfDay, computeDateRange, generateDateRange, generateHeaderGroups, flattenTree, xToDate, dateToX, getISOWeekNumber, getISOWeekYear, } from "./utils";
4
+ export type { TimelineHeaderGroup } from "./utils";
5
+ export { useGanttState } from "./hooks/useGanttState";
6
+ export { useGanttDrag } from "./hooks/useGanttDrag";