@yuzhouu/canvas-kit 0.1.11 → 0.1.13
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 +47 -13
- package/_vendor/canvas-core/bindings/bindingUtil.d.ts +1 -0
- package/_vendor/canvas-core/editor/clipboard.d.ts +1 -1
- package/_vendor/canvas-core/editor/commands.d.ts +0 -2
- package/_vendor/canvas-core/editor/managers/bindingManager.d.ts +4 -0
- package/_vendor/canvas-core/editor/queries/shapeTransforms.d.ts +3 -4
- package/_vendor/canvas-core/editor/resizeGeometry.d.ts +20 -0
- package/_vendor/canvas-core/editor/selectionResizeCapabilities.d.ts +2 -0
- package/_vendor/canvas-core/geometry/mat.d.ts +2 -3
- package/_vendor/canvas-core/index.d.ts +4 -2
- package/_vendor/canvas-core/schema/records.d.ts +0 -1
- package/_vendor/canvas-core/schema/snapshots.d.ts +2 -2
- package/_vendor/canvas-core/shapes/childTransformPolicy.d.ts +16 -0
- package/_vendor/canvas-core/shapes/shapeUtil.d.ts +3 -3
- package/_vendor/canvas-plugin-sdk/capability.d.ts +0 -6
- package/_vendor/canvas-plugin-sdk/index.d.ts +1 -16
- package/_vendor/canvas-plugin-sdk/plugin.d.ts +5 -52
- package/_vendor/canvas-plugin-sdk/setupExtension.d.ts +5 -0
- package/_vendor/canvas-product-contracts/actionRegistry.d.ts +4 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/actions.d.ts +10 -16
- package/_vendor/canvas-product-contracts/capability.d.ts +8 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/chrome.d.ts +1 -0
- package/_vendor/canvas-product-contracts/chromeRegistry.d.ts +9 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/contextMenu.d.ts +4 -0
- package/_vendor/canvas-product-contracts/contextMenuRegistry.d.ts +4 -0
- package/_vendor/canvas-product-contracts/exportRegistry.d.ts +6 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/exports.d.ts +1 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/importRegistry.d.ts +1 -4
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/imports.d.ts +1 -0
- package/_vendor/canvas-product-contracts/index.d.ts +15 -0
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/productApi.d.ts +6 -5
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/services.d.ts +2 -1
- package/_vendor/{canvas-plugin-sdk → canvas-product-contracts}/toolbar.d.ts +3 -6
- package/_vendor/canvas-product-contracts/toolbarRegistry.d.ts +9 -0
- package/_vendor/plugin-arrow/api.d.ts +2 -2
- package/_vendor/plugin-frame/api.d.ts +2 -2
- package/_vendor/plugin-geo/api.d.ts +2 -2
- package/_vendor/plugin-group/groupContributions.d.ts +1 -1
- package/_vendor/plugin-group/productRuntime.d.ts +1 -1
- package/_vendor/plugin-image/cropRuntime.d.ts +1 -1
- package/_vendor/plugin-image/imageHostActionContract.d.ts +1 -1
- package/_vendor/plugin-image/productRuntime.d.ts +1 -1
- package/_vendor/plugin-image/runtimeShared.d.ts +1 -1
- package/_vendor/plugin-image/smudgeRuntime.d.ts +1 -1
- package/_vendor/plugin-image/styleRuntime.d.ts +1 -1
- package/_vendor/plugin-image/toolbarRuntime.d.ts +1 -1
- package/_vendor/plugin-runtime-clipboard/capability.d.ts +1 -0
- package/_vendor/{plugin-builtin-clipboard/clipboardContribution.d.ts → plugin-runtime-clipboard/clipboardActions.d.ts} +1 -6
- package/_vendor/{plugin-builtin-clipboard → plugin-runtime-clipboard}/clipboardService.d.ts +2 -2
- package/_vendor/plugin-runtime-clipboard/index.d.ts +4 -0
- package/_vendor/plugin-runtime-clipboard/plugin.d.ts +1 -0
- package/_vendor/{plugin-builtin-export → plugin-runtime-export}/canvasExportApi.d.ts +2 -2
- package/_vendor/{plugin-builtin-export → plugin-runtime-export}/index.d.ts +1 -1
- package/_vendor/{plugin-builtin-export → plugin-runtime-export}/plugin.d.ts +1 -1
- package/_vendor/plugin-text/api.d.ts +2 -2
- package/_vendor/plugin-text/feature.d.ts +1 -1
- package/_vendor/plugin-text/textShapeHelpers.d.ts +0 -1
- package/browser/persistence.d.ts +1 -1
- package/canvasKitTools.d.ts +3 -0
- package/chrome/contextMenuRuntime.d.ts +7 -0
- package/chrome/toolbar/FloatingSelectionToolbarPageSpace.d.ts +1 -1
- package/chrome/toolbar/mergeToolbarGroups.d.ts +8 -0
- package/chrome/toolbar/toolbarLabels.d.ts +1 -1
- package/chrome/toolbar/useToolbarSurfaces.d.ts +1 -1
- package/chrome/types.d.ts +7 -8
- package/chrome/useCanvasKitChromeContext.d.ts +7 -7
- package/chrome/useCanvasKitLayerTree.d.ts +3 -2
- package/chrome/useChromeSurfaces.d.ts +1 -1
- package/chrome/useContextMenuSurface.d.ts +1 -1
- package/chrome/useHistoryControls.d.ts +3 -3
- package/chrome/usePageControls.d.ts +8 -8
- package/chrome/useZoomControls.d.ts +5 -1
- package/commands/command.d.ts +11 -0
- package/commands/commandTokens.d.ts +61 -0
- package/commands/documentCommands.d.ts +2 -0
- package/commands/historyCommands.d.ts +3 -0
- package/commands/index.d.ts +11 -0
- package/commands/layerCommands.d.ts +20 -0
- package/commands/pageCommands.d.ts +12 -0
- package/commands/selectionCommands.d.ts +12 -0
- package/commands/shapeCommands.d.ts +8 -0
- package/commands/toolCommands.d.ts +2 -0
- package/commands/viewCommands.d.ts +10 -0
- package/contracts/canvasProductControllerContracts.d.ts +32 -0
- package/{core/product-controller → controller}/canvasProductController.d.ts +27 -55
- package/controller/index.d.ts +3 -0
- package/{core/product-controller/productLayerTree.d.ts → controller/layerTree.d.ts} +1 -1
- package/index.d.ts +31 -27
- package/index.mjs +88 -111
- package/package.json +2 -2
- package/plugins/host/image/api/imageHostApi.d.ts +11 -0
- package/plugins/host/image/api/imageHostApiContract.d.ts +60 -0
- package/{features → plugins/host}/image/asset/imageAssetService.d.ts +3 -2
- package/{features → plugins/host}/image/asset/imageBlobStore.d.ts +2 -2
- package/{features → plugins/host}/image/asset/imageFileHelpers.d.ts +1 -1
- package/{features → plugins/host}/image/asset/svgImageAssetInliner.d.ts +1 -1
- package/{features → plugins/host}/image/import/ImageImportController.d.ts +2 -2
- package/{features → plugins/host}/image/index.d.ts +4 -4
- package/plugins/host/image/plugin.d.ts +1 -0
- package/{features → plugins/host}/image/smudge/imageSmudgeHostActions.d.ts +3 -3
- package/{features → plugins/host}/image/toolbar/imageHostActions.d.ts +8 -24
- package/{features → plugins/host}/image/toolbar/imageToolbarHostBridge.d.ts +2 -2
- package/{features → plugins/host}/text/link/TextLinkHoverPopover.d.ts +1 -1
- package/plugins/host/text/textHostPlugin.d.ts +5 -0
- package/plugins/host/text/textSvgAssetInliner.d.ts +3 -0
- package/plugins/host/text/textSvgAssetPlugin.d.ts +2 -0
- package/{_vendor/plugin-builtin-import-host → plugins/runtime/import-host}/CanvasImportHost.d.ts +2 -1
- package/plugins/runtime/import-host/capability.d.ts +1 -0
- package/plugins/runtime/import-host/plugin.d.ts +1 -0
- package/plugins/runtime/keyboard-shortcuts/index.d.ts +1 -0
- package/plugins/runtime/keyboard-shortcuts/plugin.d.ts +1 -0
- package/plugins/runtime/keyboard-shortcuts/useCanvasKeyboardShortcuts.d.ts +6 -0
- package/plugins/runtime/tool-actions/capability.d.ts +1 -0
- package/{_vendor/plugin-builtin-tool-actions → plugins/runtime/tool-actions}/index.d.ts +1 -1
- package/plugins/runtime/tool-actions/plugin.d.ts +1 -0
- package/plugins/runtime/tool-actions/toolActions.d.ts +2 -0
- package/plugins/standard/clipboard/chrome.d.ts +2 -0
- package/plugins/standard/clipboard/contextMenu.d.ts +2 -0
- package/plugins/standard/clipboard/plugin.d.ts +1 -0
- package/plugins/standard/clipboard/shortcuts.d.ts +5 -0
- package/plugins/{standardCanvasKitPlugins.d.ts → standard/createStandardCanvasKitPlugins.d.ts} +2 -3
- package/plugins/standard/selection/actions.d.ts +21 -0
- package/plugins/standard/selection/chrome.d.ts +2 -0
- package/plugins/standard/selection/contextMenu.d.ts +2 -0
- package/plugins/standard/selection/plugin.d.ts +1 -0
- package/plugins/standard/selection/toolbar.d.ts +2 -0
- package/plugins/standard/tool-ui/contextMenu.d.ts +2 -0
- package/plugins/standard/tool-ui/plugin.d.ts +1 -0
- package/plugins/standard/tool-ui/toolbar.d.ts +2 -0
- package/plugins/standard/view/actions.d.ts +5 -0
- package/plugins/standard/view/chrome.d.ts +2 -0
- package/plugins/standard/view/contextMenu.d.ts +2 -0
- package/plugins/standard/view/plugin.d.ts +1 -0
- package/react/CanvasKitRoot.d.ts +3 -2
- package/react/useCanvasProductControllerLifecycle.d.ts +9 -0
- package/runtime/canvasKitActionContext.d.ts +17 -0
- package/runtime/canvasKitActionExecutor.d.ts +12 -0
- package/runtime/canvasKitCommandExecutor.d.ts +12 -3
- package/runtime/canvasKitPluginContracts.d.ts +13 -19
- package/{_vendor/canvas-plugin-sdk/lifecycle.d.ts → runtime/canvasKitPluginLifecycle.d.ts} +6 -5
- package/runtime/canvasKitPluginSetup.d.ts +9 -6
- package/{_vendor/canvas-plugin-sdk/pluginUi.d.ts → runtime/canvasKitPluginUi.d.ts} +5 -5
- package/runtime/canvasKitRuntime.d.ts +14 -5
- package/runtime/canvasKitRuntimeContracts.d.ts +8 -7
- package/runtime/canvasPluginGraph.d.ts +15 -0
- package/runtime/createCanvasKitCommandAction.d.ts +10 -0
- package/runtime/createCanvasKitEditor.d.ts +7 -0
- package/{core/runtime/runtimeContracts.d.ts → runtime/persistenceContracts.d.ts} +1 -6
- package/runtime/persistenceCoordinator.d.ts +1 -1
- package/{core/runtime/productAssets.d.ts → runtime/productAssetResolvers.d.ts} +11 -2
- package/runtime/productServiceRegistry.d.ts +8 -0
- package/runtime/registries/actionRegistry.d.ts +5 -0
- package/runtime/registries/chromeRegistry.d.ts +2 -0
- package/runtime/registries/contextMenuRegistry.d.ts +5 -0
- package/runtime/registries/exportRegistry.d.ts +2 -0
- package/runtime/registries/importRegistry.d.ts +2 -0
- package/runtime/registries/index.d.ts +7 -0
- package/runtime/registries/productApiRegistry.d.ts +5 -0
- package/runtime/registries/toolbarRegistry.d.ts +5 -0
- package/_vendor/canvas-plugin-sdk/actionRegistry.d.ts +0 -7
- package/_vendor/canvas-plugin-sdk/chromeRegistry.d.ts +0 -15
- package/_vendor/canvas-plugin-sdk/contextMenuRegistry.d.ts +0 -11
- package/_vendor/canvas-plugin-sdk/exportRegistry.d.ts +0 -9
- package/_vendor/canvas-plugin-sdk/toolbarRegistry.d.ts +0 -18
- package/_vendor/plugin-builtin-clipboard/clipboardChromeContributions.d.ts +0 -2
- package/_vendor/plugin-builtin-clipboard/clipboardContextMenuContributions.d.ts +0 -2
- package/_vendor/plugin-builtin-clipboard/index.d.ts +0 -3
- package/_vendor/plugin-builtin-clipboard/plugin.d.ts +0 -1
- package/_vendor/plugin-builtin-import-host/capability.d.ts +0 -1
- package/_vendor/plugin-builtin-import-host/plugin.d.ts +0 -1
- package/_vendor/plugin-builtin-tool-actions/capability.d.ts +0 -1
- package/_vendor/plugin-builtin-tool-actions/plugin.d.ts +0 -1
- package/_vendor/plugin-builtin-tool-actions/toolActions.d.ts +0 -2
- package/_vendor/plugin-connector/canvasRender.d.ts +0 -2
- package/_vendor/plugin-connector/connectorBindingUtil.d.ts +0 -28
- package/_vendor/plugin-connector/connectorBindings.d.ts +0 -8
- package/_vendor/plugin-connector/connectorGeometry.d.ts +0 -70
- package/_vendor/plugin-connector/connectorHandles.d.ts +0 -12
- package/_vendor/plugin-connector/connectorInteractions.d.ts +0 -3
- package/_vendor/plugin-connector/connectorMarker.d.ts +0 -7
- package/_vendor/plugin-connector/connectorModel.d.ts +0 -43
- package/_vendor/plugin-connector/connectorPortInteraction.d.ts +0 -13
- package/_vendor/plugin-connector/connectorPorts.d.ts +0 -23
- package/_vendor/plugin-connector/connectorRuntime.d.ts +0 -62
- package/_vendor/plugin-connector/connectorShapeUtil.d.ts +0 -29
- package/_vendor/plugin-connector/connectorTool.d.ts +0 -4
- package/_vendor/plugin-connector/constants.d.ts +0 -17
- package/_vendor/plugin-connector/editorRuntime.d.ts +0 -7
- package/_vendor/plugin-connector/feature.d.ts +0 -4
- package/_vendor/plugin-connector/index.d.ts +0 -18
- package/_vendor/plugin-connector/orthogonalRoute.d.ts +0 -9
- package/_vendor/plugin-connector/productRuntime.d.ts +0 -2
- package/_vendor/plugin-connector/quickConnect.d.ts +0 -28
- package/_vendor/plugin-connector/types.d.ts +0 -51
- package/_vendor/plugin-packaging/api.d.ts +0 -74
- package/_vendor/plugin-packaging/canvasRender.d.ts +0 -2
- package/_vendor/plugin-packaging/editorRuntime.d.ts +0 -2
- package/_vendor/plugin-packaging/feature.d.ts +0 -2
- package/_vendor/plugin-packaging/index.d.ts +0 -19
- package/_vendor/plugin-packaging/packagingArtwork.d.ts +0 -5
- package/_vendor/plugin-packaging/packagingDxf.d.ts +0 -9
- package/_vendor/plugin-packaging/packagingGeometry.d.ts +0 -74
- package/_vendor/plugin-packaging/packagingInteractions.d.ts +0 -2
- package/_vendor/plugin-packaging/packagingPdfExporter.d.ts +0 -25
- package/_vendor/plugin-packaging/packagingRuntime.d.ts +0 -11
- package/_vendor/plugin-packaging/packagingShapeUtil.d.ts +0 -34
- package/_vendor/plugin-packaging/packagingStyle.d.ts +0 -10
- package/_vendor/plugin-packaging/packagingSvgExporter.d.ts +0 -7
- package/_vendor/plugin-packaging/productRuntime.d.ts +0 -2
- package/_vendor/plugin-packaging/types.d.ts +0 -168
- package/_vendor/plugin-packaging/validation.d.ts +0 -3
- package/controller/canvasKitController.d.ts +0 -28
- package/core/index.d.ts +0 -7
- package/core/product-controller/index.d.ts +0 -2
- package/core/runtime/productEditor.d.ts +0 -3
- package/core/runtime/productServices.d.ts +0 -20
- package/es-DocrZgUh.mjs +0 -2
- package/features/context-menu/contextMenuRuntime.d.ts +0 -13
- package/features/image/controller/imageProductController.d.ts +0 -27
- package/features/image/imageHostPlugin.d.ts +0 -1
- package/features/image/smudge/imageSmudgeTypes.d.ts +0 -25
- package/features/text/textHostPlugin.d.ts +0 -5
- package/features/text/textSvgAssetInliner.d.ts +0 -3
- package/features/text/textSvgAssetPlugin.d.ts +0 -2
- package/react/useCanvasKitControllerLifecycle.d.ts +0 -8
- /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/blobDataUrl.d.ts +0 -0
- /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/pngExport.d.ts +0 -0
- /package/_vendor/{plugin-builtin-export → plugin-runtime-export}/svgExport.d.ts +0 -0
- /package/{_vendor/plugin-builtin-import-host → plugins/runtime/import-host}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -81,12 +81,18 @@ belong on `CanvasKitRoot`. Export appearance is supplied to each export request;
|
|
|
81
81
|
it is not stored on the Root or Runtime.
|
|
82
82
|
|
|
83
83
|
`plugins` is the complete caller-supplied plugin graph. Before compiling it,
|
|
84
|
-
CanvasKit adds
|
|
85
|
-
export API only when the graph does not already
|
|
86
|
-
capability token. A plugin that provides
|
|
87
|
-
`
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
CanvasKit adds Runtime default providers for clipboard behavior, import host,
|
|
85
|
+
generic tool actions, and the export API only when the graph does not already
|
|
86
|
+
provide the corresponding capability token. A plugin that provides
|
|
87
|
+
`canvasClipboardRuntimeCapability`, `canvasToolActionsCapability`, or
|
|
88
|
+
`canvasExportApiToken` therefore replaces that default implementation. Runtime
|
|
89
|
+
defaults and caller plugins use the same `CanvasPlugin` contract and compile
|
|
90
|
+
into one dependency graph.
|
|
91
|
+
|
|
92
|
+
CanvasKit-specific import, keyboard, and tool-action defaults live with the
|
|
93
|
+
composition root under `src/plugins/runtime`. Reusable clipboard and export
|
|
94
|
+
capabilities remain independent Runtime plugin packages. Physical ownership
|
|
95
|
+
does not change capability replacement semantics.
|
|
90
96
|
|
|
91
97
|
## Startup result
|
|
92
98
|
|
|
@@ -180,18 +186,20 @@ Nested arrays are groups only; they do not need IDs and are flattened in declara
|
|
|
180
186
|
|
|
181
187
|
Runtime creation compiles the graph, creates Editor and the Runtime resource owner, runs each setup once in dependency order, then seals all registries. Sealing validates duplicate IDs and action references, materializes registered APIs, and prevents later registration.
|
|
182
188
|
|
|
183
|
-
Packaging
|
|
184
|
-
|
|
189
|
+
Connector and Packaging are composed outside CanvasKit and are intentionally
|
|
190
|
+
absent from the standard plugin profile. Products that need them depend on their
|
|
191
|
+
plugin packages and add them explicitly:
|
|
185
192
|
|
|
186
193
|
```ts
|
|
187
194
|
import {
|
|
188
|
-
Packaging,
|
|
189
195
|
createStandardCanvasKitPlugins,
|
|
190
196
|
type CanvasKitRuntimeOptions,
|
|
191
197
|
} from "@land/canvas-kit";
|
|
198
|
+
import { Connector } from "@land/plugin-connector";
|
|
199
|
+
import { Packaging } from "@land/plugin-packaging";
|
|
192
200
|
|
|
193
201
|
const options: CanvasKitRuntimeOptions = {
|
|
194
|
-
plugins: [createStandardCanvasKitPlugins(), Packaging],
|
|
202
|
+
plugins: [Connector, createStandardCanvasKitPlugins(), Packaging],
|
|
195
203
|
};
|
|
196
204
|
```
|
|
197
205
|
|
|
@@ -203,17 +211,43 @@ const options: CanvasKitRuntimeOptions = {
|
|
|
203
211
|
- `ui`
|
|
204
212
|
- `lifecycle.beforeReady()`, `lifecycle.beforeCommand()`, and `lifecycle.defer()`
|
|
205
213
|
|
|
206
|
-
`setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor.
|
|
214
|
+
`setup` returns nothing. Every owned resource registers cleanup through `lifecycle.defer()`, which gives Runtime one cleanup protocol and reverse-order resource stack. `beforeReady` runs serially during `start()` after restore/seed and asset preparation. `beforeCommand` is a repeatable interceptor executed by the Runtime-bound command executor after Runtime is ready. Public Controller and action writes are rejected outside the ready state; seed uses a private bootstrap executor, so restore, seed, and `beforeReady` initialization do not trigger it. Parameterized built-in actions validate their value before the hook runs. Controller writes and built-in actions reuse the same internal command definitions, whose IDs come from the public read-only `CANVAS_KIT_COMMAND_TOKENS` catalog.
|
|
207
215
|
|
|
208
216
|
The set-active-tool and tool-lock actions are provided by the replaceable
|
|
209
|
-
|
|
217
|
+
Runtime default for `canvasToolActionsCapability`, so shape toolbar plugins do
|
|
210
218
|
not depend on the standard profile installing a Tool action provider.
|
|
211
219
|
Components share one props contract and render between Canvas and chrome; there
|
|
212
220
|
are no component slots.
|
|
213
221
|
|
|
214
222
|
## Public controller
|
|
215
223
|
|
|
216
|
-
External code should work through `runtime.controller` or the controller supplied to `onControllerReady`. The controller exposes document, selection, page, tool, camera, layer, history, export,
|
|
224
|
+
External code should work through `runtime.controller` or the controller supplied to `onControllerReady`. The controller exposes document, selection, page, tool, camera, layer, history, export, standard shape creation, and registered API operations without exposing the raw store.
|
|
225
|
+
|
|
226
|
+
Controller reads are available immediately for assembly and inspection, but
|
|
227
|
+
Controller writes require `await runtime.start()`. Plugins can match
|
|
228
|
+
`beforeCommand` events against stable command identities without importing
|
|
229
|
+
internals:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
import {
|
|
233
|
+
CANVAS_KIT_COMMAND_TOKENS,
|
|
234
|
+
canvasKitLifecycleExtension,
|
|
235
|
+
defineCanvasPlugin,
|
|
236
|
+
} from "@land/canvas-kit";
|
|
237
|
+
|
|
238
|
+
const analyticsPlugin = defineCanvasPlugin({
|
|
239
|
+
id: "example.command-analytics",
|
|
240
|
+
setup(context) {
|
|
241
|
+
context
|
|
242
|
+
.get(canvasKitLifecycleExtension)
|
|
243
|
+
.beforeCommand(({ commandId }) => {
|
|
244
|
+
if (commandId === CANVAS_KIT_COMMAND_TOKENS.layer.bringToFront.id) {
|
|
245
|
+
// Record the product command.
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
```
|
|
217
251
|
|
|
218
252
|
### Export API
|
|
219
253
|
|
|
@@ -66,3 +66,4 @@ export declare abstract class BindingUtil<B extends BindingRecordBase = BindingR
|
|
|
66
66
|
getSelectionCompanionFrameGeometries?(editor: Editor, binding: B, context: BindingSelectionCompanionFrameContext): SelectionOverlayFrameGeometryState[];
|
|
67
67
|
}
|
|
68
68
|
export declare function resolveShapeHierarchyRootId(shapeId: ShapeRecord["id"], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ShapeRecord["id"];
|
|
69
|
+
export declare function resolveShapeHierarchyRootIds(shapeIds: readonly ShapeRecord["id"][], bindings: readonly BindingRecord[], getBindingUtil: (binding: BindingRecord) => BindingUtil): ReadonlyMap<ShapeRecord["id"], ShapeRecord["id"]>;
|
|
@@ -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: 2;
|
|
8
8
|
source: {
|
|
9
9
|
app: "land";
|
|
10
10
|
documentId?: string;
|
|
@@ -24,7 +24,6 @@ export interface CreateShapeInput {
|
|
|
24
24
|
opacity?: number;
|
|
25
25
|
isHidden?: boolean;
|
|
26
26
|
rotation?: number;
|
|
27
|
-
skewX?: number;
|
|
28
27
|
scaleX?: number;
|
|
29
28
|
scaleY?: number;
|
|
30
29
|
isLocked?: boolean;
|
|
@@ -46,7 +45,6 @@ export interface ShapeUpdate {
|
|
|
46
45
|
x?: number;
|
|
47
46
|
y?: number;
|
|
48
47
|
rotation?: number;
|
|
49
|
-
skewX?: number;
|
|
50
48
|
scaleX?: number;
|
|
51
49
|
scaleY?: number;
|
|
52
50
|
opacity?: number;
|
|
@@ -15,9 +15,13 @@ export declare class BindingManager {
|
|
|
15
15
|
repairLoadedBindings(source: ChangeSource): void;
|
|
16
16
|
handleShapeChanges(changes: ShapeChangeEntry[], source: ChangeSource): void;
|
|
17
17
|
getShapeHierarchyRootId(shapeId: ShapeId): ShapeId;
|
|
18
|
+
getShapeHierarchyRootIds(shapeIds: readonly ShapeId[]): ReadonlyMap<ShapeId, ShapeId>;
|
|
19
|
+
getShapeHierarchyMemberIds(shapeIds: readonly ShapeId[]): ShapeId[];
|
|
18
20
|
cleanupBindingsForDeletedShapes(ids: ShapeId[], source: ChangeSource): void;
|
|
19
21
|
cleanupBindings(ids: BindingId[], source: ChangeSource): void;
|
|
20
22
|
private applyEffect;
|
|
23
|
+
private syncShapeHierarchyState;
|
|
24
|
+
private getShapeHierarchyContext;
|
|
21
25
|
private getAllBindings;
|
|
22
26
|
private getExclusiveBindingKey;
|
|
23
27
|
}
|
|
@@ -13,7 +13,6 @@ export interface ShapeTransformFields {
|
|
|
13
13
|
x: number;
|
|
14
14
|
y: number;
|
|
15
15
|
rotation: number;
|
|
16
|
-
skewX: number;
|
|
17
16
|
scaleX: number;
|
|
18
17
|
scaleY: number;
|
|
19
18
|
}
|
|
@@ -24,9 +23,9 @@ export interface ShapeTransformDecompositionOptions {
|
|
|
24
23
|
preferredScaleYSign?: number;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
|
-
*
|
|
28
|
-
* translate/rotate/
|
|
29
|
-
*
|
|
26
|
+
* Strictly decompose a local-to-parent affine transform into the shape model's
|
|
27
|
+
* translate/rotate/scale fields. Non-orthogonal matrices cannot be represented
|
|
28
|
+
* without shear and therefore return null.
|
|
30
29
|
*/
|
|
31
30
|
export declare function getShapeTransformFieldsFromMatrix(matrix: Mat, localBounds: Box, options?: ShapeTransformDecompositionOptions): ShapeTransformFields | null;
|
|
32
31
|
export declare function getShapeLocalBounds<S extends ShapeRecord>(shape: S, util: ShapeUtil<S>): Box;
|
|
@@ -10,6 +10,26 @@ export interface SelectionResizeScalesResult {
|
|
|
10
10
|
scaleX: number;
|
|
11
11
|
scaleY: number;
|
|
12
12
|
}
|
|
13
|
+
/** Gets the axis-aligned size after applying a shape's scale. */
|
|
14
|
+
export declare function getSelectionResizeDimensionsFromLocal({ localWidth, localHeight, scaleX, scaleY, }: {
|
|
15
|
+
localWidth: number;
|
|
16
|
+
localHeight: number;
|
|
17
|
+
scaleX: number;
|
|
18
|
+
scaleY: number;
|
|
19
|
+
}): {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
};
|
|
23
|
+
/** Recovers intrinsic dimensions from an axis-aligned scaled size. */
|
|
24
|
+
export declare function getLocalDimensionsFromSelectionResize({ width, height, scaleX, scaleY, }: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
scaleX: number;
|
|
28
|
+
scaleY: number;
|
|
29
|
+
}): {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
};
|
|
13
33
|
export declare function selectionResizeHandleMovesLeftEdge(handleId: SelectionResizeHandleId): boolean;
|
|
14
34
|
export declare function selectionResizeHandleMovesRightEdge(handleId: SelectionResizeHandleId): boolean;
|
|
15
35
|
export declare function selectionResizeHandleMovesTopEdge(handleId: SelectionResizeHandleId): boolean;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ShapeRecord } from "../schema/records";
|
|
2
2
|
import type { Editor } from "./editor";
|
|
3
3
|
import { type SelectionResizeHandleId, type SelectionResizeMode } from "./selection";
|
|
4
|
+
export type SelectionResizeRotationCompatibility = "parallel" | "perpendicular";
|
|
5
|
+
export declare function getSelectionResizeRotationCompatibility(left: number, right: number): SelectionResizeRotationCompatibility | null;
|
|
4
6
|
export declare function areSelectionResizeRotationsCompatible(left: number, right: number): boolean;
|
|
5
7
|
export declare function areSelectionResizeTargetRotationsCompatible(editor: Editor, resizeTargetShapes: readonly ShapeRecord[], selectionRotation: number): boolean;
|
|
6
8
|
export declare function intersectSelectionResizeModes(modeSets: readonly (readonly SelectionResizeMode[])[]): SelectionResizeMode[];
|
|
@@ -16,7 +16,6 @@ export declare class Mat {
|
|
|
16
16
|
static Identity(): Mat;
|
|
17
17
|
static Translate(x: number, y: number): Mat;
|
|
18
18
|
static Rotate(angle: number): Mat;
|
|
19
|
-
static SkewX(angle: number): Mat;
|
|
20
19
|
static Scale(sx: number, sy: number): Mat;
|
|
21
20
|
/** Compose: this × other */
|
|
22
21
|
compose(other: Mat): Mat;
|
|
@@ -27,6 +26,6 @@ export declare class Mat {
|
|
|
27
26
|
invert(): Mat;
|
|
28
27
|
toCssString(): string;
|
|
29
28
|
toSvgString(): string;
|
|
30
|
-
/** Create a transform for a shape: translate * rotate *
|
|
31
|
-
static ForShape(x: number, y: number, rotation: number, scaleX?: number, scaleY?: number
|
|
29
|
+
/** Create a transform for a shape: translate * rotate * scale. */
|
|
30
|
+
static ForShape(x: number, y: number, rotation: number, scaleX?: number, scaleY?: number): Mat;
|
|
32
31
|
}
|
|
@@ -8,7 +8,7 @@ export { getShapeGeometry, getShapeExportBounds, getShapeExportPageBounds, getSh
|
|
|
8
8
|
export type { ShapeGeometry, ShapeTransformDecompositionOptions, ShapeTransformFields, } from "./editor/queries/shapeTransforms";
|
|
9
9
|
export type { BindingPreviewState, GapSnapIndicatorGapState, GapSnapIndicatorState, PointSnapIndicatorState, SnapIndicatorState, SelectionBindingSegment, TerminalBindingGuideState, SelectionBindingMiddleHandle, SelectionBindingMiddleHandleAnchor, SelectionBindingTerminalHandle, SelectionBindingTerminalHandleAnchor, SelectionCustomHandle, SelectionCustomHandleAnchor, SelectionHandle, SelectionOverlayFrameState, SelectionOverlayFrameGeometryState, SelectionOverlayFrameStyleState, SelectionOverlayHandleAnchorsState, SelectionOverlayHandleCountsState, SelectionOverlayHandlesState, SelectionOverlayState, SelectionResizeHandle, SelectionResizeHandleAnchor, SelectionResizeHandleId, SelectionResizeMode, SelectionRotateHandle, SelectionRotateHandleAnchor, SelectionRotateHandleId, SelectionMirrorAxis, } from "./editor/selection";
|
|
10
10
|
export { SELECTION_RESIZE_ALL_MODES, SELECTION_RESIZE_ASPECT_RATIO_LOCKED_ONLY_MODES, SELECTION_RESIZE_CORNER_HANDLE_IDS, SELECTION_RESIZE_FREE_ONLY_MODES, SELECTION_RESIZE_HANDLE_IDS, flipSelectionLocalBounds, getSelectionLocalBoundsFromPagePoints, mapSelectionLocalBoundsBetweenBounds, mapSelectionLocalPointBetweenBounds, mirrorSelectionLocalPoint, rotateSelectionPagePoint, selectionLocalPointToPagePoint, selectionPagePointToLocalPoint, } from "./editor/selection";
|
|
11
|
-
export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getSelectionResizeBounds, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
|
|
11
|
+
export { getAnchoredSelectionResizeLocalBounds, getAspectRatioLockedSelectionResizeBounds, getCenteredSelectionResizeBounds, getConstrainedSelectionResizeBounds, getLocalDimensionsFromSelectionResize, getSelectionResizeBounds, getSelectionResizeDimensionsFromLocal, getSelectionResizeScalesFromBounds, isSelectionResizeCorner, normalizeSelectionResizeBoundsFromEdges, selectionResizeHandleMovesBottomEdge, selectionResizeHandleMovesLeftEdge, selectionResizeHandleMovesRightEdge, selectionResizeHandleMovesTopEdge, } from "./editor/resizeGeometry";
|
|
12
12
|
export { InteractionHandlerRegistry } from "./editor/interactions";
|
|
13
13
|
export { SelectionHandleInteractionRegistry } from "./editor/selectionHandleInteractions";
|
|
14
14
|
export { ShortcutManager, formatKeyboardShortcut, normalizeKeyboardShortcut, } from "./editor/managers/shortcutManager";
|
|
@@ -29,7 +29,9 @@ export type { ChangeSource, RecordUpdate, RecordsDiff, ScopedStoreRecord, StoreR
|
|
|
29
29
|
export { SnapshotParseError, parseDocumentSnapshot, parseSessionSnapshot, } from "./schema/snapshots";
|
|
30
30
|
export type { DocumentSnapshot, SessionSnapshot } from "./schema/snapshots";
|
|
31
31
|
export { ShapeUtil } from "./shapes/shapeUtil";
|
|
32
|
-
export
|
|
32
|
+
export { CHILD_TRANSFORM_POLICY_EPSILON, formatChildTransformPolicyViolation, getChildTransformPolicyViolation, } from "./shapes/childTransformPolicy";
|
|
33
|
+
export type { ChildTransformPolicy, ChildTransformPolicyProvider, ChildTransformPolicyViolation, } from "./shapes/childTransformPolicy";
|
|
34
|
+
export type { ShapeBoundsSnapGeometry, ShapeBrushSelectInput, ShapeBrushWrapInput, ShapeClipboardCopyInput, ShapeBindingPointInput, ShapeChildPlacementInput, ShapeChildVisibilityInput, ShapeEditEndInput, ShapeEditEndResult, ShapeGeometryInput, ShapeGroupingInput, ShapeHandleSnapContext, ShapeHandleSnapGeometry, ShapeHoverTargetInput, ShapeLineSegmentHitTestInput, ShapeLabelPathGeometry, ShapeLabelPathNearestPositionOptions, ShapePointHitTestInput, ShapeSnapPoint, ShapeSnapPointKind, ShapeTerminalBindingOutline, ShapeSelectionHandleAnchorInput, ShapeSelectionHandleAnchors, ShapeSelectionFrameInput, ShapeSelectionFlipAxis, ShapeSelectionFlipInput, ShapeSelectionOverlayInfo, ShapeSelectionOverlayInfoInput, ShapeSelectionPathStyle, ShapeSelectionPagePoints, ShapeSelectionPagePointsInput, ShapeSelectionResizeInput, ShapeSelectionResizeCapabilityInput, ShapeSelectionResizeModesInput, ShapeSelectionTransformCapabilityInput, ShapeSelectionTranslateInput, } from "./shapes/shapeUtil";
|
|
33
35
|
export type { HandleSnapContext, HandleSnapInput, HandleSnapMode, HandleSnapResult, HandleSnapSnapshot, HandleSnapSnapshotInput, ResizeSnapInput, ResizeSnapResult, ResizeSnapSnapshot, SnapAxis, SnapCoordinateSpace, SnapPointIndex, SnapPointIndexEntry, SnapPointKind, TranslateSnapInput, TranslateSnapResult, TranslateSnapSnapshot, } from "./editor/managers/snapTypes";
|
|
34
36
|
export { ShapeUtilRegistry } from "./shapes/shapeUtilRegistry";
|
|
35
37
|
export { resolveTerminalBindingAtPoint, } from "./bindings/terminalBinding";
|
|
@@ -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, 3>;
|
|
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: 3;
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ShapeRecordBase } from "../schema/records";
|
|
2
|
+
export type ChildTransformPolicy = "isometry" | "similarity";
|
|
3
|
+
export declare const CHILD_TRANSFORM_POLICY_EPSILON = 1e-8;
|
|
4
|
+
export interface ChildTransformPolicyProvider<S extends ShapeRecordBase = ShapeRecordBase> {
|
|
5
|
+
canReceiveChildren(shape: S): boolean;
|
|
6
|
+
getChildTransformPolicy(shape: S): ChildTransformPolicy;
|
|
7
|
+
}
|
|
8
|
+
export interface ChildTransformPolicyViolation {
|
|
9
|
+
shapeId: ShapeRecordBase["id"];
|
|
10
|
+
shapeType: ShapeRecordBase["type"];
|
|
11
|
+
policy: ChildTransformPolicy;
|
|
12
|
+
scaleX: number;
|
|
13
|
+
scaleY: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function getChildTransformPolicyViolation<S extends ShapeRecordBase>(shape: S, provider: ChildTransformPolicyProvider<S>, epsilon?: number): ChildTransformPolicyViolation | null;
|
|
16
|
+
export declare function formatChildTransformPolicyViolation(violation: ChildTransformPolicyViolation): string;
|
|
@@ -7,6 +7,7 @@ import { type SelectionMirrorAxis } from "../editor/selection";
|
|
|
7
7
|
import type { SelectionBindingMiddleHandleAnchor, SelectionBindingSegment, SelectionBindingTerminalHandleAnchor, SelectionCustomHandleAnchor, SelectionHandle, SelectionResizeHandleId, SelectionResizeMode } from "../editor/selection";
|
|
8
8
|
import type { ShapeId, ShapeParentId, ShapeRecordBase } from "../schema/records";
|
|
9
9
|
import { type ShapeTerminalBindingPort } from "../bindings/terminalPorts";
|
|
10
|
+
import type { ChildTransformPolicy } from "./childTransformPolicy";
|
|
10
11
|
export interface ShapeEditEndResult {
|
|
11
12
|
deleteShapeIds?: ShapeId[];
|
|
12
13
|
}
|
|
@@ -94,8 +95,6 @@ export interface ShapePointHitTestInput extends ShapeGeometryInput {
|
|
|
94
95
|
pagePoint: Vec;
|
|
95
96
|
positionedPoint: Vec;
|
|
96
97
|
}
|
|
97
|
-
export interface ShapeBindingTargetHitTestInput extends ShapePointHitTestInput {
|
|
98
|
-
}
|
|
99
98
|
export interface ShapeTerminalBindingOutline {
|
|
100
99
|
points: readonly Vec[];
|
|
101
100
|
closed: boolean;
|
|
@@ -226,6 +225,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
226
225
|
getLocalToPageTransform(shape: S): Mat;
|
|
227
226
|
canEdit(_shape: S): boolean;
|
|
228
227
|
canReceiveChildren(_shape: S): boolean;
|
|
228
|
+
getChildTransformPolicy(_shape: S): ChildTransformPolicy;
|
|
229
229
|
canReceiveChild(shape: S, _child: ShapeRecordBase): boolean;
|
|
230
230
|
isChildVisible(_shape: S, _child: ShapeRecordBase, _input: ShapeChildVisibilityInput): boolean;
|
|
231
231
|
getChildPlacementMeta(_shape: S, child: ShapeRecordBase, _input: ShapeChildPlacementInput): Record<string, unknown>;
|
|
@@ -238,7 +238,7 @@ export declare abstract class ShapeUtil<S extends ShapeRecordBase = ShapeRecordB
|
|
|
238
238
|
repairLoadedShape(_shape: S): S | null;
|
|
239
239
|
onEditEnd(_shape: S, _input: ShapeEditEndInput): ShapeEditEndResult | void;
|
|
240
240
|
hitTest(shape: S, positionedPoint: Vec, _input?: ShapePointHitTestInput): boolean;
|
|
241
|
-
hitTestBindingTarget(shape: S, positionedPoint: Vec, input?:
|
|
241
|
+
hitTestBindingTarget(shape: S, positionedPoint: Vec, input?: ShapePointHitTestInput): boolean;
|
|
242
242
|
hitTestLineSegment(shape: S, input: ShapeLineSegmentHitTestInput): boolean;
|
|
243
243
|
resolveBindingPoint(shape: S, input: ShapeBindingPointInput): Vec;
|
|
244
244
|
}
|
|
@@ -6,11 +6,5 @@ export interface CanvasPluginCapabilityToken<TValue = unknown, TKind extends Can
|
|
|
6
6
|
}
|
|
7
7
|
export interface CanvasPluginValueToken<TValue> extends CanvasPluginCapabilityToken<TValue, "value"> {
|
|
8
8
|
}
|
|
9
|
-
export interface CanvasPluginCapabilityRegistry {
|
|
10
|
-
get<TValue>(token: CanvasPluginValueToken<TValue>): TValue | null;
|
|
11
|
-
}
|
|
12
|
-
export interface CanvasPluginCapabilitySetup extends CanvasPluginCapabilityRegistry {
|
|
13
|
-
provide<TValue>(token: CanvasPluginValueToken<TValue>, value: TValue): void;
|
|
14
|
-
}
|
|
15
9
|
export declare function createCanvasPluginValueToken<TValue>(id: string): CanvasPluginValueToken<TValue>;
|
|
16
10
|
export declare function isCanvasPluginCapabilityToken(value: unknown): value is CanvasPluginCapabilityToken;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
export * from "./actions";
|
|
2
|
-
export * from "./actionRegistry";
|
|
3
1
|
export * from "./capability";
|
|
4
|
-
export * from "./chrome";
|
|
5
|
-
export * from "./chromeRegistry";
|
|
6
|
-
export * from "./contextMenu";
|
|
7
|
-
export * from "./contextMenuRegistry";
|
|
8
|
-
export * from "./exports";
|
|
9
|
-
export * from "./exportRegistry";
|
|
10
|
-
export * from "./imports";
|
|
11
|
-
export * from "./importRegistry";
|
|
12
|
-
export * from "./lifecycle";
|
|
13
2
|
export * from "./plugin";
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./productApi";
|
|
16
|
-
export * from "./services";
|
|
17
|
-
export * from "./toolbar";
|
|
18
|
-
export * from "./toolbarRegistry";
|
|
3
|
+
export * from "./setupExtension";
|
|
@@ -1,48 +1,11 @@
|
|
|
1
|
-
import type { EditorPlugin, Editor
|
|
1
|
+
import type { EditorPlugin, Editor } from "../canvas-core/index";
|
|
2
2
|
import type { CanvasRenderPlugin } from "../canvas-react/host/index";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
import type { CanvasPluginImportSetup } from "./imports";
|
|
7
|
-
import type { CanvasPluginExportSetup } from "./exports";
|
|
8
|
-
import type { CanvasPluginLifecycleSetup, CanvasPluginPersistence } from "./lifecycle";
|
|
9
|
-
import type { CanvasPluginUiSetup } from "./pluginUi";
|
|
10
|
-
import type { ProductServiceSetup } from "./services";
|
|
11
|
-
import type { ToolbarContribution } from "./toolbar";
|
|
12
|
-
import type { CanvasPluginApi, CanvasPluginApiContext } from "./productApi";
|
|
13
|
-
import { type CanvasPluginCapabilitySetup, type CanvasPluginCapabilityToken } from "./capability";
|
|
14
|
-
export interface CanvasActionShortcut {
|
|
15
|
-
actionId: string;
|
|
16
|
-
shortcut: KeyboardShortcutInput;
|
|
17
|
-
}
|
|
18
|
-
export interface CanvasPluginActionSetup {
|
|
19
|
-
add(...actions: readonly CanvasAction[]): void;
|
|
20
|
-
addShortcuts(...shortcuts: readonly CanvasActionShortcut[]): void;
|
|
21
|
-
}
|
|
22
|
-
export interface CanvasPluginToolbarSetup {
|
|
23
|
-
add(...contributions: readonly ToolbarContribution[]): void;
|
|
24
|
-
}
|
|
25
|
-
export interface CanvasPluginContextMenuSetup {
|
|
26
|
-
add(...contributions: readonly ContextMenuContribution[]): void;
|
|
27
|
-
}
|
|
28
|
-
export interface CanvasPluginApiSetup<TApiContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
29
|
-
add<TApi>(api: CanvasPluginApi<TApi, TApiContext>): void;
|
|
30
|
-
}
|
|
31
|
-
export interface CanvasPluginSetupContext<TApiContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
32
|
-
readonly actions: CanvasPluginActionSetup;
|
|
33
|
-
readonly apis: CanvasPluginApiSetup<TApiContext>;
|
|
34
|
-
readonly capabilities: CanvasPluginCapabilitySetup;
|
|
35
|
-
readonly chrome: CanvasPluginChromeSetup;
|
|
36
|
-
readonly contextMenu: CanvasPluginContextMenuSetup;
|
|
3
|
+
import type { CanvasPluginCapabilityToken } from "./capability";
|
|
4
|
+
import type { CanvasPluginSetupExtension } from "./setupExtension";
|
|
5
|
+
export interface CanvasPluginSetupContext {
|
|
37
6
|
readonly editor: Editor;
|
|
38
|
-
readonly exports: CanvasPluginExportSetup;
|
|
39
|
-
readonly imports: CanvasPluginImportSetup;
|
|
40
|
-
readonly lifecycle: CanvasPluginLifecycleSetup;
|
|
41
|
-
readonly persistence: CanvasPluginPersistence | null;
|
|
42
7
|
readonly productId: string;
|
|
43
|
-
|
|
44
|
-
readonly toolbar: CanvasPluginToolbarSetup;
|
|
45
|
-
readonly ui: CanvasPluginUiSetup;
|
|
8
|
+
get<TValue>(extension: CanvasPluginSetupExtension<TValue>): TValue;
|
|
46
9
|
}
|
|
47
10
|
export type CanvasPluginSetup<TContext extends CanvasPluginSetupContext = CanvasPluginSetupContext> = (context: TContext) => void;
|
|
48
11
|
type CanvasPluginSetupLike = (context: never) => unknown;
|
|
@@ -62,15 +25,5 @@ export interface CanvasPluginDefinition<TSetup extends CanvasPluginSetupLike = C
|
|
|
62
25
|
export interface CanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> extends CanvasPluginDefinition<TSetup>, CanvasPluginReference {
|
|
63
26
|
}
|
|
64
27
|
export type CanvasPluginInput<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> = CanvasPlugin<TSetup> | readonly CanvasPluginInput<TSetup>[];
|
|
65
|
-
export interface CompiledCanvasPlugins<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup> {
|
|
66
|
-
readonly plugins: readonly CanvasPlugin<TSetup>[];
|
|
67
|
-
readonly pluginIds: readonly string[];
|
|
68
|
-
readonly editorPlugins: readonly EditorPlugin[];
|
|
69
|
-
readonly renderPlugins: readonly CanvasRenderPlugin[];
|
|
70
|
-
readonly shapeTypes: readonly ShapeRecordBase["type"][];
|
|
71
|
-
}
|
|
72
28
|
export declare function defineCanvasPlugin<TSetup extends CanvasPluginSetupLike = CanvasPluginSetup>(plugin: CanvasPluginDefinition<TSetup>): CanvasPlugin<TSetup>;
|
|
73
|
-
export declare function compileCanvasPlugins<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[]): CompiledCanvasPlugins<TSetup>;
|
|
74
|
-
export declare function assertValidCanvasPluginGraph<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[]): void;
|
|
75
|
-
export declare function hasCanvasPluginCapabilityProvider<TSetup extends CanvasPluginSetupLike>(input: readonly CanvasPluginInput<TSetup>[], token: CanvasPluginCapabilityToken): boolean;
|
|
76
29
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Editor, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
|
|
1
|
+
import type { Editor, KeyboardShortcutInput, ShapeColor, ShapeId, ShapeRecordBase } from "../canvas-core/index";
|
|
2
2
|
export interface CanvasSelectionSnapshot {
|
|
3
3
|
selectedShapeIds: readonly ShapeId[];
|
|
4
4
|
selectedShapes: readonly ShapeRecordBase[];
|
|
@@ -32,19 +32,13 @@ export interface CanvasAction<TValue extends CanvasActionValue = CanvasActionVal
|
|
|
32
32
|
getValue?(context: CanvasActionContext): TValue;
|
|
33
33
|
run(input: CanvasActionRunInput<TValue>): void;
|
|
34
34
|
}
|
|
35
|
+
export interface CanvasActionShortcut {
|
|
36
|
+
actionId: string;
|
|
37
|
+
shortcut: KeyboardShortcutInput;
|
|
38
|
+
}
|
|
39
|
+
export interface CanvasPluginActionSetup {
|
|
40
|
+
add(...actions: readonly CanvasAction[]): void;
|
|
41
|
+
addShortcuts(...shortcuts: readonly CanvasActionShortcut[]): void;
|
|
42
|
+
}
|
|
43
|
+
export declare const canvasActionsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginActionSetup>;
|
|
35
44
|
export declare function resolveCanvasActionAvailability(action: CanvasAction, context: CanvasActionContext): CanvasActionAvailability;
|
|
36
|
-
export declare function createCanvasActionContext({ editor, toolState, selectionState, }: {
|
|
37
|
-
editor: Editor;
|
|
38
|
-
toolState: {
|
|
39
|
-
activeToolId: string;
|
|
40
|
-
isToolLocked: boolean;
|
|
41
|
-
};
|
|
42
|
-
selectionState: {
|
|
43
|
-
count: number;
|
|
44
|
-
singleShapeType: CanvasActionContext["selection"]["singleShapeType"];
|
|
45
|
-
commonShapeType: CanvasActionContext["selection"]["commonShapeType"];
|
|
46
|
-
canFlipSelection: boolean;
|
|
47
|
-
canResetSelectionRotation: boolean;
|
|
48
|
-
isMixedFrameAndPointHandleSelection: boolean;
|
|
49
|
-
};
|
|
50
|
-
}): CanvasActionContext;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CanvasPluginValueToken } from "../canvas-plugin-sdk/index";
|
|
2
|
+
export interface CanvasPluginCapabilityRegistry {
|
|
3
|
+
get<TValue>(token: CanvasPluginValueToken<TValue>): TValue | null;
|
|
4
|
+
}
|
|
5
|
+
export interface CanvasPluginCapabilitySetup extends CanvasPluginCapabilityRegistry {
|
|
6
|
+
provide<TValue>(token: CanvasPluginValueToken<TValue>, value: TValue): void;
|
|
7
|
+
}
|
|
8
|
+
export declare const canvasCapabilitiesExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginCapabilitySetup>;
|
|
@@ -50,3 +50,4 @@ export interface ChromeContribution {
|
|
|
50
50
|
export interface CanvasPluginChromeSetup {
|
|
51
51
|
add(...contributions: readonly ChromeContribution[]): void;
|
|
52
52
|
}
|
|
53
|
+
export declare const canvasChromeExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginChromeSetup>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Editor } from "../canvas-core/index";
|
|
2
|
+
import type { CanvasActionContext } from "./actions";
|
|
3
|
+
import type { ChromeChannel, ChromeSection } from "./chrome";
|
|
4
|
+
export interface CanvasChromeRegistry {
|
|
5
|
+
getChannels(): readonly ChromeChannel[];
|
|
6
|
+
getStateRevision(): number;
|
|
7
|
+
subscribeToState(editor: Editor, listener: () => void): () => void;
|
|
8
|
+
getSections(channel: ChromeChannel, context: CanvasActionContext): ChromeSection[];
|
|
9
|
+
}
|
|
@@ -57,3 +57,7 @@ export interface ContextMenuContribution {
|
|
|
57
57
|
when?(context: ContextMenuContext): boolean;
|
|
58
58
|
getSections(context: ContextMenuContext): readonly ContextMenuSection[];
|
|
59
59
|
}
|
|
60
|
+
export interface CanvasPluginContextMenuSetup {
|
|
61
|
+
add(...contributions: readonly ContextMenuContribution[]): void;
|
|
62
|
+
}
|
|
63
|
+
export declare const canvasContextMenuExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginContextMenuSetup>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CanvasExportArtifact, CanvasExportFormat, CanvasExportProviderInput } from "./exports";
|
|
2
|
+
export interface CanvasExportRegistry {
|
|
3
|
+
getFormats(): readonly CanvasExportFormat[];
|
|
4
|
+
hasFormat(format: string): boolean;
|
|
5
|
+
export(format: string, input: CanvasExportProviderInput): Promise<CanvasExportArtifact>;
|
|
6
|
+
}
|
|
@@ -24,3 +24,4 @@ export interface CanvasExportContribution extends CanvasExportFormat {
|
|
|
24
24
|
export interface CanvasPluginExportSetup {
|
|
25
25
|
add(...contributions: readonly CanvasExportContribution[]): void;
|
|
26
26
|
}
|
|
27
|
+
export declare const canvasExportsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginExportSetup>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { CanvasImportContext, CanvasImportContribution, CanvasImportPreview, CanvasImportRequest, CanvasImportResult } from "./imports";
|
|
2
|
-
export
|
|
3
|
-
private readonly contributions;
|
|
4
|
-
constructor(contributions?: readonly CanvasImportContribution[]);
|
|
2
|
+
export interface CanvasImportRegistry {
|
|
5
3
|
getContributions(): readonly CanvasImportContribution[];
|
|
6
4
|
canImport(request: CanvasImportRequest): boolean;
|
|
7
5
|
canImportPreview(preview: CanvasImportPreview): boolean;
|
|
8
6
|
import(request: CanvasImportRequest, context: CanvasImportContext): Promise<CanvasImportResult>;
|
|
9
7
|
}
|
|
10
|
-
export declare function createCanvasImportRegistry(contributions?: readonly CanvasImportContribution[]): CanvasImportRegistry;
|
|
@@ -36,3 +36,4 @@ export interface CanvasImportContribution {
|
|
|
36
36
|
export interface CanvasPluginImportSetup {
|
|
37
37
|
add(...contributions: readonly CanvasImportContribution[]): void;
|
|
38
38
|
}
|
|
39
|
+
export declare const canvasImportsExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginImportSetup>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./actions";
|
|
2
|
+
export * from "./actionRegistry";
|
|
3
|
+
export * from "./capability";
|
|
4
|
+
export * from "./chrome";
|
|
5
|
+
export * from "./chromeRegistry";
|
|
6
|
+
export * from "./contextMenu";
|
|
7
|
+
export * from "./contextMenuRegistry";
|
|
8
|
+
export * from "./exports";
|
|
9
|
+
export * from "./exportRegistry";
|
|
10
|
+
export * from "./imports";
|
|
11
|
+
export * from "./importRegistry";
|
|
12
|
+
export * from "./productApi";
|
|
13
|
+
export * from "./services";
|
|
14
|
+
export * from "./toolbar";
|
|
15
|
+
export * from "./toolbarRegistry";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Editor, ShapeId } from "../canvas-core/index";
|
|
2
|
-
import
|
|
2
|
+
import { type CanvasPluginCapabilityToken } from "../canvas-plugin-sdk/index";
|
|
3
|
+
import type { CanvasPluginCapabilityRegistry } from "./capability";
|
|
3
4
|
import type { CanvasExportRegistry } from "./exportRegistry";
|
|
4
5
|
export interface ProductApiToken<TApi> extends CanvasPluginCapabilityToken<TApi, "api"> {
|
|
5
6
|
readonly __api?: TApi;
|
|
@@ -7,9 +8,6 @@ export interface ProductApiToken<TApi> extends CanvasPluginCapabilityToken<TApi,
|
|
|
7
8
|
export interface ProductApiRegistry {
|
|
8
9
|
get<TApi>(token: ProductApiToken<TApi>): TApi | null;
|
|
9
10
|
}
|
|
10
|
-
export interface ProductApiRegistryRuntime extends ProductApiRegistry {
|
|
11
|
-
register<TApi>(token: ProductApiToken<TApi>, api: TApi): void;
|
|
12
|
-
}
|
|
13
11
|
export interface CanvasShapeRef<TType extends string = string> {
|
|
14
12
|
id: ShapeId;
|
|
15
13
|
type: TType;
|
|
@@ -24,5 +22,8 @@ export interface CanvasPluginApi<TApi, TContext extends CanvasPluginApiContext =
|
|
|
24
22
|
token: ProductApiToken<TApi>;
|
|
25
23
|
create(context: TContext): TApi | null;
|
|
26
24
|
}
|
|
25
|
+
export interface CanvasPluginApiSetup<TContext extends CanvasPluginApiContext = CanvasPluginApiContext> {
|
|
26
|
+
add<TApi>(api: CanvasPluginApi<TApi, TContext>): void;
|
|
27
|
+
}
|
|
28
|
+
export declare const canvasApisExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<CanvasPluginApiSetup<CanvasPluginApiContext>>;
|
|
27
29
|
export declare function createProductApiToken<TApi>(id: string): ProductApiToken<TApi>;
|
|
28
|
-
export declare function createProductApiRegistry(): ProductApiRegistryRuntime;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CanvasPluginCapabilityToken } from "../canvas-plugin-sdk/index";
|
|
2
2
|
export interface ProductServiceToken<TService> extends CanvasPluginCapabilityToken<TService, "service"> {
|
|
3
3
|
readonly __service?: TService;
|
|
4
4
|
}
|
|
@@ -16,5 +16,6 @@ export interface ProductServiceRegistry {
|
|
|
16
16
|
export interface ProductServiceSetup extends ProductServiceRegistry {
|
|
17
17
|
add<TService>(factory: ProductServiceFactory<TService>): TService;
|
|
18
18
|
}
|
|
19
|
+
export declare const canvasServicesExtension: import("../canvas-plugin-sdk/index").CanvasPluginSetupExtension<ProductServiceSetup>;
|
|
19
20
|
export declare function createProductServiceToken<TService>(id: string): ProductServiceToken<TService>;
|
|
20
21
|
export declare function requireProductService<TService>(services: ProductServiceRegistry, token: ProductServiceToken<TService>): TService;
|