react-native-image-editor-skia 0.1.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/LICENSE +21 -0
- package/README.md +202 -0
- package/lib/commonjs/ImageEditor.js +141 -0
- package/lib/commonjs/ImageEditor.js.map +1 -0
- package/lib/commonjs/annotations/AnnotationView.js +42 -0
- package/lib/commonjs/annotations/AnnotationView.js.map +1 -0
- package/lib/commonjs/annotations/ArrowAnnotation.js +29 -0
- package/lib/commonjs/annotations/ArrowAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/CircleAnnotation.js +31 -0
- package/lib/commonjs/annotations/CircleAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/FreehandAnnotation.js +29 -0
- package/lib/commonjs/annotations/FreehandAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/MarkerAnnotation.js +27 -0
- package/lib/commonjs/annotations/MarkerAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/RotatedGroup.js +34 -0
- package/lib/commonjs/annotations/RotatedGroup.js.map +1 -0
- package/lib/commonjs/annotations/TextAnnotation.js +40 -0
- package/lib/commonjs/annotations/TextAnnotation.js.map +1 -0
- package/lib/commonjs/annotations/geometry.js +73 -0
- package/lib/commonjs/annotations/geometry.js.map +1 -0
- package/lib/commonjs/annotations/geometryPure.js +104 -0
- package/lib/commonjs/annotations/geometryPure.js.map +1 -0
- package/lib/commonjs/canvas/AnnotationLayer.js +58 -0
- package/lib/commonjs/canvas/AnnotationLayer.js.map +1 -0
- package/lib/commonjs/canvas/BaseImageLayer.js +27 -0
- package/lib/commonjs/canvas/BaseImageLayer.js.map +1 -0
- package/lib/commonjs/canvas/CropOverlay.js +135 -0
- package/lib/commonjs/canvas/CropOverlay.js.map +1 -0
- package/lib/commonjs/canvas/EditorCanvas.js +91 -0
- package/lib/commonjs/canvas/EditorCanvas.js.map +1 -0
- package/lib/commonjs/canvas/InFlightLayer.js +152 -0
- package/lib/commonjs/canvas/InFlightLayer.js.map +1 -0
- package/lib/commonjs/canvas/SelectionOverlay.js +90 -0
- package/lib/commonjs/canvas/SelectionOverlay.js.map +1 -0
- package/lib/commonjs/constants.js +56 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context/EditorContext.js +132 -0
- package/lib/commonjs/context/EditorContext.js.map +1 -0
- package/lib/commonjs/export/drawScene.js +97 -0
- package/lib/commonjs/export/drawScene.js.map +1 -0
- package/lib/commonjs/export/exportImage.js +92 -0
- package/lib/commonjs/export/exportImage.js.map +1 -0
- package/lib/commonjs/gestures/applyTransform.js +79 -0
- package/lib/commonjs/gestures/applyTransform.js.map +1 -0
- package/lib/commonjs/gestures/createAnnotation.js +73 -0
- package/lib/commonjs/gestures/createAnnotation.js.map +1 -0
- package/lib/commonjs/gestures/handles.js +53 -0
- package/lib/commonjs/gestures/handles.js.map +1 -0
- package/lib/commonjs/gestures/hitTest.js +72 -0
- package/lib/commonjs/gestures/hitTest.js.map +1 -0
- package/lib/commonjs/gestures/useCropGesture.js +149 -0
- package/lib/commonjs/gestures/useCropGesture.js.map +1 -0
- package/lib/commonjs/gestures/useEditorGestures.js +289 -0
- package/lib/commonjs/gestures/useEditorGestures.js.map +1 -0
- package/lib/commonjs/image/disposeRegistry.js +63 -0
- package/lib/commonjs/image/disposeRegistry.js.map +1 -0
- package/lib/commonjs/image/useLoadedImage.js +121 -0
- package/lib/commonjs/image/useLoadedImage.js.map +1 -0
- package/lib/commonjs/index.js +52 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/state/history.js +85 -0
- package/lib/commonjs/state/history.js.map +1 -0
- package/lib/commonjs/state/selectors.js +19 -0
- package/lib/commonjs/state/selectors.js.map +1 -0
- package/lib/commonjs/state/useEditorReducer.js +83 -0
- package/lib/commonjs/state/useEditorReducer.js.map +1 -0
- package/lib/commonjs/toolbar/ColorPicker.js +84 -0
- package/lib/commonjs/toolbar/ColorPicker.js.map +1 -0
- package/lib/commonjs/toolbar/CropControls.js +65 -0
- package/lib/commonjs/toolbar/CropControls.js.map +1 -0
- package/lib/commonjs/toolbar/RotationSlider.js +73 -0
- package/lib/commonjs/toolbar/RotationSlider.js.map +1 -0
- package/lib/commonjs/toolbar/TextInputOverlay.js +108 -0
- package/lib/commonjs/toolbar/TextInputOverlay.js.map +1 -0
- package/lib/commonjs/toolbar/ToolButton.js +56 -0
- package/lib/commonjs/toolbar/ToolButton.js.map +1 -0
- package/lib/commonjs/toolbar/Toolbar.js +137 -0
- package/lib/commonjs/toolbar/Toolbar.js.map +1 -0
- package/lib/commonjs/types.js +47 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/color.js +37 -0
- package/lib/commonjs/utils/color.js.map +1 -0
- package/lib/commonjs/utils/id.js +14 -0
- package/lib/commonjs/utils/id.js.map +1 -0
- package/lib/commonjs/utils/math.js +277 -0
- package/lib/commonjs/utils/math.js.map +1 -0
- package/lib/module/ImageEditor.js +138 -0
- package/lib/module/ImageEditor.js.map +1 -0
- package/lib/module/annotations/AnnotationView.js +39 -0
- package/lib/module/annotations/AnnotationView.js.map +1 -0
- package/lib/module/annotations/ArrowAnnotation.js +26 -0
- package/lib/module/annotations/ArrowAnnotation.js.map +1 -0
- package/lib/module/annotations/CircleAnnotation.js +27 -0
- package/lib/module/annotations/CircleAnnotation.js.map +1 -0
- package/lib/module/annotations/FreehandAnnotation.js +25 -0
- package/lib/module/annotations/FreehandAnnotation.js.map +1 -0
- package/lib/module/annotations/MarkerAnnotation.js +23 -0
- package/lib/module/annotations/MarkerAnnotation.js.map +1 -0
- package/lib/module/annotations/RotatedGroup.js +29 -0
- package/lib/module/annotations/RotatedGroup.js.map +1 -0
- package/lib/module/annotations/TextAnnotation.js +37 -0
- package/lib/module/annotations/TextAnnotation.js.map +1 -0
- package/lib/module/annotations/geometry.js +56 -0
- package/lib/module/annotations/geometry.js.map +1 -0
- package/lib/module/annotations/geometryPure.js +100 -0
- package/lib/module/annotations/geometryPure.js.map +1 -0
- package/lib/module/canvas/AnnotationLayer.js +55 -0
- package/lib/module/canvas/AnnotationLayer.js.map +1 -0
- package/lib/module/canvas/BaseImageLayer.js +23 -0
- package/lib/module/canvas/BaseImageLayer.js.map +1 -0
- package/lib/module/canvas/CropOverlay.js +131 -0
- package/lib/module/canvas/CropOverlay.js.map +1 -0
- package/lib/module/canvas/EditorCanvas.js +88 -0
- package/lib/module/canvas/EditorCanvas.js.map +1 -0
- package/lib/module/canvas/InFlightLayer.js +149 -0
- package/lib/module/canvas/InFlightLayer.js.map +1 -0
- package/lib/module/canvas/SelectionOverlay.js +85 -0
- package/lib/module/canvas/SelectionOverlay.js.map +1 -0
- package/lib/module/constants.js +52 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context/EditorContext.js +126 -0
- package/lib/module/context/EditorContext.js.map +1 -0
- package/lib/module/export/drawScene.js +93 -0
- package/lib/module/export/drawScene.js.map +1 -0
- package/lib/module/export/exportImage.js +88 -0
- package/lib/module/export/exportImage.js.map +1 -0
- package/lib/module/gestures/applyTransform.js +75 -0
- package/lib/module/gestures/applyTransform.js.map +1 -0
- package/lib/module/gestures/createAnnotation.js +65 -0
- package/lib/module/gestures/createAnnotation.js.map +1 -0
- package/lib/module/gestures/handles.js +49 -0
- package/lib/module/gestures/handles.js.map +1 -0
- package/lib/module/gestures/hitTest.js +69 -0
- package/lib/module/gestures/hitTest.js.map +1 -0
- package/lib/module/gestures/useCropGesture.js +145 -0
- package/lib/module/gestures/useCropGesture.js.map +1 -0
- package/lib/module/gestures/useEditorGestures.js +285 -0
- package/lib/module/gestures/useEditorGestures.js.map +1 -0
- package/lib/module/image/disposeRegistry.js +57 -0
- package/lib/module/image/disposeRegistry.js.map +1 -0
- package/lib/module/image/useLoadedImage.js +117 -0
- package/lib/module/image/useLoadedImage.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/state/history.js +76 -0
- package/lib/module/state/history.js.map +1 -0
- package/lib/module/state/selectors.js +14 -0
- package/lib/module/state/selectors.js.map +1 -0
- package/lib/module/state/useEditorReducer.js +79 -0
- package/lib/module/state/useEditorReducer.js.map +1 -0
- package/lib/module/toolbar/ColorPicker.js +80 -0
- package/lib/module/toolbar/ColorPicker.js.map +1 -0
- package/lib/module/toolbar/CropControls.js +62 -0
- package/lib/module/toolbar/CropControls.js.map +1 -0
- package/lib/module/toolbar/RotationSlider.js +69 -0
- package/lib/module/toolbar/RotationSlider.js.map +1 -0
- package/lib/module/toolbar/TextInputOverlay.js +105 -0
- package/lib/module/toolbar/TextInputOverlay.js.map +1 -0
- package/lib/module/toolbar/ToolButton.js +52 -0
- package/lib/module/toolbar/ToolButton.js.map +1 -0
- package/lib/module/toolbar/Toolbar.js +133 -0
- package/lib/module/toolbar/Toolbar.js.map +1 -0
- package/lib/module/types.js +43 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/color.js +33 -0
- package/lib/module/utils/color.js.map +1 -0
- package/lib/module/utils/id.js +10 -0
- package/lib/module/utils/id.js.map +1 -0
- package/lib/module/utils/math.js +258 -0
- package/lib/module/utils/math.js.map +1 -0
- package/lib/typescript/src/ImageEditor.d.ts +9 -0
- package/lib/typescript/src/ImageEditor.d.ts.map +1 -0
- package/lib/typescript/src/annotations/AnnotationView.d.ts +6 -0
- package/lib/typescript/src/annotations/AnnotationView.d.ts.map +1 -0
- package/lib/typescript/src/annotations/ArrowAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/ArrowAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/CircleAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/CircleAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/FreehandAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/FreehandAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/MarkerAnnotation.d.ts +5 -0
- package/lib/typescript/src/annotations/MarkerAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/RotatedGroup.d.ts +13 -0
- package/lib/typescript/src/annotations/RotatedGroup.d.ts.map +1 -0
- package/lib/typescript/src/annotations/TextAnnotation.d.ts +10 -0
- package/lib/typescript/src/annotations/TextAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/annotations/geometry.d.ts +11 -0
- package/lib/typescript/src/annotations/geometry.d.ts.map +1 -0
- package/lib/typescript/src/annotations/geometryPure.d.ts +14 -0
- package/lib/typescript/src/annotations/geometryPure.d.ts.map +1 -0
- package/lib/typescript/src/canvas/AnnotationLayer.d.ts +11 -0
- package/lib/typescript/src/canvas/AnnotationLayer.d.ts.map +1 -0
- package/lib/typescript/src/canvas/BaseImageLayer.d.ts +12 -0
- package/lib/typescript/src/canvas/BaseImageLayer.d.ts.map +1 -0
- package/lib/typescript/src/canvas/CropOverlay.d.ts +10 -0
- package/lib/typescript/src/canvas/CropOverlay.d.ts.map +1 -0
- package/lib/typescript/src/canvas/EditorCanvas.d.ts +18 -0
- package/lib/typescript/src/canvas/EditorCanvas.d.ts.map +1 -0
- package/lib/typescript/src/canvas/InFlightLayer.d.ts +12 -0
- package/lib/typescript/src/canvas/InFlightLayer.d.ts.map +1 -0
- package/lib/typescript/src/canvas/SelectionOverlay.d.ts +11 -0
- package/lib/typescript/src/canvas/SelectionOverlay.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +25 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/context/EditorContext.d.ts +66 -0
- package/lib/typescript/src/context/EditorContext.d.ts.map +1 -0
- package/lib/typescript/src/export/drawScene.d.ts +10 -0
- package/lib/typescript/src/export/drawScene.d.ts.map +1 -0
- package/lib/typescript/src/export/exportImage.d.ts +23 -0
- package/lib/typescript/src/export/exportImage.d.ts.map +1 -0
- package/lib/typescript/src/gestures/applyTransform.d.ts +17 -0
- package/lib/typescript/src/gestures/applyTransform.d.ts.map +1 -0
- package/lib/typescript/src/gestures/createAnnotation.d.ts +11 -0
- package/lib/typescript/src/gestures/createAnnotation.d.ts.map +1 -0
- package/lib/typescript/src/gestures/handles.d.ts +17 -0
- package/lib/typescript/src/gestures/handles.d.ts.map +1 -0
- package/lib/typescript/src/gestures/hitTest.d.ts +9 -0
- package/lib/typescript/src/gestures/hitTest.d.ts.map +1 -0
- package/lib/typescript/src/gestures/useCropGesture.d.ts +7 -0
- package/lib/typescript/src/gestures/useCropGesture.d.ts.map +1 -0
- package/lib/typescript/src/gestures/useEditorGestures.d.ts +8 -0
- package/lib/typescript/src/gestures/useEditorGestures.d.ts.map +1 -0
- package/lib/typescript/src/image/disposeRegistry.d.ts +25 -0
- package/lib/typescript/src/image/disposeRegistry.d.ts.map +1 -0
- package/lib/typescript/src/image/useLoadedImage.d.ts +23 -0
- package/lib/typescript/src/image/useLoadedImage.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/state/history.d.ts +23 -0
- package/lib/typescript/src/state/history.d.ts.map +1 -0
- package/lib/typescript/src/state/selectors.d.ts +5 -0
- package/lib/typescript/src/state/selectors.d.ts.map +1 -0
- package/lib/typescript/src/state/useEditorReducer.d.ts +32 -0
- package/lib/typescript/src/state/useEditorReducer.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/ColorPicker.d.ts +7 -0
- package/lib/typescript/src/toolbar/ColorPicker.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/CropControls.d.ts +3 -0
- package/lib/typescript/src/toolbar/CropControls.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/RotationSlider.d.ts +8 -0
- package/lib/typescript/src/toolbar/RotationSlider.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/TextInputOverlay.d.ts +9 -0
- package/lib/typescript/src/toolbar/TextInputOverlay.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/ToolButton.d.ts +7 -0
- package/lib/typescript/src/toolbar/ToolButton.d.ts.map +1 -0
- package/lib/typescript/src/toolbar/Toolbar.d.ts +4 -0
- package/lib/typescript/src/toolbar/Toolbar.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +170 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/utils/color.d.ts +8 -0
- package/lib/typescript/src/utils/color.d.ts.map +1 -0
- package/lib/typescript/src/utils/id.d.ts +3 -0
- package/lib/typescript/src/utils/id.d.ts.map +1 -0
- package/lib/typescript/src/utils/math.d.ts +68 -0
- package/lib/typescript/src/utils/math.d.ts.map +1 -0
- package/package.json +90 -0
- package/src/ImageEditor.tsx +133 -0
- package/src/annotations/AnnotationView.tsx +24 -0
- package/src/annotations/ArrowAnnotation.tsx +26 -0
- package/src/annotations/CircleAnnotation.tsx +22 -0
- package/src/annotations/FreehandAnnotation.tsx +22 -0
- package/src/annotations/MarkerAnnotation.tsx +20 -0
- package/src/annotations/RotatedGroup.tsx +28 -0
- package/src/annotations/TextAnnotation.tsx +42 -0
- package/src/annotations/geometry.ts +62 -0
- package/src/annotations/geometryPure.ts +73 -0
- package/src/canvas/AnnotationLayer.tsx +43 -0
- package/src/canvas/BaseImageLayer.tsx +28 -0
- package/src/canvas/CropOverlay.tsx +92 -0
- package/src/canvas/EditorCanvas.tsx +70 -0
- package/src/canvas/InFlightLayer.tsx +140 -0
- package/src/canvas/SelectionOverlay.tsx +92 -0
- package/src/constants.ts +46 -0
- package/src/context/EditorContext.tsx +229 -0
- package/src/export/drawScene.ts +120 -0
- package/src/export/exportImage.ts +111 -0
- package/src/gestures/applyTransform.ts +76 -0
- package/src/gestures/createAnnotation.ts +92 -0
- package/src/gestures/handles.ts +50 -0
- package/src/gestures/hitTest.ts +79 -0
- package/src/gestures/useCropGesture.ts +123 -0
- package/src/gestures/useEditorGestures.ts +308 -0
- package/src/image/disposeRegistry.ts +59 -0
- package/src/image/useLoadedImage.ts +131 -0
- package/src/index.ts +32 -0
- package/src/state/history.ts +71 -0
- package/src/state/selectors.ts +16 -0
- package/src/state/useEditorReducer.ts +93 -0
- package/src/toolbar/ColorPicker.tsx +72 -0
- package/src/toolbar/CropControls.tsx +46 -0
- package/src/toolbar/RotationSlider.tsx +56 -0
- package/src/toolbar/TextInputOverlay.tsx +104 -0
- package/src/toolbar/ToolButton.tsx +46 -0
- package/src/toolbar/Toolbar.tsx +110 -0
- package/src/types.ts +203 -0
- package/src/utils/color.ts +34 -0
- package/src/utils/id.ts +7 -0
- package/src/utils/math.ts +222 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ColorString } from './types';
|
|
2
|
+
/** Default stroke width (in image pixels) for new shapes. */
|
|
3
|
+
export declare const DEFAULT_STROKE_WIDTH = 8;
|
|
4
|
+
/** Default font size (in image pixels) for new text annotations. */
|
|
5
|
+
export declare const DEFAULT_FONT_SIZE = 48;
|
|
6
|
+
/** Default wrap width (in image pixels) for new text boxes. */
|
|
7
|
+
export declare const DEFAULT_TEXT_WIDTH = 400;
|
|
8
|
+
/** Semi-transparent opacity for the marker/highlighter tool. */
|
|
9
|
+
export declare const MARKER_OPACITY = 0.4;
|
|
10
|
+
/** Arrowhead barb length as a multiple of stroke width. */
|
|
11
|
+
export declare const ARROW_HEAD_RATIO = 4;
|
|
12
|
+
/** Touch slop (in screen points) added to hit-test radii for easier selection. */
|
|
13
|
+
export declare const HIT_SLOP = 12;
|
|
14
|
+
/** On-screen size (points) of selection handles. */
|
|
15
|
+
export declare const HANDLE_SIZE = 14;
|
|
16
|
+
/** Distance (points) the rotate handle sits above the selection's top edge. */
|
|
17
|
+
export declare const ROTATE_HANDLE_OFFSET = 36;
|
|
18
|
+
/** Max entries retained in the undo/redo history. */
|
|
19
|
+
export declare const MAX_HISTORY = 50;
|
|
20
|
+
/** Minimum spacing (image px) between sampled freehand points. */
|
|
21
|
+
export declare const FREEHAND_MIN_DISTANCE = 3;
|
|
22
|
+
export declare const DEFAULT_STROKE_COLOR: ColorString;
|
|
23
|
+
export declare const DEFAULT_TEXT_COLOR: ColorString;
|
|
24
|
+
export declare const DEFAULT_PALETTE: ColorString[];
|
|
25
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,gEAAgE;AAChE,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,kFAAkF;AAClF,eAAO,MAAM,QAAQ,KAAK,CAAC;AAE3B,oDAAoD;AACpD,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,qDAAqD;AACrD,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,MAAM,oBAAoB,EAAE,WAAuB,CAAC;AAC3D,eAAO,MAAM,kBAAkB,EAAE,WAAuB,CAAC;AAEzD,eAAO,MAAM,eAAe,EAAE,WAAW,EAUxC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
import type { Annotation, ColorString, EditorDocument, Rect, ToolType, Vec2 } from '../types';
|
|
4
|
+
import type { EditorAction, EditorState } from '../state/useEditorReducer';
|
|
5
|
+
import type { Mat } from '../utils/math';
|
|
6
|
+
export interface Size {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
/** Live geometry of a shape currently being drawn (UI-thread shared values). */
|
|
11
|
+
export interface DrawState {
|
|
12
|
+
active: SharedValue<boolean>;
|
|
13
|
+
start: SharedValue<Vec2>;
|
|
14
|
+
current: SharedValue<Vec2>;
|
|
15
|
+
points: SharedValue<Vec2[]>;
|
|
16
|
+
}
|
|
17
|
+
/** Live transform applied to the selected annotation during move/resize/rotate. */
|
|
18
|
+
export interface LiveTransformState {
|
|
19
|
+
active: SharedValue<boolean>;
|
|
20
|
+
tx: SharedValue<number>;
|
|
21
|
+
ty: SharedValue<number>;
|
|
22
|
+
rotate: SharedValue<number>;
|
|
23
|
+
scale: SharedValue<number>;
|
|
24
|
+
origin: SharedValue<Vec2>;
|
|
25
|
+
}
|
|
26
|
+
export interface EditorContextValue {
|
|
27
|
+
state: EditorState;
|
|
28
|
+
dispatch: React.Dispatch<EditorAction>;
|
|
29
|
+
doc: EditorDocument;
|
|
30
|
+
annotations: Annotation[];
|
|
31
|
+
canUndo: boolean;
|
|
32
|
+
canRedo: boolean;
|
|
33
|
+
tool: ToolType;
|
|
34
|
+
setTool: (t: ToolType) => void;
|
|
35
|
+
selectedId: string | null;
|
|
36
|
+
setSelectedId: (id: string | null) => void;
|
|
37
|
+
strokeColor: ColorString;
|
|
38
|
+
setStrokeColor: (c: ColorString) => void;
|
|
39
|
+
textColor: ColorString;
|
|
40
|
+
setTextColor: (c: ColorString) => void;
|
|
41
|
+
strokeWidth: number;
|
|
42
|
+
setStrokeWidth: (w: number) => void;
|
|
43
|
+
palette: ColorString[];
|
|
44
|
+
editingTextId: string | null;
|
|
45
|
+
setEditingTextId: (id: string | null) => void;
|
|
46
|
+
layout: Size;
|
|
47
|
+
setLayout: (s: Size) => void;
|
|
48
|
+
imageSize: Size;
|
|
49
|
+
/** image→screen affine matrix (JS thread). */
|
|
50
|
+
matrix: Mat;
|
|
51
|
+
/** image→screen affine matrix mirrored for worklet/UI-thread reads. */
|
|
52
|
+
matrixSV: SharedValue<Mat>;
|
|
53
|
+
draw: DrawState;
|
|
54
|
+
live: LiveTransformState;
|
|
55
|
+
/** In-progress crop rectangle (image space) while the crop tool is active. */
|
|
56
|
+
cropRectSV: SharedValue<Rect>;
|
|
57
|
+
}
|
|
58
|
+
export declare function useEditor(): EditorContextValue;
|
|
59
|
+
export declare function EditorProvider({ imageSize, initialStrokeColor, initialTextColor, palette, children, }: {
|
|
60
|
+
imageSize: Size;
|
|
61
|
+
initialStrokeColor?: ColorString;
|
|
62
|
+
initialTextColor?: ColorString;
|
|
63
|
+
palette?: ColorString[];
|
|
64
|
+
children: React.ReactNode;
|
|
65
|
+
}): React.JSX.Element;
|
|
66
|
+
//# sourceMappingURL=EditorContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["../../../../src/context/EditorContext.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SkCanvas, SkImage } from '@shopify/react-native-skia';
|
|
2
|
+
import type { Annotation } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Imperative draw of the base image + all annotations onto `canvas`, in IMAGE
|
|
5
|
+
* space. Shared by the off-screen export path. Mirrors the declarative on-screen
|
|
6
|
+
* renderers (same geometry, same rotation-about-center), so exports match the
|
|
7
|
+
* preview. The caller sets up the output transform + clip before calling this.
|
|
8
|
+
*/
|
|
9
|
+
export declare function drawScene(canvas: SkCanvas, image: SkImage, annotations: Annotation[]): void;
|
|
10
|
+
//# sourceMappingURL=drawScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawScene.d.ts","sourceRoot":"","sources":["../../../../src/export/drawScene.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAO3C;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,OAAO,EACd,WAAW,EAAE,UAAU,EAAE,GACxB,IAAI,CAKN"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SkImage } from '@shopify/react-native-skia';
|
|
2
|
+
import type { Annotation, ExportOptions, SceneTransform } from '../types';
|
|
3
|
+
export interface ExportParams {
|
|
4
|
+
image: SkImage;
|
|
5
|
+
annotations: Annotation[];
|
|
6
|
+
scene: SceneTransform;
|
|
7
|
+
imageWidth: number;
|
|
8
|
+
imageHeight: number;
|
|
9
|
+
options?: ExportOptions;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Render the scene OFF-SCREEN at full resolution and return base64.
|
|
13
|
+
*
|
|
14
|
+
* Output = the (optionally cropped) image + annotations, scaled by `scene.scale`
|
|
15
|
+
* and rotated by `scene.rotation`, on a surface sized to the rotated content's
|
|
16
|
+
* bounding box (transparent corners for PNG). Because annotations live in image
|
|
17
|
+
* space, no per-annotation rescaling is needed — the exact preview geometry is
|
|
18
|
+
* drawn at native resolution.
|
|
19
|
+
*
|
|
20
|
+
* All Skia objects created here (surface + snapshot) are disposed before return.
|
|
21
|
+
*/
|
|
22
|
+
export declare function exportImage(params: ExportParams): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=exportImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exportImage.d.ts","sourceRoot":"","sources":["../../../../src/export/exportImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAC;AAOhF,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAgFvE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Annotation, Vec2 } from '../types';
|
|
2
|
+
export interface LiveValues {
|
|
3
|
+
tx: number;
|
|
4
|
+
ty: number;
|
|
5
|
+
rotate: number;
|
|
6
|
+
scale: number;
|
|
7
|
+
origin: Vec2;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Bake a live move/resize/rotate transform into an annotation's stored geometry.
|
|
11
|
+
* This MUST match the on-screen preview (AnnotationLayer applies, in order:
|
|
12
|
+
* translate → rotate(about origin) → scale(about origin)). Rotation is folded
|
|
13
|
+
* into the annotation's `rotation` field (also about its center), so only scale
|
|
14
|
+
* and translate touch geometry here.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyTransformToAnnotation(a: Annotation, live: LiveValues): Annotation;
|
|
17
|
+
//# sourceMappingURL=applyTransform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyTransform.d.ts","sourceRoot":"","sources":["../../../../src/gestures/applyTransform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,CAAC,EAAE,UAAU,EACb,IAAI,EAAE,UAAU,GACf,UAAU,CAuDZ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Annotation, ColorString, Rect, TextAnnotation, Vec2 } from '../types';
|
|
2
|
+
export interface DrawStyle {
|
|
3
|
+
strokeColor: ColorString;
|
|
4
|
+
strokeWidth: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function makeCircle(center: Vec2, radius: number, style: DrawStyle): Annotation;
|
|
7
|
+
export declare function makeArrow(start: Vec2, end: Vec2, style: DrawStyle): Annotation;
|
|
8
|
+
export declare function makeMarker(rect: Rect, color: ColorString): Annotation;
|
|
9
|
+
export declare function makeFreehand(points: Vec2[], style: DrawStyle): Annotation;
|
|
10
|
+
export declare function makeText(origin: Vec2, color: ColorString, fontSize?: number): TextAnnotation;
|
|
11
|
+
//# sourceMappingURL=createAnnotation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAnnotation.d.ts","sourceRoot":"","sources":["../../../../src/gestures/createAnnotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,IAAI,EACJ,cAAc,EACd,IAAI,EACL,MAAM,UAAU,CAAC;AASlB,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,IAAI,EACZ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,GACf,UAAU,CAWZ;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,GAAG,UAAU,CAY9E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,GAAG,UAAU,CAUrE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,GAAG,UAAU,CAUzE;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,WAAW,EAClB,QAAQ,SAAoB,GAC3B,cAAc,CAYhB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Annotation, Vec2 } from '../types';
|
|
2
|
+
import type { Mat } from '../utils/math';
|
|
3
|
+
export interface SelectionHandles {
|
|
4
|
+
/** Corner handles in SCREEN space: top-left, top-right, bottom-right, bottom-left. */
|
|
5
|
+
corners: [Vec2, Vec2, Vec2, Vec2];
|
|
6
|
+
/** Rotate handle in screen space (above the top edge). */
|
|
7
|
+
rotate: Vec2;
|
|
8
|
+
/** Annotation center in screen space. */
|
|
9
|
+
center: Vec2;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Compute selection-box handle positions in SCREEN space for annotation `a`,
|
|
13
|
+
* accounting for its rotation and the current image→screen matrix. Worklet-safe
|
|
14
|
+
* (used by the transform gesture) and also callable from JS (SelectionOverlay).
|
|
15
|
+
*/
|
|
16
|
+
export declare function selectionHandles(a: Annotation, matrix: Mat): SelectionHandles;
|
|
17
|
+
//# sourceMappingURL=handles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../../../src/gestures/handles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIjD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,0DAA0D;IAC1D,MAAM,EAAE,IAAI,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAG,gBAAgB,CA6B7E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Annotation, Vec2 } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Return the id of the top-most annotation hit by `point` (image space), or null.
|
|
4
|
+
* Worklet-safe so selection resolves on the UI thread during a tap.
|
|
5
|
+
*
|
|
6
|
+
* `slop` is an extra hit margin, in image pixels (screen slop / current scale).
|
|
7
|
+
*/
|
|
8
|
+
export declare function hitTest(annotations: Annotation[], point: Vec2, slop: number): string | null;
|
|
9
|
+
//# sourceMappingURL=hitTest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitTest.d.ts","sourceRoot":"","sources":["../../../../src/gestures/hitTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAqDjD;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,WAAW,EAAE,UAAU,EAAE,EACzB,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,IAAI,CAef"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pan gesture that edits `cropRectSV` (image space) while the crop tool is
|
|
3
|
+
* active. Grab a corner to resize, or the interior to move. All values stay
|
|
4
|
+
* clamped inside the image bounds.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useCropGesture(): import("react-native-gesture-handler/lib/typescript/handlers/gestures/panGesture").PanGesture;
|
|
7
|
+
//# sourceMappingURL=useCropGesture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCropGesture.d.ts","sourceRoot":"","sources":["../../../../src/gestures/useCropGesture.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,wBAAgB,cAAc,kGAwG7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single composed Pan gesture over the canvas. It branches on the active tool
|
|
3
|
+
* and, in select mode, on where the touch began (rotate handle → rotate, corner
|
|
4
|
+
* handle → resize, body → move, empty → (de)select). All geometry math runs on
|
|
5
|
+
* the UI thread; only final commits hop to JS via runOnJS.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useEditorGestures(): import("react-native-gesture-handler/lib/typescript/handlers/gestures/panGesture").PanGesture;
|
|
8
|
+
//# sourceMappingURL=useEditorGestures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorGestures.d.ts","sourceRoot":"","sources":["../../../../src/gestures/useEditorGestures.ts"],"names":[],"mappings":"AAqCA;;;;;GAKG;AACH,wBAAgB,iBAAiB,kGAwQhC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks Skia native objects (SkImage / SkData / SkSurface / SkParagraph …) so
|
|
3
|
+
* they can be released deterministically. Skia objects are JSI HostObjects; the
|
|
4
|
+
* Hermes GC under-counts their native footprint and may never collect them, so
|
|
5
|
+
* we must call `.dispose()` explicitly. This registry is a safety net: register
|
|
6
|
+
* anything created imperatively, and `flush()` on unmount to guarantee cleanup.
|
|
7
|
+
*/
|
|
8
|
+
export interface Disposable {
|
|
9
|
+
dispose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare class DisposeRegistry {
|
|
12
|
+
private items;
|
|
13
|
+
/** Track an object and return it for convenient chaining. */
|
|
14
|
+
add<T extends Disposable>(item: T): T;
|
|
15
|
+
/** Stop tracking without disposing (e.g. ownership handed elsewhere). */
|
|
16
|
+
forget(item: Disposable): void;
|
|
17
|
+
/** Dispose a single tracked object now. */
|
|
18
|
+
release(item: Disposable | null | undefined): void;
|
|
19
|
+
/** Dispose everything still tracked. Call on unmount. */
|
|
20
|
+
flush(): void;
|
|
21
|
+
get size(): number;
|
|
22
|
+
}
|
|
23
|
+
/** Dispose without throwing if the object was already released. */
|
|
24
|
+
export declare function safeDispose(item: Disposable | null | undefined): void;
|
|
25
|
+
//# sourceMappingURL=disposeRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposeRegistry.d.ts","sourceRoot":"","sources":["../../../../src/image/disposeRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAyB;IAEtC,6DAA6D;IAC7D,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC;IAKrC,yEAAyE;IACzE,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAI9B,2CAA2C;IAC3C,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI;IAQlD,yDAAyD;IACzD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CASrE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SkImage } from '@shopify/react-native-skia';
|
|
2
|
+
import type { ImageSource } from '../types';
|
|
3
|
+
export interface LoadedImage {
|
|
4
|
+
image: SkImage | null;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Decode an {@link ImageSource} into an `SkImage`, managing native memory.
|
|
12
|
+
*
|
|
13
|
+
* Memory rules enforced here:
|
|
14
|
+
* - The encoded `SkData` is disposed immediately after `MakeImageFromEncoded`;
|
|
15
|
+
* the decoded `SkImage` owns its pixels, so retaining the encoded bytes would
|
|
16
|
+
* roughly double memory usage.
|
|
17
|
+
* - When `source` changes (or the component unmounts) the previous `SkImage` is
|
|
18
|
+
* disposed before the next one is created.
|
|
19
|
+
* - The input base64 string is consumed inside the effect and never copied into
|
|
20
|
+
* state, so a large payload is not retained by this hook.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useLoadedImage(source: ImageSource): LoadedImage;
|
|
23
|
+
//# sourceMappingURL=useLoadedImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLoadedImage.d.ts","sourceRoot":"","sources":["../../../../src/image/useLoadedImage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAUD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CA+F/D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ImageEditor } from './ImageEditor';
|
|
2
|
+
export type { ImageEditorProps, ImageEditorRef, ImageSource, ExportOptions, WriteFileFn, OutputFormat, Annotation, AnnotationType, CircleAnnotation, ArrowAnnotation, MarkerAnnotation, FreehandAnnotation, TextAnnotation, SceneTransform, ToolType, ColorString, Vec2, Rect, } from './types';
|
|
3
|
+
export { EditorProvider, useEditor } from './context/EditorContext';
|
|
4
|
+
export { exportImage } from './export/exportImage';
|
|
5
|
+
export { DEFAULT_PALETTE, DEFAULT_STROKE_COLOR, DEFAULT_TEXT_COLOR, } from './constants';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,IAAI,GACL,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic, pure undo/redo history over an immutable document `T`.
|
|
3
|
+
* Snapshots are cheap here because the document is plain JSON (annotations +
|
|
4
|
+
* scene transform) — it never contains image bytes.
|
|
5
|
+
*/
|
|
6
|
+
export interface History<T> {
|
|
7
|
+
past: T[];
|
|
8
|
+
present: T;
|
|
9
|
+
future: T[];
|
|
10
|
+
}
|
|
11
|
+
export declare function initHistory<T>(present: T): History<T>;
|
|
12
|
+
/** Replace the present, pushing the old present onto the undo stack. */
|
|
13
|
+
export declare function commit<T>(history: History<T>, next: T): History<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Replace the present WITHOUT creating a history entry — used for live edits
|
|
16
|
+
* (e.g. typing in a text box) that should collapse into the eventual commit.
|
|
17
|
+
*/
|
|
18
|
+
export declare function replacePresent<T>(history: History<T>, next: T): History<T>;
|
|
19
|
+
export declare function undo<T>(history: History<T>): History<T>;
|
|
20
|
+
export declare function redo<T>(history: History<T>): History<T>;
|
|
21
|
+
export declare function canUndo<T>(history: History<T>): boolean;
|
|
22
|
+
export declare function canRedo<T>(history: History<T>): boolean;
|
|
23
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/state/history.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,OAAO,EAAE,CAAC,CAAC;IACX,MAAM,EAAE,CAAC,EAAE,CAAC;CACb;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAErD;AAED,wEAAwE;AACxE,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUlE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAE1E;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWvD;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWvD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAEvD;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Annotation } from '../types';
|
|
2
|
+
export declare function getAnnotationById(annotations: Annotation[], id: string | null): Annotation | undefined;
|
|
3
|
+
/** Annotations in paint order (ascending z). */
|
|
4
|
+
export declare function sortedByZ(annotations: Annotation[]): Annotation[];
|
|
5
|
+
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../../src/state/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,UAAU,EAAE,EACzB,EAAE,EAAE,MAAM,GAAG,IAAI,GAChB,UAAU,GAAG,SAAS,CAKxB;AAED,gDAAgD;AAChD,wBAAgB,SAAS,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAEjE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Annotation, EditorDocument, SceneTransform } from '../types';
|
|
2
|
+
import type { History } from './history';
|
|
3
|
+
export type EditorAction = {
|
|
4
|
+
type: 'ADD_ANNOTATION';
|
|
5
|
+
annotation: Annotation;
|
|
6
|
+
} | {
|
|
7
|
+
type: 'UPDATE_ANNOTATION';
|
|
8
|
+
id: string;
|
|
9
|
+
changes: Partial<Annotation>;
|
|
10
|
+
/** When true, does not create a history entry (live edit). */
|
|
11
|
+
transient?: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'DELETE_ANNOTATION';
|
|
14
|
+
id: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'SET_SCENE';
|
|
17
|
+
changes: Partial<SceneTransform>;
|
|
18
|
+
/** When true, does not create a history entry (live slider drag). */
|
|
19
|
+
transient?: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
type: 'REPLACE';
|
|
22
|
+
document: EditorDocument;
|
|
23
|
+
} | {
|
|
24
|
+
type: 'RESET';
|
|
25
|
+
} | {
|
|
26
|
+
type: 'UNDO';
|
|
27
|
+
} | {
|
|
28
|
+
type: 'REDO';
|
|
29
|
+
};
|
|
30
|
+
export type EditorState = History<EditorDocument>;
|
|
31
|
+
export declare function useEditorReducer(initial?: Partial<EditorDocument>): [History<EditorDocument>, import("react").ActionDispatch<[action: EditorAction]>];
|
|
32
|
+
//# sourceMappingURL=useEditorReducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEditorReducer.d.ts","sourceRoot":"","sources":["../../../../src/state/useEditorReducer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAS3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,GAClD;IACE,IAAI,EAAE,mBAAmB,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B,8DAA8D;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACzC;IACE,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAqDlD,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,qFAKjE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Horizontal swatch strip. Picking a color sets the "current" color used for new
|
|
3
|
+
* shapes and, if an annotation is selected, recolors it (the right field per
|
|
4
|
+
* type). While editing text, it also updates the live text color.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ColorPicker(): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ColorPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../src/toolbar/ColorPicker.tsx"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,WAAW,gCAgD1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CropControls.d.ts","sourceRoot":"","sources":["../../../../src/toolbar/CropControls.tsx"],"names":[],"mappings":"AAKA,2EAA2E;AAC3E,wBAAgB,YAAY,gCA8B3B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drag left/right anywhere on the bar to rotate the whole image to ANY angle.
|
|
3
|
+
* Updates are transient during the drag (no history spam) and committed on
|
|
4
|
+
* release. Double-nothing here is fine — the scene re-renders, but rotation is
|
|
5
|
+
* an occasional interaction.
|
|
6
|
+
*/
|
|
7
|
+
export declare function RotationSlider(): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=RotationSlider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RotationSlider.d.ts","sourceRoot":"","sources":["../../../../src/toolbar/RotationSlider.tsx"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,wBAAgB,cAAc,gCA6B7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native TextInput overlaid on the text annotation being edited. Skia can't
|
|
3
|
+
* accept keyboard input, so we edit here and mirror the string back into the
|
|
4
|
+
* annotation (transient updates while typing; a committed update on blur). The
|
|
5
|
+
* Skia text for this annotation is hidden while editing (see AnnotationLayer).
|
|
6
|
+
* Positioning ignores rotation for simplicity.
|
|
7
|
+
*/
|
|
8
|
+
export declare function TextInputOverlay(): import("react").JSX.Element | null;
|
|
9
|
+
//# sourceMappingURL=TextInputOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInputOverlay.d.ts","sourceRoot":"","sources":["../../../../src/toolbar/TextInputOverlay.tsx"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,uCAgF/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolButton.d.ts","sourceRoot":"","sources":["../../../../src/toolbar/ToolButton.tsx"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,+BAgBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../../../src/toolbar/Toolbar.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,+BAsE1D"}
|