@grida/svg-editor 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +213 -5
- package/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/{dom-kA8NDuVh.mjs → dom-CmOu0HvI.mjs} +701 -7
- package/dist/dom-Cn-RtjRL.d.ts +48 -0
- package/dist/{dom-CfP_ZURh.js → dom-CoVZzFqy.js} +716 -7
- package/dist/dom-DJnZhtOd.d.mts +48 -0
- package/dist/dom.d.mts +2 -16
- package/dist/dom.d.ts +2 -16
- package/dist/dom.js +1 -1
- package/dist/dom.mjs +1 -1
- package/dist/{editor-M6j8XGO5.mjs → editor-CjK56cgb.mjs} +11 -11
- package/dist/{editor-BryibVvr.d.mts → editor-D2l_CDr0.d.ts} +314 -108
- package/dist/{editor-DllAMsDu.js → editor-D2zZAyny.js} +13 -13
- package/dist/{editor-klT8wu-x.d.ts → editor-Uu6dZX4y.d.mts} +314 -108
- package/dist/index-CHiXYO9-.d.ts +1 -0
- package/dist/index-ThDLM4Am.d.mts +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{paint-DuCg6Y-K.mjs → paint-Cfiw4g_J.mjs} +17 -1
- package/dist/{paint-DHq_3iwU.js → paint-dDV-Trt9.js} +23 -1
- package/dist/presets.d.mts +46 -0
- package/dist/presets.d.ts +46 -0
- package/dist/presets.js +55 -0
- package/dist/presets.mjs +50 -0
- package/dist/react.d.mts +49 -6
- package/dist/react.d.ts +49 -6
- package/dist/react.js +49 -9
- package/dist/react.mjs +49 -10
- package/package.json +9 -4
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { a as SurfaceHandle, d as Gestures, g as Camera, o as SvgEditor } from "./editor-D2l_CDr0.js";
|
|
2
|
+
import cmath from "@grida/cmath";
|
|
3
|
+
|
|
4
|
+
//#region src/dom.d.ts
|
|
5
|
+
type DomSurfaceOptions = {
|
|
6
|
+
/** Mount the SVG inside this container. */container: HTMLElement;
|
|
7
|
+
/**
|
|
8
|
+
* Install the default gesture set (wheel-pan/zoom, space-drag, middle-mouse,
|
|
9
|
+
* keyboard zoom). Default `true`. Pass `false` to start blank and bind à la
|
|
10
|
+
* carte via `handle.gestures.bind(...)`.
|
|
11
|
+
*/
|
|
12
|
+
gestures?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Auto-fit the document into the viewport on initial attach. Default
|
|
15
|
+
* `false`. Mirrors Excalidraw's `initialData.scrollToContent`.
|
|
16
|
+
* Subsequent `editor.load()` calls do NOT re-fit — call
|
|
17
|
+
* `handle.camera.fit("<root>")` yourself if you want that behavior.
|
|
18
|
+
*/
|
|
19
|
+
fit?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Initial camera transform. Default `cmath.transform.identity`. Ignored
|
|
22
|
+
* when `fit: true`.
|
|
23
|
+
*/
|
|
24
|
+
initial_camera?: cmath.Transform;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Surface handle for the DOM surface. Extends the editor's core
|
|
28
|
+
* `SurfaceHandle` with the viewport-scoped concerns: pan/zoom (`camera`)
|
|
29
|
+
* and pointer/wheel/keyboard gesture bindings (`gestures`).
|
|
30
|
+
*
|
|
31
|
+
* Camera + gestures are **surface-scoped**: detaching the surface drops
|
|
32
|
+
* both. They never appear on the headless `SvgEditor`.
|
|
33
|
+
*/
|
|
34
|
+
type DomSurfaceHandle = SurfaceHandle & {
|
|
35
|
+
camera: Camera;
|
|
36
|
+
gestures: Gestures;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Attach a DOM surface to a headless editor. Returns a `DomSurfaceHandle`
|
|
40
|
+
* whose `detach()` is the inverse — DOM cleared, listeners removed,
|
|
41
|
+
* gestures uninstalled.
|
|
42
|
+
*
|
|
43
|
+
* Usage is one-shot per container: the surface owns the container's children
|
|
44
|
+
* for its lifetime, and `detach()` restores it to empty.
|
|
45
|
+
*/
|
|
46
|
+
declare function attach_dom_surface(editor: SvgEditor, options: DomSurfaceOptions): DomSurfaceHandle;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { DomSurfaceOptions as n, attach_dom_surface as r, DomSurfaceHandle as t };
|