@annotorious/react 3.0.0-rc.30 → 3.0.0-rc.32

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.
@@ -1,18 +1,11 @@
1
+ import { StoreObserveOptions, UserSelectActionExpression } from '@annotorious/core';
1
2
  import { ReactNode } from 'react';
2
- import { Annotation, Annotator, Store, User } from '@annotorious/annotorious';
3
-
4
- interface Selection<T extends Annotation = Annotation> {
3
+ import { Annotation, Annotator, Selection as CoreSelection, Store, User } from '@annotorious/annotorious';
4
+ interface Selection<T extends Annotation = Annotation> extends Omit<CoreSelection, 'selected'> {
5
5
  selected: {
6
6
  annotation: T;
7
7
  editable?: boolean;
8
8
  }[];
9
- pointerEvent?: PointerEvent;
10
- }
11
- export interface AnnotoriousContextState {
12
- anno: Annotator;
13
- setAnno(anno: Annotator<Annotation, unknown>): void;
14
- annotations: Annotation[];
15
- selection: Selection;
16
9
  }
17
10
  export declare const AnnotoriousContext: import('react').Context<{
18
11
  anno: any;
@@ -28,6 +21,8 @@ export declare const Annotorious: import('react').ForwardRefExoticComponent<{
28
21
  export declare const useAnnotator: <T extends unknown = Annotator<any, unknown>>() => T;
29
22
  export declare const useAnnotationStore: <T extends unknown = Store<Annotation>>() => T | undefined;
30
23
  export declare const useAnnotations: <T extends Annotation>(debounce?: number) => T[];
24
+ export declare const useAnnotation: <T extends Annotation>(id: string, options?: Omit<StoreObserveOptions, "annotations">) => T;
25
+ export declare const useAnnotationSelectAction: <T extends Annotation>(id: string, action: UserSelectActionExpression<T>) => import('@annotorious/core').UserSelectAction;
31
26
  export declare const useSelection: <T extends Annotation>() => Selection<T>;
32
27
  export declare const useAnnotatorUser: () => User;
33
28
  export declare const useViewportState: <T extends Annotation>(debounce?: number) => T[];
@@ -1 +1 @@
1
- {"version":3,"file":"Annotorious.d.ts","sourceRoot":"","sources":["../src/Annotorious.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,SAAS,EAAC,MAAM,OAAO,C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M,OAAO,CAAC;AACf,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,SAAS,IAAI,aAAa,EAC1B,KAAK,EAEL,IAAI,EACL,MAAM,0BAA0B,CAAC;AAElC,UAAU,SAAS,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IAE5F,QAAQ,EAAE;QAAE,UAAU,EAAE,CAAC,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;CAEnD;AAED,eAAO,MAAM,kBAAkB;;;;;;;EAU7B,CAAC;AAEH,eAAO,MAAM,WAAW;cAAqC,SAAS;qEAuEpE,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,aAAa,GAAI,CAAC,SAAS,UAAU,MAAM,MAAM,YAAY,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,MAsBjH,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,UAAU,MAAM,MAAM,UAAU,0BAA0B,CAAC,CAAC,CAAC,iDAGhH,CAAA;AAED,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,5 +1,4 @@
1
1
  import { Annotator } from '@annotorious/annotorious';
2
-
3
2
  export type AnnotatorPlugin<T extends unknown = Annotator<any, unknown>> = (anno: T, opts?: Object) => ({
4
3
  unmount?: () => void;
5
4
  }) | void;
@@ -7,5 +6,7 @@ export interface AnnotoriousPluginProps<T extends unknown = Annotator<any, unkno
7
6
  plugin: AnnotatorPlugin<T>;
8
7
  opts?: Object;
9
8
  }
10
- export declare const AnnotoriousPlugin: <T extends unknown = Annotator<any, unknown>>(props: AnnotoriousPluginProps<T>) => any;
9
+ export declare const AnnotoriousPlugin: import('react').ForwardRefExoticComponent<AnnotoriousPluginProps<unknown> & import('react').RefAttributes<void | {
10
+ unmount?: () => void;
11
+ }>>;
11
12
  //# sourceMappingURL=AnnotoriousPlugin.d.ts.map
@@ -1 +1 @@
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
+ {"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;AAID,eAAO,MAAM,iBAAiB;cAZa,MAAM,IAAI;GAwCnD,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ImageAnnotation } from '@annotorious/annotorious';
3
-
4
3
  export interface AnnotoriousPopupProps {
5
4
  selected: {
6
5
  annotation: ImageAnnotation;
@@ -1,6 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { AnnotoriousOpts, DrawingStyle, DrawingTool, Filter, ImageAnnotation } from '@annotorious/annotorious';
3
-
4
3
  export interface ImageAnnotatorProps<E extends unknown> extends AnnotoriousOpts<ImageAnnotation, E> {
5
4
  children: ReactElement<HTMLImageElement>;
6
5
  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,GAAI,CAAC,SAAS,OAAO,SAAS,mBAAmB,CAAC,CAAC,CAAC,4CA+B9E,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,CAAC;CAEpB;AAED,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,OAAO,SAAS,mBAAmB,CAAC,CAAC,CAAC,4CAmC9E,CAAA"}
@@ -1 +1 @@
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
+ 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 .a9s-annotation{cursor:pointer}.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,38 +1,40 @@
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";
1
+ import { Annotorious as A, AnnotoriousContext as g, useAnnotation as c, useAnnotationSelectAction as S, useAnnotationStore as f, useAnnotations as x, useAnnotator as l, useAnnotatorUser as I, useSelection as d, useViewportState as y } from "./annotorious-react.es2.js";
2
+ import { AnnotoriousPlugin as O } from "./annotorious-react.es3.js";
3
+ import { Draggable as w } from "./annotorious-react.es4.js";
4
+ import { ImageAnnotator as P } from "./annotorious-react.es5.js";
5
5
  /* empty css */
6
6
  /* empty css */
7
- import { Origin as F, PointerSelectAction as T, createAnonymousGuest as V, createBody as W, defaultColorProvider as $ } from "@annotorious/core";
7
+ import { Origin as V, UserSelectAction as W, createAnonymousGuest as $, createBody as U, defaultColorProvider as b } from "@annotorious/core";
8
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";
9
+ import { OpenSeadragonAnnotator as B, useViewer as D } from "./annotorious-react.es8.js";
10
+ import { OpenSeadragonPopup as j } from "./annotorious-react.es9.js";
11
+ import { OpenSeadragonViewer as q } from "./annotorious-react.es10.js";
12
12
  const p = o, m = e, s = t;
13
13
  export {
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,
14
+ A as Annotorious,
15
+ g as AnnotoriousContext,
16
+ O as AnnotoriousPlugin,
17
+ w as Draggable,
18
+ P as ImageAnnotator,
19
+ B as OpenSeadragonAnnotator,
20
+ j as OpenSeadragonPopup,
21
+ q as OpenSeadragonViewer,
22
+ V as Origin,
24
23
  m as ShapeType,
24
+ W as UserSelectAction,
25
25
  s as W3CImageFormat,
26
- V as createAnonymousGuest,
27
- W as createBody,
26
+ $ as createAnonymousGuest,
27
+ U as createBody,
28
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
29
+ b as defaultColorProvider,
30
+ c as useAnnotation,
31
+ S as useAnnotationSelectAction,
32
+ f as useAnnotationStore,
33
+ x as useAnnotations,
34
+ l as useAnnotator,
35
+ I as useAnnotatorUser,
36
+ d as useSelection,
37
+ D as useViewer,
38
+ y as useViewportState
37
39
  };
38
40
  //# sourceMappingURL=annotorious-react.es.js.map
@@ -1 +1 @@
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
+ {"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 UserSelectAction as _UserSelectAction\n} from '@annotorious/core';\n\nexport { _createAnonymousGuest as createAnonymousGuest };\nexport { _createBody as createBody };\nexport { _defaultColorProvider as defaultColorProvider };\nexport { _Origin as Origin };\nexport { _UserSelectAction as UserSelectAction };\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,17 +1,17 @@
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";
1
+ import { j as a } from "./annotorious-react.es11.js";
2
+ import { forwardRef as m, useRef as p, useContext as u, useEffect as c, useImperativeHandle as d } from "react";
3
3
  import l from "openseadragon";
4
4
  import { OpenSeadragonAnnotatorContext as x } from "./annotorious-react.es8.js";
5
5
  const S = m((n, s) => {
6
- const { className: i, options: t } = n, r = p(null), { viewer: a, setViewer: e } = u(x);
6
+ const { className: i, options: t } = n, r = p(null), { viewer: f, setViewer: e } = u(x);
7
7
  return c(() => {
8
8
  if (r.current) {
9
9
  const o = l({ ...t, element: r.current });
10
10
  return e && e(o), () => {
11
- o.destroy(), e && e(void 0);
11
+ e && e(void 0), o.destroy();
12
12
  };
13
13
  }
14
- }, [JSON.stringify(t)]), d(s, () => a), /* @__PURE__ */ f.jsx("div", { className: i, ref: r });
14
+ }, [JSON.stringify(t)]), d(s, () => f), /* @__PURE__ */ a.jsx("div", { className: i, ref: r });
15
15
  });
16
16
  export {
17
17
  S as OpenSeadragonViewer
@@ -1 +1 @@
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
+ {"version":3,"file":"annotorious-react.es10.js","sources":["../src/openseadragon/OpenSeadragonViewer.tsx"],"sourcesContent":["import { forwardRef, useContext, useEffect, useImperativeHandle, 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 useEffect(() => { \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 if (setViewer)\n setViewer(undefined);\n\n v.destroy();\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","useEffect","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,EAAU,MAAM;AACd,QAAIN,EAAQ,SAAS;AACb,YAAAO,IAAIC,EAAc,EAAC,GAAGT,GAAS,SAASC,EAAQ,SAAS;AAI3D,aAAAG,KACFA,EAAUI,CAAC,GAEN,MAAM;AACP,QAAAJ,KACFA,EAAU,MAAS,GAErBI,EAAE,QAAQ;AAAA,MAAA;AAAA,IAEd;AAAA,KACC,CAAC,KAAK,UAAUR,CAAO,CAAC,CAAC,GAERU,EAAAZ,GAAK,MAAMK,CAAM,GAGlCQ,gBAAAA,EAAAA,IAAA,OAAA,EAAI,WAAAZ,GAAsB,KAAKE,EAAS,CAAA;AAG7C,CAAC;"}
@@ -1,97 +1,116 @@
1
- import { j as I } from "./annotorious-react.es11.js";
2
- import { createContext as O, forwardRef as R, useState as f, useImperativeHandle as U, useEffect as h, useContext as c } from "react";
3
- import { useDebounce as C } from "./annotorious-react.es12.js";
4
- const o = O({
1
+ import { j as E } from "./annotorious-react.es11.js";
2
+ import { onUserSelect as I } from "@annotorious/core";
3
+ import { useDebounce as _ } from "./annotorious-react.es12.js";
4
+ import { createContext as O, forwardRef as R, useState as b, useImperativeHandle as H, useEffect as V, useContext as a } from "react";
5
+ const c = O({
5
6
  anno: void 0,
6
7
  setAnno: void 0,
7
8
  annotations: [],
8
9
  selection: { selected: [] }
9
- }), B = R((t, s) => {
10
- const [n, a] = f(null), [p, r] = f([]), [m, u] = f({ selected: [] });
11
- return U(s, () => n), h(() => {
10
+ }), K = R((t, o) => {
11
+ const [n, i] = b(null), [u, s] = b([]), [d, r] = b({ selected: [] });
12
+ return H(o, () => n), V(() => {
12
13
  if (n) {
13
- const { selection: A, store: e } = n.state;
14
- e.all().length > 0 && r(e.all());
15
- const v = () => r(() => e.all());
16
- e.observe(v);
17
- let i;
18
- const b = A.subscribe(({ selected: l, pointerEvent: w }) => {
19
- i && e.unobserve(i);
20
- const j = (l || []).map(({ id: d, editable: S }) => ({ annotation: e.getAnnotation(d), editable: S }));
21
- u({ selected: j, pointerEvent: w }), i = (d) => {
22
- const { updated: S } = d.changes;
23
- u(({ selected: D }) => ({
24
- selected: D.map(({ annotation: V, editable: x }) => {
25
- const g = S.find((E) => E.oldValue.id === V.id);
26
- return g ? { annotation: g.newValue, editable: x } : { annotation: V, editable: x };
14
+ const { selection: m, store: e } = n.state;
15
+ e.all().length > 0 && s(e.all());
16
+ const f = () => s(() => e.all());
17
+ e.observe(f);
18
+ let l;
19
+ const A = m.subscribe(({ selected: p, ...w }) => {
20
+ l && e.unobserve(l);
21
+ const D = (p || []).map(({ id: v, editable: S }) => ({ annotation: e.getAnnotation(v), editable: S }));
22
+ r({ selected: D, ...w }), l = (v) => {
23
+ const { updated: S } = v.changes;
24
+ r((g) => ({
25
+ ...g,
26
+ selected: g.selected.map(({ annotation: h, editable: x }) => {
27
+ const C = S.find((U) => U.oldValue.id === h.id);
28
+ return C ? { annotation: C.newValue, editable: x } : { annotation: h, editable: x };
27
29
  })
28
30
  }));
29
- }, e.observe(i, { annotations: l.map(({ id: d }) => d) });
31
+ }, e.observe(l, { annotations: p.map(({ id: v }) => v) });
30
32
  });
31
33
  return () => {
32
- e.unobserve(v), b();
34
+ e.unobserve(f), A();
33
35
  };
34
36
  }
35
- }, [n]), /* @__PURE__ */ I.jsx(o.Provider, { value: {
37
+ }, [n]), /* @__PURE__ */ E.jsx(c.Provider, { value: {
36
38
  anno: n,
37
- setAnno: a,
38
- annotations: p,
39
- selection: m
39
+ setAnno: i,
40
+ annotations: u,
41
+ selection: d
40
42
  }, children: t.children });
41
- }), F = () => {
42
- const { anno: t } = c(o);
43
+ }), L = () => {
44
+ const { anno: t } = a(c);
43
45
  return t;
44
- }, G = () => {
45
- const { anno: t } = c(o);
46
+ }, P = () => {
47
+ const { anno: t } = a(c);
46
48
  return t == null ? void 0 : t.state.store;
47
- }, H = () => {
48
- const { annotations: t } = c(o);
49
+ }, k = () => {
50
+ const { annotations: t } = a(c);
49
51
  return t;
50
- }, P = (t) => {
51
- const { annotations: s } = c(o);
52
- return C(s, t);
53
- }, J = (t) => t ? P(t) : H(), K = () => {
54
- const { selection: t } = c(o);
52
+ }, q = (t) => {
53
+ const { annotations: o } = a(c);
54
+ return _(o, t);
55
+ }, M = (t) => t ? q(t) : k(), y = (t, o) => {
56
+ const n = P(), [i, u] = b(
57
+ n == null ? void 0 : n.getAnnotation(t)
58
+ );
59
+ return V(() => {
60
+ if (!n) return;
61
+ const s = (d) => {
62
+ const r = d.changes.updated[0];
63
+ r && u(r.newValue);
64
+ };
65
+ return n.observe(s, { ...o, annotations: t }), () => n.unobserve(s);
66
+ }, []), i;
67
+ }, N = (t, o) => {
68
+ const n = y(t);
69
+ return n ? I(n, o) : void 0;
70
+ }, Q = () => {
71
+ const { selection: t } = a(c);
55
72
  return t;
56
- }, L = () => {
57
- const { anno: t } = c(o);
73
+ }, T = () => {
74
+ const { anno: t } = a(c);
58
75
  return t == null ? void 0 : t.getUser();
59
- }, _ = () => {
60
- const { anno: t } = c(o), [s, n] = f([]);
61
- return h(() => {
76
+ }, j = () => {
77
+ const { anno: t } = a(c), [o, n] = b([]);
78
+ return V(() => {
62
79
  if (t) {
63
- const { store: a, viewport: p } = t.state;
64
- if (!p)
80
+ const { store: i, viewport: u } = t.state;
81
+ if (!u)
65
82
  return;
66
- let r;
67
- const m = p.subscribe((u) => {
68
- r && a.unobserve(r);
69
- const A = u.map((e) => a.getAnnotation(e));
70
- n(A), r = (e) => {
71
- const { updated: v } = e.changes;
72
- n((i) => i.map((b) => {
73
- const l = v.find((w) => w.oldValue.id === b.id);
74
- return l ? l.newValue : b;
83
+ let s;
84
+ const d = u.subscribe((r) => {
85
+ s && i.unobserve(s);
86
+ const m = r.map((e) => i.getAnnotation(e));
87
+ n(m), s = (e) => {
88
+ const { updated: f } = e.changes;
89
+ n((l) => l.map((A) => {
90
+ const p = f.find((w) => w.oldValue.id === A.id);
91
+ return p ? p.newValue : A;
75
92
  }));
76
- }, a.observe(r, { annotations: u });
93
+ }, i.observe(s, { annotations: r });
77
94
  });
78
95
  return () => {
79
- m();
96
+ d();
80
97
  };
81
98
  }
82
- }, [t]), s;
83
- }, k = (t) => {
84
- const s = _();
85
- return C(s, t);
86
- }, M = (t) => t ? k(t) : _();
99
+ }, [t]), o;
100
+ }, z = (t) => {
101
+ const o = j();
102
+ return _(o, t);
103
+ }, W = (t) => t ? z(t) : j();
87
104
  export {
88
- B as Annotorious,
89
- o as AnnotoriousContext,
90
- G as useAnnotationStore,
91
- J as useAnnotations,
92
- F as useAnnotator,
93
- L as useAnnotatorUser,
94
- K as useSelection,
95
- M as useViewportState
105
+ K as Annotorious,
106
+ c as AnnotoriousContext,
107
+ y as useAnnotation,
108
+ N as useAnnotationSelectAction,
109
+ P as useAnnotationStore,
110
+ M as useAnnotations,
111
+ L as useAnnotator,
112
+ T as useAnnotatorUser,
113
+ Q as useSelection,
114
+ W as useViewportState
96
115
  };
97
116
  //# sourceMappingURL=annotorious-react.es2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react.es2.js","sources":["../src/Annotorious.tsx"],"sourcesContent":["import { createContext, forwardRef, ReactNode} from 'react';\nimport { useContext, useEffect, useImperativeHandle, useState } from 'react';\nimport { Annotation, Annotator, Store, StoreChangeEvent, User } from '@annotorious/annotorious';\nimport { useDebounce } from './useDebounce';\n\ninterface Selection<T extends Annotation = Annotation> {\n\n selected: { annotation: T, editable?: boolean }[];\n\n pointerEvent?: PointerEvent;\n\n}\n\nexport interface AnnotoriousContextState {\n\n anno: Annotator;\n\n setAnno(anno: Annotator<Annotation, unknown>): void;\n\n annotations: Annotation[];\n\n selection: Selection;\n\n}\n\nexport const AnnotoriousContext = createContext({ \n\n anno: undefined, \n\n setAnno: undefined, \n\n annotations: [], \n\n selection: { selected: [] }\n\n});\n\nexport const Annotorious = forwardRef<Annotator, { children: ReactNode }>((props: { children: ReactNode }, ref) => {\n\n const [anno, setAnno] = useState<Annotator>(null);\n\n const [annotations, setAnnotations] = useState<Annotation[]>([]);\n\n const [selection, setSelection] = useState<Selection>({ selected: [] });\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store } = anno.state;\n\n // Components below <Annotorious /> may have\n // loaded annotations into the store already! \n if (store.all().length > 0)\n setAnnotations(store.all());\n\n // Keeps annotations in sync with a React state,\n // so clients can render components the usual React way.\n const onStoreChange = () => setAnnotations(() => store.all());\n\n store.observe(onStoreChange);\n\n // Keep selection in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let selectionStoreObserver: (event: StoreChangeEvent<Annotation>) => void;\n\n const unsubscribeSelection = selection.subscribe(({ selected, pointerEvent }) => {\n if (selectionStoreObserver) \n store.unobserve(selectionStoreObserver);\n\n const resolved = (selected || [])\n .map(({ id, editable }) => ({ annotation: store.getAnnotation(id), editable }));\n\n setSelection({ selected: resolved, pointerEvent });\n\n selectionStoreObserver = event => {\n const { updated } = event.changes;\n\n setSelection(({ selected }) => ({\n selected: selected.map(({ annotation, editable }) => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? { annotation: next.newValue, editable } : { annotation, editable };\n })\n }));\n }\n\n store.observe(selectionStoreObserver, { annotations: selected.map(({ id }) => id) });\n });\n\n return () => {\n store.unobserve(onStoreChange);\n unsubscribeSelection();\n }\n }\n }, [anno]);\n\n return (\n <AnnotoriousContext.Provider value={{ \n anno, \n setAnno,\n annotations, \n selection \n }}>\n {props.children}\n </AnnotoriousContext.Provider>\n )\n\n});\n\nexport const useAnnotator = <T extends unknown = Annotator<any, unknown>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno as T;\n}\n\nexport const useAnnotationStore = <T extends unknown = Store<Annotation>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno?.state.store as T | undefined;\n}\n\nconst _useAnnotations = <T extends Annotation>() => {\n const { annotations } = useContext(AnnotoriousContext);\n return annotations as T[];\n}\n\nconst _useAnnotationsDebounced = <T extends Annotation>(debounce: number) => {\n const { annotations } = useContext(AnnotoriousContext);\n return useDebounce(annotations, debounce) as T[];\n}\n\nexport const useAnnotations = <T extends Annotation>(debounce?: number) =>\n debounce ? _useAnnotationsDebounced<T>(debounce) : _useAnnotations<T>();\n\nexport const useSelection = <T extends Annotation>() => {\n const { selection } = useContext(AnnotoriousContext);\n return selection as Selection<T>;\n}\n\nexport const useAnnotatorUser = (): User => {\n const { anno } = useContext(AnnotoriousContext);\n return anno?.getUser();\n}\n\nconst _useViewportState = <T extends Annotation>() => {\n const { anno } = useContext(AnnotoriousContext);\n\n const [inViewport, setInViewport] = useState<T[]>([]);\n\n useEffect(() => {\n if (anno) {\n const { store, viewport } = anno.state;\n\n if (!viewport)\n return;\n\n // Keep viewport annotations in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let viewportStoreObserver: (event: StoreChangeEvent<T>) => void;\n\n const unsubscribeViewport = viewport.subscribe(ids => {\n if (viewportStoreObserver) \n store.unobserve(viewportStoreObserver);\n\n const resolved = ids.map(id => store.getAnnotation(id)) as T[];\n setInViewport(resolved);\n\n viewportStoreObserver = event => {\n const { updated } = event.changes;\n\n setInViewport(annotations => annotations.map(annotation => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? next.newValue : annotation;\n }));\n }\n\n store.observe(viewportStoreObserver, { annotations: ids });\n });\n\n return () => {\n unsubscribeViewport();\n }\n }\n }, [anno]);\n\n return inViewport;\n}\n\nconst _useViewportStateDebounced = <T extends Annotation>(debounce: number) => {\n const inViewport = _useViewportState();\n return useDebounce(inViewport, debounce) as T[];\n}\n\nexport const useViewportState = <T extends Annotation>(debounce?: number) =>\n debounce ? _useViewportStateDebounced<T>(debounce) : _useViewportState<T>();\n"],"names":["AnnotoriousContext","createContext","Annotorious","forwardRef","props","ref","anno","setAnno","useState","annotations","setAnnotations","selection","setSelection","useImperativeHandle","useEffect","store","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","pointerEvent","resolved","id","editable","event","updated","annotation","next","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useSelection","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;AAyBO,MAAMA,IAAqBC,EAAc;AAAA,EAE9C,MAAM;AAAA,EAEN,SAAS;AAAA,EAET,aAAa,CAAC;AAAA,EAEd,WAAW,EAAE,UAAU,GAAG;AAE5B,CAAC,GAEYC,IAAcC,EAA+C,CAACC,GAAgCC,MAAQ;AAEjH,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAoB,IAAI,GAE1C,CAACC,GAAaC,CAAc,IAAIF,EAAuB,CAAE,CAAA,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAC,EAAA,CAAG;AAElD,SAAAK,EAAAR,GAAK,MAAMC,CAAI,GAEnCQ,EAAU,MAAM;AACd,QAAIR,GAAM;AACR,YAAM,EAAE,WAAAK,GAAW,OAAAI,EAAA,IAAUT,EAAK;AAI9B,MAAAS,EAAM,MAAM,SAAS,KACRL,EAAAK,EAAM,KAAK;AAI5B,YAAMC,IAAgB,MAAMN,EAAe,MAAMK,EAAM,IAAK,CAAA;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B,EAAA,CAAAjC,MAAeA,EAAY,IAAI,CAAciB,MAAA;AACnD,kBAAAC,IAAOF,EAAQ,KAAK,CAAAG,MAAKA,EAAE,SAAS,OAAOF,EAAW,EAAE;AACvD,mBAAAC,IAAOA,EAAK,WAAWD;AAAA,UAC/B,CAAA,CAAC;AAAA,QAAA,GAGJX,EAAM,QAAQ6B,GAAuB,EAAE,aAAaE,EAAK,CAAA;AAAA,MAAA,CAC1D;AAED,aAAO,MAAM;AACS,QAAAD;MAAA;AAAA,IAExB;AAAA,EAAA,GACC,CAACvC,CAAI,CAAC,GAEFmC;AACT,GAEMM,IAA8B,CAAuBZ,MAAqB;AAC9E,QAAMM,IAAaD;AACZ,SAAAJ,EAAYK,GAAYN,CAAQ;AACzC,GAEaa,IAAoB,CAAuBb,MACtDA,IAAWY,EAA8BZ,CAAQ,IAAIK,EAAqB;"}
1
+ {"version":3,"file":"annotorious-react.es2.js","sources":["../src/Annotorious.tsx"],"sourcesContent":["import { onUserSelect } from '@annotorious/core';\nimport type { StoreObserveOptions, UserSelectActionExpression} from '@annotorious/core';\nimport { useDebounce } from './useDebounce';\nimport { \n createContext, \n forwardRef, \n type ReactNode, \n useContext, \n useEffect, \n useImperativeHandle, \n useState \n} from 'react';\nimport type {\n Annotation,\n Annotator,\n Selection as CoreSelection,\n Store,\n StoreChangeEvent,\n User\n} from '@annotorious/annotorious';\n\ninterface Selection<T extends Annotation = Annotation> extends Omit<CoreSelection, 'selected'> {\n\n selected: { annotation: T, editable?: boolean }[];\n\n}\n\nexport const AnnotoriousContext = createContext({ \n\n anno: undefined, \n\n setAnno: undefined, \n\n annotations: [], \n\n selection: { selected: [] }\n\n});\n\nexport const Annotorious = forwardRef<Annotator, { children: ReactNode }>((props: { children: ReactNode }, ref) => {\n\n const [anno, setAnno] = useState<Annotator>(null);\n\n const [annotations, setAnnotations] = useState<Annotation[]>([]);\n\n const [selection, setSelection] = useState<Selection>({ selected: [] });\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store } = anno.state;\n\n // Components below <Annotorious /> may have\n // loaded annotations into the store already! \n if (store.all().length > 0)\n setAnnotations(store.all());\n\n // Keeps annotations in sync with a React state,\n // so clients can render components the usual React way.\n const onStoreChange = () => setAnnotations(() => store.all());\n\n store.observe(onStoreChange);\n\n // Keep selection in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let selectionStoreObserver: (event: StoreChangeEvent<Annotation>) => void;\n\n const unsubscribeSelection = selection.subscribe(({ selected, ...rest }) => {\n if (selectionStoreObserver) \n store.unobserve(selectionStoreObserver);\n\n const resolved = (selected || [])\n .map(({ id, editable }) => ({ annotation: store.getAnnotation(id), editable }));\n\n setSelection({ selected: resolved, ...rest });\n\n selectionStoreObserver = event => {\n const { updated } = event.changes;\n\n setSelection((selection) => ({\n ...selection,\n selected: selection.selected.map(({ annotation, editable }) => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? { annotation: next.newValue, editable } : { annotation, editable };\n })\n }));\n }\n\n store.observe(selectionStoreObserver, { annotations: selected.map(({ id }) => id) });\n });\n\n return () => {\n store.unobserve(onStoreChange);\n unsubscribeSelection();\n }\n }\n }, [anno]);\n\n return (\n <AnnotoriousContext.Provider value={{ \n anno, \n setAnno,\n annotations, \n selection \n }}>\n {props.children}\n </AnnotoriousContext.Provider>\n )\n\n});\n\nexport const useAnnotator = <T extends unknown = Annotator<any, unknown>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno as T;\n}\n\nexport const useAnnotationStore = <T extends unknown = Store<Annotation>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno?.state.store as T | undefined;\n}\n\nconst _useAnnotations = <T extends Annotation>() => {\n const { annotations } = useContext(AnnotoriousContext);\n return annotations as T[];\n}\n\nconst _useAnnotationsDebounced = <T extends Annotation>(debounce: number) => {\n const { annotations } = useContext(AnnotoriousContext);\n return useDebounce(annotations, debounce) as T[];\n}\n\nexport const useAnnotations = <T extends Annotation>(debounce?: number) =>\n debounce ? _useAnnotationsDebounced<T>(debounce) : _useAnnotations<T>();\n\nexport const useAnnotation = <T extends Annotation>(id: string, options?: Omit<StoreObserveOptions, 'annotations'>) => {\n const store = useAnnotationStore<Store<T>>();\n\n const [annotation, setAnnotation] = useState<T | undefined>(\n store?.getAnnotation(id)\n );\n\n useEffect(() => {\n if (!store) return;\n\n const handleChange = (event: StoreChangeEvent<T>) => {\n const updated = event.changes.updated[0];\n if (updated) {\n setAnnotation(updated.newValue);\n }\n };\n\n store.observe(handleChange, { ...options, annotations: id });\n return () => store.unobserve(handleChange);\n }, []);\n\n return annotation;\n}\n\nexport const useAnnotationSelectAction = <T extends Annotation>(id: string, action: UserSelectActionExpression<T>) => {\n const annotation = useAnnotation(id);\n return annotation ? onUserSelect(annotation, action) : undefined;\n}\n\nexport const useSelection = <T extends Annotation>() => {\n const { selection } = useContext(AnnotoriousContext);\n return selection as Selection<T>;\n}\n\nexport const useAnnotatorUser = (): User => {\n const { anno } = useContext(AnnotoriousContext);\n return anno?.getUser();\n}\n\nconst _useViewportState = <T extends Annotation>() => {\n const { anno } = useContext(AnnotoriousContext);\n\n const [inViewport, setInViewport] = useState<T[]>([]);\n\n useEffect(() => {\n if (anno) {\n const { store, viewport } = anno.state;\n\n if (!viewport)\n return;\n\n // Keep viewport annotations in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let viewportStoreObserver: (event: StoreChangeEvent<T>) => void;\n\n const unsubscribeViewport = viewport.subscribe(ids => {\n if (viewportStoreObserver) \n store.unobserve(viewportStoreObserver);\n\n const resolved = ids.map(id => store.getAnnotation(id)) as T[];\n setInViewport(resolved);\n\n viewportStoreObserver = event => {\n const { updated } = event.changes;\n\n setInViewport(annotations => annotations.map(annotation => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? next.newValue : annotation;\n }));\n }\n\n store.observe(viewportStoreObserver, { annotations: ids });\n });\n\n return () => {\n unsubscribeViewport();\n }\n }\n }, [anno]);\n\n return inViewport;\n}\n\nconst _useViewportStateDebounced = <T extends Annotation>(debounce: number) => {\n const inViewport = _useViewportState();\n return useDebounce(inViewport, debounce) as T[];\n}\n\nexport const useViewportState = <T extends Annotation>(debounce?: number) =>\n debounce ? _useViewportStateDebounced<T>(debounce) : _useViewportState<T>();\n"],"names":["AnnotoriousContext","createContext","Annotorious","forwardRef","props","ref","anno","setAnno","useState","annotations","setAnnotations","selection","setSelection","useImperativeHandle","useEffect","store","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","rest","resolved","id","editable","event","updated","annotation","next","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useAnnotation","options","setAnnotation","handleChange","useAnnotationSelectAction","action","onUserSelect","useSelection","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;;AA2BO,MAAMA,IAAqBC,EAAc;AAAA,EAE9C,MAAM;AAAA,EAEN,SAAS;AAAA,EAET,aAAa,CAAC;AAAA,EAEd,WAAW,EAAE,UAAU,GAAG;AAE5B,CAAC,GAEYC,IAAcC,EAA+C,CAACC,GAAgCC,MAAQ;AAEjH,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAoB,IAAI,GAE1C,CAACC,GAAaC,CAAc,IAAIF,EAAuB,CAAE,CAAA,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAC,EAAA,CAAG;AAElD,SAAAK,EAAAR,GAAK,MAAMC,CAAI,GAEnCQ,EAAU,MAAM;AACd,QAAIR,GAAM;AACR,YAAM,EAAE,WAAAK,GAAW,OAAAI,EAAA,IAAUT,EAAK;AAI9B,MAAAS,EAAM,MAAM,SAAS,KACRL,EAAAK,EAAM,KAAK;AAI5B,YAAMC,IAAgB,MAAMN,EAAe,MAAMK,EAAM,IAAK,CAAA;AAE5D,MAAAA,EAAM,QAAQC,CAAa;AAIvB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M,KAAA,gBAAAA,EAAM;AACf,GAEMyC,IAAoB,MAA4B;AACpD,QAAM,EAAE,MAAAzC,EAAA,IAASyB,EAAW/B,CAAkB,GAExC,CAACgD,GAAYC,CAAa,IAAIzC,EAAc,CAAE,CAAA;AAEpD,SAAAM,EAAU,MAAM;AACd,QAAIR,GAAM;AACR,YAAM,EAAE,OAAAS,GAAO,UAAAmC,MAAa5C,EAAK;AAEjC,UAAI,CAAC4C;AACH;AAIE,UAAAC;AAEE,YAAAC,IAAsBF,EAAS,UAAU,CAAOG,MAAA;AAChD,QAAAF,KACFpC,EAAM,UAAUoC,CAAqB;AAEvC,cAAM9B,IAAWgC,EAAI,IAAI,OAAMtC,EAAM,cAAcO,CAAE,CAAC;AACtD,QAAA2B,EAAc5B,CAAQ,GAEtB8B,IAAwB,CAAS3B,MAAA;AACzB,gBAAA,EAAE,SAAAC,EAAQ,IAAID,EAAM;AAEZ,UAAAyB,EAAA,CAAAxC,MAAeA,EAAY,IAAI,CAAciB,MAAA;AACnD,kBAAAC,IAAOF,EAAQ,KAAK,CAAAG,MAAKA,EAAE,SAAS,OAAOF,EAAW,EAAE;AACvD,mBAAAC,IAAOA,EAAK,WAAWD;AAAA,UAC/B,CAAA,CAAC;AAAA,QAAA,GAGJX,EAAM,QAAQoC,GAAuB,EAAE,aAAaE,EAAK,CAAA;AAAA,MAAA,CAC1D;AAED,aAAO,MAAM;AACS,QAAAD;MAAA;AAAA,IAExB;AAAA,EAAA,GACC,CAAC9C,CAAI,CAAC,GAEF0C;AACT,GAEMM,IAA8B,CAAuBnB,MAAqB;AAC9E,QAAMa,IAAaD;AACZ,SAAAX,EAAYY,GAAYb,CAAQ;AACzC,GAEaoB,IAAoB,CAAuBpB,MACtDA,IAAWmB,EAA8BnB,CAAQ,IAAIY,EAAqB;"}
@@ -1,15 +1,15 @@
1
- import { useEffect as i } from "react";
2
- import { useAnnotator as s } from "./annotorious-react.es2.js";
3
- const m = (t) => {
4
- const { plugin: r, opts: u } = t, n = s();
5
- return i(() => {
6
- if (!n) return;
7
- const o = r(n, u);
8
- return () => {
9
- o && "unmount" in o && o.unmount();
1
+ import { forwardRef as s, useEffect as c } from "react";
2
+ import { useAnnotator as e } from "./annotorious-react.es2.js";
3
+ const m = s((i, n) => {
4
+ const { plugin: u, opts: r } = i, t = e();
5
+ return c(() => {
6
+ if (!t) return;
7
+ const o = u(t, r);
8
+ return n && (n.current = o), () => {
9
+ o && "unmount" in o && o.unmount(), n && (n.current = null);
10
10
  };
11
- }, [n]), null;
12
- };
11
+ }, [t, u, r, n]), null;
12
+ });
13
13
  export {
14
14
  m as AnnotoriousPlugin
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react.es3.js","sources":["../src/AnnotoriousPlugin.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { Annotator } from '@annotorious/annotorious';\nimport { useAnnotator } from './Annotorious';\n\nexport type AnnotatorPlugin<T extends unknown = Annotator<any, unknown>> =\n (anno: T, opts?: Object) => ({ unmount?: () => void }) | void;\n\nexport interface AnnotoriousPluginProps<T extends unknown = Annotator<any, unknown>> {\n\n plugin: AnnotatorPlugin<T>;\n\n opts?: Object;\n\n}\n\nexport const AnnotoriousPlugin = <T extends unknown = Annotator<any, unknown>>(props: AnnotoriousPluginProps<T>) => {\n const { plugin, opts } = props;\n\n const anno = useAnnotator<T>();\n\n useEffect(() => {\n if (!anno) return;\n\n const p = plugin(anno, opts);\n return () => {\n if (p && 'unmount' in p)\n p.unmount();\n };\n }, [anno]);\n\n return null;\n\n};\n"],"names":["AnnotoriousPlugin","props","plugin","opts","anno","useAnnotator","useEffect","p"],"mappings":";;AAea,MAAAA,IAAoB,CAA8CC,MAAqC;AAC5G,QAAA,EAAE,QAAAC,GAAQ,MAAAC,EAAS,IAAAF,GAEnBG,IAAOC;AAEb,SAAAC,EAAU,MAAM;AACd,QAAI,CAACF,EAAM;AAEL,UAAAG,IAAIL,EAAOE,GAAMD,CAAI;AAC3B,WAAO,MAAM;AACX,MAAII,KAAK,aAAaA,KACpBA,EAAE,QAAQ;AAAA,IAAA;AAAA,EACd,GACC,CAACH,CAAI,CAAC,GAEF;AAET;"}
1
+ {"version":3,"file":"annotorious-react.es3.js","sources":["../src/AnnotoriousPlugin.tsx"],"sourcesContent":["import { forwardRef, useEffect } from 'react';\nimport { Annotator } from '@annotorious/annotorious';\nimport { useAnnotator } from './Annotorious';\n\nexport type AnnotatorPlugin<T extends unknown = Annotator<any, unknown>> =\n (anno: T, opts?: Object) => ({ unmount?: () => void }) | void;\n\nexport interface AnnotoriousPluginProps<T extends unknown = Annotator<any, unknown>> {\n\n plugin: AnnotatorPlugin<T>;\n\n opts?: Object;\n\n}\n\ntype PluginReturnType<T> = ReturnType<AnnotatorPlugin<T>>;\n\nexport const AnnotoriousPlugin = forwardRef(<T extends unknown = Annotator<any, unknown>>(\n props: AnnotoriousPluginProps<T>,\n ref: React.MutableRefObject<PluginReturnType<T>>\n) => {\n const { plugin, opts } = props;\n\n const anno = useAnnotator<T>();\n\n useEffect(() => {\n if (!anno) return;\n\n const p = plugin(anno, opts);\n\n if (ref)\n ref.current = p;\n\n return () => {\n if (p && 'unmount' in p) {\n p.unmount();\n }\n\n if (ref)\n ref.current = null;\n }\n }, [anno, plugin, opts, ref]);\n\n return null;\n\n});\n"],"names":["AnnotoriousPlugin","forwardRef","props","ref","plugin","opts","anno","useAnnotator","useEffect","p"],"mappings":";;AAiBO,MAAMA,IAAoBC,EAAW,CAC1CC,GACAC,MACG;AACG,QAAA,EAAE,QAAAC,GAAQ,MAAAC,EAAS,IAAAH,GAEnBI,IAAOC;AAEb,SAAAC,EAAU,MAAM;AACd,QAAI,CAACF,EAAM;AAEL,UAAAG,IAAIL,EAAOE,GAAMD,CAAI;AAEvB,WAAAF,MACFA,EAAI,UAAUM,IAET,MAAM;AACP,MAAAA,KAAK,aAAaA,KACpBA,EAAE,QAAQ,GAGRN,MACFA,EAAI,UAAU;AAAA,IAAA;AAAA,KAEjB,CAACG,GAAMF,GAAQC,GAAMF,CAAG,CAAC,GAErB;AAET,CAAC;"}
@@ -1,23 +1,25 @@
1
1
  import { j as n } from "./annotorious-react.es11.js";
2
- import { Children as x, useContext as g, useEffect as e, cloneElement as d } from "react";
3
- import { createImageAnnotator as u } from "@annotorious/annotorious";
4
- import { AnnotoriousContext as h } from "./annotorious-react.es2.js";
5
- const F = (t) => {
6
- const { children: i, tool: y, ...l } = t, r = x.only(i), { anno: o, setAnno: m } = g(h), s = (c) => {
7
- if (!o) {
8
- const f = c.target, a = u(f, l);
9
- m(a);
2
+ import { Children as u, useContext as x, useEffect as o, cloneElement as A } from "react";
3
+ import { createImageAnnotator as g } from "@annotorious/annotorious";
4
+ import { AnnotoriousContext as d } from "./annotorious-react.es2.js";
5
+ const E = (t) => {
6
+ const { children: i, tool: h, ...l } = t, c = u.only(i), { anno: e, setAnno: r } = x(d), s = (m) => {
7
+ if (!e) {
8
+ const f = m.target, a = g(f, l);
9
+ r(a);
10
10
  }
11
11
  };
12
- return e(() => {
13
- t.tool && o && o.setDrawingTool(t.tool);
14
- }, [t.tool, o]), e(() => {
15
- o && o.setFilter(t.filter);
16
- }, [t.filter]), e(() => {
17
- o && o.setStyle(t.style);
18
- }, [t.style]), /* @__PURE__ */ n.jsx(n.Fragment, { children: d(r, { onLoad: s }) });
12
+ return o(() => {
13
+ t.tool && e && e.setDrawingTool(t.tool);
14
+ }, [t.tool, e]), o(() => {
15
+ e && e.setFilter(t.filter);
16
+ }, [t.filter]), o(() => {
17
+ e && e.setStyle(t.style);
18
+ }, [t.style]), o(() => {
19
+ e && e.setUserSelectAction(t.userSelectAction);
20
+ }, [t.userSelectAction]), /* @__PURE__ */ n.jsx(n.Fragment, { children: A(c, { onLoad: s }) });
19
21
  };
20
22
  export {
21
- F as ImageAnnotator
23
+ E as ImageAnnotator
22
24
  };
23
25
  //# sourceMappingURL=annotorious-react.es5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"annotorious-react.es5.js","sources":["../src/ImageAnnotator.tsx"],"sourcesContent":["import { Children, ReactElement, cloneElement, useContext, useEffect } from 'react';\nimport { AnnotoriousOpts, createImageAnnotator } from '@annotorious/annotorious';\nimport type { DrawingStyle, DrawingTool, Filter, ImageAnnotation } from '@annotorious/annotorious';\nimport { AnnotoriousContext } from './Annotorious';\n\nexport interface ImageAnnotatorProps<E extends unknown> extends AnnotoriousOpts<ImageAnnotation, E> {\n\n children: ReactElement<HTMLImageElement>;\n\n filter?: Filter<ImageAnnotation>;\n\n style?: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle);\n\n tool?: DrawingTool\n\n}\n\nexport const ImageAnnotator = <E extends unknown>(props: ImageAnnotatorProps<E>) => {\n\n const { children, tool, ...opts } = props;\n\n const child = Children.only(children);\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n const onLoad = (evt: Event) => {\n if (!anno) {\n const img = evt.target as HTMLImageElement;\n\n const next = createImageAnnotator(img, opts);\n setAnno(next); \n }\n };\n\n useEffect(() => {\n if (props.tool && anno) anno.setDrawingTool(props.tool);\n }, [props.tool, anno]);\n\n useEffect(() => {\n if (anno) anno.setFilter(props.filter);\n }, [props.filter]);\n\n useEffect(() => {\n if (anno) anno.setStyle(props.style);\n }, [props.style]);\n \n return <>{cloneElement(child, { onLoad } as Partial<HTMLImageElement>)}</>\n\n}"],"names":["ImageAnnotator","props","children","tool","opts","child","Children","anno","setAnno","useContext","AnnotoriousContext","onLoad","evt","img","next","createImageAnnotator","useEffect","cloneElement"],"mappings":";;;;AAiBa,MAAAA,IAAiB,CAAoBC,MAAkC;AAElF,QAAM,EAAE,UAAAC,GAAU,MAAAC,GAAM,GAAGC,MAASH,GAE9BI,IAAQC,EAAS,KAAKJ,CAAQ,GAE9B,EAAE,MAAAK,GAAM,SAAAC,EAAQ,IAAIC,EAAWC,CAAkB,GAEjDC,IAAS,CAACC,MAAe;AAC7B,QAAI,CAACL,GAAM;AACT,YAAMM,IAAMD,EAAI,QAEVE,IAAOC,EAAqBF,GAAKT,CAAI;AAC3C,MAAAI,EAAQM,CAAI;AAAA,IACd;AAAA,EAAA;AAGF,SAAAE,EAAU,MAAM;AACd,IAAIf,EAAM,QAAQM,KAAWA,EAAA,eAAeN,EAAM,IAAI;AAAA,EACrD,GAAA,CAACA,EAAM,MAAMM,CAAI,CAAC,GAErBS,EAAU,MAAM;AACd,IAAIT,KAAMA,EAAK,UAAUN,EAAM,MAAM;AAAA,EAAA,GACpC,CAACA,EAAM,MAAM,CAAC,GAEjBe,EAAU,MAAM;AACd,IAAIT,KAAMA,EAAK,SAASN,EAAM,KAAK;AAAA,EAAA,GAClC,CAACA,EAAM,KAAK,CAAC,uCAEN,UAAagB,EAAAZ,GAAO,EAAE,QAAAM,GAAsC,EAAE,CAAA;AAE1E;"}
1
+ {"version":3,"file":"annotorious-react.es5.js","sources":["../src/ImageAnnotator.tsx"],"sourcesContent":["import { Children, ReactElement, cloneElement, useContext, useEffect } from 'react';\nimport { AnnotoriousOpts, createImageAnnotator } from '@annotorious/annotorious';\nimport type { DrawingStyle, DrawingTool, Filter, ImageAnnotation } from '@annotorious/annotorious';\nimport { AnnotoriousContext } from './Annotorious';\n\nexport interface ImageAnnotatorProps<E extends unknown> extends AnnotoriousOpts<ImageAnnotation, E> {\n\n children: ReactElement<HTMLImageElement>;\n\n filter?: Filter<ImageAnnotation>;\n\n style?: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle);\n\n tool?: DrawingTool;\n\n}\n\nexport const ImageAnnotator = <E extends unknown>(props: ImageAnnotatorProps<E>) => {\n\n const { children, tool, ...opts } = props;\n\n const child = Children.only(children);\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n const onLoad = (evt: Event) => {\n if (!anno) {\n const img = evt.target as HTMLImageElement;\n\n const next = createImageAnnotator(img, opts);\n setAnno(next); \n }\n };\n\n useEffect(() => {\n if (props.tool && anno) anno.setDrawingTool(props.tool);\n }, [props.tool, anno]);\n\n useEffect(() => {\n if (anno) anno.setFilter(props.filter);\n }, [props.filter]);\n\n useEffect(() => {\n if (anno) anno.setStyle(props.style);\n }, [props.style]);\n\n useEffect(() => {\n if (anno) anno.setUserSelectAction(props.userSelectAction);\n }, [props.userSelectAction]);\n \n return <>{cloneElement(child, { onLoad } as Partial<HTMLImageElement>)}</>\n\n}\n"],"names":["ImageAnnotator","props","children","tool","opts","child","Children","anno","setAnno","useContext","AnnotoriousContext","onLoad","evt","img","next","createImageAnnotator","useEffect","cloneElement"],"mappings":";;;;AAiBa,MAAAA,IAAiB,CAAoBC,MAAkC;AAElF,QAAM,EAAE,UAAAC,GAAU,MAAAC,GAAM,GAAGC,MAASH,GAE9BI,IAAQC,EAAS,KAAKJ,CAAQ,GAE9B,EAAE,MAAAK,GAAM,SAAAC,EAAQ,IAAIC,EAAWC,CAAkB,GAEjDC,IAAS,CAACC,MAAe;AAC7B,QAAI,CAACL,GAAM;AACT,YAAMM,IAAMD,EAAI,QAEVE,IAAOC,EAAqBF,GAAKT,CAAI;AAC3C,MAAAI,EAAQM,CAAI;AAAA,IACd;AAAA,EAAA;AAGF,SAAAE,EAAU,MAAM;AACd,IAAIf,EAAM,QAAQM,KAAWA,EAAA,eAAeN,EAAM,IAAI;AAAA,EACrD,GAAA,CAACA,EAAM,MAAMM,CAAI,CAAC,GAErBS,EAAU,MAAM;AACd,IAAIT,KAAMA,EAAK,UAAUN,EAAM,MAAM;AAAA,EAAA,GACpC,CAACA,EAAM,MAAM,CAAC,GAEjBe,EAAU,MAAM;AACd,IAAIT,KAAMA,EAAK,SAASN,EAAM,KAAK;AAAA,EAAA,GAClC,CAACA,EAAM,KAAK,CAAC,GAEhBe,EAAU,MAAM;AACd,IAAIT,KAAMA,EAAK,oBAAoBN,EAAM,gBAAgB;AAAA,EAAA,GACxD,CAACA,EAAM,gBAAgB,CAAC,uCAEjB,UAAagB,EAAAZ,GAAO,EAAE,QAAAM,GAAsC,EAAE,CAAA;AAE1E;"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { createAnonymousGuest as _createAnonymousGuest, createBody as _createBody, defaultColorProvider as _defaultColorProvider, Origin as _Origin, PointerSelectAction as _PointerSelectAction } from '@annotorious/core';
1
+ import { createAnonymousGuest as _createAnonymousGuest, createBody as _createBody, defaultColorProvider as _defaultColorProvider, Origin as _Origin, UserSelectAction as _UserSelectAction } from '@annotorious/core';
2
2
  import { ShapeType as _ShapeType } from '@annotorious/annotorious';
3
3
  export * from './Annotorious';
4
4
  export * from './AnnotoriousPlugin';
@@ -10,11 +10,11 @@ export { _createAnonymousGuest as createAnonymousGuest };
10
10
  export { _createBody as createBody };
11
11
  export { _defaultColorProvider as defaultColorProvider };
12
12
  export { _Origin as Origin };
13
- export { _PointerSelectAction as PointerSelectAction };
13
+ export { _UserSelectAction as UserSelectAction };
14
14
  export type { AnnotoriousOpts, DrawingMode, DrawingTool, FragmentSelector, ImageAnnotator as AnnotoriousImageAnnotator, ImageAnnotation, ImageAnnotatorState, Polygon, PolygonGeometry, Rectangle, RectangleGeometry, Shape, SVGSelector, W3CImageAnnotation, W3CImageAnnotationTarget } from '@annotorious/annotorious';
15
15
  export declare const createImageAnnotator: <E extends unknown = import('@annotorious/annotorious').ImageAnnotation>(image: string | HTMLImageElement | HTMLCanvasElement, options?: import('@annotorious/annotorious').AnnotoriousOpts<import('@annotorious/annotorious').ImageAnnotation, E>) => import('@annotorious/annotorious').ImageAnnotator<E>;
16
16
  export declare const ShapeType: typeof _ShapeType;
17
- export declare const W3CImageFormat: (source: string, invertY?: boolean) => import('@annotorious/annotorious').W3CImageFormatAdapter;
17
+ export declare const W3CImageFormat: (source: string, opts?: import('@annotorious/annotorious').W3CImageFormatAdapterOpts) => import('@annotorious/annotorious').W3CImageFormatAdapter;
18
18
  export type { OpenSeadragonAnnotator as AnnotoriousOpenSeadragonAnnotator } from '@annotorious/openseadragon';
19
19
  export type { Viewer } from 'openseadragon';
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sour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;AACzD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAC7B,OAAO,EAAE,iBAAiB,IAAI,gBAAgB,EAAE,CAAC;AAGjD,YAAY,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,IAAI,yBAAyB,EAC3C,eAAe,EACf,mBAAmB,EACnB,OAAO,EACP,eAAe,EACf,SAAS,EACT,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,SAAS,IAAI,UAAU,EAExB,MAAM,0BAA0B,CAAC;AAElC,eAAO,MAAM,oBAAoB,6SAAwB,CAAC;AAC1D,eAAO,MAAM,SAAS,mBAAa,CAAC;AACpC,eAAO,MAAM,cAAc,mJAAkB,CAAC;AAG9C,YAAY,EACV,sBAAsB,IAAI,iCAAiC,EAC5D,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { default as OpenSeadragon } from 'openseadragon';
3
3
  import { AnnotoriousOpts, DrawingStyle, Filter, ImageAnnotation } from '@annotorious/annotorious';
4
-
5
4
  export declare const OpenSeadragonAnnotatorContext: import('react').Context<{
6
5
  viewer: OpenSeadragon.Viewer;
7
6
  setViewer(viewer: OpenSeadragon.Viewer): void;
@@ -1,7 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { default as OpenSeadragon } from 'openseadragon';
3
3
  import { AnnotoriousPopupProps } from '../AnnotoriousPopup';
4
-
5
4
  export type OpenSeadragonPopupProps = AnnotoriousPopupProps & {
6
5
  viewer: OpenSeadragon.Viewer;
7
6
  };
@@ -1,5 +1,4 @@
1
1
  import { default as OpenSeadragon } from 'openseadragon';
2
-
3
2
  export interface OpenSeadragonViewerProps {
4
3
  className?: string;
5
4
  options: OpenSeadragon.Options;
@@ -1,5 +1,4 @@
1
1
  import { ImageAnnotation } from '@annotorious/annotorious';
2
2
  import { default as OpenSeadragon } from 'openseadragon';
3
-
4
3
  export declare const setPosition: (viewer: OpenSeadragon.Viewer, annotation: ImageAnnotation, popup: HTMLElement, sideOffset?: number) => void;
5
4
  //# sourceMappingURL=setPosition.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@annotorious/react",
3
- "version": "3.0.0-rc.30",
3
+ "version": "3.0.0-rc.32",
4
4
  "description": "Annotorious React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -24,16 +24,16 @@
24
24
  "./annotorious-react.css": "./dist/annotorious-react.css"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/react": "^18.3.3",
27
+ "@types/react": "^18.3.4",
28
28
  "@types/react-dom": "^18.3.0",
29
29
  "@vitejs/plugin-react": "^4.3.1",
30
- "typescript": "^5.5.2",
31
- "vite": "^5.3.1",
32
- "vite-plugin-dts": "^3.9.1",
33
- "vite-tsconfig-paths": "^4.3.2"
30
+ "typescript": "5.5.4",
31
+ "vite": "^5.4.2",
32
+ "vite-plugin-dts": "^4.0.3",
33
+ "vite-tsconfig-paths": "^5.0.1"
34
34
  },
35
35
  "peerDependencies": {
36
- "openseadragon": "^3.0.0 || ^4.0.0",
36
+ "openseadragon": "^3.0.0 || ^4.0.0 || ^5.0.0",
37
37
  "react": "16.8.0 || >=17.x || >=18.x",
38
38
  "react-dom": "16.8.0 || >=17.x || >=18.x"
39
39
  },
@@ -43,9 +43,9 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@annotorious/core": "3.0.0-rc.30",
47
- "@annotorious/annotorious": "3.0.0-rc.30",
48
- "@annotorious/openseadragon": "3.0.0-rc.30",
46
+ "@annotorious/core": "3.0.0-rc.32",
47
+ "@annotorious/annotorious": "3.0.0-rc.32",
48
+ "@annotorious/openseadragon": "3.0.0-rc.32",
49
49
  "@neodrag/react": "^2.0.4"
50
50
  },
51
51
  "sideEffects": false