@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.
- package/CHANGELOG.md +15 -0
- package/docs/README.md +2 -2
- package/docs/api-support.md +53 -40
- package/docs/editor-collaboration.md +187 -0
- package/docs/editor.md +30 -27
- package/docs/getting-started.md +3 -3
- package/docs/portability.md +8 -6
- package/docs/providers/README.md +13 -13
- package/docs/providers/asr.md +3 -1
- package/docs/providers/sync.md +41 -2
- package/docs/providers/tts.md +15 -0
- package/docs/providers/upload.md +43 -4
- package/docs/release.md +1 -1
- package/docs/whiteboard-collaboration.md +67 -0
- package/docs/whiteboard.md +79 -29
- package/package.json +5 -4
- package/publish-artifacts.js +9348 -73
- package/types/packages/collaboration/src/protocol.d.ts +144 -0
- package/types/packages/collaboration/src/whiteboard-contract.d.ts +6 -0
- package/types/packages/collaboration/src/whiteboard-types.d.ts +181 -0
- package/types/packages/collaboration/whiteboard-types.d.ts +1 -0
- package/types/packages/db-schema/content-contracts.d.ts +4 -1
- package/types/packages/db-schema/content-identities.d.ts +19 -0
- package/types/packages/db-schema/data-versions.d.ts +16 -0
- package/types/packages/editor/source-contracts.d.ts +13 -41
- package/types/packages/editor/src/Editor.d.ts +7 -0
- package/types/packages/editor/src/builtin-types.d.ts +22 -0
- package/types/packages/editor/src/core/CoreEditor.d.ts +44 -0
- package/types/packages/editor/src/core/api/elementView.d.ts +14 -0
- package/types/packages/editor/src/core/api/extension.d.ts +3 -8
- package/types/packages/editor/src/core/api/index.d.ts +6 -1
- package/types/packages/editor/src/core/api/slateTextFields.d.ts +6 -0
- package/types/packages/editor/src/core/api/textFieldInput.d.ts +14 -0
- package/types/packages/editor/src/core/document/EditorDocument.d.ts +74 -0
- package/types/packages/editor/src/core/extensions/markdown-paste-import/index.d.ts +10 -0
- package/types/packages/editor/src/core/hooks/useTouchVoidSelection.d.ts +10 -0
- package/types/packages/editor/src/core/index.d.ts +36 -0
- package/types/packages/editor/src/core/menu/defaultMenu.d.ts +2 -0
- package/types/packages/editor/src/core/plugins/withMarkdownPasteImport.d.ts +17 -0
- package/types/packages/editor/src/core/services/elementEditingPolicy.d.ts +0 -1
- package/types/packages/editor/src/core/utils/blockNavigation.d.ts +1 -1
- package/types/packages/editor/src/core/utils/editor.d.ts +2 -2
- package/types/packages/editor/src/core/utils/hotkey.d.ts +17 -0
- package/types/packages/editor/src/core/utils/index.d.ts +9 -0
- package/types/packages/editor/src/core/utils/normalizeEditorContent.d.ts +2 -0
- package/types/packages/editor/src/core/utils/plugin.d.ts +1 -1
- package/types/packages/editor/src/extensions/annotation/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/annotation/src/types.d.ts +6 -0
- package/types/packages/editor/src/extensions/blockquote/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/blockquote/src/types.d.ts +7 -0
- package/types/packages/editor/src/extensions/callout/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/callout/src/types.d.ts +11 -0
- package/types/packages/editor/src/extensions/callout/src/variants.d.ts +1 -0
- package/types/packages/editor/src/extensions/code-block/src/augmentations.d.ts +7 -0
- package/types/packages/editor/src/extensions/code-block/src/types/code-block.d.ts +40 -0
- package/types/packages/editor/src/extensions/code-block/src/types/index.d.ts +1 -0
- package/types/packages/editor/src/extensions/comment/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/comment/src/types.d.ts +15 -0
- package/types/packages/editor/src/extensions/detail/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/detail/src/types.d.ts +9 -0
- package/types/packages/editor/src/extensions/diagram/src/augmentations.d.ts +7 -0
- package/types/packages/editor/src/extensions/diagram/src/types/index.d.ts +4 -0
- package/types/packages/editor/src/extensions/diagram/src/types/mermaid.d.ts +12 -0
- package/types/packages/editor/src/extensions/diagram/src/types/plantuml.d.ts +6 -0
- package/types/packages/editor/src/extensions/diagram/src/types/typst.d.ts +9 -0
- package/types/packages/editor/src/extensions/divide-line/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/divide-line/src/types.d.ts +5 -0
- package/types/packages/editor/src/extensions/emoji/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/emoji/src/types.d.ts +9 -0
- package/types/packages/editor/src/extensions/front-matter/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/front-matter/src/types.d.ts +6 -0
- package/types/packages/editor/src/extensions/header/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/header/src/types.d.ts +8 -0
- package/types/packages/editor/src/extensions/highlight-block/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/highlight-block/src/types.d.ts +10 -0
- package/types/packages/editor/src/extensions/highlight-block/src/variants.d.ts +1 -0
- package/types/packages/editor/src/extensions/kbd/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/kbd/src/types.d.ts +5 -0
- package/types/packages/editor/src/extensions/link/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/link/src/types.d.ts +6 -0
- package/types/packages/editor/src/extensions/list/src/augmentations.d.ts +10 -0
- package/types/packages/editor/src/extensions/list/src/types/check-list.d.ts +25 -0
- package/types/packages/editor/src/extensions/list/src/types/list.d.ts +18 -0
- package/types/packages/editor/src/extensions/list/src/types.d.ts +3 -0
- package/types/packages/editor/src/extensions/math/src/augmentations.d.ts +10 -0
- package/types/packages/editor/src/extensions/math/src/types.d.ts +11 -0
- package/types/packages/editor/src/extensions/media/src/augmentations.d.ts +15 -0
- package/types/packages/editor/src/extensions/media/src/components/ImageCropEditor/geometry.d.ts +119 -0
- package/types/packages/editor/src/extensions/media/src/types/element/audio.d.ts +13 -0
- package/types/packages/editor/src/extensions/media/src/types/element/image-appearance.d.ts +2 -0
- package/types/packages/editor/src/extensions/media/src/types/element/image.d.ts +31 -0
- package/types/packages/editor/src/extensions/media/src/types/element/inline-image.d.ts +10 -0
- package/types/packages/editor/src/extensions/media/src/types/element/video.d.ts +21 -0
- package/types/packages/editor/src/extensions/styled-text/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/styled-text/src/colors.d.ts +75 -0
- package/types/packages/editor/src/extensions/styled-text/src/types.d.ts +7 -0
- package/types/packages/editor/src/extensions/table/src/align.d.ts +2 -0
- package/types/packages/editor/src/extensions/table/src/augmentations.d.ts +8 -0
- package/types/packages/editor/src/extensions/table/src/types.d.ts +19 -0
- package/types/packages/editor/src/extensions/tabs/src/augmentations.d.ts +7 -0
- package/types/packages/editor/src/extensions/tabs/src/types.d.ts +29 -0
- package/types/packages/editor/src/extensions/underline/src/augmentations.d.ts +9 -0
- package/types/packages/editor/src/extensions/underline/src/types.d.ts +8 -0
- package/types/packages/editor/src/extensions/webview/src/augmentations.d.ts +6 -0
- package/types/packages/editor/src/extensions/webview/src/types.d.ts +14 -0
- package/types/packages/editor/src/index.d.ts +4 -0
- package/types/packages/editor/src/presets/default.d.ts +2 -0
- package/types/packages/editor/text-field-contract.d.ts +36 -0
- package/types/packages/plugins/src/content-input.d.ts +1 -0
- package/types/packages/plugins/src/data.d.ts +1 -0
- package/types/packages/plugins/src/flashcards.d.ts +2 -0
- package/types/packages/plugins/src/index.d.ts +3 -2
- package/types/packages/plugins/src/provider-form.d.ts +57 -0
- package/types/packages/plugins/src/settings.d.ts +14 -10
- package/types/packages/plugins/src/whiteboard.d.ts +3 -2
- package/types/packages/shared/color-utils.d.ts +19 -0
- package/types/packages/shared/media-services.d.ts +18 -0
- package/types/packages/shared/media-types.d.ts +1 -0
- package/types/packages/shared/src/chat-core/askQuestion.d.ts +54 -0
- package/types/packages/shared/src/chat-core/index.d.ts +1 -0
- package/types/packages/shared/src/task-assistant/contracts.d.ts +119 -0
- package/types/packages/shared/src/task-assistant/document-state.d.ts +14 -0
- package/types/packages/shared/src/task-assistant/schema.d.ts +42 -0
- package/types/packages/shared/task-assistant.d.ts +3 -0
- package/types/packages/whiteboard/src/Board.d.ts +180 -0
- package/types/packages/whiteboard/src/WhiteBoard.d.ts +55 -0
- package/types/packages/whiteboard/src/author.d.ts +5 -3
- package/types/packages/whiteboard/src/components/ArrowConnectPointGroup/index.d.ts +13 -0
- package/types/packages/whiteboard/src/components/ArrowDropConnectPoint/index.d.ts +7 -0
- package/types/packages/whiteboard/src/components/DocumentElement/index.d.ts +13 -0
- package/types/packages/whiteboard/src/components/ResizeCircle/index.d.ts +15 -0
- package/types/packages/whiteboard/src/components/SketchPaths/SketchRect.d.ts +21 -0
- package/types/packages/whiteboard/src/components/Toolbar/ToolMenu.d.ts +15 -0
- package/types/packages/whiteboard/src/constants/arrow.d.ts +19 -0
- package/types/packages/whiteboard/src/constants/boardIdentity.d.ts +2 -0
- package/types/packages/whiteboard/src/constants/geometry.d.ts +7 -0
- package/types/packages/whiteboard/src/constants/grid.d.ts +4 -0
- package/types/packages/whiteboard/src/constants/image.d.ts +21 -0
- package/types/packages/whiteboard/src/constants/index.d.ts +13 -0
- package/types/packages/whiteboard/src/constants/map.d.ts +2 -0
- package/types/packages/whiteboard/src/constants/mind-themes.d.ts +30 -0
- package/types/packages/whiteboard/src/constants/mind.d.ts +14 -0
- package/types/packages/whiteboard/src/constants/resize.d.ts +2 -0
- package/types/packages/whiteboard/src/constants/select.d.ts +4 -0
- package/types/packages/whiteboard/src/constants/shadow.d.ts +12 -0
- package/types/packages/whiteboard/src/constants/sketch.d.ts +16 -0
- package/types/packages/whiteboard/src/constants/text-style.d.ts +68 -0
- package/types/packages/whiteboard/src/constants/tools.d.ts +11 -0
- package/types/packages/whiteboard/src/constants/viewport.d.ts +3 -0
- package/types/packages/whiteboard/src/document-version.d.ts +9 -0
- package/types/packages/whiteboard/src/document.d.ts +47 -0
- package/types/packages/whiteboard/src/extensions/api.d.ts +9 -0
- package/types/packages/whiteboard/src/extensions/authorApi.d.ts +10 -0
- package/types/packages/whiteboard/src/extensions/authorHooks.d.ts +2 -2
- package/types/packages/whiteboard/src/extensions/authorTypes.d.ts +150 -0
- package/types/packages/whiteboard/src/extensions/media.d.ts +50 -0
- package/types/packages/whiteboard/src/extensions/publicHooks.d.ts +2 -0
- package/types/packages/whiteboard/src/extensions/runtime.d.ts +95 -0
- package/types/packages/whiteboard/src/extensions/text.d.ts +58 -0
- package/types/packages/whiteboard/src/extensions/versions.d.ts +2 -0
- package/types/packages/whiteboard/src/hooks/useBoardState.d.ts +6 -0
- package/types/packages/whiteboard/src/hooks/useDropArrow.d.ts +76 -0
- package/types/packages/whiteboard/src/hooks/useElementsMoving.d.ts +10 -0
- package/types/packages/whiteboard/src/hooks/useMindTheme.d.ts +8 -0
- package/types/packages/whiteboard/src/hooks/useSelectState.d.ts +10 -0
- package/types/packages/whiteboard/src/hooks/useSketch.d.ts +15 -0
- package/types/packages/whiteboard/src/index.d.ts +54 -0
- package/types/packages/whiteboard/src/interactions/InteractionManager.d.ts +68 -0
- package/types/packages/whiteboard/src/interactions/InteractionState.d.ts +28 -0
- package/types/packages/whiteboard/src/interactions/states/ResizingState.d.ts +40 -0
- package/types/packages/whiteboard/src/plugins/ArrowPlugin.d.ts +48 -0
- package/types/packages/whiteboard/src/plugins/AudioPlugin.d.ts +15 -0
- package/types/packages/whiteboard/src/plugins/ColumnPlugin.d.ts +81 -0
- package/types/packages/whiteboard/src/plugins/CommonPlugin.d.ts +104 -0
- package/types/packages/whiteboard/src/plugins/CopyPastePlugin.d.ts +38 -0
- package/types/packages/whiteboard/src/plugins/DocumentPlugin.d.ts +41 -0
- package/types/packages/whiteboard/src/plugins/ExportImagePlugin.d.ts +6 -0
- package/types/packages/whiteboard/src/plugins/FileDragDropPlugin.d.ts +15 -0
- package/types/packages/whiteboard/src/plugins/FramePlugin.d.ts +14 -0
- package/types/packages/whiteboard/src/plugins/GeometryPlugin.d.ts +31 -0
- package/types/packages/whiteboard/src/plugins/HandwritePlugin.d.ts +22 -0
- package/types/packages/whiteboard/src/plugins/ImagePlugin.d.ts +21 -0
- package/types/packages/whiteboard/src/plugins/MindPlugin.d.ts +72 -0
- package/types/packages/whiteboard/src/plugins/PresentationPlugin.d.ts +13 -0
- package/types/packages/whiteboard/src/plugins/RichTextPlugin.d.ts +44 -0
- package/types/packages/whiteboard/src/plugins/VideoPlugin.d.ts +14 -0
- package/types/packages/whiteboard/src/plugins/ViewPortPlugin.d.ts +13 -0
- package/types/packages/whiteboard/src/plugins/WebviewPlugin.d.ts +11 -0
- package/types/packages/whiteboard/src/plugins/WhiteBoardPlugin.d.ts +31 -0
- package/types/packages/whiteboard/src/plugins/index.d.ts +19 -0
- package/types/packages/whiteboard/src/public.d.ts +54 -0
- package/types/packages/whiteboard/src/schematic/PageSchematic.d.ts +13 -0
- package/types/packages/whiteboard/src/services/CapabilityService.d.ts +186 -0
- package/types/packages/whiteboard/src/transforms/SelectTransforms.d.ts +4 -0
- package/types/packages/whiteboard/src/transforms/SketchTransforms.d.ts +5 -0
- package/types/packages/whiteboard/src/transforms/ViewPortTransforms.d.ts +26 -0
- package/types/packages/whiteboard/src/transforms/index.d.ts +3 -0
- package/types/packages/whiteboard/src/types/arrow.d.ts +52 -0
- package/types/packages/whiteboard/src/types/audio.d.ts +8 -0
- package/types/packages/whiteboard/src/types/board.d.ts +79 -0
- package/types/packages/whiteboard/src/types/capabilities.d.ts +267 -0
- package/types/packages/whiteboard/src/types/column.d.ts +71 -0
- package/types/packages/whiteboard/src/types/element.d.ts +1 -0
- package/types/packages/whiteboard/src/types/frame.d.ts +35 -0
- package/types/packages/whiteboard/src/types/image.d.ts +19 -0
- package/types/packages/whiteboard/src/types/index.d.ts +33 -0
- package/types/packages/whiteboard/src/types/mind.d.ts +54 -0
- package/types/packages/whiteboard/src/types/resize.d.ts +16 -0
- package/types/packages/whiteboard/src/types/video.d.ts +20 -0
- package/types/packages/whiteboard/src/types/webview.d.ts +7 -0
- package/types/packages/whiteboard/src/utils/ArrowConnectTracker.d.ts +50 -0
- package/types/packages/whiteboard/src/utils/ArrowStyleUtil.d.ts +15 -0
- package/types/packages/whiteboard/src/utils/ArrowUtil.d.ts +11 -0
- package/types/packages/whiteboard/src/utils/AudioUtil.d.ts +20 -0
- package/types/packages/whiteboard/src/utils/BoardUtil.d.ts +101 -0
- package/types/packages/whiteboard/src/utils/CanvasUtil.d.ts +5 -0
- package/types/packages/whiteboard/src/utils/ClipboardUtil.d.ts +8 -0
- package/types/packages/whiteboard/src/utils/ColumnUtil.d.ts +125 -0
- package/types/packages/whiteboard/src/utils/ConnectPointOwner.d.ts +36 -0
- package/types/packages/whiteboard/src/utils/ConnectPointUtil.d.ts +66 -0
- package/types/packages/whiteboard/src/utils/Constraints.d.ts +6 -0
- package/types/packages/whiteboard/src/utils/ExportImageUtil.d.ts +14 -0
- package/types/packages/whiteboard/src/utils/FrameUtil.d.ts +90 -0
- package/types/packages/whiteboard/src/utils/GeometryUtil.d.ts +18 -0
- package/types/packages/whiteboard/src/utils/HandwriteGroupUtil.d.ts +25 -0
- package/types/packages/whiteboard/src/utils/HandwriteUtil.d.ts +39 -0
- package/types/packages/whiteboard/src/utils/ImageUtil.d.ts +13 -0
- package/types/packages/whiteboard/src/utils/LayerOrderUtil.d.ts +16 -0
- package/types/packages/whiteboard/src/utils/MindThemePreviewStore.d.ts +11 -0
- package/types/packages/whiteboard/src/utils/MindThemeUtil.d.ts +54 -0
- package/types/packages/whiteboard/src/utils/MindUtil.d.ts +65 -0
- package/types/packages/whiteboard/src/utils/PathUtil.d.ts +80 -0
- package/types/packages/whiteboard/src/utils/PointUtil.d.ts +50 -0
- package/types/packages/whiteboard/src/utils/PresentationManager.d.ts +53 -0
- package/types/packages/whiteboard/src/utils/RichTextContentUtil.d.ts +17 -0
- package/types/packages/whiteboard/src/utils/SelectionActionUtil.d.ts +9 -0
- package/types/packages/whiteboard/src/utils/TextStyleStore.d.ts +10 -0
- package/types/packages/whiteboard/src/utils/VideoUtil.d.ts +11 -0
- package/types/packages/whiteboard/src/utils/ViewportUtil.d.ts +10 -0
- package/types/packages/whiteboard/src/utils/common.d.ts +18 -0
- package/types/packages/whiteboard/src/utils/events.d.ts +13 -0
- package/types/packages/whiteboard/src/utils/index.d.ts +28 -0
- package/types/packages/whiteboard/src/utils/sketch/arrow.d.ts +29 -0
- package/types/packages/whiteboard/src/utils/sketch/batch.d.ts +10 -0
- package/types/packages/whiteboard/src/utils/sketch/index.d.ts +9 -0
- package/types/packages/whiteboard/src/utils/sketch/patch.d.ts +5 -0
- package/types/packages/whiteboard/src/utils/sketch/resolve.d.ts +14 -0
- package/types/packages/whiteboard/src/utils/snap/SnapGeometry.d.ts +52 -0
- package/types/packages/whiteboard/src/utils/snap/SnapManager.d.ts +57 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export declare const COLLABORATION_VERSION = 1;
|
|
2
|
+
export declare const DEFAULT_COLLABORATION_URL = "https://collab.taunote.app";
|
|
3
|
+
export declare const ASSET_PREFIX = "tau-collab-asset:";
|
|
4
|
+
/**
|
|
5
|
+
* 仅本机资源引用:不上传服务器的资源(视频、丢失或无法识别的本地文件)在共享文档里换成它,
|
|
6
|
+
* 原始地址只记录在引用所属设备上,其他成员看到占位;结束共享时由作者设备还原。
|
|
7
|
+
*/
|
|
8
|
+
export declare const LOCAL_ASSET_PREFIX = "tau-collab-local:";
|
|
9
|
+
export declare const isLocalAssetReference: (value: string) => boolean;
|
|
10
|
+
/** 需经协作会话解析的资源引用(服务器资产或仅本机资源) */
|
|
11
|
+
export declare const isCollaborationResource: (value: string | undefined) => value is string;
|
|
12
|
+
export declare const SOURCE_TYPES: readonly ["article", "card", "project-item", "content"];
|
|
13
|
+
export type SourceType = (typeof SOURCE_TYPES)[number];
|
|
14
|
+
export interface ContentNode {
|
|
15
|
+
type?: string;
|
|
16
|
+
text?: string;
|
|
17
|
+
children?: ContentNode[];
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
}
|
|
20
|
+
export interface SharedContent {
|
|
21
|
+
title: string;
|
|
22
|
+
content: ContentNode[];
|
|
23
|
+
bannerBg: string;
|
|
24
|
+
bannerPosition: string;
|
|
25
|
+
}
|
|
26
|
+
export interface DeviceIdentity {
|
|
27
|
+
id: string;
|
|
28
|
+
secret: string;
|
|
29
|
+
nickname: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Member {
|
|
32
|
+
deviceId: string;
|
|
33
|
+
nickname: string;
|
|
34
|
+
role: "owner" | "editor";
|
|
35
|
+
online: boolean;
|
|
36
|
+
activity: "editing" | "viewing" | "background";
|
|
37
|
+
}
|
|
38
|
+
export interface SharedDocumentInfo {
|
|
39
|
+
id: string;
|
|
40
|
+
title: string;
|
|
41
|
+
ownerId: string;
|
|
42
|
+
role: "owner" | "editor";
|
|
43
|
+
status: "active" | "closed";
|
|
44
|
+
members: Member[];
|
|
45
|
+
updatedAt: number;
|
|
46
|
+
}
|
|
47
|
+
export interface JoinRequest {
|
|
48
|
+
id: string;
|
|
49
|
+
documentId: string;
|
|
50
|
+
deviceId: string;
|
|
51
|
+
nickname: string;
|
|
52
|
+
status: "pending" | "approved" | "rejected" | "expired";
|
|
53
|
+
expiresAt: number;
|
|
54
|
+
}
|
|
55
|
+
/** POST /v1/join-requests 的响应;pending 也返回 documentId,客户端据此精确判定批准(文档出现在会话列表) */
|
|
56
|
+
export type JoinRequestResult = {
|
|
57
|
+
id: string;
|
|
58
|
+
status: "pending";
|
|
59
|
+
documentId: string;
|
|
60
|
+
} | {
|
|
61
|
+
status: "approved";
|
|
62
|
+
documentId: string;
|
|
63
|
+
};
|
|
64
|
+
export interface ContentVersionUpgrade {
|
|
65
|
+
expectedRevision: string;
|
|
66
|
+
content: ContentNode[];
|
|
67
|
+
}
|
|
68
|
+
export interface SourceBinding {
|
|
69
|
+
databaseName: string;
|
|
70
|
+
contentId: number;
|
|
71
|
+
contentCreatedAt: number;
|
|
72
|
+
librarySourceId?: string;
|
|
73
|
+
contentDocumentId?: string;
|
|
74
|
+
/** 本机缓存最后确认的主库投影修订,不随文档共享。 */
|
|
75
|
+
projectionRevision?: string;
|
|
76
|
+
sourceType?: SourceType;
|
|
77
|
+
sourceId?: number;
|
|
78
|
+
sourceTitle?: string;
|
|
79
|
+
}
|
|
80
|
+
/** 创建共享文档的幂等键(POST /v1/documents idempotencyKey)为**端侧私有派生**:
|
|
81
|
+
* 桌面端绑定(库名/内容创建时间/代次),移动端绑定(服务器/内容/来源),两端互不互认——
|
|
82
|
+
* 防重复发布各自依赖本机的 collaboration_bindings 表,跨端对同一内容重复发布会得到
|
|
83
|
+
* 两个房间(已知边界,如需跨端去重须先统一此处的字段与派生规则)。服务端只做
|
|
84
|
+
* 同键幂等(见 store.create 的 UNIQUE(owner_id, creation_key)),不解释键的含义。 */
|
|
85
|
+
export interface CollaborationSession extends SharedDocumentInfo {
|
|
86
|
+
remoteVersionAvailable?: boolean;
|
|
87
|
+
mode?: "local" | "shared";
|
|
88
|
+
frozen?: boolean;
|
|
89
|
+
serverUrl: string;
|
|
90
|
+
connection: "connecting" | "connected" | "offline" | "error";
|
|
91
|
+
pending: boolean;
|
|
92
|
+
leaving: boolean;
|
|
93
|
+
source?: SourceBinding;
|
|
94
|
+
error?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface ContentSessionTarget {
|
|
97
|
+
contentId: number;
|
|
98
|
+
sourceType?: SourceType;
|
|
99
|
+
sourceId?: number;
|
|
100
|
+
sourceTitle?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface ContentSessionSnapshot {
|
|
103
|
+
documentId: string;
|
|
104
|
+
mode: "local" | "shared";
|
|
105
|
+
title: string;
|
|
106
|
+
frozen: boolean;
|
|
107
|
+
source?: SourceBinding;
|
|
108
|
+
}
|
|
109
|
+
/** 白板房间只在协作状态中列出成员与角色;打开、同步和投影由白板文档会话负责。 */
|
|
110
|
+
export interface SharedWhiteboardInfo extends SharedDocumentInfo {
|
|
111
|
+
serverUrl: string;
|
|
112
|
+
}
|
|
113
|
+
export interface CollaborationState {
|
|
114
|
+
serverUrl: string;
|
|
115
|
+
nickname: string;
|
|
116
|
+
deviceId?: string;
|
|
117
|
+
sessions: CollaborationSession[];
|
|
118
|
+
whiteboards?: SharedWhiteboardInfo[];
|
|
119
|
+
requests: JoinRequest[];
|
|
120
|
+
error?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface ContentInputDraft {
|
|
123
|
+
nodeId: string;
|
|
124
|
+
field: string;
|
|
125
|
+
value: string;
|
|
126
|
+
revision: string;
|
|
127
|
+
sequence: number;
|
|
128
|
+
}
|
|
129
|
+
export type CollaborationEvent = {
|
|
130
|
+
type: "refresh";
|
|
131
|
+
} | {
|
|
132
|
+
type: "revoked" | "closed";
|
|
133
|
+
documentId: string;
|
|
134
|
+
} | {
|
|
135
|
+
type: "presence";
|
|
136
|
+
documentId: string;
|
|
137
|
+
members: Member[];
|
|
138
|
+
};
|
|
139
|
+
export declare class CollaborationError extends Error {
|
|
140
|
+
code: string;
|
|
141
|
+
statusCode: number;
|
|
142
|
+
constructor(code: string, message: string, statusCode?: number);
|
|
143
|
+
}
|
|
144
|
+
export declare function normalizeServerUrl(value: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WhiteboardElementContract } from "../../db-schema/content-contracts";
|
|
2
|
+
export type { DataJson as WhiteboardJson } from "../../db-schema/content-contracts";
|
|
3
|
+
import type { DataJson as WhiteboardJson } from "../../db-schema/content-contracts";
|
|
4
|
+
export declare function assertWhiteboardJson(value: unknown, depth?: number): void;
|
|
5
|
+
/** 只验证首期普通属性补丁,不提交文档,也不代替资源授权或模型版本检查。 */
|
|
6
|
+
export declare function assertWhiteboardDataPatch(contract: WhiteboardElementContract, patch: unknown, unset?: readonly string[]): asserts patch is Readonly<Record<string, WhiteboardJson>>;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { ContentContractDictionary } from "../../db-schema/content-contracts";
|
|
2
|
+
import type { ContentEntityReference } from "../../db-schema/content-identities";
|
|
3
|
+
import type { ContentNode } from "./protocol";
|
|
4
|
+
import type { WhiteboardJson } from "./whiteboard-contract";
|
|
5
|
+
export type WhiteboardData = Readonly<Record<string, WhiteboardJson>>;
|
|
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 interface WhiteboardParent {
|
|
14
|
+
readonly kind: "page" | "element";
|
|
15
|
+
readonly 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 WhiteboardPlacement {
|
|
28
|
+
readonly parent: WhiteboardParent;
|
|
29
|
+
readonly token: string;
|
|
30
|
+
readonly fallbackPageId: string;
|
|
31
|
+
}
|
|
32
|
+
export interface WhiteboardReference {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly token: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WhiteboardFieldBindings {
|
|
37
|
+
readonly data: Readonly<Record<string, string>>;
|
|
38
|
+
readonly body?: {
|
|
39
|
+
readonly mode: "plain" | "richtext";
|
|
40
|
+
readonly rootId: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface WhiteboardShellPatch {
|
|
44
|
+
readonly name?: string;
|
|
45
|
+
readonly geometry?: WhiteboardGeometry;
|
|
46
|
+
readonly style?: WhiteboardData;
|
|
47
|
+
}
|
|
48
|
+
export interface WhiteboardTextEdit {
|
|
49
|
+
readonly offset: number;
|
|
50
|
+
readonly remove: number;
|
|
51
|
+
readonly text: string;
|
|
52
|
+
}
|
|
53
|
+
/** 宿主纯模型命令;插件入口在适配层解析类型/契约,不直接接收这些内部参数。 */
|
|
54
|
+
export type WhiteboardModelCommand = ({
|
|
55
|
+
type: "create_page";
|
|
56
|
+
id?: string;
|
|
57
|
+
title: string;
|
|
58
|
+
} & WhiteboardAnchor) | ({
|
|
59
|
+
type: "move_page";
|
|
60
|
+
id: string;
|
|
61
|
+
} & WhiteboardAnchor) | {
|
|
62
|
+
type: "remove_page";
|
|
63
|
+
id: string;
|
|
64
|
+
observedElementIds: readonly string[];
|
|
65
|
+
} | {
|
|
66
|
+
type: "edit_page_title";
|
|
67
|
+
id: string;
|
|
68
|
+
edit: WhiteboardTextEdit;
|
|
69
|
+
} | {
|
|
70
|
+
type: "edit_title";
|
|
71
|
+
edit: WhiteboardTextEdit;
|
|
72
|
+
} | {
|
|
73
|
+
type: "set_page_sketch";
|
|
74
|
+
id: string;
|
|
75
|
+
sketch: {
|
|
76
|
+
mode: "normal" | "sketch";
|
|
77
|
+
level: "neat" | "natural" | "loose";
|
|
78
|
+
};
|
|
79
|
+
} | {
|
|
80
|
+
type: "set_presentation";
|
|
81
|
+
before: readonly WhiteboardPresentation[];
|
|
82
|
+
after: readonly WhiteboardPresentation[];
|
|
83
|
+
} | ({
|
|
84
|
+
type: "create";
|
|
85
|
+
id?: string;
|
|
86
|
+
contractId: string;
|
|
87
|
+
data: WhiteboardData;
|
|
88
|
+
geometry: WhiteboardGeometry;
|
|
89
|
+
parent: WhiteboardParent;
|
|
90
|
+
body?: string | readonly ContentNode[];
|
|
91
|
+
entity?: ContentEntityReference;
|
|
92
|
+
} & WhiteboardAnchor) | ({
|
|
93
|
+
type: "move_node";
|
|
94
|
+
id: string;
|
|
95
|
+
parent: WhiteboardParent;
|
|
96
|
+
} & WhiteboardAnchor) | {
|
|
97
|
+
type: "set_entity";
|
|
98
|
+
id: string;
|
|
99
|
+
entity: ContentEntityReference | null;
|
|
100
|
+
} | {
|
|
101
|
+
type: "remove_nodes";
|
|
102
|
+
ids: readonly string[];
|
|
103
|
+
} | {
|
|
104
|
+
type: "set_node";
|
|
105
|
+
id: string;
|
|
106
|
+
patch: WhiteboardShellPatch;
|
|
107
|
+
} | {
|
|
108
|
+
type: "set_data";
|
|
109
|
+
id: string;
|
|
110
|
+
patch: WhiteboardData;
|
|
111
|
+
unset?: readonly string[];
|
|
112
|
+
} | {
|
|
113
|
+
type: "edit_text";
|
|
114
|
+
id: string;
|
|
115
|
+
field: string | null;
|
|
116
|
+
edit: WhiteboardTextEdit;
|
|
117
|
+
};
|
|
118
|
+
export type WhiteboardRecoveryReason = "parent-unavailable" | "containment" | "cycle" | "depth";
|
|
119
|
+
export interface WhiteboardElementSnapshot {
|
|
120
|
+
readonly id: string;
|
|
121
|
+
readonly type: string;
|
|
122
|
+
readonly contractId: string;
|
|
123
|
+
readonly name?: string;
|
|
124
|
+
readonly geometry: WhiteboardGeometry;
|
|
125
|
+
readonly style: WhiteboardData;
|
|
126
|
+
readonly data: WhiteboardData;
|
|
127
|
+
readonly fieldBindings: WhiteboardFieldBindings;
|
|
128
|
+
readonly body?: string | readonly ContentNode[];
|
|
129
|
+
readonly entity?: ContentEntityReference;
|
|
130
|
+
readonly children: readonly WhiteboardElementSnapshot[];
|
|
131
|
+
readonly recoveryReason?: WhiteboardRecoveryReason;
|
|
132
|
+
}
|
|
133
|
+
export interface WhiteboardPageSnapshot {
|
|
134
|
+
readonly sketch?: {
|
|
135
|
+
mode: "normal" | "sketch";
|
|
136
|
+
level: "neat" | "natural" | "loose";
|
|
137
|
+
};
|
|
138
|
+
readonly id: string;
|
|
139
|
+
readonly title: string;
|
|
140
|
+
readonly children: readonly WhiteboardElementSnapshot[];
|
|
141
|
+
readonly recovery: readonly WhiteboardElementSnapshot[];
|
|
142
|
+
}
|
|
143
|
+
export interface WhiteboardSnapshot {
|
|
144
|
+
readonly presentations?: readonly WhiteboardPresentation[];
|
|
145
|
+
readonly title: string;
|
|
146
|
+
readonly pages: readonly WhiteboardPageSnapshot[];
|
|
147
|
+
readonly recovery: readonly WhiteboardElementSnapshot[];
|
|
148
|
+
}
|
|
149
|
+
export interface WhiteboardPresentation {
|
|
150
|
+
id: string;
|
|
151
|
+
name: string;
|
|
152
|
+
frames: {
|
|
153
|
+
id: string;
|
|
154
|
+
elements: string[];
|
|
155
|
+
}[];
|
|
156
|
+
createTime: number;
|
|
157
|
+
updateTime: number;
|
|
158
|
+
}
|
|
159
|
+
export type TransferElement = Omit<WhiteboardElementSnapshot, "children" | "fieldBindings" | "recoveryReason"> & {
|
|
160
|
+
children: TransferElement[];
|
|
161
|
+
};
|
|
162
|
+
export interface WhiteboardTransfer {
|
|
163
|
+
assets?: {
|
|
164
|
+
reference: string;
|
|
165
|
+
name: string;
|
|
166
|
+
mime: string;
|
|
167
|
+
base64: string;
|
|
168
|
+
}[];
|
|
169
|
+
format: "whiteboard-transfer-v1";
|
|
170
|
+
sourceDocumentId: string;
|
|
171
|
+
title: string;
|
|
172
|
+
pages: {
|
|
173
|
+
id: string;
|
|
174
|
+
title: string;
|
|
175
|
+
sketch?: WhiteboardPageSnapshot["sketch"];
|
|
176
|
+
elements: TransferElement[];
|
|
177
|
+
}[];
|
|
178
|
+
contracts: ContentContractDictionary;
|
|
179
|
+
resources: string[];
|
|
180
|
+
presentations: WhiteboardPresentation[];
|
|
181
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { WhiteboardTransfer, TransferElement, WhiteboardPresentation, } from "./src/whiteboard-types";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export type DataJson = null | boolean | number | string | readonly DataJson[] | {
|
|
2
|
+
readonly [key: string]: DataJson;
|
|
3
|
+
};
|
|
1
4
|
import { type ContentResourceSpec } from "./content-resources";
|
|
2
5
|
export declare const CONTENT_CONTRACT_VERSION = 2;
|
|
3
6
|
export declare const NODE_CONTRACT_PROPERTY = "tauContract";
|
|
@@ -10,7 +13,6 @@ export declare const CONTENT_CONTRACT_LIMITS: Readonly<{
|
|
|
10
13
|
}>;
|
|
11
14
|
export interface ContentCollaborationSpec {
|
|
12
15
|
textFields?: readonly string[];
|
|
13
|
-
structuredFields?: readonly string[];
|
|
14
16
|
}
|
|
15
17
|
export interface ContentContractDefinition {
|
|
16
18
|
type: string;
|
|
@@ -69,6 +71,7 @@ export type ContentContractDictionary = Readonly<Record<string, DataContract>>;
|
|
|
69
71
|
export declare function normalizeContentContract(owner: string, definition: ContentContractDefinition): ContentContract;
|
|
70
72
|
export declare function normalizeWhiteboardContract(owner: string, definition: WhiteboardContractDefinition): WhiteboardElementContract;
|
|
71
73
|
export declare function canonicalContractJson(value: unknown): string;
|
|
74
|
+
export declare function assertPreparedContract(value: PreparedContentContract | PreparedWhiteboardContract): void;
|
|
72
75
|
export declare function prepareContentContract(owner: string, definition: ContentContractDefinition): Promise<PreparedContentContract>;
|
|
73
76
|
export declare function prepareWhiteboardContract(owner: string, definition: WhiteboardContractDefinition): Promise<PreparedWhiteboardContract>;
|
|
74
77
|
export declare function contentContractChecks(value: unknown): readonly {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const CONTENT_ENTITY_KINDS: readonly ["whiteboard-content", "data-table", "project-item", "card", "article", "diary-moment", "whiteboard", "content", "video-note"];
|
|
2
|
+
export type ContentEntityKind = (typeof CONTENT_ENTITY_KINDS)[number];
|
|
3
|
+
export interface ContentEntityReference {
|
|
4
|
+
sourceId: string;
|
|
5
|
+
kind: ContentEntityKind;
|
|
6
|
+
entityId: string;
|
|
7
|
+
}
|
|
8
|
+
export type ContentEntityTarget = number | ContentEntityReference;
|
|
9
|
+
export interface ContentEntityRelation {
|
|
10
|
+
nodeId: string;
|
|
11
|
+
slot: string;
|
|
12
|
+
target: ContentEntityReference;
|
|
13
|
+
}
|
|
14
|
+
export declare function isContentEntityReference(value: unknown): value is ContentEntityReference;
|
|
15
|
+
/** 内置引用节点的归属约束;不能仅凭同名插件类型认领实体槽。 */
|
|
16
|
+
export declare const CONTENT_ENTITY_NODE_CONTRACTS: Readonly<Record<string, {
|
|
17
|
+
owner: string;
|
|
18
|
+
kind: ContentEntityKind;
|
|
19
|
+
}>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** 编辑器和白板共用直接历史版本声明,不递归展开历史定义。 */
|
|
2
|
+
export interface PreviousDataVersion<T> {
|
|
3
|
+
element: T;
|
|
4
|
+
access: "read" | "edit" | "none";
|
|
5
|
+
}
|
|
6
|
+
export interface DataMigration<T = Record<string, unknown>> {
|
|
7
|
+
from: number;
|
|
8
|
+
migrate(data: Readonly<T>): T;
|
|
9
|
+
}
|
|
10
|
+
export declare function assertDataVersions<T extends {
|
|
11
|
+
type: string;
|
|
12
|
+
dataVersion?: number;
|
|
13
|
+
collaboration?: unknown;
|
|
14
|
+
previousVersions?: readonly PreviousDataVersion<T>[];
|
|
15
|
+
migrations?: readonly DataMigration<any>[];
|
|
16
|
+
}>(spec: T, validate: (element: T) => unknown): void;
|
|
@@ -2,43 +2,20 @@ import type { MouseEvent, ReactNode, ReactElement } from "react";
|
|
|
2
2
|
import type { LucideIcon } from "lucide-react";
|
|
3
3
|
import type { Editor, Element, Path } from "slate";
|
|
4
4
|
import type { ElementBehaviors, ParagraphElement, BlockElement } from "./api";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
readonly revision: string;
|
|
8
|
-
}
|
|
9
|
-
export interface TextFieldDelta {
|
|
10
|
-
retain?: number;
|
|
11
|
-
delete?: number;
|
|
12
|
-
insert?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface EditorTextField {
|
|
15
|
-
getSnapshot(): TextFieldSnapshot;
|
|
16
|
-
subscribe(listener: (event: {
|
|
17
|
-
delta: readonly TextFieldDelta[];
|
|
18
|
-
local: boolean;
|
|
19
|
-
}) => void): () => void;
|
|
20
|
-
edit(change: {
|
|
21
|
-
offset: number;
|
|
22
|
-
remove: number;
|
|
23
|
-
text: string;
|
|
24
|
-
revision: string;
|
|
25
|
-
}): void;
|
|
26
|
-
editBatch(changes: readonly {
|
|
27
|
-
offset: number;
|
|
28
|
-
remove: number;
|
|
29
|
-
text: string;
|
|
30
|
-
}[], revision: string): void;
|
|
31
|
-
/** 本机观察版本保护;共享文档的异步整段替换须经宿主条件提交,不能据此声称服务端 CAS。 */
|
|
32
|
-
replace(value: string, revision: string): void;
|
|
33
|
-
undo(): void;
|
|
34
|
-
redo(): void;
|
|
35
|
-
dispose(): void;
|
|
36
|
-
}
|
|
5
|
+
export type { TextFieldSnapshot, TextFieldDelta, EditorTextField } from "./text-field-contract";
|
|
6
|
+
import type { EditorTextField } from "./text-field-contract";
|
|
37
7
|
export interface EditorTextFields {
|
|
38
8
|
open(editor: Editor, element: Element, field: string): EditorTextField;
|
|
39
9
|
}
|
|
40
10
|
export declare const IEditorTextFields: import("../shared/service-contract").ServiceIdentifier<EditorTextFields>;
|
|
11
|
+
export interface EditorNodeViews {
|
|
12
|
+
read(nodeId: string): Readonly<Record<string, unknown>> | undefined;
|
|
13
|
+
write(nodeId: string, patch: Record<string, unknown>): Promise<Readonly<Record<string, unknown>>>;
|
|
14
|
+
}
|
|
15
|
+
export declare const IEditorNodeViews: import("../shared/service-contract").ServiceIdentifier<EditorNodeViews>;
|
|
41
16
|
export interface TextFieldEditor {
|
|
17
|
+
/** 交给原生 input/textarea 的 ref;宿主负责输入法、选区、撤销和卸载冲刷。 */
|
|
18
|
+
readonly inputRef: import("react").RefCallback<HTMLInputElement | HTMLTextAreaElement>;
|
|
42
19
|
readonly value: string;
|
|
43
20
|
readonly revision: string;
|
|
44
21
|
readonly readOnly: boolean;
|
|
@@ -66,15 +43,9 @@ interface SourceBlockEditorBaseProps {
|
|
|
66
43
|
extend?: boolean;
|
|
67
44
|
children?: ReactNode;
|
|
68
45
|
}
|
|
69
|
-
export type SourceBlockEditorProps = SourceBlockEditorBaseProps &
|
|
46
|
+
export type SourceBlockEditorProps = SourceBlockEditorBaseProps & {
|
|
70
47
|
field: string;
|
|
71
|
-
|
|
72
|
-
onChange?: never;
|
|
73
|
-
} | {
|
|
74
|
-
field?: never;
|
|
75
|
-
initValue: string;
|
|
76
|
-
onChange(value: string): void;
|
|
77
|
-
});
|
|
48
|
+
};
|
|
78
49
|
export interface RuntimeStyleCompiler {
|
|
79
50
|
compile(request: {
|
|
80
51
|
source: string;
|
|
@@ -99,6 +70,8 @@ export interface SourceEditorRuntime {
|
|
|
99
70
|
sourceBlockParagraphBehavior(type: string): ElementBehaviors<ParagraphElement>;
|
|
100
71
|
}
|
|
101
72
|
export interface ElementAccess {
|
|
73
|
+
view: Readonly<Record<string, unknown>>;
|
|
74
|
+
updateView(properties: Record<string, unknown>): void;
|
|
102
75
|
readOnly: boolean;
|
|
103
76
|
/** 外框里的块是否被点选;未声明外框时恒为 false */
|
|
104
77
|
selected: boolean;
|
|
@@ -148,4 +121,3 @@ export interface InlineSourceRuntime {
|
|
|
148
121
|
insertInlineSource(editor: Editor, element: Element): void;
|
|
149
122
|
InlineSourceBoundary(): ReactElement;
|
|
150
123
|
}
|
|
151
|
-
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type IEditorProps } from "./core/CoreEditor";
|
|
2
|
+
import type { EditorRef } from "./core/types/editor";
|
|
3
|
+
export interface EditorProps extends IEditorProps {
|
|
4
|
+
/** 是否继承外层编辑器的组合,默认继承。 */
|
|
5
|
+
inheritKit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Editor: import("react").ForwardRefExoticComponent<EditorProps & import("react").RefAttributes<EditorRef>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "./extensions/annotation/src/augmentations";
|
|
2
|
+
import "./extensions/blockquote/src/augmentations";
|
|
3
|
+
import "./extensions/callout/src/augmentations";
|
|
4
|
+
import "./extensions/code-block/src/augmentations";
|
|
5
|
+
import "./extensions/comment/src/augmentations";
|
|
6
|
+
import "./extensions/detail/src/augmentations";
|
|
7
|
+
import "./extensions/diagram/src/augmentations";
|
|
8
|
+
import "./extensions/divide-line/src/augmentations";
|
|
9
|
+
import "./extensions/emoji/src/augmentations";
|
|
10
|
+
import "./extensions/front-matter/src/augmentations";
|
|
11
|
+
import "./extensions/header/src/augmentations";
|
|
12
|
+
import "./extensions/highlight-block/src/augmentations";
|
|
13
|
+
import "./extensions/kbd/src/augmentations";
|
|
14
|
+
import "./extensions/link/src/augmentations";
|
|
15
|
+
import "./extensions/list/src/augmentations";
|
|
16
|
+
import "./extensions/math/src/augmentations";
|
|
17
|
+
import "./extensions/media/src/augmentations";
|
|
18
|
+
import "./extensions/styled-text/src/augmentations";
|
|
19
|
+
import "./extensions/table/src/augmentations";
|
|
20
|
+
import "./extensions/tabs/src/augmentations";
|
|
21
|
+
import "./extensions/underline/src/augmentations";
|
|
22
|
+
import "./extensions/webview/src/augmentations";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Node, Path } from "slate";
|
|
2
|
+
import { Descendant, Editor, Range } from "slate";
|
|
3
|
+
import type { EditorKit } from "./kit/EditorKit";
|
|
4
|
+
import type { EditorDocument } from "./document/EditorDocument";
|
|
5
|
+
import type { AnyExtension } from "./api/legacy";
|
|
6
|
+
import type { EditorRef } from "./types/editor";
|
|
7
|
+
import type { MarkRenderProps } from "./api/marks";
|
|
8
|
+
import type { ComponentType } from "react";
|
|
9
|
+
import { IConfigItem, IHotKeyConfig } from "./types";
|
|
10
|
+
|
|
11
|
+
export interface IEditorProps {
|
|
12
|
+
initValue?: Descendant[];
|
|
13
|
+
onChange?: (value: Descendant[], editor: Editor) => void;
|
|
14
|
+
onSelectionChange?: () => void;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
/** 本编辑器的组成(扩展 + 服务 + 主题)。不传则继承外层编辑器的 kit */
|
|
17
|
+
kit?: EditorKit;
|
|
18
|
+
/**
|
|
19
|
+
* 文档源:内容的事实来源(01 §7.2)。给定时取代 `initValue` / `onChange`,
|
|
20
|
+
* 并可覆盖服务、要求只读。协作用的 Yjs 文档源见 `@tau/editor-collab`。
|
|
21
|
+
*/
|
|
22
|
+
document?: EditorDocument;
|
|
23
|
+
/** 只作用于本实例的扩展;按元素类型覆盖 kit 里的同名实现 */
|
|
24
|
+
extensions?: readonly AnyExtension[];
|
|
25
|
+
hotkeyConfigs?: IHotKeyConfig[];
|
|
26
|
+
hoveringBarConfigs?: IConfigItem[];
|
|
27
|
+
onInit?: (editor: Editor, content: Descendant[]) => void;
|
|
28
|
+
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
onFocus?: () => void;
|
|
31
|
+
onBlur?: () => void;
|
|
32
|
+
placeHolder?: string;
|
|
33
|
+
/** 自定义 decorate 函数(用于添加装饰,如 diff 高亮) */
|
|
34
|
+
decorate?: (entry: [Node, Path]) => Range[];
|
|
35
|
+
/** 包装已经应用标记的内容,不接管 Slate attributes。 */
|
|
36
|
+
leafWrapper?: ComponentType<MarkRenderProps>;
|
|
37
|
+
/**
|
|
38
|
+
* 聚焦模式:沿光标所在的文档路径,同级兄弟元素退后(其余顶层块、列表的其他项、表格的其他单元格…)。
|
|
39
|
+
* 退后程度由宿主在容器上设置 `--ed-focus-dim`(缺省 0.26)。
|
|
40
|
+
*/
|
|
41
|
+
focusMode?: boolean;
|
|
42
|
+
}
|
|
43
|
+
declare const Index: import("react").NamedExoticComponent<IEditorProps & import("react").RefAttributes<EditorRef>>;
|
|
44
|
+
export default Index;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Editor, Element } from "slate";
|
|
2
|
+
type View = Readonly<Record<string, unknown>>;
|
|
3
|
+
interface Entry {
|
|
4
|
+
getSnapshot(): View;
|
|
5
|
+
subscribe(listener: () => void): () => void;
|
|
6
|
+
update(patch: Record<string, unknown>): void;
|
|
7
|
+
}
|
|
8
|
+
/** 组件读取本机视图;持久化由当前文档服务负责,临时编辑器只保留会话内状态。 */
|
|
9
|
+
export declare function elementView(editor: Editor, element: Element): Entry;
|
|
10
|
+
export declare function useElementView(element: Element): {
|
|
11
|
+
value: Readonly<Record<string, unknown>>;
|
|
12
|
+
update: (patch: Record<string, unknown>) => void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DataMigration, type PreviousDataVersion } from "../../../../db-schema/data-versions";
|
|
1
2
|
import type { ComponentType, ReactNode } from "react";
|
|
2
3
|
import type { Descendant, Editor, Element, NodeEntry, TextUnit } from "slate";
|
|
3
4
|
import type { RenderElementProps } from "slate-react";
|
|
@@ -12,14 +13,8 @@ import type { DecorationSpec, MarkSpec } from "./marks";
|
|
|
12
13
|
import type { InputRule } from "./inputRules";
|
|
13
14
|
import type { ContentResourceSpec } from "../../../../db-schema/content-resources";
|
|
14
15
|
import { type ContentCollaborationSpec } from "../../../../db-schema/content-contracts";
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
migrate(data: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
export interface PreviousElementVersion {
|
|
20
|
-
element: ElementSpec;
|
|
21
|
-
access: "read" | "edit" | "none";
|
|
22
|
-
}
|
|
16
|
+
export type ElementDataMigration = DataMigration;
|
|
17
|
+
export type PreviousElementVersion = PreviousDataVersion<ElementSpec>;
|
|
23
18
|
/**
|
|
24
19
|
* 扩展 API v2(01 §5.1):声明式描述「这个扩展贡献了什么」,内核负责装配、隔离与分发。
|
|
25
20
|
* 所有扩展都是 defineExtension 的产物(旧 IExtension 适配层已删除,ER-019)。
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { EXTENSION_API_VERSION, defineExtension, defineElement, type EditorExtension, type ExtensionDefinition, type ElementSpec, type ElementFrame, type ElementEmptyContext, type ElementBehaviors, type ElementRenderProps, type ExtensionLayerProps, } from "./extension";
|
|
8
8
|
export type { AnyExtension } from "./legacy";
|
|
9
|
+
export { elementView, useElementView } from "./elementView";
|
|
9
10
|
export { canEditElement, getElementVersionResolver, setElementVersionResolver, type ElementVersionAccess, type ElementVersionResolver, } from "./elementVersions";
|
|
10
11
|
export type { CopyDecision, CopyContext, ElementCopy } from "./copy";
|
|
11
12
|
export type { MarkSpec, MarkRenderProps, DecorationSpec } from "./marks";
|
|
@@ -51,6 +52,7 @@ export { default as AddParagraph, type AddParagraphRef } from "../components/Add
|
|
|
51
52
|
export { IOverlayBackDismiss, type OverlayBackDismissProps, type OverlayBackDismissAdapter, } from "../services/overlayBackDismiss";
|
|
52
53
|
export { default as OverlayBackDismiss } from "../components/OverlayBackDismiss/index";
|
|
53
54
|
export { IEditorInteraction, useTouchInteraction, isTouchInteraction, type EditorInteraction, } from "../services/interaction";
|
|
55
|
+
export { useTouchVoidSelection } from "../hooks/useTouchVoidSelection";
|
|
54
56
|
export { getElementParent, getClosestCurrentElement } from "../utils/editor";
|
|
55
57
|
export { getParentNodeByNode, getPreviousSiblingNode } from "../utils/element";
|
|
56
58
|
export { getPrevPath } from "../utils/path";
|
|
@@ -63,5 +65,8 @@ export { panAroundAnchor, pointFromCenter, type Point as ZoomPanPoint } from "..
|
|
|
63
65
|
export { FloatingToolbar, ToolbarDivider, ToolbarIconButton } from "../components/FloatingToolbar/index";
|
|
64
66
|
export { IElementEditingPolicy, type ElementEditingPolicy } from "../services/elementEditingPolicy";
|
|
65
67
|
export { IUnknownElementNotice, type UnknownElementNotice } from "../services/unknownElementNotice";
|
|
66
|
-
export type { EditorTextField } from "../../../source-contracts";
|
|
68
|
+
export type { EditorTextField, TextFieldDelta, TextFieldSnapshot } from "../../../source-contracts";
|
|
67
69
|
export { useTextFieldBinding } from "./useTextFieldBinding";
|
|
70
|
+
export { bindTextFieldTextarea, rebaseTextFieldInput } from "./textFieldInput";
|
|
71
|
+
export { IEditorTextFields } from "../../../source-contracts";
|
|
72
|
+
export { slateTextFields } from "./slateTextFields";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EditorTextField } from "../../../text-field-contract";
|
|
2
|
+
interface Edit {
|
|
3
|
+
offset: number;
|
|
4
|
+
remove: number;
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
/** 输入法期间的替换只删除开始组合时已存在的字符,保留期间到达的远端插入。 */
|
|
8
|
+
export declare function rebaseTextFieldInput(local: Edit, remote: readonly Edit[]): Edit[];
|
|
9
|
+
/** 原生输入控件立即消费字段增量,避免 React 渲染时序把旧整段文本写回共享正文。 */
|
|
10
|
+
export declare function bindTextFieldTextarea(input: HTMLTextAreaElement | HTMLInputElement, field: EditorTextField, onValue: (value: string) => void, onError: (message: string) => void): {
|
|
11
|
+
write: (next: string) => void;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
};
|
|
14
|
+
export {};
|