@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.
@@ -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 };