@grida/svg-editor 1.0.0-alpha.1 → 1.0.0-alpha.12
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 +184 -185
- package/dist/chunk-CfYAbeIz.mjs +13 -0
- package/dist/dom-BlMk07oX.mjs +3515 -0
- package/dist/dom-Cvm9Towu.js +3545 -0
- package/dist/dom-DCX-a8Kr.d.ts +57 -0
- package/dist/dom-DgB4f-TE.d.mts +59 -0
- package/dist/dom.d.mts +3 -16
- package/dist/dom.d.ts +3 -16
- package/dist/dom.js +5 -1
- package/dist/dom.mjs +2 -2
- package/dist/editor-BH03X8cX.d.mts +1139 -0
- package/dist/editor-Bd4-VCEJ.d.ts +1139 -0
- package/dist/{editor-DQWUWrVZ.js → editor-CdyC3uAe.js} +1205 -388
- package/dist/{editor-B5z-gTML.mjs → editor-DtuRIs-Q.mjs} +1195 -372
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -2
- package/dist/index.mjs +3 -2
- package/dist/insertions-BJ-6o6o5.js +2399 -0
- package/dist/insertions-Okcuo-Ck.mjs +2176 -0
- package/dist/presets.d.mts +61 -0
- package/dist/presets.d.ts +61 -0
- package/dist/presets.js +61 -0
- package/dist/presets.mjs +55 -0
- package/dist/react.d.mts +94 -9
- package/dist/react.d.ts +94 -9
- package/dist/react.js +157 -19
- package/dist/react.mjs +147 -21
- package/package.json +11 -6
- package/dist/dom-CfP_ZURh.js +0 -963
- package/dist/dom-kA8NDuVh.mjs +0 -929
- package/dist/editor-CTtU2gu4.d.ts +0 -607
- package/dist/editor-JY7AQrR1.d.mts +0 -607
- package/dist/paint-DHq_3iwU.js +0 -509
- package/dist/paint-DuCg6Y-K.mjs +0 -461
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { c as SvgEditor, p as Gestures, s as SurfaceHandle, y as Camera } from "./editor-Bd4-VCEJ.js";
|
|
2
|
+
import cmath from "@grida/cmath";
|
|
3
|
+
//#region src/core/snap/options.d.ts
|
|
4
|
+
type SnapOptions = {
|
|
5
|
+
/** When false, snap behavior and snap-guide rendering are both off. */enabled: boolean;
|
|
6
|
+
/** Snap threshold in HUD canvas pixels (container CSS px in svg-editor;
|
|
7
|
+
* whatever space the consumer feeds in). Constant across zoom because
|
|
8
|
+
* the input rects are already in screen-equivalent units. */
|
|
9
|
+
threshold_px: number;
|
|
10
|
+
};
|
|
11
|
+
declare const DEFAULT_SNAP_OPTIONS: SnapOptions;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/dom.d.ts
|
|
14
|
+
type DomSurfaceOptions = {
|
|
15
|
+
/** Mount the SVG inside this container. */container: HTMLElement;
|
|
16
|
+
/**
|
|
17
|
+
* Install the default gesture set (wheel-pan/zoom, space-drag, middle-mouse,
|
|
18
|
+
* keyboard zoom). Default `true`. Pass `false` to start blank and bind à la
|
|
19
|
+
* carte via `handle.gestures.bind(...)`.
|
|
20
|
+
*/
|
|
21
|
+
gestures?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Auto-fit the document into the viewport on initial attach. Default
|
|
24
|
+
* `false`. Mirrors Excalidraw's `initialData.scrollToContent`.
|
|
25
|
+
* Subsequent `editor.load()` calls do NOT re-fit — call
|
|
26
|
+
* `handle.camera.fit("<root>")` yourself if you want that behavior.
|
|
27
|
+
*/
|
|
28
|
+
fit?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Initial camera transform. Default `cmath.transform.identity`. Ignored
|
|
31
|
+
* when `fit: true`.
|
|
32
|
+
*/
|
|
33
|
+
initial_camera?: cmath.Transform;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Surface handle for the DOM surface. Extends the editor's core
|
|
37
|
+
* `SurfaceHandle` with the viewport-scoped concerns: pan/zoom (`camera`)
|
|
38
|
+
* and pointer/wheel/keyboard gesture bindings (`gestures`).
|
|
39
|
+
*
|
|
40
|
+
* Camera + gestures are **surface-scoped**: detaching the surface drops
|
|
41
|
+
* both. They never appear on the headless `SvgEditor`.
|
|
42
|
+
*/
|
|
43
|
+
type DomSurfaceHandle = SurfaceHandle & {
|
|
44
|
+
camera: Camera;
|
|
45
|
+
gestures: Gestures;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Attach a DOM surface to a headless editor. Returns a `DomSurfaceHandle`
|
|
49
|
+
* whose `detach()` is the inverse — DOM cleared, listeners removed,
|
|
50
|
+
* gestures uninstalled.
|
|
51
|
+
*
|
|
52
|
+
* Usage is one-shot per container: the surface owns the container's children
|
|
53
|
+
* for its lifetime, and `detach()` restores it to empty.
|
|
54
|
+
*/
|
|
55
|
+
declare function attach_dom_surface(editor: SvgEditor, options: DomSurfaceOptions): DomSurfaceHandle;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { SnapOptions as a, DEFAULT_SNAP_OPTIONS as i, DomSurfaceOptions as n, attach_dom_surface as r, DomSurfaceHandle as t };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { c as SvgEditor, p as Gestures, s as SurfaceHandle, y as Camera } from "./editor-BH03X8cX.mjs";
|
|
2
|
+
import cmath from "@grida/cmath";
|
|
3
|
+
import { guide } from "@grida/cmath/_snap";
|
|
4
|
+
|
|
5
|
+
//#region src/core/snap/options.d.ts
|
|
6
|
+
type SnapOptions = {
|
|
7
|
+
/** When false, snap behavior and snap-guide rendering are both off. */enabled: boolean;
|
|
8
|
+
/** Snap threshold in HUD canvas pixels (container CSS px in svg-editor;
|
|
9
|
+
* whatever space the consumer feeds in). Constant across zoom because
|
|
10
|
+
* the input rects are already in screen-equivalent units. */
|
|
11
|
+
threshold_px: number;
|
|
12
|
+
};
|
|
13
|
+
declare const DEFAULT_SNAP_OPTIONS: SnapOptions;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/dom.d.ts
|
|
16
|
+
type DomSurfaceOptions = {
|
|
17
|
+
/** Mount the SVG inside this container. */container: HTMLElement;
|
|
18
|
+
/**
|
|
19
|
+
* Install the default gesture set (wheel-pan/zoom, space-drag, middle-mouse,
|
|
20
|
+
* keyboard zoom). Default `true`. Pass `false` to start blank and bind à la
|
|
21
|
+
* carte via `handle.gestures.bind(...)`.
|
|
22
|
+
*/
|
|
23
|
+
gestures?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Auto-fit the document into the viewport on initial attach. Default
|
|
26
|
+
* `false`. Mirrors Excalidraw's `initialData.scrollToContent`.
|
|
27
|
+
* Subsequent `editor.load()` calls do NOT re-fit — call
|
|
28
|
+
* `handle.camera.fit("<root>")` yourself if you want that behavior.
|
|
29
|
+
*/
|
|
30
|
+
fit?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Initial camera transform. Default `cmath.transform.identity`. Ignored
|
|
33
|
+
* when `fit: true`.
|
|
34
|
+
*/
|
|
35
|
+
initial_camera?: cmath.Transform;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Surface handle for the DOM surface. Extends the editor's core
|
|
39
|
+
* `SurfaceHandle` with the viewport-scoped concerns: pan/zoom (`camera`)
|
|
40
|
+
* and pointer/wheel/keyboard gesture bindings (`gestures`).
|
|
41
|
+
*
|
|
42
|
+
* Camera + gestures are **surface-scoped**: detaching the surface drops
|
|
43
|
+
* both. They never appear on the headless `SvgEditor`.
|
|
44
|
+
*/
|
|
45
|
+
type DomSurfaceHandle = SurfaceHandle & {
|
|
46
|
+
camera: Camera;
|
|
47
|
+
gestures: Gestures;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Attach a DOM surface to a headless editor. Returns a `DomSurfaceHandle`
|
|
51
|
+
* whose `detach()` is the inverse — DOM cleared, listeners removed,
|
|
52
|
+
* gestures uninstalled.
|
|
53
|
+
*
|
|
54
|
+
* Usage is one-shot per container: the surface owns the container's children
|
|
55
|
+
* for its lifetime, and `detach()` restores it to empty.
|
|
56
|
+
*/
|
|
57
|
+
declare function attach_dom_surface(editor: SvgEditor, options: DomSurfaceOptions): DomSurfaceHandle;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { SnapOptions as a, DEFAULT_SNAP_OPTIONS as i, DomSurfaceOptions as n, attach_dom_surface as r, DomSurfaceHandle as t };
|
package/dist/dom.d.mts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type DomSurfaceOptions = {
|
|
5
|
-
/** Mount the SVG inside this container. */container: HTMLElement;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Attach a DOM surface to a headless editor. Returns a `SurfaceHandle` whose
|
|
9
|
-
* `detach()` is the inverse — DOM cleared, listeners removed.
|
|
10
|
-
*
|
|
11
|
-
* Usage is one-shot per container: the surface owns the container's children
|
|
12
|
-
* for its lifetime, and `detach()` restores it to empty.
|
|
13
|
-
*/
|
|
14
|
-
declare function attach_dom_surface(editor: SvgEditor, options: DomSurfaceOptions): SurfaceHandle;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { DomSurfaceOptions, attach_dom_surface };
|
|
1
|
+
import { b as CameraConstraints, d as GestureContext, f as GestureId, g as MemoizedGeometryProvider, h as GeometrySignals, i as DomComputedResolver, m as GeometryProvider, p as Gestures, r as DomComputedPaint, u as GestureBinding, v as BoundsResolver, x as CameraOptions, y as Camera } from "./editor-BH03X8cX.mjs";
|
|
2
|
+
import { a as SnapOptions, i as DEFAULT_SNAP_OPTIONS, n as DomSurfaceOptions, r as attach_dom_surface, t as DomSurfaceHandle } from "./dom-DgB4f-TE.mjs";
|
|
3
|
+
export { BoundsResolver, Camera, CameraConstraints, CameraOptions, DEFAULT_SNAP_OPTIONS, DomComputedPaint, DomComputedResolver, DomSurfaceHandle, DomSurfaceOptions, GeometryProvider, GeometrySignals, GestureBinding, GestureContext, GestureId, Gestures, MemoizedGeometryProvider, SnapOptions, attach_dom_surface };
|
package/dist/dom.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type DomSurfaceOptions = {
|
|
5
|
-
/** Mount the SVG inside this container. */container: HTMLElement;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Attach a DOM surface to a headless editor. Returns a `SurfaceHandle` whose
|
|
9
|
-
* `detach()` is the inverse — DOM cleared, listeners removed.
|
|
10
|
-
*
|
|
11
|
-
* Usage is one-shot per container: the surface owns the container's children
|
|
12
|
-
* for its lifetime, and `detach()` restores it to empty.
|
|
13
|
-
*/
|
|
14
|
-
declare function attach_dom_surface(editor: SvgEditor, options: DomSurfaceOptions): SurfaceHandle;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { DomSurfaceOptions, attach_dom_surface };
|
|
1
|
+
import { b as CameraConstraints, d as GestureContext, f as GestureId, g as MemoizedGeometryProvider, h as GeometrySignals, i as DomComputedResolver, m as GeometryProvider, p as Gestures, r as DomComputedPaint, u as GestureBinding, v as BoundsResolver, x as CameraOptions, y as Camera } from "./editor-Bd4-VCEJ.js";
|
|
2
|
+
import { a as SnapOptions, i as DEFAULT_SNAP_OPTIONS, n as DomSurfaceOptions, r as attach_dom_surface, t as DomSurfaceHandle } from "./dom-DCX-a8Kr.js";
|
|
3
|
+
export { BoundsResolver, Camera, CameraConstraints, CameraOptions, DEFAULT_SNAP_OPTIONS, DomComputedPaint, DomComputedResolver, DomSurfaceHandle, DomSurfaceOptions, GeometryProvider, GeometrySignals, GestureBinding, GestureContext, GestureId, Gestures, MemoizedGeometryProvider, SnapOptions, attach_dom_surface };
|
package/dist/dom.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_dom = require("./dom-
|
|
2
|
+
const require_dom = require("./dom-Cvm9Towu.js");
|
|
3
|
+
exports.Camera = require_dom.Camera;
|
|
4
|
+
exports.DEFAULT_SNAP_OPTIONS = require_dom.DEFAULT_SNAP_OPTIONS;
|
|
5
|
+
exports.Gestures = require_dom.Gestures;
|
|
6
|
+
exports.MemoizedGeometryProvider = require_dom.MemoizedGeometryProvider;
|
|
3
7
|
exports.attach_dom_surface = require_dom.attach_dom_surface;
|
package/dist/dom.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as attach_dom_surface } from "./dom-
|
|
2
|
-
export { attach_dom_surface };
|
|
1
|
+
import { a as Camera, i as MemoizedGeometryProvider, n as Gestures, r as DEFAULT_SNAP_OPTIONS, t as attach_dom_surface } from "./dom-BlMk07oX.mjs";
|
|
2
|
+
export { Camera, DEFAULT_SNAP_OPTIONS, Gestures, MemoizedGeometryProvider, attach_dom_surface };
|