@yuzhouu/canvas-kit 0.1.20 → 0.1.21
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/README.md +1 -1
- package/_vendor/canvas-core/editor/editor.d.ts +16 -0
- package/_vendor/canvas-core/editor/records/documentSnapshots.d.ts +4 -1
- package/_vendor/canvas-core/editor/selection/selectionOverlay.d.ts +1 -0
- package/_vendor/canvas-core/editor/state/editorSignals.d.ts +1 -0
- package/_vendor/canvas-core/editor/viewport/camera.d.ts +6 -3
- package/_vendor/canvas-react/host/ShapeHeadingControl.d.ts +1 -2
- package/_vendor/canvas-react/index.d.ts +1 -0
- package/host-C9sTNI4D.mjs +47 -0
- package/index.d.ts +2 -2
- package/index.mjs +6 -6
- package/package.json +1 -1
- package/plugin-runtime.mjs +1 -1
- package/react/canvasActions.d.ts +2 -0
- package/react/canvasKitRootContracts.d.ts +1 -0
- package/react/host/keyboard/useCanvasKeyboardShortcuts.d.ts +2 -1
- package/runtime/canvasKitContracts.d.ts +29 -4
- package/runtime/createCanvasKitEditor.d.ts +2 -0
- package/host-s4jdMA_d.mjs +0 -49
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ function SelectionToolbar() {
|
|
|
67
67
|
|
|
68
68
|
Pass a `chromeRenderer` to `CanvasKitRoot`. The renderer receives the same `CanvasKit` available from `useCanvasKit()`. Product components subscribe only to the capability they render, for example `useCanvasValue(canvas.pages.state)` or `useCanvasValue(canvas.history.state)`.
|
|
69
69
|
|
|
70
|
-
Zen and Professional build separate React trees and CSS from that facade. Feature controls call `canvas.api(token)` directly. Packaging UI therefore remains in Professional, while Connector
|
|
70
|
+
Zen and Professional build separate React trees and CSS from that facade. Feature controls call `canvas.api(token)` directly. Packaging UI therefore remains in Professional, while Zen composes Connector alongside Standard. Arrow, Connector and Packaging remain standalone opt-in plugins.
|
|
71
71
|
|
|
72
72
|
## Plugins and React composition
|
|
73
73
|
|
|
@@ -45,6 +45,8 @@ export interface EditorOptions {
|
|
|
45
45
|
onUnhandledError?: (error: unknown) => void;
|
|
46
46
|
snapDiagnostics?: SnapDiagnostics;
|
|
47
47
|
cameraAnimationScheduler?: CameraAnimationScheduler;
|
|
48
|
+
minZoom?: number;
|
|
49
|
+
maxZoom?: number;
|
|
48
50
|
}
|
|
49
51
|
export interface CenterOnShapeOptions {
|
|
50
52
|
source?: ChangeSource;
|
|
@@ -69,6 +71,7 @@ export declare class Editor {
|
|
|
69
71
|
readonly inputs: InputsManager;
|
|
70
72
|
readonly tools: ToolManager;
|
|
71
73
|
private readonly cameraManager;
|
|
74
|
+
private readonly zoomLimits;
|
|
72
75
|
readonly editing: ShapeEditingManager;
|
|
73
76
|
readonly shapeUtils: ShapeUtilRegistry;
|
|
74
77
|
readonly shapeSvgExporters: ShapeSvgExporterRegistry;
|
|
@@ -97,11 +100,13 @@ export declare class Editor {
|
|
|
97
100
|
private readonly _shapeDefaultPropsByTypeSignal;
|
|
98
101
|
private assetUrlResolver;
|
|
99
102
|
private readonly _readonlySignal;
|
|
103
|
+
private readonly _documentLockedSignal;
|
|
100
104
|
private writesClosed;
|
|
101
105
|
readonly document: {
|
|
102
106
|
readonly getMetadata: () => DocumentMetadataRecord | undefined;
|
|
103
107
|
readonly updateMetadata: (patch: Record<string, unknown>, source?: ChangeSource) => DocumentMetadataRecord;
|
|
104
108
|
readonly setReadonly: (readonly: boolean) => void;
|
|
109
|
+
readonly setLocked: (isLocked: boolean) => void;
|
|
105
110
|
};
|
|
106
111
|
readonly session: {
|
|
107
112
|
readonly get: () => SessionRecord;
|
|
@@ -286,6 +291,7 @@ export declare class Editor {
|
|
|
286
291
|
readonly resolveTerminal: (input: TerminalBindingResolverInput) => ResolvedTerminalBinding;
|
|
287
292
|
};
|
|
288
293
|
readonly viewport: {
|
|
294
|
+
readonly clampZoom: (zoom: number) => number;
|
|
289
295
|
readonly getCamera: (pageId?: PageId) => Camera;
|
|
290
296
|
readonly pageToScreen: (point: Vec, pageId?: PageId) => Vec;
|
|
291
297
|
readonly screenToPage: (point: Vec, pageId?: PageId) => Vec;
|
|
@@ -305,6 +311,15 @@ export declare class Editor {
|
|
|
305
311
|
}) => void;
|
|
306
312
|
readonly stopCameraAnimation: () => void;
|
|
307
313
|
readonly getCurrentPageBounds: (pageId?: PageId) => Box | null;
|
|
314
|
+
readonly centerOnPoint: (point: {
|
|
315
|
+
x: number;
|
|
316
|
+
y: number;
|
|
317
|
+
}, options?: {
|
|
318
|
+
source?: ChangeSource;
|
|
319
|
+
animation?: {
|
|
320
|
+
durationMs: number;
|
|
321
|
+
};
|
|
322
|
+
}) => boolean;
|
|
308
323
|
readonly centerOnShape: (shapeId: ShapeId, options?: CenterOnShapeOptions) => boolean;
|
|
309
324
|
readonly zoomToBounds: (bounds: Box, options?: {
|
|
310
325
|
padding?: number;
|
|
@@ -352,6 +367,7 @@ export declare class Editor {
|
|
|
352
367
|
};
|
|
353
368
|
constructor(options?: EditorOptions);
|
|
354
369
|
closeWrites(): void;
|
|
370
|
+
private setDocumentReadonlyFlag;
|
|
355
371
|
assertDocumentWriteAllowed(): void;
|
|
356
372
|
private assertStoreChangeAllowed;
|
|
357
373
|
private registerBuiltInInteractions;
|
|
@@ -2,7 +2,10 @@ import { type ChangeSource } from "../../../store/index";
|
|
|
2
2
|
import { type EditorRecord } from "../../schema/records";
|
|
3
3
|
import { type DocumentSnapshot, type SessionSnapshot } from "../../schema/snapshots";
|
|
4
4
|
import type { Editor } from "../editor";
|
|
5
|
-
export declare function createInitialEditorRecords(documentMeta
|
|
5
|
+
export declare function createInitialEditorRecords({ documentMeta, initialZoom, }: {
|
|
6
|
+
documentMeta?: Record<string, unknown>;
|
|
7
|
+
initialZoom: number;
|
|
8
|
+
}): EditorRecord[];
|
|
6
9
|
export declare function getEditorDocumentSnapshot(editor: Editor): DocumentSnapshot;
|
|
7
10
|
export declare function getEditorSessionSnapshot(editor: Editor): SessionSnapshot;
|
|
8
11
|
export declare function loadEditorDocumentSnapshot(editor: Editor, snapshot: unknown, options?: {
|
|
@@ -4,6 +4,7 @@ import type { ShapeSelectionHandleAnchors, ShapeSelectionPathStyle } from "../..
|
|
|
4
4
|
import type { SelectionBindingMiddleHandle, SelectionBindingSegment, SelectionBindingTerminalHandle, SelectionCustomHandle, SelectionFrame, SelectionOverlayHandleAnchorsState, SelectionResizeHandle, SelectionResizeHandleId, SelectionRotateHandle } from "./selection";
|
|
5
5
|
export interface SelectedShapeOverlayItem {
|
|
6
6
|
id: ShapeId;
|
|
7
|
+
frameCorners: Vec[];
|
|
7
8
|
usesSelectionPathOverlay: boolean;
|
|
8
9
|
startPagePoint: Vec | null;
|
|
9
10
|
endPagePoint: Vec | null;
|
|
@@ -11,6 +11,7 @@ import type { RenderItem } from "../viewport/renderWindow";
|
|
|
11
11
|
import type { EditorSelectionMetadata, EditorSelectionState, EditorShapeEditingState, EditorToolState, ShapeTreeSnapshotEntry } from "./editorReadModels";
|
|
12
12
|
export interface EditorStateSignals {
|
|
13
13
|
readonly readonly: Signal<boolean>;
|
|
14
|
+
readonly documentLocked: Signal<boolean>;
|
|
14
15
|
readonly session: Signal<SessionRecord>;
|
|
15
16
|
readonly pages: Signal<PageRecord[]>;
|
|
16
17
|
readonly currentPageId: Signal<PageId>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface CameraZoomLimits {
|
|
2
|
+
readonly minZoom: number;
|
|
3
|
+
readonly maxZoom: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function resolveCameraZoomLimits({ minZoom, maxZoom, }: Partial<CameraZoomLimits>): CameraZoomLimits;
|
|
6
|
+
export declare function clampCameraZoom(zoom: number, limits: CameraZoomLimits): number;
|
|
@@ -25,11 +25,10 @@ export interface ShapeHeadingControlProps<S extends ShapeRecordBase = ShapeRecor
|
|
|
25
25
|
readonly color?: string;
|
|
26
26
|
readonly offsetX?: number;
|
|
27
27
|
readonly editable?: boolean;
|
|
28
|
-
readonly showBackground?: boolean;
|
|
29
28
|
readonly showDragHandle?: boolean;
|
|
30
29
|
}
|
|
31
30
|
export declare function createShapeHeadingDomEventGuard({ id, selector, }: {
|
|
32
31
|
id: string;
|
|
33
32
|
selector: string;
|
|
34
33
|
}): CanvasDomEventGuard;
|
|
35
|
-
export declare function ShapeHeadingControl<S extends ShapeRecordBase>({ editor, shape, isEditing, value, fallback, bodyWidth, bodyHeight, renderHeight, operationKind, editAriaLabel, inputAriaLabel, dataUi, onValueChange, leading, color, offsetX, editable,
|
|
34
|
+
export declare function ShapeHeadingControl<S extends ShapeRecordBase>({ editor, shape, isEditing, value, fallback, bodyWidth, bodyHeight, renderHeight, operationKind, editAriaLabel, inputAriaLabel, dataUi, onValueChange, leading, color, offsetX, editable, showDragHandle, }: ShapeHeadingControlProps<S>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,3 +3,4 @@ export type { CanvasContextMenuRequest, CanvasContextMenuTarget, } from "./conte
|
|
|
3
3
|
export { CANVAS_SURFACE_DATA_UI, CANVAS_SURFACE_SELECTOR, forwardWheelEventToCanvasSurface, getCanvasSurfaceElement, getCanvasSurfaceElementForNode, getCanvasSurfacePagePoint, getCanvasSurfaceScreenPoint, getEditableEventTarget, isEditableEventTarget, } from "./dom";
|
|
4
4
|
export { useEditor, EditorContext } from "./hooks/useEditor";
|
|
5
5
|
export { useValue } from "./hooks/useValue";
|
|
6
|
+
export { BindingSegmentsOverlay } from "./components/overlays/SelectionPathOverlay";
|