@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
@@ -1,6 +1,7 @@
1
1
  import type { ComponentType } from "react";
2
2
  import type { Disposable, PluginContext } from "./index";
3
3
  import type { JsonValue } from "./json";
4
+ import type { ProviderForm } from "./provider-form";
4
5
  export interface PluginSettingsProps {
5
6
  readonly context: PluginContext;
6
7
  readonly publishConfig?: {
@@ -30,27 +31,29 @@ export interface PluginSettingsProps {
30
31
  label?: string;
31
32
  }[]): Promise<void>;
32
33
  };
33
- readonly uploadConfig?: {
34
- readonly value: JsonValue;
35
- save(value: JsonValue): Promise<void>;
36
- };
37
34
  readonly videoConfig?: {
38
35
  readonly value: JsonValue;
39
36
  save(value: JsonValue): Promise<void>;
40
37
  };
41
- readonly syncConfig?: {
42
- readonly value: JsonValue;
43
- save(value: JsonValue): Promise<void>;
44
- };
45
38
  }
46
- export interface PluginSettingsDefinition {
39
+ interface PluginSettingsBase {
47
40
  id: string;
48
41
  title: string;
49
42
  description?: string;
43
+ }
44
+ /** 存储提供方的连接配置:只声明字段,由宿主在插件设置页按平台渲染与保存。 */
45
+ export interface PluginProviderSettingsDefinition extends PluginSettingsBase {
46
+ target: "sync" | "upload";
47
+ form: ProviderForm;
48
+ component?: never;
49
+ }
50
+ export interface PluginComponentSettingsDefinition extends PluginSettingsBase {
50
51
  /** 提供方配置表单挂载到对应宿主设置;普通插件设置省略。 */
51
- target?: "sync" | "upload" | "tts" | "asr" | "images" | "video" | "publish";
52
+ target?: "tts" | "asr" | "images" | "video" | "publish";
52
53
  component: ComponentType<PluginSettingsProps>;
54
+ form?: never;
53
55
  }
56
+ export type PluginSettingsDefinition = PluginProviderSettingsDefinition | PluginComponentSettingsDefinition;
54
57
  export interface PluginSettingsHandle extends Disposable {
55
58
  readonly id: string;
56
59
  open(): Promise<void>;
@@ -59,3 +62,4 @@ export interface PluginSettings {
59
62
  /** 分区随本次激活回收;提供方保存使用配置属性,普通设置使用 context.storage。 */
60
63
  register(definition: PluginSettingsDefinition): PluginSettingsHandle;
61
64
  }
65
+ export {};
@@ -1,7 +1,8 @@
1
1
  export { defineElement, defineWhiteboardExtension, useWhiteboardAPI, useSketch, usePageSketch, AttrPopover, AttrToggle, OptionGrid, Seg, SketchPopover, sketch, SketchPaths, } from "../../whiteboard/src/author";
2
2
  export type { SketchPath, Vec } from "../../whiteboard/src/author";
3
3
  export type { SchematicShape, SchematicFill, ResolvedSketch, ElementSketch, PageSketch, SketchLevel, } from "../../whiteboard/src/author";
4
- export type { WhiteboardAPI, WhiteboardExtension, WhiteboardElementDefinition, WhiteboardContributions, TypedBoardElement, ElementCreateSpec, WhiteboardSnapshot, BoardElement, WhiteboardToolProps, } from "../../whiteboard/src/author";
4
+ export type { WhiteboardAPI, WhiteboardIdCommand, WhiteboardShellPatch, WhiteboardGeometry, WhiteboardData, WhiteboardExtension, WhiteboardElementDefinition, WhiteboardContributions, TypedBoardElement, ElementCreateSpec, WhiteboardSnapshot, BoardElement, WhiteboardToolProps, } from "../../whiteboard/src/author";
5
+ import { type ServiceIdentifier } from "../../shared/service-contract";
5
6
  import type { PluginStorage } from "./contract";
6
7
  /** 由宿主按插件和工作区绑定,交互扩展通过 getService 获取。 */
7
- export declare const IPluginStorage: import("../../shared/service-contract").ServiceIdentifier<PluginStorage>;
8
+ export declare const IPluginStorage: ServiceIdentifier<PluginStorage>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * OKLCH 取色与 WCAG 对比度工具。
3
+ * 思维导图主题用它从「色相 + 彩度」种子派生各层级颜色:OKLCH 的 L 在感知上均匀,
4
+ * 同一 L 下不同色相的明暗接近,才能保证一套主题里每个分支的对比度一致。
5
+ */
6
+ export interface Tone {
7
+ hex: string;
8
+ /** WCAG 相对亮度(0~1) */
9
+ luminance: number;
10
+ }
11
+ /** OKLCH → sRGB;超出色域时保持 L、H 不变,二分降低彩度 */
12
+ export declare function oklch(l: number, c: number, h: number): Tone;
13
+ export declare function hexTone(hex: string): Tone;
14
+ export declare function contrast(a: Tone, b: Tone): number;
15
+ /**
16
+ * 从目标亮度出发,沿 direction 逐步调整 L,直到与 against 的对比度达标。
17
+ * 调到尽头仍不达标时返回最后一档(调用方的单测会兜住这种情况)。
18
+ */
19
+ export declare function fitTone(l: number, c: number, h: number, against: Tone, minRatio: number, direction: "darker" | "lighter"): Tone;
@@ -0,0 +1,18 @@
1
+ import { type ServiceIdentifier } from "./service-contract";
2
+ /** 宿主媒体信息探测能力:解析本地文件的像素尺寸(解码失败返回 null)。 */
3
+ export interface MediaInfoService {
4
+ imageInfo(file: File): Promise<{
5
+ width: number;
6
+ height: number;
7
+ } | null>;
8
+ videoInfo(file: File): Promise<{
9
+ width: number;
10
+ height: number;
11
+ } | null>;
12
+ }
13
+ export declare const IMediaInfoService: ServiceIdentifier<MediaInfoService>;
14
+ /** 宿主下载能力:将远程资源保存到宿主侧(浏览器下载、另存到本地等)。 */
15
+ export interface DownloadService {
16
+ download(url: string): Promise<unknown>;
17
+ }
18
+ export declare const IDownloadService: ServiceIdentifier<DownloadService>;
@@ -0,0 +1 @@
1
+ export type WebLinkSourceType = "remote" | "local";
@@ -0,0 +1,54 @@
1
+ /** ask-question 提问工具的载荷、作答与结果(纯数据,主进程、渲染端与浏览器扩展共用) */
2
+ export declare const ASK_QUESTION_TOOL_NAME: "ask-question";
3
+ export type AskQuestionType = "single" | "multiple";
4
+ export interface AskQuestionOption {
5
+ label: string;
6
+ value: string;
7
+ description?: string;
8
+ }
9
+ export interface AskQuestionItem {
10
+ id: string;
11
+ question: string;
12
+ type: AskQuestionType;
13
+ options: AskQuestionOption[];
14
+ required: boolean;
15
+ }
16
+ export interface AskQuestionPayload {
17
+ title?: string;
18
+ description?: string;
19
+ submitLabel?: string;
20
+ questions: AskQuestionItem[];
21
+ }
22
+ export interface AskQuestionAnswerItem {
23
+ questionId: string;
24
+ selectedValues: string[];
25
+ otherText: string;
26
+ }
27
+ export interface AskQuestionSubmission {
28
+ answers: AskQuestionAnswerItem[];
29
+ submittedAt: number;
30
+ }
31
+ export interface AskQuestionResolvedAnswer {
32
+ questionId: string;
33
+ question: string;
34
+ type: AskQuestionType;
35
+ required: boolean;
36
+ selectedOptions: Array<{
37
+ value: string;
38
+ label: string;
39
+ }>;
40
+ otherText: string;
41
+ }
42
+ export interface AskQuestionToolResult {
43
+ type: "ask-question-result";
44
+ submittedAt: number;
45
+ answers: AskQuestionResolvedAnswer[];
46
+ }
47
+ export interface AskQuestionNormalizationResult {
48
+ payload?: AskQuestionPayload;
49
+ error?: string;
50
+ }
51
+ export declare const normalizeAskQuestionPayload: (input: unknown) => AskQuestionNormalizationResult;
52
+ /** 第一个未作答的必答题(既没选项也没填「其他」);全部答完返回 undefined */
53
+ export declare const findUnansweredQuestion: (payload: AskQuestionPayload, answers: AskQuestionAnswerItem[]) => AskQuestionItem | undefined;
54
+ export declare const buildAskQuestionToolResult: (payload: AskQuestionPayload, submission: AskQuestionSubmission) => AskQuestionToolResult;
@@ -4,3 +4,4 @@ export * from "./messageSchema";
4
4
  export * from "./assistantBlocks";
5
5
  export * from "./streamEvents";
6
6
  export * from "./aiRunProtocol";
7
+ export * from "./askQuestion";
@@ -0,0 +1,119 @@
1
+ export type TaskRef = {
2
+ kind: "todo";
3
+ todoId: number;
4
+ createdAt: number;
5
+ } | {
6
+ kind: "document";
7
+ contentId: number;
8
+ createdAt: number;
9
+ taskId: string;
10
+ };
11
+ export interface TaskOccurrenceRef {
12
+ seriesId: string;
13
+ occurrenceDate: string;
14
+ }
15
+ export interface TaskRecurrenceRule {
16
+ type: "daily" | "weekdays" | "weekly" | "monthly" | "yearly" | "custom";
17
+ interval: number;
18
+ startDate: string;
19
+ endDate?: string | null;
20
+ weekdays?: number[];
21
+ monthDay?: number;
22
+ yearMonth?: number;
23
+ yearDay?: number;
24
+ maxOccurrences?: number | null;
25
+ excludeHolidays?: boolean;
26
+ }
27
+ export interface TaskRecurrenceSegment {
28
+ seriesId: string;
29
+ effectiveDate: string;
30
+ rule: TaskRecurrenceRule | null;
31
+ }
32
+ export interface TaskOccurrenceState {
33
+ completedAt?: number | null;
34
+ skipped?: boolean;
35
+ scheduledAt?: string | null;
36
+ }
37
+ export interface DocumentTaskAttributes {
38
+ taskReminder?: {
39
+ version: 1;
40
+ at: string;
41
+ } | null;
42
+ taskRecurrence?: {
43
+ version: 1;
44
+ segments: TaskRecurrenceSegment[];
45
+ } | null;
46
+ taskOccurrenceState?: Record<string, TaskOccurrenceState>;
47
+ taskArchived?: boolean;
48
+ taskCompletedAt?: number | null;
49
+ }
50
+ export interface AssistantTask {
51
+ taskRef: TaskRef;
52
+ revision: string;
53
+ title: string;
54
+ completed: boolean;
55
+ archived: boolean;
56
+ dueAt: string | null;
57
+ groupId: number | null;
58
+ sourceTitle?: string;
59
+ sourceRef?: {
60
+ kind: "card" | "article" | "project-item" | "diary-moment";
61
+ id: number;
62
+ };
63
+ documentRevision?: string;
64
+ occurrence?: TaskOccurrenceRef;
65
+ reminderAt?: string | null;
66
+ recurrence?: TaskRecurrenceSegment[];
67
+ writable: boolean;
68
+ readonlyReason?: string;
69
+ }
70
+ export interface AssistantCalendarEvent {
71
+ eventId: number;
72
+ createdAt: number;
73
+ revision: string;
74
+ title: string;
75
+ calendarId: number;
76
+ start: string;
77
+ end: string;
78
+ allDay: boolean;
79
+ taskRef?: TaskRef;
80
+ occurrence?: TaskOccurrenceRef;
81
+ writable: boolean;
82
+ }
83
+ export interface AssistantQueryResult<T> {
84
+ type: "assistant-tasks" | "assistant-calendar" | "assistant-operations";
85
+ databaseName: string;
86
+ items: T[];
87
+ hasMore: boolean;
88
+ nextCursor: string | null;
89
+ incomplete: boolean;
90
+ warnings: string[];
91
+ document?: {
92
+ contentId: number;
93
+ createdAt: number;
94
+ revision: string;
95
+ };
96
+ }
97
+ export interface TaskOperationResult {
98
+ requestId: string;
99
+ operationId?: string;
100
+ status: "succeeded" | "pending" | "failed" | "notExecuted";
101
+ result?: unknown;
102
+ error?: {
103
+ code: string;
104
+ message: string;
105
+ };
106
+ undoableUntil?: number;
107
+ }
108
+ export interface TaskBatchResult {
109
+ type: "assistant-task-operation";
110
+ databaseName: string;
111
+ batchId: string;
112
+ items: TaskOperationResult[];
113
+ }
114
+ export declare class TaskAssistantError extends Error {
115
+ readonly code: string;
116
+ constructor(code: string, message: string);
117
+ }
118
+ export declare function taskKey(ref: TaskRef): string;
119
+ export declare function occurrenceKey(ref: TaskOccurrenceRef): string;
@@ -0,0 +1,14 @@
1
+ import { type DocumentTaskAttributes, type TaskOccurrenceRef, type TaskOccurrenceState, type TaskRecurrenceSegment } from "./contracts";
2
+ export declare function taskOccurrencesInRange(segments: TaskRecurrenceSegment[], states: Record<string, TaskOccurrenceState>, start: string, end: string, holidays?: Set<number>): {
3
+ occurrence: TaskOccurrenceRef;
4
+ scheduledAt: string;
5
+ state: TaskOccurrenceState;
6
+ }[];
7
+ /** 正文勾选只改变当天实例;没有当天实例时不能把整个周期标为完成。 */
8
+ export declare function documentTaskOccurrence(attributes: DocumentTaskAttributes, now?: Date): TaskOccurrenceRef | null;
9
+ export declare function documentTaskCheck(attributes: DocumentTaskAttributes & {
10
+ checked?: boolean;
11
+ }, checked: boolean, now?: number): Record<string, unknown> | null;
12
+ export declare function documentTaskIsChecked(attributes: DocumentTaskAttributes & {
13
+ checked?: boolean;
14
+ }, now?: Date): boolean;
@@ -0,0 +1,42 @@
1
+ export interface TaskSchema {
2
+ type?: string;
3
+ description?: string;
4
+ properties?: Record<string, TaskSchema>;
5
+ required?: string[];
6
+ additionalProperties?: boolean;
7
+ items?: TaskSchema;
8
+ enum?: string[];
9
+ anyOf?: TaskSchema[];
10
+ minItems?: number;
11
+ maxItems?: number;
12
+ minimum?: number;
13
+ maximum?: number;
14
+ minLength?: number;
15
+ maxLength?: number;
16
+ [key: string]: unknown;
17
+ }
18
+ export declare const TASK_WRITE_SCHEMAS: {
19
+ create_todo: TaskSchema;
20
+ update_todo: TaskSchema;
21
+ set_todo_completed: TaskSchema;
22
+ delete_todo: TaskSchema;
23
+ set_todo_recurrence: TaskSchema;
24
+ update_todo_occurrence: TaskSchema;
25
+ create_calendar_event: TaskSchema;
26
+ update_calendar_event: TaskSchema;
27
+ delete_calendar_event: TaskSchema;
28
+ undo_task_operation: TaskSchema;
29
+ };
30
+ export type TaskWriteName = keyof typeof TASK_WRITE_SCHEMAS;
31
+ export declare const TASK_READ_SCHEMAS: {
32
+ query_todos: TaskSchema;
33
+ query_calendar_events: TaskSchema;
34
+ query_task_operations: TaskSchema;
35
+ };
36
+ export type TaskReadName = keyof typeof TASK_READ_SCHEMAS;
37
+ export type TaskToolName = TaskReadName | TaskWriteName;
38
+ export declare const TASK_TOOL_DESCRIPTIONS: Record<TaskToolName, string>;
39
+ /** 本地校验标记不进入模型厂商的 JSON Schema。 */
40
+ export declare function taskToolSchema(name: TaskToolName): TaskSchema;
41
+ export declare function validateTaskValue(schema: TaskSchema, value: unknown, path?: string): void;
42
+ export declare function validateTaskTool(name: TaskToolName, args: unknown): asserts args is Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ export * from "./src/task-assistant/contracts";
2
+ export * from "./src/task-assistant/schema";
3
+ export * from "./src/task-assistant/document-state";
@@ -0,0 +1,180 @@
1
+ import React from "react";
2
+ import SnapManager from "./utils/snap/SnapManager";
3
+ import { PresentationManager } from "./utils/PresentationManager";
4
+ import { Operation, Selection, IBoardPlugin, BoardElement, ViewPort, PresentationSequence, ElementBounds, BoardContextMenuPayload, PluginContextMenuItem, CustomOffset, PageSketch } from "./types/index";
5
+ import { CapabilityService } from "./services/CapabilityService";
6
+ import { InteractionManager } from "./interactions/InteractionManager";
7
+ import { ExtensionRuntime } from "./extensions/runtime";
8
+ import type { WhiteboardAPI, WhiteboardExtension, WhiteboardExtensionError } from "./extensions/api";
9
+ import type { ServiceRegistry } from "../../shared/service-registry";
10
+ import type { WhiteboardDocumentBinding } from "./document";
11
+ import { boardFlag } from "./constants/boardIdentity";
12
+ interface VisibleElementTree {
13
+ element: BoardElement;
14
+ children: VisibleElementTree[];
15
+ }
16
+ declare class Board {
17
+ static boardFlag: symbol;
18
+ document?: WhiteboardDocumentBinding;
19
+ private disconnectDocument?;
20
+ private projectingDocument;
21
+ attachDocument(document: WhiteboardDocumentBinding): void;
22
+ publishDocument(children: BoardElement[], sketch?: PageSketch, sequences?: PresentationSequence[]): void;
23
+ private plugins;
24
+ private eventEmitter;
25
+ snap: SnapManager;
26
+ capabilityService: CapabilityService;
27
+ interactions: InteractionManager;
28
+ mindThemePreviewStore: import("zustand").StoreApi<import("./utils/MindThemePreviewStore").MindThemePreviewState>;
29
+ private active;
30
+ extensions?: ExtensionRuntime;
31
+ private historyGroup;
32
+ /** undo/redo 重放标记:重放历史操作不进提交校验(数据提交时已校验过) */
33
+ private replayingHistory;
34
+ installExtensions(extensions: readonly WhiteboardExtension[], onExtensionError?: (error: WhiteboardExtensionError) => void, services?: ServiceRegistry, extensionServices?: (id: string, api: WhiteboardAPI) => ServiceRegistry): void;
35
+ /** 加载期迁移落盘:替换 children 并重建快照,不进 undo 历史、不 emit change */
36
+ replaceChildrenSilently(children: BoardElement[]): void;
37
+ private submissionVersion;
38
+ private removedElementVersions;
39
+ setActive(active: boolean): void;
40
+ captureSubmission(element?: BoardElement): () => boolean;
41
+ getFontSize(): number;
42
+ presentationManager: PresentationManager;
43
+ boardFlag: typeof boardFlag;
44
+ isDestroyed: boolean;
45
+ children: BoardElement[];
46
+ viewPort: ViewPort;
47
+ selection: Selection;
48
+ /** 页级画风(D-107);变化时 emit("sketch:change") */
49
+ sketch: PageSketch;
50
+ undos: Array<Operation[]>;
51
+ redos: Array<Operation[]>;
52
+ isEditingElements: string[];
53
+ private lastUndoTimestamp;
54
+ private elementVersion;
55
+ private containerRectCache;
56
+ /**
57
+ * 容器视口矩形(缓存):指针热路径(每次 pointermove 的坐标转换)高频读取,
58
+ * getBoundingClientRect 在上一帧 DOM 写入后会把整文档强制重排(大页面百 ms 级)。
59
+ * 平移/手势期间容器几何不变,缓存恒命中;布局变化经 invalidateContainerRect 失效
60
+ * (容器 ResizeObserver 与窗口滚动捕获,见 WhiteBoard 接线)。
61
+ */
62
+ getContainerRect(): {
63
+ x: number;
64
+ y: number;
65
+ } | null;
66
+ invalidateContainerRect(): void;
67
+ /** 剔除滞回的上一轮保留集合(见 filterElementsInViewport 的宽退出盒说明) */
68
+ private cullRetainedIds;
69
+ private snapshot;
70
+ /** 当前工具("tau.select" 表示非创建模式) */
71
+ private _activeTool;
72
+ private _activeToolOptions;
73
+ /**
74
+ * 创建手势的预览覆盖层状态:预览元素从不进入 children、快照、onChange 与历史;
75
+ * 变化时 emit("internal:creation-preview-change")。leaving 表示取消退场中(120ms 后清空)。
76
+ */
77
+ creationPreview: {
78
+ element: BoardElement;
79
+ highlight: readonly string[];
80
+ leaving: boolean;
81
+ /** 尺寸徽标文本(drag 已移动时由内核计算,line 约束显示长度) */
82
+ sizeLabel?: string;
83
+ /** 是否绘制包围盒描边(手写笔迹等传 false) */
84
+ bounds: boolean;
85
+ } | null;
86
+ /** 设置/清除创建预览;element 为 null 时清除 */
87
+ setCreationPreview(element: BoardElement | null, options?: {
88
+ highlight?: readonly string[];
89
+ sizeLabel?: string;
90
+ bounds?: boolean;
91
+ }): void;
92
+ /** 标记预览进入取消退场(渲染层播放 120ms 淡出) */
93
+ markCreationPreviewLeaving(): void;
94
+ constructor(children: BoardElement[], viewPort: ViewPort, selection: Selection, plugins?: IBoardPlugin[], presentationSequences?: PresentationSequence[], readonly?: boolean, sketch?: PageSketch);
95
+ private _readonly;
96
+ /** 文档版本过高导致的强制只读原因;普通只读为 null。宿主(WhiteBoard 组件)负责设置。 */
97
+ readonlyReason: "document-too-new" | null;
98
+ get readonly(): boolean;
99
+ set readonly(value: boolean);
100
+ on(event: string, listener: (...args: any[]) => void): void;
101
+ off(event: string, listener: (...args: any[]) => void): void;
102
+ emit(event: string, ...args: any[]): void;
103
+ once(event: string, listener: (...args: any[]) => void): void;
104
+ destroy(): void;
105
+ initPlugins(plugins: IBoardPlugin[]): void;
106
+ addPlugin(plugin: IBoardPlugin): void;
107
+ isHit(element: BoardElement, x: number, y: number): boolean;
108
+ moveElement(element: BoardElement, offsetX: number, offsetY: number): BoardElement | null | undefined;
109
+ getBounds(element: BoardElement): ElementBounds | null;
110
+ onMouseDown(event: MouseEvent): void;
111
+ onGlobalMouseDown(event: MouseEvent): void;
112
+ onMouseMove(event: MouseEvent): void;
113
+ onMouseUp(event: MouseEvent): void;
114
+ onGlobalMouseUp(event: MouseEvent): void;
115
+ onMouseLeave(event: MouseEvent): void;
116
+ onMouseEnter(event: MouseEvent): void;
117
+ onClick(event: MouseEvent): void;
118
+ onDblClick(event: MouseEvent): void;
119
+ onContextMenu(event: MouseEvent): void;
120
+ getContextMenu(context: BoardContextMenuPayload): PluginContextMenuItem[];
121
+ onWheel(event: WheelEvent): void;
122
+ onKeyDown(event: KeyboardEvent): void;
123
+ /**
124
+ * Esc 只承担退出创建模式(浮层退场语义之外无其它角色)。让位规则:
125
+ * 输入法组合在 onKeyDown 入口已让位;元素编辑中、演示态与编辑上下文
126
+ * (输入框/可编辑节点)让位;portal 浮层的事件本就不归属画布(ownsBoardEvent),
127
+ * 天然优先于本处理。
128
+ */
129
+ private exitCreateToolOnEscape;
130
+ onKeyUp(event: KeyboardEvent): void;
131
+ onPointerDown(event: PointerEvent): void;
132
+ onPointerUp(event: PointerEvent): void;
133
+ onPointerMove(event: PointerEvent): void;
134
+ onGlobalPointerDown(event: PointerEvent): void;
135
+ onGlobalPointerUp(event: PointerEvent): void;
136
+ onGlobalPointerMove(event: PointerEvent): void;
137
+ onGlobalPointerCancel(event: PointerEvent): void;
138
+ onPaste(event: ClipboardEvent): void;
139
+ onCopy(event: ClipboardEvent): void;
140
+ onCut(event: ClipboardEvent): void;
141
+ onDrop(event: DragEvent): void;
142
+ onDragOver(event: DragEvent): void;
143
+ onDragEnter(event: DragEvent): void;
144
+ onDragLeave(event: DragEvent): void;
145
+ /** 内部操作的唯一历史入口,缩放预览结束后也通过此入口提交。 */
146
+ recordHistory(processedOps: Operation[], historyGroup?: string): void;
147
+ apply(ops: Operation | Operation[], updateHistory?: boolean, historyGroup?: string): void;
148
+ isElementSelected(element: BoardElement, selectArea?: Selection["selectArea"]): boolean;
149
+ renderElement(element: BoardElement): React.ReactElement | null | undefined;
150
+ renderPluginElement(plugin: IBoardPlugin, element: BoardElement, children: React.ReactElement[]): import("react/jsx-runtime").JSX.Element;
151
+ renderElements(value?: BoardElement[]): (React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null | undefined)[];
152
+ getArrowBindPoint(element: BoardElement, connectId: string, customOffset?: CustomOffset): import("./types/index").Point | null;
153
+ undo(): void;
154
+ redo(): void;
155
+ subscribe(callback: () => void): () => void;
156
+ getSnapshot(): {
157
+ children: BoardElement[];
158
+ viewPort: ViewPort;
159
+ selection: Selection;
160
+ presentationSequences: PresentationSequence[];
161
+ sketch: PageSketch;
162
+ version: number;
163
+ };
164
+ getElementVersion(): number;
165
+ get activeTool(): string;
166
+ get activeToolOptions(): Readonly<Record<string, unknown>> | null;
167
+ /** 是否处于创建模式(非"选择"工具激活) */
168
+ isCreating(): boolean;
169
+ /**
170
+ * 设置当前工具;id 必须是已注册工具 id 或 "tau.select",否则抛错。
171
+ * 只读画布下非 select 的设置被忽略并返回 false。未传 options 视为清空参数。
172
+ */
173
+ setActiveTool(id: string, options?: Record<string, unknown>): boolean;
174
+ /** 写齐字段后统一发事件 */
175
+ private applyToolChange;
176
+ getPlugin<T extends IBoardPlugin>(name: string): T | undefined;
177
+ filterElementsInViewport(elements: BoardElement[], expandPixels?: number): VisibleElementTree[];
178
+ renderVisibleElements(elements?: VisibleElementTree[]): Array<React.ReactElement | null | undefined>;
179
+ }
180
+ export default Board;
@@ -0,0 +1,55 @@
1
+ import type { WhiteboardDocumentBinding } from "./document";
2
+ import React from "react";
3
+ import { type ServiceRegistry } from "../../shared/service-registry";
4
+ import { BoardElement, ViewPort, Selection, PresentationSequence, PageSketch } from "./types/index";
5
+ import type { WhiteboardExtension, WhiteboardExtensionError, WhiteboardOutline, WhiteboardSnapshot } from "./extensions/api";
6
+ export interface WhiteBoardProps {
7
+ document?: WhiteboardDocumentBinding;
8
+ extensions: readonly WhiteboardExtension[];
9
+ outline?: WhiteboardOutline;
10
+ className?: string;
11
+ style?: React.CSSProperties;
12
+ initData: BoardElement[] & {
13
+ presentationSequences?: PresentationSequence[];
14
+ };
15
+ initViewPort?: ViewPort;
16
+ initSelection?: Selection;
17
+ initPresentationSequences?: PresentationSequence[];
18
+ /** 页级画风(D-107),缺省为普通 */
19
+ initSketch?: PageSketch;
20
+ /** 加载的文档版本(getDocumentVersion(data)),缺省视为 1;高于支持范围时强制只读且不写回 */
21
+ version?: number;
22
+ readonly?: boolean;
23
+ onChange?: (data: WhiteboardSnapshot) => void;
24
+ showSidebar?: boolean;
25
+ showToolbar?: boolean;
26
+ showAttributeSetter?: boolean;
27
+ showStatusBar?: boolean;
28
+ /** 宿主追加在右下状态栏末尾的控件(如协作入口),演示模式下随状态栏隐藏 */
29
+ statusBarEnd?: React.ReactNode;
30
+ /** 进出演示模式(宿主页面据此收起画布外的浮动件,如页签条) */
31
+ onPresentationModeChange?: (presenting: boolean) => void;
32
+ /** 扩展被禁用时回调(命名空间违规、冲突、创建失败等),画布继续运行 */
33
+ onExtensionError?: (error: WhiteboardExtensionError) => void;
34
+ /** 宿主服务注册表:扩展经 requires/optional 声明后从扩展 api 获取;缺省为空注册表 */
35
+ services?: ServiceRegistry;
36
+ /** 宿主为特定扩展派生服务作用域;未提供时使用公共注册表。 */
37
+ extensionServices?: (id: string, api: import("./extensions/api").WhiteboardAPI) => ServiceRegistry;
38
+ }
39
+ export interface WhiteBoardRef {
40
+ fitAllElements: (padding?: number, animate?: boolean) => void;
41
+ getElements: () => BoardElement[];
42
+ zoomIn: () => void;
43
+ zoomOut: () => void;
44
+ zoomTo: (zoom: number) => void;
45
+ /** 选中并滚入视野,派发 element:flash 让元素闪一下;元素不存在返回 false */
46
+ revealElement: (id: string) => boolean;
47
+ }
48
+ /**
49
+ * 画板生命周期:渲染期只构造无副作用的 Board,文档连接与扩展装配放在提交期,完成后才挂载画布。
50
+ * 被丢弃的渲染(挂起、出错重试、StrictMode 双渲染)因此不会残留扩展实例或占用文档绑定;
51
+ * 销毁由画布在容器真正脱离文档时执行(见 WhiteBoardCanvas 的容器 effect)。
52
+ */
53
+ declare const WhiteBoard: React.NamedExoticComponent<WhiteBoardProps & React.RefAttributes<WhiteBoardRef>>;
54
+ export default WhiteBoard;
55
+ export * from "./types/index";
@@ -1,8 +1,9 @@
1
1
  /** 白板作者入口保持无 DOM 副作用,定义可在纯数据宿主中求值。 */
2
- export { defineElement, defineWhiteboardExtension } from "./extensions/api";
3
- export type { WhiteboardAPI, WhiteboardExtension, WhiteboardElementDefinition, WhiteboardContributions, TypedBoardElement, ElementCreateSpec, WhiteboardSnapshot, WhiteboardToolProps, } from "./extensions/api";
2
+ export { defineElement, defineWhiteboardExtension, useWhiteboardAPI } from "./extensions/authorApi";
3
+ export type { WhiteboardAPI, WhiteboardExtension, WhiteboardElementDefinition, WhiteboardContributions, WhiteboardSnapshot, WhiteboardIdCommand, WhiteboardShellPatch, WhiteboardGeometry, WhiteboardData, } from "./extensions/authorTypes";
4
4
  export type { BoardElement } from "./types/element";
5
- export { useWhiteboardAPI } from "./extensions/context";
5
+ export type { TypedBoardElement, WhiteboardToolProps } from "./extensions/api";
6
+ export type ElementCreateSpec<TData = unknown> = NonNullable<import("./extensions/authorTypes").WhiteboardElementDefinition<TData>["create"]>;
6
7
  export { useSketch, usePageSketch } from "./extensions/authorHooks";
7
8
  export { AttrPopover, AttrToggle, OptionGrid, Seg } from "./chrome/index";
8
9
  export { default as SketchPopover } from "./components/SketchPopover";
@@ -12,3 +13,4 @@ export type { SketchPath } from "./utils/sketch/types";
12
13
  export type { Vec } from "./utils/sketch/geometry";
13
14
  export type { SchematicShape, SchematicFill } from "./types/schematic";
14
15
  export type { ResolvedSketch, ElementSketch, PageSketch, SketchLevel } from "./types/sketch";
16
+ export { assertWhiteboardElementVersions } from "./extensions/versions";
@@ -0,0 +1,13 @@
1
+ import type { BoardElement, Point } from "../../types/index";
2
+ type ArrowConnectPointData = {
3
+ connectId: string;
4
+ point: Point;
5
+ };
6
+ interface ArrowConnectPointGroupProps {
7
+ element: BoardElement;
8
+ points: ArrowConnectPointData[];
9
+ isSelected: boolean;
10
+ disabled?: boolean;
11
+ }
12
+ declare const ArrowConnectPointGroup: import("react").MemoExoticComponent<(props: ArrowConnectPointGroupProps) => import("react/jsx-runtime").JSX.Element>;
13
+ export default ArrowConnectPointGroup;
@@ -0,0 +1,7 @@
1
+ interface ArrowDropConnectPointProps {
2
+ cx: number;
3
+ cy: number;
4
+ isActive: boolean;
5
+ }
6
+ declare const ArrowDropConnectPoint: import("react").MemoExoticComponent<(props: ArrowDropConnectPointProps) => import("react/jsx-runtime").JSX.Element>;
7
+ export default ArrowDropConnectPoint;
@@ -0,0 +1,13 @@
1
+ import { Board, EHandlerPosition, Point } from "../../types/index";
2
+ import { type DocumentElement } from "../../plugins/DocumentPlugin";
3
+ /** 画布上文档卡的圆角,宿主的纸面与选中框共用 */
4
+ export declare const DOCUMENT_CARD_RADIUS = 16;
5
+ interface DocumentElementProps {
6
+ element: DocumentElement;
7
+ onResizeStart?: (element: DocumentElement, startPoint: Point) => void;
8
+ onResize: (board: Board, element: DocumentElement, position: EHandlerPosition, startPoint: Point, endPoint: Point, isPreserveRatio?: boolean, isAdsorb?: boolean) => void;
9
+ onResizeEnd?: (board: Board, element: DocumentElement, position: EHandlerPosition, startPoint: Point, endPoint: Point) => void;
10
+ }
11
+ /** 文档卡外壳负责选中、缩放和连线,纸面由文档扩展的渲染闭包提供。 */
12
+ declare const DocumentElementComponent: import("react").MemoExoticComponent<(props: DocumentElementProps) => import("react/jsx-runtime").JSX.Element>;
13
+ export default DocumentElementComponent;
@@ -0,0 +1,15 @@
1
+ import { EHandlerPosition, Point } from "../../types/index";
2
+ interface ResizeCircleProps {
3
+ position: EHandlerPosition;
4
+ cx: number;
5
+ cy: number;
6
+ r: number;
7
+ fill: string;
8
+ innerRadius?: number;
9
+ innerFill?: string;
10
+ onResizeStart?: (startPoint: Point) => void;
11
+ onResize: (position: EHandlerPosition, startPoint: Point, endPoint: Point, isPreserveRatio?: boolean, isAdsorb?: boolean) => void;
12
+ onResizeEnd?: (position: EHandlerPosition, startPoint: Point, endPoint: Point) => void;
13
+ }
14
+ declare const ResizeCircle: import("react").MemoExoticComponent<(props: ResizeCircleProps) => import("react/jsx-runtime").JSX.Element>;
15
+ export default ResizeCircle;