@annotorious/annotorious 3.0.0-rc.20 → 3.0.0-rc.3

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 (80) hide show
  1. package/dist/Annotorious.d.ts +2 -7
  2. package/dist/Annotorious.d.ts.map +1 -1
  3. package/dist/AnnotoriousOpts.d.ts +3 -4
  4. package/dist/AnnotoriousOpts.d.ts.map +1 -1
  5. package/dist/annotation/SVGAnnotationLayerPointerEvent.d.ts.map +1 -1
  6. package/dist/annotation/editors/Handle.d.ts +14 -0
  7. package/dist/annotation/editors/Handle.d.ts.map +1 -0
  8. package/dist/annotation/editors/editorsRegistry.d.ts +1 -1
  9. package/dist/annotation/editors/editorsRegistry.d.ts.map +1 -1
  10. package/dist/annotation/editors/index.d.ts +1 -1
  11. package/dist/annotation/editors/index.d.ts.map +1 -1
  12. package/dist/annotation/tools/drawingToolsRegistry.d.ts +4 -4
  13. package/dist/annotation/tools/drawingToolsRegistry.d.ts.map +1 -1
  14. package/dist/annotation/utils/responsive.d.ts +1 -2
  15. package/dist/annotation/utils/responsive.d.ts.map +1 -1
  16. package/dist/annotation/utils/styling.d.ts +1 -1
  17. package/dist/annotation/utils/styling.d.ts.map +1 -1
  18. package/dist/annotation/utils/touch.d.ts.map +1 -1
  19. package/dist/annotorious.css +1 -1
  20. package/dist/annotorious.es.js +2087 -2359
  21. package/dist/annotorious.es.js.map +1 -1
  22. package/dist/annotorious.js +1 -1
  23. package/dist/annotorious.js.map +1 -1
  24. package/dist/index.d.ts +7 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/keyboardCommands.d.ts +2 -2
  27. package/dist/keyboardCommands.d.ts.map +1 -1
  28. package/dist/model/w3c/W3CImageFormatAdapter.d.ts +2 -3
  29. package/dist/model/w3c/W3CImageFormatAdapter.d.ts.map +1 -1
  30. package/dist/model/w3c/fragment/FragmentSelector.d.ts +2 -1
  31. package/dist/model/w3c/fragment/FragmentSelector.d.ts.map +1 -1
  32. package/dist/model/w3c/index.d.ts +0 -1
  33. package/dist/model/w3c/index.d.ts.map +1 -1
  34. package/dist/model/w3c/svg/SVG.d.ts.map +1 -1
  35. package/dist/model/w3c/svg/SVGSelector.d.ts +2 -1
  36. package/dist/model/w3c/svg/SVGSelector.d.ts.map +1 -1
  37. package/dist/state/ImageAnnotatorState.d.ts.map +1 -1
  38. package/dist/state/spatialTree.d.ts +1 -1
  39. package/dist/state/spatialTree.d.ts.map +1 -1
  40. package/dist/themes/smart/setTheme.d.ts +1 -3
  41. package/dist/themes/smart/setTheme.d.ts.map +1 -1
  42. package/package.json +13 -13
  43. package/src/Annotorious.css +5 -5
  44. package/src/Annotorious.ts +28 -34
  45. package/src/AnnotoriousOpts.ts +6 -11
  46. package/src/annotation/SVGAnnotationLayer.svelte +15 -21
  47. package/src/annotation/SVGAnnotationLayerPointerEvent.ts +2 -1
  48. package/src/annotation/Transform.ts +1 -1
  49. package/src/annotation/editors/Editor.svelte +11 -10
  50. package/src/annotation/editors/EditorMount.svelte +2 -2
  51. package/src/annotation/editors/Handle.ts +21 -0
  52. package/src/annotation/editors/index.ts +2 -2
  53. package/src/annotation/editors/polygon/PolygonEditor.svelte +16 -16
  54. package/src/annotation/editors/rectangle/RectangleEditor.svelte +43 -46
  55. package/src/annotation/shapes/Ellipse.svelte +2 -2
  56. package/src/annotation/shapes/Polygon.svelte +2 -2
  57. package/src/annotation/shapes/Rectangle.svelte +2 -2
  58. package/src/annotation/tools/ToolMount.svelte +3 -3
  59. package/src/annotation/tools/drawingToolsRegistry.ts +1 -2
  60. package/src/annotation/tools/polygon/RubberbandPolygon.svelte +13 -40
  61. package/src/annotation/tools/rectangle/RubberbandRectangle.svelte +10 -16
  62. package/src/annotation/utils/responsive.ts +1 -1
  63. package/src/annotation/utils/touch.ts +1 -4
  64. package/src/index.ts +16 -23
  65. package/src/keyboardCommands.ts +7 -11
  66. package/src/model/w3c/W3CImageFormatAdapter.ts +21 -53
  67. package/src/model/w3c/fragment/FragmentSelector.ts +6 -5
  68. package/src/model/w3c/index.ts +0 -1
  69. package/src/model/w3c/svg/SVG.ts +2 -1
  70. package/src/model/w3c/svg/SVGSelector.ts +13 -11
  71. package/src/state/ImageAnnotatorState.ts +3 -3
  72. package/src/state/spatialTree.ts +2 -3
  73. package/src/themes/dark/index.css +2 -2
  74. package/src/themes/light/index.css +2 -2
  75. package/src/themes/smart/setTheme.ts +6 -10
  76. package/dist/annotation/editors/Handle.svelte.d.ts +0 -1
  77. package/dist/model/w3c/W3CImageAnnotation.d.ts +0 -11
  78. package/dist/model/w3c/W3CImageAnnotation.d.ts.map +0 -1
  79. package/src/annotation/editors/Handle.svelte +0 -66
  80. package/src/model/w3c/W3CImageAnnotation.ts +0 -17
package/dist/index.d.ts CHANGED
@@ -6,5 +6,11 @@ export * from './annotation/tools';
6
6
  export * from './Annotorious';
7
7
  export * from './AnnotoriousOpts';
8
8
  export * from './keyboardCommands';
9
- export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Appearance, AppearanceProvider, Color, DrawingStyle, Filter, FormatAdapter, HoverState, LifecycleEvents, ParseResult, PresentUser, Purpose, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, User, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core';
9
+ export * from '@annotorious/core/src/model';
10
+ export * from '@annotorious/core/src/presence';
11
+ export * from '@annotorious/core/src/utils';
12
+ export type { HoverState, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver } from '@annotorious/core/src/state';
13
+ import { Origin as _Origin, PointerSelectAction as _PointerSelectAction } from '@annotorious/core/src/state';
14
+ export { _Origin as Origin };
15
+ export { _PointerSelectAction as PointerSelectAction };
10
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAGnC,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,KAAK,EACL,YAAY,EACZ,MAAM,EACN,aAAa,EACb,UAAU,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,OAAO,EACP,SAAS,EACT,cAAc,EACd,KAAK,EACL,gBAAgB,EAChB,aAAa,EACb,IAAI,EACJ,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,YAAY,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,KAAK,EACL,gBAAgB,EAChB,aAAa,EACd,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,MAAM,IAAI,OAAO,EACjB,mBAAmB,IAAI,oBAAoB,EAC5C,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAC7B,OAAO,EAAE,oBAAoB,IAAI,mBAAmB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { Annotation, UndoStack } from '@annotorious/core';
2
- export declare const initKeyboardCommands: <T extends Annotation>(undoStack: UndoStack<T>, container?: Element) => {
1
+ import type { UndoStack } from '@annotorious/core';
2
+ export declare const initKeyboardCommands: (undoStack: UndoStack, container?: Element) => {
3
3
  destroy: () => void;
4
4
  };
5
5
  //# sourceMappingURL=keyboardCommands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboardCommands.d.ts","sourceRoot":"","sources":["../src/keyboardCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAI/D,eAAO,MAAM,oBAAoB,oCACpB,UAAU,CAAC,CAAC,cACX,OAAO;;CA2CpB,CAAA"}
1
+ {"version":3,"file":"keyboardCommands.d.ts","sourceRoot":"","sources":["../src/keyboardCommands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,eAAO,MAAM,oBAAoB,cACpB,SAAS,cACR,OAAO;;CAuCpB,CAAA"}
@@ -1,8 +1,7 @@
1
1
  import type { FormatAdapter, ParseResult, W3CAnnotation } from '@annotorious/core';
2
2
  import type { ImageAnnotation } from '../core';
3
- import type { W3CImageAnnotation } from './W3CImageAnnotation';
4
- export type W3CImageFormatAdapter = FormatAdapter<ImageAnnotation, W3CImageAnnotation>;
3
+ export type W3CImageFormatAdapter = FormatAdapter<ImageAnnotation, W3CAnnotation>;
5
4
  export declare const W3CImageFormat: (source: string, invertY?: boolean) => W3CImageFormatAdapter;
6
5
  export declare const parseW3CImageAnnotation: (annotation: W3CAnnotation, invertY?: boolean) => ParseResult<ImageAnnotation>;
7
- export declare const serializeW3CImageAnnotation: (annotation: ImageAnnotation, source: string) => W3CImageAnnotation;
6
+ export declare const serializeW3CImageAnnotation: (annotation: ImageAnnotation, source: string) => W3CAnnotation;
8
7
  //# sourceMappingURL=W3CImageFormatAdapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"W3CImageFormatAdapter.d.ts","sourceRoot":"","sources":["../../../src/model/w3c/W3CImageFormatAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAKlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAEvF,eAAO,MAAM,cAAc,WACjB,MAAM,YACL,OAAO,0BAUjB,CAAA;AAED,eAAO,MAAM,uBAAuB,eACtB,aAAa,YAChB,OAAO,KACf,YAAY,eAAe,CA2C7B,CAAA;AAED,eAAO,MAAM,2BAA2B,eAC1B,eAAe,UACnB,MAAM,KACb,kBAsCF,CAAA"}
1
+ {"version":3,"file":"W3CImageFormatAdapter.d.ts","sourceRoot":"","sources":["../../../src/model/w3c/W3CImageFormatAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,SAAS,CAAC;AAMlE,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;AAElF,eAAO,MAAM,cAAc,WACjB,MAAM,YACL,OAAO,0BAUjB,CAAA;AAED,eAAO,MAAM,uBAAuB,eACtB,aAAa,YAChB,OAAO,KACf,YAAY,eAAe,CA+B7B,CAAA;AAED,eAAO,MAAM,2BAA2B,eAC1B,eAAe,UACnB,MAAM,KACb,aAmBF,CAAC"}
@@ -1,5 +1,6 @@
1
+ import type { W3CSelector } from '@annotorious/core';
1
2
  import type { Rectangle, RectangleGeometry } from '../../core';
2
- export interface FragmentSelector {
3
+ export interface FragmentSelector extends W3CSelector {
3
4
  type: 'FragmentSelector';
4
5
  conformsTo: 'http://www.w3.org/TR/media-frags/';
5
6
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"FragmentSelector.d.ts","sourceRoot":"","sources":["../../../../src/model/w3c/fragment/FragmentSelector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/D,MAAM,WAAW,gBAAgB;IAE/B,IAAI,EAAE,kBAAkB,CAAC;IAEzB,UAAU,EAAE,mCAAmC,CAAC;IAEhD,KAAK,EAAE,MAAM,CAAC;CAEf;AAED,eAAO,MAAM,qBAAqB,uBACZ,gBAAgB,GAAG,MAAM,wBAE5C,SA+BF,CAAA;AAED,eAAO,MAAM,yBAAyB,aAAc,iBAAiB,KAAG,gBAQvE,CAAA"}
1
+ {"version":3,"file":"FragmentSelector.d.ts","sourceRoot":"","sources":["../../../../src/model/w3c/fragment/FragmentSelector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IAEnD,IAAI,EAAE,kBAAkB,CAAC;IAEzB,UAAU,EAAE,mCAAmC,CAAC;IAEhD,KAAK,EAAE,MAAM,CAAC;CAEf;AAED,eAAO,MAAM,qBAAqB,uBACZ,gBAAgB,GAAG,MAAM,wBAE5C,SA+BF,CAAC;AAEF,eAAO,MAAM,yBAAyB,aAAc,iBAAiB,KAAG,gBAQvE,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export * from './fragment';
2
2
  export * from './svg';
3
- export * from './W3CImageAnnotation';
4
3
  export * from './W3CImageFormatAdapter';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/w3c/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/model/w3c/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SVG.d.ts","sourceRoot":"","sources":["../../../../src/model/w3c/svg/SVG.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAE1D,eAAO,MAAM,QAAQ,QAAS,OAAO,GAAG,QAAQ,uBAkB/C,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,kBAAkB,gBAAiB,QAAQ,KAAG,OAW1D,CAAA"}
1
+ {"version":3,"file":"SVG.d.ts","sourceRoot":"","sources":["../../../../src/model/w3c/svg/SVG.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAE1D,eAAO,MAAM,QAAQ,QAAS,OAAO,GAAG,QAAQ,uBAmB/C,CAAA;AAED,uDAAuD;AACvD,eAAO,MAAM,kBAAkB,gBAAiB,QAAQ,KAAG,OAW1D,CAAA"}
@@ -1,5 +1,6 @@
1
+ import type { W3CSelector } from '@annotorious/core';
1
2
  import type { Shape } from '../../core';
2
- export interface SVGSelector {
3
+ export interface SVGSelector extends W3CSelector {
3
4
  type: 'SvgSelector';
4
5
  value: string;
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SVGSelector.d.ts","sourceRoot":"","sources":["../../../../src/model/w3c/svg/SVGSelector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsD,KAAK,EAAE,MAAM,YAAY,CAAC;AAI5F,MAAM,WAAW,WAAW;IAE1B,IAAI,EAAE,aAAa,CAAC;IAEpB,KAAK,EAAE,MAAM,CAAC;CAEf;AA0DD,eAAO,MAAM,gBAAgB,qCAAsC,WAAW,GAAG,MAAM,KAAG,CASzF,CAAA;AAED,eAAO,MAAM,oBAAoB,UAAW,KAAK,KAAG,WAiBnD,CAAA"}
1
+ {"version":3,"file":"SVGSelector.d.ts","sourceRoot":"","sources":["../../../../src/model/w3c/svg/SVGSelector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAsD,KAAK,EAAE,MAAM,YAAY,CAAC;AAG5F,MAAM,WAAW,WAAY,SAAQ,WAAW;IAE9C,IAAI,EAAE,aAAa,CAAC;IAEpB,KAAK,EAAE,MAAM,CAAC;CAEf;AA6DD,eAAO,MAAM,gBAAgB,qCAAsC,WAAW,GAAG,MAAM,MAOtF,CAAA;AAED,eAAO,MAAM,oBAAoB,UAAW,KAAK,KAAG,WAiBnD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageAnnotatorState.d.ts","sourceRoot":"","sources":["../../src/state/ImageAnnotatorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EACV,oBAAoB,EAEpB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,IAAI,cAAc,CAAC,eAAe,CAAC,GAAG;IAEzH,KAAK,EAAE,CAAC,CAAC;IAET,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAE3C,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CAEpC,CAAA;AAED,eAAO,MAAM,yBAAyB,4BAC9B,gBAAgB,eAAe,EAAE,CAAC,CAAC,KACxC,oBAAoB,oBAAoB,CAwC1C,CAAA;AAED,eAAO,MAAM,+BAA+B,4BACpC,gBAAgB,eAAe,EAAE,CAAC,CAAC,KACxC,yBASF,CAAA"}
1
+ {"version":3,"file":"ImageAnnotatorState.d.ts","sourceRoot":"","sources":["../../src/state/ImageAnnotatorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,KAAK,EACV,oBAAoB,EAEpB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,oBAAoB,GAAG,oBAAoB,IAAI,cAAc,CAAC,eAAe,CAAC,GAAG;IAEzH,KAAK,EAAE,CAAC,CAAC;IAET,SAAS,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;IAE3C,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;CAEpC,CAAA;AAED,eAAO,MAAM,yBAAyB,oEAEnC,oBAAoB,oBAAoB,CAwC1C,CAAA;AAED,eAAO,MAAM,+BAA+B,oEAEzC,yBASF,CAAA"}
@@ -9,7 +9,7 @@ interface IndexedTarget {
9
9
  export declare const createSpatialTree: () => {
10
10
  all: () => IndexedTarget[];
11
11
  clear: () => void;
12
- getAt: (x: number, y: number) => ImageAnnotationTarget | undefined;
12
+ getAt: (x: number, y: number) => ImageAnnotationTarget | null;
13
13
  getIntersecting: (x: number, y: number, width: number, height: number) => ImageAnnotationTarget[];
14
14
  insert: (target: ImageAnnotationTarget) => void;
15
15
  remove: (target: ImageAnnotationTarget) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"spatialTree.d.ts","sourceRoot":"","sources":["../../src/state/spatialTree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,UAAU,aAAa;IAErB,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,qBAAqB,CAAC;CAE/B;AAED,eAAO,MAAM,iBAAiB;;;eA+CV,MAAM,KAAK,MAAM,KAAG,qBAAqB,GAAG,SAAS;yBAqB3C,MAAM,KAAK,MAAM,SAAS,MAAM,UAAU,MAAM;qBAvDpD,qBAAqB;qBASrB,qBAAqB;mBAYvB,qBAAqB,EAAE,YAAW,OAAO;;uBALrC,qBAAqB,WAAW,qBAAqB;CA6DhF,CAAA"}
1
+ {"version":3,"file":"spatialTree.d.ts","sourceRoot":"","sources":["../../src/state/spatialTree.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,UAAU,aAAa;IAErB,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,MAAM,CAAC;IAEb,MAAM,EAAE,qBAAqB,CAAC;CAE/B;AAED,eAAO,MAAM,iBAAiB;;;eA8CV,MAAM,KAAK,MAAM,KAAG,qBAAqB,GAAG,IAAI;yBAqBtC,MAAM,KAAK,MAAM,SAAS,MAAM,UAAU,MAAM;qBAtDpD,qBAAqB;qBASrB,qBAAqB;mBAWvB,qBAAqB,EAAE,YAAW,OAAO;;uBALrC,qBAAqB,WAAW,qBAAqB;CA6DhF,CAAA"}
@@ -1,5 +1,3 @@
1
- import type { Theme } from '../../AnnotoriousOpts';
2
1
  export declare const sampleBrightness: (imageOrCanvas: HTMLElement) => number;
3
- export declare const detectTheme: (imageOrCanvas: HTMLElement) => "dark" | "light";
4
- export declare const setTheme: (imageOrCanvas: HTMLElement, container: HTMLElement, theme: Theme) => void;
2
+ export declare const setTheme: (imageOrCanvas: HTMLElement, container: HTMLElement) => void;
5
3
  //# sourceMappingURL=setTheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setTheme.d.ts","sourceRoot":"","sources":["../../../src/themes/smart/setTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,eAAO,MAAM,gBAAgB,kBAAmB,WAAW,WAmC1D,CAAA;AAED,eAAO,MAAM,WAAW,kBAAmB,WAAW,qBAOrD,CAAA;AAED,eAAO,MAAM,QAAQ,kBAAmB,WAAW,aAAa,WAAW,SAAS,KAAK,SACI,CAAC"}
1
+ {"version":3,"file":"setTheme.d.ts","sourceRoot":"","sources":["../../../src/themes/smart/setTheme.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,kBAAmB,WAAW,WAmC1D,CAAA;AAED,eAAO,MAAM,QAAQ,kBAAmB,WAAW,aAAa,WAAW,SAQ1E,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@annotorious/annotorious",
3
- "version": "3.0.0-rc.20",
3
+ "version": "3.0.0-rc.3",
4
4
  "description": "Add image annotation functionality to any web page with a few lines of JavaScript",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -33,22 +33,22 @@
33
33
  "require": "./dist/annotorious.js"
34
34
  },
35
35
  "./annotorious.css": "./dist/annotorious.css",
36
- "./src": "./src/index.ts"
36
+ "./src": "./src/index.ts",
37
+ "./src/annotation": "./src/annotation/index.ts",
38
+ "./src/model": "./src/model/index.ts"
37
39
  },
38
40
  "devDependencies": {
39
- "@sveltejs/vite-plugin-svelte": "^3.0.2",
40
- "@tsconfig/svelte": "^5.0.2",
41
- "@types/rbush": "^3.0.3",
42
- "jsdom": "^24.0.0",
43
- "svelte": "^4.2.12",
44
- "svelte-preprocess": "^5.1.3",
45
- "typescript": "^5.3.3",
46
- "vite": "^5.2.2",
47
- "vite-plugin-dts": "^3.7.3",
48
- "vitest": "^1.4.0"
41
+ "@sveltejs/vite-plugin-svelte": "^2.4.6",
42
+ "@tsconfig/svelte": "^3.0.0",
43
+ "@types/rbush": "^3.0.2",
44
+ "jsdom": "^22.1.0",
45
+ "svelte": "^3.59.2",
46
+ "typescript": "^4.9.5",
47
+ "vite": "^4.4.9",
48
+ "vite-plugin-dts": "^3.6.0",
49
+ "vitest": "^0.34.6"
49
50
  },
50
51
  "dependencies": {
51
- "@annotorious/core": "*",
52
52
  "rbush": "^3.0.1",
53
53
  "uuid": "^9.0.1"
54
54
  }
@@ -37,7 +37,7 @@
37
37
  cursor: move;
38
38
  }
39
39
 
40
- .a9s-handle {
40
+ .a9s-corner-handle {
41
41
  cursor: move;
42
42
  }
43
43
 
@@ -57,18 +57,18 @@
57
57
  cursor: w-resize;
58
58
  }
59
59
 
60
- .a9s-handle.a9s-corner-handle-topleft {
60
+ .a9s-corner-handle.a9s-corner-handle-topleft {
61
61
  cursor: nw-resize;
62
62
  }
63
63
 
64
- .a9s-handle.a9s-corner-handle-topright {
64
+ .a9s-corner-handle.a9s-corner-handle-topright {
65
65
  cursor: ne-resize;
66
66
  }
67
67
 
68
- .a9s-handle.a9s-corner-handle-bottomright {
68
+ .a9s-corner-handle.a9s-corner-handle-bottomright {
69
69
  cursor: se-resize;
70
70
  }
71
71
 
72
- .a9s-handle.a9s-corner-handle-bottomleft {
72
+ .a9s-corner-handle.a9s-corner-handle-bottomleft {
73
73
  cursor: sw-resize;
74
74
  }
@@ -1,5 +1,5 @@
1
1
  import type { SvelteComponent } from 'svelte';
2
- import { PointerSelectAction, type Annotator, type DrawingStyle, type Filter, type User } from '@annotorious/core';
2
+ import type { Annotator, DrawingStyle, Filter, User } from '@annotorious/core';
3
3
  import { createAnonymousGuest, createBaseAnnotator, createLifecyleObserver, createUndoStack } from '@annotorious/core';
4
4
  import { registerEditor } from './annotation/editors';
5
5
  import { getTool, registerTool, listDrawingTools, type DrawingTool } from './annotation/tools';
@@ -7,8 +7,8 @@ import { SVGAnnotationLayer } from './annotation';
7
7
  import type { DrawingToolOpts, SVGAnnotationLayerPointerEvent } from './annotation';
8
8
  import type { ImageAnnotation, ShapeType } from './model';
9
9
  import { createSvelteImageAnnotatorState } from './state';
10
- import { setTheme as _setTheme } from './themes';
11
- import { fillDefaults, type Theme } from './AnnotoriousOpts';
10
+ import { setTheme } from './themes';
11
+ import { fillDefaults } from './AnnotoriousOpts';
12
12
  import type { AnnotoriousOpts } from './AnnotoriousOpts';
13
13
  import { initKeyboardCommands } from './keyboardCommands';
14
14
 
@@ -24,12 +24,10 @@ export interface ImageAnnotator<E extends unknown = ImageAnnotation> extends Ann
24
24
 
25
25
  registerShapeEditor(shapeType: ShapeType, editor: typeof SvelteComponent): void;
26
26
 
27
- setDrawingTool(name: DrawingTool): void;
27
+ setDrawingTool(tool: DrawingTool): void;
28
28
 
29
29
  setDrawingEnabled(enabled: boolean): void;
30
30
 
31
- setTheme(theme: Theme): void;
32
-
33
31
  }
34
32
 
35
33
  export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
@@ -43,22 +41,16 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
43
41
  const img = (typeof image === 'string' ?
44
42
  document.getElementById(image) : image) as HTMLImageElement | HTMLCanvasElement;
45
43
 
46
- const opts = fillDefaults<ImageAnnotation, E>(options, {
47
- drawingEnabled: true,
48
- drawingMode: 'drag',
49
- pointerSelectAction: PointerSelectAction.EDIT,
50
- theme: 'light'
51
- });
44
+ const opts = fillDefaults<ImageAnnotation, E>(options);
52
45
 
53
46
  const state = createSvelteImageAnnotatorState(opts);
54
47
 
55
- const { selection, store } = state;
56
-
57
- const undoStack = createUndoStack(store);
48
+ const { hover, selection, store } = state;
58
49
 
59
50
  const lifecycle = createLifecyleObserver<ImageAnnotation, E>(
60
- state, undoStack, opts.adapter, opts.autoSave
61
- );
51
+ store, selection, hover, undefined, opts.adapter, opts.autoSave);
52
+
53
+ const undoStack = createUndoStack(store);
62
54
 
63
55
  // We'll wrap the image in a container DIV.
64
56
  const container = document.createElement('DIV');
@@ -68,21 +60,21 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
68
60
  // Wrapper div has unwanted margin at the bottom otherwise!
69
61
  img.style.display = 'block';
70
62
 
71
- img.parentNode!.insertBefore(container, img);
63
+ img.parentNode.insertBefore(container, img);
72
64
  container.appendChild(img);
73
65
 
74
66
  const keyboardCommands = initKeyboardCommands(undoStack);
75
67
 
76
68
  let currentUser: User = createAnonymousGuest();
77
69
 
78
- _setTheme(img, container, opts.theme!);
70
+ setTheme(img, container);
79
71
 
80
72
  const annotationLayer = new SVGAnnotationLayer({
81
73
  target: container,
82
74
  props: {
83
- drawingEnabled: Boolean(opts.drawingEnabled),
75
+ drawingEnabled: opts.drawingEnabled,
84
76
  image: img,
85
- preferredDrawingMode: opts.drawingMode!,
77
+ preferredDrawingMode: opts.drawingMode,
86
78
  state,
87
79
  style: opts.style,
88
80
  user: currentUser
@@ -102,15 +94,15 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
102
94
  /******++++++*************/
103
95
 
104
96
  // Most of the external API functions are covered in the base annotator
105
- const base = createBaseAnnotator<ImageAnnotation, E>(state, undoStack, opts.adapter);
97
+ const base = createBaseAnnotator<ImageAnnotation, E>(store, undoStack, opts.adapter);
106
98
 
107
99
  const destroy = () => {
108
100
  // Destroy Svelte annotation layer
109
101
  annotationLayer.$destroy();
110
102
 
111
103
  // Unwrap the image
112
- container.parentNode!.insertBefore(img, container);
113
- container.parentNode!.removeChild(container);
104
+ container.parentNode.insertBefore(img, container);
105
+ container.parentNode.removeChild(container);
114
106
 
115
107
  // Other cleanup actions
116
108
  keyboardCommands.destroy();
@@ -125,14 +117,10 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
125
117
  const registerShapeEditor = (shapeType: ShapeType, editor: typeof SvelteComponent) =>
126
118
  registerEditor(shapeType, editor);
127
119
 
128
- const setDrawingTool = (name: DrawingTool) => {
129
- // Validate that the tool exists
130
- const toolSpec = getTool(name);
131
- if (!toolSpec)
132
- throw `No drawing tool named ${name}`;
133
-
120
+ const setDrawingTool = (t: DrawingTool) => {
121
+ const { tool, opts } = getTool(t);
134
122
  // @ts-ignore
135
- annotationLayer.$set({ toolName: name })
123
+ annotationLayer.$set({ tool, opts })
136
124
  }
137
125
 
138
126
  const setDrawingEnabled = (enabled: boolean) =>
@@ -142,11 +130,17 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
142
130
  console.warn('Filter not implemented yet');
143
131
  }
144
132
 
133
+ const setSelected = (arg?: string | string[]) => {
134
+ if (arg) {
135
+ selection.setSelected(arg);
136
+ } else {
137
+ selection.clear();
138
+ }
139
+ }
140
+
145
141
  const setStyle = (style: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle) | undefined) =>
146
142
  annotationLayer.$set({ style });
147
143
 
148
- const setTheme = (theme: Theme) => _setTheme(img, container, theme);
149
-
150
144
  const setUser = (user: User) => {
151
145
  currentUser = user;
152
146
  annotationLayer.$set({ user });
@@ -164,8 +158,8 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
164
158
  setDrawingEnabled,
165
159
  setDrawingTool,
166
160
  setFilter,
161
+ setSelected,
167
162
  setStyle,
168
- setTheme,
169
163
  setUser,
170
164
  state
171
165
  }
@@ -1,4 +1,5 @@
1
- import type { Annotation, DrawingStyle, FormatAdapter, PointerSelectAction } from '@annotorious/core';
1
+ import { PointerSelectAction } from '@annotorious/core';
2
+ import type { Annotation, DrawingStyle, FormatAdapter } from '@annotorious/core';
2
3
  import type { ImageAnnotation } from './model';
3
4
 
4
5
  export interface AnnotoriousOpts<I extends Annotation = ImageAnnotation, E extends unknown = ImageAnnotation> {
@@ -17,25 +18,19 @@ export interface AnnotoriousOpts<I extends Annotation = ImageAnnotation, E exten
17
18
 
18
19
  style?: DrawingStyle | ((annotation: I) => DrawingStyle);
19
20
 
20
- theme?: Theme;
21
-
22
21
  }
23
22
 
24
23
  export type DrawingMode = 'click' | 'drag';
25
24
 
26
- export type Theme = 'dark' | 'light' | 'auto';
27
-
28
25
  export const fillDefaults = <I extends ImageAnnotation = ImageAnnotation, E extends unknown = ImageAnnotation> (
29
- opts: AnnotoriousOpts<I, E>,
30
- defaults: AnnotoriousOpts<I, E>
26
+ opts: AnnotoriousOpts<I, E>
31
27
  ): AnnotoriousOpts<I, E> => {
32
28
 
33
29
  return {
34
30
  ...opts,
35
- drawingEnabled: opts.drawingEnabled === undefined ? defaults.drawingEnabled : opts.drawingEnabled,
36
- drawingMode: opts.drawingMode || defaults.drawingMode,
37
- pointerSelectAction: opts.pointerSelectAction || defaults.pointerSelectAction,
38
- theme: opts.theme || defaults.theme
31
+ drawingEnabled: opts.drawingEnabled === undefined ? true : opts.drawingEnabled,
32
+ drawingMode: opts.drawingMode || 'drag',
33
+ pointerSelectAction: opts.pointerSelectAction || PointerSelectAction.EDIT
39
34
  };
40
35
 
41
36
  };
@@ -1,12 +1,12 @@
1
- <script lang="ts">
2
- import { SvelteComponent, onMount } from 'svelte';
1
+ <script type="ts">
2
+ import { onMount, type SvelteComponent } from 'svelte';
3
3
  import { v4 as uuidv4 } from 'uuid';
4
4
  import type { DrawingStyle, StoreChangeEvent, User } from '@annotorious/core';
5
5
  import { ShapeType } from '../model';
6
6
  import type { ImageAnnotation, Shape} from '../model';
7
- import { getEditor as _getEditor, EditorMount } from './editors';
7
+ import { getEditor, EditorMount } from './editors';
8
8
  import { Ellipse, Polygon, Rectangle} from './shapes';
9
- import { getTool, listDrawingTools, ToolMount } from './tools';
9
+ import { getTool, ToolMount } from './tools';
10
10
  import { enableResponsive } from './utils';
11
11
  import { createSVGTransform } from './Transform';
12
12
  import { addEventListeners } from './SVGAnnotationLayerPointerEvent';
@@ -18,12 +18,10 @@
18
18
  export let image: HTMLImageElement | HTMLCanvasElement;
19
19
  export let preferredDrawingMode: DrawingMode;
20
20
  export let state: SvelteImageAnnotatorState;
21
- export let style: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle) | undefined = undefined;
22
- export let toolName: string = listDrawingTools()[0];
21
+ export let style: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle) = undefined;
22
+ export let { tool, opts } = getTool('rectangle');
23
23
  export let user: User;
24
24
 
25
- $: ({ tool, opts } = getTool(toolName) || { tool: undefined, opts: undefined });
26
-
27
25
  $: drawingMode = opts?.drawingMode || preferredDrawingMode;
28
26
 
29
27
  /** Drawing tool layer **/
@@ -43,17 +41,16 @@
43
41
 
44
42
  $: ({ onPointerDown, onPointerUp } = addEventListeners(svgEl, store));
45
43
 
46
- let storeObserver: (event: StoreChangeEvent<ImageAnnotation>) => void | undefined;
44
+ let storeObserver = null;
47
45
 
48
- let editableAnnotations: ImageAnnotation[] | undefined;
46
+ let editableAnnotations: ImageAnnotation[] = null;
49
47
 
50
48
  $: isEditable = (a: ImageAnnotation) => $selection.selected.find(s => s.id === a.id && s.editable);
51
49
 
52
50
  $: trackSelection($selection.selected);
53
51
 
54
52
  const trackSelection = (selected: { id: string, editable?: boolean }[]) => {
55
- if (storeObserver)
56
- store.unobserve(storeObserver);
53
+ store.unobserve(storeObserver);
57
54
 
58
55
  // Track only editable annotations
59
56
  const editableIds =
@@ -61,17 +58,17 @@
61
58
 
62
59
  if (editableIds.length > 0) {
63
60
  // Resolve selected IDs from the store
64
- editableAnnotations = editableIds.map(id => store.getAnnotation(id)!).filter(Boolean);
61
+ editableAnnotations = editableIds.map(id => store.getAnnotation(id));
65
62
 
66
63
  // Track updates on the editable annotations
67
64
  storeObserver = (event: StoreChangeEvent<ImageAnnotation>) => {
68
65
  const { updated } = event.changes;
69
- editableAnnotations = updated?.map(change => change.newValue);
66
+ editableAnnotations = updated.map(change => change.newValue);
70
67
  }
71
68
 
72
69
  store.observe(storeObserver, { annotations: editableIds });
73
70
  } else {
74
- editableAnnotations = undefined;
71
+ editableAnnotations = null;
75
72
  }
76
73
  }
77
74
 
@@ -109,13 +106,10 @@
109
106
  ...target,
110
107
  selector: event.detail,
111
108
  created: isUpdate ? target.created : new Date(),
112
- updated: isUpdate ? new Date() : undefined,
113
- updatedBy: isUpdate ? user : undefined
109
+ updated: isUpdate ? new Date() : null,
110
+ updatedBy: isUpdate ? user : null
114
111
  });
115
112
  }
116
-
117
- // To get around lack of TypeScript support in Svelte markup
118
- const getEditor = (shape: Shape): typeof SvelteComponent => _getEditor(shape)!;
119
113
  </script>
120
114
 
121
115
  <svg
@@ -160,7 +154,7 @@
160
154
  {/key}
161
155
  {/each}
162
156
  {:else if (tool && drawingEnabled)}
163
- {#key toolName}
157
+ {#key tool}
164
158
  <ToolMount
165
159
  target={drawingEl}
166
160
  tool={tool}
@@ -1,6 +1,7 @@
1
1
  import { createEventDispatcher } from 'svelte';
2
2
  import type { SvelteImageAnnotationStore } from '../state';
3
3
  import type { ImageAnnotation } from '../model';
4
+ import { isTouch } from './utils';
4
5
 
5
6
  export interface SVGAnnotationLayerPointerEvent {
6
7
 
@@ -50,5 +51,5 @@ const getSVGPoint = (evt: PointerEvent, svg: SVGSVGElement) => {
50
51
  pt.x = x + left;
51
52
  pt.y = y + top;
52
53
 
53
- return pt.matrixTransform(svg.getScreenCTM()!.inverse());
54
+ return pt.matrixTransform(svg.getScreenCTM().inverse());
54
55
  }
@@ -19,7 +19,7 @@ export const createSVGTransform = (svg: SVGSVGElement): Transform => ({
19
19
  pt.x = offsetX + bbox.x;
20
20
  pt.y = offsetY + bbox.y;
21
21
 
22
- const { x, y } = pt.matrixTransform(svg.getScreenCTM()!.inverse());
22
+ const { x, y } = pt.matrixTransform(svg.getScreenCTM().inverse());
23
23
  return [x, y];
24
24
  }
25
25
 
@@ -1,22 +1,23 @@
1
- <script lang="ts">
1
+ <script type="ts">
2
2
  import { createEventDispatcher } from 'svelte';
3
3
  import type { Shape } from '../../model';
4
+ import type { Handle } from './Handle';
4
5
  import type { Transform } from '../Transform';
5
6
 
6
- const dispatch = createEventDispatcher<{ grab: PointerEvent, release: PointerEvent, change: Shape }>();
7
+ const dispatch = createEventDispatcher<{ grab: undefined, release: undefined, change: Shape }>();
7
8
 
8
9
  /** Props */
9
10
  export let shape: Shape;
10
- export let editor: (shape: Shape, handle: string, delta: [number, number]) => Shape;
11
+ export let editor: (shape: Shape, handle: Handle, delta: [number, number]) => Shape;
11
12
  export let transform: Transform;
12
13
 
13
- let grabbedHandle: string | undefined;
14
+ let grabbedHandle: Handle = null;
14
15
 
15
16
  let origin: [number, number];
16
17
 
17
- let initialShape: Shape | undefined;
18
+ let initialShape: Shape = null;
18
19
 
19
- const onGrab = (handle: string) => (evt: PointerEvent) => {
20
+ const onGrab = (handle: Handle) => (evt: PointerEvent) => {
20
21
  grabbedHandle = handle;
21
22
  origin = transform.elementToImage(evt.offsetX, evt.offsetY);
22
23
  initialShape = shape;
@@ -24,7 +25,7 @@
24
25
  const target = evt.target as Element;
25
26
  target.setPointerCapture(evt.pointerId);
26
27
 
27
- dispatch('grab', evt);
28
+ dispatch('grab');
28
29
  }
29
30
 
30
31
  const onPointerMove = (evt: PointerEvent) => {
@@ -33,7 +34,7 @@
33
34
 
34
35
  const delta: [number, number] = [x - origin[0], y - origin[1]];
35
36
 
36
- shape = editor(initialShape!, grabbedHandle, delta);
37
+ shape = editor(initialShape, grabbedHandle, delta);
37
38
 
38
39
  dispatch('change', shape);
39
40
  }
@@ -43,11 +44,11 @@
43
44
  const target = evt.target as Element;
44
45
  target.releasePointerCapture(evt.pointerId);
45
46
 
46
- grabbedHandle = undefined;
47
+ grabbedHandle = null;
47
48
 
48
49
  initialShape = shape;
49
50
 
50
- dispatch('release', evt);
51
+ dispatch('release');
51
52
  }
52
53
  </script>
53
54
 
@@ -5,12 +5,12 @@
5
5
  import { computeStyle } from '../utils/styling';
6
6
  import type { Transform } from '../Transform';
7
7
 
8
- const dispatch = createEventDispatcher<{ grab: PointerEvent, release: PointerEvent, change: Shape }>();
8
+ const dispatch = createEventDispatcher<{ grab: undefined, release: undefined, change: Shape }>();
9
9
 
10
10
  /** Props */
11
11
  export let annotation: ImageAnnotation;
12
12
  export let editor: typeof SvelteComponent;
13
- export let style: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle) | undefined;
13
+ export let style: DrawingStyle | ((annotation: ImageAnnotation) => DrawingStyle) = undefined;
14
14
  export let target: SVGGElement;
15
15
  export let transform: Transform;
16
16
  export let viewportScale: number;
@@ -0,0 +1,21 @@
1
+ export type Handle = string;
2
+
3
+ export const Handle = (value: string | number) => `HANDLE-${value}`;
4
+
5
+ Handle.SHAPE = 'SHAPE';
6
+
7
+ Handle.TOP = 'TOP';
8
+
9
+ Handle.RIGHT = 'RIGHT';
10
+
11
+ Handle.BOTTOM = 'BOTTOM';
12
+
13
+ Handle.LEFT = 'LEFT';
14
+
15
+ Handle.TOP_LEFT = 'TOP_LEFT';
16
+
17
+ Handle.TOP_RIGHT = 'TOP_RIGHT';
18
+
19
+ Handle.BOTTOM_RIGHT = 'BOTTOM_RIGHT';
20
+
21
+ Handle.BOTTOM_LEFT = 'BOTTOM_LEFT';
@@ -1,7 +1,7 @@
1
1
  export * from './polygon';
2
2
  export * from './rectangle';
3
3
  export * from './editorsRegistry';
4
+ export * from './Handle';
4
5
 
5
6
  export { default as Editor } from './Editor.svelte';
6
- export { default as EditorMount } from './EditorMount.svelte';
7
- export { default as Handle } from './Handle.svelte';
7
+ export { default as EditorMount } from './EditorMount.svelte';