@xiongtao.xt/tau-plugins 0.44.0 → 0.45.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 (246) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/client/{chunk-UTVEXGFI.js → chunk-CEWYJJKJ.js} +12 -1
  3. package/client/{fuse-KWYBABFA.js → fuse-OHBNZPDB.js} +1 -1
  4. package/docs/README.md +2 -2
  5. package/docs/api-support.md +17 -4
  6. package/docs/editor-collaboration.md +146 -0
  7. package/docs/editor.md +30 -27
  8. package/docs/getting-started.md +3 -3
  9. package/docs/portability.md +7 -3
  10. package/docs/providers/asr.md +3 -1
  11. package/docs/providers/tts.md +15 -0
  12. package/docs/release.md +1 -1
  13. package/docs/whiteboard-collaboration.md +67 -0
  14. package/docs/whiteboard.md +55 -13
  15. package/package.js +1 -1
  16. package/package.json +5 -4
  17. package/portable.js +1 -1
  18. package/publish-artifacts.js +17975 -76
  19. package/publish-client.js +2 -2
  20. package/types/packages/collaboration/src/protocol.d.ts +144 -0
  21. package/types/packages/collaboration/src/whiteboard-contract.d.ts +6 -0
  22. package/types/packages/collaboration/src/whiteboard-types.d.ts +181 -0
  23. package/types/packages/collaboration/whiteboard-types.d.ts +1 -0
  24. package/types/packages/db-schema/content-contracts.d.ts +4 -1
  25. package/types/packages/db-schema/content-identities.d.ts +19 -0
  26. package/types/packages/db-schema/data-versions.d.ts +16 -0
  27. package/types/packages/editor/source-contracts.d.ts +13 -41
  28. package/types/packages/editor/src/Editor.d.ts +7 -0
  29. package/types/packages/editor/src/builtin-types.d.ts +22 -0
  30. package/types/packages/editor/src/core/CoreEditor.d.ts +44 -0
  31. package/types/packages/editor/src/core/api/elementView.d.ts +14 -0
  32. package/types/packages/editor/src/core/api/extension.d.ts +3 -8
  33. package/types/packages/editor/src/core/api/index.d.ts +5 -0
  34. package/types/packages/editor/src/core/api/slateTextFields.d.ts +6 -0
  35. package/types/packages/editor/src/core/api/textFieldInput.d.ts +14 -0
  36. package/types/packages/editor/src/core/document/EditorDocument.d.ts +74 -0
  37. package/types/packages/editor/src/core/extensions/markdown-paste-import/index.d.ts +10 -0
  38. package/types/packages/editor/src/core/hooks/useTouchVoidSelection.d.ts +10 -0
  39. package/types/packages/editor/src/core/index.d.ts +36 -0
  40. package/types/packages/editor/src/core/menu/defaultMenu.d.ts +2 -0
  41. package/types/packages/editor/src/core/plugins/withMarkdownPasteImport.d.ts +17 -0
  42. package/types/packages/editor/src/core/services/elementEditingPolicy.d.ts +0 -1
  43. package/types/packages/editor/src/core/utils/blockNavigation.d.ts +1 -1
  44. package/types/packages/editor/src/core/utils/editor.d.ts +2 -2
  45. package/types/packages/editor/src/core/utils/hotkey.d.ts +17 -0
  46. package/types/packages/editor/src/core/utils/index.d.ts +9 -0
  47. package/types/packages/editor/src/core/utils/normalizeEditorContent.d.ts +2 -0
  48. package/types/packages/editor/src/core/utils/plugin.d.ts +1 -1
  49. package/types/packages/editor/src/extensions/annotation/src/augmentations.d.ts +9 -0
  50. package/types/packages/editor/src/extensions/annotation/src/types.d.ts +6 -0
  51. package/types/packages/editor/src/extensions/blockquote/src/augmentations.d.ts +6 -0
  52. package/types/packages/editor/src/extensions/blockquote/src/types.d.ts +7 -0
  53. package/types/packages/editor/src/extensions/callout/src/augmentations.d.ts +6 -0
  54. package/types/packages/editor/src/extensions/callout/src/types.d.ts +11 -0
  55. package/types/packages/editor/src/extensions/callout/src/variants.d.ts +1 -0
  56. package/types/packages/editor/src/extensions/code-block/src/augmentations.d.ts +7 -0
  57. package/types/packages/editor/src/extensions/code-block/src/types/code-block.d.ts +40 -0
  58. package/types/packages/editor/src/extensions/code-block/src/types/index.d.ts +1 -0
  59. package/types/packages/editor/src/extensions/comment/src/augmentations.d.ts +9 -0
  60. package/types/packages/editor/src/extensions/comment/src/types.d.ts +15 -0
  61. package/types/packages/editor/src/extensions/detail/src/augmentations.d.ts +6 -0
  62. package/types/packages/editor/src/extensions/detail/src/types.d.ts +9 -0
  63. package/types/packages/editor/src/extensions/diagram/src/augmentations.d.ts +7 -0
  64. package/types/packages/editor/src/extensions/diagram/src/types/index.d.ts +4 -0
  65. package/types/packages/editor/src/extensions/diagram/src/types/mermaid.d.ts +12 -0
  66. package/types/packages/editor/src/extensions/diagram/src/types/plantuml.d.ts +6 -0
  67. package/types/packages/editor/src/extensions/diagram/src/types/typst.d.ts +9 -0
  68. package/types/packages/editor/src/extensions/divide-line/src/augmentations.d.ts +6 -0
  69. package/types/packages/editor/src/extensions/divide-line/src/types.d.ts +5 -0
  70. package/types/packages/editor/src/extensions/emoji/src/augmentations.d.ts +9 -0
  71. package/types/packages/editor/src/extensions/emoji/src/types.d.ts +9 -0
  72. package/types/packages/editor/src/extensions/front-matter/src/augmentations.d.ts +6 -0
  73. package/types/packages/editor/src/extensions/front-matter/src/types.d.ts +6 -0
  74. package/types/packages/editor/src/extensions/header/src/augmentations.d.ts +6 -0
  75. package/types/packages/editor/src/extensions/header/src/types.d.ts +8 -0
  76. package/types/packages/editor/src/extensions/highlight-block/src/augmentations.d.ts +6 -0
  77. package/types/packages/editor/src/extensions/highlight-block/src/types.d.ts +10 -0
  78. package/types/packages/editor/src/extensions/highlight-block/src/variants.d.ts +1 -0
  79. package/types/packages/editor/src/extensions/kbd/src/augmentations.d.ts +9 -0
  80. package/types/packages/editor/src/extensions/kbd/src/types.d.ts +5 -0
  81. package/types/packages/editor/src/extensions/link/src/augmentations.d.ts +9 -0
  82. package/types/packages/editor/src/extensions/link/src/types.d.ts +6 -0
  83. package/types/packages/editor/src/extensions/list/src/augmentations.d.ts +10 -0
  84. package/types/packages/editor/src/extensions/list/src/types/check-list.d.ts +25 -0
  85. package/types/packages/editor/src/extensions/list/src/types/list.d.ts +18 -0
  86. package/types/packages/editor/src/extensions/list/src/types.d.ts +3 -0
  87. package/types/packages/editor/src/extensions/math/src/augmentations.d.ts +10 -0
  88. package/types/packages/editor/src/extensions/math/src/types.d.ts +11 -0
  89. package/types/packages/editor/src/extensions/media/src/augmentations.d.ts +15 -0
  90. package/types/packages/editor/src/extensions/media/src/components/ImageCropEditor/geometry.d.ts +119 -0
  91. package/types/packages/editor/src/extensions/media/src/types/element/audio.d.ts +13 -0
  92. package/types/packages/editor/src/extensions/media/src/types/element/image-appearance.d.ts +2 -0
  93. package/types/packages/editor/src/extensions/media/src/types/element/image.d.ts +31 -0
  94. package/types/packages/editor/src/extensions/media/src/types/element/inline-image.d.ts +10 -0
  95. package/types/packages/editor/src/extensions/media/src/types/element/video.d.ts +21 -0
  96. package/types/packages/editor/src/extensions/styled-text/src/augmentations.d.ts +9 -0
  97. package/types/packages/editor/src/extensions/styled-text/src/colors.d.ts +75 -0
  98. package/types/packages/editor/src/extensions/styled-text/src/types.d.ts +7 -0
  99. package/types/packages/editor/src/extensions/table/src/align.d.ts +2 -0
  100. package/types/packages/editor/src/extensions/table/src/augmentations.d.ts +8 -0
  101. package/types/packages/editor/src/extensions/table/src/types.d.ts +19 -0
  102. package/types/packages/editor/src/extensions/tabs/src/augmentations.d.ts +7 -0
  103. package/types/packages/editor/src/extensions/tabs/src/types.d.ts +29 -0
  104. package/types/packages/editor/src/extensions/underline/src/augmentations.d.ts +9 -0
  105. package/types/packages/editor/src/extensions/underline/src/types.d.ts +8 -0
  106. package/types/packages/editor/src/extensions/webview/src/augmentations.d.ts +6 -0
  107. package/types/packages/editor/src/extensions/webview/src/types.d.ts +14 -0
  108. package/types/packages/editor/src/index.d.ts +4 -0
  109. package/types/packages/editor/src/presets/default.d.ts +2 -0
  110. package/types/packages/editor/text-field-contract.d.ts +36 -0
  111. package/types/packages/plugins/src/content-input.d.ts +1 -0
  112. package/types/packages/plugins/src/data.d.ts +1 -0
  113. package/types/packages/plugins/src/flashcards.d.ts +2 -0
  114. package/types/packages/plugins/src/whiteboard.d.ts +3 -2
  115. package/types/packages/shared/color-utils.d.ts +19 -0
  116. package/types/packages/shared/media-services.d.ts +18 -0
  117. package/types/packages/shared/media-types.d.ts +1 -0
  118. package/types/packages/shared/src/task-assistant/contracts.d.ts +119 -0
  119. package/types/packages/shared/src/task-assistant/document-state.d.ts +14 -0
  120. package/types/packages/shared/src/task-assistant/schema.d.ts +42 -0
  121. package/types/packages/shared/task-assistant.d.ts +3 -0
  122. package/types/packages/whiteboard/src/Board.d.ts +180 -0
  123. package/types/packages/whiteboard/src/WhiteBoard.d.ts +53 -0
  124. package/types/packages/whiteboard/src/author.d.ts +5 -3
  125. package/types/packages/whiteboard/src/components/ArrowConnectPointGroup/index.d.ts +13 -0
  126. package/types/packages/whiteboard/src/components/ArrowDropConnectPoint/index.d.ts +7 -0
  127. package/types/packages/whiteboard/src/components/DocumentElement/index.d.ts +13 -0
  128. package/types/packages/whiteboard/src/components/ResizeCircle/index.d.ts +15 -0
  129. package/types/packages/whiteboard/src/components/SketchPaths/SketchRect.d.ts +21 -0
  130. package/types/packages/whiteboard/src/components/Toolbar/ToolMenu.d.ts +15 -0
  131. package/types/packages/whiteboard/src/constants/arrow.d.ts +19 -0
  132. package/types/packages/whiteboard/src/constants/boardIdentity.d.ts +2 -0
  133. package/types/packages/whiteboard/src/constants/geometry.d.ts +7 -0
  134. package/types/packages/whiteboard/src/constants/grid.d.ts +4 -0
  135. package/types/packages/whiteboard/src/constants/image.d.ts +21 -0
  136. package/types/packages/whiteboard/src/constants/index.d.ts +13 -0
  137. package/types/packages/whiteboard/src/constants/map.d.ts +2 -0
  138. package/types/packages/whiteboard/src/constants/mind-themes.d.ts +30 -0
  139. package/types/packages/whiteboard/src/constants/mind.d.ts +14 -0
  140. package/types/packages/whiteboard/src/constants/resize.d.ts +2 -0
  141. package/types/packages/whiteboard/src/constants/select.d.ts +4 -0
  142. package/types/packages/whiteboard/src/constants/shadow.d.ts +12 -0
  143. package/types/packages/whiteboard/src/constants/sketch.d.ts +16 -0
  144. package/types/packages/whiteboard/src/constants/text-style.d.ts +68 -0
  145. package/types/packages/whiteboard/src/constants/tools.d.ts +11 -0
  146. package/types/packages/whiteboard/src/constants/viewport.d.ts +3 -0
  147. package/types/packages/whiteboard/src/document-version.d.ts +9 -0
  148. package/types/packages/whiteboard/src/document.d.ts +47 -0
  149. package/types/packages/whiteboard/src/extensions/api.d.ts +9 -0
  150. package/types/packages/whiteboard/src/extensions/authorApi.d.ts +10 -0
  151. package/types/packages/whiteboard/src/extensions/authorHooks.d.ts +2 -2
  152. package/types/packages/whiteboard/src/extensions/authorTypes.d.ts +150 -0
  153. package/types/packages/whiteboard/src/extensions/media.d.ts +50 -0
  154. package/types/packages/whiteboard/src/extensions/publicHooks.d.ts +2 -0
  155. package/types/packages/whiteboard/src/extensions/runtime.d.ts +95 -0
  156. package/types/packages/whiteboard/src/extensions/text.d.ts +58 -0
  157. package/types/packages/whiteboard/src/extensions/versions.d.ts +2 -0
  158. package/types/packages/whiteboard/src/hooks/useBoardState.d.ts +6 -0
  159. package/types/packages/whiteboard/src/hooks/useDropArrow.d.ts +76 -0
  160. package/types/packages/whiteboard/src/hooks/useElementsMoving.d.ts +10 -0
  161. package/types/packages/whiteboard/src/hooks/useMindTheme.d.ts +8 -0
  162. package/types/packages/whiteboard/src/hooks/useSelectState.d.ts +10 -0
  163. package/types/packages/whiteboard/src/hooks/useSketch.d.ts +15 -0
  164. package/types/packages/whiteboard/src/index.d.ts +54 -0
  165. package/types/packages/whiteboard/src/interactions/InteractionManager.d.ts +68 -0
  166. package/types/packages/whiteboard/src/interactions/InteractionState.d.ts +28 -0
  167. package/types/packages/whiteboard/src/interactions/states/ResizingState.d.ts +40 -0
  168. package/types/packages/whiteboard/src/plugins/ArrowPlugin.d.ts +48 -0
  169. package/types/packages/whiteboard/src/plugins/AudioPlugin.d.ts +15 -0
  170. package/types/packages/whiteboard/src/plugins/ColumnPlugin.d.ts +81 -0
  171. package/types/packages/whiteboard/src/plugins/CommonPlugin.d.ts +104 -0
  172. package/types/packages/whiteboard/src/plugins/CopyPastePlugin.d.ts +38 -0
  173. package/types/packages/whiteboard/src/plugins/DocumentPlugin.d.ts +41 -0
  174. package/types/packages/whiteboard/src/plugins/ExportImagePlugin.d.ts +6 -0
  175. package/types/packages/whiteboard/src/plugins/FileDragDropPlugin.d.ts +15 -0
  176. package/types/packages/whiteboard/src/plugins/FramePlugin.d.ts +14 -0
  177. package/types/packages/whiteboard/src/plugins/GeometryPlugin.d.ts +31 -0
  178. package/types/packages/whiteboard/src/plugins/HandwritePlugin.d.ts +22 -0
  179. package/types/packages/whiteboard/src/plugins/ImagePlugin.d.ts +21 -0
  180. package/types/packages/whiteboard/src/plugins/MindPlugin.d.ts +72 -0
  181. package/types/packages/whiteboard/src/plugins/PresentationPlugin.d.ts +13 -0
  182. package/types/packages/whiteboard/src/plugins/RichTextPlugin.d.ts +44 -0
  183. package/types/packages/whiteboard/src/plugins/VideoPlugin.d.ts +14 -0
  184. package/types/packages/whiteboard/src/plugins/ViewPortPlugin.d.ts +13 -0
  185. package/types/packages/whiteboard/src/plugins/WebviewPlugin.d.ts +11 -0
  186. package/types/packages/whiteboard/src/plugins/WhiteBoardPlugin.d.ts +31 -0
  187. package/types/packages/whiteboard/src/plugins/index.d.ts +19 -0
  188. package/types/packages/whiteboard/src/public.d.ts +54 -0
  189. package/types/packages/whiteboard/src/schematic/PageSchematic.d.ts +13 -0
  190. package/types/packages/whiteboard/src/services/CapabilityService.d.ts +186 -0
  191. package/types/packages/whiteboard/src/transforms/SelectTransforms.d.ts +4 -0
  192. package/types/packages/whiteboard/src/transforms/SketchTransforms.d.ts +5 -0
  193. package/types/packages/whiteboard/src/transforms/ViewPortTransforms.d.ts +26 -0
  194. package/types/packages/whiteboard/src/transforms/index.d.ts +3 -0
  195. package/types/packages/whiteboard/src/types/arrow.d.ts +52 -0
  196. package/types/packages/whiteboard/src/types/audio.d.ts +8 -0
  197. package/types/packages/whiteboard/src/types/board.d.ts +79 -0
  198. package/types/packages/whiteboard/src/types/capabilities.d.ts +267 -0
  199. package/types/packages/whiteboard/src/types/column.d.ts +71 -0
  200. package/types/packages/whiteboard/src/types/element.d.ts +1 -0
  201. package/types/packages/whiteboard/src/types/frame.d.ts +35 -0
  202. package/types/packages/whiteboard/src/types/image.d.ts +19 -0
  203. package/types/packages/whiteboard/src/types/index.d.ts +33 -0
  204. package/types/packages/whiteboard/src/types/mind.d.ts +54 -0
  205. package/types/packages/whiteboard/src/types/resize.d.ts +16 -0
  206. package/types/packages/whiteboard/src/types/video.d.ts +20 -0
  207. package/types/packages/whiteboard/src/types/webview.d.ts +7 -0
  208. package/types/packages/whiteboard/src/utils/ArrowConnectTracker.d.ts +50 -0
  209. package/types/packages/whiteboard/src/utils/ArrowStyleUtil.d.ts +15 -0
  210. package/types/packages/whiteboard/src/utils/ArrowUtil.d.ts +11 -0
  211. package/types/packages/whiteboard/src/utils/AudioUtil.d.ts +20 -0
  212. package/types/packages/whiteboard/src/utils/BoardUtil.d.ts +101 -0
  213. package/types/packages/whiteboard/src/utils/CanvasUtil.d.ts +5 -0
  214. package/types/packages/whiteboard/src/utils/ClipboardUtil.d.ts +8 -0
  215. package/types/packages/whiteboard/src/utils/ColumnUtil.d.ts +125 -0
  216. package/types/packages/whiteboard/src/utils/ConnectPointOwner.d.ts +36 -0
  217. package/types/packages/whiteboard/src/utils/ConnectPointUtil.d.ts +66 -0
  218. package/types/packages/whiteboard/src/utils/Constraints.d.ts +6 -0
  219. package/types/packages/whiteboard/src/utils/ExportImageUtil.d.ts +14 -0
  220. package/types/packages/whiteboard/src/utils/FrameUtil.d.ts +90 -0
  221. package/types/packages/whiteboard/src/utils/GeometryUtil.d.ts +18 -0
  222. package/types/packages/whiteboard/src/utils/HandwriteGroupUtil.d.ts +25 -0
  223. package/types/packages/whiteboard/src/utils/HandwriteUtil.d.ts +39 -0
  224. package/types/packages/whiteboard/src/utils/ImageUtil.d.ts +13 -0
  225. package/types/packages/whiteboard/src/utils/LayerOrderUtil.d.ts +16 -0
  226. package/types/packages/whiteboard/src/utils/MindThemePreviewStore.d.ts +11 -0
  227. package/types/packages/whiteboard/src/utils/MindThemeUtil.d.ts +54 -0
  228. package/types/packages/whiteboard/src/utils/MindUtil.d.ts +65 -0
  229. package/types/packages/whiteboard/src/utils/PathUtil.d.ts +80 -0
  230. package/types/packages/whiteboard/src/utils/PointUtil.d.ts +50 -0
  231. package/types/packages/whiteboard/src/utils/PresentationManager.d.ts +53 -0
  232. package/types/packages/whiteboard/src/utils/RichTextContentUtil.d.ts +17 -0
  233. package/types/packages/whiteboard/src/utils/SelectionActionUtil.d.ts +9 -0
  234. package/types/packages/whiteboard/src/utils/TextStyleStore.d.ts +10 -0
  235. package/types/packages/whiteboard/src/utils/VideoUtil.d.ts +11 -0
  236. package/types/packages/whiteboard/src/utils/ViewportUtil.d.ts +10 -0
  237. package/types/packages/whiteboard/src/utils/common.d.ts +18 -0
  238. package/types/packages/whiteboard/src/utils/events.d.ts +13 -0
  239. package/types/packages/whiteboard/src/utils/index.d.ts +28 -0
  240. package/types/packages/whiteboard/src/utils/sketch/arrow.d.ts +29 -0
  241. package/types/packages/whiteboard/src/utils/sketch/batch.d.ts +10 -0
  242. package/types/packages/whiteboard/src/utils/sketch/index.d.ts +9 -0
  243. package/types/packages/whiteboard/src/utils/sketch/patch.d.ts +5 -0
  244. package/types/packages/whiteboard/src/utils/sketch/resolve.d.ts +14 -0
  245. package/types/packages/whiteboard/src/utils/snap/SnapGeometry.d.ts +52 -0
  246. package/types/packages/whiteboard/src/utils/snap/SnapManager.d.ts +57 -0
@@ -0,0 +1,50 @@
1
+ import type { ArrowElement, BoardElement, CustomOffset, Point } from "../types/index";
2
+ export type ArrowConnectPointData = {
3
+ element: BoardElement;
4
+ connectPoints: Array<{
5
+ connectId: string;
6
+ point: Point;
7
+ }>;
8
+ };
9
+ export type CandidateConnectPointData = {
10
+ elementId: string;
11
+ connectId: string;
12
+ distance: number;
13
+ point: Point;
14
+ customOffset?: CustomOffset;
15
+ };
16
+ /** 事件总线(Board 与 WhiteboardAPI 均结构兼容,监听器签名与公共 API 一致) */
17
+ interface ArrowConnectBus {
18
+ on(event: string, listener: (...args: any[]) => void): void;
19
+ off(event: string, listener: (...args: any[]) => void): void;
20
+ emit(event: string, ...args: unknown[]): void;
21
+ }
22
+ /** 拖动共享状态:是否已超过拖动阈值、当前指针(画布坐标)与缩放 */
23
+ export interface ArrowConnectDragState {
24
+ isMoved(): boolean;
25
+ currentPoint(): Point | null;
26
+ zoom(): number;
27
+ }
28
+ /**
29
+ * 箭头端点拖动中的连接点候选追踪(自 useMoveArrow 抽出的共享逻辑):
30
+ * 维护「进入落点范围的元素」清单并重算候选(5 固定点距离吸附 / Alt 射线-边缘交点),
31
+ * 供拖动箭头端点(React 场景)与创建箭头手势(非 React 场景)复用。
32
+ */
33
+ export declare class ArrowConnectTracker {
34
+ private readonly bus;
35
+ private readonly state;
36
+ private closingConnectElements;
37
+ private candidateConnectPoints;
38
+ private altMode;
39
+ constructor(bus: ArrowConnectBus, state: ArrowConnectDragState);
40
+ /** 订阅连接点候选事件;返回取消订阅函数 */
41
+ attach(): () => void;
42
+ setAltMode(alt: boolean): void;
43
+ private emitCustomSnap;
44
+ private recomputeCandidates;
45
+ private handleAddClosingElements;
46
+ private handleRemoveClosingElements;
47
+ private handleArrowMoveEnd;
48
+ getUpdateArrowElement: (originalArrow: ArrowElement, currentPoint: Point, movedPointIndex: number) => ArrowElement;
49
+ }
50
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ArrowElement, EArrowLineType, EMarkerType } from "../types/arrow";
2
+ export interface ArrowStylePreset {
3
+ lineType: EArrowLineType;
4
+ sourceMarker: EMarkerType;
5
+ targetMarker: EMarkerType;
6
+ lineWidth: number;
7
+ themeColorId: string;
8
+ dashed: boolean;
9
+ dashArray: number[];
10
+ animated: boolean;
11
+ animationSpeed: number;
12
+ }
13
+ export declare const getDefaultArrowStylePreset: () => ArrowStylePreset;
14
+ export declare const getPrevArrowStylePreset: () => ArrowStylePreset;
15
+ export declare const saveArrowStylePresetFromElement: (element: ArrowElement) => void;
@@ -0,0 +1,11 @@
1
+ import { Point, GetArrowPathParams, CustomOffset } from "../types/index";
2
+ export declare class ArrowUtil {
3
+ static getMiddlePoint: (startPoint: Point, endPoint: Point, forceVertical?: boolean, hasStartMarker?: boolean, hasEndMarker?: boolean) => {
4
+ x: number;
5
+ y: number;
6
+ }[];
7
+ static getOrthogonalPoints: (startPoint: Point, endPoint: Point, sourceConnectId?: string, targetConnectId?: string, sourceCustomOffset?: CustomOffset, targetCustomOffset?: CustomOffset) => Point[];
8
+ static isPointOnLine(p0: Point, p1: Point, point: Point, tolerance?: number): boolean;
9
+ static getQuadraticControlPoint(startPoint: Point, endPoint: Point, midPoint: Point): Point;
10
+ static getArrowPath(arrow: GetArrowPathParams, forceVertical?: boolean): string;
11
+ }
@@ -0,0 +1,20 @@
1
+ import type { MediaCapabilities } from "../extensions/media";
2
+ import { Board } from "../types/index";
3
+ export declare class AudioUtil {
4
+ /**
5
+ * Insert audio from a local file
6
+ */
7
+ static insertAudio(file: File, board: Board, media: MediaCapabilities): Promise<void>;
8
+ /**
9
+ * Insert audio from a resource path
10
+ */
11
+ static insertAudioFromPath(src: string, board: Board): Promise<void>;
12
+ /**
13
+ * Insert audio from a URL
14
+ */
15
+ static insertAudioFromUrl(url: string, board: Board): Promise<void>;
16
+ /**
17
+ * Insert audio from text-to-speech
18
+ */
19
+ static insertAudioFromTTS(audioBlob: Blob, text: string, board: Board, media: MediaCapabilities): Promise<void>;
20
+ }
@@ -0,0 +1,101 @@
1
+ import { BoardElement, Operation, Selection } from "../types/index";
2
+ import type Board from "../Board";
3
+ export declare class BoardUtil {
4
+ private static hitIndexCache;
5
+ static isBoard(value: unknown): value is Board;
6
+ static getHitElements(board: Board, x: number, y: number): BoardElement[];
7
+ static getElementsInSelectArea(board: Board, selectArea: Selection["selectArea"]): BoardElement[];
8
+ private static getSpatialIndex;
9
+ /** 与 dfs 相同的先序遍历,但只进入可见子元素 */
10
+ private static dfsHitTestable;
11
+ private static getHitElementsByDFS;
12
+ private static getElementsInSelectAreaByDFS;
13
+ static dfs(node: BoardElement | Board, visit: (node: BoardElement) => void | boolean, quickQuit?: boolean): boolean | void;
14
+ static bfs(node: BoardElement | Board, visit: (node: BoardElement) => boolean | void, quickQuit?: boolean): boolean | void;
15
+ /**
16
+ * diff 算法 - 生成基于目标状态的操作序列
17
+ * @param oldChildren 旧的子节点数组
18
+ * @param newChildren 新的子节点数组
19
+ * @param basePath 基础路径,默认为空数组
20
+ * @returns 操作列表(基于目标状态的路径,需要跳过路径转换)
21
+ */
22
+ static diff(oldChildren: BoardElement[], newChildren: BoardElement[], basePath?: number[]): Operation[];
23
+ /**
24
+ * diff 单个节点:只对当前节点生成 set_node(patch,不含 children),children 变化由 diff(children) 生成结构操作。
25
+ * 该方法返回的操作序列适用于按顺序执行且跳过路径变换的场景(例如 BoardOperations.applyDiffOperations)。
26
+ */
27
+ static diffNode(oldNode: BoardElement, newNode: BoardElement, path: number[]): Operation[];
28
+ /**
29
+ * diff 单个节点(浅层):仅生成当前节点的 set_node(patch,不含 children),不递归 children。
30
+ * 适用场景:结构变化已由 move/insert/remove 表达,仅需要根据 layout 结果更新节点自身属性。
31
+ */
32
+ static diffNodePatchOnly(oldNode: BoardElement, newNode: BoardElement, path: number[]): Operation[];
33
+ /**
34
+ * 平移整棵子树:对 root 及其所有带 x/y 的后代节点各生成一条 set_node。
35
+ * 纯函数,不依赖 board,调用方需传入移动前的 root 快照及其 path。
36
+ * 适用场景:容器(Frame/Column)与 RootOnly 元素(mind-node 根)整体移动,
37
+ * 避免用 set_node 写入 children 字段。
38
+ */
39
+ static buildTranslateSubtreeOps(snapshotRoot: BoardElement, rootPath: number[], dx: number, dy: number): Operation[];
40
+ /**
41
+ * 返回所有"属于容器后代"的元素 id 集合(任意祖先是容器的元素,不含容器自身)。
42
+ * 容器判定基于 CapabilityService.isContainer(Frame/Column/MindNode 等)。
43
+ * 用于多选对齐等场景:容器内部元素的位置由容器布局决定,独立平移会破坏布局,
44
+ * 因此应将其从可独立操作的目标中剔除。容器自身不被计入。
45
+ */
46
+ static getContainerDescendantIds(board: Board): Set<string>;
47
+ /**
48
+ * 将一组操作标记为“已标准化”,用于跳过路径变换与预处理排序。
49
+ * 适用场景:ops 是通过 diff 生成、且依赖“按原始顺序执行”的序列。
50
+ */
51
+ static normalizeOperations(operations: Operation[]): Operation[];
52
+ /**
53
+ * 获取元素属性变化
54
+ * @param oldElement 旧元素
55
+ * @param newElement 新元素
56
+ * @returns 变化的属性
57
+ */
58
+ private static getElementChanges;
59
+ /**
60
+ * 只为“会被修改的字段”收集旧值,确保 undo/redo 正确且减少操作体积
61
+ */
62
+ private static getElementPropertiesForChanges;
63
+ /**
64
+ * 深度比较两个值是否相等
65
+ * @param oldValue 旧值
66
+ * @param newValue 新值
67
+ * @returns 是否发生变化
68
+ */
69
+ private static isValueChanged;
70
+ /**
71
+ * 创建元素映射(内存优化)
72
+ */
73
+ private static createElementMap;
74
+ /**
75
+ * 优化操作列表(批量优化)
76
+ */
77
+ private static optimizeOperations;
78
+ /**
79
+ * 收集批量 set_node 操作
80
+ */
81
+ private static collectBatchSetOperations;
82
+ /**
83
+ * 合并批量 set_node 操作
84
+ */
85
+ private static mergeBatchSetOperations;
86
+ /**
87
+ * 比较两个数组是否相等
88
+ */
89
+ private static arraysEqual;
90
+ /**
91
+ * 应用操作列表到子节点数组(使用Board.tsx的真实apply逻辑)
92
+ * @param children 原始子节点数组
93
+ * @param operations 操作列表
94
+ * @returns 应用操作后的新数组
95
+ */
96
+ static apply(children: BoardElement[], operations: Operation[]): BoardElement[];
97
+ static inverseOperation: (op: Operation) => Operation;
98
+ static getParent(board: Board, element: BoardElement): BoardElement | null;
99
+ static getElementById(board: Board, id: string): BoardElement | null;
100
+ }
101
+ export default BoardUtil;
@@ -0,0 +1,5 @@
1
+ export declare class CanvasUtil {
2
+ static isPointInPath(path: Path2D, x: number, y: number): boolean;
3
+ static isPointInStroke(path: Path2D, lineWidth: number, x: number, y: number): boolean;
4
+ }
5
+ export default CanvasUtil;
@@ -0,0 +1,8 @@
1
+ import { Board, BoardElement } from "../types/index";
2
+ export declare const buildClipboardPayload: (board: Board, elements: BoardElement[]) => string | null;
3
+ export declare const writeClipboardPayload: (payload: string) => Promise<boolean>;
4
+ declare const _default: {
5
+ buildClipboardPayload: (board: Board, elements: BoardElement[]) => string | null;
6
+ writeClipboardPayload: (payload: string) => Promise<boolean>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,125 @@
1
+ import { BoardElement, ColumnElement, Board } from "../types/index";
2
+ export declare class ColumnUtil {
3
+ /**
4
+ * Create a new Column element
5
+ */
6
+ static createColumn(x: number, y: number, width?: number, title?: string): ColumnElement;
7
+ /**
8
+ * Layout column and children - directly modifies children's x, y, width
9
+ * Similar to MindUtil.layout, this is the core layout algorithm
10
+ */
11
+ static layout(_board: Board, column: ColumnElement): ColumnElement;
12
+ /** layout 的纯函数形态(board 参数从未参与计算),创建手势等无 Board 场合复用 */
13
+ static layoutColumn(column: ColumnElement): ColumnElement;
14
+ /**
15
+ * Relayout column and apply changes to board
16
+ */
17
+ static relayout(board: Board, column: ColumnElement): ColumnElement;
18
+ /**
19
+ * Calculate height from children without board context
20
+ */
21
+ static calculateHeightFromChildren(column: ColumnElement): number;
22
+ /**
23
+ * Calculate total height based on children
24
+ * 添加缓存机制避免频繁重新计算导致性能问题和强制重排
25
+ */
26
+ static calculateHeight(board: Board, column: ColumnElement): number;
27
+ /**
28
+ * Check if point is within column bounds
29
+ */
30
+ static isPointInColumn(board: Board, column: ColumnElement, x: number, y: number): boolean;
31
+ /**
32
+ * Check if element is in column bounds
33
+ * 使用鼠标位置判断元素是否进入 Column
34
+ */
35
+ static isElementInColumn(board: Board, _element: BoardElement, column: ColumnElement, pointerPosition?: {
36
+ x: number;
37
+ y: number;
38
+ }): boolean;
39
+ /**
40
+ * Get drop index for a y position within column
41
+ * @param excludeElementId - 排除某个元素(用于同一容器内拖拽时排除被拖拽的元素)
42
+ */
43
+ static getDropIndex(board: Board, column: ColumnElement, dropY: number, excludeElementId?: string): number;
44
+ /** 折叠态高度:标题栏 + 露出的纸边(空列无纸边) */
45
+ static getCollapsedHeight(column: ColumnElement): number;
46
+ /**
47
+ * 切换折叠:与布局合并为一次操作(单条撤销记录)
48
+ */
49
+ static toggleCollapsed(board: Board, column: ColumnElement): void;
50
+ /**
51
+ * 在列末尾追加一段空白文字并自动进入编辑(沿用上次的富文本样式)。
52
+ * 插入前按内容宽度实测初始高度,避免插入后再跳高;插入与 relayout 历史合并为一条撤销记录。
53
+ */
54
+ static appendRichText(board: Board, column: ColumnElement): Promise<string | null>;
55
+ /**
56
+ * 标题下方的数量文案:同类元素用对应量词(「3 张图片」),混合时统称「个元素」
57
+ */
58
+ static getCountLabel(column: ColumnElement): string;
59
+ /**
60
+ * 拖入占位块的高度:列内元素取自身高度;外部元素按列内容宽度估算
61
+ * (图片 / 视频按宽高比,其余取当前高度并限制在范围内)
62
+ */
63
+ static getPlaceholderHeight(column: ColumnElement, element: BoardElement): number;
64
+ /**
65
+ * 外部元素拖入时托盘多出的高度(列内拖拽是「原位合拢 + 落点占位」,总高不变)
66
+ */
67
+ static getDropGrowth(column: ColumnElement): number;
68
+ /**
69
+ * 拖拽中的视觉布局:被拖出的子元素原位合拢,落点处空出占位块。
70
+ * 返回每个可见子元素的目标 y、占位块 y,以及托盘高度;存储坐标不变。
71
+ */
72
+ static getVisualLayout(column: ColumnElement): {
73
+ childYs: Map<string, number>;
74
+ placeholderY: number | null;
75
+ placeholderHeight: number;
76
+ height: number;
77
+ isVisuallyEmpty: boolean;
78
+ };
79
+ /**
80
+ * Move column and all its children
81
+ */
82
+ static moveAll(column: ColumnElement, dx: number, dy: number): ColumnElement;
83
+ /**
84
+ * Remove child from column
85
+ */
86
+ static removeChild(column: ColumnElement, childId: string): ColumnElement;
87
+ /**
88
+ * Reorder children within column
89
+ */
90
+ static reorderChildren(column: ColumnElement, fromIndex: number, toIndex: number): ColumnElement;
91
+ /**
92
+ * Get content width (column width minus padding)
93
+ */
94
+ static getContentWidth(column: ColumnElement): number;
95
+ /**
96
+ * Check if child is in column
97
+ */
98
+ static isChildInColumn(column: ColumnElement, child: BoardElement): boolean;
99
+ /**
100
+ * DFS traverse column and children
101
+ */
102
+ static dfs(column: BoardElement, { before, after, }: {
103
+ before?: (element: BoardElement, parent: BoardElement | null, index: number) => void;
104
+ after?: (element: BoardElement, parent: BoardElement | null, index: number) => void;
105
+ }, parent?: BoardElement | null, index?: number): void;
106
+ /**
107
+ * Get all children recursively
108
+ */
109
+ static getAllChildren(column: ColumnElement): BoardElement[];
110
+ /**
111
+ * Find parent Column of an element
112
+ */
113
+ static findParentColumn(board: Board, element: BoardElement): ColumnElement | null;
114
+ /**
115
+ * Relayout parent Column when a child's size changes
116
+ * Call this from child element plugins when their size changes
117
+ */
118
+ static relayoutParentColumn(board: Board, childElement: BoardElement): void;
119
+ /**
120
+ * Dissolve column - move children to board root and remove column
121
+ */
122
+ static dissolveColumn(board: Board, column: ColumnElement): boolean;
123
+ /** 收集容器自身与全部后代(供整体移动使用) */
124
+ static collectDescendants(container: BoardElement): BoardElement[];
125
+ }
@@ -0,0 +1,36 @@
1
+ import type { Point } from "../types/index";
2
+ export interface ConnectPointBounds {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface ConnectPointCandidate {
9
+ bounds: ConnectPointBounds;
10
+ /** 容器元素(如 Frame):内部空白让给子元素,只有靠近边框时才参与竞争 */
11
+ container: boolean;
12
+ }
13
+ /**
14
+ * 在指针附近的候选元素中选出唯一显示连接点的元素:
15
+ * 指针在元素内部优先于只在外扩感应区内;同为内部取面积最小(嵌套时落到最内层),
16
+ * 同为外部取距离最近,再以面积小者优先。
17
+ */
18
+ export declare const resolveConnectPointOwner: (candidates: Iterable<[string, ConnectPointCandidate]>, pointer: Point | null, radius: number) => string | null;
19
+ export interface ConnectPointOwnerStore {
20
+ getOwner: () => string | null;
21
+ subscribe: (listener: () => void) => () => void;
22
+ setPointer: (point: Point | null) => void;
23
+ /** 注册或更新候选元素,返回注销函数 */
24
+ register: (id: string, candidate: ConnectPointCandidate) => () => void;
25
+ /** 拖动箭头端点时的落点归属:与悬停同一套规则,按给定半径即时求值(同一点结果缓存,供各元素共享) */
26
+ resolveAt: (point: Point, radius: number) => string | null;
27
+ /** 指针停在某元素的连接点上或正从它拖出箭头时锁定归属,避免被邻近元素抢走 */
28
+ lock: (id: string) => void;
29
+ unlock: (id: string) => void;
30
+ dispose: () => void;
31
+ }
32
+ export declare const createConnectPointOwnerStore: ({ radius, hideDelay, }: {
33
+ radius: number;
34
+ /** 归属变为空时延迟清空,吸收感应区边缘的抖动 */
35
+ hideDelay: number;
36
+ }) => ConnectPointOwnerStore;
@@ -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
+ }