@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,21 @@
|
|
|
1
|
+
import type { SketchFillStyle, SketchLevel } from "../../types/index";
|
|
2
|
+
interface SketchRectProps {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
radius?: number;
|
|
8
|
+
stroke?: string;
|
|
9
|
+
strokeWidth: number;
|
|
10
|
+
fill?: string;
|
|
11
|
+
fillOpacity?: number;
|
|
12
|
+
fillStyle?: SketchFillStyle;
|
|
13
|
+
washAlpha?: number;
|
|
14
|
+
/** 描边线型:只对圆角矩形生效;缺省实线 */
|
|
15
|
+
strokeDash?: "dashed" | "dotted";
|
|
16
|
+
level: SketchLevel;
|
|
17
|
+
seed: number;
|
|
18
|
+
}
|
|
19
|
+
/** 手绘圆角矩形框:画框、分栏、文本底板、导图节点共用;不接收指针事件,命中仍由原图形承担 */
|
|
20
|
+
declare const SketchRect: import("react").MemoExoticComponent<(props: SketchRectProps) => import("react/jsx-runtime").JSX.Element>;
|
|
21
|
+
export default SketchRect;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { LucideIcon } from "lucide-react";
|
|
3
|
+
export interface ToolMenuItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
icon: LucideIcon;
|
|
7
|
+
onSelect: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** 带子菜单的工具按钮:按钮右下角小三角,点开是 Menu 公共件 */
|
|
10
|
+
export declare function ToolMenu({ label, icon, items, active, }: {
|
|
11
|
+
label: string;
|
|
12
|
+
icon: ReactNode;
|
|
13
|
+
items: ToolMenuItem[];
|
|
14
|
+
active?: boolean;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const ARROW_SIZE = 6;
|
|
2
|
+
export declare const ARROW_CONNECT_POINT_FILL = "var(--tau-accent)";
|
|
3
|
+
export declare const ARROW_CONNECT_POINT_RADIUS = 4;
|
|
4
|
+
export declare const ARROW_CONNECT_PROXIMITY_RADIUS = 28;
|
|
5
|
+
export declare const ARROW_CONNECT_PROXIMITY_HIDE_DELAY = 80;
|
|
6
|
+
export declare const ARROW_DROP_PROXIMITY_RADIUS = 10;
|
|
7
|
+
export declare const DEFAULT_ARROW_LINE_COLOR = "currentColor";
|
|
8
|
+
export declare const DEFAULT_ARROW_LINE_WIDTH = 2;
|
|
9
|
+
export declare const ARROW_CONNECT_ID: {
|
|
10
|
+
readonly TOP: "top";
|
|
11
|
+
readonly BOTTOM: "bottom";
|
|
12
|
+
readonly LEFT: "left";
|
|
13
|
+
readonly RIGHT: "right";
|
|
14
|
+
readonly CENTER: "center";
|
|
15
|
+
readonly CUSTOM: "custom";
|
|
16
|
+
};
|
|
17
|
+
export declare const ARROW_CUSTOM_CONNECT_PROXIMITY = 14;
|
|
18
|
+
export declare const ARROW_CUSTOM_CONNECT_MIN_WORLD = 12;
|
|
19
|
+
export declare const ARROW_CUSTOM_BIND_MARKER_RADIUS = 3.5;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DEFAULT_GEOMETRY_FILL = "none";
|
|
2
|
+
export declare const DEFAULT_GEOMETRY_FILL_OPACITY = 0;
|
|
3
|
+
export declare const DEFAULT_GEOMETRY_STROKE = "currentColor";
|
|
4
|
+
export declare const DEFAULT_GEOMETRY_STROKE_WIDTH = 1;
|
|
5
|
+
export declare const DEFAULT_GEOMETRY_STROKE_OPACITY = 1;
|
|
6
|
+
export declare const DEFAULT_GEOMETRY_CORNER_RADIUS = 0;
|
|
7
|
+
export declare const DEFAULT_GEOMETRY_TEXT_ALIGN = "center";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EShadowSize } from "./shadow";
|
|
2
|
+
export declare enum EDescriptionPosition {
|
|
3
|
+
TOP = "top",
|
|
4
|
+
BOTTOM = "bottom"
|
|
5
|
+
}
|
|
6
|
+
export declare enum EDescriptionAlignment {
|
|
7
|
+
LEFT = "left",
|
|
8
|
+
CENTER = "center",
|
|
9
|
+
RIGHT = "right"
|
|
10
|
+
}
|
|
11
|
+
export declare const IMAGE_DESCRIPTION_HEIGHT = 24;
|
|
12
|
+
export declare const IMAGE_DESCRIPTION_PADDING = "4px 8px";
|
|
13
|
+
export declare const IMAGE_DESCRIPTION_MARGIN = 8;
|
|
14
|
+
export declare const IMAGE_DESCRIPTION_LIGHT_COLOR = "#666666";
|
|
15
|
+
export declare const IMAGE_DESCRIPTION_DARK_COLOR = "#aaaaaa";
|
|
16
|
+
export declare const IMAGE_DESCRIPTION_PLACEHOLDER = "\u6DFB\u52A0\u63CF\u8FF0...";
|
|
17
|
+
export declare const DEFAULT_DESCRIPTION = "";
|
|
18
|
+
export declare const DEFAULT_DESCRIPTION_POSITION = EDescriptionPosition.BOTTOM;
|
|
19
|
+
export declare const DEFAULT_DESCRIPTION_ALIGNMENT = EDescriptionAlignment.CENTER;
|
|
20
|
+
export declare const DEFAULT_DESCRIPTION_FONT_SIZE = 10;
|
|
21
|
+
export declare const DEFAULT_IMAGE_SHADOW_SIZE = EShadowSize.None;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./map";
|
|
2
|
+
export * from "./select";
|
|
3
|
+
export * from "./tools";
|
|
4
|
+
export * from "./arrow";
|
|
5
|
+
export * from "./resize";
|
|
6
|
+
export * from "./geometry";
|
|
7
|
+
export * from "./text-style";
|
|
8
|
+
export * from "./mind";
|
|
9
|
+
export * from "./viewport";
|
|
10
|
+
export * from "./grid";
|
|
11
|
+
export * from "./shadow";
|
|
12
|
+
export * from "./sketch";
|
|
13
|
+
export declare const FIT_VIEW_PADDING = 50;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 思维导图主题 = 配色(种子色相)× 风格(节点轻重)× 明暗。
|
|
3
|
+
* 这里只存种子,具体色值由 MindThemeUtil 在 OKLCH 空间派生,并保证文字对比度 ≥ 4.5:1。
|
|
4
|
+
* 着色按分支:同一条二级分支及其子孙共用一个色相,层级靠「实心 → 浅底 → 纯文字」区分。
|
|
5
|
+
*/
|
|
6
|
+
export interface MindHue {
|
|
7
|
+
/** OKLCH 色相(度) */
|
|
8
|
+
h: number;
|
|
9
|
+
/** OKLCH 彩度,0 为纯灰 */
|
|
10
|
+
c: number;
|
|
11
|
+
}
|
|
12
|
+
export interface MindPalette {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
root: MindHue;
|
|
16
|
+
/** 分支色相,按二级节点顺序循环 */
|
|
17
|
+
hues: MindHue[];
|
|
18
|
+
/** 深色画布下根节点仍用深色实底(霓虹这类以深底为特征的配色) */
|
|
19
|
+
rootAlwaysDark?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type MindThemeStyle = "solid" | "soft" | "outline";
|
|
22
|
+
export declare const MIND_THEME_STYLES: Array<{
|
|
23
|
+
value: MindThemeStyle;
|
|
24
|
+
label: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const MIND_PALETTES: MindPalette[];
|
|
27
|
+
export declare const DEFAULT_THEME_ID = "classic";
|
|
28
|
+
export declare const DEFAULT_THEME_STYLE: MindThemeStyle;
|
|
29
|
+
export declare function getPaletteById(id: string | undefined): MindPalette;
|
|
30
|
+
export declare function isMindThemeStyle(v: unknown): v is MindThemeStyle;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const MIND_COLORS: readonly [{
|
|
2
|
+
readonly background: "rgb(62, 136, 245)";
|
|
3
|
+
readonly textColor: "#fff";
|
|
4
|
+
readonly theme: "dark";
|
|
5
|
+
}, {
|
|
6
|
+
readonly background: "rgb(238, 238, 238)";
|
|
7
|
+
readonly textColor: "#000";
|
|
8
|
+
readonly theme: "light";
|
|
9
|
+
}, {
|
|
10
|
+
readonly background: "transparent";
|
|
11
|
+
readonly textColor: "currentColor";
|
|
12
|
+
}];
|
|
13
|
+
export declare const MIND_LINE_COLORS: string[];
|
|
14
|
+
export declare const getMindDragSourceId: (nodeId: string) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum EShadowSize {
|
|
2
|
+
None = "none",
|
|
3
|
+
Small = "small",
|
|
4
|
+
Medium = "medium",
|
|
5
|
+
Large = "large"
|
|
6
|
+
}
|
|
7
|
+
export interface ShadowSizeOption {
|
|
8
|
+
value: EShadowSize;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const SHADOW_SIZE_OPTIONS: ShadowSizeOption[];
|
|
12
|
+
export declare function getShadowStyle(size: EShadowSize | undefined | null, isDark: boolean): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SketchFillStyle, SketchLevel, SketchMode } from "../types/sketch";
|
|
2
|
+
export declare const SKETCH_MODE_OPTIONS: {
|
|
3
|
+
value: SketchMode;
|
|
4
|
+
label: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const SKETCH_LEVEL_OPTIONS: {
|
|
7
|
+
value: SketchLevel;
|
|
8
|
+
label: string;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const SKETCH_FILL_OPTIONS: {
|
|
11
|
+
value: SketchFillStyle;
|
|
12
|
+
label: string;
|
|
13
|
+
}[];
|
|
14
|
+
export declare const sketchLevelLabel: (level: SketchLevel) => string;
|
|
15
|
+
/** 媒体类元素(图片 / 视频 / 网页 / 音频 / 白板引用)手绘外框的墨色 */
|
|
16
|
+
export declare const SKETCH_MEDIA_FRAME = "var(--tau-ink-3)";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { ColumnColor } from "../types/column";
|
|
2
|
+
/**
|
|
3
|
+
* 富文本 / 卡片的外观:只存语义(样式 + 色调),颜色全部取主题 token,
|
|
4
|
+
* 随主题族与明暗切换。内边距、圆角、阴影由这里统一给定,不开放给用户。
|
|
5
|
+
*
|
|
6
|
+
* - none 透明:无底无框,只有文字
|
|
7
|
+
* - plain 白卡:surface 实底 + 发丝线
|
|
8
|
+
* - band 色带:白卡 + 顶部 tag 色带(与 Column 色带同高同色)
|
|
9
|
+
* - tinted 柔色:tag-soft 底 + 同色系淡边
|
|
10
|
+
*/
|
|
11
|
+
export type TextVariant = "none" | "plain" | "band" | "tinted";
|
|
12
|
+
/** 色调与 Column 共用同一组标签色,色相顺序一致 */
|
|
13
|
+
export type TextTone = ColumnColor;
|
|
14
|
+
export interface TextStyle {
|
|
15
|
+
variant: TextVariant;
|
|
16
|
+
tone?: TextTone;
|
|
17
|
+
}
|
|
18
|
+
export declare const TEXT_TONES: Array<{
|
|
19
|
+
value: TextTone;
|
|
20
|
+
label: string;
|
|
21
|
+
solid: string;
|
|
22
|
+
soft: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const TEXT_BOX: {
|
|
25
|
+
readonly radius: 6;
|
|
26
|
+
readonly paddingX: 16;
|
|
27
|
+
readonly paddingY: 12;
|
|
28
|
+
readonly bandHeight: 3;
|
|
29
|
+
};
|
|
30
|
+
export declare const TEXT_COLORS: {
|
|
31
|
+
readonly ink: "var(--tau-ink-1)";
|
|
32
|
+
readonly surface: "var(--tau-bg-surface)";
|
|
33
|
+
readonly line: "color-mix(in srgb, var(--tau-ink-1) 11%, transparent)";
|
|
34
|
+
};
|
|
35
|
+
export declare const DEFAULT_RICHTEXT_STYLE: TextStyle;
|
|
36
|
+
export interface TextBoxPadding {
|
|
37
|
+
top: number;
|
|
38
|
+
right: number;
|
|
39
|
+
bottom: number;
|
|
40
|
+
left: number;
|
|
41
|
+
}
|
|
42
|
+
export declare function getTextBoxPadding(style: TextStyle): TextBoxPadding;
|
|
43
|
+
export declare const toCssPadding: (p: TextBoxPadding) => string;
|
|
44
|
+
/**
|
|
45
|
+
* 底板的底色与发丝线色;none 返回 null。卡片不用阴影,只靠发丝线分层。
|
|
46
|
+
* sketchEdge:手绘模式下的墨迹框色——发丝线太淡,墨迹需要可辨的颜色(D-107)
|
|
47
|
+
*/
|
|
48
|
+
export declare function getTextSurface(style: TextStyle): {
|
|
49
|
+
background: string;
|
|
50
|
+
edge: string;
|
|
51
|
+
sketchEdge: string;
|
|
52
|
+
} | null;
|
|
53
|
+
/** 顶部色带颜色;非 band 或无色调返回 null */
|
|
54
|
+
export declare function getTextBandColor(style: TextStyle): string | null;
|
|
55
|
+
interface TextStyleSource {
|
|
56
|
+
type: string;
|
|
57
|
+
variant?: TextVariant;
|
|
58
|
+
tone?: TextTone;
|
|
59
|
+
/** @deprecated 旧版字段,仅用于换算 */
|
|
60
|
+
background?: string;
|
|
61
|
+
/** @deprecated 旧版字段,仅用于换算 */
|
|
62
|
+
topColor?: string;
|
|
63
|
+
}
|
|
64
|
+
/** 读出元素的有效样式:新字段优先,否则由旧色值换算,都没有则取类型默认 */
|
|
65
|
+
export declare function resolveTextStyle(element: TextStyleSource): TextStyle;
|
|
66
|
+
/** 选中新样式时一并清掉的旧版外观字段 */
|
|
67
|
+
export declare const LEGACY_TEXT_STYLE_KEYS: readonly ["background", "topColor", "color", "theme", "shadowSize", "paddingWidth", "paddingHeight"];
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** 内置"选择"工具 id(非创建模式的哨兵值) */
|
|
2
|
+
export declare const SELECT_TOOL_ID = "tau.select";
|
|
3
|
+
/** 内置创建工具 id(工具按钮、右键菜单与扩展装配共用同一常量) */
|
|
4
|
+
export declare const GEOMETRY_TOOL_ID = "tau.geometry.create";
|
|
5
|
+
export declare const ARROW_TOOL_ID = "tau.arrow.create";
|
|
6
|
+
export declare const HANDWRITE_TOOL_ID = "tau.handwrite.create";
|
|
7
|
+
export declare const RICHTEXT_TOOL_ID = "tau.richtext.create";
|
|
8
|
+
export declare const MIND_TOOL_ID = "tau.mind.create";
|
|
9
|
+
export declare const FRAME_TOOL_ID = "tau.frame.create";
|
|
10
|
+
export declare const COLUMN_TOOL_ID = "tau.column.create";
|
|
11
|
+
export declare const builtinCreateToolIds: Set<string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** 当前应用可读写的白板文档版本;保存时永远写入该值。 */
|
|
2
|
+
export declare const WHITEBOARD_DOCUMENT_VERSION = 2;
|
|
3
|
+
/**
|
|
4
|
+
* 从持久化的白板页 data(JSON 解析结果)取文档版本。
|
|
5
|
+
* 旧数据没有 version 字段或值非法(非正整数)时视为 1。
|
|
6
|
+
*/
|
|
7
|
+
export declare function getDocumentVersion(data: unknown): number;
|
|
8
|
+
/** 版本高于当前应用支持的范围时只读展示,不写回。 */
|
|
9
|
+
export declare function isDocumentVersionSupported(version: number): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { WhiteboardAuthorBridge } from "./extensions/authorTypes";
|
|
2
|
+
import type { WhiteboardElementDefinition } from "./extensions/api";
|
|
3
|
+
import type { EditorDocument } from "../../editor/src/index";
|
|
4
|
+
import type Board from "./Board";
|
|
5
|
+
import type { Operation } from "./types/operation";
|
|
6
|
+
/** 文档绑定只接管内容与历史;视口和选区仍由画布本机实例管理。 */
|
|
7
|
+
export interface WhiteboardDocumentBinding {
|
|
8
|
+
isBlocked?(): boolean;
|
|
9
|
+
flushInputs?(): void;
|
|
10
|
+
createContentCopy?(elementId: string): Promise<number>;
|
|
11
|
+
duplicatePage?(pageId: string): Promise<string>;
|
|
12
|
+
pages?(): readonly {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
}[];
|
|
16
|
+
moveToPage?(ids: readonly string[], pageId: string): void;
|
|
17
|
+
appendStroke?(id: string, points: readonly import("./utils/HandwriteUtil").HandwriteInputPoint[], style: import("./utils/HandwriteUtil").HandwriteStyle): void;
|
|
18
|
+
cancelStroke?(id: string): void;
|
|
19
|
+
exportFile?(ids?: readonly string[]): Promise<Blob>;
|
|
20
|
+
exportTransfer?(ids?: readonly string[]): import("../../collaboration/whiteboard-types").WhiteboardTransfer;
|
|
21
|
+
importTransfer?(bundle: import("../../collaboration/whiteboard-types").WhiteboardTransfer, allPages?: boolean): Promise<readonly string[]>;
|
|
22
|
+
linkEntity?(elementId: string, kind: import("../../db-schema/content-identities").ContentEntityKind, localId: number): Promise<boolean>;
|
|
23
|
+
unlinkEntity?(elementId: string): void;
|
|
24
|
+
setPresentations?(before: readonly import("./types/presentation").PresentationSequence[], after: readonly import("./types/presentation").PresentationSequence[]): void;
|
|
25
|
+
revealElements?(ids: readonly string[]): void;
|
|
26
|
+
measureElement?(elementId: string, size: {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}): void;
|
|
30
|
+
refreshLayout?(): void;
|
|
31
|
+
supportsElement?(elementId: string): boolean;
|
|
32
|
+
textField?(elementId: string, field: string): import("../../editor/text-field-contract").EditorTextField;
|
|
33
|
+
readonly author?: WhiteboardAuthorBridge;
|
|
34
|
+
resolveElementDefinition?(contractId: string): {
|
|
35
|
+
element: WhiteboardElementDefinition;
|
|
36
|
+
access: "read" | "edit" | "none";
|
|
37
|
+
} | undefined;
|
|
38
|
+
connect(board: Board): () => void;
|
|
39
|
+
apply(operations: Operation[], updateHistory: boolean, historyGroup?: string): boolean;
|
|
40
|
+
commitPreview(operations: Operation[], historyGroup?: string): void;
|
|
41
|
+
beginGesture(): void;
|
|
42
|
+
splitHistory(): void;
|
|
43
|
+
endGesture(commit: boolean): void;
|
|
44
|
+
undo(): void;
|
|
45
|
+
redo(): void;
|
|
46
|
+
textDocument(elementId: string): EditorDocument | undefined;
|
|
47
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { DataMigration, PreviousDataVersion } from "../../../db-schema/data-versions";
|
|
2
|
+
import type { ContentResourceSpec } from "../../../db-schema/content-resources";
|
|
1
3
|
import type { ComponentType, ReactNode } from "react";
|
|
2
4
|
import type { ServiceIdentifier } from "../../../shared/service-contract";
|
|
3
5
|
import type { BoardElement, ElementBounds } from "../types/element";
|
|
@@ -109,6 +111,13 @@ export interface ElementContainmentSpec {
|
|
|
109
111
|
joins?: readonly ContainerKind[];
|
|
110
112
|
}
|
|
111
113
|
export interface WhiteboardElementDefinition<TData = unknown> {
|
|
114
|
+
dataVersion?: number;
|
|
115
|
+
collaboration?: {
|
|
116
|
+
textFields?: readonly string[];
|
|
117
|
+
};
|
|
118
|
+
resources?: readonly ContentResourceSpec[];
|
|
119
|
+
previousVersions?: readonly PreviousDataVersion<WhiteboardElementDefinition<TData>>[];
|
|
120
|
+
migrations?: readonly DataMigration<any>[];
|
|
112
121
|
type: string;
|
|
113
122
|
presentation?: {
|
|
114
123
|
label: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WhiteboardAPI as HostAPI, WhiteboardExtension as HostExtension } from "./api";
|
|
2
|
+
import type { WhiteboardAPI, WhiteboardAuthorBridge, WhiteboardElementDefinition, WhiteboardExtension } from "./authorTypes";
|
|
3
|
+
export declare const whiteboardAuthorOwner: (extension: object) => string | undefined;
|
|
4
|
+
export declare function bindWhiteboardAuthorAPI(base: HostAPI, owner: string, get: () => WhiteboardAuthorBridge | undefined, active: () => boolean): () => void;
|
|
5
|
+
export declare function authorAPI(base: HostAPI): WhiteboardAPI;
|
|
6
|
+
export declare function useWhiteboardAPI(): WhiteboardAPI;
|
|
7
|
+
export declare function defineElement<TData = unknown>(definition: WhiteboardElementDefinition<TData>): WhiteboardElementDefinition<TData>;
|
|
8
|
+
/** 作者工厂及回调始终收到受控外观,宿主旧能力不进入作者对象原型。 */
|
|
9
|
+
export declare function defineWhiteboardExtension(definition: Omit<WhiteboardExtension, "apiVersion">): WhiteboardExtension;
|
|
10
|
+
export declare function hostWhiteboardExtensions(extensions: readonly WhiteboardExtension[], owner?: string): readonly HostExtension[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { BoardElement } from "../types/element";
|
|
2
|
-
export declare function usePageSketch(): import("../
|
|
2
|
+
export declare function usePageSketch(): import("../index").PageSketch;
|
|
3
3
|
/** 订阅所属画布的画风,元素和 owner 的覆盖仍由内核统一解析。 */
|
|
4
|
-
export declare function useSketch(element: BoardElement, owner?: BoardElement): import("../
|
|
4
|
+
export declare function useSketch(element: BoardElement, owner?: BoardElement): import("../index").ResolvedSketch;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { DataJson } from "../../../db-schema/content-contracts";
|
|
2
|
+
import type { DataMigration, PreviousDataVersion } from "../../../db-schema/data-versions";
|
|
3
|
+
import type { EditorTextField } from "../../../editor/text-field-contract";
|
|
4
|
+
import type { WhiteboardAPI as HostAPI, WhiteboardElementDefinition as HostElement, WhiteboardContributions as HostContributions, WhiteboardExtension as HostExtension } from "./api";
|
|
5
|
+
export type WhiteboardData = Readonly<Record<string, DataJson>>;
|
|
6
|
+
export interface WhiteboardGeometry {
|
|
7
|
+
readonly x: number;
|
|
8
|
+
readonly y: number;
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly height: number;
|
|
11
|
+
readonly rotation: number;
|
|
12
|
+
}
|
|
13
|
+
export type WhiteboardParent = {
|
|
14
|
+
kind: "page" | "element";
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
export type WhiteboardAnchor = {
|
|
18
|
+
beforeId: string;
|
|
19
|
+
afterId?: never;
|
|
20
|
+
} | {
|
|
21
|
+
afterId: string;
|
|
22
|
+
beforeId?: never;
|
|
23
|
+
} | {
|
|
24
|
+
beforeId?: never;
|
|
25
|
+
afterId?: never;
|
|
26
|
+
};
|
|
27
|
+
export interface WhiteboardShellPatch {
|
|
28
|
+
name?: string;
|
|
29
|
+
geometry?: WhiteboardGeometry;
|
|
30
|
+
style?: WhiteboardData;
|
|
31
|
+
}
|
|
32
|
+
export interface WhiteboardElement {
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly type: string;
|
|
35
|
+
readonly name?: string;
|
|
36
|
+
readonly style?: WhiteboardData;
|
|
37
|
+
readonly data: WhiteboardData;
|
|
38
|
+
readonly geometry: WhiteboardGeometry;
|
|
39
|
+
readonly children?: readonly WhiteboardElement[];
|
|
40
|
+
}
|
|
41
|
+
export type WhiteboardIdCommand = ({
|
|
42
|
+
type: "create";
|
|
43
|
+
element: {
|
|
44
|
+
type: string;
|
|
45
|
+
data: WhiteboardData;
|
|
46
|
+
geometry: WhiteboardGeometry;
|
|
47
|
+
};
|
|
48
|
+
parent: WhiteboardParent;
|
|
49
|
+
} & WhiteboardAnchor) | {
|
|
50
|
+
type: "set_node";
|
|
51
|
+
id: string;
|
|
52
|
+
patch: WhiteboardShellPatch;
|
|
53
|
+
} | {
|
|
54
|
+
type: "set_data";
|
|
55
|
+
id: string;
|
|
56
|
+
patch: WhiteboardData;
|
|
57
|
+
unset?: readonly string[];
|
|
58
|
+
} | ({
|
|
59
|
+
type: "move_node";
|
|
60
|
+
id: string;
|
|
61
|
+
parent: WhiteboardParent;
|
|
62
|
+
} & WhiteboardAnchor) | {
|
|
63
|
+
type: "remove_nodes";
|
|
64
|
+
ids: readonly string[];
|
|
65
|
+
};
|
|
66
|
+
export interface WhiteboardSnapshot {
|
|
67
|
+
readonly pageId: string;
|
|
68
|
+
readonly children: readonly WhiteboardElement[];
|
|
69
|
+
}
|
|
70
|
+
export interface WhiteboardAPI extends Omit<HostAPI, "children" | "getSnapshot" | "getElement" | "submit" | "apply" | "updateElement" | "captureSubmission"> {
|
|
71
|
+
readonly children: readonly WhiteboardElement[];
|
|
72
|
+
getSnapshot(): WhiteboardSnapshot;
|
|
73
|
+
getElement(id: string): WhiteboardElement | undefined;
|
|
74
|
+
updateElement(id: string, patch: WhiteboardShellPatch): boolean;
|
|
75
|
+
updateElementData(id: string, patch: WhiteboardData, options?: {
|
|
76
|
+
unset?: readonly string[];
|
|
77
|
+
historyGroup?: string;
|
|
78
|
+
}): boolean;
|
|
79
|
+
getTextBinding(id: string, field: string): EditorTextField;
|
|
80
|
+
submit(commands: readonly WhiteboardIdCommand[], options?: {
|
|
81
|
+
historyGroup?: string;
|
|
82
|
+
}): {
|
|
83
|
+
readonly createdIds: readonly string[];
|
|
84
|
+
};
|
|
85
|
+
captureSubmission(target?: string | {
|
|
86
|
+
readonly id: string;
|
|
87
|
+
}): () => boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface WhiteboardElementDefinition<TData = unknown> extends Omit<HostElement<TData>, "schemaVersion" | "migrate" | "previousVersions" | "migrations" | "create"> {
|
|
90
|
+
dataVersion: number;
|
|
91
|
+
previousVersions?: readonly PreviousDataVersion<WhiteboardElementDefinition<any>>[];
|
|
92
|
+
migrations?: readonly DataMigration<Record<string, DataJson>>[];
|
|
93
|
+
create?: Omit<NonNullable<HostElement<TData>["create"]>, "build" | "gesture"> & {
|
|
94
|
+
gesture: "click" | "drag" | {
|
|
95
|
+
begin(context: Omit<import("./api").CreatePointerContext, "api"> & {
|
|
96
|
+
api: WhiteboardAPI;
|
|
97
|
+
preview(element: import("./api").TypedBoardElement<TData> | null, options?: import("./api").CreatePreviewOptions): void;
|
|
98
|
+
}): {
|
|
99
|
+
move(context: Omit<import("./api").CreatePointerContext, "api"> & {
|
|
100
|
+
api: WhiteboardAPI;
|
|
101
|
+
}): void;
|
|
102
|
+
end(context: Omit<import("./api").CreatePointerContext, "api"> & {
|
|
103
|
+
api: WhiteboardAPI;
|
|
104
|
+
moved: boolean;
|
|
105
|
+
}): import("./api").TypedBoardElement<TData> | null | Promise<import("./api").TypedBoardElement<TData> | null>;
|
|
106
|
+
cancel?(): void;
|
|
107
|
+
} | null;
|
|
108
|
+
};
|
|
109
|
+
build?(context: Omit<import("./api").CreateBuildContext, "api"> & {
|
|
110
|
+
api: WhiteboardAPI;
|
|
111
|
+
}): import("./api").TypedBoardElement<TData> | null | Promise<import("./api").TypedBoardElement<TData> | null>;
|
|
112
|
+
};
|
|
113
|
+
schemaVersion?: never;
|
|
114
|
+
migrate?: never;
|
|
115
|
+
}
|
|
116
|
+
export interface WhiteboardContributions extends Omit<HostContributions, "commands" | "menus" | "ingest"> {
|
|
117
|
+
commands?: readonly {
|
|
118
|
+
id: string;
|
|
119
|
+
enabled?(api: WhiteboardAPI): boolean;
|
|
120
|
+
execute(api: WhiteboardAPI, payload?: unknown): unknown;
|
|
121
|
+
}[];
|
|
122
|
+
menus?: readonly {
|
|
123
|
+
id: string;
|
|
124
|
+
label: string;
|
|
125
|
+
command: string;
|
|
126
|
+
order: number;
|
|
127
|
+
when?(api: WhiteboardAPI): boolean;
|
|
128
|
+
}[];
|
|
129
|
+
ingest?: readonly {
|
|
130
|
+
id: string;
|
|
131
|
+
source: "paste" | "drop";
|
|
132
|
+
accepts(event: ClipboardEvent | DragEvent): boolean;
|
|
133
|
+
run(api: WhiteboardAPI, event: ClipboardEvent | DragEvent): void | Promise<void>;
|
|
134
|
+
}[];
|
|
135
|
+
}
|
|
136
|
+
export interface WhiteboardExtension extends Omit<HostExtension, "elements" | "create"> {
|
|
137
|
+
readonly elements?: readonly WhiteboardElementDefinition<any>[];
|
|
138
|
+
create(api: WhiteboardAPI): WhiteboardContributions;
|
|
139
|
+
}
|
|
140
|
+
/** 宿主实现注册到作用域,不包含 Y.Doc 或画布内核。 */
|
|
141
|
+
export interface WhiteboardAuthorBridge {
|
|
142
|
+
canWrite(): boolean;
|
|
143
|
+
getPageId(): string;
|
|
144
|
+
getSnapshot(): Pick<WhiteboardSnapshot, "pageId" | "children">;
|
|
145
|
+
getElement(id: string): WhiteboardElement | undefined;
|
|
146
|
+
submit(owner: string, commands: readonly WhiteboardIdCommand[], historyGroup?: string): {
|
|
147
|
+
readonly createdIds: readonly string[];
|
|
148
|
+
};
|
|
149
|
+
getTextBinding(owner: string, id: string, field: string): EditorTextField;
|
|
150
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ComponentType } from "react";
|
|
2
|
+
import { type MediaInfoService } from "../../../shared/media-services";
|
|
3
|
+
import type { PluginContextMenuItem } from "../types/index";
|
|
4
|
+
import type { WhiteboardAPI } from "./api";
|
|
5
|
+
/** 媒体插件的宿主能力:由扩展从宿主服务构造,upload/download 缺失时对应入口隐藏 */
|
|
6
|
+
/** 宿主提供的视频来源(如各视频插件),每项一个添加入口,选择后以 `source:<id>` 动作打开宿主弹窗。 */
|
|
7
|
+
export interface VideoSourceEntry {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MediaCapabilities {
|
|
12
|
+
actions?: readonly string[];
|
|
13
|
+
/** 每次打开菜单时读取,来源随宿主状态增减。 */
|
|
14
|
+
videoSources?: () => readonly VideoSourceEntry[];
|
|
15
|
+
upload?(file: File): Promise<string | null>;
|
|
16
|
+
download?(url: string): Promise<unknown>;
|
|
17
|
+
imageInfo(file: File): Promise<{
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
} | null>;
|
|
21
|
+
videoInfo(file: File): Promise<{
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
} | null>;
|
|
25
|
+
}
|
|
26
|
+
/** 宿主对内置媒体扩展的 UI 配置(菜单动作与图片组件),保留为工厂参数、不进服务 */
|
|
27
|
+
export interface MediaExtensionOptions {
|
|
28
|
+
resolveUrl?: (url: string) => Promise<string>;
|
|
29
|
+
actions?: readonly string[];
|
|
30
|
+
videoSources?: () => readonly VideoSourceEntry[];
|
|
31
|
+
Image?: ComponentType<{
|
|
32
|
+
url: string;
|
|
33
|
+
alt?: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
onLoad?: React.ReactEventHandler<HTMLImageElement>;
|
|
37
|
+
onError?: React.ReactEventHandler<HTMLImageElement>;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
/** 浏览器实现的媒体信息探测(objectURL 解码),无宿主 IMediaInfoService 时的兜底 */
|
|
41
|
+
export declare const browserMediaInfo: MediaInfoService;
|
|
42
|
+
export declare const MediaExtensionContext: import("react").Context<MediaExtensionOptions>;
|
|
43
|
+
export declare const useMediaExtension: () => MediaExtensionOptions;
|
|
44
|
+
/**
|
|
45
|
+
* 从宿主服务构造媒体插件的运行时能力:
|
|
46
|
+
* upload 按 shared 契约把“空串 / null / 抛错”统一视为失败(空串归一为 null,抛错自然冒泡),
|
|
47
|
+
* 缺失 IMediaInfoService 时退回浏览器实现。
|
|
48
|
+
*/
|
|
49
|
+
export declare function mediaCapabilitiesFromServices(api: WhiteboardAPI, actions?: readonly string[]): MediaCapabilities;
|
|
50
|
+
export declare function mediaMenu(items: PluginContextMenuItem[], kind: "image" | "video" | "audio", options: MediaCapabilities): PluginContextMenuItem[];
|