@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.
Files changed (98) hide show
  1. package/dist/Annotorious.d.ts +8 -32
  2. package/dist/Annotorious.d.ts.map +1 -1
  3. package/dist/AnnotoriousPlugin.d.ts +8 -6
  4. package/dist/AnnotoriousPlugin.d.ts.map +1 -1
  5. package/dist/AnnotoriousPopup.d.ts +2 -1
  6. package/dist/ImageAnnotator.d.ts +2 -2
  7. package/dist/ImageAnnotator.d.ts.map +1 -1
  8. package/dist/annotorious-react.css +1 -1
  9. package/dist/annotorious-react.es.js +35 -52
  10. package/dist/annotorious-react.es.js.map +1 -1
  11. package/dist/annotorious-react.es10.js +16 -3
  12. package/dist/annotorious-react.es10.js.map +1 -1
  13. package/dist/annotorious-react.es11.js +6 -27
  14. package/dist/annotorious-react.es11.js.map +1 -1
  15. package/dist/annotorious-react.es12.js +7 -19
  16. package/dist/annotorious-react.es12.js.map +1 -1
  17. package/dist/annotorious-react.es13.js +131 -51
  18. package/dist/annotorious-react.es13.js.map +1 -1
  19. package/dist/annotorious-react.es14.js +32 -17
  20. package/dist/annotorious-react.es14.js.map +1 -1
  21. package/dist/annotorious-react.es15.js +2 -22
  22. package/dist/annotorious-react.es15.js.map +1 -1
  23. package/dist/annotorious-react.es16.js +26 -2
  24. package/dist/annotorious-react.es16.js.map +1 -1
  25. package/dist/annotorious-react.es17.js +606 -2
  26. package/dist/annotorious-react.es17.js.map +1 -1
  27. package/dist/annotorious-react.es18.js +2 -3859
  28. package/dist/annotorious-react.es18.js.map +1 -1
  29. package/dist/annotorious-react.es19.js +2 -29
  30. package/dist/annotorious-react.es19.js.map +1 -1
  31. package/dist/annotorious-react.es2.js +32 -32
  32. package/dist/annotorious-react.es2.js.map +1 -1
  33. package/dist/annotorious-react.es3.js +6 -7
  34. package/dist/annotorious-react.es3.js.map +1 -1
  35. package/dist/annotorious-react.es4.js +8 -8
  36. package/dist/annotorious-react.es4.js.map +1 -1
  37. package/dist/annotorious-react.es5.js +10 -10
  38. package/dist/annotorious-react.es5.js.map +1 -1
  39. package/dist/annotorious-react.es8.js +27 -47
  40. package/dist/annotorious-react.es8.js.map +1 -1
  41. package/dist/annotorious-react.es9.js +35 -12
  42. package/dist/annotorious-react.es9.js.map +1 -1
  43. package/dist/index.d.ts +10 -10
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/openseadragon/OpenSeadragonAnnotator.d.ts +3 -2
  46. package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
  47. package/dist/openseadragon/OpenSeadragonPopup.d.ts +2 -1
  48. package/dist/openseadragon/OpenSeadragonViewer.d.ts +3 -3
  49. package/dist/openseadragon/OpenSeadragonViewer.d.ts.map +1 -1
  50. package/dist/openseadragon/setPosition.d.ts +2 -1
  51. package/dist/openseadragon/setPosition.d.ts.map +1 -1
  52. package/package.json +18 -10
  53. package/dist/annotorious-react.es20.js +0 -39
  54. package/dist/annotorious-react.es20.js.map +0 -1
  55. package/dist/annotorious-react.es21.js +0 -19
  56. package/dist/annotorious-react.es21.js.map +0 -1
  57. package/dist/annotorious-react.es22.js +0 -7
  58. package/dist/annotorious-react.es22.js.map +0 -1
  59. package/dist/annotorious-react.es23.js +0 -11
  60. package/dist/annotorious-react.es23.js.map +0 -1
  61. package/dist/annotorious-react.es24.js +0 -156
  62. package/dist/annotorious-react.es24.js.map +0 -1
  63. package/dist/annotorious-react.es25.js +0 -9
  64. package/dist/annotorious-react.es25.js.map +0 -1
  65. package/dist/annotorious-react.es26.js +0 -20665
  66. package/dist/annotorious-react.es26.js.map +0 -1
  67. package/dist/annotorious-react.es27.js +0 -35
  68. package/dist/annotorious-react.es27.js.map +0 -1
  69. package/dist/annotorious-react.es28.js +0 -5
  70. package/dist/annotorious-react.es28.js.map +0 -1
  71. package/dist/annotorious-react.es29.js +0 -33
  72. package/dist/annotorious-react.es29.js.map +0 -1
  73. package/dist/annotorious-react.es30.js +0 -602
  74. package/dist/annotorious-react.es30.js.map +0 -1
  75. package/dist/annotorious-react.es31.js +0 -5
  76. package/dist/annotorious-react.es31.js.map +0 -1
  77. package/dist/annotorious-react.es32.js +0 -5
  78. package/dist/annotorious-react.es32.js.map +0 -1
  79. package/dist/annotorious-react.es33.js +0 -20
  80. package/dist/annotorious-react.es33.js.map +0 -1
  81. package/dist/annotorious-react.es34.js +0 -30
  82. package/dist/annotorious-react.es34.js.map +0 -1
  83. package/dist/annotorious-react.es35.js +0 -19
  84. package/dist/annotorious-react.es35.js.map +0 -1
  85. package/dist/annotorious-react.es36.js +0 -24
  86. package/dist/annotorious-react.es36.js.map +0 -1
  87. package/dist/annotorious-react.es37.js +0 -19
  88. package/dist/annotorious-react.es37.js.map +0 -1
  89. package/dist/annotorious-react.es38.js +0 -7
  90. package/dist/annotorious-react.es38.js.map +0 -1
  91. package/dist/annotorious-react.es39.js +0 -11
  92. package/dist/annotorious-react.es39.js.map +0 -1
  93. package/dist/annotorious-react.es40.js +0 -10
  94. package/dist/annotorious-react.es40.js.map +0 -1
  95. package/dist/annotorious-react.es6.js +0 -5
  96. package/dist/annotorious-react.es6.js.map +0 -1
  97. package/dist/annotorious-react.es7.js +0 -5
  98. package/dist/annotorious-react.es7.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { Annotation, Annotator, StoreChangeEvent } from '@annotorious/core';
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("react").Context<{
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("react").ForwardRefExoticComponent<{
25
+ export declare const Annotorious: import('react').ForwardRefExoticComponent<{
25
26
  children: ReactNode;
26
- } & import("react").RefAttributes<Annotator<Annotation, Annotation>>>;
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: () => any;
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,EAAS,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGnF,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;qEAuEpE,CAAC;AAEH,eAAO,MAAM,YAAY,4CAGxB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;SAG9B,CAAA;AAYD,eAAO,MAAM,cAAc,oCAAqC,MAAM,QACE,CAAC;AAEzE,eAAO,MAAM,YAAY,0CAGxB,CAAA;AAED,eAAO,MAAM,gBAAgB,WAG5B,CAAA;AAmDD,eAAO,MAAM,gBAAgB,oCAAsC,MAAM,QACI,CAAC"}
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 { Annotation, Annotator } from '@annotorious/annotorious';
2
- export interface AnnotoriousPluginProps<I extends Annotation, E extends unknown> {
3
- plugin: (anno: Annotator<I, E>, opts?: Object) => ({
4
- unmount?: () => void;
5
- }) | void;
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: <I extends Annotation = Annotation, E extends unknown = unknown>(props: AnnotoriousPluginProps<I, E>) => any;
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,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,WAAW,sBAAsB,CAAE,CAAC,SAAS,UAAU,EAAE,CAAC,SAAS,OAAO;IAE9E,MAAM,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAEpF,IAAI,CAAC,EAAE,MAAM,CAAC;CAEf;AAED,eAAO,MAAM,iBAAiB,8GAkB7B,CAAA"}
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("react").ForwardRefExoticComponent<DraggableProps & import("react").RefAttributes<HTMLDivElement>>;
16
+ export declare const Draggable: import('react').ForwardRefExoticComponent<DraggableProps & import('react').RefAttributes<HTMLDivElement>>;
16
17
  //# sourceMappingURL=AnnotoriousPopup.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
- import { AnnotoriousOpts } from '@annotorious/annotorious';
3
- import type { DrawingStyle, DrawingTool, Filter, ImageAnnotation } from '@annotorious/annotorious';
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,+FA+B1B,CAAA"}
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-corner-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-corner-handle.a9s-corner-handle-topleft{cursor:nw-resize}.a9s-corner-handle.a9s-corner-handle-topright{cursor:ne-resize}.a9s-corner-handle.a9s-corner-handle-bottomright{cursor:se-resize}.a9s-corner-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-corner-handle,div[data-theme=dark] rect.a9s-corner-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-corner-handle,div[data-theme=light] rect.a9s-corner-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
+ 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 n, AnnotoriousContext as a, useAnnotationStore as p, useAnnotations as i, useAnnotator as m, useAnnotatorUser as s, useSelection as f, useViewportState as x } from "./annotorious-react.es2.js";
2
- import { AnnotoriousPlugin as A } from "./annotorious-react.es3.js";
3
- import { Draggable as c } from "./annotorious-react.es4.js";
4
- import { ImageAnnotator as g } from "./annotorious-react.es5.js";
5
- import "./annotorious-react.es6.js";
6
- import "./annotorious-react.es7.js";
7
- import { createBaseAnnotator as C } from "./annotorious-react.es8.js";
8
- import { parseAll as B, serializeAll as E } from "./annotorious-react.es9.js";
9
- import { createAnonymousGuest as w } from "./annotorious-react.es10.js";
10
- import { parseW3CBodies as V, serializeW3CBodies as W } from "./annotorious-react.es11.js";
11
- import { createDefaultAppearenceProvider as v, defaultColorProvider as z } from "./annotorious-react.es12.js";
12
- import { PRESENCE_KEY as I, createPresenceState as h } from "./annotorious-react.es13.js";
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
- n as Annotorious,
23
- a as AnnotoriousContext,
24
- A as AnnotoriousPlugin,
25
- c as Draggable,
26
- g as ImageAnnotator,
27
- J as OpenSeadragonAnnotator,
28
- Q as OpenSeadragonPopup,
29
- Z as OpenSeadragonViewer,
30
- _ as Origin,
31
- I as PRESENCE_KEY,
32
- U as PointerSelectAction,
33
- k as ShapeType,
34
- q as W3CImageFormat,
35
- w as createAnonymousGuest,
36
- C as createBaseAnnotator,
37
- G as createBody,
38
- v as createDefaultAppearenceProvider,
39
- h as createPresenceState,
40
- z as defaultColorProvider,
41
- R as diffAnnotations,
42
- K as getContributors,
43
- B as parseAll,
44
- V as parseW3CBodies,
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 { customAlphabet as t } from "./annotorious-react.es35.js";
2
- const e = () => ({ isGuest: !0, id: t("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_", 20)() });
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
- e as createAnonymousGuest
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":["../../annotorious-core/src/model/User.ts"],"sourcesContent":["import { customAlphabet } from 'nanoid';\n\nexport interface User {\n\n id: string;\n\n isGuest?: boolean;\n\n name?: string;\n\n avatar?: string;\n\n}\n\nexport const createAnonymousGuest = () => {\n const nanoid = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_', 20);\n \n return { isGuest: true, id: nanoid() }\n}"],"names":["createAnonymousGuest","customAlphabet"],"mappings":";AAcO,MAAMA,IAAuB,OAG3B,EAAE,SAAS,IAAM,IAFTC,EAAe,mEAAmE,EAAE,EAE9D,EAAA;"}
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
- const d = (r) => {
2
- const o = JSON.stringify(r);
3
- let t = 0;
4
- for (let e = 0, a = o.length; e < a; e++) {
5
- let n = o.charCodeAt(e);
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
- l as parseW3CBodies,
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":["../../annotorious-core/src/model/W3CAnnotation.ts"],"sourcesContent":["import type { AnnotationBody } from './Annotation';\n\nexport interface W3CAnnotation {\n\n '@context': 'http://www.w3.org/ns/anno.jsonld';\n\n type: 'Annotation';\n\n id: string;\n\n body: W3CAnnotationBody | W3CAnnotationBody[]\n\n target: W3CAnnotationTarget | W3CAnnotationTarget[];\n\n [key: string]: any;\n\n}\n\nexport interface W3CAnnotationBody {\n\n id?: string;\n\n type?: string;\n\n purpose?: string;\n\n value?: string;\n\n source?: string;\n\n created?: Date;\n\n creator?: {\n\n type?: string;\n\n id: string;\n\n name?: string;\n\n };\n\n}\n\nexport interface W3CAnnotationTarget {\n\n source: string;\n\n selector?: W3CSelector | W3CSelector[];\n\n}\n\nexport interface W3CSelector {\n\n type: string;\n\n conformsTo?: string;\n\n value: string;\n}\n\n// https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript\nconst hashCode = (obj: Object): string => {\n const str = JSON.stringify(obj);\n\n let hash = 0;\n\n for (let i = 0, len = str.length; i < len; i++) {\n let chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n\n return `${hash}`;\n}\n\n/**\n * Helper to crosswalk the W3C annotation body to a list of core AnnotationBody objects.\n */\nexport const parseW3CBodies = (\n body: W3CAnnotationBody | W3CAnnotationBody[], \n annotationId: string\n): AnnotationBody[] => (Array.isArray(body) ? body : [body]).map(body => {\n\n // Exctract properties that conform to the internal model, but keep custom props\n const { id, type, purpose, value, created, creator, ...rest } = body;\n\n // The internal model strictly requires IDs. (Because multi-user scenarios\n // will have problems without them.) In the W3C model, bodys *may* have IDs.\n // We'll create ad-hoc IDs for bodies without IDs, but want to make sure that\n // generating the ID is idempotent: the same body should always get the same ID.\n // This will avoid unexpected results when checking for equality. \n return {\n id: id || `temp-${hashCode(body)}`,\n annotation: annotationId,\n type,\n purpose,\n value,\n created,\n creator: creator ? \n typeof creator === 'object' ? { ...creator }: creator :\n undefined,\n ...rest\n }\n\n});\n\n/** Serialization helper to remove core-specific fields from the annotation body **/\nexport const serializeW3CBodies = (bodies: AnnotationBody[]): W3CAnnotationBody[] => \n bodies.map(b => {\n const w3c = { ...b };\n delete w3c.annotation;\n\n if (w3c.id?.startsWith('temp-'))\n delete w3c.id;\n \n return w3c;\n });"],"names":["hashCode","obj","str","hash","i","len","chr","parseW3CBodies","body","annotationId","id","type","purpose","value","created","creator","rest","serializeW3CBodies","bodies","b","_a","w3c"],"mappings":"AA8DA,MAAMA,IAAW,CAACC,MAAwB;AAClC,QAAAC,IAAM,KAAK,UAAUD,CAAG;AAE9B,MAAIE,IAAO;AAEX,WAASC,IAAI,GAAGC,IAAMH,EAAI,QAAQE,IAAIC,GAAKD,KAAK;AACxC,QAAAE,IAAMJ,EAAI,WAAWE,CAAC;AAClB,IAAAD,KAAAA,KAAQ,KAAKA,IAAOG,GACpBH,KAAA;AAAA,EACZ;AAEA,SAAO,GAAGA,CAAI;AAChB,GAKaI,IAAiB,CAC5BC,GACAC,OACsB,MAAM,QAAQD,CAAI,IAAIA,IAAO,CAACA,CAAI,GAAG,IAAI,CAAAA,MAAQ;AAGjE,QAAA,EAAE,IAAAE,GAAI,MAAAC,GAAM,SAAAC,GAAS,OAAAC,GAAO,SAAAC,GAAS,SAAAC,GAAS,GAAGC,EAASR,IAAAA;AAOzD,SAAA;AAAA,IACL,IAAIE,KAAM,QAAQV,EAASQ,CAAI,CAAC;AAAA,IAChC,YAAYC;AAAA,IACZ,MAAAE;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,SAASC,IACP,OAAOA,KAAY,WAAW,EAAE,GAAGA,EAAQ,IAAGA,IAC9C;AAAA,IACF,GAAGC;AAAA,EAAA;AAGP,CAAC,GAGYC,IAAqB,CAACC,MACjCA,EAAO,IAAI,CAAKC,MAAA;AA/ClB,MAAAC;AAgDU,QAAAC,IAAM,EAAE,GAAGF;AACjB,gBAAOE,EAAI,aAEPD,IAAAC,EAAI,OAAJ,QAAAD,EAAQ,WAAW,YACrB,OAAOC,EAAI,IAENA;AACT,CAAC;"}
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 { DEFAULT_PALETTE as t } from "./annotorious-react.es36.js";
2
- const l = () => {
3
- const o = [...t];
4
- return { assignRandomColor: () => {
5
- const r = Math.floor(Math.random() * o.length), e = o[r];
6
- return o.splice(r, 1), e;
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
- d as createDefaultAppearenceProvider,
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":["../../annotorious-core/src/presence/AppearanceProvider.ts"],"sourcesContent":["import type { User } from '../model';\nimport type { Appearance } from './Appearance';\nimport type { PresentUser } from './PresentUser';\nimport { DEFAULT_PALETTE } from './ColorPalette';\n\nexport interface AppearanceProvider {\n\n addUser(presenceKey: string, user: User): Appearance;\n\n removeUser(user: PresentUser): void;\n\n}\n\nexport const defaultColorProvider = () => {\n\n const unassignedColors = [...DEFAULT_PALETTE];\n\n const assignRandomColor = () => {\n const rnd = Math.floor(Math.random() * unassignedColors.length);\n const color = unassignedColors[rnd];\n\n unassignedColors.splice(rnd, 1);\n\n return color;\n }\n\n const releaseColor = (color: string) =>\n unassignedColors.push(color);\n\n return { assignRandomColor, releaseColor };\n\n}\n\nexport const createDefaultAppearenceProvider = () => {\n\n const colorProvider = defaultColorProvider();\n\n const addUser = (presenceKey: string, user: User): Appearance => {\n const color = colorProvider.assignRandomColor();\n\n return {\n label: user.name || user.id,\n avatar: user.avatar,\n color\n };\n }\n\n const removeUser = (user: PresentUser) =>\n colorProvider.releaseColor(user.appearance.color);\n\n return { addUser, removeUser }\n \n}"],"names":["defaultColorProvider","unassignedColors","DEFAULT_PALETTE","rnd","color","createDefaultAppearenceProvider","colorProvider","presenceKey","user"],"mappings":";AAaO,MAAMA,IAAuB,MAAM;AAElC,QAAAC,IAAmB,CAAC,GAAGC,CAAe;AAcrC,SAAA,EAAE,mBAZiB,MAAM;AAC9B,UAAMC,IAAM,KAAK,MAAM,KAAK,WAAWF,EAAiB,MAAM,GACxDG,IAAQH,EAAiBE,CAAG;AAEjB,WAAAF,EAAA,OAAOE,GAAK,CAAC,GAEvBC;AAAA,EAAA,GAMmB,cAHP,CAACA,MACpBH,EAAiB,KAAKG,CAAK;AAI/B,GAEaC,IAAkC,MAAM;AAEnD,QAAMC,IAAgBN;AAef,SAAA,EAAE,SAbO,CAACO,GAAqBC,MAA2B;AACzD,UAAAJ,IAAQE,EAAc;AAErB,WAAA;AAAA,MACL,OAAOE,EAAK,QAAQA,EAAK;AAAA,MACzB,QAAQA,EAAK;AAAA,MACb,OAAAJ;AAAA,IAAA;AAAA,EACF,GAMgB,YAHC,CAACI,MAClBF,EAAc,aAAaE,EAAK,WAAW,KAAK;AAIpD;"}
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 { nanoid as v } from "./annotorious-react.es35.js";
2
- import { createNanoEvents as p } from "./annotorious-react.es37.js";
3
- import { createDefaultAppearenceProvider as E } from "./annotorious-react.es12.js";
4
- const w = (c, r) => c.every((o) => c.includes(o)) && r.every((o) => c.includes(o)), P = v(), y = (c = E()) => {
5
- const r = p(), o = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), m = (t, e) => {
6
- if (o.has(t)) {
7
- console.warn("Attempt to add user that is already present", t, e);
8
- return;
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 n = c.addUser(t, e);
11
- o.set(t, {
12
- ...e,
13
- presenceKey: t,
14
- appearance: n
15
- });
16
- }, u = (t) => {
17
- const e = o.get(t);
18
- if (!e) {
19
- console.warn("Attempt to remove user that is not present", t);
20
- return;
21
- }
22
- c.removeUser(e), o.delete(t);
23
- }, h = (t) => {
24
- const e = new Set(t.map((s) => s.presenceKey)), n = t.filter(({ presenceKey: s }) => !o.has(s)), i = Array.from(o.values()).filter((s) => !e.has(s.presenceKey));
25
- n.forEach(({ presenceKey: s, user: f }) => m(s, f)), i.forEach((s) => {
26
- const { presenceKey: f } = s;
27
- a.has(f) && r.emit("selectionChange", s, null), u(f);
28
- }), (n.length > 0 || i.length > 0) && r.emit("presence", l());
29
- }, d = (t, e) => {
30
- const n = o.get(t);
31
- if (!n) {
32
- console.warn("Activity notification from user that is not present");
33
- return;
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
- const i = a.get(t);
36
- (!i || !w(i, e)) && (a.set(t, e), r.emit("selectionChange", n, e));
37
- }, g = (t, e) => {
38
- const n = o.get(t);
39
- if (!n) {
40
- console.warn("Selection change for user that is not present", t);
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
- e ? a.set(t, e) : a.delete(t), r.emit("selectionChange", n, e);
44
- }, l = () => [...Array.from(o.values())];
45
- return {
46
- getPresentUsers: l,
47
- notifyActivity: d,
48
- on: (t, e) => r.on(t, e),
49
- syncUsers: h,
50
- updateSelection: g
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
- P as PRESENCE_KEY,
55
- y as createPresenceState
135
+ we as useDraggable
56
136
  };
57
137
  //# sourceMappingURL=annotorious-react.es13.js.map