@annotorious/react 3.0.0-rc.3 → 3.0.0-rc.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/Annotorious.d.ts +12 -34
  2. package/dist/Annotorious.d.ts.map +1 -1
  3. package/dist/AnnotoriousPlugin.d.ts +8 -6
  4. package/dist/AnnotoriousPlugin.d.ts.map +1 -1
  5. package/dist/AnnotoriousPopup.d.ts +2 -1
  6. package/dist/ImageAnnotator.d.ts +2 -2
  7. package/dist/ImageAnnotator.d.ts.map +1 -1
  8. package/dist/annotorious-react.css +1 -1
  9. package/dist/annotorious-react.es.js +37 -52
  10. package/dist/annotorious-react.es.js.map +1 -1
  11. package/dist/annotorious-react.es10.js +16 -3
  12. package/dist/annotorious-react.es10.js.map +1 -1
  13. package/dist/annotorious-react.es11.js +6 -27
  14. package/dist/annotorious-react.es11.js.map +1 -1
  15. package/dist/annotorious-react.es12.js +7 -19
  16. package/dist/annotorious-react.es12.js.map +1 -1
  17. package/dist/annotorious-react.es13.js +131 -51
  18. package/dist/annotorious-react.es13.js.map +1 -1
  19. package/dist/annotorious-react.es14.js +32 -17
  20. package/dist/annotorious-react.es14.js.map +1 -1
  21. package/dist/annotorious-react.es15.js +2 -22
  22. package/dist/annotorious-react.es15.js.map +1 -1
  23. package/dist/annotorious-react.es16.js +26 -2
  24. package/dist/annotorious-react.es16.js.map +1 -1
  25. package/dist/annotorious-react.es17.js +606 -2
  26. package/dist/annotorious-react.es17.js.map +1 -1
  27. package/dist/annotorious-react.es18.js +2 -3859
  28. package/dist/annotorious-react.es18.js.map +1 -1
  29. package/dist/annotorious-react.es19.js +2 -29
  30. package/dist/annotorious-react.es19.js.map +1 -1
  31. package/dist/annotorious-react.es2.js +87 -68
  32. package/dist/annotorious-react.es2.js.map +1 -1
  33. package/dist/annotorious-react.es3.js +6 -7
  34. package/dist/annotorious-react.es3.js.map +1 -1
  35. package/dist/annotorious-react.es4.js +8 -8
  36. package/dist/annotorious-react.es4.js.map +1 -1
  37. package/dist/annotorious-react.es5.js +19 -17
  38. package/dist/annotorious-react.es5.js.map +1 -1
  39. package/dist/annotorious-react.es8.js +27 -47
  40. package/dist/annotorious-react.es8.js.map +1 -1
  41. package/dist/annotorious-react.es9.js +35 -12
  42. package/dist/annotorious-react.es9.js.map +1 -1
  43. package/dist/index.d.ts +11 -11
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/openseadragon/OpenSeadragonAnnotator.d.ts +3 -2
  46. package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
  47. package/dist/openseadragon/OpenSeadragonPopup.d.ts +2 -1
  48. package/dist/openseadragon/OpenSeadragonViewer.d.ts +3 -3
  49. package/dist/openseadragon/OpenSeadragonViewer.d.ts.map +1 -1
  50. package/dist/openseadragon/setPosition.d.ts +2 -1
  51. package/dist/openseadragon/setPosition.d.ts.map +1 -1
  52. package/package.json +18 -10
  53. package/dist/annotorious-react.es20.js +0 -39
  54. package/dist/annotorious-react.es20.js.map +0 -1
  55. package/dist/annotorious-react.es21.js +0 -19
  56. package/dist/annotorious-react.es21.js.map +0 -1
  57. package/dist/annotorious-react.es22.js +0 -7
  58. package/dist/annotorious-react.es22.js.map +0 -1
  59. package/dist/annotorious-react.es23.js +0 -11
  60. package/dist/annotorious-react.es23.js.map +0 -1
  61. package/dist/annotorious-react.es24.js +0 -156
  62. package/dist/annotorious-react.es24.js.map +0 -1
  63. package/dist/annotorious-react.es25.js +0 -9
  64. package/dist/annotorious-react.es25.js.map +0 -1
  65. package/dist/annotorious-react.es26.js +0 -20665
  66. package/dist/annotorious-react.es26.js.map +0 -1
  67. package/dist/annotorious-react.es27.js +0 -35
  68. package/dist/annotorious-react.es27.js.map +0 -1
  69. package/dist/annotorious-react.es28.js +0 -5
  70. package/dist/annotorious-react.es28.js.map +0 -1
  71. package/dist/annotorious-react.es29.js +0 -33
  72. package/dist/annotorious-react.es29.js.map +0 -1
  73. package/dist/annotorious-react.es30.js +0 -602
  74. package/dist/annotorious-react.es30.js.map +0 -1
  75. package/dist/annotorious-react.es31.js +0 -5
  76. package/dist/annotorious-react.es31.js.map +0 -1
  77. package/dist/annotorious-react.es32.js +0 -5
  78. package/dist/annotorious-react.es32.js.map +0 -1
  79. package/dist/annotorious-react.es33.js +0 -20
  80. package/dist/annotorious-react.es33.js.map +0 -1
  81. package/dist/annotorious-react.es34.js +0 -30
  82. package/dist/annotorious-react.es34.js.map +0 -1
  83. package/dist/annotorious-react.es35.js +0 -19
  84. package/dist/annotorious-react.es35.js.map +0 -1
  85. package/dist/annotorious-react.es36.js +0 -24
  86. package/dist/annotorious-react.es36.js.map +0 -1
  87. package/dist/annotorious-react.es37.js +0 -19
  88. package/dist/annotorious-react.es37.js.map +0 -1
  89. package/dist/annotorious-react.es38.js +0 -7
  90. package/dist/annotorious-react.es38.js.map +0 -1
  91. package/dist/annotorious-react.es39.js +0 -11
  92. package/dist/annotorious-react.es39.js.map +0 -1
  93. package/dist/annotorious-react.es40.js +0 -10
  94. package/dist/annotorious-react.es40.js.map +0 -1
  95. package/dist/annotorious-react.es6.js +0 -5
  96. package/dist/annotorious-react.es6.js.map +0 -1
  97. package/dist/annotorious-react.es7.js +0 -5
  98. package/dist/annotorious-react.es7.js.map +0 -1
@@ -1,35 +0,0 @@
1
- import w from "openseadragon";
2
- const L = (i, h) => {
3
- const e = i.element.getBoundingClientRect(), { minX: n, minY: l, maxX: t, maxY: c } = h.target.selector.geometry.bounds, s = i.viewport.imageToViewerElementCoordinates(new w.Point(n, l)), x = i.viewport.imageToViewerElementCoordinates(new w.Point(t, c));
4
- return {
5
- x: s.x + e.x,
6
- right: x.x + e.x,
7
- y: s.y + e.y,
8
- bottom: x.y + e.y,
9
- width: x.x - s.x,
10
- height: x.y - s.y
11
- };
12
- }, T = (i, h, e, n = 5) => {
13
- const l = i.element.getBoundingClientRect(), t = L(i, h), c = t.y - l.y, s = l.right - t.x, x = l.bottom - t.bottom, d = t.x - l.left, o = e.firstElementChild.getBoundingClientRect(), g = c / o.height, y = s / o.width, a = x / o.height, r = d / o.width, $ = () => {
14
- e.style.left = `${t.x}px`, e.style.top = `${t.y - n - o.height}px`;
15
- }, f = () => {
16
- e.style.left = `${t.right - o.width}px`, e.style.top = `${t.y - n - o.height}px`;
17
- }, B = () => {
18
- e.style.left = `${t.x - o.width - n}px`, e.style.top = `${t.y}px`;
19
- }, v = () => {
20
- e.style.left = `${t.right + n}px`, e.style.top = `${t.y}px`;
21
- }, R = () => {
22
- e.style.left = `${t.x - o.width - n}px`, e.style.top = `${t.bottom - o.height}px`;
23
- }, C = () => {
24
- e.style.left = `${t.x + t.width + n}px`, e.style.top = `${t.bottom - o.height}px`;
25
- }, E = () => {
26
- e.style.left = `${t.x}px`, e.style.top = `${t.bottom + n}px`;
27
- }, A = () => {
28
- e.style.left = `${t.right - o.width}px`, e.style.top = `${t.bottom + n}px`;
29
- }, b = [g, y, a, r], m = b.indexOf(Math.max(...b));
30
- m === 0 ? y > r ? $() : f() : m === 1 ? g > a ? C() : v() : m === 2 ? y > r ? E() : A() : g > a ? R() : B();
31
- };
32
- export {
33
- T as setPosition
34
- };
35
- //# sourceMappingURL=annotorious-react.es27.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"annotorious-react.es27.js","sources":["../src/openseadragon/setPosition.ts"],"sourcesContent":["import { ImageAnnotation } from '@annotorious/annotorious';\nimport OpenSeadragon from 'openseadragon';\n\nconst getAnnotationDomRect = (viewer: OpenSeadragon.Viewer, annotation: ImageAnnotation) => {\n const viewerBounds = viewer.element.getBoundingClientRect();\n \n // Annotation bounds (image coordinates)\n const { minX, minY, maxX, maxY } = annotation.target.selector.geometry.bounds;\n\n // Annotation coordinates - viewer element coordinates\n const topLeft = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(minX, minY));\n const bottomRight = viewer.viewport.imageToViewerElementCoordinates(new OpenSeadragon.Point(maxX, maxY));\n\n // Account for viewer element offset\n return {\n x: topLeft.x + viewerBounds.x,\n right: bottomRight.x + viewerBounds.x,\n y: topLeft.y + viewerBounds.y,\n bottom: bottomRight.y + viewerBounds.y,\n width: bottomRight.x - topLeft.x,\n height: bottomRight.y - topLeft.y,\n };\n}\n\nexport const setPosition = (\n viewer: OpenSeadragon.Viewer, \n annotation: ImageAnnotation, \n popup: HTMLElement,\n sideOffset: number = 5\n) => {\n const viewerBounds = viewer.element.getBoundingClientRect();\n const annoBounds = getAnnotationDomRect(viewer, annotation);\n\n // Available space above, right, below, left the annotation in the viewport\n const availableAbove = annoBounds.y - viewerBounds.y;\n const availableRight = viewerBounds.right - annoBounds.x;\n const availableBelow = viewerBounds.bottom - annoBounds.bottom;\n const availableLeft = annoBounds.x - viewerBounds.left;\n\n // Popup element bounds\n const popupBounds = popup.firstElementChild.getBoundingClientRect();\n\n // Eight possible base alignment anchor points\n //\n // topleft topright\n // * *\n // leftdown * |---------------------| * rightdown\n // | |\n // | |\n // | |\n // leftup * |---------------------| * rightup\n // * * \n // bottomleft bottomright\n //\n // We'll position the popup at the cardinal direction\n // with the highest ratio: available space vs. popup size.\n const ratioAbove = availableAbove / popupBounds.height;\n const ratioRight = availableRight / popupBounds.width;\n const ratioBelow = availableBelow / popupBounds.height;\n const ratioLeft = availableLeft / popupBounds.width;\n\n const topleft = () => {\n popup.style.left = `${annoBounds.x}px`;\n popup.style.top = `${annoBounds.y - sideOffset - popupBounds.height}px`;\n }\n\n const topright = () => {\n popup.style.left = `${annoBounds.right - popupBounds.width}px`;\n popup.style.top = `${annoBounds.y - sideOffset - popupBounds.height}px`;\n }\n\n const leftdown = () => {\n popup.style.left = `${annoBounds.x - popupBounds.width - sideOffset}px`;\n popup.style.top = `${annoBounds.y}px`;\n } \n\n const rightdown = () => {\n popup.style.left = `${annoBounds.right + sideOffset}px`;\n popup.style.top = `${annoBounds.y}px`;\n }\n\n const leftup = () => {\n popup.style.left = `${annoBounds.x - popupBounds.width - sideOffset}px`;\n popup.style.top = `${annoBounds.bottom - popupBounds.height}px`;\n }\n\n const rightup = () => {\n popup.style.left = `${annoBounds.x + annoBounds.width + sideOffset}px`;\n popup.style.top = `${annoBounds.bottom - popupBounds.height}px`;\n }\n\n const bottomleft = () => {\n popup.style.left = `${annoBounds.x}px`;\n popup.style.top = `${annoBounds.bottom + sideOffset}px`;\n }\n\n const bottomright = () => {\n popup.style.left = `${annoBounds.right - popupBounds.width}px`;\n popup.style.top = `${annoBounds.bottom + sideOffset}px`;\n }\n\n const ratios = [ratioAbove, ratioRight, ratioBelow, ratioLeft];\n const maxIdx = ratios.indexOf(Math.max(...ratios));\n\n if (maxIdx === 0) {\n // Main orientation: above\n if (ratioRight > ratioLeft)\n topleft();\n else \n topright();\n } else if (maxIdx === 1) {\n // Main orientation: right\n if (ratioAbove > ratioBelow)\n rightup();\n else\n rightdown();\n } else if (maxIdx === 2) {\n // Main orientation: below\n if (ratioRight > ratioLeft)\n bottomleft();\n else\n bottomright();\n } else {\n // Main orientation: left\n if (ratioAbove > ratioBelow)\n leftup();\n else \n leftdown();\n }\n}"],"names":["getAnnotationDomRect","viewer","annotation","viewerBounds","minX","minY","maxX","maxY","topLeft","OpenSeadragon","bottomRight","setPosition","popup","sideOffset","annoBounds","availableAbove","availableRight","availableBelow","availableLeft","popupBounds","ratioAbove","ratioRight","ratioBelow","ratioLeft","topleft","topright","leftdown","rightdown","leftup","rightup","bottomleft","bottomright","ratios","maxIdx"],"mappings":";AAGA,MAAMA,IAAuB,CAACC,GAA8BC,MAAgC;AACpF,QAAAC,IAAeF,EAAO,QAAQ,sBAAsB,GAGpD,EAAE,MAAAG,GAAM,MAAAC,GAAM,MAAAC,GAAM,MAAAC,MAASL,EAAW,OAAO,SAAS,SAAS,QAGjEM,IAAUP,EAAO,SAAS,gCAAgC,IAAIQ,EAAc,MAAML,GAAMC,CAAI,CAAC,GAC7FK,IAAcT,EAAO,SAAS,gCAAgC,IAAIQ,EAAc,MAAMH,GAAMC,CAAI,CAAC;AAGhG,SAAA;AAAA,I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AAM,MAAM,GAAGE,EAAW,CAAC;AAAA,EAAA,GAG7Bc,IAAS,MAAM;AACnB,IAAAhB,EAAM,MAAM,OAAO,GAAGE,EAAW,IAAIK,EAAY,QAAQN,CAAU,MACnED,EAAM,MAAM,MAAM,GAAGE,EAAW,SAASK,EAAY,MAAM;AAAA,EAAA,GAGvDU,IAAU,MAAM;AACpB,IAAAjB,EAAM,MAAM,OAAO,GAAGE,EAAW,IAAIA,EAAW,QAAQD,CAAU,MAClED,EAAM,MAAM,MAAM,GAAGE,EAAW,SAASK,EAAY,MAAM;AAAA,EAAA,GAGvDW,IAAa,MAAM;AACvB,IAAAlB,EAAM,MAAM,OAAO,GAAGE,EAAW,CAAC,MAClCF,EAAM,MAAM,MAAM,GAAGE,EAAW,SAASD,CAAU;AAAA,EAAA,GAG/CkB,IAAc,MAAM;AACxB,IAAAnB,EAAM,MAAM,OAAO,GAAGE,EAAW,QAAQK,EAAY,KAAK,MAC1DP,EAAM,MAAM,MAAM,GAAGE,EAAW,SAASD,CAAU;AAAA,EAAA,GAG/CmB,IAAS,CAACZ,GAAYC,GAAYC,GAAYC,CAAS,GACvDU,IAASD,EAAO,QAAQ,KAAK,IAAI,GAAGA,CAAM,CAAC;AAEjD,EAAIC,MAAW,IAETZ,IAAaE,IACPC,MAECC,MACFQ,MAAW,IAEhBb,IAAaE,IACPO,MAEEF,MACHM,MAAW,IAEhBZ,IAAaE,IACJO,MAECC,MAGVX,IAAaE,IACRM,MAEEF;AAEf;"}
@@ -1,5 +0,0 @@
1
- var e = { exports: {} };
2
- export {
3
- e as __module
4
- };
5
- //# sourceMappingURL=annotorious-react.es28.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"annotorious-react.es28.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,33 +0,0 @@
1
- import { __exports as t } from "./annotorious-react.es31.js";
2
- import R from "react";
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var p;
13
- function v() {
14
- if (p)
15
- return t;
16
- p = 1;
17
- var s = R, m = Symbol.for("react.element"), l = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, d = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, y = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function i(o, r, u) {
19
- var e, n = {}, _ = null, f = null;
20
- u !== void 0 && (_ = "" + u), r.key !== void 0 && (_ = "" + r.key), r.ref !== void 0 && (f = r.ref);
21
- for (e in r)
22
- c.call(r, e) && !y.hasOwnProperty(e) && (n[e] = r[e]);
23
- if (o && o.defaultProps)
24
- for (e in r = o.defaultProps, r)
25
- n[e] === void 0 && (n[e] = r[e]);
26
- return { $$typeof: m, type: o, key: _, ref: f, props: n, _owner: d.current };
27
- }
28
- return t.Fragment = l, t.jsx = i, t.jsxs = i, t;
29
- }
30
- export {
31
- v as __require
32
- };
33
- //# sourceMappingURL=annotorious-react.es29.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"annotorious-react.es29.js","sources":["../../../node_modules/.pnpm/react@18.2.0/node_modules/react/cjs/react-jsx-runtime.production.min.js"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n"],"names":["f","require$$0","k","m","n","p","q","c","a","g","b","d","e","h","reactJsxRuntime_production_min"],"mappings":";;;;;;;;;;;;;;;;AASa,MAAIA,IAAEC,GAAiBC,IAAE,OAAO,IAAI,eAAe,GAAE,IAAE,OAAO,IAAI,gBAAgB,GAAEC,IAAE,OAAO,UAAU,gBAAeC,IAAEJ,EAAE,mDAAmD,mBAAkBK,IAAE,EAAC,KAAI,IAAG,KAAI,IAAG,QAAO,IAAG,UAAS,GAAE;AAClP,WAASC,EAAEC,GAAEC,GAAEC,GAAE;AAAC,QAAIC,GAAEC,IAAE,IAAGC,IAAE,MAAKC,IAAE;AAAK,IAASJ,MAAT,WAAaG,IAAE,KAAGH,IAAYD,EAAE,QAAX,WAAiBI,IAAE,KAAGJ,EAAE,MAAcA,EAAE,QAAX,WAAiBK,IAAEL,EAAE;AAAK,SAAIE,KAAKF;AAAE,MAAAL,EAAE,KAAKK,GAAEE,CAAC,KAAG,CAACL,EAAE,eAAeK,CAAC,MAAIC,EAAED,CAAC,IAAEF,EAAEE,CAAC;AAAG,QAAGH,KAAGA,EAAE;AAAa,WAAIG,KAAKF,IAAED,EAAE,cAAaC;AAAE,QAASG,EAAED,CAAC,MAAZ,WAAgBC,EAAED,CAAC,IAAEF,EAAEE,CAAC;AAAG,WAAM,EAAC,UAASR,GAAE,MAAKK,GAAE,KAAIK,GAAE,KAAIC,GAAE,OAAMF,GAAE,QAAOP,EAAE,QAAO;AAAA,EAAC;AAAC,SAAAU,aAAiB,GAAEA,EAAW,MAACR,GAAEQ,EAAA,OAAaR;;","x_google_ignoreList":[0]}