@xiongtao.xt/tau-plugins 0.48.0 → 0.49.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 +5 -0
- package/LICENSE +21 -21
- package/client/{chunk-M3YEVDN4.js → chunk-CQ3UMKDY.js} +2 -3
- package/client/{chunk-X6MBLKAL.js → chunk-MNFXOBPW.js} +3 -8
- package/docs/README.md +44 -49
- package/docs/ai.md +176 -172
- package/docs/backend.md +177 -168
- package/docs/editor-collaboration.md +153 -187
- package/docs/editor.md +701 -635
- package/docs/excerpts.md +145 -126
- package/docs/flashcards.md +144 -127
- package/docs/getting-started.md +78 -46
- package/docs/mcp.md +185 -173
- package/docs/plugin-basics.md +215 -211
- package/docs/portability.md +135 -116
- package/docs/providers/README.md +116 -111
- package/docs/providers/asr.md +135 -50
- package/docs/providers/embeddings.md +77 -0
- package/docs/providers/images.md +81 -69
- package/docs/providers/publish.md +159 -146
- package/docs/providers/sync.md +129 -120
- package/docs/providers/tts.md +62 -48
- package/docs/providers/upload.md +131 -116
- package/docs/providers/video.md +130 -118
- package/docs/release.md +132 -132
- package/docs/services.md +169 -159
- package/docs/site-data.md +90 -90
- package/docs/skills.md +129 -128
- package/docs/storage-and-network.md +93 -68
- package/docs/ui.md +647 -568
- package/docs/user-data.md +771 -714
- package/docs/whiteboard.md +391 -339
- package/package.js +1 -1
- package/package.json +3 -2
- package/portable.js +2 -4
- package/publish-artifacts.js +15 -17
- package/types/packages/collaboration/src/document-adapter.d.ts +7 -0
- package/types/packages/collaboration/src/document-installation.d.ts +15 -0
- package/types/packages/collaboration/src/document-operations.d.ts +37 -0
- package/types/packages/collaboration/src/document-protocol.d.ts +41 -0
- package/types/packages/collaboration/src/document-sync.d.ts +62 -0
- package/types/packages/collaboration/src/document-version.d.ts +13 -0
- package/types/packages/collaboration/src/document-write-queue.d.ts +10 -0
- package/types/packages/collaboration/src/encoding.d.ts +2 -0
- package/types/packages/collaboration/src/index.d.ts +26 -0
- package/types/packages/collaboration/src/model-limits.d.ts +22 -0
- package/types/packages/collaboration/src/node-document.d.ts +21 -0
- package/types/packages/collaboration/src/node-tree-history.d.ts +34 -0
- package/types/packages/collaboration/src/node-tree.d.ts +107 -0
- package/types/packages/collaboration/src/palette.d.ts +4 -0
- package/types/packages/collaboration/src/presence-budget.d.ts +2 -0
- package/types/packages/collaboration/src/protocol.d.ts +0 -5
- package/types/packages/collaboration/src/resource-policy.d.ts +1 -0
- package/types/packages/collaboration/src/shared-values.d.ts +4 -0
- package/types/packages/collaboration/src/text-segments.d.ts +52 -0
- package/types/packages/collaboration/src/whiteboard-baseline.d.ts +7 -0
- package/types/packages/collaboration/src/whiteboard-document.d.ts +7 -0
- package/types/packages/collaboration/src/whiteboard-model.d.ts +85 -0
- package/types/packages/collaboration/src/whiteboard-presence.d.ts +28 -0
- package/types/packages/collaboration/src/whiteboard-presentation.d.ts +21 -0
- package/types/packages/collaboration/src/whiteboard-relations.d.ts +11 -0
- package/types/packages/collaboration/src/whiteboard-transfer.d.ts +27 -0
- package/types/packages/db-schema/data-versions.d.ts +0 -5
- package/types/packages/editor/contracts.d.ts +1 -1
- package/types/packages/editor/src/core/CoreEditor.d.ts +2 -2
- package/types/packages/editor/src/core/api/extension.d.ts +14 -4
- package/types/packages/editor/src/core/api/index.d.ts +0 -1
- package/types/packages/editor/src/core/index.d.ts +1 -1
- package/types/packages/editor/src/core/kit/EditorKit.d.ts +3 -4
- package/types/packages/editor/src/core/kit/ExtensionAssembly.d.ts +1 -2
- package/types/packages/editor/src/core/kit/context.d.ts +2 -2
- package/types/packages/editor/src/extensions/diagram/src/types/index.d.ts +1 -2
- package/types/packages/editor/src/extensions/media/src/types/element/image.d.ts +1 -8
- package/types/packages/editor/src/extensions/tabs/src/types.d.ts +0 -11
- package/types/packages/editor/src/presets/default.d.ts +2 -2
- package/types/packages/plugins/src/contract.d.ts +3 -0
- package/types/packages/plugins/src/embeddings.d.ts +16 -0
- package/types/packages/plugins/src/index.d.ts +2 -1
- package/types/packages/plugins/src/package.d.ts +2 -2
- package/types/packages/plugins/src/portable.d.ts +4 -10
- package/types/packages/plugins/src/render-artifact.d.ts +2 -2
- package/types/packages/plugins/src/rendering.d.ts +4 -4
- package/types/packages/plugins/src/settings.d.ts +8 -5
- package/types/packages/ui/src/primitives/ResizableAndHideableSidebar.d.ts +0 -4
- package/types/packages/whiteboard/src/Board.d.ts +3 -1
- package/types/packages/whiteboard/src/WhiteBoard.d.ts +2 -0
- package/types/packages/whiteboard/src/collaboration/presence.d.ts +23 -0
- package/types/packages/whiteboard/src/constants/text-style.d.ts +5 -7
- package/types/packages/whiteboard/src/context.d.ts +23 -0
- package/types/packages/whiteboard/src/document.d.ts +8 -1
- package/types/packages/whiteboard/src/extensions/api.d.ts +4 -7
- package/types/packages/whiteboard/src/extensions/authorTypes.d.ts +2 -4
- package/types/packages/whiteboard/src/extensions/runtime.d.ts +1 -1
- package/types/packages/whiteboard/src/plugins/RichTextPlugin.d.ts +0 -4
- package/types/packages/whiteboard/src/transforms/ViewPortTransforms.d.ts +1 -0
- package/types/packages/whiteboard/src/utils/index.d.ts +0 -1
- package/docs/api-support.md +0 -95
- package/docs/content-metrics.md +0 -45
- package/docs/websocket.md +0 -39
- package/docs/whiteboard-collaboration.md +0 -67
- package/types/packages/editor/src/core/api/legacy.d.ts +0 -10
- package/types/packages/editor/src/extensions/diagram/src/types/typst.d.ts +0 -9
- package/types/packages/whiteboard/src/utils/Constraints.d.ts +0 -6
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { WhiteboardPresentations } from "./whiteboard-presentation";
|
|
2
|
+
import * as Y from "yjs";
|
|
3
|
+
import { type PreparedWhiteboardContract, type PreparedContentContract, type ContentContractDictionary, type DataContract } from "../../db-schema/content-contracts";
|
|
4
|
+
import { NodeTree } from "./node-tree";
|
|
5
|
+
import { NodeTreeHistory, type NodeTreeHistoryOptions } from "./node-tree-history";
|
|
6
|
+
import type { WhiteboardModelCommand, WhiteboardReference, WhiteboardSnapshot } from "./whiteboard-types";
|
|
7
|
+
/** 纯协作模型;宿主负责权限、耐久会话和插件版本保护,模型不连接画布。 */
|
|
8
|
+
export declare class WhiteboardModel {
|
|
9
|
+
readonly doc: Y.Doc;
|
|
10
|
+
readonly presentations: WhiteboardPresentations;
|
|
11
|
+
readonly pages: Y.Map<Y.Map<unknown>>;
|
|
12
|
+
readonly pageOrder: Y.Array<WhiteboardReference>;
|
|
13
|
+
readonly elements: Y.Map<Y.Map<unknown>>;
|
|
14
|
+
readonly orders: Y.Map<Y.Array<WhiteboardReference>>;
|
|
15
|
+
readonly strings: Y.Map<Y.Text>;
|
|
16
|
+
readonly creations: Y.Map<boolean>;
|
|
17
|
+
readonly contracts: Y.Map<DataContract>;
|
|
18
|
+
readonly title: Y.Text;
|
|
19
|
+
private readonly meta;
|
|
20
|
+
private readonly trees;
|
|
21
|
+
private readonly histories;
|
|
22
|
+
private disposed;
|
|
23
|
+
private revision;
|
|
24
|
+
private pending?;
|
|
25
|
+
private queuedBytes;
|
|
26
|
+
private incoming;
|
|
27
|
+
private readonly changed;
|
|
28
|
+
constructor(doc: Y.Doc);
|
|
29
|
+
private active;
|
|
30
|
+
readonly dispose: () => void;
|
|
31
|
+
private record;
|
|
32
|
+
private visible;
|
|
33
|
+
private live;
|
|
34
|
+
private contract;
|
|
35
|
+
private bindings;
|
|
36
|
+
private root;
|
|
37
|
+
private attachRoots;
|
|
38
|
+
createUndoManager(options: NodeTreeHistoryOptions): NodeTreeHistory;
|
|
39
|
+
attachUndoManager(history: NodeTreeHistory): void;
|
|
40
|
+
/** 返回宿主内部共享根;插件只能经后续文本绑定接入,不能直接访问 Yjs。 */
|
|
41
|
+
text(target: string, field?: string | null): Y.Text;
|
|
42
|
+
richText(target: string): NodeTree;
|
|
43
|
+
installContracts(dictionary: ContentContractDictionary): Promise<void>;
|
|
44
|
+
private clone;
|
|
45
|
+
/** 可信绑定在隔离候选执行写操作;不能把闭包交给插件或在其中产生外部副作用。 */
|
|
46
|
+
preflight(write: (candidate: WhiteboardModel) => void): void;
|
|
47
|
+
/** 历史时钟和 redone 链属于本机状态,不能只复制正文便声称验证了撤销。 */
|
|
48
|
+
preflightHistory(history: NodeTreeHistory, direction: "undo" | "redo"): void;
|
|
49
|
+
private preparedAdditions;
|
|
50
|
+
withPreparedContracts(prepared: readonly (PreparedWhiteboardContract | PreparedContentContract)[], write: (model: WhiteboardModel) => void, origin: unknown): void;
|
|
51
|
+
/** 大批导入分段预检,最终以一个增量进入当前视图历史。 */
|
|
52
|
+
submitChunks(commands: readonly WhiteboardModelCommand[], origin: unknown, prepared?: readonly (PreparedWhiteboardContract | PreparedContentContract)[], initialBodies?: readonly {
|
|
53
|
+
id: string;
|
|
54
|
+
preserveIds?: boolean;
|
|
55
|
+
body: readonly import("./protocol").ContentNode[];
|
|
56
|
+
}[]): void;
|
|
57
|
+
/** 在隔离副本中验证整批及编码大小,失败不改变真实文档或撤销栈。 */
|
|
58
|
+
submit(commands: readonly WhiteboardModelCommand[], origin: unknown, prepared?: readonly (PreparedWhiteboardContract | PreparedContentContract)[]): {
|
|
59
|
+
readonly createdIds: readonly string[];
|
|
60
|
+
};
|
|
61
|
+
private execute;
|
|
62
|
+
private initialize;
|
|
63
|
+
private baseRecord;
|
|
64
|
+
private order;
|
|
65
|
+
private placement;
|
|
66
|
+
private routing;
|
|
67
|
+
private destination;
|
|
68
|
+
private position;
|
|
69
|
+
private erase;
|
|
70
|
+
private edit;
|
|
71
|
+
private executeOne;
|
|
72
|
+
private assertBudget;
|
|
73
|
+
private validateState;
|
|
74
|
+
read(): WhiteboardSnapshot;
|
|
75
|
+
/** 服务端校验完整候选,已有记录的物理身份不能被普通更新替换。 */
|
|
76
|
+
validate(previous?: WhiteboardModel): Promise<void>;
|
|
77
|
+
/** 因果缺口保存在有界内存队列;不物化、不记历史,也不冒充耐久接纳。 */
|
|
78
|
+
receive(update: Uint8Array): Promise<{
|
|
79
|
+
status: "applied" | "pending";
|
|
80
|
+
}>;
|
|
81
|
+
/** 将未接纳的缺依赖材料交还宿主保全;不能在接收仍进行时清空。 */
|
|
82
|
+
takePendingUpdate(): Uint8Array | undefined;
|
|
83
|
+
private receiveNow;
|
|
84
|
+
private assertStableRecords;
|
|
85
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WhiteboardGeometry } from "./whiteboard-types";
|
|
2
|
+
/** 视图临时状态使用画布坐标,不进入文档、磁盘或撤销历史。 */
|
|
3
|
+
export interface WhiteboardPresence {
|
|
4
|
+
pageId: string;
|
|
5
|
+
cursor: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
} | null;
|
|
9
|
+
selection: {
|
|
10
|
+
id: string;
|
|
11
|
+
minX: number;
|
|
12
|
+
minY: number;
|
|
13
|
+
maxX: number;
|
|
14
|
+
maxY: number;
|
|
15
|
+
geometry?: WhiteboardGeometry;
|
|
16
|
+
}[];
|
|
17
|
+
moving: boolean;
|
|
18
|
+
/** 松手后的预览保留到接收端包含该文档状态。 */
|
|
19
|
+
version?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface WhiteboardPeer extends WhiteboardPresence {
|
|
22
|
+
clientId: number;
|
|
23
|
+
/** 连接身份(设备 ID),用于派生与正文协作一致的成员色。 */
|
|
24
|
+
userId: string;
|
|
25
|
+
name: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const WHITEBOARD_PRESENCE_INTERVAL = 120;
|
|
28
|
+
export declare function readWhiteboardPresence(value: unknown): WhiteboardPresence | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import type { WhiteboardPresentation } from "./whiteboard-types";
|
|
3
|
+
type Ref = {
|
|
4
|
+
id: string;
|
|
5
|
+
token: string;
|
|
6
|
+
};
|
|
7
|
+
/** 序列和帧的身份保留,删除只写本次标记,播放进度不进入文档。 */
|
|
8
|
+
export declare class WhiteboardPresentations {
|
|
9
|
+
readonly doc: Y.Doc;
|
|
10
|
+
private readonly creations;
|
|
11
|
+
readonly records: Y.Map<Y.Map<unknown>>;
|
|
12
|
+
readonly order: Y.Array<Ref>;
|
|
13
|
+
constructor(doc: Y.Doc, creations: Y.Map<boolean>);
|
|
14
|
+
private visible;
|
|
15
|
+
private ordered;
|
|
16
|
+
read(): WhiteboardPresentation[];
|
|
17
|
+
apply(before: readonly WhiteboardPresentation[], after: readonly WhiteboardPresentation[], token: string, transaction: Y.Transaction): void;
|
|
18
|
+
validate(): void;
|
|
19
|
+
assertStable(previous: WhiteboardPresentations): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ContentEntityReference } from "../../db-schema/content-identities";
|
|
2
|
+
import type { WhiteboardModel } from "./whiteboard-model";
|
|
3
|
+
export interface WhiteboardEntityRelation {
|
|
4
|
+
rootId: string;
|
|
5
|
+
nodeId: string;
|
|
6
|
+
slot: string;
|
|
7
|
+
target: ContentEntityReference;
|
|
8
|
+
}
|
|
9
|
+
export declare const whiteboardRelationKey: (relation: WhiteboardEntityRelation) => string;
|
|
10
|
+
/** 存活投影用于业务关系账;保留池用于本机历史持有,两者不能混作同步引用计数。 */
|
|
11
|
+
export declare function collectWhiteboardRelations(model: WhiteboardModel, retained?: boolean): WhiteboardEntityRelation[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type PreparedContentContract, type PreparedWhiteboardContract } from "../../db-schema/content-contracts";
|
|
2
|
+
import type { ContentNode } from "./protocol";
|
|
3
|
+
import type { WhiteboardModel } from "./whiteboard-model";
|
|
4
|
+
import type { WhiteboardModelCommand } from "./whiteboard-types";
|
|
5
|
+
import type { WhiteboardTransfer } from "./whiteboard-types";
|
|
6
|
+
export type { TransferElement, WhiteboardTransfer } from "./whiteboard-types";
|
|
7
|
+
export declare function whiteboardTransferResources(bundle: Pick<WhiteboardTransfer, "pages" | "contracts">): string[];
|
|
8
|
+
export declare function exportWhiteboardTransfer(model: WhiteboardModel, sourceDocumentId: string, elementIds?: readonly string[], scope?: {
|
|
9
|
+
pageIds?: readonly string[];
|
|
10
|
+
includeRecovery?: boolean;
|
|
11
|
+
}): WhiteboardTransfer;
|
|
12
|
+
export declare function prepareWhiteboardTransfer(model: WhiteboardModel, bundle: WhiteboardTransfer, options: {
|
|
13
|
+
pageId?: string;
|
|
14
|
+
targetDocumentId: string;
|
|
15
|
+
knownContractIds?: ReadonlySet<string>;
|
|
16
|
+
baseline?: boolean;
|
|
17
|
+
importResource?: (reference: string, sourceDocumentId: string) => Promise<string>;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
commands: WhiteboardModelCommand[];
|
|
20
|
+
prepared: (PreparedContentContract | PreparedWhiteboardContract)[];
|
|
21
|
+
ids: Map<string, string>;
|
|
22
|
+
initialBodies: {
|
|
23
|
+
id: string;
|
|
24
|
+
preserveIds?: boolean;
|
|
25
|
+
body: ContentNode[];
|
|
26
|
+
}[];
|
|
27
|
+
}>;
|
|
@@ -3,14 +3,9 @@ export interface PreviousDataVersion<T> {
|
|
|
3
3
|
element: T;
|
|
4
4
|
access: "read" | "edit" | "none";
|
|
5
5
|
}
|
|
6
|
-
export interface DataMigration<T = Record<string, unknown>> {
|
|
7
|
-
from: number;
|
|
8
|
-
migrate(data: Readonly<T>): T;
|
|
9
|
-
}
|
|
10
6
|
export declare function assertDataVersions<T extends {
|
|
11
7
|
type: string;
|
|
12
8
|
dataVersion?: number;
|
|
13
9
|
collaboration?: unknown;
|
|
14
10
|
previousVersions?: readonly PreviousDataVersion<T>[];
|
|
15
|
-
migrations?: readonly DataMigration<any>[];
|
|
16
11
|
}>(spec: T, validate: (element: T) => unknown): void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** 无 React/DOM 运行时代码的声明入口,供应用 SDK 适配现有扩展协议。 */
|
|
2
2
|
export { defineExtension, defineElement, assertElementVersions } from "./src/core/api/extension";
|
|
3
|
-
export type { EditorExtension, ElementSpec, ElementRenderProps, ElementFrame,
|
|
3
|
+
export type { EditorExtension, ElementSpec, ElementRenderProps, ElementFrame, PreviousElementVersion, ElementContractDefinition, } from "./src/core/api/extension";
|
|
@@ -2,7 +2,7 @@ import type { Node, Path } from "slate";
|
|
|
2
2
|
import { Descendant, Editor, Range } from "slate";
|
|
3
3
|
import type { EditorKit } from "./kit/EditorKit";
|
|
4
4
|
import type { EditorDocument } from "./document/EditorDocument";
|
|
5
|
-
import type {
|
|
5
|
+
import type { EditorExtension } from "./api/extension";
|
|
6
6
|
import type { EditorRef } from "./types/editor";
|
|
7
7
|
import type { MarkRenderProps } from "./api/marks";
|
|
8
8
|
import type { ComponentType } from "react";
|
|
@@ -21,7 +21,7 @@ export interface IEditorProps {
|
|
|
21
21
|
*/
|
|
22
22
|
document?: EditorDocument;
|
|
23
23
|
/** 只作用于本实例的扩展;按元素类型覆盖 kit 里的同名实现 */
|
|
24
|
-
extensions?: readonly
|
|
24
|
+
extensions?: readonly EditorExtension[];
|
|
25
25
|
hotkeyConfigs?: IHotKeyConfig[];
|
|
26
26
|
hoveringBarConfigs?: IConfigItem[];
|
|
27
27
|
onInit?: (editor: Editor, content: Descendant[]) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PreviousDataVersion } from "../../../../db-schema/data-versions";
|
|
2
2
|
import type { ComponentType, ReactNode } from "react";
|
|
3
3
|
import type { Descendant, Editor, Element, NodeEntry, TextUnit } from "slate";
|
|
4
4
|
import type { RenderElementProps } from "slate-react";
|
|
@@ -13,7 +13,6 @@ import type { DecorationSpec, MarkSpec } from "./marks";
|
|
|
13
13
|
import type { InputRule } from "./inputRules";
|
|
14
14
|
import type { ContentResourceSpec } from "../../../../db-schema/content-resources";
|
|
15
15
|
import { type ContentCollaborationSpec } from "../../../../db-schema/content-contracts";
|
|
16
|
-
export type ElementDataMigration = DataMigration;
|
|
17
16
|
export type PreviousElementVersion = PreviousDataVersion<ElementSpec>;
|
|
18
17
|
/**
|
|
19
18
|
* 扩展 API v2(01 §5.1):声明式描述「这个扩展贡献了什么」,内核负责装配、隔离与分发。
|
|
@@ -58,7 +57,6 @@ export interface ElementSpec<E extends Element = Element> {
|
|
|
58
57
|
dataVersion?: number;
|
|
59
58
|
collaboration?: ContentCollaborationSpec;
|
|
60
59
|
previousVersions?: readonly PreviousElementVersion[];
|
|
61
|
-
migrations?: readonly ElementDataMigration[];
|
|
62
60
|
kind: "block" | "inline";
|
|
63
61
|
isVoid?: boolean;
|
|
64
62
|
/** 后代的方向键/退格导航由领域接管,核心不执行默认相邻块导航。 */
|
|
@@ -124,5 +122,17 @@ export type ExtensionDefinition = Omit<EditorExtension, "apiVersion"> & {
|
|
|
124
122
|
export declare function defineExtension(definition: ExtensionDefinition): EditorExtension;
|
|
125
123
|
/** 按元素类型收窄 render / behaviors 的参数类型;运行时原样返回 */
|
|
126
124
|
export declare function defineElement<E extends Element>(spec: ElementSpec<E>): ElementSpec;
|
|
127
|
-
|
|
125
|
+
/** 节点的持久化声明:进入文档契约只需这些字段,Markdown 转换等无界面场景直接使用 */
|
|
126
|
+
export interface ElementContractDefinition {
|
|
127
|
+
type: string;
|
|
128
|
+
dataVersion?: number;
|
|
129
|
+
collaboration?: ContentCollaborationSpec;
|
|
130
|
+
previousVersions?: readonly PreviousDataVersion<ElementContractDefinition>[];
|
|
131
|
+
kind: "block" | "inline";
|
|
132
|
+
isVoid?: boolean;
|
|
133
|
+
resources?: readonly ContentResourceSpec[];
|
|
134
|
+
}
|
|
135
|
+
export declare function assertElementVersions(spec: ElementContractDefinition): void;
|
|
128
136
|
export declare const isEditorExtension: (value: unknown) => value is EditorExtension;
|
|
137
|
+
/** 扩展贡献的元素类型 */
|
|
138
|
+
export declare const elementTypesOf: (extension: EditorExtension) => string[];
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* 未标注过渡用途的导出按稳定 API 维护;过渡导出只供现有内部消费者迁移使用。
|
|
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
|
-
export type { AnyExtension } from "./legacy";
|
|
9
8
|
export { elementView, useElementView } from "./elementView";
|
|
10
9
|
export { canEditElement, getElementVersionResolver, setElementVersionResolver, type ElementVersionAccess, type ElementVersionResolver, } from "./elementVersions";
|
|
11
10
|
export type { CopyDecision, CopyContext, ElementCopy } from "./copy";
|
|
@@ -26,7 +26,7 @@ export type { EditorTheme } from "./theme/context";
|
|
|
26
26
|
export { createDomThemeService, createStaticThemeService } from "./theme/ThemeService";
|
|
27
27
|
export type { ThemeService, EditorThemeMode } from "./theme/ThemeService";
|
|
28
28
|
export * from "./utils/element";
|
|
29
|
-
export { defineExtension, defineElement, type EditorExtension, type
|
|
29
|
+
export { defineExtension, defineElement, type EditorExtension, type ElementSpec, type ElementEmptyContext, type ElementBehaviors, type ElementRenderProps, type ExtensionLayerProps, type EditorCommand, type EditorCommandContext, type EditorHotkey, } from "./api/index";
|
|
30
30
|
export * from "./utils/index";
|
|
31
31
|
export * from "./types";
|
|
32
32
|
export * from "./types/custom-element";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type { EditorExtension } from "../api/extension";
|
|
1
|
+
import { type EditorExtension } from "../api/extension";
|
|
3
2
|
import type { ServiceRegistration, ServiceRegistry } from "../services/registry";
|
|
4
3
|
import type { ThemeService } from "../theme/ThemeService";
|
|
5
4
|
import { ExtensionAssembly } from "./ExtensionAssembly";
|
|
@@ -21,7 +20,7 @@ export interface EditorKit {
|
|
|
21
20
|
}
|
|
22
21
|
export interface EditorKitOptions {
|
|
23
22
|
/** 元素与功能扩展;同元素类型重复会报错,除非 `override: true` */
|
|
24
|
-
extensions?: readonly
|
|
23
|
+
extensions?: readonly EditorExtension[];
|
|
25
24
|
/** 平台能力与 UI 插槽 */
|
|
26
25
|
services?: ServiceRegistration[];
|
|
27
26
|
/** 主题服务;等价于注册 IThemeService,缺省时编辑器读 DOM */
|
|
@@ -30,7 +29,7 @@ export interface EditorKitOptions {
|
|
|
30
29
|
override?: boolean;
|
|
31
30
|
}
|
|
32
31
|
export interface EditorKitExtendOptions {
|
|
33
|
-
extensions?: readonly
|
|
32
|
+
extensions?: readonly EditorExtension[];
|
|
34
33
|
services?: ServiceRegistration[];
|
|
35
34
|
theme?: ThemeService;
|
|
36
35
|
override?: boolean;
|
|
@@ -7,7 +7,6 @@ import { CommandRegistry, type EditorHotkey } from "../api/command";
|
|
|
7
7
|
import { type ElementDragSpec } from "../api/drag";
|
|
8
8
|
import type { ElementIngestSpec } from "../api/ingest";
|
|
9
9
|
import type { MenuContributionSource } from "../menu/resolveMenu";
|
|
10
|
-
import { type AnyExtension } from "../api/legacy";
|
|
11
10
|
import type { Plugin } from "../utils/plugin";
|
|
12
11
|
import type { IBlockPanelListItem, IConfigItem } from "../types";
|
|
13
12
|
import type { RegisteredCopy } from "../api/copy";
|
|
@@ -72,7 +71,7 @@ export declare class ExtensionAssembly {
|
|
|
72
71
|
readonly layers: readonly RegisteredLayer[];
|
|
73
72
|
private readonly renderers;
|
|
74
73
|
private readonly owners;
|
|
75
|
-
constructor(extensions: readonly
|
|
74
|
+
constructor(extensions: readonly EditorExtension[]);
|
|
76
75
|
/** 先把一个扩展的全部贡献收齐,中途抛错则整个扩展都不装,不留半截 */
|
|
77
76
|
private collect;
|
|
78
77
|
hasElement(type: string): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { EditorExtension } from "../api/extension";
|
|
3
3
|
import type { EditorKit } from "./EditorKit";
|
|
4
4
|
/** 内核用:把本编辑器的 kit 传给子树(含嵌套编辑器与扩展组件) */
|
|
5
5
|
export declare function EditorKitScope({ kit, children }: {
|
|
@@ -18,4 +18,4 @@ export declare function useResolvedKit(explicit: EditorKit | undefined): EditorK
|
|
|
18
18
|
* per-instance 扩展按 type 覆盖 kit 的同名实现(沿用迁移前的 later-wins 语义),
|
|
19
19
|
* 相同扩展实例返回同一个派生 kit(kit.extend 内部按实例集合缓存),编辑器不会因此重建。
|
|
20
20
|
*/
|
|
21
|
-
export declare function useKitWithExtensions(kit: EditorKit, extensions: readonly
|
|
21
|
+
export declare function useKitWithExtensions(kit: EditorKit, extensions: readonly EditorExtension[] | undefined): EditorKit;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { Descendant } from "slate";
|
|
2
2
|
import type { ImageCropTransform } from "../../components/ImageCropEditor/geometry";
|
|
3
3
|
import type { ImageBorderRadiusPreset, ImageShadowPreset } from "./image-appearance";
|
|
4
|
-
/** 旧版 cropperjs 的裁剪参数:保留在存量文档里,不再解读(再次裁剪从原图开始) */
|
|
5
|
-
export interface LegacyCropTransform {
|
|
6
|
-
version: "1.0";
|
|
7
|
-
[key: string]: unknown;
|
|
8
|
-
}
|
|
9
4
|
export interface ImageElement {
|
|
10
5
|
type: "image";
|
|
11
6
|
/** 原图地址(裁剪不改它) */
|
|
@@ -14,9 +9,7 @@ export interface ImageElement {
|
|
|
14
9
|
uuid?: string;
|
|
15
10
|
pasteUploading?: boolean;
|
|
16
11
|
/** 裁剪参数:再次裁剪时据此恢复 */
|
|
17
|
-
cropTransform?: ImageCropTransform
|
|
18
|
-
/** @deprecated 使用 cropTransform 代替 */
|
|
19
|
-
crop?: any;
|
|
12
|
+
cropTransform?: ImageCropTransform;
|
|
20
13
|
/** 显示用地址:未裁剪时等于 url,裁剪后为裁剪结果;导出链路同样取它 */
|
|
21
14
|
previewUrl?: string;
|
|
22
15
|
/** 显示图(previewUrl)的像素尺寸,首次加载后写入,用于加载前按比例占位 */
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import type { BlockElement } from "../../../../api";
|
|
2
|
-
/**
|
|
3
|
-
* 旧数据形态:Tab 内容整体存于 tabs 属性中,仅作存量数据读取兼容,
|
|
4
|
-
* 由迁移逻辑转换为 tab-pane 子节点后不再产生。
|
|
5
|
-
*/
|
|
6
|
-
export interface ITabsContent {
|
|
7
|
-
key: string;
|
|
8
|
-
title: string;
|
|
9
|
-
content: BlockElement[];
|
|
10
|
-
}
|
|
11
2
|
/** 单个 Tab 容器节点:Tab 的真实内容作为其 children 留在文档树内 */
|
|
12
3
|
export interface TabPaneElement {
|
|
13
4
|
type: "tab-pane";
|
|
@@ -18,8 +9,6 @@ export interface TabPaneElement {
|
|
|
18
9
|
export interface TabsElement {
|
|
19
10
|
type: "tabs";
|
|
20
11
|
activeKey?: string;
|
|
21
|
-
/** @deprecated 旧数据形态,仅迁移读取兼容 */
|
|
22
|
-
tabsContent?: ITabsContent[];
|
|
23
12
|
children: TabPaneElement[];
|
|
24
13
|
}
|
|
25
14
|
export interface ITabItem {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const defaultExtensions: readonly
|
|
1
|
+
import type { EditorExtension } from "../core/api/extension";
|
|
2
|
+
export declare const defaultExtensions: readonly EditorExtension[];
|
|
@@ -15,6 +15,7 @@ import type { PluginTTS } from "./tts";
|
|
|
15
15
|
import type { PluginASR } from "./asr";
|
|
16
16
|
import type { PluginWebSocket } from "./websocket";
|
|
17
17
|
import type { PluginImages } from "./images";
|
|
18
|
+
import type { PluginEmbeddings } from "./embeddings";
|
|
18
19
|
import type { PluginVideo } from "./video";
|
|
19
20
|
import type { PluginPublish } from "./publish";
|
|
20
21
|
import type { PluginSidebar } from "./sidebar";
|
|
@@ -71,6 +72,8 @@ export interface PluginContext {
|
|
|
71
72
|
readonly asr: PluginASR;
|
|
72
73
|
readonly websocket: PluginWebSocket;
|
|
73
74
|
readonly images: PluginImages;
|
|
75
|
+
/** API 嵌入提供方:渲染进程内实现,主进程经 relay 调用 */
|
|
76
|
+
readonly embeddings: PluginEmbeddings;
|
|
74
77
|
readonly video: PluginVideo;
|
|
75
78
|
readonly publish: PluginPublish;
|
|
76
79
|
readonly sidebar: PluginSidebar;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Disposable, JsonValue } from "./contract";
|
|
2
|
+
export interface EmbeddingInstance {
|
|
3
|
+
/** 返回与 texts 等长、同序的向量 */
|
|
4
|
+
embed(texts: string[], signal: AbortSignal): Promise<number[][]>;
|
|
5
|
+
}
|
|
6
|
+
export interface EmbeddingProviderDefinition {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
/** 单次 embed 可接受的最大文本条数;宿主据此分批 */
|
|
10
|
+
maxBatchSize?: number;
|
|
11
|
+
/** 创建时不发网络请求 */
|
|
12
|
+
create(config: JsonValue, modelId: string): EmbeddingInstance;
|
|
13
|
+
}
|
|
14
|
+
export interface PluginEmbeddings {
|
|
15
|
+
register(definition: EmbeddingProviderDefinition): Disposable;
|
|
16
|
+
}
|
|
@@ -6,10 +6,11 @@ export type { PluginBackendClient, BackendStatus, BackendState } from "./backend
|
|
|
6
6
|
export type * from "./upload";
|
|
7
7
|
export type * from "./tts";
|
|
8
8
|
export type * from "./images";
|
|
9
|
+
export type * from "./embeddings";
|
|
9
10
|
export type * from "./video";
|
|
10
11
|
export type * from "./publish";
|
|
11
12
|
export type { JsonValue, Disposable, PluginStorage, PluginCommand, PluginContext, PluginInstance, PluginDefinition, } from "./contract";
|
|
12
|
-
export type { PluginSettings, PluginSettingsDefinition, PluginProviderSettingsDefinition, PluginComponentSettingsDefinition, PluginSettingsProps, PluginSettingsHandle, } from "./settings";
|
|
13
|
+
export type { PluginSettings, PluginSettingsDefinition, PluginProviderSettingsDefinition, PluginComponentSettingsDefinition, PluginSettingsModel, PluginSettingsProps, PluginSettingsHandle, } from "./settings";
|
|
13
14
|
export * from "./provider-form";
|
|
14
15
|
export * from "./editor";
|
|
15
16
|
export { SourceBlockEditor, useSourceBlock, useTextField, useReportPreviewError, insertSourceBlock, sourceBlockParagraphBehavior, } from "./source-editor";
|
|
@@ -9,7 +9,7 @@ export { PLUGIN_PERMISSIONS, isPluginPermission, type PluginPermission } from ".
|
|
|
9
9
|
export { PLUGIN_AI_CAPABILITIES, isPluginAICapability } from "./ai";
|
|
10
10
|
export declare const PLUGIN_SHARED_MODULES: readonly ["@tau/plugins", "@tau/plugins/whiteboard", "@tau/plugins/sync", "@tau/ui", "react", "react-dom", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime"];
|
|
11
11
|
export interface PluginManifest {
|
|
12
|
-
formatVersion:
|
|
12
|
+
formatVersion: 2;
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
15
|
version: string;
|
|
@@ -35,7 +35,7 @@ export interface PluginManifest {
|
|
|
35
35
|
}
|
|
36
36
|
/** 宿主内部传输的已读取产物,不属于作者运行时 API。 */
|
|
37
37
|
export interface DevelopmentPluginPackage {
|
|
38
|
-
manifest: PluginManifest;
|
|
38
|
+
manifest: PluginManifest | import("./portable").PortablePluginManifest;
|
|
39
39
|
code: string;
|
|
40
40
|
css?: string;
|
|
41
41
|
}
|
|
@@ -2,7 +2,6 @@ import { type PluginManifest } from "./package";
|
|
|
2
2
|
import type { PluginEnvironment } from "./environment";
|
|
3
3
|
export declare const PORTABLE_PLATFORMS: readonly ["desktop", "android", "ios"];
|
|
4
4
|
export type PortablePlatform = (typeof PORTABLE_PLATFORMS)[number];
|
|
5
|
-
export type PluginElementSupport = "none" | "render" | "edit";
|
|
6
5
|
export declare const PORTABLE_SHARED_MODULES: readonly ["@tau/plugins", "@tau/plugins/whiteboard", "@tau/ui", "react", "react-dom", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime"];
|
|
7
6
|
export interface PortablePluginTarget {
|
|
8
7
|
readonly minAppVersion: string;
|
|
@@ -14,13 +13,9 @@ export interface PortablePluginManifest extends Omit<PluginManifest, "formatVers
|
|
|
14
13
|
readonly description?: string;
|
|
15
14
|
readonly targets: Readonly<Partial<Record<PortablePlatform, PortablePluginTarget>>>;
|
|
16
15
|
}
|
|
17
|
-
export type ReadablePortablePluginManifest = PortablePluginManifest;
|
|
18
|
-
export interface PluginAuthorTarget {
|
|
19
|
-
readonly minAppVersion: string;
|
|
20
|
-
}
|
|
21
16
|
export interface PluginAuthorManifest extends Pick<PluginManifest, "id" | "name" | "version" | "categories" | "keywords" | "permissions"> {
|
|
22
17
|
readonly description?: string;
|
|
23
|
-
readonly targets: Readonly<Partial<Record<PortablePlatform,
|
|
18
|
+
readonly targets: Readonly<Partial<Record<PortablePlatform, PortablePluginTarget>>>;
|
|
24
19
|
}
|
|
25
20
|
export interface PluginBuildOutput {
|
|
26
21
|
readonly main: string;
|
|
@@ -35,9 +30,8 @@ export interface PortablePluginHost {
|
|
|
35
30
|
readonly appVersion: string;
|
|
36
31
|
readonly profiles: readonly string[];
|
|
37
32
|
}
|
|
38
|
-
/** 作者、中心和宿主读取同一份平台与版本契约。 */
|
|
39
|
-
export declare function validatePortablePluginManifest(value: unknown): PortablePluginManifest;
|
|
40
|
-
export declare const readPortablePluginManifest: typeof validatePortablePluginManifest;
|
|
41
33
|
/** 构建器与中心共用发行范围;不代表中心已开放批准发布。 */
|
|
42
34
|
export declare function validatePortableDistributionManifest(value: unknown): PortablePluginManifest;
|
|
43
|
-
|
|
35
|
+
/** 作者、中心和宿主读取同一份平台与版本契约。 */
|
|
36
|
+
export declare function validatePortablePluginManifest(value: unknown): PortablePluginManifest;
|
|
37
|
+
export declare function assertPortablePluginCompatibility(manifest: PortablePluginManifest, host: PortablePluginHost): PortablePluginTarget;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PluginManifest } from "./package";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PortablePluginManifest } from "./portable";
|
|
3
3
|
/** 发布内容只携带插件产物元数据,不依赖编辑器或 UI 类型。 */
|
|
4
4
|
export interface PublishedPluginRender {
|
|
5
5
|
runtimeVersion: 1;
|
|
6
|
-
manifest: PluginManifest |
|
|
6
|
+
manifest: PluginManifest | PortablePluginManifest;
|
|
7
7
|
entry: string;
|
|
8
8
|
styles?: string;
|
|
9
9
|
nodeTypes: string[];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { PluginDefinition } from "./contract";
|
|
2
2
|
import type { PluginEditorExtension } from "./editor";
|
|
3
3
|
import type { MarkdownCodec } from "../../markdown/src/index";
|
|
4
|
-
import { type
|
|
4
|
+
import { type PortablePluginManifest, type PortablePluginHost } from "./portable";
|
|
5
5
|
import { type DevelopmentPluginPackage, type PluginManifest } from "./package";
|
|
6
6
|
export type { PublishedPluginRender } from "./render-artifact";
|
|
7
7
|
export declare function assertUniqueEditorCodecs(codecs: readonly MarkdownCodec[], versions?: ReadonlyMap<string, number | undefined>): void;
|
|
8
8
|
export declare const PLUGIN_RENDER_VERSION = 1;
|
|
9
9
|
/** 发布站只读取静态贡献;清单保持原格式,不启动应用插件生命周期。 */
|
|
10
|
-
export declare function readPublishedPluginManifest(value: unknown): PluginManifest |
|
|
10
|
+
export declare function readPublishedPluginManifest(value: unknown): PluginManifest | PortablePluginManifest;
|
|
11
11
|
export declare function evaluatePublishedPluginPackage(artifact: {
|
|
12
|
-
manifest: PluginManifest |
|
|
12
|
+
manifest: PluginManifest | PortablePluginManifest;
|
|
13
13
|
code: string;
|
|
14
14
|
css?: string;
|
|
15
15
|
}, modules: Readonly<Record<string, unknown>>): PluginDefinition;
|
|
@@ -29,7 +29,7 @@ export interface PluginRenderContext {
|
|
|
29
29
|
export declare function evaluatePluginPackage(artifact: DevelopmentPluginPackage, modules: Readonly<Record<string, unknown>>): PluginDefinition;
|
|
30
30
|
/** 只供显式接入跨端协议的宿主;执行前必须先由包读取器验证文件完整性。 */
|
|
31
31
|
export declare function evaluatePortablePluginPackage(artifact: {
|
|
32
|
-
manifest:
|
|
32
|
+
manifest: PortablePluginManifest;
|
|
33
33
|
code: string;
|
|
34
34
|
css?: string;
|
|
35
35
|
}, modules: Readonly<Record<string, unknown>>, host: PortablePluginHost): PluginDefinition;
|
|
@@ -41,14 +41,17 @@ interface PluginSettingsBase {
|
|
|
41
41
|
title: string;
|
|
42
42
|
description?: string;
|
|
43
43
|
/** 提供方可用的模型目录;账号已保存的模型优先于此初始目录。 */
|
|
44
|
-
models?: readonly
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
models?: readonly PluginSettingsModel[];
|
|
45
|
+
}
|
|
46
|
+
export interface PluginSettingsModel {
|
|
47
|
+
id: string;
|
|
48
|
+
label?: string;
|
|
49
|
+
/** 嵌入模型的向量维度;仅作展示提示,实际以 embed 返回为准。 */
|
|
50
|
+
dimensions?: number;
|
|
48
51
|
}
|
|
49
52
|
/** 提供方的连接配置:只声明字段,由宿主在插件设置页按平台渲染与保存。 */
|
|
50
53
|
export interface PluginProviderSettingsDefinition extends PluginSettingsBase {
|
|
51
|
-
target: "sync" | "upload" | "tts" | "asr" | "images" | "video" | "publish";
|
|
54
|
+
target: "sync" | "upload" | "tts" | "asr" | "images" | "embeddings" | "video" | "publish";
|
|
52
55
|
form: ProviderForm;
|
|
53
56
|
component?: never;
|
|
54
57
|
}
|
|
@@ -18,10 +18,6 @@ interface ResizeableAndHideableSidebarProps {
|
|
|
18
18
|
* - 右侧侧边栏通常传 `left`
|
|
19
19
|
*/
|
|
20
20
|
resizeHandleSide?: "left" | "right";
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated 兼容旧调用,等价于 `resizeHandleSide`
|
|
23
|
-
*/
|
|
24
|
-
side?: "left" | "right";
|
|
25
21
|
/** 侧边栏的位置(左侧或右侧),用于确定按钮显示位置 */
|
|
26
22
|
sidebarPosition?: "left" | "right";
|
|
27
23
|
disableResize?: boolean;
|
|
@@ -32,7 +32,7 @@ declare class Board {
|
|
|
32
32
|
/** undo/redo 重放标记:重放历史操作不进提交校验(数据提交时已校验过) */
|
|
33
33
|
private replayingHistory;
|
|
34
34
|
installExtensions(extensions: readonly WhiteboardExtension[], onExtensionError?: (error: WhiteboardExtensionError) => void, services?: ServiceRegistry, extensionServices?: (id: string, api: WhiteboardAPI) => ServiceRegistry): void;
|
|
35
|
-
/**
|
|
35
|
+
/** 替换 children 并重建快照与选区引用,不进 undo 历史、不 emit change */
|
|
36
36
|
replaceChildrenSilently(children: BoardElement[]): void;
|
|
37
37
|
private submissionVersion;
|
|
38
38
|
private removedElementVersions;
|
|
@@ -150,6 +150,8 @@ declare class Board {
|
|
|
150
150
|
renderPluginElement(plugin: IBoardPlugin, element: BoardElement, children: React.ReactElement[]): import("react/jsx-runtime").JSX.Element;
|
|
151
151
|
renderElements(value?: BoardElement[]): (React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null | undefined)[];
|
|
152
152
|
getArrowBindPoint(element: BoardElement, connectId: string, customOffset?: CustomOffset): import("./types/index").Point | null;
|
|
153
|
+
canUndo(): boolean;
|
|
154
|
+
canRedo(): boolean;
|
|
153
155
|
undo(): void;
|
|
154
156
|
redo(): void;
|
|
155
157
|
subscribe(callback: () => void): () => void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { WhiteboardDocumentBinding } from "./document";
|
|
2
|
+
import { type WhiteboardPresenceOptions } from "./collaboration/presence";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { type ServiceRegistry } from "../../shared/service-registry";
|
|
4
5
|
import { BoardElement, ViewPort, Selection, PresentationSequence, PageSketch } from "./types/index";
|
|
5
6
|
import type { WhiteboardExtension, WhiteboardExtensionError, WhiteboardOutline, WhiteboardSnapshot } from "./extensions/api";
|
|
6
7
|
export interface WhiteBoardProps {
|
|
8
|
+
presence?: WhiteboardPresenceOptions;
|
|
7
9
|
document?: WhiteboardDocumentBinding;
|
|
8
10
|
extensions: readonly WhiteboardExtension[];
|
|
9
11
|
outline?: WhiteboardOutline;
|