@xiongtao.xt/tau-plugins 0.44.0 → 0.46.0

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 (249) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/docs/README.md +2 -2
  3. package/docs/api-support.md +53 -40
  4. package/docs/editor-collaboration.md +187 -0
  5. package/docs/editor.md +30 -27
  6. package/docs/getting-started.md +3 -3
  7. package/docs/portability.md +8 -6
  8. package/docs/providers/README.md +13 -13
  9. package/docs/providers/asr.md +3 -1
  10. package/docs/providers/sync.md +41 -2
  11. package/docs/providers/tts.md +15 -0
  12. package/docs/providers/upload.md +43 -4
  13. package/docs/release.md +1 -1
  14. package/docs/whiteboard-collaboration.md +67 -0
  15. package/docs/whiteboard.md +79 -29
  16. package/package.json +5 -4
  17. package/publish-artifacts.js +9348 -73
  18. package/types/packages/collaboration/src/protocol.d.ts +144 -0
  19. package/types/packages/collaboration/src/whiteboard-contract.d.ts +6 -0
  20. package/types/packages/collaboration/src/whiteboard-types.d.ts +181 -0
  21. package/types/packages/collaboration/whiteboard-types.d.ts +1 -0
  22. package/types/packages/db-schema/content-contracts.d.ts +4 -1
  23. package/types/packages/db-schema/content-identities.d.ts +19 -0
  24. package/types/packages/db-schema/data-versions.d.ts +16 -0
  25. package/types/packages/editor/source-contracts.d.ts +13 -41
  26. package/types/packages/editor/src/Editor.d.ts +7 -0
  27. package/types/packages/editor/src/builtin-types.d.ts +22 -0
  28. package/types/packages/editor/src/core/CoreEditor.d.ts +44 -0
  29. package/types/packages/editor/src/core/api/elementView.d.ts +14 -0
  30. package/types/packages/editor/src/core/api/extension.d.ts +3 -8
  31. package/types/packages/editor/src/core/api/index.d.ts +6 -1
  32. package/types/packages/editor/src/core/api/slateTextFields.d.ts +6 -0
  33. package/types/packages/editor/src/core/api/textFieldInput.d.ts +14 -0
  34. package/types/packages/editor/src/core/document/EditorDocument.d.ts +74 -0
  35. package/types/packages/editor/src/core/extensions/markdown-paste-import/index.d.ts +10 -0
  36. package/types/packages/editor/src/core/hooks/useTouchVoidSelection.d.ts +10 -0
  37. package/types/packages/editor/src/core/index.d.ts +36 -0
  38. package/types/packages/editor/src/core/menu/defaultMenu.d.ts +2 -0
  39. package/types/packages/editor/src/core/plugins/withMarkdownPasteImport.d.ts +17 -0
  40. package/types/packages/editor/src/core/services/elementEditingPolicy.d.ts +0 -1
  41. package/types/packages/editor/src/core/utils/blockNavigation.d.ts +1 -1
  42. package/types/packages/editor/src/core/utils/editor.d.ts +2 -2
  43. package/types/packages/editor/src/core/utils/hotkey.d.ts +17 -0
  44. package/types/packages/editor/src/core/utils/index.d.ts +9 -0
  45. package/types/packages/editor/src/core/utils/normalizeEditorContent.d.ts +2 -0
  46. package/types/packages/editor/src/core/utils/plugin.d.ts +1 -1
  47. package/types/packages/editor/src/extensions/annotation/src/augmentations.d.ts +9 -0
  48. package/types/packages/editor/src/extensions/annotation/src/types.d.ts +6 -0
  49. package/types/packages/editor/src/extensions/blockquote/src/augmentations.d.ts +6 -0
  50. package/types/packages/editor/src/extensions/blockquote/src/types.d.ts +7 -0
  51. package/types/packages/editor/src/extensions/callout/src/augmentations.d.ts +6 -0
  52. package/types/packages/editor/src/extensions/callout/src/types.d.ts +11 -0
  53. package/types/packages/editor/src/extensions/callout/src/variants.d.ts +1 -0
  54. package/types/packages/editor/src/extensions/code-block/src/augmentations.d.ts +7 -0
  55. package/types/packages/editor/src/extensions/code-block/src/types/code-block.d.ts +40 -0
  56. package/types/packages/editor/src/extensions/code-block/src/types/index.d.ts +1 -0
  57. package/types/packages/editor/src/extensions/comment/src/augmentations.d.ts +9 -0
  58. package/types/packages/editor/src/extensions/comment/src/types.d.ts +15 -0
  59. package/types/packages/editor/src/extensions/detail/src/augmentations.d.ts +6 -0
  60. package/types/packages/editor/src/extensions/detail/src/types.d.ts +9 -0
  61. package/types/packages/editor/src/extensions/diagram/src/augmentations.d.ts +7 -0
  62. package/types/packages/editor/src/extensions/diagram/src/types/index.d.ts +4 -0
  63. package/types/packages/editor/src/extensions/diagram/src/types/mermaid.d.ts +12 -0
  64. package/types/packages/editor/src/extensions/diagram/src/types/plantuml.d.ts +6 -0
  65. package/types/packages/editor/src/extensions/diagram/src/types/typst.d.ts +9 -0
  66. package/types/packages/editor/src/extensions/divide-line/src/augmentations.d.ts +6 -0
  67. package/types/packages/editor/src/extensions/divide-line/src/types.d.ts +5 -0
  68. package/types/packages/editor/src/extensions/emoji/src/augmentations.d.ts +9 -0
  69. package/types/packages/editor/src/extensions/emoji/src/types.d.ts +9 -0
  70. package/types/packages/editor/src/extensions/front-matter/src/augmentations.d.ts +6 -0
  71. package/types/packages/editor/src/extensions/front-matter/src/types.d.ts +6 -0
  72. package/types/packages/editor/src/extensions/header/src/augmentations.d.ts +6 -0
  73. package/types/packages/editor/src/extensions/header/src/types.d.ts +8 -0
  74. package/types/packages/editor/src/extensions/highlight-block/src/augmentations.d.ts +6 -0
  75. package/types/packages/editor/src/extensions/highlight-block/src/types.d.ts +10 -0
  76. package/types/packages/editor/src/extensions/highlight-block/src/variants.d.ts +1 -0
  77. package/types/packages/editor/src/extensions/kbd/src/augmentations.d.ts +9 -0
  78. package/types/packages/editor/src/extensions/kbd/src/types.d.ts +5 -0
  79. package/types/packages/editor/src/extensions/link/src/augmentations.d.ts +9 -0
  80. package/types/packages/editor/src/extensions/link/src/types.d.ts +6 -0
  81. package/types/packages/editor/src/extensions/list/src/augmentations.d.ts +10 -0
  82. package/types/packages/editor/src/extensions/list/src/types/check-list.d.ts +25 -0
  83. package/types/packages/editor/src/extensions/list/src/types/list.d.ts +18 -0
  84. package/types/packages/editor/src/extensions/list/src/types.d.ts +3 -0
  85. package/types/packages/editor/src/extensions/math/src/augmentations.d.ts +10 -0
  86. package/types/packages/editor/src/extensions/math/src/types.d.ts +11 -0
  87. package/types/packages/editor/src/extensions/media/src/augmentations.d.ts +15 -0
  88. package/types/packages/editor/src/extensions/media/src/components/ImageCropEditor/geometry.d.ts +119 -0
  89. package/types/packages/editor/src/extensions/media/src/types/element/audio.d.ts +13 -0
  90. package/types/packages/editor/src/extensions/media/src/types/element/image-appearance.d.ts +2 -0
  91. package/types/packages/editor/src/extensions/media/src/types/element/image.d.ts +31 -0
  92. package/types/packages/editor/src/extensions/media/src/types/element/inline-image.d.ts +10 -0
  93. package/types/packages/editor/src/extensions/media/src/types/element/video.d.ts +21 -0
  94. package/types/packages/editor/src/extensions/styled-text/src/augmentations.d.ts +9 -0
  95. package/types/packages/editor/src/extensions/styled-text/src/colors.d.ts +75 -0
  96. package/types/packages/editor/src/extensions/styled-text/src/types.d.ts +7 -0
  97. package/types/packages/editor/src/extensions/table/src/align.d.ts +2 -0
  98. package/types/packages/editor/src/extensions/table/src/augmentations.d.ts +8 -0
  99. package/types/packages/editor/src/extensions/table/src/types.d.ts +19 -0
  100. package/types/packages/editor/src/extensions/tabs/src/augmentations.d.ts +7 -0
  101. package/types/packages/editor/src/extensions/tabs/src/types.d.ts +29 -0
  102. package/types/packages/editor/src/extensions/underline/src/augmentations.d.ts +9 -0
  103. package/types/packages/editor/src/extensions/underline/src/types.d.ts +8 -0
  104. package/types/packages/editor/src/extensions/webview/src/augmentations.d.ts +6 -0
  105. package/types/packages/editor/src/extensions/webview/src/types.d.ts +14 -0
  106. package/types/packages/editor/src/index.d.ts +4 -0
  107. package/types/packages/editor/src/presets/default.d.ts +2 -0
  108. package/types/packages/editor/text-field-contract.d.ts +36 -0
  109. package/types/packages/plugins/src/content-input.d.ts +1 -0
  110. package/types/packages/plugins/src/data.d.ts +1 -0
  111. package/types/packages/plugins/src/flashcards.d.ts +2 -0
  112. package/types/packages/plugins/src/index.d.ts +3 -2
  113. package/types/packages/plugins/src/provider-form.d.ts +57 -0
  114. package/types/packages/plugins/src/settings.d.ts +14 -10
  115. package/types/packages/plugins/src/whiteboard.d.ts +3 -2
  116. package/types/packages/shared/color-utils.d.ts +19 -0
  117. package/types/packages/shared/media-services.d.ts +18 -0
  118. package/types/packages/shared/media-types.d.ts +1 -0
  119. package/types/packages/shared/src/chat-core/askQuestion.d.ts +54 -0
  120. package/types/packages/shared/src/chat-core/index.d.ts +1 -0
  121. package/types/packages/shared/src/task-assistant/contracts.d.ts +119 -0
  122. package/types/packages/shared/src/task-assistant/document-state.d.ts +14 -0
  123. package/types/packages/shared/src/task-assistant/schema.d.ts +42 -0
  124. package/types/packages/shared/task-assistant.d.ts +3 -0
  125. package/types/packages/whiteboard/src/Board.d.ts +180 -0
  126. package/types/packages/whiteboard/src/WhiteBoard.d.ts +55 -0
  127. package/types/packages/whiteboard/src/author.d.ts +5 -3
  128. package/types/packages/whiteboard/src/components/ArrowConnectPointGroup/index.d.ts +13 -0
  129. package/types/packages/whiteboard/src/components/ArrowDropConnectPoint/index.d.ts +7 -0
  130. package/types/packages/whiteboard/src/components/DocumentElement/index.d.ts +13 -0
  131. package/types/packages/whiteboard/src/components/ResizeCircle/index.d.ts +15 -0
  132. package/types/packages/whiteboard/src/components/SketchPaths/SketchRect.d.ts +21 -0
  133. package/types/packages/whiteboard/src/components/Toolbar/ToolMenu.d.ts +15 -0
  134. package/types/packages/whiteboard/src/constants/arrow.d.ts +19 -0
  135. package/types/packages/whiteboard/src/constants/boardIdentity.d.ts +2 -0
  136. package/types/packages/whiteboard/src/constants/geometry.d.ts +7 -0
  137. package/types/packages/whiteboard/src/constants/grid.d.ts +4 -0
  138. package/types/packages/whiteboard/src/constants/image.d.ts +21 -0
  139. package/types/packages/whiteboard/src/constants/index.d.ts +13 -0
  140. package/types/packages/whiteboard/src/constants/map.d.ts +2 -0
  141. package/types/packages/whiteboard/src/constants/mind-themes.d.ts +30 -0
  142. package/types/packages/whiteboard/src/constants/mind.d.ts +14 -0
  143. package/types/packages/whiteboard/src/constants/resize.d.ts +2 -0
  144. package/types/packages/whiteboard/src/constants/select.d.ts +4 -0
  145. package/types/packages/whiteboard/src/constants/shadow.d.ts +12 -0
  146. package/types/packages/whiteboard/src/constants/sketch.d.ts +16 -0
  147. package/types/packages/whiteboard/src/constants/text-style.d.ts +68 -0
  148. package/types/packages/whiteboard/src/constants/tools.d.ts +11 -0
  149. package/types/packages/whiteboard/src/constants/viewport.d.ts +3 -0
  150. package/types/packages/whiteboard/src/document-version.d.ts +9 -0
  151. package/types/packages/whiteboard/src/document.d.ts +47 -0
  152. package/types/packages/whiteboard/src/extensions/api.d.ts +9 -0
  153. package/types/packages/whiteboard/src/extensions/authorApi.d.ts +10 -0
  154. package/types/packages/whiteboard/src/extensions/authorHooks.d.ts +2 -2
  155. package/types/packages/whiteboard/src/extensions/authorTypes.d.ts +150 -0
  156. package/types/packages/whiteboard/src/extensions/media.d.ts +50 -0
  157. package/types/packages/whiteboard/src/extensions/publicHooks.d.ts +2 -0
  158. package/types/packages/whiteboard/src/extensions/runtime.d.ts +95 -0
  159. package/types/packages/whiteboard/src/extensions/text.d.ts +58 -0
  160. package/types/packages/whiteboard/src/extensions/versions.d.ts +2 -0
  161. package/types/packages/whiteboard/src/hooks/useBoardState.d.ts +6 -0
  162. package/types/packages/whiteboard/src/hooks/useDropArrow.d.ts +76 -0
  163. package/types/packages/whiteboard/src/hooks/useElementsMoving.d.ts +10 -0
  164. package/types/packages/whiteboard/src/hooks/useMindTheme.d.ts +8 -0
  165. package/types/packages/whiteboard/src/hooks/useSelectState.d.ts +10 -0
  166. package/types/packages/whiteboard/src/hooks/useSketch.d.ts +15 -0
  167. package/types/packages/whiteboard/src/index.d.ts +54 -0
  168. package/types/packages/whiteboard/src/interactions/InteractionManager.d.ts +68 -0
  169. package/types/packages/whiteboard/src/interactions/InteractionState.d.ts +28 -0
  170. package/types/packages/whiteboard/src/interactions/states/ResizingState.d.ts +40 -0
  171. package/types/packages/whiteboard/src/plugins/ArrowPlugin.d.ts +48 -0
  172. package/types/packages/whiteboard/src/plugins/AudioPlugin.d.ts +15 -0
  173. package/types/packages/whiteboard/src/plugins/ColumnPlugin.d.ts +81 -0
  174. package/types/packages/whiteboard/src/plugins/CommonPlugin.d.ts +104 -0
  175. package/types/packages/whiteboard/src/plugins/CopyPastePlugin.d.ts +38 -0
  176. package/types/packages/whiteboard/src/plugins/DocumentPlugin.d.ts +41 -0
  177. package/types/packages/whiteboard/src/plugins/ExportImagePlugin.d.ts +6 -0
  178. package/types/packages/whiteboard/src/plugins/FileDragDropPlugin.d.ts +15 -0
  179. package/types/packages/whiteboard/src/plugins/FramePlugin.d.ts +14 -0
  180. package/types/packages/whiteboard/src/plugins/GeometryPlugin.d.ts +31 -0
  181. package/types/packages/whiteboard/src/plugins/HandwritePlugin.d.ts +22 -0
  182. package/types/packages/whiteboard/src/plugins/ImagePlugin.d.ts +21 -0
  183. package/types/packages/whiteboard/src/plugins/MindPlugin.d.ts +72 -0
  184. package/types/packages/whiteboard/src/plugins/PresentationPlugin.d.ts +13 -0
  185. package/types/packages/whiteboard/src/plugins/RichTextPlugin.d.ts +44 -0
  186. package/types/packages/whiteboard/src/plugins/VideoPlugin.d.ts +14 -0
  187. package/types/packages/whiteboard/src/plugins/ViewPortPlugin.d.ts +13 -0
  188. package/types/packages/whiteboard/src/plugins/WebviewPlugin.d.ts +11 -0
  189. package/types/packages/whiteboard/src/plugins/WhiteBoardPlugin.d.ts +31 -0
  190. package/types/packages/whiteboard/src/plugins/index.d.ts +19 -0
  191. package/types/packages/whiteboard/src/public.d.ts +54 -0
  192. package/types/packages/whiteboard/src/schematic/PageSchematic.d.ts +13 -0
  193. package/types/packages/whiteboard/src/services/CapabilityService.d.ts +186 -0
  194. package/types/packages/whiteboard/src/transforms/SelectTransforms.d.ts +4 -0
  195. package/types/packages/whiteboard/src/transforms/SketchTransforms.d.ts +5 -0
  196. package/types/packages/whiteboard/src/transforms/ViewPortTransforms.d.ts +26 -0
  197. package/types/packages/whiteboard/src/transforms/index.d.ts +3 -0
  198. package/types/packages/whiteboard/src/types/arrow.d.ts +52 -0
  199. package/types/packages/whiteboard/src/types/audio.d.ts +8 -0
  200. package/types/packages/whiteboard/src/types/board.d.ts +79 -0
  201. package/types/packages/whiteboard/src/types/capabilities.d.ts +267 -0
  202. package/types/packages/whiteboard/src/types/column.d.ts +71 -0
  203. package/types/packages/whiteboard/src/types/element.d.ts +1 -0
  204. package/types/packages/whiteboard/src/types/frame.d.ts +35 -0
  205. package/types/packages/whiteboard/src/types/image.d.ts +19 -0
  206. package/types/packages/whiteboard/src/types/index.d.ts +33 -0
  207. package/types/packages/whiteboard/src/types/mind.d.ts +54 -0
  208. package/types/packages/whiteboard/src/types/resize.d.ts +16 -0
  209. package/types/packages/whiteboard/src/types/video.d.ts +20 -0
  210. package/types/packages/whiteboard/src/types/webview.d.ts +7 -0
  211. package/types/packages/whiteboard/src/utils/ArrowConnectTracker.d.ts +50 -0
  212. package/types/packages/whiteboard/src/utils/ArrowStyleUtil.d.ts +15 -0
  213. package/types/packages/whiteboard/src/utils/ArrowUtil.d.ts +11 -0
  214. package/types/packages/whiteboard/src/utils/AudioUtil.d.ts +20 -0
  215. package/types/packages/whiteboard/src/utils/BoardUtil.d.ts +101 -0
  216. package/types/packages/whiteboard/src/utils/CanvasUtil.d.ts +5 -0
  217. package/types/packages/whiteboard/src/utils/ClipboardUtil.d.ts +8 -0
  218. package/types/packages/whiteboard/src/utils/ColumnUtil.d.ts +125 -0
  219. package/types/packages/whiteboard/src/utils/ConnectPointOwner.d.ts +36 -0
  220. package/types/packages/whiteboard/src/utils/ConnectPointUtil.d.ts +66 -0
  221. package/types/packages/whiteboard/src/utils/Constraints.d.ts +6 -0
  222. package/types/packages/whiteboard/src/utils/ExportImageUtil.d.ts +14 -0
  223. package/types/packages/whiteboard/src/utils/FrameUtil.d.ts +90 -0
  224. package/types/packages/whiteboard/src/utils/GeometryUtil.d.ts +18 -0
  225. package/types/packages/whiteboard/src/utils/HandwriteGroupUtil.d.ts +25 -0
  226. package/types/packages/whiteboard/src/utils/HandwriteUtil.d.ts +39 -0
  227. package/types/packages/whiteboard/src/utils/ImageUtil.d.ts +13 -0
  228. package/types/packages/whiteboard/src/utils/LayerOrderUtil.d.ts +16 -0
  229. package/types/packages/whiteboard/src/utils/MindThemePreviewStore.d.ts +11 -0
  230. package/types/packages/whiteboard/src/utils/MindThemeUtil.d.ts +54 -0
  231. package/types/packages/whiteboard/src/utils/MindUtil.d.ts +65 -0
  232. package/types/packages/whiteboard/src/utils/PathUtil.d.ts +80 -0
  233. package/types/packages/whiteboard/src/utils/PointUtil.d.ts +50 -0
  234. package/types/packages/whiteboard/src/utils/PresentationManager.d.ts +53 -0
  235. package/types/packages/whiteboard/src/utils/RichTextContentUtil.d.ts +17 -0
  236. package/types/packages/whiteboard/src/utils/SelectionActionUtil.d.ts +9 -0
  237. package/types/packages/whiteboard/src/utils/TextStyleStore.d.ts +10 -0
  238. package/types/packages/whiteboard/src/utils/VideoUtil.d.ts +11 -0
  239. package/types/packages/whiteboard/src/utils/ViewportUtil.d.ts +10 -0
  240. package/types/packages/whiteboard/src/utils/common.d.ts +18 -0
  241. package/types/packages/whiteboard/src/utils/events.d.ts +13 -0
  242. package/types/packages/whiteboard/src/utils/index.d.ts +28 -0
  243. package/types/packages/whiteboard/src/utils/sketch/arrow.d.ts +29 -0
  244. package/types/packages/whiteboard/src/utils/sketch/batch.d.ts +10 -0
  245. package/types/packages/whiteboard/src/utils/sketch/index.d.ts +9 -0
  246. package/types/packages/whiteboard/src/utils/sketch/patch.d.ts +5 -0
  247. package/types/packages/whiteboard/src/utils/sketch/resolve.d.ts +14 -0
  248. package/types/packages/whiteboard/src/utils/snap/SnapGeometry.d.ts +52 -0
  249. package/types/packages/whiteboard/src/utils/snap/SnapManager.d.ts +57 -0
@@ -0,0 +1,66 @@
1
+ import { BoardElement, CustomOffset, Point } from "../types/index";
2
+ export type ConnectEdgeOrientation = "vertical" | "horizontal";
3
+ export interface CustomConnectCandidate {
4
+ point: Point;
5
+ customOffset: CustomOffset;
6
+ distance: number;
7
+ }
8
+ export interface ElementCustomConnectCandidate extends CustomConnectCandidate {
9
+ element: BoardElement & {
10
+ x: number;
11
+ y: number;
12
+ width: number;
13
+ height: number;
14
+ };
15
+ }
16
+ /**
17
+ * 计算"图形中心 → 鼠标"射线与图形 bbox 边缘的交点,作为自定义连接点候选。
18
+ *
19
+ * 采用 bbox slab 求交(与现有 5 个固定点同样基于 bbox 的模型一致):
20
+ * - 鼠标在 bbox 外时,交点为朝向鼠标一侧的近边点;
21
+ * - 鼠标在 bbox 内时,交点为鼠标所在方位的边点(鼠标位于中心与该边点之间)。
22
+ * 距离阈值过滤掉"鼠标深入图形内部"的情况——此时不吸附,保留为自由端点。
23
+ */
24
+ export declare const getCustomConnectCandidate: (element: BoardElement & {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ }, mousePoint: Point, zoom: number) => CustomConnectCandidate | null;
30
+ export declare const getNearestCustomConnectCandidate: (elements: BoardElement[], mousePoint: Point, zoom: number) => ElementCustomConnectCandidate | null;
31
+ /**
32
+ * 判断端点是否"落在图形 bbox 内部"(需要提升渲染层级避免被图形遮挡)。
33
+ *
34
+ * - center:始终为内部点(位于 bbox 中心);
35
+ * - custom:当 u、v 均严格处于 (0,1) 开区间时为内部点(非矩形几何图形的边缘交点可能落在 bbox 内);
36
+ * - top/bottom/left/right:位于 bbox 边界,不算内部。
37
+ * 仅依赖 ArrowBound 自身字段,无需绑定图形几何,便于在排序/导出等遍历中直接调用。
38
+ */
39
+ export declare const isInteriorConnectBound: (bound?: {
40
+ connectId?: string;
41
+ customOffset?: CustomOffset;
42
+ }) => boolean;
43
+ export declare const isInteriorConnectElement: (element: BoardElement) => boolean;
44
+ /**
45
+ * 根据连接点所在边缘的法线方向,决定正交线先走水平还是垂直。
46
+ * - top/bottom 边(法线垂直)→ 先垂直;
47
+ * - left/right 边(法线水平)→ 先水平;
48
+ * - custom 内部点或无法判定 → 返回 null,由调用方回退到距离启发式。
49
+ */
50
+ export declare const getConnectEdgeOrientation: (connectId?: string, customOffset?: CustomOffset) => ConnectEdgeOrientation | null;
51
+ declare const _default: {
52
+ getCustomConnectCandidate: (element: BoardElement & {
53
+ x: number;
54
+ y: number;
55
+ width: number;
56
+ height: number;
57
+ }, mousePoint: Point, zoom: number) => CustomConnectCandidate | null;
58
+ getNearestCustomConnectCandidate: (elements: BoardElement[], mousePoint: Point, zoom: number) => ElementCustomConnectCandidate | null;
59
+ isInteriorConnectBound: (bound?: {
60
+ connectId?: string;
61
+ customOffset?: CustomOffset;
62
+ }) => boolean;
63
+ isInteriorConnectElement: (element: BoardElement) => boolean;
64
+ getConnectEdgeOrientation: (connectId?: string, customOffset?: CustomOffset) => ConnectEdgeOrientation | null;
65
+ };
66
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { Board, BoardElement } from "../types/index";
2
+ /**
3
+ * 统一的嵌套约束(已迁移到能力系统)
4
+ * @deprecated 使用 board.capabilityService.canContain(parent, child) 代替
5
+ */
6
+ export declare function canNest(board: Board, parent: BoardElement, child: BoardElement): boolean;
@@ -0,0 +1,14 @@
1
+ import { Board, BoardElement, ElementBounds, Selection, ViewPort } from "../types/index";
2
+ export type ExportImageAction = "board" | "selection";
3
+ export type ExportImageBackgroundMode = "light" | "dark" | "transparent";
4
+ export declare const resolveExportElements: (params: {
5
+ board: Board;
6
+ action: ExportImageAction;
7
+ selectedElementIds?: string[];
8
+ }) => BoardElement[];
9
+ export declare const calculateExportBounds: (board: Board, elements: BoardElement[]) => ElementBounds | null;
10
+ export declare const createExportViewPort: (bounds: ElementBounds, padding: number) => ViewPort;
11
+ export declare const resolveExportBackgroundColor: (mode: ExportImageBackgroundMode) => string | null;
12
+ export declare const cloneSelection: (selection: Selection) => Selection;
13
+ export declare const createExportFilename: (action: ExportImageAction) => string;
14
+ export declare const downloadBlobAsFile: (blob: Blob, filename: string) => void;
@@ -0,0 +1,90 @@
1
+ import type { Board, BoardElement, ElementBounds } from "../types/board";
2
+ import { type FrameBorderStyle, type FrameElement, type FrameTitlePosition } from "../types/frame";
3
+ export declare class FrameUtil {
4
+ static readonly TITLE_HEIGHT = 40;
5
+ static readonly TITLE_GAP = 10;
6
+ static readonly INLINE_TITLE_HEIGHT = 32;
7
+ static getTitleY(frame: FrameElement): number;
8
+ static getInlineTopPadding(frame: FrameElement): number;
9
+ static setLocalStorage(key: string, value: string): void;
10
+ static getLocalStorage(key: string): string | null;
11
+ static getPrevFrameStyle(): {
12
+ readonly backgroundColor: string;
13
+ readonly borderColor: string;
14
+ readonly borderWidth: number;
15
+ readonly borderRadius: number;
16
+ };
17
+ static getPrevTitlePosition(): FrameTitlePosition;
18
+ static getPrevBorderStyle(): FrameBorderStyle;
19
+ static createFrame(x: number, y: number, width: number, height: number, title?: string): FrameElement;
20
+ static addChildToFrame(board: Board, frame: FrameElement, child: BoardElement): FrameElement;
21
+ static removeChildFromFrame(frame: FrameElement, childId: string): FrameElement;
22
+ /**
23
+ * 计算元素相对于Frame的位置
24
+ */
25
+ static getRelativePosition(element: BoardElement, frame: FrameElement): {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ /**
30
+ * 检查元素是否在Frame的边界内
31
+ */
32
+ static isElementInBounds(element: BoardElement, frame: FrameElement, padding?: number): boolean;
33
+ /**
34
+ * 检查元素是否在Frame内部
35
+ */
36
+ static isElementInFrame(element: BoardElement, frame: FrameElement, policy?: "full" | "partial"): boolean;
37
+ static calculateFrameBounds(board: Board, frame: FrameElement, children?: BoardElement[]): {
38
+ x: number;
39
+ y: number;
40
+ width: number;
41
+ height: number;
42
+ };
43
+ /**
44
+ * calculateFrameBounds 的纯函数形态:子元素包围盒由调用方提供
45
+ * (创建手势等无 Board 实例的场合复用同一套边界扩张规则)。
46
+ */
47
+ static calculateFrameBoundsFromBounds(frame: FrameElement, childBounds: readonly ElementBounds[]): {
48
+ x: number;
49
+ y: number;
50
+ width: number;
51
+ height: number;
52
+ };
53
+ /**
54
+ * 计算 Frame 的边界,使得 Frame 能够完全包含所有子元素
55
+ */
56
+ static calculateFrameFitBounds(board: Board, frame: FrameElement, children?: BoardElement[]): {
57
+ x: number;
58
+ y: number;
59
+ width: number;
60
+ height: number;
61
+ };
62
+ /**
63
+ * 调整Frame大小以适应所有子元素
64
+ */
65
+ static resizeToFitChildren(board: Board, frame: FrameElement): void;
66
+ /**
67
+ * 计算包围所有子元素的最小矩形
68
+ */
69
+ static calculateBoundingRect(board: Board, elements: BoardElement[]): {
70
+ x: number;
71
+ y: number;
72
+ width: number;
73
+ height: number;
74
+ };
75
+ /**
76
+ * 检查是否需要调整Frame大小
77
+ */
78
+ static shouldResizeFrame(board: Board, frame: FrameElement, children: BoardElement[], padding?: number): boolean;
79
+ static dfs(frame: BoardElement, { before, after, }: {
80
+ before?: (element: BoardElement, parent: BoardElement | null, index: number) => void;
81
+ after?: (element: BoardElement, parent: BoardElement | null, index: number) => void;
82
+ }, parent?: BoardElement | null, index?: number): void;
83
+ /**
84
+ * 移动 Frame 及其所有子元素
85
+ */
86
+ static moveAll(frame: FrameElement, dx: number, dy: number): FrameElement;
87
+ static getAllChildren(frame: FrameElement): BoardElement[];
88
+ static isChildInFrame(frame: FrameElement, child: BoardElement): boolean;
89
+ static unwrapFrame(board: Board, frame: FrameElement): boolean;
90
+ }
@@ -0,0 +1,18 @@
1
+ import type { SketchFillStyle } from "../types/index";
2
+ export declare class GeometryUtil {
3
+ static setLocalStorage(key: string, value: string | undefined): void;
4
+ static getLocalStorage(key: string): string | null;
5
+ private static getNumber;
6
+ static getPrevGeometryStyle(): {
7
+ readonly fill: string;
8
+ readonly fillOpacity: number;
9
+ readonly stroke: string;
10
+ readonly strokeWidth: number;
11
+ readonly strokeOpacity: number;
12
+ readonly color: string | undefined;
13
+ readonly theme: "dark" | "light" | undefined;
14
+ readonly cornerRadius: number;
15
+ readonly textAlign: "center" | "left" | "right";
16
+ readonly fillStyle: SketchFillStyle | undefined;
17
+ };
18
+ }
@@ -0,0 +1,25 @@
1
+ import { Board, BoardElement } from "../types/index";
2
+ interface HandwriteLikeElement extends BoardElement {
3
+ type: "handwrite";
4
+ groupId?: string;
5
+ }
6
+ export interface GroupSelectionBounds {
7
+ groupId: string;
8
+ minX: number;
9
+ minY: number;
10
+ maxX: number;
11
+ maxY: number;
12
+ }
13
+ export declare const isHandwriteElement: (element: BoardElement | null | undefined) => element is HandwriteLikeElement;
14
+ export declare const getElementGroupId: (element: BoardElement | null | undefined) => string | null;
15
+ export declare const collectGroupMembers: (board: Pick<Board, "children">, groupId: string) => BoardElement[];
16
+ export declare const getSelectedGroupBounds: (board: Pick<Board, "children" | "getBounds">, selectedElements: BoardElement[]) => GroupSelectionBounds[];
17
+ export declare const isPointInGroupBounds: (bounds: GroupSelectionBounds, x: number, y: number, padding?: number) => boolean;
18
+ export declare const isPointInAnySelectedGroupBounds: (board: Pick<Board, "children" | "getBounds">, selectedElements: BoardElement[], x: number, y: number, padding?: number) => boolean;
19
+ export declare const expandSelectionByGroup: (board: Pick<Board, "children">, elements: BoardElement[]) => BoardElement[];
20
+ export declare const isMergeableHandwriteSelection: (elements: BoardElement[]) => boolean;
21
+ export declare const getSharedHandwriteGroupId: (elements: BoardElement[]) => string | null;
22
+ export declare const collectHandwriteGroupMembers: (board: Pick<Board, "children">, groupId: string) => HandwriteLikeElement[];
23
+ export declare const expandSelectionByHandwriteGroup: (board: Pick<Board, "children">, elements: BoardElement[]) => BoardElement[];
24
+ export declare const applyHandwriteGroupIdPatch: (elements: BoardElement[], nextGroupId: string | null) => BoardElement[];
25
+ export {};
@@ -0,0 +1,39 @@
1
+ export declare const HANDWRITE_STYLE_STORAGE_KEY = "whiteboard-handwrite-style-v1";
2
+ export interface HandwriteStyle {
3
+ themeColorId: string;
4
+ opacity: number;
5
+ size: number;
6
+ thinning: number;
7
+ smoothing: number;
8
+ streamline: number;
9
+ simulatePressure: boolean;
10
+ startCap: boolean;
11
+ endCap: boolean;
12
+ }
13
+ export interface HandwriteInputPoint {
14
+ x: number;
15
+ y: number;
16
+ pressure: number;
17
+ }
18
+ export type HandwriteOutlinePoint = [number, number];
19
+ export interface HandwriteBounds {
20
+ x: number;
21
+ y: number;
22
+ width: number;
23
+ height: number;
24
+ }
25
+ export interface HandwriteGeometryData extends HandwriteBounds {
26
+ points: HandwriteInputPoint[];
27
+ outline: HandwriteOutlinePoint[];
28
+ }
29
+ export declare const getDefaultHandwriteStyle: () => HandwriteStyle;
30
+ export declare const getPrevHandwriteStyle: () => HandwriteStyle;
31
+ export declare const saveHandwriteStyle: (style: HandwriteStyle) => void;
32
+ export declare const buildStrokeOutline: (points: HandwriteInputPoint[], style: HandwriteStyle) => HandwriteOutlinePoint[];
33
+ export declare const getPointsBounds: (points: Array<HandwriteInputPoint | HandwriteOutlinePoint>) => HandwriteBounds | null;
34
+ export declare const normalizePoints: (points: HandwriteInputPoint[], bounds: HandwriteBounds) => HandwriteInputPoint[];
35
+ export declare const denormalizePoints: (points: HandwriteInputPoint[], bounds: HandwriteBounds) => HandwriteInputPoint[];
36
+ export declare const normalizeOutline: (points: HandwriteOutlinePoint[], bounds: HandwriteBounds) => HandwriteOutlinePoint[];
37
+ export declare const denormalizeOutline: (points: HandwriteOutlinePoint[], bounds: HandwriteBounds) => HandwriteOutlinePoint[];
38
+ export declare const outlineToSvgPath: (points: HandwriteOutlinePoint[]) => string;
39
+ export declare const rebuildHandwriteGeometry: (normalizedPoints: HandwriteInputPoint[], currentBounds: HandwriteBounds, style: HandwriteStyle) => HandwriteGeometryData | null;
@@ -0,0 +1,13 @@
1
+ import type { MediaCapabilities } from "../extensions/media";
2
+ import { Board } from "../types/index";
3
+ import { EShadowSize } from "../constants/index";
4
+ export declare class ImageUtil {
5
+ static setLocalStorage(key: string, value: string | undefined): void;
6
+ static getLocalStorage(key: string): string | null;
7
+ static getPrevImageStyle(): {
8
+ readonly shadowSize: EShadowSize;
9
+ };
10
+ static insertImage(file: File, board: Board, media: MediaCapabilities): Promise<void>;
11
+ private static getImageSizeFromUrl;
12
+ static insertImageFromPath(src: string, board: Board): Promise<void>;
13
+ }
@@ -0,0 +1,16 @@
1
+ import Board from "../Board";
2
+ import { BoardElement } from "../types/index";
3
+ export type LayerOrderAction = "move-up" | "move-down" | "move-top" | "move-bottom";
4
+ export interface LayerOrderActionState {
5
+ moveUpDisabled: boolean;
6
+ moveDownDisabled: boolean;
7
+ moveTopDisabled: boolean;
8
+ moveBottomDisabled: boolean;
9
+ }
10
+ export declare const getLayerOrderActionState: (board: Board, targets: BoardElement[]) => LayerOrderActionState;
11
+ export declare const executeLayerOrderAction: (board: Board, targets: BoardElement[], action: LayerOrderAction) => boolean;
12
+ declare const _default: {
13
+ getLayerOrderActionState: (board: Board, targets: BoardElement[]) => LayerOrderActionState;
14
+ executeLayerOrderAction: (board: Board, targets: BoardElement[], action: LayerOrderAction) => boolean;
15
+ };
16
+ export default _default;
@@ -0,0 +1,11 @@
1
+ export interface MindThemePreviewState {
2
+ previews: Record<string, {
3
+ themeId: string;
4
+ themeStyle: string;
5
+ }>;
6
+ setPreview(rootId: string, theme: {
7
+ themeId: string;
8
+ themeStyle: string;
9
+ } | null): void;
10
+ }
11
+ export declare const createMindThemePreviewStore: () => import("zustand").StoreApi<MindThemePreviewState>;
@@ -0,0 +1,54 @@
1
+ import { type MindThemeStyle } from "../constants/mind-themes";
2
+ import { type Tone } from "../../../shared/color-utils";
3
+ export type MindMode = "light" | "dark";
4
+ export interface MindNodeVisual {
5
+ background: string;
6
+ textColor: string;
7
+ borderColor: string;
8
+ borderWidth: number;
9
+ borderRadius: number;
10
+ /** 富文本编辑器的明暗(决定链接、代码块等内嵌元素的配色) */
11
+ editorTheme: MindMode;
12
+ /** 指向该节点的连线 */
13
+ lineColor: string;
14
+ lineWidth: number;
15
+ /** 折叠指示器 / 笔记点等小部件的底色与前景 */
16
+ accent: string;
17
+ accentText: string;
18
+ }
19
+ /** 文字对比度下限(WCAG AA 正文) */
20
+ export declare const MIN_TEXT_CONTRAST = 4.5;
21
+ /** 连线、描边等非文字元素的对比度下限(WCAG 1.4.11) */
22
+ export declare const MIN_LINE_CONTRAST = 3;
23
+ /**
24
+ * 画布参考底色:取各应用主题里对比度最差的一档
25
+ * (浅色取偏暗的 page 底,深色取偏亮的 surface 底),保证在所有应用主题下都达标。
26
+ */
27
+ export declare const CANVAS_TONE: Record<MindMode, Tone>;
28
+ export interface MindThemeRef {
29
+ themeId?: string;
30
+ themeStyle?: string;
31
+ }
32
+ interface TreeNode {
33
+ id: string;
34
+ children?: TreeNode[];
35
+ }
36
+ export declare class MindThemeUtil {
37
+ private static STORAGE_KEY;
38
+ private static STYLE_STORAGE_KEY;
39
+ static resolveStyle(style: string | undefined): MindThemeStyle;
40
+ /**
41
+ * 节点视觉。branchIndex 为所属二级分支在根节点 children 中的序号(根节点传 -1)。
42
+ * 结果按参数缓存,渲染时可以放心调用。
43
+ */
44
+ static getNodeVisual(theme: MindThemeRef, level: number, branchIndex: number, mode: MindMode): MindNodeVisual;
45
+ /** 节点 id → 所属二级分支序号;按根对象缓存(immer 下树不变则对象不变) */
46
+ static getBranchIndexMap(root: TreeNode): Map<string, number>;
47
+ static getBranchIndex(root: TreeNode | null | undefined, nodeId: string): number;
48
+ static getDefaultThemeId(): string;
49
+ static getDefaultThemeStyle(): MindThemeStyle;
50
+ static saveDefault(themeId: string, themeStyle: MindThemeStyle): void;
51
+ /** 根节点上的主题;缺省时回落到用户默认 */
52
+ static getThemeOf(root: MindThemeRef | null | undefined): Required<MindThemeRef>;
53
+ }
54
+ export default MindThemeUtil;
@@ -0,0 +1,65 @@
1
+ import { Board, ElementBounds, MindNodeElement, MindDragTarget } from "../types/index";
2
+ export declare const MIND_DRAG_HORIZONTAL_THRESHOLD_PX = 120;
3
+ export declare const MIND_DRAG_VERTICAL_THRESHOLD_PX = 80;
4
+ export declare const MIND_DRAG_TARGET_RETENTION_SCALE = 1.2;
5
+ export declare class MindUtil {
6
+ static isRoot(node: MindNodeElement): boolean;
7
+ static layout(node: MindNodeElement): MindNodeElement;
8
+ static relayoutAffectedRootsAfterMindMove(board: Board, movedMindNodeId: string, sourceRootId?: string | null): void;
9
+ /** 可见子树(跳过折叠分支)的包围盒;与 MindPlugin.getBounds 同一规则 */
10
+ static getSubtreeBounds(node: MindNodeElement): ElementBounds;
11
+ static dfs(node: MindNodeElement, { before, after, }: {
12
+ before?: (node: MindNodeElement, parent: MindNodeElement | null, index: number) => void;
13
+ after?: (node: MindNodeElement, parent: MindNodeElement | null, index: number) => void;
14
+ }, parent?: MindNodeElement | null, index?: number, skipFolded?: boolean): void;
15
+ static moveAll(root: MindNodeElement, dx: number, dy: number): MindNodeElement;
16
+ static createRootDragLayout(root: MindNodeElement, position: {
17
+ x: number;
18
+ y: number;
19
+ }, direction: "left" | "right" | null): MindNodeElement;
20
+ static getParent(root: MindNodeElement, node: MindNodeElement): MindNodeElement | null;
21
+ static getRoot(board: Board, node: MindNodeElement): MindNodeElement | null;
22
+ static addChild(root: MindNodeElement, node: MindNodeElement, afterNode?: MindNodeElement, newChild?: MindNodeElement, fontSize?: number): MindNodeElement;
23
+ /**
24
+ * 为根节点添加指定方向的子节点
25
+ */
26
+ static addChildWithDirection(root: MindNodeElement, node: MindNodeElement, direction: "left" | "right", fontSize?: number): MindNodeElement;
27
+ static addChildBefore(root: MindNodeElement, node: MindNodeElement, beforeNode?: MindNodeElement, newChild?: MindNodeElement): MindNodeElement;
28
+ static addSibling(root: MindNodeElement, node: MindNodeElement, newSibling?: MindNodeElement, fontSize?: number): MindNodeElement | undefined;
29
+ static addSiblingBefore(root: MindNodeElement, node: MindNodeElement, newSibling?: MindNodeElement): MindNodeElement | undefined;
30
+ static deleteNode(root: MindNodeElement, node: MindNodeElement): MindNodeElement;
31
+ static deleteNodes(root: MindNodeElement, nodes: MindNodeElement[]): MindNodeElement;
32
+ static getChildrenByNode(node: MindNodeElement): MindNodeElement[];
33
+ static moveNodeUp(root: MindNodeElement, node: MindNodeElement): MindNodeElement | null;
34
+ static moveNodeDown(root: MindNodeElement, node: MindNodeElement): MindNodeElement | null;
35
+ static toggleFold(root: MindNodeElement, node: MindNodeElement, direction: "left" | "right"): MindNodeElement;
36
+ static calculateDragTargetDistance(draggedNode: MindNodeElement, candidateParent: MindNodeElement, direction: "left" | "right", zoom: number): Omit<MindDragTarget, "node" | "insertIndex"> | null;
37
+ /**
38
+ * 递归更新节点及其所有子节点的 direction
39
+ */
40
+ static updateNodeDirectionAndLevel(node: MindNodeElement, newDirection: "left" | "right", parentLevel: number): void;
41
+ /**
42
+ * 检查目标节点是否是被拖拽节点的子孙节点
43
+ * @param draggedNode 被拖拽的节点
44
+ * @param targetNode 要检查的目标节点
45
+ * @returns 如果目标节点是被拖拽节点的子孙节点,返回 true
46
+ */
47
+ static isDescendantOf(draggedNode: MindNodeElement, targetNode: MindNodeElement): boolean;
48
+ static findNearestMindNode(board: Board, dragNode: MindNodeElement, currentTarget?: MindDragTarget | null): MindDragTarget | null;
49
+ static calculateInsertPosition(parentNode: MindNodeElement, dragCenterPoint: {
50
+ x: number;
51
+ y: number;
52
+ }, direction: "left" | "right", draggedNodeId?: string): Pick<MindDragTarget, "node" | "insertIndex" | "direction">;
53
+ static moveNodeToNewParent(sourceRoot: MindNodeElement, targetRoot: MindNodeElement, nodeToMove: MindNodeElement, newParent: MindNodeElement, insertIndex: number, direction: "left" | "right"): MindNodeElement;
54
+ static moveNodeToSpecificPosition(sourceRoot: MindNodeElement, targetRoot: MindNodeElement, nodeToMove: MindNodeElement, targetParent: MindNodeElement, insertIndex: number, direction: "left" | "right"): MindNodeElement;
55
+ static createNewRootNode(node: MindNodeElement, position: {
56
+ x: number;
57
+ y: number;
58
+ }): MindNodeElement;
59
+ static findParentInTree(root: MindNodeElement, childId: string): MindNodeElement | null;
60
+ static findNodeInTree(root: MindNodeElement, nodeId: string): MindNodeElement | null;
61
+ static canMoveNode(root: MindNodeElement, node: MindNodeElement): boolean;
62
+ static isValidDrop(draggedNode: MindNodeElement, targetNode: MindNodeElement): boolean;
63
+ static getDefaultThemeId(): string;
64
+ }
65
+ export default MindUtil;
@@ -0,0 +1,80 @@
1
+ import { BoardElement, Board, Operation } from "../types/index";
2
+ export type Path = number[];
3
+ export declare class PathUtil {
4
+ static getPathByElement(board: Board, element: BoardElement & any): Path | null;
5
+ static getElementByPath(board: Board, path: number[]): BoardElement;
6
+ static getElement(children: BoardElement[], path: Path): BoardElement | null;
7
+ static getParentByPath(board: Board, path: Path): Board | BoardElement | null;
8
+ /**
9
+ * 根据已执行的操作转换路径
10
+ * 这是解决批量操作中路径失效问题的核心方法
11
+ * @param path 要转换的路径
12
+ * @param operation 已执行的操作
13
+ * @param targetOpType 目标路径所属的操作类型(可选)
14
+ */
15
+ static transformPath(path: Path, operation: Operation, targetOpType?: string): Path | null;
16
+ private static transformPathByMove;
17
+ private static adjustPathIndex;
18
+ /**
19
+ * 判断 ancestorPath 是否是 descendantPath 的祖先路径
20
+ */
21
+ private static isAncestorPath;
22
+ /**
23
+ * 判断两个路径是否相等
24
+ */
25
+ private static pathsEqual;
26
+ /**
27
+ * 检查路径是否在指定操作索引之后被删除(或其祖先路径被删除)
28
+ * 这个方法考虑操作的执行顺序
29
+ */
30
+ private static isPathDeletedBeforeIndex;
31
+ /**
32
+ * 过滤掉无效的操作(父元素被删除等)
33
+ * 包括祖先-子孙关系过滤:删除祖先时自动过滤子孙删除操作
34
+ * 考虑操作顺序:对于move_node,如果先move再删除,则move操作有效
35
+ * 返回过滤后的原始操作,用于保存到历史记录
36
+ *
37
+ * 性能优化:使用Set和Map加速路径查找和比较
38
+ */
39
+ static filterValidOperations(operations: Operation[], skipValidation?: (operation: Operation) => boolean): Operation[];
40
+ /**
41
+ * 过滤祖先-子孙关系的路径
42
+ * 如果删除了祖先路径,其子孙路径的删除就是冗余的
43
+ */
44
+ private static filterAncestorDescendantPaths;
45
+ /**
46
+ * 简化的操作排序:只保证基本的执行顺序
47
+ * 插入操作需要按深度排序,确保父元素先于子元素创建
48
+ */
49
+ static sortOperationsForExecution(operations: Operation[]): Operation[];
50
+ /**
51
+ * 转换有效操作:基于原始操作路径计算累积影响,避免转换链式误差
52
+ * 性能优化:缓存路径变换结果,避免重复计算
53
+ */
54
+ static transformValidOperations(operations: Operation[]): Operation[];
55
+ /**
56
+ * 计算一系列操作对目标路径的累积影响
57
+ * 基于原始操作路径,按执行顺序计算影响
58
+ * @param targetPath 目标路径
59
+ * @param precedingOps 前序操作列表
60
+ * @param targetOpType 目标路径所属的操作类型(可选)
61
+ */
62
+ private static calculateCumulativePathTransform;
63
+ /**
64
+ * 检查路径是否会被特定操作影响
65
+ */
66
+ private static pathWouldBeAffected;
67
+ /**
68
+ * 直接应用单个操作对路径的影响
69
+ * @param targetPath 目标路径
70
+ * @param opType 操作类型
71
+ * @param opPath 操作路径
72
+ * @param targetOpType 目标路径所属的操作类型(可选)
73
+ */
74
+ private static applyDirectTransform;
75
+ /**
76
+ * 检查操作是否有路径需要转换
77
+ */
78
+ private static operationHasPath;
79
+ }
80
+ export default PathUtil;
@@ -0,0 +1,50 @@
1
+ import { Board, EHandlerPosition, Point, BBox } from "../types/index";
2
+ export declare class PointUtil {
3
+ /** 指针热路径坐标转换:走 Board 的容器矩形缓存,避免每次 pointermove 强制整文档重排 */
4
+ static screenToViewPort(board: Board, x: number, y: number): {
5
+ x: number;
6
+ y: number;
7
+ } | null;
8
+ /** screenToViewPort 的反向:画布坐标 → 屏幕(client)坐标;容器未挂载返回 null */
9
+ static viewPortToScreen(board: Board, x: number, y: number): {
10
+ x: number;
11
+ y: number;
12
+ } | null;
13
+ static getResizePointFromRect(rect: BBox): {
14
+ "top-left": {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ top: {
19
+ x: number;
20
+ y: number;
21
+ };
22
+ "top-right": {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ left: {
27
+ x: number;
28
+ y: number;
29
+ };
30
+ right: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ "bottom-left": {
35
+ x: number;
36
+ y: number;
37
+ };
38
+ bottom: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ "bottom-right": {
43
+ x: number;
44
+ y: number;
45
+ };
46
+ };
47
+ static getResizedBBox(bbox: BBox, position: EHandlerPosition, anchor: Point, focus: Point): BBox;
48
+ static getResizeCursor(position: EHandlerPosition): "move" | "e-resize" | "n-resize" | "ne-resize" | "nw-resize" | "s-resize" | "se-resize" | "sw-resize" | "w-resize";
49
+ }
50
+ export default PointUtil;
@@ -0,0 +1,53 @@
1
+ import { BoardElement, ViewPort, Board, PresentationSequence, PresentationFrame } from "../types/index";
2
+ export declare class PresentationManager {
3
+ private board;
4
+ private _sequences;
5
+ private _currentSequence;
6
+ private _currentFrameIndex;
7
+ private _isPresentationMode;
8
+ private _isCreatingSequence;
9
+ private originalReadonly;
10
+ private eventEmitter;
11
+ constructor(board: Board, initialSequences?: PresentationSequence[]);
12
+ on(event: string, listener: (...args: any[]) => void): void;
13
+ off(event: string, listener: (...args: any[]) => void): void;
14
+ emit(event: string, ...args: any[]): void;
15
+ once(event: string, listener: (...args: any[]) => void): void;
16
+ get isPresentationMode(): boolean;
17
+ set isPresentationMode(value: boolean);
18
+ get isCreatingSequence(): boolean;
19
+ set isCreatingSequence(value: boolean);
20
+ get sequences(): PresentationSequence[];
21
+ set sequences(value: PresentationSequence[]);
22
+ publishSequences(value: PresentationSequence[]): void;
23
+ get currentSequence(): PresentationSequence | null;
24
+ set currentSequence(value: PresentationSequence | null);
25
+ get currentFrameIndex(): number | null;
26
+ set currentFrameIndex(value: number);
27
+ startCreatingSequence(): void;
28
+ stopCreatingSequence(): void;
29
+ getCurrentSequenceFrames(): {
30
+ frames: PresentationFrame[];
31
+ name: string;
32
+ id?: string;
33
+ } | null;
34
+ saveSequence(name: string, frames: PresentationFrame[], sequenceId?: string): PresentationSequence;
35
+ startPresentationMode(sequenceId: string): void;
36
+ stopPresentationMode(): void;
37
+ showCurrentFrame(animate?: boolean): Promise<void>;
38
+ getElementsByIds(elementIds: Set<string>): BoardElement[];
39
+ nextFrame(animate?: boolean): Promise<boolean>;
40
+ prevFrame(animate?: boolean): Promise<boolean>;
41
+ addSequence(name: string, frames: PresentationFrame[]): PresentationSequence;
42
+ updateSequence(sequence: PresentationSequence): PresentationSequence;
43
+ deleteSequence(id: string): boolean;
44
+ setCurrentSequence(id: string): boolean;
45
+ goToNextFrame(): boolean;
46
+ goToPrevFrame(): boolean;
47
+ goToFrame(index: number): boolean;
48
+ createFrame(_viewPort: ViewPort, elements: BoardElement[]): PresentationFrame;
49
+ createFrameFromSelectedElements(board: Board): PresentationFrame | null;
50
+ isElementInViewport(element: BoardElement, viewPort: ViewPort): boolean;
51
+ getElementsInViewport(elements: BoardElement[], viewPort: ViewPort): BoardElement[];
52
+ fitElementsInViewport(elements: BoardElement[], padding?: number): ViewPort | null;
53
+ }
@@ -0,0 +1,17 @@
1
+ import type { TextExtensionOptions } from "../extensions/text";
2
+ import { Descendant } from "slate";
3
+ export declare const createEmptyRichTextContent: () => Descendant[];
4
+ export declare const isRichTextContentEmpty: (content: Descendant[] | undefined) => boolean;
5
+ /** 结构化的提交守门宿主:Board 与扩展 WhiteboardAPI 都满足 */
6
+ interface SubmissionHost {
7
+ readonly readonly: boolean;
8
+ readonly isDestroyed: boolean;
9
+ captureSubmission?(): () => boolean;
10
+ }
11
+ /**
12
+ * 新建富文本前先建好 content:ContentEditor 以 contentId 为 key,
13
+ * 元素落位后再补 contentId 会重挂编辑器、丢掉刚拿到的焦点。
14
+ * 建不出来时返回 undefined,元素仍可插入,聚焦时由 RichText 兜底补建。
15
+ */
16
+ export declare const createRichTextContentId: (content: Descendant[], board: SubmissionHost, binding?: Pick<TextExtensionOptions, "create" | "release" | "countWords">) => Promise<number | undefined>;
17
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Board, BoardElement } from "../types/index";
2
+ export declare const deleteBoardElements: (board: Board, elements: BoardElement[]) => boolean;
3
+ /**
4
+ * 空白富文本失焦即回收:新建后一个字没打就点走的元素不留在画布上。
5
+ * 仅处理 richtext(card 指向已有卡片),已建过卡片 / 文章的不动;
6
+ * 在列内时先记住父列,删完再按最新状态重排。
7
+ */
8
+ export declare const deleteEmptyRichText: (board: Board, element: BoardElement) => boolean;
9
+ export default deleteBoardElements;
@@ -0,0 +1,10 @@
1
+ import { TextStyle } from "../constants/index";
2
+ /** 记住上一次选的外观,新建同类元素时沿用;只存语义,旧版色值键不再读取 */
3
+ export declare class TextStyleStore {
4
+ private readonly prefix;
5
+ private readonly fallback;
6
+ constructor(prefix: string, fallback: TextStyle);
7
+ save(style: TextStyle): void;
8
+ load(): TextStyle;
9
+ }
10
+ export declare const RichTextUtil: TextStyleStore;