@annotorious/react 3.0.0-rc.21 → 3.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Annotorious.d.ts +28 -3
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/AnnotoriousPlugin.d.ts +6 -7
- package/dist/AnnotoriousPlugin.d.ts.map +1 -1
- package/dist/ImageAnnotator.d.ts.map +1 -1
- package/dist/annotorious-react.css +1 -1
- package/dist/annotorious-react.es.js +50 -33
- package/dist/annotorious-react.es.js.map +1 -1
- package/dist/annotorious-react.es10.js +3 -29
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js +27 -36
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js +20 -16
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js +54 -6
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js +17 -8
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +21 -152
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js +2 -27436
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js +2 -32
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js +3893 -2
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +29 -30
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +32 -32
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js +35 -598
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js +16 -2
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es22.js +4 -2
- package/dist/annotorious-react.es22.js.map +1 -1
- package/dist/annotorious-react.es23.js +11 -0
- package/dist/annotorious-react.es23.js.map +1 -0
- package/dist/annotorious-react.es24.js +156 -0
- package/dist/annotorious-react.es24.js.map +1 -0
- package/dist/annotorious-react.es25.js +9 -0
- package/dist/annotorious-react.es25.js.map +1 -0
- package/dist/annotorious-react.es26.js +5 -0
- package/dist/annotorious-react.es26.js.map +1 -0
- package/dist/annotorious-react.es27.js +33 -0
- package/dist/annotorious-react.es27.js.map +1 -0
- package/dist/annotorious-react.es28.js +602 -0
- package/dist/annotorious-react.es28.js.map +1 -0
- package/dist/annotorious-react.es29.js +20128 -0
- package/dist/annotorious-react.es29.js.map +1 -0
- package/dist/annotorious-react.es3.js +7 -7
- package/dist/annotorious-react.es3.js.map +1 -1
- package/dist/annotorious-react.es30.js +35 -0
- package/dist/annotorious-react.es30.js.map +1 -0
- package/dist/annotorious-react.es31.js +5 -0
- package/dist/annotorious-react.es31.js.map +1 -0
- package/dist/annotorious-react.es32.js +5 -0
- package/dist/annotorious-react.es32.js.map +1 -0
- package/dist/annotorious-react.es33.js +19 -0
- package/dist/annotorious-react.es33.js.map +1 -0
- package/dist/annotorious-react.es34.js +24 -0
- package/dist/annotorious-react.es34.js.map +1 -0
- package/dist/annotorious-react.es35.js +19 -0
- package/dist/annotorious-react.es35.js.map +1 -0
- package/dist/annotorious-react.es36.js +20 -0
- package/dist/annotorious-react.es36.js.map +1 -0
- package/dist/annotorious-react.es37.js +30 -0
- package/dist/annotorious-react.es37.js.map +1 -0
- package/dist/annotorious-react.es38.js +7 -0
- package/dist/annotorious-react.es38.js.map +1 -0
- package/dist/annotorious-react.es39.js +11 -0
- package/dist/annotorious-react.es39.js.map +1 -0
- package/dist/annotorious-react.es4.js +8 -8
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es40.js +10 -0
- package/dist/annotorious-react.es40.js.map +1 -0
- package/dist/annotorious-react.es5.js +10 -10
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es6.js +4 -1
- package/dist/annotorious-react.es6.js.map +1 -1
- package/dist/annotorious-react.es7.js +4 -1
- package/dist/annotorious-react.es7.js.map +1 -1
- package/dist/annotorious-react.es8.js +57 -85
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js +10 -4237
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +10 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/openseadragon/OpenSeadragonAnnotator.d.ts.map +1 -1
- package/dist/openseadragon/setPosition.d.ts.map +1 -1
- package/package.json +9 -16
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useEffect as i } from "react";
|
|
2
2
|
import { useAnnotator as s } from "./annotorious-react.es2.js";
|
|
3
3
|
const m = (t) => {
|
|
4
|
-
const { plugin:
|
|
4
|
+
const { plugin: u, opts: r } = t, n = s();
|
|
5
5
|
return i(() => {
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
6
|
+
if (n) {
|
|
7
|
+
const o = u(n, r);
|
|
8
|
+
return () => {
|
|
9
|
+
o && "unmount" in o && o.unmount();
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
12
|
}, [n]), null;
|
|
13
13
|
};
|
|
14
14
|
export {
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"annotorious-react.es3.js","sources":["../src/AnnotoriousPlugin.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { Annotation, Annotator } from '@annotorious/annotorious';\nimport { useAnnotator } from './Annotorious';\n\nexport interface AnnotoriousPluginProps <I extends Annotation, E extends unknown> {\n\n plugin: (anno: Annotator<I, E>, opts?: Object) => ({ unmount?: () => void }) | void;\n\n opts?: Object;\n\n}\n\nexport const AnnotoriousPlugin = <I extends Annotation = Annotation, E extends unknown = unknown>(props: AnnotoriousPluginProps<I, E>) => {\n const { plugin, opts } = props;\n\n const anno = useAnnotator<Annotator<I, E>>();\n\n useEffect(() => {\n if (anno) {\n const p = plugin(anno, opts);\n\n return () => {\n if (p && 'unmount' in p)\n p.unmount();\n }\n }\n }, [anno]);\n\n return null;\n\n}"],"names":["AnnotoriousPlugin","props","plugin","opts","anno","useAnnotator","useEffect","p"],"mappings":";;AAYa,MAAAA,IAAoB,CAAiEC,MAAwC;AAClI,QAAA,EAAE,QAAAC,GAAQ,MAAAC,EAAS,IAAAF,GAEnBG,IAAOC;AAEb,SAAAC,EAAU,MAAM;AACd,QAAIF,GAAM;AACF,YAAAG,IAAIL,EAAOE,GAAMD,CAAI;AAE3B,aAAO,MAAM;AACX,QAAII,KAAK,aAAaA,KACpBA,EAAE,QAAQ;AAAA,MAAA;AAAA,IAEhB;AAAA,EAAA,GACC,CAACH,CAAI,CAAC,GAEF;AAET;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
}, A = () => {
|
|
26
|
+
e.style.left = `${t.x}px`, e.style.top = `${t.bottom + n}px`;
|
|
27
|
+
}, E = () => {
|
|
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 ? A() : E() : g > a ? R() : B();
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
T as setPosition
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=annotorious-react.es30.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es30.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":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es31.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es32.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
let u = (t) => crypto.getRandomValues(new Uint8Array(t)), i = (t, e, r) => {
|
|
2
|
+
let n = (2 << Math.log(t.length - 1) / Math.LN2) - 1, o = -~(1.6 * n * e / t.length);
|
|
3
|
+
return (a = e) => {
|
|
4
|
+
let l = "";
|
|
5
|
+
for (; ; ) {
|
|
6
|
+
let g = r(o), s = o;
|
|
7
|
+
for (; s--; )
|
|
8
|
+
if (l += t[g[s] & n] || "", l.length === a)
|
|
9
|
+
return l;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
}, m = (t, e = 21) => i(t, e, u), h = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, r) => (r &= 63, r < 36 ? e += r.toString(36) : r < 62 ? e += (r - 26).toString(36).toUpperCase() : r > 62 ? e += "-" : e += "_", e), "");
|
|
13
|
+
export {
|
|
14
|
+
m as customAlphabet,
|
|
15
|
+
i as customRandom,
|
|
16
|
+
h as nanoid,
|
|
17
|
+
u as random
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=annotorious-react.es33.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es33.js","sources":["../../../node_modules/nanoid/index.browser.js"],"sourcesContent":["export { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nexport let nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\n"],"names":["random","bytes","customRandom","alphabet","defaultSize","getRandom","mask","step","size","id","j","customAlphabet","nanoid","byte"],"mappings":"AACU,IAACA,IAAS,CAAAC,MAAS,OAAO,gBAAgB,IAAI,WAAWA,CAAK,CAAC,GAC9DC,IAAe,CAACC,GAAUC,GAAaC,MAAc;AAC9D,MAAIC,KAAQ,KAAM,KAAK,IAAIH,EAAS,SAAS,CAAC,IAAI,KAAK,OAAQ,GAC3DI,IAAO,CAAC,EAAG,MAAMD,IAAOF,IAAeD,EAAS;AACpD,SAAO,CAACK,IAAOJ,MAAgB;AAC7B,QAAIK,IAAK;AACT,eAAa;AACX,UAAIR,IAAQI,EAAUE,CAAI,GACtBG,IAAIH;AACR,aAAOG;AAEL,YADAD,KAAMN,EAASF,EAAMS,CAAC,IAAIJ,CAAI,KAAK,IAC/BG,EAAG,WAAWD;AAAM,iBAAOC;AAAA,IAElC;AAAA,EACF;AACH,GACWE,IAAiB,CAACR,GAAUK,IAAO,OAC5CN,EAAaC,GAAUK,GAAMR,CAAM,GAC1BY,IAAS,CAACJ,IAAO,OAC1B,OAAO,gBAAgB,IAAI,WAAWA,CAAI,CAAC,EAAE,OAAO,CAACC,GAAII,OACvDA,KAAQ,IACJA,IAAO,KACTJ,KAAMI,EAAK,SAAS,EAAE,IACbA,IAAO,KAChBJ,MAAOI,IAAO,IAAI,SAAS,EAAE,EAAE,YAAa,IACnCA,IAAO,KAChBJ,KAAM,MAENA,KAAM,KAEDA,IACN,EAAE;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const f = [
|
|
2
|
+
"#ff7c00",
|
|
3
|
+
// orange
|
|
4
|
+
"#1ac938",
|
|
5
|
+
// green
|
|
6
|
+
"#e8000b",
|
|
7
|
+
// red
|
|
8
|
+
"#8b2be2",
|
|
9
|
+
// purple
|
|
10
|
+
"#9f4800",
|
|
11
|
+
// brown
|
|
12
|
+
"#f14cc1",
|
|
13
|
+
// pink
|
|
14
|
+
"#ffc400",
|
|
15
|
+
// khaki
|
|
16
|
+
"#00d7ff",
|
|
17
|
+
// cyan
|
|
18
|
+
"#023eff"
|
|
19
|
+
// blue
|
|
20
|
+
];
|
|
21
|
+
export {
|
|
22
|
+
f as DEFAULT_PALETTE
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=annotorious-react.es34.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es34.js","sources":["../../annotorious-core/src/presence/ColorPalette.ts"],"sourcesContent":["// SEABORN_BRIGHT\nexport const DEFAULT_PALETTE: Palette = [\n '#ff7c00', // orange\n '#1ac938', // green\n '#e8000b', // red\n '#8b2be2', // purple\n '#9f4800', // brown\n '#f14cc1', // pink\n '#ffc400', // khaki\n '#00d7ff', // cyan\n '#023eff' // blue\n];\n\nexport type Palette = string[];"],"names":["DEFAULT_PALETTE"],"mappings":"AACO,MAAMA,IAA2B;AAAA,EACtC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
let i = () => ({
|
|
2
|
+
emit(t, ...s) {
|
|
3
|
+
let n = this.events[t] || [];
|
|
4
|
+
for (let e = 0, h = n.length; e < h; e++)
|
|
5
|
+
n[e](...s);
|
|
6
|
+
},
|
|
7
|
+
events: {},
|
|
8
|
+
on(t, s) {
|
|
9
|
+
var n;
|
|
10
|
+
return (n = this.events[t]) != null && n.push(s) || (this.events[t] = [s]), () => {
|
|
11
|
+
var e;
|
|
12
|
+
this.events[t] = (e = this.events[t]) == null ? void 0 : e.filter((h) => s !== h);
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
i as createNanoEvents
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=annotorious-react.es35.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es35.js","sources":["../../../node_modules/nanoevents/index.js"],"sourcesContent":["export let createNanoEvents = () => ({\n emit(event, ...args) {\n let callbacks = this.events[event] || []\n for (let i = 0, length = callbacks.length; i < length; i++) {\n callbacks[i](...args)\n }\n },\n events: {},\n on(event, cb) {\n this.events[event]?.push(cb) || (this.events[event] = [cb])\n return () => {\n this.events[event] = this.events[event]?.filter(i => cb !== i)\n }\n }\n})\n"],"names":["createNanoEvents","event","args","callbacks","i","length","cb","_a"],"mappings":"AAAU,IAACA,IAAmB,OAAO;AAAA,EACnC,KAAKC,MAAUC,GAAM;AACnB,QAAIC,IAAY,KAAK,OAAOF,CAAK,KAAK,CAAE;AACxC,aAASG,IAAI,GAAGC,IAASF,EAAU,QAAQC,IAAIC,GAAQD;AACrD,MAAAD,EAAUC,CAAC,EAAE,GAAGF,CAAI;AAAA,EAEvB;AAAA,EACD,QAAQ,CAAE;AAAA,EACV,GAAGD,GAAOK,GAAI;AARN,QAAAC;AASN,YAAAA,IAAA,KAAK,OAAON,CAAK,MAAjB,QAAAM,EAAoB,KAAKD,OAAQ,KAAK,OAAOL,CAAK,IAAI,CAACK,CAAE,IAClD,MAAM;AAVP,UAAAC;AAWJ,WAAK,OAAON,CAAK,KAAIM,IAAA,KAAK,OAAON,CAAK,MAAjB,gBAAAM,EAAoB,OAAO,CAAAH,MAAKE,MAAOF;AAAA,IAC7D;AAAA,EACF;AACH;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import e from "./annotorious-react.es38.js";
|
|
2
|
+
import i from "./annotorious-react.es39.js";
|
|
3
|
+
import { unsafeStringify as d } from "./annotorious-react.es40.js";
|
|
4
|
+
function g(n, m, t) {
|
|
5
|
+
if (e.randomUUID && !m && !n)
|
|
6
|
+
return e.randomUUID();
|
|
7
|
+
n = n || {};
|
|
8
|
+
const r = n.random || (n.rng || i)();
|
|
9
|
+
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, m) {
|
|
10
|
+
t = t || 0;
|
|
11
|
+
for (let a = 0; a < 16; ++a)
|
|
12
|
+
m[t + a] = r[a];
|
|
13
|
+
return m;
|
|
14
|
+
}
|
|
15
|
+
return d(r);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
g as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=annotorious-react.es36.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es36.js","sources":["../../../node_modules/uuid/dist/esm-browser/v4.js"],"sourcesContent":["import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;"],"names":["v4","options","buf","offset","native","rnds","rng","i","unsafeStringify"],"mappings":";;;AAIA,SAASA,EAAGC,GAASC,GAAKC,GAAQ;AAChC,MAAIC,EAAO,cAAc,CAACF,KAAO,CAACD;AAChC,WAAOG,EAAO;AAGhB,EAAAH,IAAUA,KAAW;AACrB,QAAMI,IAAOJ,EAAQ,WAAWA,EAAQ,OAAOK;AAK/C,MAHAD,EAAK,CAAC,IAAIA,EAAK,CAAC,IAAI,KAAO,IAC3BA,EAAK,CAAC,IAAIA,EAAK,CAAC,IAAI,KAAO,KAEvBH,GAAK;AACP,IAAAC,IAASA,KAAU;AAEnB,aAASI,IAAI,GAAGA,IAAI,IAAI,EAAEA;AACxB,MAAAL,EAAIC,IAASI,CAAC,IAAIF,EAAKE,CAAC;AAG1B,WAAOL;AAAA,EACR;AAED,SAAOM,EAAgBH,CAAI;AAC7B;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var i = Object.prototype.hasOwnProperty;
|
|
2
|
+
function u(t, e) {
|
|
3
|
+
var n, r;
|
|
4
|
+
if (t === e)
|
|
5
|
+
return !0;
|
|
6
|
+
if (t && e && (n = t.constructor) === e.constructor) {
|
|
7
|
+
if (n === Date)
|
|
8
|
+
return t.getTime() === e.getTime();
|
|
9
|
+
if (n === RegExp)
|
|
10
|
+
return t.toString() === e.toString();
|
|
11
|
+
if (n === Array) {
|
|
12
|
+
if ((r = t.length) === e.length)
|
|
13
|
+
for (; r-- && u(t[r], e[r]); )
|
|
14
|
+
;
|
|
15
|
+
return r === -1;
|
|
16
|
+
}
|
|
17
|
+
if (!n || typeof t == "object") {
|
|
18
|
+
r = 0;
|
|
19
|
+
for (n in t)
|
|
20
|
+
if (i.call(t, n) && ++r && !i.call(e, n) || !(n in e) || !u(t[n], e[n]))
|
|
21
|
+
return !1;
|
|
22
|
+
return Object.keys(e).length === r;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return t !== t && e !== e;
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
u as dequal
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=annotorious-react.es37.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es37.js","sources":["../../../node_modules/dequal/lite/index.mjs"],"sourcesContent":["var has = Object.prototype.hasOwnProperty;\n\nexport function dequal(foo, bar) {\n\tvar ctor, len;\n\tif (foo === bar) return true;\n\n\tif (foo && bar && (ctor=foo.constructor) === bar.constructor) {\n\t\tif (ctor === Date) return foo.getTime() === bar.getTime();\n\t\tif (ctor === RegExp) return foo.toString() === bar.toString();\n\n\t\tif (ctor === Array) {\n\t\t\tif ((len=foo.length) === bar.length) {\n\t\t\t\twhile (len-- && dequal(foo[len], bar[len]));\n\t\t\t}\n\t\t\treturn len === -1;\n\t\t}\n\n\t\tif (!ctor || typeof foo === 'object') {\n\t\t\tlen = 0;\n\t\t\tfor (ctor in foo) {\n\t\t\t\tif (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;\n\t\t\t\tif (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;\n\t\t\t}\n\t\t\treturn Object.keys(bar).length === len;\n\t\t}\n\t}\n\n\treturn foo !== foo && bar !== bar;\n}\n"],"names":["has","dequal","foo","bar","ctor","len"],"mappings":"AAAA,IAAIA,IAAM,OAAO,UAAU;AAEpB,SAASC,EAAOC,GAAKC,GAAK;AAChC,MAAIC,GAAMC;AACV,MAAIH,MAAQC;AAAK,WAAO;AAExB,MAAID,KAAOC,MAAQC,IAAKF,EAAI,iBAAiBC,EAAI,aAAa;AAC7D,QAAIC,MAAS;AAAM,aAAOF,EAAI,cAAcC,EAAI;AAChD,QAAIC,MAAS;AAAQ,aAAOF,EAAI,eAAeC,EAAI;AAEnD,QAAIC,MAAS,OAAO;AACnB,WAAKC,IAAIH,EAAI,YAAYC,EAAI;AAC5B,eAAOE,OAASJ,EAAOC,EAAIG,CAAG,GAAGF,EAAIE,CAAG,CAAC;AAAE;AAE5C,aAAOA,MAAQ;AAAA,IACf;AAED,QAAI,CAACD,KAAQ,OAAOF,KAAQ,UAAU;AACrC,MAAAG,IAAM;AACN,WAAKD,KAAQF;AAEZ,YADIF,EAAI,KAAKE,GAAKE,CAAI,KAAK,EAAEC,KAAO,CAACL,EAAI,KAAKG,GAAKC,CAAI,KACnD,EAAEA,KAAQD,MAAQ,CAACF,EAAOC,EAAIE,CAAI,GAAGD,EAAIC,CAAI,CAAC;AAAG,iBAAO;AAE7D,aAAO,OAAO,KAAKD,CAAG,EAAE,WAAWE;AAAA,IACnC;AAAA,EACD;AAED,SAAOH,MAAQA,KAAOC,MAAQA;AAC/B;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es38.js","sources":["../../../node_modules/uuid/dist/esm-browser/native.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};"],"names":["randomUUID","native"],"mappings":"AAAA,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,cAAc,OAAO,WAAW,KAAK,MAAM,GACvFC,IAAA;AAAA,EACb,YAAAD;AACF;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let t;
|
|
2
|
+
const e = new Uint8Array(16);
|
|
3
|
+
function o() {
|
|
4
|
+
if (!t && (t = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !t))
|
|
5
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
6
|
+
return t(e);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
o as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=annotorious-react.es39.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es39.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}"],"names":["getRandomValues","rnds8","rng"],"mappings":"AAGA,IAAIA;AACJ,MAAMC,IAAQ,IAAI,WAAW,EAAE;AAChB,SAASC,IAAM;AAE5B,MAAI,CAACF,MAEHA,IAAkB,OAAO,SAAW,OAAe,OAAO,mBAAmB,OAAO,gBAAgB,KAAK,MAAM,GAE3G,CAACA;AACH,UAAM,IAAI,MAAM,0GAA0G;AAI9H,SAAOA,EAAgBC,CAAK;AAC9B;","x_google_ignoreList":[0]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as s } from "./annotorious-react.es22.js";
|
|
2
2
|
import { forwardRef as g } from "react";
|
|
3
|
-
import { useDraggable as i } from "./annotorious-react.
|
|
4
|
-
const
|
|
5
|
-
const { children:
|
|
6
|
-
return i(o, { onDragStart:
|
|
3
|
+
import { useDraggable as i } from "./annotorious-react.es24.js";
|
|
4
|
+
const d = g((r, o) => {
|
|
5
|
+
const { children: a, className: t, onDragStart: n, onDragEnd: e } = r;
|
|
6
|
+
return i(o, { onDragStart: n, onDragEnd: e, cancel: "button, .no-drag" }), /* @__PURE__ */ s(
|
|
7
7
|
"div",
|
|
8
8
|
{
|
|
9
9
|
ref: o,
|
|
10
|
-
className:
|
|
10
|
+
className: t,
|
|
11
11
|
style: { position: "absolute" },
|
|
12
|
-
children:
|
|
12
|
+
children: a
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
});
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
d as Draggable
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=annotorious-react.es4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es4.js","sources":["../src/AnnotoriousPopup.tsx"],"sourcesContent":["import { forwardRef, ReactNode } from 'react';\nimport { ImageAnnotation } from '@annotorious/annotorious';\nimport { useDraggable } from '@neodrag/react';\n\nexport interface AnnotoriousPopupProps {\n\n selected: { annotation: ImageAnnotation, editable?: boolean }[];\n\n}\n\nexport interface DraggableProps {\n\n children: ReactNode;\n\n className?: string;\n\n onDragStart?(): void;\n\n onDragEnd?(): void;\n\n}\n\nexport const Draggable = forwardRef((props: DraggableProps, ref: React.MutableRefObject<HTMLDivElement>) => {\n\n const { children, className, onDragStart, onDragEnd } = props;\n\n useDraggable(ref, { onDragStart, onDragEnd, cancel: 'button, .no-drag' });\n\n return (\n <div \n ref={ref} \n className={className} \n style={{ position: 'absolute' }}>\n {children}\n </div>\n )\n\n});"],"names":["Draggable","forwardRef","props","ref","children","className","onDragStart","onDragEnd","useDraggable","jsx"],"mappings":";;;AAsBO,MAAMA,IAAYC,EAAW,CAACC,GAAuBC,MAAiD;AAE3G,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,aAAAC,GAAa,WAAAC,MAAcL;AAExDM,SAAAA,EAAaL,GAAK,EAAE,aAAAG,GAAa,WAAAC,GAAW,QAAQ,oBAAoB,
|
|
1
|
+
{"version":3,"file":"annotorious-react.es4.js","sources":["../src/AnnotoriousPopup.tsx"],"sourcesContent":["import { forwardRef, ReactNode } from 'react';\nimport { ImageAnnotation } from '@annotorious/annotorious';\nimport { useDraggable } from '@neodrag/react';\n\nexport interface AnnotoriousPopupProps {\n\n selected: { annotation: ImageAnnotation, editable?: boolean }[];\n\n}\n\nexport interface DraggableProps {\n\n children: ReactNode;\n\n className?: string;\n\n onDragStart?(): void;\n\n onDragEnd?(): void;\n\n}\n\nexport const Draggable = forwardRef((props: DraggableProps, ref: React.MutableRefObject<HTMLDivElement>) => {\n\n const { children, className, onDragStart, onDragEnd } = props;\n\n useDraggable(ref, { onDragStart, onDragEnd, cancel: 'button, .no-drag' });\n\n return (\n <div \n ref={ref} \n className={className} \n style={{ position: 'absolute' }}>\n {children}\n </div>\n )\n\n});"],"names":["Draggable","forwardRef","props","ref","children","className","onDragStart","onDragEnd","useDraggable","jsx"],"mappings":";;;AAsBO,MAAMA,IAAYC,EAAW,CAACC,GAAuBC,MAAiD;AAE3G,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,aAAAC,GAAa,WAAAC,MAAcL;AAExDM,SAAAA,EAAaL,GAAK,EAAE,aAAAG,GAAa,WAAAC,GAAW,QAAQ,oBAAoB,GAGtE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAN;AAAA,MACA,WAAAE;AAAA,MACA,OAAO,EAAE,UAAU,WAAW;AAAA,MAC7B,UAAAD;AAAA,IAAA;AAAA,EAAA;AAIP,CAAC;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const i = [];
|
|
2
|
+
for (let n = 0; n < 256; ++n)
|
|
3
|
+
i.push((n + 256).toString(16).slice(1));
|
|
4
|
+
function c(n, u = 0) {
|
|
5
|
+
return i[n[u + 0]] + i[n[u + 1]] + i[n[u + 2]] + i[n[u + 3]] + "-" + i[n[u + 4]] + i[n[u + 5]] + "-" + i[n[u + 6]] + i[n[u + 7]] + "-" + i[n[u + 8]] + i[n[u + 9]] + "-" + i[n[u + 10]] + i[n[u + 11]] + i[n[u + 12]] + i[n[u + 13]] + i[n[u + 14]] + i[n[u + 15]];
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
c as unsafeStringify
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=annotorious-react.es40.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotorious-react.es40.js","sources":["../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;"],"names":["byteToHex","i","unsafeStringify","arr","offset"],"mappings":"AAMA,MAAMA,IAAY,CAAA;AAElB,SAASC,IAAI,GAAGA,IAAI,KAAK,EAAEA;AACzB,EAAAD,EAAU,MAAMC,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAG3C,SAASC,EAAgBC,GAAKC,IAAS,GAAG;AAG/C,SAAOJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAI,MAAMJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAI,MAAMJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAI,MAAMJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAAI,MAAMJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAAIJ,EAAUG,EAAIC,IAAS,EAAE,CAAC;AACnf;","x_google_ignoreList":[0]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Children as
|
|
3
|
-
import { createImageAnnotator as u } from "./annotorious-react.
|
|
4
|
-
import { AnnotoriousContext as
|
|
5
|
-
const
|
|
6
|
-
const { children:
|
|
1
|
+
import { jsx as a, Fragment as g } from "./annotorious-react.es22.js";
|
|
2
|
+
import { Children as d, useContext as x, useEffect as e, cloneElement as h } from "react";
|
|
3
|
+
import { createImageAnnotator as u } from "./annotorious-react.es18.js";
|
|
4
|
+
import { AnnotoriousContext as y } from "./annotorious-react.es2.js";
|
|
5
|
+
const j = (t) => {
|
|
6
|
+
const { children: n, tool: A, ...i } = t, l = d.only(n), { anno: o, setAnno: r } = x(y), c = (m) => {
|
|
7
7
|
if (!o) {
|
|
8
|
-
const
|
|
9
|
-
s
|
|
8
|
+
const f = m.target, s = u(f, i);
|
|
9
|
+
r(s);
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
12
|
return e(() => {
|
|
@@ -15,9 +15,9 @@ const D = (t) => {
|
|
|
15
15
|
o && o.setFilter(t.filter);
|
|
16
16
|
}, [t.filter]), e(() => {
|
|
17
17
|
o && o.setStyle(t.style);
|
|
18
|
-
}, [t.style]), /* @__PURE__ */
|
|
18
|
+
}, [t.style]), /* @__PURE__ */ a(g, { children: h(l, { onLoad: c }) });
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
j as ImageAnnotator
|
|
22
22
|
};
|
|
23
23
|
//# 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;AACV,IAAAT,KAAWA,EAAA,UAAUN,EAAM,MAAM;AAAA,EAAA,GACpC,CAACA,EAAM,MAAM,CAAC,GAEjBe,EAAU,MAAM;AACV,IAAAT,KAAWA,EAAA,SAASN,EAAM,KAAK;AAAA,EAAA,GAClC,CAACA,EAAM,KAAK,CAAC,
|
|
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;AACV,IAAAT,KAAWA,EAAA,UAAUN,EAAM,MAAM;AAAA,EAAA,GACpC,CAACA,EAAM,MAAM,CAAC,GAEjBe,EAAU,MAAM;AACV,IAAAT,KAAWA,EAAA,SAASN,EAAM,KAAK;AAAA,EAAA,GAClC,CAACA,EAAM,KAAK,CAAC,0BAEN,UAAagB,EAAAZ,GAAO,EAAE,QAAAM,GAAsC,EAAE,CAAA;AAE1E;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"annotorious-react.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es7.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"annotorious-react.es7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,91 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const p =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let D = (t) => crypto.getRandomValues(new Uint8Array(t)), C = (t, r, e) => {
|
|
41
|
-
let n = (2 << Math.log(t.length - 1) / Math.LN2) - 1, a = -~(1.6 * n * r / t.length);
|
|
42
|
-
return (l = r) => {
|
|
43
|
-
let s = "";
|
|
44
|
-
for (; ; ) {
|
|
45
|
-
let d = e(a), u = a;
|
|
46
|
-
for (; u--; )
|
|
47
|
-
if (s += t[d[u] & n] || "", s.length === l)
|
|
48
|
-
return s;
|
|
1
|
+
import { Origin as l } from "./annotorious-react.es17.js";
|
|
2
|
+
import { parseAll as v } from "./annotorious-react.es9.js";
|
|
3
|
+
const p = (d, i, t) => {
|
|
4
|
+
const { store: o, selection: c } = d, a = (e) => {
|
|
5
|
+
if (t) {
|
|
6
|
+
const { parsed: n, error: s } = t.parse(e);
|
|
7
|
+
n ? o.addAnnotation(n, l.REMOTE) : console.error(s);
|
|
8
|
+
} else
|
|
9
|
+
o.addAnnotation(e, l.REMOTE);
|
|
10
|
+
}, u = () => c.clear(), f = () => o.clear(), m = (e) => {
|
|
11
|
+
const n = o.getAnnotation(e);
|
|
12
|
+
return t && n ? t.serialize(n) : n;
|
|
13
|
+
}, E = () => t ? o.all().map(t.serialize) : o.all(), g = () => {
|
|
14
|
+
var s;
|
|
15
|
+
const n = (((s = c.selected) == null ? void 0 : s.map((r) => r.id)) || []).map((r) => o.getAnnotation(r));
|
|
16
|
+
return t ? n.map(t.serialize) : n;
|
|
17
|
+
}, R = (e) => fetch(e).then((n) => n.json()).then((n) => (A(n), n)), h = (e) => {
|
|
18
|
+
if (typeof e == "string") {
|
|
19
|
+
const n = o.getAnnotation(e);
|
|
20
|
+
return o.deleteAnnotation(e), t ? t.serialize(n) : n;
|
|
21
|
+
} else {
|
|
22
|
+
const n = t ? t.parse(e).parsed : e;
|
|
23
|
+
return o.deleteAnnotation(n), e;
|
|
24
|
+
}
|
|
25
|
+
}, A = (e) => {
|
|
26
|
+
if (t) {
|
|
27
|
+
const { parsed: n, failed: s } = v(t)(e);
|
|
28
|
+
s.length > 0 && console.warn(`Discarded ${s.length} invalid annotations`, s), o.bulkAddAnnotation(n, !0, l.REMOTE);
|
|
29
|
+
} else
|
|
30
|
+
o.bulkAddAnnotation(e, !0, l.REMOTE);
|
|
31
|
+
}, z = (e) => {
|
|
32
|
+
e ? c.setSelected(e) : c.clear();
|
|
33
|
+
}, O = (e) => {
|
|
34
|
+
if (t) {
|
|
35
|
+
const n = t.parse(e).parsed, s = t.serialize(o.getAnnotation(n.id));
|
|
36
|
+
return o.updateAnnotation(n), s;
|
|
37
|
+
} else {
|
|
38
|
+
const n = o.getAnnotation(e.id);
|
|
39
|
+
return o.updateAnnotation(e), n;
|
|
49
40
|
}
|
|
50
41
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"#f14cc1",
|
|
69
|
-
// pink
|
|
70
|
-
"#ffc400",
|
|
71
|
-
// khaki
|
|
72
|
-
"#00d7ff",
|
|
73
|
-
// cyan
|
|
74
|
-
"#023eff"
|
|
75
|
-
// blue
|
|
76
|
-
], L = () => {
|
|
77
|
-
const t = [...w];
|
|
78
|
-
return { assignRandomColor: () => {
|
|
79
|
-
const r = Math.floor(Math.random() * t.length), e = t[r];
|
|
80
|
-
return t.splice(r, 1), e;
|
|
81
|
-
}, releaseColor: (r) => t.push(r) };
|
|
42
|
+
return {
|
|
43
|
+
addAnnotation: a,
|
|
44
|
+
cancelSelected: u,
|
|
45
|
+
canRedo: i.canRedo,
|
|
46
|
+
canUndo: i.canUndo,
|
|
47
|
+
clearAnnotations: f,
|
|
48
|
+
getAnnotationById: m,
|
|
49
|
+
getAnnotations: E,
|
|
50
|
+
getSelected: g,
|
|
51
|
+
loadAnnotations: R,
|
|
52
|
+
redo: i.redo,
|
|
53
|
+
removeAnnotation: h,
|
|
54
|
+
setAnnotations: A,
|
|
55
|
+
setSelected: z,
|
|
56
|
+
undo: i.undo,
|
|
57
|
+
updateAnnotation: O
|
|
58
|
+
};
|
|
82
59
|
};
|
|
83
|
-
R();
|
|
84
60
|
export {
|
|
85
|
-
|
|
86
|
-
f as PointerSelectAction,
|
|
87
|
-
I as createAnonymousGuest,
|
|
88
|
-
A as createBody,
|
|
89
|
-
L as defaultColorProvider
|
|
61
|
+
p as createBaseAnnotator
|
|
90
62
|
};
|
|
91
63
|
//# sourceMappingURL=annotorious-react.es8.js.map
|