@annotorious/react 3.0.0-rc.3 → 3.0.0-rc.30
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/dist/Annotorious.d.ts +8 -32
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/AnnotoriousPlugin.d.ts +8 -6
- package/dist/AnnotoriousPlugin.d.ts.map +1 -1
- package/dist/AnnotoriousPopup.d.ts +2 -1
- package/dist/ImageAnnotator.d.ts +2 -2
- package/dist/ImageAnnotator.d.ts.map +1 -1
- package/dist/annotorious-react.css +1 -1
- package/dist/annotorious-react.es.js +35 -52
- package/dist/annotorious-react.es.js.map +1 -1
- package/dist/annotorious-react.es10.js +16 -3
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +6 -27
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +7 -19
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +131 -51
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +32 -17
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +2 -22
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +26 -2
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +606 -2
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +2 -3859
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +2 -29
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +32 -32
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es3.js +6 -7
- package/dist/annotorious-react.es3.js.map +1 -1
- package/dist/annotorious-react.es4.js +8 -8
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js +10 -10
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es8.js +27 -47
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +35 -12
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts +3 -2
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonPopup.d.ts +2 -1
- package/dist/openseadragon/OpenSeadragonViewer.d.ts +3 -3
- package/dist/openseadragon/OpenSeadragonViewer.d.ts.map +1 -1
- package/dist/openseadragon/setPosition.d.ts +2 -1
- package/dist/openseadragon/setPosition.d.ts.map +1 -1
- package/package.json +18 -10
- package/dist/annotorious-react.es20.js +0 -39
- package/dist/annotorious-react.es20.js.map +0 -1
- package/dist/annotorious-react.es21.js +0 -19
- package/dist/annotorious-react.es21.js.map +0 -1
- package/dist/annotorious-react.es22.js +0 -7
- package/dist/annotorious-react.es22.js.map +0 -1
- package/dist/annotorious-react.es23.js +0 -11
- package/dist/annotorious-react.es23.js.map +0 -1
- package/dist/annotorious-react.es24.js +0 -156
- package/dist/annotorious-react.es24.js.map +0 -1
- package/dist/annotorious-react.es25.js +0 -9
- package/dist/annotorious-react.es25.js.map +0 -1
- package/dist/annotorious-react.es26.js +0 -20665
- package/dist/annotorious-react.es26.js.map +0 -1
- package/dist/annotorious-react.es27.js +0 -35
- package/dist/annotorious-react.es27.js.map +0 -1
- package/dist/annotorious-react.es28.js +0 -5
- package/dist/annotorious-react.es28.js.map +0 -1
- package/dist/annotorious-react.es29.js +0 -33
- package/dist/annotorious-react.es29.js.map +0 -1
- package/dist/annotorious-react.es30.js +0 -602
- package/dist/annotorious-react.es30.js.map +0 -1
- package/dist/annotorious-react.es31.js +0 -5
- package/dist/annotorious-react.es31.js.map +0 -1
- package/dist/annotorious-react.es32.js +0 -5
- package/dist/annotorious-react.es32.js.map +0 -1
- package/dist/annotorious-react.es33.js +0 -20
- package/dist/annotorious-react.es33.js.map +0 -1
- package/dist/annotorious-react.es34.js +0 -30
- package/dist/annotorious-react.es34.js.map +0 -1
- package/dist/annotorious-react.es35.js +0 -19
- package/dist/annotorious-react.es35.js.map +0 -1
- package/dist/annotorious-react.es36.js +0 -24
- package/dist/annotorious-react.es36.js.map +0 -1
- package/dist/annotorious-react.es37.js +0 -19
- package/dist/annotorious-react.es37.js.map +0 -1
- package/dist/annotorious-react.es38.js +0 -7
- package/dist/annotorious-react.es38.js.map +0 -1
- package/dist/annotorious-react.es39.js +0 -11
- package/dist/annotorious-react.es39.js.map +0 -1
- package/dist/annotorious-react.es40.js +0 -10
- package/dist/annotorious-react.es40.js.map +0 -1
- package/dist/annotorious-react.es6.js +0 -5
- package/dist/annotorious-react.es6.js.map +0 -1
- package/dist/annotorious-react.es7.js +0 -5
- package/dist/annotorious-react.es7.js.map +0 -1
package/dist/Annotorious.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Annotation, Annotator,
|
|
2
|
+
import { Annotation, Annotator, Store, User } from '@annotorious/annotorious';
|
|
3
|
+
|
|
3
4
|
interface Selection<T extends Annotation = Annotation> {
|
|
4
5
|
selected: {
|
|
5
6
|
annotation: T;
|
|
@@ -13,7 +14,7 @@ export interface AnnotoriousContextState {
|
|
|
13
14
|
annotations: Annotation[];
|
|
14
15
|
selection: Selection;
|
|
15
16
|
}
|
|
16
|
-
export declare const AnnotoriousContext: import(
|
|
17
|
+
export declare const AnnotoriousContext: import('react').Context<{
|
|
17
18
|
anno: any;
|
|
18
19
|
setAnno: any;
|
|
19
20
|
annotations: any[];
|
|
@@ -21,39 +22,14 @@ export declare const AnnotoriousContext: import("react").Context<{
|
|
|
21
22
|
selected: any[];
|
|
22
23
|
};
|
|
23
24
|
}>;
|
|
24
|
-
export declare const Annotorious: import(
|
|
25
|
+
export declare const Annotorious: import('react').ForwardRefExoticComponent<{
|
|
25
26
|
children: ReactNode;
|
|
26
|
-
} & import(
|
|
27
|
-
export declare const useAnnotator: <T extends Annotator<any, unknown>>() => T;
|
|
28
|
-
export declare const useAnnotationStore: <T extends
|
|
29
|
-
addAnnotation: (annotation: Annotation, origin?: import("@annotorious/core").Origin) => void;
|
|
30
|
-
addBody: (body: import("@annotorious/core").AnnotationBody, origin?: import("@annotorious/core").Origin) => void;
|
|
31
|
-
all: () => Annotation[];
|
|
32
|
-
bulkAddAnnotation: (annotations: Annotation[], replace?: boolean, origin?: import("@annotorious/core").Origin) => void;
|
|
33
|
-
bulkDeleteAnnotation: (annotationsOrIds: (string | Annotation)[], origin?: import("@annotorious/core").Origin) => void;
|
|
34
|
-
bulkUpdateAnnotation: (annotations: Annotation[], origin?: import("@annotorious/core").Origin) => void;
|
|
35
|
-
bulkUpdateBodies: (bodies: import("@annotorious/core").AnnotationBody[], origin?: import("@annotorious/core").Origin) => void;
|
|
36
|
-
bulkUpdateTargets: (targets: import("@annotorious/core").AnnotationTarget[], origin?: import("@annotorious/core").Origin) => void;
|
|
37
|
-
clear: (origin?: import("@annotorious/core").Origin) => void;
|
|
38
|
-
deleteAnnotation: (annotationOrId: string | Annotation, origin?: import("@annotorious/core").Origin) => void;
|
|
39
|
-
deleteBody: (body: {
|
|
40
|
-
id: string;
|
|
41
|
-
annotation: string;
|
|
42
|
-
}, origin?: import("@annotorious/core").Origin) => void;
|
|
43
|
-
getAnnotation: (id: string) => Annotation;
|
|
44
|
-
getBody: (id: string) => import("@annotorious/core").AnnotationBody;
|
|
45
|
-
observe: (onChange: (event: StoreChangeEvent<Annotation>) => void, options?: import("@annotorious/core").StoreObserveOptions) => number;
|
|
46
|
-
unobserve: (onChange: (event: StoreChangeEvent<Annotation>) => void) => void;
|
|
47
|
-
updateAnnotation: (arg1: string | Annotation, arg2?: Annotation | import("@annotorious/core").Origin, arg3?: import("@annotorious/core").Origin) => void;
|
|
48
|
-
updateBody: (oldBodyId: {
|
|
49
|
-
id: string;
|
|
50
|
-
annotation: string;
|
|
51
|
-
}, newBody: import("@annotorious/core").AnnotationBody, origin?: import("@annotorious/core").Origin) => void;
|
|
52
|
-
updateTarget: (target: import("@annotorious/core").AnnotationTarget, origin?: import("@annotorious/core").Origin) => void;
|
|
53
|
-
}>() => T;
|
|
27
|
+
} & import('react').RefAttributes<Annotator<Annotation, Annotation>>>;
|
|
28
|
+
export declare const useAnnotator: <T extends unknown = Annotator<any, unknown>>() => T;
|
|
29
|
+
export declare const useAnnotationStore: <T extends unknown = Store<Annotation>>() => T | undefined;
|
|
54
30
|
export declare const useAnnotations: <T extends Annotation>(debounce?: number) => T[];
|
|
55
31
|
export declare const useSelection: <T extends Annotation>() => Selection<T>;
|
|
56
|
-
export declare const useAnnotatorUser: () =>
|
|
32
|
+
export declare const useAnnotatorUser: () => User;
|
|
57
33
|
export declare const useViewportState: <T extends Annotation>(debounce?: number) => T[];
|
|
58
34
|
export {};
|
|
59
35
|
//# sourceMappingURL=Annotorious.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAoB,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhG,UAAU,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAEnD,QAAQ,EAAE;QAAE,UAAU,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAElD,YAAY,CAAC,EAAE,YAAY,CAAC;CAE7B;AAED,MAAM,WAAW,uBAAuB;IAEtC,IAAI,EAAE,SAAS,CAAC;IAEhB,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAEpD,WAAW,EAAE,UAAU,EAAE,CAAC;IAE1B,SAAS,EAAE,SAAS,CAAC;CAEtB;AAED,eAAO,MAAM,kBAAkB;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,WAAW;cAAqC,SAAS;qEAsEpE,CAAC;AAEH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,OAAO,iCAE7B,CAChB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,OAAO,2BAEtB,CAAC,GAAG,SACjC,CAAA;AAYD,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,UAAU,aAAa,MAAM,QACG,CAAC;AAE1E,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,UAAU,OAE3B,SAAS,CAAC,CAAC,CAChC,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,IAGnC,CAAA;AAmDD,eAAO,MAAM,gBAAgB,GAAK,CAAC,SAAS,UAAU,aAAa,MAAM,QACI,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Annotator } from '@annotorious/annotorious';
|
|
2
|
+
|
|
3
|
+
export type AnnotatorPlugin<T extends unknown = Annotator<any, unknown>> = (anno: T, opts?: Object) => ({
|
|
4
|
+
unmount?: () => void;
|
|
5
|
+
}) | void;
|
|
6
|
+
export interface AnnotoriousPluginProps<T extends unknown = Annotator<any, unknown>> {
|
|
7
|
+
plugin: AnnotatorPlugin<T>;
|
|
6
8
|
opts?: Object;
|
|
7
9
|
}
|
|
8
|
-
export declare const AnnotoriousPlugin: <
|
|
10
|
+
export declare const AnnotoriousPlugin: <T extends unknown = Annotator<any, unknown>>(props: AnnotoriousPluginProps<T>) => any;
|
|
9
11
|
//# sourceMappingURL=AnnotoriousPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnotoriousPlugin.d.ts","sourceRoot":"","sources":["../src/AnnotoriousPlugin.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AnnotoriousPlugin.d.ts","sourceRoot":"","sources":["../src/AnnotoriousPlugin.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,IACrE,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC;AAEhE,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC;IAEjF,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,CAAC,EAAE,MAAM,CAAC;CAEf;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,OAAO,mCAAmC,sBAAsB,CAAC,CAAC,CAAC,QAiB9G,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ImageAnnotation } from '@annotorious/annotorious';
|
|
3
|
+
|
|
3
4
|
export interface AnnotoriousPopupProps {
|
|
4
5
|
selected: {
|
|
5
6
|
annotation: ImageAnnotation;
|
|
@@ -12,5 +13,5 @@ export interface DraggableProps {
|
|
|
12
13
|
onDragStart?(): void;
|
|
13
14
|
onDragEnd?(): void;
|
|
14
15
|
}
|
|
15
|
-
export declare const Draggable: import(
|
|
16
|
+
export declare const Draggable: import('react').ForwardRefExoticComponent<DraggableProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
16
17
|
//# sourceMappingURL=AnnotoriousPopup.d.ts.map
|
package/dist/ImageAnnotator.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { AnnotoriousOpts } from '@annotorious/annotorious';
|
|
3
|
-
|
|
2
|
+
import { AnnotoriousOpts, DrawingStyle, DrawingTool, Filter, ImageAnnotation } from '@annotorious/annotorious';
|
|
3
|
+
|
|
4
4
|
export interface ImageAnnotatorProps<E extends unknown> extends AnnotoriousOpts<ImageAnnotation, E> {
|
|
5
5
|
children: ReactElement<HTMLImageElement>;
|
|
6
6
|
filter?: Filter<ImageAnnotation>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageAnnotator.d.ts","sourceRoot":"","sources":["../src/ImageAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAuC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGnG,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;IAEjG,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAEzC,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAEjC,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,UAAU,EAAE,eAAe,KAAK,YAAY,CAAC,CAAC;IAEvE,IAAI,CAAC,EAAE,WAAW,CAAA;CAEnB;AAED,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"ImageAnnotator.d.ts","sourceRoot":"","sources":["../src/ImageAnnotator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,YAAY,EAAuC,MAAM,OAAO,CAAC;AACpF,OAAO,EAAE,eAAe,EAAwB,MAAM,0BAA0B,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGnG,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,OAAO,CAAE,SAAQ,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;IAEjG,QAAQ,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC;IAEzC,MAAM,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;IAEjC,KAAK,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,UAAU,EAAE,eAAe,KAAK,YAAY,CAAC,CAAC;IAEvE,IAAI,CAAC,EAAE,WAAW,CAAA;CAEnB;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,OAAO,SAAS,mBAAmB,CAAC,CAAC,CAAC,4CA+B9E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
canvas.a9s-gl-canvas{height:100%;left:0;position:absolute;top:0;width:100%}canvas.a9s-gl-canvas.hover{cursor:pointer!important}svg.svelte-190cqdf.svelte-190cqdf{pointer-events:none}svg.drawing.svelte-190cqdf.svelte-190cqdf{pointer-events:all}svg.svelte-190cqdf .svelte-190cqdf{pointer-events:all}text.svelte-1rehw2p{fill:#fff;font-family:Arial,Helvetica,sans-serif;font-weight:600}rect.svelte-1rehw2p{stroke-width:1.2;vector-effect:non-scaling-stroke}polygon.svelte-fgq4n0{stroke-width:1.2;vector-effect:non-scaling-stroke}rect.svelte-gze948{stroke-width:1.2;vector-effect:non-scaling-stroke}svg.svelte-1krwc4m{position:absolute;top:0;left:0;width:100%;height:100%;outline:none;pointer-events:none}.a9s-annotationlayer{box-sizing:border-box;height:100%;left:0;outline:none;position:absolute;top:0;touch-action:none;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.a9s-annotationlayer ellipse,.a9s-annotationlayer polygon,.a9s-annotationlayer rect{fill:transparent;shape-rendering:geometricPrecision;vector-effect:non-scaling-stroke}.a9s-edge-handle{fill:transparent;stroke:transparent;stroke-width:6px}.a9s-shape-handle,.a9s-
|
|
1
|
+
canvas.a9s-gl-canvas{height:100%;left:0;position:absolute;top:0;width:100%}canvas.a9s-gl-canvas.hidden{display:none}canvas.a9s-gl-canvas.hover{cursor:pointer!important}svg.svelte-190cqdf.svelte-190cqdf{pointer-events:none}svg.drawing.svelte-190cqdf.svelte-190cqdf{pointer-events:all}svg.svelte-190cqdf .svelte-190cqdf{pointer-events:all}text.svelte-1rehw2p{fill:#fff;font-family:Arial,Helvetica,sans-serif;font-weight:600}rect.svelte-1rehw2p{stroke-width:1.2;vector-effect:non-scaling-stroke}polygon.svelte-fgq4n0{stroke-width:1.2;vector-effect:non-scaling-stroke}rect.svelte-gze948{stroke-width:1.2;vector-effect:non-scaling-stroke}svg.svelte-1krwc4m{position:absolute;top:0;left:0;width:100%;height:100%;outline:none;pointer-events:none}.a9s-touch-halo.svelte-1sgkh33{fill:transparent;stroke-width:0}.a9s-touch-halo.touched.svelte-1sgkh33{fill:#ffffff40}.a9s-annotationlayer{box-sizing:border-box;height:100%;left:0;outline:none;position:absolute;top:0;touch-action:none;width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.a9s-annotationlayer.hidden{display:none}.a9s-annotationlayer ellipse,.a9s-annotationlayer polygon,.a9s-annotationlayer rect{fill:transparent;shape-rendering:geometricPrecision;vector-effect:non-scaling-stroke}.a9s-edge-handle{fill:transparent;stroke:transparent;stroke-width:6px}.a9s-shape-handle,.a9s-handle{cursor:move}.a9s-edge-handle-top{cursor:n-resize}.a9s-edge-handle-right{cursor:e-resize}.a9s-edge-handle-bottom{cursor:s-resize}.a9s-edge-handle-left{cursor:w-resize}.a9s-handle.a9s-corner-handle-topleft{cursor:nw-resize}.a9s-handle.a9s-corner-handle-topright{cursor:ne-resize}.a9s-handle.a9s-corner-handle-bottomright{cursor:se-resize}.a9s-handle.a9s-corner-handle-bottomleft{cursor:sw-resize}.a9s-annotationlayer .a9s-outer,div[data-theme=dark] .a9s-annotationlayer .a9s-outer{display:none}.a9s-annotationlayer .a9s-inner,div[data-theme=dark] .a9s-annotationlayer .a9s-inner{fill:#0000001f;stroke:#000;stroke-width:1px}rect.a9s-handle,div[data-theme=dark] rect.a9s-handle{fill:#000;rx:2px}rect.a9s-close-polygon-handle,div[data-theme=dark] rect.a9s-close-polygon-handle{fill:#000;rx:1px}.a9s-annotationlayer .a9s-outer,div[data-theme=light] .a9s-annotationlayer .a9s-outer{display:block;stroke:#00000040;stroke-width:3.5px}.a9s-annotationlayer .a9s-inner,div[data-theme=light] .a9s-annotationlayer .a9s-inner{fill:#ffffff26;stroke:#fff;stroke-width:1.5px}rect.a9s-handle,div[data-theme=light] rect.a9s-handle{fill:#fff;rx:1px;stroke:#00000073;stroke-width:1px}rect.a9s-close-polygon-handle,div[data-theme=light] rect.a9s-close-polygon-handle{fill:#fff;rx:1px;stroke:#00000073;stroke-width:1px}
|
|
@@ -1,55 +1,38 @@
|
|
|
1
|
-
import { Annotorious as
|
|
2
|
-
import { AnnotoriousPlugin as
|
|
3
|
-
import { Draggable as
|
|
4
|
-
import { ImageAnnotator as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
import { createBody as G, getContributors as K } from "./annotorious-react.es14.js";
|
|
14
|
-
import { diffAnnotations as R } from "./annotorious-react.es15.js";
|
|
15
|
-
import { PointerSelectAction as U } from "./annotorious-react.es16.js";
|
|
16
|
-
import { Origin as _ } from "./annotorious-react.es17.js";
|
|
17
|
-
import { ShapeType as k, W3CImageFormat as q } from "./annotorious-react.es18.js";
|
|
18
|
-
import { OpenSeadragonAnnotator as J, useViewer as L } from "./annotorious-react.es19.js";
|
|
19
|
-
import { OpenSeadragonPopup as Q } from "./annotorious-react.es20.js";
|
|
20
|
-
import { OpenSeadragonViewer as Z } from "./annotorious-react.es21.js";
|
|
1
|
+
import { Annotorious as g, AnnotoriousContext as A, useAnnotationStore as c, useAnnotations as f, useAnnotator as x, useAnnotatorUser as S, useSelection as I, useViewportState as d } from "./annotorious-react.es2.js";
|
|
2
|
+
import { AnnotoriousPlugin as y } from "./annotorious-react.es3.js";
|
|
3
|
+
import { Draggable as O } from "./annotorious-react.es4.js";
|
|
4
|
+
import { ImageAnnotator as h } from "./annotorious-react.es5.js";
|
|
5
|
+
/* empty css */
|
|
6
|
+
/* empty css */
|
|
7
|
+
import { Origin as F, PointerSelectAction as T, createAnonymousGuest as V, createBody as W, defaultColorProvider as $ } from "@annotorious/core";
|
|
8
|
+
import { createImageAnnotator as o, ShapeType as e, W3CImageFormat as t } from "@annotorious/annotorious";
|
|
9
|
+
import { OpenSeadragonAnnotator as v, useViewer as B } from "./annotorious-react.es8.js";
|
|
10
|
+
import { OpenSeadragonPopup as G } from "./annotorious-react.es9.js";
|
|
11
|
+
import { OpenSeadragonViewer as j } from "./annotorious-react.es10.js";
|
|
12
|
+
const p = o, m = e, s = t;
|
|
21
13
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
B as
|
|
44
|
-
|
|
45
|
-
E as serializeAll,
|
|
46
|
-
W as serializeW3CBodies,
|
|
47
|
-
p as useAnnotationStore,
|
|
48
|
-
i as useAnnotations,
|
|
49
|
-
m as useAnnotator,
|
|
50
|
-
s as useAnnotatorUser,
|
|
51
|
-
f as useSelection,
|
|
52
|
-
L as useViewer,
|
|
53
|
-
x as useViewportState
|
|
14
|
+
g as Annotorious,
|
|
15
|
+
A as AnnotoriousContext,
|
|
16
|
+
y as AnnotoriousPlugin,
|
|
17
|
+
O as Draggable,
|
|
18
|
+
h as ImageAnnotator,
|
|
19
|
+
v as OpenSeadragonAnnotator,
|
|
20
|
+
G as OpenSeadragonPopup,
|
|
21
|
+
j as OpenSeadragonViewer,
|
|
22
|
+
F as Origin,
|
|
23
|
+
T as PointerSelectAction,
|
|
24
|
+
m as ShapeType,
|
|
25
|
+
s as W3CImageFormat,
|
|
26
|
+
V as createAnonymousGuest,
|
|
27
|
+
W as createBody,
|
|
28
|
+
p as createImageAnnotator,
|
|
29
|
+
$ as defaultColorProvider,
|
|
30
|
+
c as useAnnotationStore,
|
|
31
|
+
f as useAnnotations,
|
|
32
|
+
x as useAnnotator,
|
|
33
|
+
S as useAnnotatorUser,
|
|
34
|
+
I as useSelection,
|
|
35
|
+
B as useViewer,
|
|
36
|
+
d as useViewportState
|
|
54
37
|
};
|
|
55
38
|
//# sourceMappingURL=annotorious-react.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"annotorious-react.es.js","sources":["../src/index.ts"],"sourcesContent":["export * from './Annotorious';\nexport * from './AnnotoriousPlugin';\nexport * from './AnnotoriousPopup';\nexport * from './ImageAnnotator';\n\nexport * from './openseadragon';\n\n// This ensures the Annotorious stylesheet gets packaged into annotorious-react\nimport '@annotorious/annotorious/annotorious.css';\nimport '@annotorious/openseadragon/annotorious-openseadragon.css';\n\n// Essential re-exports from @annotorious/core\nexport type {\n Annotation,\n AnnotationBody,\n AnnotationState,\n AnnotationTarget,\n Annotator,\n AnnotatorState,\n Appearance,\n AppearanceProvider,\n Color,\n DrawingStyle,\n DrawingStyleExpression,\n Filter,\n FormatAdapter,\n HoverState,\n LifecycleEvents,\n ParseResult,\n PresentUser,\n Selection,\n SelectionState,\n Store,\n StoreChangeEvent,\n StoreObserver,\n User,\n W3CAnnotation,\n W3CAnnotationBody,\n W3CAnnotationTarget\n} from '@annotorious/core';\n\nimport {\n createAnonymousGuest as _createAnonymousGuest, \n createBody as _createBody,\n defaultColorProvider as _defaultColorProvider,\n Origin as _Origin,\n PointerSelectAction as _PointerSelectAction\n} from '@annotorious/core';\n\nexport { _createAnonymousGuest as createAnonymousGuest };\nexport { _createBody as createBody };\nexport { _defaultColorProvider as defaultColorProvider };\nexport { _Origin as Origin };\nexport { _PointerSelectAction as PointerSelectAction };\n\n// Essential re-exports from @annotorious/annotorious \nexport type {\n AnnotoriousOpts,\n DrawingMode,\n DrawingTool,\n FragmentSelector,\n ImageAnnotator as AnnotoriousImageAnnotator,\n ImageAnnotation,\n ImageAnnotatorState,\n Polygon,\n PolygonGeometry,\n Rectangle,\n RectangleGeometry,\n Shape,\n SVGSelector,\n W3CImageAnnotation,\n W3CImageAnnotationTarget\n} from '@annotorious/annotorious';\n\nimport { \n createImageAnnotator as _createImageAnnotator,\n ShapeType as _ShapeType,\n W3CImageFormat as _W3CImageFormat\n} from '@annotorious/annotorious';\n\nexport const createImageAnnotator = _createImageAnnotator;\nexport const ShapeType = _ShapeType;\nexport const W3CImageFormat = _W3CImageFormat;\n\n// Essential re-exports from @annotorious/openseadragon \nexport type {\n OpenSeadragonAnnotator as AnnotoriousOpenSeadragonAnnotator\n} from '@annotorious/openseadragon';\n\nexport type { Viewer } from 'openseadragon';\n"],"names":["createImageAnnotator","_createImageAnnotator","ShapeType","_ShapeType","W3CImageFormat","_W3CImageFormat"],"mappings":";;;;;;;;;;;AAgFO,MAAMA,IAAuBC,GACvBC,IAAYC,GACZC,IAAiBC;"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { j as f } from "./annotorious-react.es11.js";
|
|
2
|
+
import { forwardRef as m, useRef as p, useContext as u, useLayoutEffect as c, useImperativeHandle as d } from "react";
|
|
3
|
+
import l from "openseadragon";
|
|
4
|
+
import { OpenSeadragonAnnotatorContext as x } from "./annotorious-react.es8.js";
|
|
5
|
+
const S = m((n, s) => {
|
|
6
|
+
const { className: i, options: t } = n, r = p(null), { viewer: a, setViewer: e } = u(x);
|
|
7
|
+
return c(() => {
|
|
8
|
+
if (r.current) {
|
|
9
|
+
const o = l({ ...t, element: r.current });
|
|
10
|
+
return e && e(o), () => {
|
|
11
|
+
o.destroy(), e && e(void 0);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}, [JSON.stringify(t)]), d(s, () => a), /* @__PURE__ */ f.jsx("div", { className: i, ref: r });
|
|
15
|
+
});
|
|
3
16
|
export {
|
|
4
|
-
|
|
17
|
+
S as OpenSeadragonViewer
|
|
5
18
|
};
|
|
6
19
|
//# sourceMappingURL=annotorious-react.es10.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es10.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es10.js","sources":["../src/openseadragon/OpenSeadragonViewer.tsx"],"sourcesContent":["import { forwardRef, useContext, useImperativeHandle, useLayoutEffect, useRef } from 'react';\nimport OpenSeadragon from 'openseadragon';\nimport { OpenSeadragonAnnotatorContext } from './OpenSeadragonAnnotator';\n\nexport interface OpenSeadragonViewerProps {\n\n className?: string;\n\n options: OpenSeadragon.Options;\n\n}\n\nexport const OpenSeadragonViewer = forwardRef<OpenSeadragon.Viewer, OpenSeadragonViewerProps>((props: OpenSeadragonViewerProps, ref) => {\n\n const { className, options } = props;\n\n const element = useRef<HTMLDivElement>(null);\n\n const { viewer, setViewer } = useContext(OpenSeadragonAnnotatorContext);\n\n useLayoutEffect(() => { \n if (element.current) {\n const v = OpenSeadragon({...options, element: element.current });\n\n // Checking for setViewer is just a convenience so we can\n // use this component also without an OpenSeadragonAnnotator\n if (setViewer)\n setViewer(v);\n\n return () => {\n v.destroy();\n\n if (setViewer) \n setViewer(undefined);\n }\n }\n }, [JSON.stringify(options)]);\n\n useImperativeHandle(ref, () => viewer);\n\n return (\n <div className={className} ref={element} />\n );\n\n});"],"names":["OpenSeadragonViewer","forwardRef","props","ref","className","options","element","useRef","viewer","setViewer","useContext","OpenSeadragonAnnotatorContext","useLayoutEffect","v","OpenSeadragon","useImperativeHandle","jsx"],"mappings":";;;;AAYO,MAAMA,IAAsBC,EAA2D,CAACC,GAAiCC,MAAQ;AAEhI,QAAA,EAAE,WAAAC,GAAW,SAAAC,EAAY,IAAAH,GAEzBI,IAAUC,EAAuB,IAAI,GAErC,EAAE,QAAAC,GAAQ,WAAAC,EAAU,IAAIC,EAAWC,CAA6B;AAEtE,SAAAC,EAAgB,MAAM;AACpB,QAAIN,EAAQ,SAAS;AACb,YAAAO,IAAIC,EAAc,EAAC,GAAGT,GAAS,SAASC,EAAQ,SAAS;AAI3D,aAAAG,KACFA,EAAUI,CAAC,GAEN,MAAM;AACX,QAAAA,EAAE,QAAQ,GAENJ,KACFA,EAAU,MAAS;AAAA,MAAA;AAAA,IAEzB;AAAA,KACC,CAAC,KAAK,UAAUJ,CAAO,CAAC,CAAC,GAERU,EAAAZ,GAAK,MAAMK,CAAM,GAGlCQ,gBAAAA,EAAAA,IAAA,OAAA,EAAI,WAAAZ,GAAsB,KAAKE,EAAS,CAAA;AAG7C,CAAC;"}
|
|
@@ -1,30 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
t = (t << 5) - t + n, t |= 0;
|
|
7
|
-
}
|
|
8
|
-
return `${t}`;
|
|
9
|
-
}, l = (r, o) => (Array.isArray(r) ? r : [r]).map((t) => {
|
|
10
|
-
const { id: e, type: a, purpose: n, value: i, created: c, creator: s, ...p } = t;
|
|
11
|
-
return {
|
|
12
|
-
id: e || `temp-${d(t)}`,
|
|
13
|
-
annotation: o,
|
|
14
|
-
type: a,
|
|
15
|
-
purpose: n,
|
|
16
|
-
value: i,
|
|
17
|
-
created: c,
|
|
18
|
-
creator: s ? typeof s == "object" ? { ...s } : s : void 0,
|
|
19
|
-
...p
|
|
20
|
-
};
|
|
21
|
-
}), h = (r) => r.map((o) => {
|
|
22
|
-
var e;
|
|
23
|
-
const t = { ...o };
|
|
24
|
-
return delete t.annotation, (e = t.id) != null && e.startsWith("temp-") && delete t.id, t;
|
|
25
|
-
});
|
|
1
|
+
import { __module as e } from "./annotorious-react.es15.js";
|
|
2
|
+
import { __require as r } from "./annotorious-react.es16.js";
|
|
3
|
+
import { __require as o } from "./annotorious-react.es17.js";
|
|
4
|
+
process.env.NODE_ENV === "production" ? e.exports = r() : e.exports = o();
|
|
5
|
+
var m = e.exports;
|
|
26
6
|
export {
|
|
27
|
-
|
|
28
|
-
h as serializeW3CBodies
|
|
7
|
+
m as j
|
|
29
8
|
};
|
|
30
9
|
//# sourceMappingURL=annotorious-react.es11.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es11.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es11.js","sources":["../../../node_modules/react/jsx-runtime.js"],"sourcesContent":["'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n"],"names":["jsxRuntimeModule","require$$0","require$$1"],"mappings":";;;AAEI,QAAQ,IAAI,aAAa,eAC3BA,EAAA,UAAiBC,MAEjBD,EAAA,UAAiBE;;","x_google_ignoreList":[0]}
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
const o =
|
|
4
|
-
return
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}, releaseColor: (r) => o.push(r) };
|
|
8
|
-
}, d = () => {
|
|
9
|
-
const o = l();
|
|
10
|
-
return { addUser: (r, e) => {
|
|
11
|
-
const s = o.assignRandomColor();
|
|
12
|
-
return {
|
|
13
|
-
label: e.name || e.id,
|
|
14
|
-
avatar: e.avatar,
|
|
15
|
-
color: s
|
|
16
|
-
};
|
|
17
|
-
}, removeUser: (r) => o.releaseColor(r.appearance.color) };
|
|
1
|
+
import { useState as c, useRef as n, useEffect as s } from "react";
|
|
2
|
+
const m = (e, t) => {
|
|
3
|
+
const [u, o] = c(e), r = n();
|
|
4
|
+
return s(() => (r.current = setTimeout(() => o(e), t), () => {
|
|
5
|
+
clearTimeout(r.current);
|
|
6
|
+
}), [e, t]), u;
|
|
18
7
|
};
|
|
19
8
|
export {
|
|
20
|
-
|
|
21
|
-
l as defaultColorProvider
|
|
9
|
+
m as useDebounce
|
|
22
10
|
};
|
|
23
11
|
//# sourceMappingURL=annotorious-react.es12.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es12.js","sources":["
|
|
1
|
+
{"version":3,"file":"annotorious-react.es12.js","sources":["../src/useDebounce.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\nexport const useDebounce = (value: any, delay: number) => {\n const [debouncedValue, setDebouncedValue] = useState<any>(value);\n\n const timerRef = useRef<ReturnType<typeof setTimeout>>();\n\n useEffect(() => {\n timerRef.current = \n setTimeout(() => setDebouncedValue(value), delay);\n\n return () => {\n clearTimeout(timerRef.current);\n };\n }, [value, delay]);\n\n return debouncedValue;\n}"],"names":["useDebounce","value","delay","debouncedValue","setDebouncedValue","useState","timerRef","useRef","useEffect"],"mappings":";AAEa,MAAAA,IAAc,CAACC,GAAYC,MAAkB;AACxD,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAcJ,CAAK,GAEzDK,IAAWC;AAEjB,SAAAC,EAAU,OACRF,EAAS,UACP,WAAW,MAAMF,EAAkBH,CAAK,GAAGC,CAAK,GAE3C,MAAM;AACX,iBAAaI,EAAS,OAAO;AAAA,EAAA,IAE9B,CAACL,GAAOC,CAAK,CAAC,GAEVC;AACT;"}
|
|
@@ -1,57 +1,137 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useRef as pe, useState as ie, useEffect as se } from "react";
|
|
2
|
+
var Q = { dragStart: !0 }, he = (e, t = {}) => {
|
|
3
|
+
let o, l, { bounds: c, axis: m = "both", gpuAcceleration: f = !0, legacyTranslate: R = !0, transform: M, applyUserSelectHack: N = !0, disabled: $ = !1, ignoreMultitouch: B = !1, recomputeBounds: b = Q, grid: H, position: u, cancel: D, handle: S, defaultClass: E = "neodrag", defaultClassDragging: i = "neodrag-dragging", defaultClassDragged: g = "neodrag-dragged", defaultPosition: U = { x: 0, y: 0 }, onDragStart: ce, onDrag: ue, onDragEnd: fe } = t, Y = !1, x = 0, A = 0, L = 0, T = 0, W = 0, j = 0, { x: q, y: P } = u ? { x: (u == null ? void 0 : u.x) ?? 0, y: (u == null ? void 0 : u.y) ?? 0 } : U;
|
|
4
|
+
J(q, P);
|
|
5
|
+
let y, C, X, F, ee, ne = "", ge = !!u;
|
|
6
|
+
b = { ...Q, ...b };
|
|
7
|
+
let k = /* @__PURE__ */ new Set();
|
|
8
|
+
const G = document.body.style, v = e.classList;
|
|
9
|
+
function J(n = x, a = A) {
|
|
10
|
+
if (!M) {
|
|
11
|
+
if (R) {
|
|
12
|
+
let d = `${+n}px, ${+a}px`;
|
|
13
|
+
return z(e, "transform", f ? `translate3d(${d}, 0)` : `translate(${d})`);
|
|
14
|
+
}
|
|
15
|
+
return z(e, "translate", `${+n}px ${+a}px ${f ? "1px" : ""}`);
|
|
9
16
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
const s = M({ offsetX: n, offsetY: a, rootNode: e });
|
|
18
|
+
V(s) && z(e, "transform", s);
|
|
19
|
+
}
|
|
20
|
+
const K = (n, a) => {
|
|
21
|
+
const s = { offsetX: x, offsetY: A, rootNode: e, currentNode: ee };
|
|
22
|
+
e.dispatchEvent(new CustomEvent(n, { detail: s })), a == null || a(s);
|
|
23
|
+
}, O = addEventListener;
|
|
24
|
+
O("pointerdown", te, !1), O("pointerup", oe, !1), O("pointermove", ae, !1), z(e, "touch-action", "none");
|
|
25
|
+
const re = () => {
|
|
26
|
+
let n = e.offsetWidth / C.width;
|
|
27
|
+
return isNaN(n) && (n = 1), n;
|
|
28
|
+
};
|
|
29
|
+
function te(n) {
|
|
30
|
+
if ($ || n.button === 2) return;
|
|
31
|
+
if (k.add(n.pointerId), B && k.size > 1) return n.preventDefault();
|
|
32
|
+
if (b.dragStart && (y = Z(c, e)), V(S) && V(D) && S === D) throw new Error("`handle` selector can't be same as `cancel` selector");
|
|
33
|
+
if (v.add(E), X = function(r, h) {
|
|
34
|
+
if (!r) return [h];
|
|
35
|
+
if (_(r)) return [r];
|
|
36
|
+
if (Array.isArray(r)) return r;
|
|
37
|
+
const w = h.querySelectorAll(r);
|
|
38
|
+
if (w === null) throw new Error("Selector passed for `handle` option should be child of the element on which the action is applied");
|
|
39
|
+
return Array.from(w.values());
|
|
40
|
+
}(S, e), F = function(r, h) {
|
|
41
|
+
if (!r) return [];
|
|
42
|
+
if (_(r)) return [r];
|
|
43
|
+
if (Array.isArray(r)) return r;
|
|
44
|
+
const w = h.querySelectorAll(r);
|
|
45
|
+
if (w === null) throw new Error("Selector passed for `cancel` option should be child of the element on which the action is applied");
|
|
46
|
+
return Array.from(w.values());
|
|
47
|
+
}(D, e), o = /(both|x)/.test(m), l = /(both|y)/.test(m), le(F, X)) throw new Error("Element being dragged can't be a child of the element on which `cancel` is applied");
|
|
48
|
+
const a = n.composedPath()[0];
|
|
49
|
+
if (!X.some((r) => {
|
|
50
|
+
var h;
|
|
51
|
+
return r.contains(a) || ((h = r.shadowRoot) == null ? void 0 : h.contains(a));
|
|
52
|
+
}) || le(F, [a])) return;
|
|
53
|
+
ee = X.length === 1 ? e : X.find((r) => r.contains(a)), Y = !0, C = e.getBoundingClientRect(), N && (ne = G.userSelect, G.userSelect = "none"), K("neodrag:start", ce);
|
|
54
|
+
const { clientX: s, clientY: d } = n, p = re();
|
|
55
|
+
o && (L = s - q / p), l && (T = d - P / p), y && (W = s - C.left, j = d - C.top);
|
|
56
|
+
}
|
|
57
|
+
function oe(n) {
|
|
58
|
+
k.delete(n.pointerId), Y && (b.dragEnd && (y = Z(c, e)), v.remove(i), v.add(g), N && (G.userSelect = ne), K("neodrag:end", fe), o && (L = x), l && (T = A), Y = !1);
|
|
59
|
+
}
|
|
60
|
+
function ae(n) {
|
|
61
|
+
if (!Y || B && k.size > 1) return;
|
|
62
|
+
b.drag && (y = Z(c, e)), v.add(i), n.preventDefault(), C = e.getBoundingClientRect();
|
|
63
|
+
let a = n.clientX, s = n.clientY;
|
|
64
|
+
const d = re();
|
|
65
|
+
if (y) {
|
|
66
|
+
const p = { left: y.left + W, top: y.top + j, right: y.right + W - C.width, bottom: y.bottom + j - C.height };
|
|
67
|
+
a = de(a, p.left, p.right), s = de(s, p.top, p.bottom);
|
|
34
68
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return;
|
|
69
|
+
if (Array.isArray(H)) {
|
|
70
|
+
let [p, r] = H;
|
|
71
|
+
if (isNaN(+p) || p < 0) throw new Error("1st argument of `grid` must be a valid positive number");
|
|
72
|
+
if (isNaN(+r) || r < 0) throw new Error("2nd argument of `grid` must be a valid positive number");
|
|
73
|
+
let h = a - L, w = s - T;
|
|
74
|
+
[h, w] = me([p / d, r / d], h, w), a = L + h, s = T + w;
|
|
42
75
|
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
76
|
+
o && (x = Math.round((a - L) * d)), l && (A = Math.round((s - T) * d)), q = x, P = A, K("neodrag", ue), J();
|
|
77
|
+
}
|
|
78
|
+
return { destroy: () => {
|
|
79
|
+
const n = removeEventListener;
|
|
80
|
+
n("pointerdown", te, !1), n("pointerup", oe, !1), n("pointermove", ae, !1);
|
|
81
|
+
}, update: (n) => {
|
|
82
|
+
var s, d;
|
|
83
|
+
m = n.axis || "both", $ = n.disabled ?? !1, B = n.ignoreMultitouch ?? !1, S = n.handle, c = n.bounds, b = n.recomputeBounds ?? Q, D = n.cancel, N = n.applyUserSelectHack ?? !0, H = n.grid, f = n.gpuAcceleration ?? !0, R = n.legacyTranslate ?? !0, M = n.transform;
|
|
84
|
+
const a = v.contains(g);
|
|
85
|
+
v.remove(E, g), E = n.defaultClass ?? "neodrag", i = n.defaultClassDragging ?? "neodrag-dragging", g = n.defaultClassDragged ?? "neodrag-dragged", v.add(E), a && v.add(g), ge && (q = x = ((s = n.position) == null ? void 0 : s.x) ?? x, P = A = ((d = n.position) == null ? void 0 : d.y) ?? A, J());
|
|
86
|
+
} };
|
|
87
|
+
}, de = (e, t, o) => Math.min(Math.max(e, t), o), V = (e) => typeof e == "string", me = ([e, t], o, l) => {
|
|
88
|
+
const c = (m, f) => f === 0 ? 0 : Math.ceil(m / f) * f;
|
|
89
|
+
return [c(o, e), c(l, t)];
|
|
90
|
+
}, le = (e, t) => e.some((o) => t.some((l) => o.contains(l)));
|
|
91
|
+
function Z(e, t) {
|
|
92
|
+
if (e === void 0) return;
|
|
93
|
+
if (_(e)) return e.getBoundingClientRect();
|
|
94
|
+
if (typeof e == "object") {
|
|
95
|
+
const { top: l = 0, left: c = 0, right: m = 0, bottom: f = 0 } = e;
|
|
96
|
+
return { top: l, right: window.innerWidth - m, bottom: window.innerHeight - f, left: c };
|
|
97
|
+
}
|
|
98
|
+
if (e === "parent") return t.parentNode.getBoundingClientRect();
|
|
99
|
+
const o = document.querySelector(e);
|
|
100
|
+
if (o === null) throw new Error("The selector provided for bound doesn't exists in the document.");
|
|
101
|
+
return o.getBoundingClientRect();
|
|
102
|
+
}
|
|
103
|
+
var z = (e, t, o) => e.style.setProperty(t, o), _ = (e) => e instanceof HTMLElement;
|
|
104
|
+
function I(e) {
|
|
105
|
+
return e == null || typeof e == "string" || e instanceof HTMLElement ? e : "current" in e ? e.current : Array.isArray(e) ? e.map((t) => t instanceof HTMLElement ? t : t.current) : void 0;
|
|
106
|
+
}
|
|
107
|
+
function we(e, t = {}) {
|
|
108
|
+
const o = pe(), [l, c] = ie(!1), [m, f] = ie();
|
|
109
|
+
let { onDragStart: R, onDrag: M, onDragEnd: N, handle: $, cancel: B } = t, b = I($), H = I(B);
|
|
110
|
+
function u(i, g) {
|
|
111
|
+
f(i), g == null || g(i);
|
|
112
|
+
}
|
|
113
|
+
function D(i) {
|
|
114
|
+
c(!0), u(i, R);
|
|
115
|
+
}
|
|
116
|
+
function S(i) {
|
|
117
|
+
u(i, M);
|
|
118
|
+
}
|
|
119
|
+
function E(i) {
|
|
120
|
+
c(!1), u(i, N);
|
|
121
|
+
}
|
|
122
|
+
return se(() => {
|
|
123
|
+
if (typeof window > "u") return;
|
|
124
|
+
const i = e.current;
|
|
125
|
+
if (!i) return;
|
|
126
|
+
({ onDragStart: R, onDrag: M, onDragEnd: N } = t);
|
|
127
|
+
const { update: g, destroy: U } = he(i, { ...t, handle: b, cancel: H, onDragStart: D, onDrag: S, onDragEnd: E });
|
|
128
|
+
return o.current = g, U;
|
|
129
|
+
}, []), se(() => {
|
|
130
|
+
var i;
|
|
131
|
+
(i = o.current) == null || i.call(o, { ...t, handle: I($), cancel: I(B), onDragStart: D, onDrag: S, onDragEnd: E });
|
|
132
|
+
}, [t]), { isDragging: l, dragState: m };
|
|
133
|
+
}
|
|
53
134
|
export {
|
|
54
|
-
|
|
55
|
-
y as createPresenceState
|
|
135
|
+
we as useDraggable
|
|
56
136
|
};
|
|
57
137
|
//# sourceMappingURL=annotorious-react.es13.js.map
|