@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,2 @@
1
+ export declare const RESIZE_CIRCLE_FILL = "var(--tau-accent)";
2
+ export declare const RESIZE_CIRCLE_RADIUS = 5;
@@ -0,0 +1,4 @@
1
+ export declare const SELECT_RECT_STROKE = "var(--tau-accent)";
2
+ export declare const SELECT_RECT_STROKE_WIDTH = 1;
3
+ export declare const SELECT_RECT_FILL_OPACITY = 0;
4
+ export declare const SELECT_AREA_COLOR = "var(--tau-accent)";
@@ -0,0 +1,12 @@
1
+ export declare enum EShadowSize {
2
+ None = "none",
3
+ Small = "small",
4
+ Medium = "medium",
5
+ Large = "large"
6
+ }
7
+ export interface ShadowSizeOption {
8
+ value: EShadowSize;
9
+ label: string;
10
+ }
11
+ export declare const SHADOW_SIZE_OPTIONS: ShadowSizeOption[];
12
+ export declare function getShadowStyle(size: EShadowSize | undefined | null, isDark: boolean): string;
@@ -0,0 +1,16 @@
1
+ import type { SketchFillStyle, SketchLevel, SketchMode } from "../types/sketch";
2
+ export declare const SKETCH_MODE_OPTIONS: {
3
+ value: SketchMode;
4
+ label: string;
5
+ }[];
6
+ export declare const SKETCH_LEVEL_OPTIONS: {
7
+ value: SketchLevel;
8
+ label: string;
9
+ }[];
10
+ export declare const SKETCH_FILL_OPTIONS: {
11
+ value: SketchFillStyle;
12
+ label: string;
13
+ }[];
14
+ export declare const sketchLevelLabel: (level: SketchLevel) => string;
15
+ /** 媒体类元素(图片 / 视频 / 网页 / 音频 / 白板引用)手绘外框的墨色 */
16
+ export declare const SKETCH_MEDIA_FRAME = "var(--tau-ink-3)";
@@ -0,0 +1,68 @@
1
+ import type { ColumnColor } from "../types/column";
2
+ /**
3
+ * 富文本 / 卡片的外观:只存语义(样式 + 色调),颜色全部取主题 token,
4
+ * 随主题族与明暗切换。内边距、圆角、阴影由这里统一给定,不开放给用户。
5
+ *
6
+ * - none 透明:无底无框,只有文字
7
+ * - plain 白卡:surface 实底 + 发丝线
8
+ * - band 色带:白卡 + 顶部 tag 色带(与 Column 色带同高同色)
9
+ * - tinted 柔色:tag-soft 底 + 同色系淡边
10
+ */
11
+ export type TextVariant = "none" | "plain" | "band" | "tinted";
12
+ /** 色调与 Column 共用同一组标签色,色相顺序一致 */
13
+ export type TextTone = ColumnColor;
14
+ export interface TextStyle {
15
+ variant: TextVariant;
16
+ tone?: TextTone;
17
+ }
18
+ export declare const TEXT_TONES: Array<{
19
+ value: TextTone;
20
+ label: string;
21
+ solid: string;
22
+ soft: string;
23
+ }>;
24
+ export declare const TEXT_BOX: {
25
+ readonly radius: 6;
26
+ readonly paddingX: 16;
27
+ readonly paddingY: 12;
28
+ readonly bandHeight: 3;
29
+ };
30
+ export declare const TEXT_COLORS: {
31
+ readonly ink: "var(--tau-ink-1)";
32
+ readonly surface: "var(--tau-bg-surface)";
33
+ readonly line: "color-mix(in srgb, var(--tau-ink-1) 11%, transparent)";
34
+ };
35
+ export declare const DEFAULT_RICHTEXT_STYLE: TextStyle;
36
+ export interface TextBoxPadding {
37
+ top: number;
38
+ right: number;
39
+ bottom: number;
40
+ left: number;
41
+ }
42
+ export declare function getTextBoxPadding(style: TextStyle): TextBoxPadding;
43
+ export declare const toCssPadding: (p: TextBoxPadding) => string;
44
+ /**
45
+ * 底板的底色与发丝线色;none 返回 null。卡片不用阴影,只靠发丝线分层。
46
+ * sketchEdge:手绘模式下的墨迹框色——发丝线太淡,墨迹需要可辨的颜色(D-107)
47
+ */
48
+ export declare function getTextSurface(style: TextStyle): {
49
+ background: string;
50
+ edge: string;
51
+ sketchEdge: string;
52
+ } | null;
53
+ /** 顶部色带颜色;非 band 或无色调返回 null */
54
+ export declare function getTextBandColor(style: TextStyle): string | null;
55
+ interface TextStyleSource {
56
+ type: string;
57
+ variant?: TextVariant;
58
+ tone?: TextTone;
59
+ /** @deprecated 旧版字段,仅用于换算 */
60
+ background?: string;
61
+ /** @deprecated 旧版字段,仅用于换算 */
62
+ topColor?: string;
63
+ }
64
+ /** 读出元素的有效样式:新字段优先,否则由旧色值换算,都没有则取类型默认 */
65
+ export declare function resolveTextStyle(element: TextStyleSource): TextStyle;
66
+ /** 选中新样式时一并清掉的旧版外观字段 */
67
+ export declare const LEGACY_TEXT_STYLE_KEYS: readonly ["background", "topColor", "color", "theme", "shadowSize", "paddingWidth", "paddingHeight"];
68
+ export {};
@@ -0,0 +1,11 @@
1
+ /** 内置"选择"工具 id(非创建模式的哨兵值) */
2
+ export declare const SELECT_TOOL_ID = "tau.select";
3
+ /** 内置创建工具 id(工具按钮、右键菜单与扩展装配共用同一常量) */
4
+ export declare const GEOMETRY_TOOL_ID = "tau.geometry.create";
5
+ export declare const ARROW_TOOL_ID = "tau.arrow.create";
6
+ export declare const HANDWRITE_TOOL_ID = "tau.handwrite.create";
7
+ export declare const RICHTEXT_TOOL_ID = "tau.richtext.create";
8
+ export declare const MIND_TOOL_ID = "tau.mind.create";
9
+ export declare const FRAME_TOOL_ID = "tau.frame.create";
10
+ export declare const COLUMN_TOOL_ID = "tau.column.create";
11
+ export declare const builtinCreateToolIds: Set<string>;
@@ -0,0 +1,3 @@
1
+ export declare const MIN_ZOOM = 0.2;
2
+ export declare const MAX_ZOOM = 4;
3
+ export declare const ZOOM_PRESETS: number[];
@@ -0,0 +1,9 @@
1
+ /** 当前应用可读写的白板文档版本;保存时永远写入该值。 */
2
+ export declare const WHITEBOARD_DOCUMENT_VERSION = 2;
3
+ /**
4
+ * 从持久化的白板页 data(JSON 解析结果)取文档版本。
5
+ * 旧数据没有 version 字段或值非法(非正整数)时视为 1。
6
+ */
7
+ export declare function getDocumentVersion(data: unknown): number;
8
+ /** 版本高于当前应用支持的范围时只读展示,不写回。 */
9
+ export declare function isDocumentVersionSupported(version: number): boolean;
@@ -0,0 +1,47 @@
1
+ import type { WhiteboardAuthorBridge } from "./extensions/authorTypes";
2
+ import type { WhiteboardElementDefinition } from "./extensions/api";
3
+ import type { EditorDocument } from "../../editor/src/index";
4
+ import type Board from "./Board";
5
+ import type { Operation } from "./types/operation";
6
+ /** 文档绑定只接管内容与历史;视口和选区仍由画布本机实例管理。 */
7
+ export interface WhiteboardDocumentBinding {
8
+ isBlocked?(): boolean;
9
+ flushInputs?(): void;
10
+ createContentCopy?(elementId: string): Promise<number>;
11
+ duplicatePage?(pageId: string): Promise<string>;
12
+ pages?(): readonly {
13
+ id: string;
14
+ title: string;
15
+ }[];
16
+ moveToPage?(ids: readonly string[], pageId: string): void;
17
+ appendStroke?(id: string, points: readonly import("./utils/HandwriteUtil").HandwriteInputPoint[], style: import("./utils/HandwriteUtil").HandwriteStyle): void;
18
+ cancelStroke?(id: string): void;
19
+ exportFile?(ids?: readonly string[]): Promise<Blob>;
20
+ exportTransfer?(ids?: readonly string[]): import("../../collaboration/whiteboard-types").WhiteboardTransfer;
21
+ importTransfer?(bundle: import("../../collaboration/whiteboard-types").WhiteboardTransfer, allPages?: boolean): Promise<readonly string[]>;
22
+ linkEntity?(elementId: string, kind: import("../../db-schema/content-identities").ContentEntityKind, localId: number): Promise<boolean>;
23
+ unlinkEntity?(elementId: string): void;
24
+ setPresentations?(before: readonly import("./types/presentation").PresentationSequence[], after: readonly import("./types/presentation").PresentationSequence[]): void;
25
+ revealElements?(ids: readonly string[]): void;
26
+ measureElement?(elementId: string, size: {
27
+ width: number;
28
+ height: number;
29
+ }): void;
30
+ refreshLayout?(): void;
31
+ supportsElement?(elementId: string): boolean;
32
+ textField?(elementId: string, field: string): import("../../editor/text-field-contract").EditorTextField;
33
+ readonly author?: WhiteboardAuthorBridge;
34
+ resolveElementDefinition?(contractId: string): {
35
+ element: WhiteboardElementDefinition;
36
+ access: "read" | "edit" | "none";
37
+ } | undefined;
38
+ connect(board: Board): () => void;
39
+ apply(operations: Operation[], updateHistory: boolean, historyGroup?: string): boolean;
40
+ commitPreview(operations: Operation[], historyGroup?: string): void;
41
+ beginGesture(): void;
42
+ splitHistory(): void;
43
+ endGesture(commit: boolean): void;
44
+ undo(): void;
45
+ redo(): void;
46
+ textDocument(elementId: string): EditorDocument | undefined;
47
+ }
@@ -1,3 +1,5 @@
1
+ import type { DataMigration, PreviousDataVersion } from "../../../db-schema/data-versions";
2
+ import type { ContentResourceSpec } from "../../../db-schema/content-resources";
1
3
  import type { ComponentType, ReactNode } from "react";
2
4
  import type { ServiceIdentifier } from "../../../shared/service-contract";
3
5
  import type { BoardElement, ElementBounds } from "../types/element";
@@ -109,6 +111,13 @@ export interface ElementContainmentSpec {
109
111
  joins?: readonly ContainerKind[];
110
112
  }
111
113
  export interface WhiteboardElementDefinition<TData = unknown> {
114
+ dataVersion?: number;
115
+ collaboration?: {
116
+ textFields?: readonly string[];
117
+ };
118
+ resources?: readonly ContentResourceSpec[];
119
+ previousVersions?: readonly PreviousDataVersion<WhiteboardElementDefinition<TData>>[];
120
+ migrations?: readonly DataMigration<any>[];
112
121
  type: string;
113
122
  presentation?: {
114
123
  label: string;
@@ -0,0 +1,10 @@
1
+ import type { WhiteboardAPI as HostAPI, WhiteboardExtension as HostExtension } from "./api";
2
+ import type { WhiteboardAPI, WhiteboardAuthorBridge, WhiteboardElementDefinition, WhiteboardExtension } from "./authorTypes";
3
+ export declare const whiteboardAuthorOwner: (extension: object) => string | undefined;
4
+ export declare function bindWhiteboardAuthorAPI(base: HostAPI, owner: string, get: () => WhiteboardAuthorBridge | undefined, active: () => boolean): () => void;
5
+ export declare function authorAPI(base: HostAPI): WhiteboardAPI;
6
+ export declare function useWhiteboardAPI(): WhiteboardAPI;
7
+ export declare function defineElement<TData = unknown>(definition: WhiteboardElementDefinition<TData>): WhiteboardElementDefinition<TData>;
8
+ /** 作者工厂及回调始终收到受控外观,宿主旧能力不进入作者对象原型。 */
9
+ export declare function defineWhiteboardExtension(definition: Omit<WhiteboardExtension, "apiVersion">): WhiteboardExtension;
10
+ export declare function hostWhiteboardExtensions(extensions: readonly WhiteboardExtension[], owner?: string): readonly HostExtension[];
@@ -1,4 +1,4 @@
1
1
  import type { BoardElement } from "../types/element";
2
- export declare function usePageSketch(): import("../author").PageSketch;
2
+ export declare function usePageSketch(): import("../index").PageSketch;
3
3
  /** 订阅所属画布的画风,元素和 owner 的覆盖仍由内核统一解析。 */
4
- export declare function useSketch(element: BoardElement, owner?: BoardElement): import("../author").ResolvedSketch;
4
+ export declare function useSketch(element: BoardElement, owner?: BoardElement): import("../index").ResolvedSketch;
@@ -0,0 +1,150 @@
1
+ import type { DataJson } from "../../../db-schema/content-contracts";
2
+ import type { DataMigration, PreviousDataVersion } from "../../../db-schema/data-versions";
3
+ import type { EditorTextField } from "../../../editor/text-field-contract";
4
+ import type { WhiteboardAPI as HostAPI, WhiteboardElementDefinition as HostElement, WhiteboardContributions as HostContributions, WhiteboardExtension as HostExtension } from "./api";
5
+ export type WhiteboardData = Readonly<Record<string, DataJson>>;
6
+ export interface WhiteboardGeometry {
7
+ readonly x: number;
8
+ readonly y: number;
9
+ readonly width: number;
10
+ readonly height: number;
11
+ readonly rotation: number;
12
+ }
13
+ export type WhiteboardParent = {
14
+ kind: "page" | "element";
15
+ id: string;
16
+ };
17
+ export type WhiteboardAnchor = {
18
+ beforeId: string;
19
+ afterId?: never;
20
+ } | {
21
+ afterId: string;
22
+ beforeId?: never;
23
+ } | {
24
+ beforeId?: never;
25
+ afterId?: never;
26
+ };
27
+ export interface WhiteboardShellPatch {
28
+ name?: string;
29
+ geometry?: WhiteboardGeometry;
30
+ style?: WhiteboardData;
31
+ }
32
+ export interface WhiteboardElement {
33
+ readonly id: string;
34
+ readonly type: string;
35
+ readonly name?: string;
36
+ readonly style?: WhiteboardData;
37
+ readonly data: WhiteboardData;
38
+ readonly geometry: WhiteboardGeometry;
39
+ readonly children?: readonly WhiteboardElement[];
40
+ }
41
+ export type WhiteboardIdCommand = ({
42
+ type: "create";
43
+ element: {
44
+ type: string;
45
+ data: WhiteboardData;
46
+ geometry: WhiteboardGeometry;
47
+ };
48
+ parent: WhiteboardParent;
49
+ } & WhiteboardAnchor) | {
50
+ type: "set_node";
51
+ id: string;
52
+ patch: WhiteboardShellPatch;
53
+ } | {
54
+ type: "set_data";
55
+ id: string;
56
+ patch: WhiteboardData;
57
+ unset?: readonly string[];
58
+ } | ({
59
+ type: "move_node";
60
+ id: string;
61
+ parent: WhiteboardParent;
62
+ } & WhiteboardAnchor) | {
63
+ type: "remove_nodes";
64
+ ids: readonly string[];
65
+ };
66
+ export interface WhiteboardSnapshot {
67
+ readonly pageId: string;
68
+ readonly children: readonly WhiteboardElement[];
69
+ }
70
+ export interface WhiteboardAPI extends Omit<HostAPI, "children" | "getSnapshot" | "getElement" | "submit" | "apply" | "updateElement" | "captureSubmission"> {
71
+ readonly children: readonly WhiteboardElement[];
72
+ getSnapshot(): WhiteboardSnapshot;
73
+ getElement(id: string): WhiteboardElement | undefined;
74
+ updateElement(id: string, patch: WhiteboardShellPatch): boolean;
75
+ updateElementData(id: string, patch: WhiteboardData, options?: {
76
+ unset?: readonly string[];
77
+ historyGroup?: string;
78
+ }): boolean;
79
+ getTextBinding(id: string, field: string): EditorTextField;
80
+ submit(commands: readonly WhiteboardIdCommand[], options?: {
81
+ historyGroup?: string;
82
+ }): {
83
+ readonly createdIds: readonly string[];
84
+ };
85
+ captureSubmission(target?: string | {
86
+ readonly id: string;
87
+ }): () => boolean;
88
+ }
89
+ export interface WhiteboardElementDefinition<TData = unknown> extends Omit<HostElement<TData>, "schemaVersion" | "migrate" | "previousVersions" | "migrations" | "create"> {
90
+ dataVersion: number;
91
+ previousVersions?: readonly PreviousDataVersion<WhiteboardElementDefinition<any>>[];
92
+ migrations?: readonly DataMigration<Record<string, DataJson>>[];
93
+ create?: Omit<NonNullable<HostElement<TData>["create"]>, "build" | "gesture"> & {
94
+ gesture: "click" | "drag" | {
95
+ begin(context: Omit<import("./api").CreatePointerContext, "api"> & {
96
+ api: WhiteboardAPI;
97
+ preview(element: import("./api").TypedBoardElement<TData> | null, options?: import("./api").CreatePreviewOptions): void;
98
+ }): {
99
+ move(context: Omit<import("./api").CreatePointerContext, "api"> & {
100
+ api: WhiteboardAPI;
101
+ }): void;
102
+ end(context: Omit<import("./api").CreatePointerContext, "api"> & {
103
+ api: WhiteboardAPI;
104
+ moved: boolean;
105
+ }): import("./api").TypedBoardElement<TData> | null | Promise<import("./api").TypedBoardElement<TData> | null>;
106
+ cancel?(): void;
107
+ } | null;
108
+ };
109
+ build?(context: Omit<import("./api").CreateBuildContext, "api"> & {
110
+ api: WhiteboardAPI;
111
+ }): import("./api").TypedBoardElement<TData> | null | Promise<import("./api").TypedBoardElement<TData> | null>;
112
+ };
113
+ schemaVersion?: never;
114
+ migrate?: never;
115
+ }
116
+ export interface WhiteboardContributions extends Omit<HostContributions, "commands" | "menus" | "ingest"> {
117
+ commands?: readonly {
118
+ id: string;
119
+ enabled?(api: WhiteboardAPI): boolean;
120
+ execute(api: WhiteboardAPI, payload?: unknown): unknown;
121
+ }[];
122
+ menus?: readonly {
123
+ id: string;
124
+ label: string;
125
+ command: string;
126
+ order: number;
127
+ when?(api: WhiteboardAPI): boolean;
128
+ }[];
129
+ ingest?: readonly {
130
+ id: string;
131
+ source: "paste" | "drop";
132
+ accepts(event: ClipboardEvent | DragEvent): boolean;
133
+ run(api: WhiteboardAPI, event: ClipboardEvent | DragEvent): void | Promise<void>;
134
+ }[];
135
+ }
136
+ export interface WhiteboardExtension extends Omit<HostExtension, "elements" | "create"> {
137
+ readonly elements?: readonly WhiteboardElementDefinition<any>[];
138
+ create(api: WhiteboardAPI): WhiteboardContributions;
139
+ }
140
+ /** 宿主实现注册到作用域,不包含 Y.Doc 或画布内核。 */
141
+ export interface WhiteboardAuthorBridge {
142
+ canWrite(): boolean;
143
+ getPageId(): string;
144
+ getSnapshot(): Pick<WhiteboardSnapshot, "pageId" | "children">;
145
+ getElement(id: string): WhiteboardElement | undefined;
146
+ submit(owner: string, commands: readonly WhiteboardIdCommand[], historyGroup?: string): {
147
+ readonly createdIds: readonly string[];
148
+ };
149
+ getTextBinding(owner: string, id: string, field: string): EditorTextField;
150
+ }
@@ -0,0 +1,50 @@
1
+ import { type ComponentType } from "react";
2
+ import { type MediaInfoService } from "../../../shared/media-services";
3
+ import type { PluginContextMenuItem } from "../types/index";
4
+ import type { WhiteboardAPI } from "./api";
5
+ /** 媒体插件的宿主能力:由扩展从宿主服务构造,upload/download 缺失时对应入口隐藏 */
6
+ /** 宿主提供的视频来源(如各视频插件),每项一个添加入口,选择后以 `source:<id>` 动作打开宿主弹窗。 */
7
+ export interface VideoSourceEntry {
8
+ id: string;
9
+ label: string;
10
+ }
11
+ export interface MediaCapabilities {
12
+ actions?: readonly string[];
13
+ /** 每次打开菜单时读取,来源随宿主状态增减。 */
14
+ videoSources?: () => readonly VideoSourceEntry[];
15
+ upload?(file: File): Promise<string | null>;
16
+ download?(url: string): Promise<unknown>;
17
+ imageInfo(file: File): Promise<{
18
+ width: number;
19
+ height: number;
20
+ } | null>;
21
+ videoInfo(file: File): Promise<{
22
+ width: number;
23
+ height: number;
24
+ } | null>;
25
+ }
26
+ /** 宿主对内置媒体扩展的 UI 配置(菜单动作与图片组件),保留为工厂参数、不进服务 */
27
+ export interface MediaExtensionOptions {
28
+ resolveUrl?: (url: string) => Promise<string>;
29
+ actions?: readonly string[];
30
+ videoSources?: () => readonly VideoSourceEntry[];
31
+ Image?: ComponentType<{
32
+ url: string;
33
+ alt?: string;
34
+ className?: string;
35
+ style?: React.CSSProperties;
36
+ onLoad?: React.ReactEventHandler<HTMLImageElement>;
37
+ onError?: React.ReactEventHandler<HTMLImageElement>;
38
+ }>;
39
+ }
40
+ /** 浏览器实现的媒体信息探测(objectURL 解码),无宿主 IMediaInfoService 时的兜底 */
41
+ export declare const browserMediaInfo: MediaInfoService;
42
+ export declare const MediaExtensionContext: import("react").Context<MediaExtensionOptions>;
43
+ export declare const useMediaExtension: () => MediaExtensionOptions;
44
+ /**
45
+ * 从宿主服务构造媒体插件的运行时能力:
46
+ * upload 按 shared 契约把“空串 / null / 抛错”统一视为失败(空串归一为 null,抛错自然冒泡),
47
+ * 缺失 IMediaInfoService 时退回浏览器实现。
48
+ */
49
+ export declare function mediaCapabilitiesFromServices(api: WhiteboardAPI, actions?: readonly string[]): MediaCapabilities;
50
+ export declare function mediaMenu(items: PluginContextMenuItem[], kind: "image" | "video" | "audio", options: MediaCapabilities): PluginContextMenuItem[];
@@ -0,0 +1,2 @@
1
+ export declare function useSelection(): import("../index").Selection;
2
+ export declare function useViewPort(): import("../index").ViewPort;
@@ -0,0 +1,95 @@
1
+ import { type ServiceRegistry } from "../../../shared/service-registry";
2
+ import type Board from "../Board";
3
+ import type { WhiteboardAPI, WhiteboardContributions, WhiteboardElementDefinition, WhiteboardExtension, WhiteboardExtensionError } from "./api";
4
+ import type { PluginContextMenuItem, BoardElement } from "../types/board";
5
+ export declare class ExtensionRuntime {
6
+ readonly entries: {
7
+ id: string;
8
+ api: WhiteboardAPI;
9
+ value: WhiteboardContributions;
10
+ }[];
11
+ readonly api: WhiteboardAPI;
12
+ private readonly board;
13
+ private cleanups;
14
+ private active;
15
+ private disposed;
16
+ private readonly scopes;
17
+ private readonly authorOwners;
18
+ private readonly authorTypes;
19
+ private readonly owners;
20
+ private readonly rejectedErrors;
21
+ /** 已装配扩展声明的元素定义(含版本与迁移函数),type → 定义 */
22
+ private readonly elementDefinitions;
23
+ /** 创建型工具 id → 元素 type(工具与元素同扩展装配校验) */
24
+ private readonly createTools;
25
+ /** 工具 id → 所属扩展 id(「扩展工具」菜单显示"来自 {name}"用) */
26
+ private readonly toolOwners;
27
+ /** 扩展 id → 展示名(WhiteboardExtension.name) */
28
+ private readonly extensionNames;
29
+ /** create 成功后被拒的扩展声明的元素 type → 扩展 id(用于占位原因 "disabled") */
30
+ private readonly rejectedTypeOwners;
31
+ /** 快捷键条目:tau 扩展在前(内置键优先),其余按装配顺序,同一扩展内按声明顺序 */
32
+ private readonly hotkeyEntries;
33
+ private readonly menuActions;
34
+ getRejectedExtensions(): readonly WhiteboardExtensionError[];
35
+ /** 扩展展示名(未声明或已禁用的扩展返回 undefined) */
36
+ getExtensionName(id: string): string | undefined;
37
+ ownerOf(type: string): string;
38
+ /** 工具所属扩展 id;未注册或已被禁用的工具返回 undefined */
39
+ toolOwner(toolId: string): string | undefined;
40
+ beginMenu(): void;
41
+ registerMenu(type: string, items: PluginContextMenuItem[]): PluginContextMenuItem[];
42
+ constructor(board: Board, extensions: readonly WhiteboardExtension[], onExtensionError?: (error: WhiteboardExtensionError) => void, services?: ServiceRegistry, extensionServices?: (id: string, api: WhiteboardAPI) => ServiceRegistry);
43
+ /** 渲染 UnknownElement 时的原因判定:未知类型、被拒扩展的元素,或元素版本与定义不兼容 */
44
+ authorOfType(type: string): string | undefined;
45
+ isHostElement(type: string): boolean;
46
+ getElementDefinition(type: string): WhiteboardElementDefinition<unknown> | undefined;
47
+ getElementDefinitions(): WhiteboardElementDefinition<unknown>[];
48
+ supportsSketch(type: string): boolean;
49
+ unknownElementReason(element: BoardElement): {
50
+ reason: "missing" | "too-new" | "migration-failed" | "disabled";
51
+ extensionId?: string;
52
+ } | undefined;
53
+ /** 命令第一个绑定快捷键的展示文字:hotkeyEntries 已按「tau 优先 + 装配顺序」排列,无绑定返回 null */
54
+ getShortcut(commandId: string): string | null;
55
+ /**
56
+ * 执行结果校验(在 applyOperations 返回之后、任何状态提交之前调用):
57
+ * 新旧树按 id 比较元素引用(copy-on-write 保证未改动元素引用不变),引用变化或新增
58
+ * 且带 schema 且版本兼容的元素校验 data——天然覆盖 insert / set / move 混排,不依赖
59
+ * 路径解析。不合规抛 WhiteboardValidationError,调用方尚未提交任何状态,原子性保持。
60
+ */
61
+ validateChangedElements(oldChildren: readonly BoardElement[], newChildren: readonly BoardElement[]): void;
62
+ private guard;
63
+ setActive(active: boolean): void;
64
+ dispose(): void;
65
+ /** 按命令 id 查找归属扩展与命令定义(装配顺序优先) */
66
+ private findCommand;
67
+ authorOfEvent(event: string): string | undefined;
68
+ authorOfTool(id: string): string | undefined;
69
+ executeFor(owner: string, id: string, payload?: unknown): Promise<unknown>;
70
+ execute(id: string, payload?: unknown): Promise<unknown>;
71
+ /**
72
+ * 快捷键仲裁:按「tau 优先 + 装配顺序」找全部键匹配的条目,第一条 enabled 的命令
73
+ * 才拦截(preventDefault + stopPropagation)并执行;全部不可用则放行给后续链。
74
+ * 输入法组合、编辑上下文、元素编辑中与演示态整体让位(命令 enabled 仍可自行收紧)。
75
+ */
76
+ onKeyDown(event: KeyboardEvent): boolean;
77
+ ingest(source: "paste" | "drop", event: ClipboardEvent | DragEvent): boolean;
78
+ acceptsDrop(event: DragEvent): boolean;
79
+ get tools(): import("./api").WhiteboardToolContribution[];
80
+ /** 创建型工具查询:id 对应的元素 type 与定义(含 create 规格);非创建型工具返回 null */
81
+ getCreateTool(toolId: string): {
82
+ elementType: string;
83
+ definition: WhiteboardElementDefinition;
84
+ } | null;
85
+ /** 工具点击入口:创建型工具切换激活(同工具无参数时切回选择),命令型工具执行命令 */
86
+ runTool(tool: {
87
+ id: string;
88
+ command?: string;
89
+ element?: string;
90
+ }, payload?: unknown): void;
91
+ get layers(): import("./api").WhiteboardLayerContribution[];
92
+ renderToolPanel(toolId: string, run: (payload?: unknown) => void): import("react/jsx-runtime").JSX.Element | null;
93
+ renderLayers(position: "canvas" | "outside"): import("react/jsx-runtime").JSX.Element[];
94
+ get inspectors(): any;
95
+ }
@@ -0,0 +1,58 @@
1
+ import { type ComponentType, type ComponentPropsWithRef } from "react";
2
+ import { Editor, type EditorKit } from "../../../editor/src/index";
3
+ import type { Descendant } from "slate";
4
+ export type WhiteboardTextEditorProps = ComponentPropsWithRef<typeof Editor> & {
5
+ contentId?: number;
6
+ editingContext?: {
7
+ entityType: string;
8
+ entityId: string;
9
+ };
10
+ };
11
+ /** 宿主提供的白板富文本能力:编辑器组件、测量 kit 与正文持久化。 */
12
+ export interface WhiteboardRichTextService {
13
+ /** 与宿主正文保存使用同一套扩展统计规则。 */
14
+ countWords?(content: readonly Descendant[]): number;
15
+ /** 必有:宿主提供的正文编辑器,或兜底实现 */
16
+ Editor: ComponentType<WhiteboardTextEditorProps>;
17
+ /** 测量与只读渲染共用 */
18
+ kit(contentId?: number): EditorKit;
19
+ /** 正文持久化:有它才能创建独立正文 */
20
+ content?: {
21
+ create(content: Descendant[], length: number, refCount?: number): Promise<number | null>;
22
+ update(id: number, content: Descendant[]): Promise<unknown>;
23
+ release(id: number): Promise<unknown>;
24
+ retain(id: number): Promise<unknown>;
25
+ unretain(id: number): Promise<unknown>;
26
+ };
27
+ Observer?: ComponentType<{
28
+ contentId: number;
29
+ onChange(value: Descendant[]): void;
30
+ }>;
31
+ importMarkdown?(text: string): Descendant[];
32
+ }
33
+ export declare const IWhiteboardRichText: import("../../../editor/src/index").ServiceIdentifier<WhiteboardRichTextService>;
34
+ /** 正文扩展私有的绑定,画布内核不读取正文身份或 Kit。 */
35
+ export interface TextExtensionOptions {
36
+ countWords?(content: readonly Descendant[]): number;
37
+ kit(contentId?: number): EditorKit;
38
+ Editor?: ComponentType<WhiteboardTextEditorProps>;
39
+ Observer?: ComponentType<{
40
+ contentId: number;
41
+ onChange(value: Descendant[]): void;
42
+ }>;
43
+ Selector?: ComponentType<any>;
44
+ create?(content: Descendant[], length: number, refCount?: number): Promise<number | null>;
45
+ update?(id: number, content: Descendant[]): Promise<unknown>;
46
+ release?(id: number): Promise<unknown>;
47
+ retain?(id: number): Promise<unknown>;
48
+ unretain?(id: number): Promise<unknown>;
49
+ importMarkdown?(text: string): Descendant[];
50
+ }
51
+ /** 无宿主时的嵌入式富文本服务:basicKit + 兜底编辑器,无正文持久化 */
52
+ export declare function createEmbeddedRichTextService(): WhiteboardRichTextService;
53
+ export declare const embeddedTextOptions: TextExtensionOptions;
54
+ export declare const TextExtensionContext: import("react").Context<TextExtensionOptions>;
55
+ export declare const useTextExtension: () => TextExtensionOptions;
56
+ /** 服务 → 正文扩展绑定:宿主未提供正文持久化时各回调保持缺失 */
57
+ export declare function textOptionsFromService(service: WhiteboardRichTextService, Selector?: TextExtensionOptions["Selector"]): TextExtensionOptions;
58
+ export declare function TextEditor({ contentId, editingContext, ...props }: WhiteboardTextEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { WhiteboardElementDefinition } from "./api";
2
+ export declare function assertWhiteboardElementVersions(element: WhiteboardElementDefinition): void;
@@ -0,0 +1,6 @@
1
+ export declare const useBoardState: () => {
2
+ isMoving: boolean;
3
+ movingStore: import("./useElementsMoving").MovingElementsStore;
4
+ simplifiedRenderZoomThreshold: number;
5
+ connectPointOwnerStore: import("../utils/ConnectPointOwner").ConnectPointOwnerStore | null;
6
+ };