@yuzhouu/canvas-kit 0.1.17 → 0.1.18
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/bindings/bindingManager.d.ts +1 -0
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +17 -10
- package/_vendor/canvas-core/editor/clipboard.d.ts +1 -1
- package/_vendor/canvas-core/editor/commands/bindingCommands.d.ts +3 -1
- package/_vendor/canvas-core/editor/commands/commandTypes.d.ts +21 -7
- package/_vendor/canvas-core/editor/editor.d.ts +4 -4
- package/_vendor/canvas-core/editor/queries/bindingQueryCache.d.ts +8 -8
- package/_vendor/canvas-core/editor/queries/bindingQueryState.d.ts +2 -2
- package/_vendor/canvas-core/editor/queries/draftBindingIndex.d.ts +1 -1
- package/_vendor/canvas-core/index.d.ts +1 -1
- package/_vendor/canvas-core/schema/records.d.ts +10 -5
- package/_vendor/canvas-core/schema/snapshots.d.ts +2 -2
- package/_vendor/canvas-extension-contracts/plugin.d.ts +3 -1
- package/host-Djw688Kd.mjs +49 -0
- package/index.mjs +1 -1
- package/package.json +1 -1
- package/plugin-runtime.mjs +1 -1
- package/host-DYfq8ME2.mjs +0 -49
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Editor } from "../editor/editor";
|
|
2
2
|
import type { SelectionOverlayFrameGeometryState } from "../editor/selection/selection";
|
|
3
3
|
import type { Vec } from "../geometry/vec";
|
|
4
|
-
import type { BindingId, BindingRecord, BindingRecordBase, ShapeRecord } from "../schema/records";
|
|
4
|
+
import type { BindingId, BindingEndpointBase, BindingRecord, BindingRecordBase, ShapeRecord } from "../schema/records";
|
|
5
5
|
export interface BindingUtilEffect {
|
|
6
6
|
shapes?: ShapeRecord[];
|
|
7
7
|
bindings?: BindingRecord[];
|
|
@@ -13,32 +13,39 @@ export interface BindingUtilEffect {
|
|
|
13
13
|
export interface BindingShapeChangeContext {
|
|
14
14
|
before: ShapeRecord;
|
|
15
15
|
after: ShapeRecord;
|
|
16
|
-
|
|
16
|
+
owner: boolean;
|
|
17
|
+
endpointSlots: readonly string[];
|
|
17
18
|
reason: "self" | "ancestry";
|
|
18
19
|
}
|
|
19
20
|
export interface BindingShapeDeleteContext {
|
|
20
21
|
shape: ShapeRecord;
|
|
21
|
-
|
|
22
|
+
owner: boolean;
|
|
23
|
+
endpointSlots: readonly string[];
|
|
22
24
|
}
|
|
23
25
|
export interface BindingEndpointContext {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
ownerShape: ShapeRecord;
|
|
27
|
+
endpoints: readonly {
|
|
28
|
+
endpoint: BindingEndpointBase;
|
|
29
|
+
targetShape: ShapeRecord;
|
|
30
|
+
}[];
|
|
26
31
|
}
|
|
27
32
|
export interface BindingSelectionCompanionFrameContext {
|
|
28
33
|
selectedShape: ShapeRecord;
|
|
29
34
|
}
|
|
30
35
|
export interface BindingShapeGeometryDependencyContext {
|
|
31
36
|
shape: ShapeRecord;
|
|
32
|
-
|
|
37
|
+
owner: boolean;
|
|
38
|
+
endpointSlots: readonly string[];
|
|
33
39
|
}
|
|
34
40
|
export interface BindingTargetShapeContentCutoutContext {
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
ownerShape: ShapeRecord;
|
|
42
|
+
endpoint: BindingEndpointBase;
|
|
43
|
+
targetShape: ShapeRecord;
|
|
37
44
|
}
|
|
38
45
|
export declare abstract class BindingUtil<B extends BindingRecordBase = BindingRecordBase> {
|
|
39
46
|
abstract readonly type: B["type"];
|
|
40
|
-
abstract
|
|
41
|
-
abstract
|
|
47
|
+
abstract getDefaultEndpointProps(slot: B["endpoints"][number]["slot"]): B["endpoints"][number]["props"];
|
|
48
|
+
abstract validateEndpointProps(slot: B["endpoints"][number]["slot"], props: unknown): B["endpoints"][number]["props"];
|
|
42
49
|
canBind?(editor: Editor, binding: B, context: BindingEndpointContext): boolean;
|
|
43
50
|
getExclusiveBindingKey?(binding: B): string | null;
|
|
44
51
|
onBindingCreate?(editor: Editor, binding: B): BindingUtilEffect | void;
|
|
@@ -4,7 +4,7 @@ import type { AssetId, AssetRecord, BindingRecord, ShapeId, ShapeRecord } from "
|
|
|
4
4
|
import type { Editor } from "./editor";
|
|
5
5
|
export interface EditorClipboardPayload {
|
|
6
6
|
type: "land/clipboard";
|
|
7
|
-
version:
|
|
7
|
+
version: 3;
|
|
8
8
|
source: {
|
|
9
9
|
app: "land";
|
|
10
10
|
documentId?: string;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ChangeSource } from "../../../store/index";
|
|
2
2
|
import type { BindingId, BindingRecord, ShapeId } from "../../schema/records";
|
|
3
|
-
import type { CreateBindingInput, EditorCommandOptions, UpdateBindingInput } from "./commandTypes";
|
|
3
|
+
import type { ClearBindingEndpointInput, CreateBindingInput, EditorCommandOptions, SetBindingEndpointInput, UpdateBindingInput } from "./commandTypes";
|
|
4
4
|
import type { Editor } from "../editor";
|
|
5
5
|
type RepairMinimumChildContainers = (containerIds: Iterable<ShapeId>, deletedIds: Set<ShapeId>, source: ChangeSource) => void;
|
|
6
6
|
interface BindingCommandSet {
|
|
7
7
|
createBinding(input: CreateBindingInput, options?: EditorCommandOptions): BindingRecord;
|
|
8
8
|
updateBinding(input: UpdateBindingInput, options?: EditorCommandOptions): BindingRecord | null;
|
|
9
|
+
setBindingEndpoint(input: SetBindingEndpointInput, options?: EditorCommandOptions): BindingRecord | null;
|
|
10
|
+
clearBindingEndpoint(input: ClearBindingEndpointInput, options?: EditorCommandOptions): BindingRecord | null;
|
|
9
11
|
deleteBinding(id: BindingId, options?: EditorCommandOptions): boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare function createBindingCommandSet(editor: Editor, repairMinimumChildContainers: RepairMinimumChildContainers): BindingCommandSet;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChangeSource } from "../../../store/index";
|
|
2
|
-
import type { AssetId, AssetRecord, AssetRecordBase, BindingId, BindingRecord, BindingRecordBase, Camera, DocumentMetadataRecord, PageId, PageRecord, ShapeEditingEntryMode, ShapeId, ShapeParentId, ShapeRecord, ShapeRecordBase } from "../../schema/records";
|
|
2
|
+
import type { AssetId, AssetRecord, AssetRecordBase, BindingId, BindingEndpointBase, BindingRecord, BindingRecordBase, Camera, DocumentMetadataRecord, PageId, PageRecord, ShapeEditingEntryMode, ShapeId, ShapeParentId, ShapeRecord, ShapeRecordBase } from "../../schema/records";
|
|
3
3
|
export interface EditorCommandOptions {
|
|
4
4
|
source?: ChangeSource;
|
|
5
5
|
}
|
|
@@ -72,21 +72,33 @@ export interface StartEditingShapeInput {
|
|
|
72
72
|
reuseActiveOperation?: boolean;
|
|
73
73
|
preserveInteraction?: boolean;
|
|
74
74
|
}
|
|
75
|
+
export interface CreateBindingEndpointInput {
|
|
76
|
+
slot: BindingEndpointBase["slot"];
|
|
77
|
+
targetId: ShapeId;
|
|
78
|
+
props?: Record<string, unknown>;
|
|
79
|
+
meta?: Record<string, unknown>;
|
|
80
|
+
}
|
|
75
81
|
export interface CreateBindingInput {
|
|
76
82
|
id?: BindingId;
|
|
77
83
|
type: BindingRecordBase["type"];
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
props?: Record<string, unknown>;
|
|
84
|
+
ownerId: ShapeId;
|
|
85
|
+
endpoints: readonly CreateBindingEndpointInput[];
|
|
81
86
|
meta?: Record<string, unknown>;
|
|
82
87
|
}
|
|
83
88
|
export interface UpdateBindingInput {
|
|
84
89
|
id: BindingId;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
props?: Record<string, unknown>;
|
|
90
|
+
ownerId?: ShapeId;
|
|
91
|
+
endpoints?: readonly CreateBindingEndpointInput[];
|
|
88
92
|
meta?: Record<string, unknown>;
|
|
89
93
|
}
|
|
94
|
+
export interface SetBindingEndpointInput {
|
|
95
|
+
bindingId: BindingId;
|
|
96
|
+
endpoint: CreateBindingEndpointInput;
|
|
97
|
+
}
|
|
98
|
+
export interface ClearBindingEndpointInput {
|
|
99
|
+
bindingId: BindingId;
|
|
100
|
+
slot: string;
|
|
101
|
+
}
|
|
90
102
|
export interface CreatePageInput {
|
|
91
103
|
name?: string;
|
|
92
104
|
index?: string;
|
|
@@ -142,6 +154,8 @@ export interface EditorCommands {
|
|
|
142
154
|
deleteAsset(id: AssetId, options?: EditorCommandOptions): boolean;
|
|
143
155
|
createBinding(input: CreateBindingInput, options?: EditorCommandOptions): BindingRecord;
|
|
144
156
|
updateBinding(input: UpdateBindingInput, options?: EditorCommandOptions): BindingRecord | null;
|
|
157
|
+
setBindingEndpoint(input: SetBindingEndpointInput, options?: EditorCommandOptions): BindingRecord | null;
|
|
158
|
+
clearBindingEndpoint(input: ClearBindingEndpointInput, options?: EditorCommandOptions): BindingRecord | null;
|
|
145
159
|
deleteBinding(id: BindingId, options?: EditorCommandOptions): boolean;
|
|
146
160
|
setCurrentPageId(id: PageId, options?: EditorCommandOptions): void;
|
|
147
161
|
setCamera(input: SetCameraInput, options?: EditorCommandOptions): void;
|
|
@@ -262,10 +262,10 @@ export declare class Editor {
|
|
|
262
262
|
};
|
|
263
263
|
readonly bindings: {
|
|
264
264
|
readonly get: (id: BindingId) => BindingRecord | undefined;
|
|
265
|
-
readonly
|
|
266
|
-
readonly
|
|
267
|
-
readonly
|
|
268
|
-
readonly
|
|
265
|
+
readonly getOwnedByShape: (shapeId: ShapeId) => BindingRecord[];
|
|
266
|
+
readonly getOwnedByShapeSignal: (shapeId: ShapeId) => Signal<readonly BindingRecord[]>;
|
|
267
|
+
readonly getTargetingShape: (shapeId: ShapeId) => BindingRecord[];
|
|
268
|
+
readonly getTargetingShapeSignal: (shapeId: ShapeId) => Signal<readonly BindingRecord[]>;
|
|
269
269
|
readonly getForShape: (shapeId: ShapeId) => BindingRecord[];
|
|
270
270
|
readonly getForShapeSignal: (shapeId: ShapeId) => Signal<readonly BindingRecord[]>;
|
|
271
271
|
readonly getUtil: <B extends BindingRecord>(binding: B) => BindingUtil<B>;
|
|
@@ -4,23 +4,23 @@ import type { Editor } from "../editor";
|
|
|
4
4
|
export declare class BindingQueryCache {
|
|
5
5
|
private readonly editor;
|
|
6
6
|
private state;
|
|
7
|
-
private readonly
|
|
8
|
-
private readonly
|
|
7
|
+
private readonly bindingsOwnedByShapeSignals;
|
|
8
|
+
private readonly bindingsTargetingShapeSignals;
|
|
9
9
|
private readonly bindingsForShapeSignals;
|
|
10
10
|
private draftBindingIndex;
|
|
11
11
|
private readonly unsubscribeFromStore;
|
|
12
12
|
constructor(editor: Editor);
|
|
13
13
|
dispose(): void;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
getBindingsOwnedByShape(shapeId: ShapeId): BindingRecord[];
|
|
15
|
+
getBindingsOwnedByShapeSignal(shapeId: ShapeId): Signal<readonly BindingRecord[]>;
|
|
16
|
+
getBindingsTargetingShape(shapeId: ShapeId): BindingRecord[];
|
|
17
|
+
getBindingsTargetingShapeSignal(shapeId: ShapeId): Signal<readonly BindingRecord[]>;
|
|
18
18
|
getBindingsForShape(shapeId: ShapeId): BindingRecord[];
|
|
19
19
|
getBindingsForShapeSignal(shapeId: ShapeId): Signal<readonly BindingRecord[]>;
|
|
20
20
|
private handleStoreChange;
|
|
21
21
|
private updateCachedSignals;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
22
|
+
private getBindingsOwnedByState;
|
|
23
|
+
private getBindingsTargetingState;
|
|
24
24
|
private getBindingsForState;
|
|
25
25
|
private getBindingsForIds;
|
|
26
26
|
private getDraftBindingIndex;
|
|
@@ -2,8 +2,8 @@ import type { StoreChange } from "../../../store/index";
|
|
|
2
2
|
import { type BindingId, type BindingRecord, type EditorRecord, type ShapeId } from "../../schema/records";
|
|
3
3
|
export interface BindingQueryState {
|
|
4
4
|
bindingById: Map<BindingId, BindingRecord>;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
bindingIdsByOwnerShape: Map<ShapeId, BindingId[]>;
|
|
6
|
+
bindingIdsByTargetShape: Map<ShapeId, BindingId[]>;
|
|
7
7
|
relatedBindingIdsByShape: Map<ShapeId, BindingId[]>;
|
|
8
8
|
}
|
|
9
9
|
export declare function compareBindings(left: BindingRecord, right: BindingRecord): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RecordsDiff } from "../../../store/index";
|
|
2
2
|
import { type BindingId, type BindingRecord, type EditorRecord, type ShapeId } from "../../schema/records";
|
|
3
|
-
export type BindingRelation = "
|
|
3
|
+
export type BindingRelation = "owner" | "target" | "related";
|
|
4
4
|
interface DraftRelationIndex {
|
|
5
5
|
changesByShape: Map<ShapeId, Map<BindingId, BindingRecord | undefined>>;
|
|
6
6
|
cacheByShape: Map<ShapeId, readonly BindingRecord[]>;
|
|
@@ -60,7 +60,7 @@ export { SelectTool } from "./tools/select/selectTool";
|
|
|
60
60
|
export { LAND_DEFAULT_THEME_COLOR_FALLBACKS, LAND_THEME_COLOR_SLOTS, LAND_THEME_COLOR_TOKEN_BY_SLOT, areShapeColorsEqual, createCustomShapeColor, createThemeShapeColor, getThemeColorTokenName, isCustomShapeColorRef, isShapeColor, isThemeShapeColorRef, isTransparentShapeColor, normalizeShapeColor, resolveShapeColor, shapeColorToCssColor, } from "./shapes/colors";
|
|
61
61
|
export type { CustomShapeColorRef, ShapeColor, ThemeColorSlot, ThemeColorResolver, ThemeColorTokenName, ThemeShapeColorRef, } from "./shapes/colors";
|
|
62
62
|
export { type EditorPlugin, createEditorRuntimeToken, EditorRuntimeRegistry, type EditorRuntimeToken, } from "./plugins";
|
|
63
|
-
export { DEFAULT_CAMERA, DEFAULT_DOCUMENT_ID, DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultDocument, createDefaultPage, createDefaultSession, isAssetRecord, isBindingRecord, isDocumentRecord, isDocumentMetadataRecord, isPageRecord, isSessionRecord, isShapeRecord, type AssetId, type AssetRecord, type AssetRecordBase, type BaseRecord, type BindingId, type BindingRecordBase, type BindingRecord, type Camera, type DocumentId, type DocumentMetadataRecord, type DocumentRecord, type EditorRecord, type PageCameraById, type PageId, type PageSelectionById, type PageRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecordBase, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingEntryMode, type ShapeEditingPoint, type ShapeEditingSession, } from "./schema/records";
|
|
63
|
+
export { DEFAULT_CAMERA, DEFAULT_DOCUMENT_ID, DEFAULT_PAGE_ID, DEFAULT_SESSION_ID, createDefaultDocument, createDefaultPage, createDefaultSession, isAssetRecord, isBindingRecord, isDocumentRecord, isDocumentMetadataRecord, isPageRecord, isSessionRecord, isShapeRecord, type AssetId, type AssetRecord, type AssetRecordBase, type BaseRecord, type BindingId, type BindingEndpointBase, type BindingRecordBase, type BindingRecord, type Camera, type DocumentId, type DocumentMetadataRecord, type DocumentRecord, type EditorRecord, type PageCameraById, type PageId, type PageSelectionById, type PageRecord, type RecordScope, type SessionRecord, type ShapeId, type ShapeParentId, type ShapeRecordBase, type ShapeRecord, type ShapeEditingEntryRequest, type ShapeEditingEntryMode, type ShapeEditingPoint, type ShapeEditingSession, } from "./schema/records";
|
|
64
64
|
export { Vec } from "./geometry/vec";
|
|
65
65
|
export { Box } from "./geometry/box";
|
|
66
66
|
export { Mat } from "./geometry/mat";
|
|
@@ -67,14 +67,19 @@ export interface ShapeRecordBase<Type extends string = string, Props extends obj
|
|
|
67
67
|
isLocked: boolean;
|
|
68
68
|
props: Props;
|
|
69
69
|
}
|
|
70
|
-
export interface
|
|
70
|
+
export interface BindingEndpointBase<Slot extends string = string, Props extends object = object> {
|
|
71
|
+
slot: Slot;
|
|
72
|
+
targetId: ShapeId;
|
|
73
|
+
props: Props;
|
|
74
|
+
meta: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
export interface BindingRecordBase<Type extends string = string, Endpoint extends BindingEndpointBase = BindingEndpointBase> extends BaseRecord {
|
|
71
77
|
id: BindingId;
|
|
72
78
|
typeName: "binding";
|
|
73
79
|
scope: "document";
|
|
74
80
|
type: Type;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
props: Props;
|
|
81
|
+
ownerId: ShapeId;
|
|
82
|
+
endpoints: readonly Endpoint[];
|
|
78
83
|
}
|
|
79
84
|
export interface AssetRecordBase<Type extends string = string, Props extends object = object> extends BaseRecord {
|
|
80
85
|
id: AssetId;
|
|
@@ -84,7 +89,7 @@ export interface AssetRecordBase<Type extends string = string, Props extends obj
|
|
|
84
89
|
props: Props;
|
|
85
90
|
}
|
|
86
91
|
export type ShapeRecord = ShapeRecordBase<string, object>;
|
|
87
|
-
export type BindingRecord = BindingRecordBase<string, object
|
|
92
|
+
export type BindingRecord = BindingRecordBase<string, BindingEndpointBase<string, object>>;
|
|
88
93
|
export type AssetRecord = AssetRecordBase<string, object>;
|
|
89
94
|
export interface SessionRecord extends BaseRecord {
|
|
90
95
|
id: SessionId;
|
|
@@ -2,12 +2,12 @@ import type { ShapeUtilRegistry } from "../shapes/shapeUtilRegistry";
|
|
|
2
2
|
import type { BindingUtilRegistry } from "../bindings/bindingUtilRegistry";
|
|
3
3
|
import type { StoreSnapshot } from "../../store/index";
|
|
4
4
|
import { type DocumentRecord, type SessionRecord } from "./records";
|
|
5
|
-
export type DocumentSnapshot = StoreSnapshot<DocumentRecord,
|
|
5
|
+
export type DocumentSnapshot = StoreSnapshot<DocumentRecord, 4>;
|
|
6
6
|
export type SessionSnapshot = StoreSnapshot<SessionRecord, 1>;
|
|
7
7
|
export declare class SnapshotParseError extends Error {
|
|
8
8
|
constructor(message: string);
|
|
9
9
|
}
|
|
10
|
-
declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION:
|
|
10
|
+
declare const CURRENT_DOCUMENT_SNAPSHOT_VERSION: 4;
|
|
11
11
|
declare const CURRENT_SESSION_SNAPSHOT_VERSION: 1;
|
|
12
12
|
export declare function getSnapshotEnvelope(snapshot: unknown, kind: "document"): {
|
|
13
13
|
schemaVersion: typeof CURRENT_DOCUMENT_SNAPSHOT_VERSION;
|
|
@@ -2,9 +2,10 @@ import type { Editor, EditorPlugin } from "../canvas-core/index";
|
|
|
2
2
|
import type { CanvasRenderPlugin } from "../canvas-react/host/index";
|
|
3
3
|
import type { CanvasAssetResolverContribution, CanvasExportContribution, CanvasImportContribution } from "./contributions";
|
|
4
4
|
import type { CanvasApiToken, ScopedProductApiRegistryView } from "./tokens";
|
|
5
|
+
declare const canvasPluginReferenceBrand: unique symbol;
|
|
5
6
|
export interface CanvasPluginReference {
|
|
6
7
|
readonly id: string;
|
|
7
|
-
readonly
|
|
8
|
+
readonly [canvasPluginReferenceBrand]: true;
|
|
8
9
|
}
|
|
9
10
|
export type CanvasPluginRequirement = CanvasPluginReference;
|
|
10
11
|
export interface CanvasTaskRunner {
|
|
@@ -35,3 +36,4 @@ export interface CanvasPlugin<TApi = never> extends CanvasPluginDefinition<TApi>
|
|
|
35
36
|
}
|
|
36
37
|
export type CanvasPluginInput = CanvasPlugin<unknown> | readonly CanvasPluginInput[];
|
|
37
38
|
export declare function defineCanvasPlugin<TApi = never>(plugin: CanvasPluginDefinition<TApi>): CanvasPlugin<TApi>;
|
|
39
|
+
export {};
|