@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,11 @@
|
|
|
1
|
+
import type { MediaCapabilities } from "../extensions/media";
|
|
2
|
+
import { Board } from "../types/index";
|
|
3
|
+
import type { OnlineVideoMeta } from "../types/video";
|
|
4
|
+
export declare class VideoUtil {
|
|
5
|
+
static insertVideo(file: File, board: Board, media: MediaCapabilities): Promise<void>;
|
|
6
|
+
private static getVideoSizeFromUrl;
|
|
7
|
+
static insertVideoFromPath(src: string, board: Board): Promise<void>;
|
|
8
|
+
static insertVideoFromUrl(url: string, board: Board): Promise<void>;
|
|
9
|
+
/** 插入视频插件提供的视频:src 保存原页面地址,播放由宿主按 meta 取源。 */
|
|
10
|
+
static insertVideoFromMeta(board: Board, meta: OnlineVideoMeta, pageUrl: string): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ViewPort } from "../types/index";
|
|
2
|
+
declare class ViewportUtil {
|
|
3
|
+
static isRectInViewport(rect: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}, viewPort: ViewPort, expandPixels?: number): boolean;
|
|
9
|
+
}
|
|
10
|
+
export default ViewportUtil;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EventHandler, Board, SelectArea, BBox, Point } from "../types/index";
|
|
2
|
+
import { EHandlerPosition } from "../types/resize";
|
|
3
|
+
export declare const isRectIntersect: (rect1: BBox, rect2: BBox) => boolean;
|
|
4
|
+
export declare const getRectIntersectionArea: (rect1: BBox, rect2: BBox) => number;
|
|
5
|
+
export declare const selectAreaToRect: (selectArea: SelectArea) => {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const isValid: <T>(value: T | null | undefined) => value is T;
|
|
12
|
+
/**
|
|
13
|
+
* 按注册顺序执行事件处理器,任一处理器返回 false 则中断后续分发。
|
|
14
|
+
* @returns 是否完整执行(未被中断)
|
|
15
|
+
*/
|
|
16
|
+
export declare const executeSequence: (fns: EventHandler[], event: Event, board: Board) => boolean;
|
|
17
|
+
export declare const getResizedBBox: (bbox: BBox, position: EHandlerPosition, anchor: Point, focus: Point, isPreserveRatio?: boolean) => BBox;
|
|
18
|
+
export declare const transformPath: (pathString: string, scaleX: number, scaleY: number) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type Board from "../Board";
|
|
2
|
+
/** 画布容器内的宿主浮层(如文档阅读纸):其中的按键、剪贴板与指针事件不归画布 */
|
|
3
|
+
export declare const CANVAS_OVERLAY_ATTR = "data-whiteboard-overlay";
|
|
4
|
+
export declare const isCanvasOverlayEvent: (event: {
|
|
5
|
+
target: EventTarget | null;
|
|
6
|
+
}) => boolean;
|
|
7
|
+
export declare function ownsBoardEvent(board: Board, event: Event): boolean;
|
|
8
|
+
export declare function claimBoardPointer(board: Board, event: PointerEvent): boolean;
|
|
9
|
+
export declare function ownsBoardPointerEvent(board: Board, event: PointerEvent): boolean;
|
|
10
|
+
export declare const wasBoardPointerFinished: (event: Event) => boolean;
|
|
11
|
+
export declare function finishBoardPointer(event: Event): void;
|
|
12
|
+
export declare function releaseBoardPointer(board: Board, event: PointerEvent): void;
|
|
13
|
+
export declare function releaseBoardPointers(board: Board): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from "./BoardUtil";
|
|
2
|
+
export * from "./PointUtil";
|
|
3
|
+
export * from "./PathUtil";
|
|
4
|
+
export * from "./CanvasUtil";
|
|
5
|
+
export * from "./ImageUtil";
|
|
6
|
+
export * from "./VideoUtil";
|
|
7
|
+
export * from "./AudioUtil";
|
|
8
|
+
export * from "./GeometryUtil";
|
|
9
|
+
export * from "./TextStyleStore";
|
|
10
|
+
export * from "./RichTextContentUtil";
|
|
11
|
+
export * from "./common";
|
|
12
|
+
export * from "./snap/SnapGeometry";
|
|
13
|
+
export * from "./ArrowUtil";
|
|
14
|
+
export * from "./ConnectPointUtil";
|
|
15
|
+
export * from "./ArrowConnectTracker";
|
|
16
|
+
export * from "./MindUtil";
|
|
17
|
+
export * from "./MindThemeUtil";
|
|
18
|
+
export * from "./FrameUtil";
|
|
19
|
+
export * from "./ColumnUtil";
|
|
20
|
+
export * from "./Constraints";
|
|
21
|
+
export * from "./SelectionActionUtil";
|
|
22
|
+
export * from "./ClipboardUtil";
|
|
23
|
+
export * from "./ArrowStyleUtil";
|
|
24
|
+
export * from "./HandwriteUtil";
|
|
25
|
+
export * from "./HandwriteGroupUtil";
|
|
26
|
+
export * from "./ExportImageUtil";
|
|
27
|
+
export * from "./LayerOrderUtil";
|
|
28
|
+
export { default as ViewportUtil } from "./ViewportUtil";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { EMarkerType } from "../../types/arrow";
|
|
2
|
+
import type { SketchLevel } from "../../types/sketch";
|
|
3
|
+
import type { SketchPath } from "./types";
|
|
4
|
+
export interface SketchArrowInput {
|
|
5
|
+
/** 连线中心线(ArrowUtil.getArrowPath 的输出,画布坐标) */
|
|
6
|
+
d: string;
|
|
7
|
+
color: string;
|
|
8
|
+
strokeWidth: number;
|
|
9
|
+
dashed?: boolean;
|
|
10
|
+
dashArray?: number[];
|
|
11
|
+
sourceMarker: EMarkerType;
|
|
12
|
+
targetMarker: EMarkerType;
|
|
13
|
+
level: SketchLevel;
|
|
14
|
+
seed: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SketchArrowOutput {
|
|
17
|
+
paths: SketchPath[];
|
|
18
|
+
/** 摆动后的中心线:流动点沿它运动,虚线遮罩也沿它描 */
|
|
19
|
+
centerline: string;
|
|
20
|
+
/** 中心线长度(px) */
|
|
21
|
+
length: number;
|
|
22
|
+
}
|
|
23
|
+
/** 端点标记长度:随线宽增长,封顶避免粗线配大黑三角 */
|
|
24
|
+
export declare const markerLength: (strokeWidth: number) => number;
|
|
25
|
+
/**
|
|
26
|
+
* 连线的手绘渲染。线身始终是一笔连续墨迹;虚线由遮罩切段(dashMask),
|
|
27
|
+
* 所以虚线与流动动画都不需要重算墨迹。
|
|
28
|
+
*/
|
|
29
|
+
export declare function sketchArrow(input: SketchArrowInput): SketchArrowOutput;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type Board from "../../Board";
|
|
2
|
+
import type { BoardElement, Operation, SetNodePatch } from "../../types/index";
|
|
3
|
+
export { patchSketch } from "./patch";
|
|
4
|
+
/**
|
|
5
|
+
* 多选笔触的作用对象:思维导图节点归到根节点(覆盖存在根上),重复的根只算一次;
|
|
6
|
+
* 不跟随手绘的类型(手写)剔除。
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSketchTargets(board: Board, elements: BoardElement[]): BoardElement[];
|
|
9
|
+
/** 按元素生成只改 sketch / fillStyle 的 set_node;recipe 返回 null 表示该元素不改 */
|
|
10
|
+
export declare function buildSketchOps(board: Board, targets: BoardElement[], recipe: (el: BoardElement) => Partial<Pick<SetNodePatch, "sketch" | "fillStyle">> | null): Operation[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
export { sketchShape, hatchGap, type SketchOutline, type SketchShapeInput } from "./shape";
|
|
3
|
+
export { sketchArrow, markerLength, type SketchArrowInput, type SketchArrowOutput } from "./arrow";
|
|
4
|
+
export { resolveSketch, isSketchableType } from "./resolve";
|
|
5
|
+
export { inkSize } from "./levels";
|
|
6
|
+
export { createRandom, hashSeed } from "./random";
|
|
7
|
+
export { flattenPath } from "./geometry";
|
|
8
|
+
export { patchSketch, getSketchTargets, buildSketchOps } from "./batch";
|
|
9
|
+
export { handTextClass } from "./handText";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ElementSketch } from "../../types/sketch";
|
|
2
|
+
type SketchPatch = Partial<Record<keyof ElementSketch, unknown>>;
|
|
3
|
+
/** 合并覆盖:值为 undefined 的字段删除,全部删空则返回 undefined(回到完全跟随页面) */
|
|
4
|
+
export declare function patchSketch(sketch: ElementSketch | undefined, patch: SketchPatch): ElementSketch | undefined;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ElementSketch, PageSketch, ResolvedSketch } from "../../types/sketch";
|
|
2
|
+
/** 该类型是否跟随手绘(与当前画风无关,只看类型) */
|
|
3
|
+
export declare const isSketchableType: (type: string) => boolean;
|
|
4
|
+
interface SketchCarrier {
|
|
5
|
+
id: string;
|
|
6
|
+
type: string;
|
|
7
|
+
sketch?: ElementSketch;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 页面默认画风 + 元素覆盖 → 生效画风。
|
|
11
|
+
* 思维导图整棵树共用根节点的覆盖与笔迹种子,所以传入 owner 为根节点。
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveSketch(page: PageSketch, element: SketchCarrier, owner?: SketchCarrier, supported?: boolean): ResolvedSketch;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface SnapBounds {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
export type SnapAxis = "x" | "y";
|
|
8
|
+
export interface SnapGuide {
|
|
9
|
+
key: string;
|
|
10
|
+
/** align = 边/中心对齐线;gap = 等距测距线 */
|
|
11
|
+
kind: "align" | "gap";
|
|
12
|
+
/** align:x 轴画竖线、y 轴画横线;gap:沿该轴方向画测距线 */
|
|
13
|
+
axis: SnapAxis;
|
|
14
|
+
x1: number;
|
|
15
|
+
y1: number;
|
|
16
|
+
x2: number;
|
|
17
|
+
y2: number;
|
|
18
|
+
}
|
|
19
|
+
/** resize 时参与吸附的边:min = 左/上,max = 右/下 */
|
|
20
|
+
export type SnapEdge = "min" | "max";
|
|
21
|
+
export interface SnapResizeEdges {
|
|
22
|
+
x?: SnapEdge;
|
|
23
|
+
y?: SnapEdge;
|
|
24
|
+
}
|
|
25
|
+
/** 元素是否带有可用于吸附的有限包围盒字段 */
|
|
26
|
+
export declare const hasSnapBounds: <T extends object>(element: T) => element is T & SnapBounds;
|
|
27
|
+
/** 多个包围盒的并集;为空返回 null */
|
|
28
|
+
export declare const unionBounds: (rects: SnapBounds[]) => SnapBounds | null;
|
|
29
|
+
/**
|
|
30
|
+
* 移动吸附:运动包围盒的左/中/右、上/中/下与候选同类点比较,
|
|
31
|
+
* 并与候选间的相邻间距比较(等距),每个轴只取最近的一个偏移。
|
|
32
|
+
*/
|
|
33
|
+
export declare const snapMove: (moving: SnapBounds, candidates: SnapBounds[], threshold: number) => {
|
|
34
|
+
dx: number;
|
|
35
|
+
dy: number;
|
|
36
|
+
guides: SnapGuide[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 缩放吸附:只有正在拖动的边参与(与候选的左/中/右或上/中/下比较),
|
|
40
|
+
* 吸附后若导致尺寸非正则放弃该轴。
|
|
41
|
+
*/
|
|
42
|
+
export declare const snapResize: (bounds: SnapBounds, edges: SnapResizeEdges, candidates: SnapBounds[], threshold: number) => {
|
|
43
|
+
bounds: SnapBounds;
|
|
44
|
+
guides: SnapGuide[];
|
|
45
|
+
};
|
|
46
|
+
/** 网格移动吸附:包围盒左上角取整到网格 */
|
|
47
|
+
export declare const snapMoveToGrid: (moving: SnapBounds, gridSize: number) => {
|
|
48
|
+
dx: number;
|
|
49
|
+
dy: number;
|
|
50
|
+
};
|
|
51
|
+
/** 网格缩放吸附:正在拖动的边取整到网格 */
|
|
52
|
+
export declare const snapResizeToGrid: (bounds: SnapBounds, edges: SnapResizeEdges, gridSize: number) => SnapBounds;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type Board from "../../Board";
|
|
2
|
+
import type { BoardElement } from "../../types/index";
|
|
3
|
+
import { EHandlerPosition } from "../../types/resize";
|
|
4
|
+
import { SnapAxis, SnapBounds, SnapGuide } from "./SnapGeometry";
|
|
5
|
+
/** 吸附阈值(屏幕像素),按 zoom 换算到画布单位 */
|
|
6
|
+
export declare const SNAP_THRESHOLD_PX = 8;
|
|
7
|
+
export interface SnapMoveOptions {
|
|
8
|
+
/** 正在移动的元素,自身及子孙不作为候选 */
|
|
9
|
+
elements: BoardElement[];
|
|
10
|
+
/** 参与吸附的运动包围盒(通常是选区并集) */
|
|
11
|
+
bounds: SnapBounds;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SnapResizeOptions {
|
|
15
|
+
element: BoardElement;
|
|
16
|
+
bounds: SnapBounds;
|
|
17
|
+
position: EHandlerPosition;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/** 等比缩放时只吸附主轴,另一维按比例回算 */
|
|
20
|
+
preserveRatio?: boolean;
|
|
21
|
+
/** 限定可吸附的轴(如固定高度元素只允许 x) */
|
|
22
|
+
axes?: SnapAxis[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 吸附会话:拖拽/缩放开始时惰性拍候选快照,期间每帧计算吸附与参考线,
|
|
26
|
+
* 结束时统一清空。任何指针抬起/取消或窗口失焦都会兜底结束,避免参考线残留。
|
|
27
|
+
*/
|
|
28
|
+
export declare class SnapManager {
|
|
29
|
+
private board;
|
|
30
|
+
private guides;
|
|
31
|
+
private listeners;
|
|
32
|
+
private gridSize;
|
|
33
|
+
private candidateCache;
|
|
34
|
+
private sessionActive;
|
|
35
|
+
private endTimer;
|
|
36
|
+
constructor(board: Board);
|
|
37
|
+
getGuides: () => SnapGuide[];
|
|
38
|
+
subscribe: (listener: () => void) => () => void;
|
|
39
|
+
/** 网格可见时传入网格尺寸,吸附改为对网格取整且不画参考线 */
|
|
40
|
+
setGridSize(gridSize: number | null): void;
|
|
41
|
+
move({ elements, bounds, enabled }: SnapMoveOptions): {
|
|
42
|
+
dx: number;
|
|
43
|
+
dy: number;
|
|
44
|
+
};
|
|
45
|
+
resize({ element, bounds, position, enabled, preserveRatio, axes, }: SnapResizeOptions): SnapBounds;
|
|
46
|
+
/** 结束吸附会话:清空参考线与候选快照 */
|
|
47
|
+
end: () => void;
|
|
48
|
+
dispose(): void;
|
|
49
|
+
private get threshold();
|
|
50
|
+
private beginSession;
|
|
51
|
+
private scheduleEnd;
|
|
52
|
+
private cancelScheduledEnd;
|
|
53
|
+
private setGuides;
|
|
54
|
+
/** 候选 = 视口内参与参考线的元素,排除运动元素及其子孙;视口不变时复用快照 */
|
|
55
|
+
private getCandidates;
|
|
56
|
+
}
|
|
57
|
+
export default SnapManager;
|