@bensitu/image-editor 2.0.0 → 2.2.0
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 +346 -90
- package/dist/cjs/index.cjs +4883 -1191
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/animation/animation-queue.js +16 -9
- package/dist/esm/animation/animation-queue.js.map +1 -1
- package/dist/esm/annotation/annotation-lock.js +7 -0
- package/dist/esm/annotation/annotation-lock.js.map +1 -0
- package/dist/esm/annotation/annotation-manager.js +217 -0
- package/dist/esm/annotation/annotation-manager.js.map +1 -0
- package/dist/esm/annotation/annotation-style.js +50 -0
- package/dist/esm/annotation/annotation-style.js.map +1 -0
- package/dist/esm/annotation/draw-controller.js +114 -0
- package/dist/esm/annotation/draw-controller.js.map +1 -0
- package/dist/esm/annotation/text-controller.js +234 -0
- package/dist/esm/annotation/text-controller.js.map +1 -0
- package/dist/esm/core/default-options.js +447 -11
- package/dist/esm/core/default-options.js.map +1 -1
- package/dist/esm/core/editor-object-kind.js +37 -0
- package/dist/esm/core/editor-object-kind.js.map +1 -0
- package/dist/esm/core/errors.js +19 -0
- package/dist/esm/core/errors.js.map +1 -1
- package/dist/esm/core/layer-order.js +100 -0
- package/dist/esm/core/layer-order.js.map +1 -0
- package/dist/esm/core/operation-guard.js +28 -0
- package/dist/esm/core/operation-guard.js.map +1 -1
- package/dist/esm/core/public-types.js +34 -1
- package/dist/esm/core/public-types.js.map +1 -1
- package/dist/esm/core/state-serializer.js +108 -27
- package/dist/esm/core/state-serializer.js.map +1 -1
- package/dist/esm/crop/crop-controller.js +6 -2
- package/dist/esm/crop/crop-controller.js.map +1 -1
- package/dist/esm/export/export-format.js.map +1 -1
- package/dist/esm/export/export-service.js +140 -141
- package/dist/esm/export/export-service.js.map +1 -1
- package/dist/esm/export/overlay-merge-service.js +75 -0
- package/dist/esm/export/overlay-merge-service.js.map +1 -0
- package/dist/esm/fabric/fabric-animation.js +56 -4
- package/dist/esm/fabric/fabric-animation.js.map +1 -1
- package/dist/esm/history/history-manager.js +2 -2
- package/dist/esm/history/history-manager.js.map +1 -1
- package/dist/esm/image/image-loader.js +27 -65
- package/dist/esm/image/image-loader.js.map +1 -1
- package/dist/esm/image/image-resampler.js +7 -2
- package/dist/esm/image/image-resampler.js.map +1 -1
- package/dist/esm/image/layout-manager.js +2 -20
- package/dist/esm/image/layout-manager.js.map +1 -1
- package/dist/esm/image/transform-controller.js.map +1 -1
- package/dist/esm/image-editor.js +1474 -135
- package/dist/esm/image-editor.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mask/mask-factory.js +92 -43
- package/dist/esm/mask/mask-factory.js.map +1 -1
- package/dist/esm/mask/mask-label-manager.js +2 -0
- package/dist/esm/mask/mask-label-manager.js.map +1 -1
- package/dist/esm/mask/mask-list.js +9 -3
- package/dist/esm/mask/mask-list.js.map +1 -1
- package/dist/esm/mask/mask-style.js.map +1 -1
- package/dist/esm/mosaic/mosaic-controller.js +666 -0
- package/dist/esm/mosaic/mosaic-controller.js.map +1 -0
- package/dist/esm/mosaic/mosaic-geometry.js +81 -0
- package/dist/esm/mosaic/mosaic-geometry.js.map +1 -0
- package/dist/esm/mosaic/mosaic-pixelate.js +71 -0
- package/dist/esm/mosaic/mosaic-pixelate.js.map +1 -0
- package/dist/esm/ui/dom-bindings.js +10 -3
- package/dist/esm/ui/dom-bindings.js.map +1 -1
- package/dist/esm/utils/image-element-loader.js +55 -0
- package/dist/esm/utils/image-element-loader.js.map +1 -0
- package/dist/esm/utils/number.js.map +1 -1
- package/dist/esm/utils/pointer.js +28 -0
- package/dist/esm/utils/pointer.js.map +1 -0
- package/dist/types/animation/animation-queue.d.ts.map +1 -1
- package/dist/types/annotation/annotation-lock.d.ts +12 -0
- package/dist/types/annotation/annotation-lock.d.ts.map +1 -0
- package/dist/types/annotation/annotation-manager.d.ts +33 -0
- package/dist/types/annotation/annotation-manager.d.ts.map +1 -0
- package/dist/types/annotation/annotation-style.d.ts +13 -0
- package/dist/types/annotation/annotation-style.d.ts.map +1 -0
- package/dist/types/annotation/draw-controller.d.ts +43 -0
- package/dist/types/annotation/draw-controller.d.ts.map +1 -0
- package/dist/types/annotation/text-controller.d.ts +47 -0
- package/dist/types/annotation/text-controller.d.ts.map +1 -0
- package/dist/types/core/default-options.d.ts +46 -6
- package/dist/types/core/default-options.d.ts.map +1 -1
- package/dist/types/core/editor-object-kind.d.ts +29 -0
- package/dist/types/core/editor-object-kind.d.ts.map +1 -0
- package/dist/types/core/errors.d.ts +12 -2
- package/dist/types/core/errors.d.ts.map +1 -1
- package/dist/types/core/layer-order.d.ts +21 -0
- package/dist/types/core/layer-order.d.ts.map +1 -0
- package/dist/types/core/operation-guard.d.ts +2 -0
- package/dist/types/core/operation-guard.d.ts.map +1 -1
- package/dist/types/core/public-types.d.ts +341 -33
- package/dist/types/core/public-types.d.ts.map +1 -1
- package/dist/types/core/state-serializer.d.ts +32 -5
- package/dist/types/core/state-serializer.d.ts.map +1 -1
- package/dist/types/crop/crop-controller.d.ts +6 -7
- package/dist/types/crop/crop-controller.d.ts.map +1 -1
- package/dist/types/export/export-format.d.ts +5 -33
- package/dist/types/export/export-format.d.ts.map +1 -1
- package/dist/types/export/export-service.d.ts +24 -15
- package/dist/types/export/export-service.d.ts.map +1 -1
- package/dist/types/export/overlay-merge-service.d.ts +38 -0
- package/dist/types/export/overlay-merge-service.d.ts.map +1 -0
- package/dist/types/fabric/fabric-animation.d.ts.map +1 -1
- package/dist/types/history/history-manager.d.ts +11 -14
- package/dist/types/history/history-manager.d.ts.map +1 -1
- package/dist/types/image/image-loader.d.ts +24 -21
- package/dist/types/image/image-loader.d.ts.map +1 -1
- package/dist/types/image/image-resampler.d.ts +2 -2
- package/dist/types/image/image-resampler.d.ts.map +1 -1
- package/dist/types/image/layout-manager.d.ts +5 -49
- package/dist/types/image/layout-manager.d.ts.map +1 -1
- package/dist/types/image/transform-controller.d.ts +6 -9
- package/dist/types/image/transform-controller.d.ts.map +1 -1
- package/dist/types/image-editor.d.ts +93 -14
- package/dist/types/image-editor.d.ts.map +1 -1
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mask/mask-factory.d.ts +24 -21
- package/dist/types/mask/mask-factory.d.ts.map +1 -1
- package/dist/types/mask/mask-label-manager.d.ts +10 -9
- package/dist/types/mask/mask-label-manager.d.ts.map +1 -1
- package/dist/types/mask/mask-list.d.ts +11 -12
- package/dist/types/mask/mask-list.d.ts.map +1 -1
- package/dist/types/mask/mask-style.d.ts +19 -20
- package/dist/types/mask/mask-style.d.ts.map +1 -1
- package/dist/types/mosaic/mosaic-controller.d.ts +82 -0
- package/dist/types/mosaic/mosaic-controller.d.ts.map +1 -0
- package/dist/types/mosaic/mosaic-geometry.d.ts +29 -0
- package/dist/types/mosaic/mosaic-geometry.d.ts.map +1 -0
- package/dist/types/mosaic/mosaic-pixelate.d.ts +23 -0
- package/dist/types/mosaic/mosaic-pixelate.d.ts.map +1 -0
- package/dist/types/ui/dom-bindings.d.ts +3 -1
- package/dist/types/ui/dom-bindings.d.ts.map +1 -1
- package/dist/types/ui/visibility-state.d.ts +2 -2
- package/dist/types/utils/image-element-loader.d.ts +19 -0
- package/dist/types/utils/image-element-loader.d.ts.map +1 -0
- package/dist/types/utils/number.d.ts +1 -2
- package/dist/types/utils/number.d.ts.map +1 -1
- package/dist/types/utils/pointer.d.ts +16 -0
- package/dist/types/utils/pointer.d.ts.map +1 -0
- package/dist/umd/image-editor.umd.js +1 -1
- package/dist/umd/image-editor.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mask list DOM rendering
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Mask list DOM rendering and click-to-select behavior.
|
|
3
|
+
*
|
|
4
|
+
* The ImageEditor facade owns canvas selection state; this module rebuilds
|
|
5
|
+
* the list from the current canvas objects and reports user selection through
|
|
5
6
|
* {@link MaskListContext}.
|
|
6
7
|
*
|
|
7
8
|
* ## Owned contracts
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
* - Every `<li>` carries a `data-mask-id` attribute
|
|
16
17
|
* (via `dataset.maskId`) equal to the mask's `maskId`. Clients keying off
|
|
17
18
|
* the list (the click handler below, the test suite under
|
|
18
|
-
* `tests/
|
|
19
|
+
* `tests/mask-list-dom.property.test.mjs`) MUST use this attribute and
|
|
19
20
|
* never the visible label text — the label may be rewritten by the
|
|
20
21
|
* integrator via `options.label.getText`, so it is NOT a stable key.
|
|
21
22
|
*
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
* tested in isolation against a stub Fabric environment plus a JSDOM
|
|
45
46
|
* container.
|
|
46
47
|
* - The DOM contract — `<li class="list-group-item mask-item">` with a
|
|
47
|
-
* `dataset.maskId` —
|
|
48
|
-
*
|
|
48
|
+
* `dataset.maskId` — is stable so existing CSS, theme overrides, and
|
|
49
|
+
* integrator selectors continue to work unchanged.
|
|
49
50
|
* - Each render replaces the container's `innerHTML`. That is intentional:
|
|
50
51
|
* it guarantees the DOM mirrors `canvas.getObjects` exactly, and the
|
|
51
52
|
* Fabric event handlers (`object:added`, `object:removed`, `selection:*`)
|
|
@@ -62,8 +63,7 @@ import type { MaskObject } from '../core/public-types.js';
|
|
|
62
63
|
*
|
|
63
64
|
* The module does NOT own any of these slots — it only reads them so
|
|
64
65
|
* ownership of the canvas, the resolved DOM element ID map, and the
|
|
65
|
-
* selection-changed pipeline stays on the orchestrator
|
|
66
|
-
* them).
|
|
66
|
+
* selection-changed pipeline stays on the orchestrator.
|
|
67
67
|
*/
|
|
68
68
|
export interface MaskListContext {
|
|
69
69
|
/**
|
|
@@ -82,8 +82,7 @@ export interface MaskListContext {
|
|
|
82
82
|
* Invoked by the click handler after `setActiveObject(mask)` has run,
|
|
83
83
|
* so the orchestrator can drive its selection-changed pipeline (label
|
|
84
84
|
* overlay, hover/selection styling, list highlight) the same way it
|
|
85
|
-
* does for canvas-originated selections.
|
|
86
|
-
* `_handleSelectionChanged([mask])` call from `_handleMaskListClick`.
|
|
85
|
+
* does for canvas-originated selections.
|
|
87
86
|
*/
|
|
88
87
|
onMaskSelected(mask: MaskObject): void;
|
|
89
88
|
}
|
|
@@ -105,8 +104,8 @@ export interface MaskListContext {
|
|
|
105
104
|
* listener bookkeeping to track separately.
|
|
106
105
|
* 3. For each {@link MaskObject} returned by `canvas.getObjects` (in
|
|
107
106
|
* canvas object order), build a fresh `<li>`:
|
|
108
|
-
* - class `list-group-item mask-item` (
|
|
109
|
-
* existing CSS keeps working);
|
|
107
|
+
* - class `list-group-item mask-item` (part of the stable DOM
|
|
108
|
+
* contract so existing CSS keeps working);
|
|
110
109
|
* - `textContent` set to `mask.maskName` (the label-text contract
|
|
111
110
|
* owned by `mask/mask-label-manager.ts`; this list shows the same
|
|
112
111
|
* identifier);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-list.d.ts","sourceRoot":"","sources":["../../../src/mask/mask-list.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mask-list.d.ts","sourceRoot":"","sources":["../../../src/mask/mask-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC5B;;;;OAIG;IACH,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;IAC/B;;;;OAIG;IACH,gBAAgB,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9C;;;;;OAKG;IACH,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;CAC1C;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CA2C7D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CACnC,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,UAAU,GAAG,IAAI,GAChC,IAAI,CAWN"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hover, selection, and "original style restore" helpers for
|
|
3
|
-
* mask visual state.
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* mask visual state.
|
|
4
|
+
*
|
|
5
|
+
* The ImageEditor facade owns canvas state; this module receives the live
|
|
6
|
+
* canvas and resolved options through {@link MaskStyleContext} so mask
|
|
7
|
+
* visual behavior stays centralized.
|
|
8
8
|
*
|
|
9
9
|
* Two callers consume the same backup shape:
|
|
10
10
|
*
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* Centralizing the backup shape, the hover style literals (`#ff5500`,
|
|
22
22
|
* `strokeWidth: 2`, `opacity = originalAlpha + 0.2`), and the
|
|
23
23
|
* selected/unselected stroke literals (`#ff0000`, `mask.originalStroke ||
|
|
24
|
-
* '#ccc'`) here
|
|
25
|
-
*
|
|
24
|
+
* '#ccc'`) here keeps mask visuals consistent and any future tweak in one
|
|
25
|
+
* place.
|
|
26
26
|
*
|
|
27
27
|
* ## Owned contracts
|
|
28
28
|
*
|
|
@@ -51,18 +51,17 @@
|
|
|
51
51
|
* and `lockRotation` from the captured {@link MaskBackup}, matching the current
|
|
52
52
|
* documented `MaskBackup` interface.
|
|
53
53
|
*
|
|
54
|
-
* - **
|
|
55
|
-
* {@link reattachMaskHoverHandlers} bind
|
|
56
|
-
* handlers
|
|
54
|
+
* - **Hover behavior** — {@link attachMaskHoverHandlers} and
|
|
55
|
+
* {@link reattachMaskHoverHandlers} bind `mouseover`/`mouseout`
|
|
56
|
+
* handlers that read
|
|
57
57
|
* `mask.originalAlpha` / `mask.originalStroke` / `mask.originalStrokeWidth`
|
|
58
58
|
* on each invocation so they always reflect the current "live" state
|
|
59
59
|
* (e.g. after a stroke change from a selection event).
|
|
60
60
|
*
|
|
61
|
-
* - **
|
|
61
|
+
* - **Selection styling** — {@link applyMaskSelectedStyle} sets
|
|
62
62
|
* the selection-highlight stroke (`#ff0000`, `strokeWidth: 1`) and
|
|
63
63
|
* {@link applyMaskUnselectedStyle} restores the normal stroke from the
|
|
64
|
-
* per-mask `originalStroke` / `originalStrokeWidth`.
|
|
65
|
-
* legacy's `_handleSelectionChanged`.
|
|
64
|
+
* per-mask `originalStroke` / `originalStrokeWidth`.
|
|
66
65
|
*
|
|
67
66
|
* ## Out of scope (handled by sibling modules)
|
|
68
67
|
*
|
|
@@ -81,10 +80,11 @@
|
|
|
81
80
|
* - Hover handlers do NOT cache the normal/hover style at attach time. They
|
|
82
81
|
* read `mask.originalAlpha` / `mask.originalStroke` / `mask.originalStrokeWidth`
|
|
83
82
|
* on every event so the visual matches the live "original" values even
|
|
84
|
-
* after a stroke or opacity change
|
|
83
|
+
* after a stroke or opacity change.
|
|
85
84
|
* - The handlers are tagged on `mask.imageEditorMaskHandlers` exactly as
|
|
86
|
-
*
|
|
87
|
-
* binding fresh ones, avoiding duplicate listeners after
|
|
85
|
+
* {@link reattachMaskHoverHandlers} expects so it can drop the old pair
|
|
86
|
+
* before binding fresh ones, avoiding duplicate listeners after
|
|
87
|
+
* `loadFromJSON`.
|
|
88
88
|
*
|
|
89
89
|
* @module
|
|
90
90
|
*/
|
|
@@ -94,8 +94,7 @@ import type { MaskBackup, MaskObject, ResolvedOptions } from '../core/public-typ
|
|
|
94
94
|
* State the mask-style helpers read from the `ImageEditor` orchestrator.
|
|
95
95
|
*
|
|
96
96
|
* The module does NOT own any of these slots — it only reads them so
|
|
97
|
-
* ownership of the canvas and resolved options stays on the orchestrator
|
|
98
|
-
* (where legacy left them).
|
|
97
|
+
* ownership of the canvas and resolved options stays on the orchestrator.
|
|
99
98
|
*/
|
|
100
99
|
export interface MaskStyleContext {
|
|
101
100
|
/**
|
|
@@ -202,8 +201,8 @@ export declare function attachMaskHoverHandlers(mask: MaskObject): void;
|
|
|
202
201
|
* Also re-asserts the persisted `original*` metadata when missing — legacy's
|
|
203
202
|
* `_rebindMaskEvents` did the same so a snapshot from an older format that
|
|
204
203
|
* happens to lack `originalStroke`/`originalStrokeWidth` still hovers
|
|
205
|
-
* correctly.
|
|
206
|
-
*
|
|
204
|
+
* correctly. Current snapshots always serialize `originalAlpha`, but we
|
|
205
|
+
* defend against partial payloads here too.
|
|
207
206
|
*
|
|
208
207
|
* @param mask - The mask to refresh handlers on.
|
|
209
208
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mask-style.d.ts","sourceRoot":"","sources":["../../../src/mask/mask-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAwBvF
|
|
1
|
+
{"version":3,"file":"mask-style.d.ts","sourceRoot":"","sources":["../../../src/mask/mask-style.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAwBvF;;;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EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAiC3F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACvC,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EAClD,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAiBZ;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAM7D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mosaic mode controller.
|
|
3
|
+
*
|
|
4
|
+
* Owns the Mosaic session lifecycle, preview objects, Fabric pointer handlers,
|
|
5
|
+
* and the base-image pixel replacement pipeline. The ImageEditor facade owns
|
|
6
|
+
* canonical editor state and passes it in through the context callbacks.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type * as FabricNS from 'fabric';
|
|
11
|
+
import type { BaseImageObject, FabricModule, ImageEditorCallbackContext, ImageEditorOperation, ImageMimeType, ResolvedMosaicConfig, ResolvedOptions } from '../core/public-types.js';
|
|
12
|
+
import { type HistoryManager } from '../history/history-manager.js';
|
|
13
|
+
import { type MosaicImagePoint } from './mosaic-geometry.js';
|
|
14
|
+
interface MosaicPreviewCircle extends FabricNS.Circle {
|
|
15
|
+
isMosaicPreview?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface MosaicPreviewImage extends FabricNS.FabricImage {
|
|
18
|
+
isMosaicPreview?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface MosaicSession {
|
|
21
|
+
previewCircle: MosaicPreviewCircle | null;
|
|
22
|
+
previewImage: MosaicPreviewImage | null;
|
|
23
|
+
prevSelection: boolean;
|
|
24
|
+
prevDefaultCursor: string | undefined;
|
|
25
|
+
prevObjectStates: Array<{
|
|
26
|
+
object: FabricNS.FabricObject;
|
|
27
|
+
evented: boolean;
|
|
28
|
+
selectable: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
handlers: Array<{
|
|
31
|
+
eventName: string;
|
|
32
|
+
callback: (event: unknown) => void;
|
|
33
|
+
}>;
|
|
34
|
+
rasterCache: MosaicRasterCache | null;
|
|
35
|
+
pendingCanvasPoints: Array<{
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}>;
|
|
39
|
+
isPointerDown: boolean;
|
|
40
|
+
isApplying: boolean;
|
|
41
|
+
commitRequested: boolean;
|
|
42
|
+
hasUncommittedChanges: boolean;
|
|
43
|
+
lastImagePoint: MosaicImagePoint | null;
|
|
44
|
+
}
|
|
45
|
+
export interface MosaicControllerContext {
|
|
46
|
+
readonly fabric: FabricModule;
|
|
47
|
+
readonly canvas: FabricNS.Canvas;
|
|
48
|
+
readonly options: ResolvedOptions;
|
|
49
|
+
readonly historyManager: HistoryManager;
|
|
50
|
+
getMosaicConfig(): ResolvedMosaicConfig;
|
|
51
|
+
isImageLoaded(): boolean;
|
|
52
|
+
getOriginalImage(): BaseImageObject | null;
|
|
53
|
+
setOriginalImage(image: BaseImageObject | null): void;
|
|
54
|
+
getCurrentImageMimeType(): ImageMimeType | null;
|
|
55
|
+
setCurrentImageMimeType(mimeType: ImageMimeType | null): void;
|
|
56
|
+
getLastSnapshot(): string | null;
|
|
57
|
+
setLastSnapshot(snapshot: string | null): void;
|
|
58
|
+
captureSnapshot(): string;
|
|
59
|
+
loadFromState(snapshot: string): Promise<void>;
|
|
60
|
+
updateUi(): void;
|
|
61
|
+
updateInputs(): void;
|
|
62
|
+
hideAllMaskLabels(): void;
|
|
63
|
+
emitImageChanged(context: ImageEditorCallbackContext): void;
|
|
64
|
+
emitBusyChangeIfChanged(context: ImageEditorCallbackContext): void;
|
|
65
|
+
buildCallbackContext(operation: ImageEditorOperation, isInternal?: boolean): ImageEditorCallbackContext;
|
|
66
|
+
getMosaicSession(): MosaicSession | null;
|
|
67
|
+
setMosaicSession(session: MosaicSession | null): void;
|
|
68
|
+
}
|
|
69
|
+
interface MosaicRasterCache {
|
|
70
|
+
offscreenCanvas: HTMLCanvasElement;
|
|
71
|
+
renderingContext: CanvasRenderingContext2D;
|
|
72
|
+
imageData: ImageData;
|
|
73
|
+
source: string;
|
|
74
|
+
width: number;
|
|
75
|
+
height: number;
|
|
76
|
+
}
|
|
77
|
+
export declare function enterMosaicMode(context: MosaicControllerContext): void;
|
|
78
|
+
export declare function exitMosaicMode(context: MosaicControllerContext): void;
|
|
79
|
+
export declare function updateMosaicPreview(context: MosaicControllerContext): void;
|
|
80
|
+
export declare function isMosaicPreviewObject(object: FabricNS.FabricObject): boolean;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=mosaic-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mosaic-controller.d.ts","sourceRoot":"","sources":["../../../src/mosaic/mosaic-controller.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AAIxC,OAAO,KAAK,EACR,eAAe,EACf,YAAY,EACZ,0BAA0B,EAC1B,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,eAAe,EAClB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAI7E,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAGlF,UAAU,mBAAoB,SAAQ,QAAQ,CAAC,MAAM;IACjD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,UAAU,kBAAmB,SAAQ,QAAQ,CAAC,WAAW;IACrD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MA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+1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canvas-to-source-image coordinate conversion for Mosaic mode.
|
|
3
|
+
*
|
|
4
|
+
* Fabric object bounding boxes are not sufficient for rotated images. These
|
|
5
|
+
* helpers invert the image transform matrix and convert the pointer into the
|
|
6
|
+
* image's natural pixel coordinate space.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type * as FabricNS from 'fabric';
|
|
11
|
+
import type { FabricModule } from '../core/public-types.js';
|
|
12
|
+
export interface MosaicImagePoint {
|
|
13
|
+
sourceX: number;
|
|
14
|
+
sourceY: number;
|
|
15
|
+
sourceRadius: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert a Fabric canvas pointer into source-image pixels.
|
|
19
|
+
*
|
|
20
|
+
* For non-uniform image scale, `sourceRadius` uses the smaller canvas scale
|
|
21
|
+
* axis, which yields the larger source-space radius. This conservative
|
|
22
|
+
* deterministic strategy ensures the circular canvas brush covers the clicked
|
|
23
|
+
* image area after inverse transformation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getMosaicImagePoint(fabric: FabricModule, image: FabricNS.FabricImage, canvasPoint: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}, brushDiameterCanvasPx: number): MosaicImagePoint | null;
|
|
29
|
+
//# sourceMappingURL=mosaic-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mosaic-geometry.d.ts","sourceRoot":"","sources":["../../../src/mosaic/mosaic-geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACxB;AAwED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,QAAQ,CAAC,WAAW,EAC3B,WAAW,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,qBAAqB,EAAE,MAAM,GAC9B,gBAAgB,GAAG,IAAI,CAmCzB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure pixelation helpers for Mosaic mode.
|
|
3
|
+
*
|
|
4
|
+
* The helpers mutate caller-supplied ImageData in place and do not touch DOM
|
|
5
|
+
* or Fabric state, which keeps the algorithm deterministic and directly
|
|
6
|
+
* testable.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export interface MosaicPixelateOptions {
|
|
11
|
+
imageData: ImageData;
|
|
12
|
+
centerX: number;
|
|
13
|
+
centerY: number;
|
|
14
|
+
radius: number;
|
|
15
|
+
blockSize: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Applies blocky pixelation inside a circular brush region.
|
|
19
|
+
*
|
|
20
|
+
* @returns `true` when at least one pixel was processed, otherwise `false`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyCircularMosaicToImageData(options: MosaicPixelateOptions): boolean;
|
|
23
|
+
//# sourceMappingURL=mosaic-pixelate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mosaic-pixelate.d.ts","sourceRoot":"","sources":["../../../src/mosaic/mosaic-pixelate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,qBAAqB;IAClC,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAsBD;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAiEtF"}
|
|
@@ -64,6 +64,7 @@ export declare class DomBindings {
|
|
|
64
64
|
private registry;
|
|
65
65
|
private readonly resolveElementId;
|
|
66
66
|
private readonly isDisposed;
|
|
67
|
+
private readonly resolveDocument;
|
|
67
68
|
/**
|
|
68
69
|
* @param resolveElementId - Returns the resolved DOM element ID for a given logical key, or a
|
|
69
70
|
* falsy value when the integrator omitted that key from the `idMap`.
|
|
@@ -71,8 +72,9 @@ export declare class DomBindings {
|
|
|
71
72
|
* @param isDisposed - Returns the editor's current `isDisposed` flag. Bound handlers
|
|
72
73
|
* consult this on every dispatch and exit early when it returns
|
|
73
74
|
* `true`.
|
|
75
|
+
* @param resolveDocument - Returns the document that owns the bound controls.
|
|
74
76
|
*/
|
|
75
|
-
constructor(resolveElementId: (key: ElementKey) => string | null | undefined, isDisposed: () => boolean);
|
|
77
|
+
constructor(resolveElementId: (key: ElementKey) => string | null | undefined, isDisposed: () => boolean, resolveDocument?: () => Document);
|
|
76
78
|
/**
|
|
77
79
|
* Look up the element registered under `key`. If it exists, attach
|
|
78
80
|
* `handler` for `eventType` and record the binding so `removeAll` can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-bindings.d.ts","sourceRoot":"","sources":["../../../src/ui/dom-bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;AActD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAiD;IAClF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;
|
|
1
|
+
{"version":3,"file":"dom-bindings.d.ts","sourceRoot":"","sources":["../../../src/ui/dom-bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC;AActD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAiD;IAClF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgB;IAC3C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAEjD;;;;;;;;OAQG;gBAEC,gBAAgB,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,EAChE,UAAU,EAAE,MAAM,OAAO,EACzB,eAAe,GAAE,MAAM,QAAyB;IAOpD;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO;IAmBjF;;;;;;OAMG;IACH,SAAS,IAAI,IAAI;IAgBjB;;;OAGG;IACH,IAAI,IAAI,MAAM;CAGjB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Placeholder/canvas-container visibility helper. Owns the
|
|
3
|
-
* standard-DOM-state transition
|
|
4
|
-
*
|
|
3
|
+
* standard-DOM-state transition used by the ImageEditor facade and image
|
|
4
|
+
* loading pipeline.
|
|
5
5
|
*
|
|
6
6
|
* ## Owned contracts
|
|
7
7
|
*
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared browser image element loading primitive.
|
|
3
|
+
*
|
|
4
|
+
* Callers provide their own error factory and validation so image loading and
|
|
5
|
+
* export pipelines can share listener cleanup without sharing domain errors.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export interface ImageElementLoadHandle {
|
|
10
|
+
promise: Promise<HTMLImageElement>;
|
|
11
|
+
cleanup(clearSource?: boolean): void;
|
|
12
|
+
}
|
|
13
|
+
export interface ImageElementLoadOptions {
|
|
14
|
+
crossOrigin?: string;
|
|
15
|
+
validate?: (imageElement: HTMLImageElement) => Error | null;
|
|
16
|
+
createError: (event: Event | string) => Error;
|
|
17
|
+
}
|
|
18
|
+
export declare function startImageElementLoad(dataUrl: string, options: ImageElementLoadOptions): ImageElementLoadHandle;
|
|
19
|
+
//# sourceMappingURL=image-element-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-element-loader.d.ts","sourceRoot":"","sources":["../../../src/utils/image-element-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACnC,OAAO,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,uBAAuB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,KAAK,KAAK,GAAG,IAAI,CAAC;IAC5D,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,KAAK,KAAK,CAAC;CACjD;AAED,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,uBAAuB,GACjC,sBAAsB,CAsDxB"}
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
* deterministic across canvas resizes.
|
|
36
36
|
* - The helper does NOT clamp the result against canvas bounds; callers
|
|
37
37
|
* are responsible for any subsequent clamping (the mask factory may
|
|
38
|
-
* expand the canvas to accommodate larger placements
|
|
39
|
-
* `expandCanvasToImage` is enabled).
|
|
38
|
+
* expand the canvas to accommodate larger placements in expand layout mode).
|
|
40
39
|
*
|
|
41
40
|
* ## Non-goals
|
|
42
41
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/utils/number.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/utils/number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE9F;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,GAAG,GAAG,GAAG,GAAG,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,cAAc,CAC1B,GAAG,EAAE,eAAe,GAAG,SAAS,EAChC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,QAAQ,CAAC,MAAM,EACvB,OAAO,EAAE,eAAe,GACzB,MAAM,CAgBR;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,YAAY,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAKtE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fabric event pointer extraction helpers.
|
|
3
|
+
*
|
|
4
|
+
* Supports Fabric v7 `scenePoint`, older pointer fields, and the
|
|
5
|
+
* `canvas.getPointer(event.e)` fallback used by controller event handlers.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type * as FabricNS from 'fabric';
|
|
10
|
+
export interface CanvasPoint {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function isFinitePoint(value: unknown): value is CanvasPoint;
|
|
15
|
+
export declare function getPointerFromFabricEvent(canvas: FabricNS.Canvas, event: unknown): CanvasPoint | null;
|
|
16
|
+
//# sourceMappingURL=pointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../../../src/utils/pointer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,QAAQ,MAAM,QAAQ,CAAC;AAExC,MAAM,WAAW,WAAW;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CASlE;AAED,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,QAAQ,CAAC,MAAM,EACvB,KAAK,EAAE,OAAO,GACf,WAAW,GAAG,IAAI,CAwBpB"}
|