@yuzhouu/canvas-kit 0.1.4 → 0.1.6
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/_vendor/canvas-core/editor/editor.d.ts +8 -1
- package/_vendor/canvas-core/editor/managers/interactionTransientManager.d.ts +7 -1
- package/_vendor/canvas-core/editor/managers/shapeHierarchyManager.d.ts +3 -0
- package/_vendor/canvas-core/editor/managers/spatialIndexManager.d.ts +1 -0
- package/_vendor/canvas-core/editor/selection.d.ts +4 -0
- package/_vendor/canvas-core/editor/selectionBindingSegments.d.ts +7 -0
- package/_vendor/canvas-core/editor/selectionOverlay.d.ts +0 -1
- package/_vendor/canvas-core/index.d.ts +2 -2
- package/_vendor/canvas-core/reactivity.d.ts +3 -1
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +7 -2
- package/_vendor/canvas-react/components/ShapeLayer.d.ts +1 -4
- package/_vendor/canvas-react/components/overlays/BindingGuide.d.ts +1 -1
- package/_vendor/canvas-react/components/overlays/SelectionPathOverlay.d.ts +7 -0
- package/_vendor/canvas-react/components/overlays/TerminalBindingGuidesOverlay.d.ts +1 -0
- package/_vendor/canvas-react/components/useCanvasDomEvents.d.ts +1 -2
- package/_vendor/plugin-arrow/arrowBindingTargets.d.ts +3 -0
- package/_vendor/plugin-arrow/arrowBindingUtil.d.ts +1 -1
- package/_vendor/plugin-draw/drawShapeUtil.d.ts +1 -0
- package/_vendor/plugin-frame/frameShapeUtil.d.ts +2 -0
- package/_vendor/plugin-geo/geoShapeUtil.d.ts +1 -0
- package/_vendor/plugin-geo/geoTools.d.ts +1 -0
- package/_vendor/plugin-group/groupShapeUtil.d.ts +2 -1
- package/_vendor/plugin-image/imageShapeUtil.d.ts +1 -0
- package/_vendor/plugin-text/canvas.d.ts +4 -1
- package/_vendor/plugin-text/editor.d.ts +4 -1
- package/_vendor/plugin-text/feature.d.ts +3 -2
- package/_vendor/plugin-text/host/RichTextEditingBox.d.ts +3 -1
- package/_vendor/plugin-text/host/TiptapTextEditor.d.ts +3 -1
- package/_vendor/plugin-text/host/textEditingBoxStyle.d.ts +2 -1
- package/_vendor/plugin-text/host/textFontLoader.d.ts +2 -1
- package/_vendor/plugin-text/host/textMeasurement.d.ts +4 -3
- package/_vendor/plugin-text/host/textMeasurementSync.d.ts +2 -1
- package/_vendor/plugin-text/host/textShapeRendererRuntime.d.ts +2 -1
- package/_vendor/plugin-text/host/textShapeSync.d.ts +3 -1
- package/_vendor/plugin-text/host/tiptapTextEditorController.d.ts +3 -1
- package/_vendor/plugin-text/index.d.ts +2 -0
- package/_vendor/plugin-text/textFonts.d.ts +46 -0
- package/_vendor/plugin-text/textShapeSvgExporter.d.ts +3 -0
- package/_vendor/plugin-text/textShapeUtil.d.ts +1 -0
- package/_vendor/plugin-text/textStyle.d.ts +11 -2
- package/_vendor/plugin-text/textTypes.d.ts +2 -2
- package/builtins/controller/shapeCreationController.d.ts +2 -0
- package/builtins/extensions.d.ts +5 -2
- package/chrome/bindings/useCanvasKitLayerTree.d.ts +5 -0
- package/chrome/types.d.ts +5 -1
- package/chrome/useCanvasKitChromeContext.d.ts +1 -1
- package/controller/canvasKitController.d.ts +1 -1
- package/core/controller/canvasProductController.d.ts +10 -1
- package/core/controller/index.d.ts +1 -1
- package/core/index.d.ts +1 -0
- package/index.d.ts +5 -1
- package/index.mjs +74 -66
- package/package.json +1 -1
- package/product/canvasKitProduct.d.ts +2 -11
package/builtins/extensions.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { LandExtensionOptionsInput } from "../_vendor/canvas-react/host/index";
|
|
2
|
+
import { type TextExtensionOptions } from "../_vendor/plugin-text/index";
|
|
1
3
|
export interface BuiltInCanvasExtensionOptions {
|
|
2
4
|
arrow?: boolean;
|
|
3
5
|
draw?: boolean;
|
|
@@ -7,9 +9,10 @@ export interface BuiltInCanvasExtensionOptions {
|
|
|
7
9
|
group?: boolean;
|
|
8
10
|
image?: boolean;
|
|
9
11
|
laser?: boolean;
|
|
10
|
-
|
|
12
|
+
path?: boolean;
|
|
13
|
+
text?: boolean | LandExtensionOptionsInput<TextExtensionOptions>;
|
|
11
14
|
}
|
|
12
|
-
export declare const builtInCanvasExtensions: readonly [import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>];
|
|
15
|
+
export declare const builtInCanvasExtensions: readonly [import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<TextExtensionOptions>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>, import("../_vendor/canvas-react/host/index").ConfigurableLandExtension<Record<string, never>>];
|
|
13
16
|
export type BuiltInCanvasExtension = (typeof builtInCanvasExtensions)[number];
|
|
14
17
|
export declare function createBuiltInCanvasExtensions(options?: BuiltInCanvasExtensionOptions): readonly BuiltInCanvasExtension[];
|
|
15
18
|
export declare function hasBuiltInCanvasExtension(extensions: readonly BuiltInCanvasExtension[], name: keyof BuiltInCanvasExtensionOptions): boolean;
|
package/chrome/types.d.ts
CHANGED
|
@@ -37,13 +37,17 @@ export interface CanvasKitPersistenceControls {
|
|
|
37
37
|
isDiscardingUnsupportedRecords: boolean;
|
|
38
38
|
status: ProductPersistenceStatus | null;
|
|
39
39
|
}
|
|
40
|
+
export interface CanvasKitLayerTreeSource {
|
|
41
|
+
getSnapshot(pageId?: string): readonly BuiltInCanvasLayerNode[];
|
|
42
|
+
subscribe(onStoreChange: () => void): () => void;
|
|
43
|
+
}
|
|
40
44
|
export interface CanvasKitChromeContext<TController extends CanvasKitBaseController = CanvasKitController> {
|
|
41
45
|
controller: TController;
|
|
42
46
|
contextMenu: CanvasKitContextMenuState;
|
|
43
47
|
currentPageId: string;
|
|
44
48
|
currentPageShapeIds: readonly ShapeId[];
|
|
45
49
|
history: HistoryControls;
|
|
46
|
-
|
|
50
|
+
layerTree: CanvasKitLayerTreeSource;
|
|
47
51
|
pages: PageControls;
|
|
48
52
|
selection: EditorSelectionState;
|
|
49
53
|
selectedShapeIds: readonly ShapeId[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type ActiveContextMenu } from "../_vendor/canvas-core/index";
|
|
3
3
|
import type { CanvasKitBaseController } from "../controller/canvasKitController";
|
|
4
4
|
import type { CanvasKitRuntime } from "../runtime/canvasKitRuntime";
|
|
5
5
|
import type { CanvasKitHostExtension } from "../runtime/canvasKitHostExtensions";
|
|
@@ -7,7 +7,7 @@ export type CanvasKitTextInput = BuiltInCanvasTextInput;
|
|
|
7
7
|
export type CanvasKitFrameInput = BuiltInCanvasFrameInput;
|
|
8
8
|
export interface CanvasKitBaseController<TToolId extends string = string> extends CanvasProductController<TToolId> {
|
|
9
9
|
}
|
|
10
|
-
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "diamond", "triangle", "hexagon", "star", "arrow", "draw", "text", "frame", "eraser", "laser"];
|
|
10
|
+
export declare const CANVAS_KIT_TOOL_IDS: readonly ["select", "hand", "rectangle", "ellipse", "diamond", "triangle", "hexagon", "star", "arrow", "draw", "path", "text", "frame", "eraser", "laser"];
|
|
11
11
|
export type CanvasKitToolId = (typeof CANVAS_KIT_TOOL_IDS)[number];
|
|
12
12
|
export interface CanvasKitControllerSnapshot<TToolId extends string = CanvasKitToolId> extends BuiltInCanvasControllerSnapshot<TToolId> {
|
|
13
13
|
productId: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Camera, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
1
|
+
import type { Camera, ChangeSource, Editor, LayerOrderDirection, LayerOrderEdge, ReparentShapePlacementFailureReason, ShapeId } from "../../_vendor/canvas-core/index";
|
|
2
2
|
import type { ProductServiceRegistry } from "../runtime/productServices";
|
|
3
3
|
import type { ProductFeatureControllerRegistry } from "./featureControllerRegistry";
|
|
4
4
|
export interface CanvasProductShapeRef {
|
|
@@ -28,6 +28,14 @@ export interface CanvasProductControllerSnapshot<TToolId extends string = string
|
|
|
28
28
|
shapeCount: number;
|
|
29
29
|
session: CanvasProductSessionSnapshot<TToolId>;
|
|
30
30
|
}
|
|
31
|
+
export type CanvasProductControllerChangeKey = "document" | "session" | "pageId" | "activeToolId" | "selectedShapeIds" | "shapeCount";
|
|
32
|
+
export interface CanvasProductControllerChange<TToolId extends string = string> {
|
|
33
|
+
source: ChangeSource;
|
|
34
|
+
changes: readonly CanvasProductControllerChangeKey[];
|
|
35
|
+
snapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
36
|
+
previousSnapshot: CanvasProductControllerSnapshot<TToolId>;
|
|
37
|
+
}
|
|
38
|
+
export type CanvasProductControllerChangeListener<TToolId extends string = string> = (change: CanvasProductControllerChange<TToolId>) => void;
|
|
31
39
|
export interface CanvasProductLayerNode {
|
|
32
40
|
id: ShapeId;
|
|
33
41
|
parentId: string;
|
|
@@ -69,6 +77,7 @@ export interface CanvasProductPageRef {
|
|
|
69
77
|
export interface CanvasProductController<TToolId extends string = string> {
|
|
70
78
|
features: ProductFeatureControllerRegistry;
|
|
71
79
|
snapshot(): CanvasProductControllerSnapshot<TToolId>;
|
|
80
|
+
subscribe(listener: CanvasProductControllerChangeListener<TToolId>): () => void;
|
|
72
81
|
clearHistory(): void;
|
|
73
82
|
canUndo(): boolean;
|
|
74
83
|
canRedo(): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createProductFeatureControllerRegistry, createProductFeatureControllerToken, } from "./featureControllerRegistry";
|
|
2
2
|
export type { ProductFeatureControllerRegistry, ProductFeatureControllerRegistryRuntime, ProductFeatureControllerToken, } from "./featureControllerRegistry";
|
|
3
3
|
export { createCanvasProductController } from "./canvasProductController";
|
|
4
|
-
export type { CanvasProductController, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeRef, } from "./canvasProductController";
|
|
4
|
+
export type { CanvasProductController, CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, CanvasProductControllerContext, CanvasProductControllerOptions, CanvasProductControllerSnapshot, CanvasProductLayerActionState, CanvasProductLayerNode, CanvasProductLayerPlacement, CanvasProductLayerPlacementFailureReason, CanvasProductLayerPlacementResult, CanvasProductPageRef, CanvasProductSessionPageState, CanvasProductSessionSnapshot, CanvasProductShapeRef, } from "./canvasProductController";
|
package/core/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { CanvasProductRuntimeContribution, } from "./runtime/productContrib
|
|
|
8
8
|
export type { ProductContextMenuRegistry, ProductPluginHostRuntime, ProductToolbarRegistry, } from "./runtime/productHost";
|
|
9
9
|
export type { ProductAssetResolverService, ProductServiceFactory, ProductServiceFactoryContext, ProductServiceRegistry, ProductServiceRegistryRuntime, ProductServiceToken, } from "./runtime/productServices";
|
|
10
10
|
export type { ProductFeatureControllerRegistry, ProductFeatureControllerRegistryRuntime, ProductFeatureControllerToken, } from "./controller/featureControllerRegistry";
|
|
11
|
+
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, } from "./controller";
|
|
11
12
|
export { SYSTEM_SELECTION_BRING_FORWARD_ACTION_ID, SYSTEM_SELECTION_BRING_TO_FRONT_ACTION_ID, SYSTEM_SELECTION_DELETE_ACTION_ID, SYSTEM_SELECTION_DUPLICATE_ACTION_ID, SYSTEM_SELECTION_FLIP_HORIZONTAL_ACTION_ID, SYSTEM_SELECTION_FLIP_VERTICAL_ACTION_ID, SYSTEM_SELECTION_GROUP_ACTION_ID, SYSTEM_SELECTION_RESET_ROTATION_ACTION_ID, SYSTEM_SELECTION_SELECT_ALL_ACTION_ID, SYSTEM_SELECTION_SEND_BACKWARD_ACTION_ID, SYSTEM_SELECTION_SEND_TO_BACK_ACTION_ID, SYSTEM_SELECTION_UNGROUP_ACTION_ID, runCanvasAction, } from "./features/actions/canvasActions";
|
|
12
13
|
export { createToolbarProductContribution } from "./features/toolbar/toolbarContribution";
|
|
13
14
|
export { createCanvasActionContext } from "./features/actions/canvasActionContext";
|
package/index.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
export { createCustomShapeColor, createThemeShapeColor, getThemeColorTokenName, isCustomShapeColorRef, isThemeShapeColorRef, resolveShapeColor, shapeColorToCssColor, } from "./_vendor/canvas-core/index";
|
|
2
|
+
export { DEFAULT_TEXT_FONT, HOST_TEXT_FONT, createDefaultTextFontCatalog, createDefaultTextExtensionOptions, } from "./_vendor/plugin-text/index";
|
|
3
|
+
export type { TextExtensionOptions, TextFontDefinition, TextFontFaceSource, TextFontSource, TextStylesheetFontSource, TextSystemFontSource, } from "./_vendor/plugin-text/index";
|
|
2
4
|
export type { CustomShapeColorRef, ShapeColor, ShapeColorRef, ThemeColorSlot, ThemeColorTokenName, ThemeShapeColorRef, } from "./_vendor/canvas-core/index";
|
|
3
5
|
export { CanvasKitFloatingToolbarLayer, } from "./chrome/CanvasKitFloatingToolbarLayer";
|
|
4
6
|
export { FloatingSelectionToolbarPageSpace, } from "./chrome/FloatingSelectionToolbarPageSpace";
|
|
7
|
+
export { useCanvasKitLayerTree, } from "./chrome/bindings/useCanvasKitLayerTree";
|
|
5
8
|
import "./index.css";
|
|
6
9
|
export { createCanvasKitController, createCanvasKitControllerWithTools, } from "./controller/canvasKitController";
|
|
7
10
|
export { CanvasKitRoot } from "./react/CanvasKitRoot";
|
|
8
11
|
export { defineCanvasKit } from "./product/canvasKitProduct";
|
|
9
12
|
export { CANVAS_KIT_TOOL_IDS } from "./controller/canvasKitController";
|
|
10
13
|
export type { CanvasKitController, CanvasKitControllerRuntimeContext, CanvasKitControllerOptions, CanvasKitControllerSnapshot, CanvasKitControllerWithToolsOptions, CanvasKitBaseController, CanvasKitControllerWithTools, CanvasKitFrameInput, CanvasKitShapeInput, CanvasKitTextInput, CanvasKitToolId, } from "./controller/canvasKitController";
|
|
11
|
-
export type {
|
|
14
|
+
export type { CanvasProductControllerChange, CanvasProductControllerChangeKey, CanvasProductControllerChangeListener, } from "./core";
|
|
15
|
+
export type { CanvasKitChromeContext, CanvasKitContextMenuState, CanvasKitGridControls, CanvasKitLayerNode, CanvasKitLayerTreeSource, CanvasKitPersistenceControls, CanvasKitToolbarActionState, CanvasKitToolbarRuntime, ContextMenuCommandItem, ContextMenuItem, ContextMenuSection, EditorSelectionState, HistoryControls, PageControls, ShapeId, SvgExportControls, CanvasActionValue, CanvasActionContext, ToolbarGroup, ToolbarItem, ToolbarSurfaces, ZoomControlsState, } from "./chrome/types";
|
|
12
16
|
export type { CanvasKitDocumentSeed, CanvasKitExtensionOptions, CanvasKitProduct, CanvasKitProductOptions, CanvasKitChromeRenderer, } from "./product/canvasKitProduct";
|
|
13
17
|
export type { ExportStatus, ProductPersistenceStatus, } from "./core";
|