@annotorious/react 3.4.7 → 3.5.1
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 +3 -3
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/annotorious-react.css +1 -1
- package/dist/annotorious-react.es.js +26 -25
- package/dist/annotorious-react.es10.js.map +1 -1
- package/dist/annotorious-react.es11.js.map +1 -1
- package/dist/annotorious-react.es12.js.map +1 -1
- package/dist/annotorious-react.es13.js.map +1 -1
- package/dist/annotorious-react.es14.js.map +1 -1
- package/dist/annotorious-react.es15.js +41 -40
- package/dist/annotorious-react.es15.js.map +1 -1
- package/dist/annotorious-react.es16.js.map +1 -1
- package/dist/annotorious-react.es17.js.map +1 -1
- package/dist/annotorious-react.es18.js.map +1 -1
- package/dist/annotorious-react.es19.js +88 -83
- package/dist/annotorious-react.es19.js.map +1 -1
- package/dist/annotorious-react.es2.js +70 -71
- package/dist/annotorious-react.es2.js.map +1 -1
- package/dist/annotorious-react.es20.js.map +1 -1
- package/dist/annotorious-react.es21.js.map +1 -1
- package/dist/annotorious-react.es23.js +67 -66
- package/dist/annotorious-react.es23.js.map +1 -1
- package/dist/annotorious-react.es24.js +46 -46
- package/dist/annotorious-react.es24.js.map +1 -1
- package/dist/annotorious-react.es3.js.map +1 -1
- package/dist/annotorious-react.es4.js.map +1 -1
- package/dist/annotorious-react.es5.js.map +1 -1
- package/dist/annotorious-react.es8.js.map +1 -1
- package/dist/annotorious-react.es9.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/state/AnnotoriousZustand.d.ts +3 -3
- package/dist/state/AnnotoriousZustand.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es2.js","sources":["../src/Annotorious.tsx"],"sourcesContent":["import { onUserSelect } from '@annotorious/core';\nimport type { StoreObserveOptions, UserSelectActionExpression} from '@annotorious/core';\nimport { useDebounce } from './useDebounce';\nimport { \n createContext, \n forwardRef, \n type ReactNode, \n useContext, \n useEffect, \n useImperativeHandle, \n useState \n} from 'react';\nimport type {\n Annotation,\n Annotator,\n Selection as CoreSelection,\n ImageAnnotation,\n Store,\n StoreChangeEvent,\n User\n} from '@annotorious/annotorious';\n\ninterface Selection<T extends Annotation = Annotation> extends Omit<CoreSelection, 'selected'> {\n\n selected: { annotation: T, editable?: boolean }[];\n\n}\n\nexport const AnnotoriousContext = createContext({ \n\n anno: undefined, \n\n setAnno: undefined, \n\n annotations: [], \n\n selection: { selected: [] }\n\n});\n\nexport const Annotorious = forwardRef<Annotator, { children: ReactNode }>((props: { children: ReactNode }, ref) => {\n\n const [anno, setAnno] = useState<Annotator>(null);\n\n const [annotations, setAnnotations] = useState<Annotation[]>([]);\n\n const [selection, setSelection] = useState<Selection>({ selected: [] });\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store, hover } = anno.state;\n\n // Components below <Annotorious /> may have\n // loaded annotations into the store already! \n if (store.all().length > 0)\n setAnnotations(store.all());\n\n // Keeps annotations in sync with a React state,\n // so clients can render components the usual React way.\n const onStoreChange = () => setAnnotations(() => store.all());\n\n store.observe(onStoreChange);\n\n // Keep selection in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let selectionStoreObserver: (event: StoreChangeEvent<Annotation>) => void;\n\n const unsubscribeSelection = selection.subscribe(({ selected, ...rest }) => {\n if (selectionStoreObserver) \n store.unobserve(selectionStoreObserver);\n\n const resolved = (selected || [])\n .map(({ id, editable }) => ({ annotation: store.getAnnotation(id), editable }));\n\n setSelection({ selected: resolved, ...rest });\n\n selectionStoreObserver = event => {\n const { updated } = event.changes;\n\n setSelection((selection) => ({\n ...selection,\n selected: selection.selected.map(({ annotation, editable }) => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? { annotation: next.newValue, editable } : { annotation, editable };\n })\n }));\n }\n\n store.observe(selectionStoreObserver, { annotations: selected.map(({ id }) => id) });\n });\n\n return () => {\n store.unobserve(onStoreChange);\n unsubscribeSelection();\n }\n }\n }, [anno]);\n\n return (\n <AnnotoriousContext.Provider value={{ \n anno, \n setAnno,\n annotations, \n selection \n }}>\n {props.children}\n </AnnotoriousContext.Provider>\n )\n\n});\n\nexport const useAnnotator = <T extends unknown = Annotator<any, unknown>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno as T;\n}\n\nexport const useAnnotationStore = <T extends unknown = Store<Annotation>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno?.state.store as T | undefined;\n}\n\nconst _useAnnotations = <T extends Annotation>() => {\n const { annotations } = useContext(AnnotoriousContext);\n return annotations as T[];\n}\n\nconst _useAnnotationsDebounced = <T extends Annotation>(debounce: number) => {\n const { annotations } = useContext(AnnotoriousContext);\n return useDebounce(annotations, debounce) as T[];\n}\n\nexport const useAnnotations = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useAnnotationsDebounced<T>(debounce) : _useAnnotations<T>();\n\nexport const useAnnotation = <T extends Annotation = ImageAnnotation>(\n id: string, \n options?: Omit<StoreObserveOptions, 'annotations'>\n) => {\n const store = useAnnotationStore<Store<T>>();\n\n const [annotation, setAnnotation] = useState<T | undefined>(\n store?.getAnnotation(id)\n );\n\n useEffect(() => {\n if (!store) return;\n\n const handleChange = (event: StoreChangeEvent<T>) => {\n const updated = event.changes.updated[0];\n if (updated) {\n setAnnotation(updated.newValue);\n }\n };\n\n store.observe(handleChange, { ...options, annotations: id });\n return () => store.unobserve(handleChange);\n }, []);\n\n return annotation;\n}\n\nexport const useAnnotationSelectAction = <I extends Annotation = ImageAnnotation, E extends unknown = ImageAnnotation>(id: string, action: UserSelectActionExpression<E>) => {\n const annotation = useAnnotation<I>(id);\n return annotation ? onUserSelect<I, E>(annotation, action) : undefined;\n}\n\nexport const useSelection = <T extends Annotation = ImageAnnotation>() => {\n const { selection } = useContext(AnnotoriousContext);\n return selection as Selection<T>;\n}\n\nexport const useHover = <T extends Annotation = ImageAnnotation>() => {\n const { anno } = useContext(AnnotoriousContext);\n\n const [hover, setHover] = useState<T | undefined>();\n\n useEffect(() => {\n if (!anno) return;\n\n const { hover, store } = (anno as Annotator<T, unknown>).state;\n\n const unsubscribeHover = hover.subscribe(id => {\n if (id) {\n const annotation = store.getAnnotation(id);\n setHover(annotation);\n } else {\n setHover(undefined);\n }\n });\n \n return () => {\n unsubscribeHover();\n }\n }, [anno]);\n\n return hover;\n}\n\nexport const useAnnotatorUser = (): User => {\n const { anno } = useContext(AnnotoriousContext);\n return anno?.getUser();\n}\n\nconst _useViewportState = <T extends Annotation>() => {\n const { anno } = useContext(AnnotoriousContext);\n\n const [inViewport, setInViewport] = useState<T[]>([]);\n\n useEffect(() => {\n if (anno) {\n const { store, viewport } = anno.state;\n\n if (!viewport)\n return;\n\n // Keep viewport annotations in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let viewportStoreObserver: (event: StoreChangeEvent<T>) => void;\n\n const unsubscribeViewport = viewport.subscribe(ids => {\n if (viewportStoreObserver) \n store.unobserve(viewportStoreObserver);\n\n const resolved = ids.map(id => store.getAnnotation(id)) as T[];\n setInViewport(resolved);\n\n viewportStoreObserver = event => {\n const { updated } = event.changes;\n\n setInViewport(annotations => annotations.map(annotation => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? next.newValue : annotation;\n }));\n }\n\n store.observe(viewportStoreObserver, { annotations: ids });\n });\n\n return () => {\n unsubscribeViewport();\n }\n }\n }, [anno]);\n\n return inViewport;\n}\n\nconst _useViewportStateDebounced = <T extends Annotation>(debounce: number) => {\n const inViewport = _useViewportState();\n return useDebounce(inViewport, debounce) as T[];\n}\n\nexport const useViewportState = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useViewportStateDebounced<T>(debounce) : _useViewportState<T>();\n"],"names":["AnnotoriousContext","createContext","Annotorious","forwardRef","props","ref","anno","setAnno","useState","annotations","setAnnotations","selection","setSelection","useImperativeHandle","useEffect","store","hover","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","rest","resolved","id","editable","event","updated","annotation","next","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useAnnotation","options","setAnnotation","handleChange","useAnnotationSelectAction","action","onUserSelect","useSelection","useHover","setHover","unsubscribeHover","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;;AA4BO,MAAMA,IAAqBC,EAAc;AAAA,EAE9C,MAAM;AAAA,EAEN,SAAS;AAAA,EAET,aAAa,CAAC;AAAA,EAEd,WAAW,EAAE,UAAU,CAAG,EAAA;AAE5B,CAAC,GAEYC,IAAcC,EAA+C,CAACC,GAAgCC,MAAQ;AAEjH,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAoB,IAAI,GAE1C,CAACC,GAAaC,CAAc,IAAIF,EAAuB,CAAA,CAAE,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAA,GAAI;AAElD,SAAAK,EAAAR,GAAK,MAAMC,CAAI,GAEnCQ,EAAU,MAAM;AACd,QAAIR,GAAM;AACR,YAAM,EAAE,WAAAK,GAAW,OAAAI,GAAO,OAAAC,EAAA,IAAUV,EAAK;AAIrC,MAAAS,EAAM,MAAM,SAAS,KACRL,EAAAK,EAAM,KAAK;AAI5B,YAAME,IAAgB,MAAMP,EAAe,MAAMK,EAAM,KAAK;AAE5D,MAAAA,EAAM,QAAQE,CAAa;AAIvB,UAAAC;AAEE,YAAAC,IAAuBR,EAAU,UAAU,CAAC,EAAE,UAAAS,GAAU,GAAGC,QAAW;AACtE,QAAAH,KACFH,EAAM,UAAUG,CAAsB;AAExC,cAAMI,KAAYF,KAAY,CAC3B,GAAA,IAAI,CAAC,EAAE,IAAAG,GAAI,UAAAC,EAAS,OAAO,EAAE,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CAAC,GAEF8C;AACT,GAEMM,IAA8B,CAAuBtB,MAAqB;AAC9E,QAAMgB,IAAaD,EAAkB;AAC9B,SAAAd,EAAYe,GAAYhB,CAAQ;AACzC,GAEauB,IAAoB,CAAyCvB,MACxEA,IAAWsB,EAA8BtB,CAAQ,IAAIe,EAAqB;"}
|
|
1
|
+
{"version":3,"file":"annotorious-react.es2.js","sources":["../src/Annotorious.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { \n createContext, \n forwardRef,\n useContext, \n useEffect, \n useImperativeHandle, \n useState \n} from 'react';\nimport type { StoreObserveOptions } from '@annotorious/core';\nimport type {\n Annotation,\n Annotator,\n ImageAnnotation,\n Selection as CoreSelection,\n Store,\n StoreChangeEvent,\n User\n} from '@annotorious/annotorious';\nimport { useDebounce } from './useDebounce';\n\ninterface Selection<T extends Annotation = Annotation> extends Omit<CoreSelection, 'selected'> {\n\n selected: { annotation: T, editable?: boolean }[];\n\n}\n\nexport const AnnotoriousContext = createContext({\n\n anno: undefined,\n\n setAnno: undefined,\n\n annotations: [],\n\n selection: { selected: [] }\n\n});\n\nexport const Annotorious = forwardRef<Annotator, { children: ReactNode }>((props: { children: ReactNode }, ref) => {\n\n const [anno, setAnno] = useState<Annotator>(null);\n\n const [annotations, setAnnotations] = useState<Annotation[]>([]);\n\n const [selection, setSelection] = useState<Selection>({ selected: [] });\n\n useImperativeHandle(ref, () => anno);\n\n useEffect(() => {\n if (anno) {\n const { selection, store, hover } = anno.state;\n\n // Components below <Annotorious /> may have\n // loaded annotations into the store already! \n if (store.all().length > 0)\n setAnnotations(store.all());\n\n // Keeps annotations in sync with a React state,\n // so clients can render components the usual React way.\n const onStoreChange = () => setAnnotations(() => store.all());\n\n store.observe(onStoreChange);\n\n // Keep selection in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let selectionStoreObserver: (event: StoreChangeEvent<Annotation>) => void;\n\n const unsubscribeSelection = selection.subscribe(({ selected, ...rest }) => {\n if (selectionStoreObserver)\n store.unobserve(selectionStoreObserver);\n\n const resolved = (selected || [])\n .map(({ id, editable }) => ({ annotation: store.getAnnotation(id), editable }));\n\n setSelection({ selected: resolved, ...rest });\n\n selectionStoreObserver = event => {\n const { updated } = event.changes;\n\n setSelection((selection) => ({\n ...selection,\n selected: selection.selected.map(({ annotation, editable }) => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? { annotation: next.newValue, editable } : { annotation, editable };\n })\n }));\n }\n\n store.observe(selectionStoreObserver, { annotations: selected.map(({ id }) => id) });\n });\n\n return () => {\n store.unobserve(onStoreChange);\n unsubscribeSelection();\n }\n }\n }, [anno]);\n\n return (\n <AnnotoriousContext.Provider value={{\n anno,\n setAnno,\n annotations,\n selection\n }}>\n {props.children}\n </AnnotoriousContext.Provider>\n )\n\n});\n\nexport const useAnnotator = <T extends unknown = Annotator<any, unknown>>() => {\n const { anno } = useContext(AnnotoriousContext);\n return anno as T;\n}\n\nexport const useAnnotationStore = <T extends unknown = Store<Annotation>>() => {\n const anno = useAnnotator();\n return anno?.state.store as T | undefined;\n}\n\nconst _useAnnotations = <T extends Annotation>() => {\n const { annotations } = useContext(AnnotoriousContext);\n return annotations as T[];\n}\n\nconst _useAnnotationsDebounced = <T extends Annotation>(debounce: number) => {\n const { annotations } = useContext(AnnotoriousContext);\n return useDebounce(annotations, debounce) as T[];\n}\n\nexport const useAnnotations = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useAnnotationsDebounced<T>(debounce) : _useAnnotations<T>();\n\nexport const useAnnotation = <T extends Annotation = ImageAnnotation>(\n id: string,\n options?: Omit<StoreObserveOptions, 'annotations'>\n) => {\n const store = useAnnotationStore<Store<T>>();\n\n const [annotation, setAnnotation] = useState<T | undefined>(\n store?.getAnnotation(id)\n );\n\n useEffect(() => {\n if (!store) return;\n\n const handleChange = (event: StoreChangeEvent<T>) => {\n const updated = event.changes.updated[0];\n if (updated) {\n setAnnotation(updated.newValue);\n }\n };\n\n store.observe(handleChange, { ...options, annotations: id });\n return () => store.unobserve(handleChange);\n }, []);\n\n return annotation;\n}\n\nexport const useAnnotationSelectAction = <I extends Annotation = ImageAnnotation>(\n id: string\n) => {\n const anno = useAnnotator();\n const annotation = useAnnotation<I>(id);\n return anno && annotation ? anno.state.selection.evalSelectAction(annotation) : undefined;\n}\n\nexport const useSelection = <T extends Annotation = ImageAnnotation>() => {\n const { selection } = useContext(AnnotoriousContext);\n return selection as Selection<T>;\n}\n\nexport const useHover = <T extends Annotation = ImageAnnotation>() => {\n const anno = useAnnotator();\n\n const [hover, setHover] = useState<T | undefined>();\n\n useEffect(() => {\n if (!anno) return;\n\n const { hover, store } = (anno as Annotator<T, unknown>).state;\n\n const unsubscribeHover = hover.subscribe(id => {\n if (id) {\n const annotation = store.getAnnotation(id);\n setHover(annotation);\n } else {\n setHover(undefined);\n }\n });\n\n return () => {\n unsubscribeHover();\n };\n }, [anno]);\n\n return hover;\n}\n\nexport const useAnnotatorUser = (): User => {\n const anno = useAnnotator();\n return anno?.getUser();\n}\n\nconst _useViewportState = <T extends Annotation>() => {\n const anno = useAnnotator();\n\n const [inViewport, setInViewport] = useState<T[]>([]);\n\n useEffect(() => {\n if (anno) {\n const { store, viewport } = anno.state;\n\n if (!viewport)\n return;\n\n // Keep viewport annotations in sync with a react state, and resolve them\n // from IDs to annotations automatically, for convenience\n let viewportStoreObserver: (event: StoreChangeEvent<T>) => void;\n\n const unsubscribeViewport = viewport.subscribe(ids => {\n if (viewportStoreObserver)\n store.unobserve(viewportStoreObserver);\n\n const resolved = ids.map(id => store.getAnnotation(id)) as T[];\n setInViewport(resolved);\n\n viewportStoreObserver = event => {\n const { updated } = event.changes;\n\n setInViewport(annotations => annotations.map(annotation => {\n const next = updated.find(u => u.oldValue.id === annotation.id);\n return next ? next.newValue : annotation;\n }));\n };\n\n store.observe(viewportStoreObserver, { annotations: ids });\n });\n\n return () => {\n unsubscribeViewport();\n };\n }\n }, [anno]);\n\n return inViewport;\n}\n\nconst _useViewportStateDebounced = <T extends Annotation>(debounce: number) => {\n const inViewport = _useViewportState();\n return useDebounce(inViewport, debounce) as T[];\n}\n\nexport const useViewportState = <T extends Annotation = ImageAnnotation>(debounce?: number) =>\n debounce ? _useViewportStateDebounced<T>(debounce) : _useViewportState<T>();\n"],"names":["AnnotoriousContext","createContext","Annotorious","forwardRef","props","ref","anno","setAnno","useState","annotations","setAnnotations","selection","setSelection","useImperativeHandle","useEffect","store","hover","onStoreChange","selectionStoreObserver","unsubscribeSelection","selected","rest","resolved","id","editable","event","updated","annotation","next","u","jsx","useAnnotator","useContext","useAnnotationStore","_useAnnotations","_useAnnotationsDebounced","debounce","useDebounce","useAnnotations","useAnnotation","options","setAnnotation","handleChange","useAnnotationSelectAction","useSelection","useHover","setHover","unsubscribeHover","useAnnotatorUser","_useViewportState","inViewport","setInViewport","viewport","viewportStoreObserver","unsubscribeViewport","ids","_useViewportStateDebounced","useViewportState"],"mappings":";;;AA2BO,MAAMA,IAAqBC,EAAc;AAAA,EAE9C,MAAM;AAAA,EAEN,SAAS;AAAA,EAET,aAAa,CAAA;AAAA,EAEb,WAAW,EAAE,UAAU,CAAA,EAAC;AAE1B,CAAC,GAEYC,IAAcC,EAA+C,CAACC,GAAgCC,MAAQ;AAEjH,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAoB,IAAI,GAE1C,CAACC,GAAaC,CAAc,IAAIF,EAAuB,CAAA,CAAE,GAEzD,CAACG,GAAWC,CAAY,IAAIJ,EAAoB,EAAE,UAAU,CAAA,GAAI;AAEtE,SAAAK,EAAoBR,GAAK,MAAMC,CAAI,GAEnCQ,EAAU,MAAM;AACd,QAAIR,GAAM;AACR,YAAM,EAAE,WAAAK,GAAW,OAAAI,GAAO,OAAAC,EAAA,IAAUV,EAAK;AAIzC,MAAIS,EAAM,MAAM,SAAS,KACvBL,EAAeK,EAAM,KAAK;AAI5B,YAAME,IAAgB,MAAMP,EAAe,MAAMK,EAAM,KAAK;AAE5D,MAAAA,EAAM,QAAQE,C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AGJZ,EAAM,QAAQsC,GAAuB,EAAE,aAAaE,GAAK;AAAA,MAAA,CAC1D;AAED,aAAO,MAAM;AACX,QAAAD,EAAA;AAAA,MAAoB;AAAA,IACtB;AAAA,EACF,GACC,CAAChD,CAAI,CAAC,GAEF4C;AACT,GAEMM,IAA6B,CAAuBpB,MAAqB;AAC7E,QAAMc,IAAaD,EAAA;AACnB,SAAOZ,EAAYa,GAAYd,CAAQ;AACzC,GAEaqB,IAAmB,CAAyCrB,MACvEA,IAAWoB,EAA8BpB,CAAQ,IAAIa,EAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es20.js","sources":["../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n"],"names":["byteToHex","i","unsafeStringify","arr","offset"],"mappings":"AACA,MAAMA,IAAY,
|
|
1
|
+
{"version":3,"file":"annotorious-react.es20.js","sources":["../../../node_modules/uuid/dist/esm-browser/stringify.js"],"sourcesContent":["import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n"],"names":["byteToHex","i","unsafeStringify","arr","offset"],"mappings":"AACA,MAAMA,IAAY,CAAA;AAClB,SAASC,IAAI,GAAGA,IAAI,KAAK,EAAEA;AACvB,EAAAD,EAAU,MAAMC,IAAI,KAAO,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC;AAE7C,SAASC,EAAgBC,GAAKC,IAAS,GAAG;AAC7C,UAAQJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IAC7BJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzBJ,EAAUG,EAAIC,IAAS,CAAC,CAAC,IACzB,MACAJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,IAC1BJ,EAAUG,EAAIC,IAAS,EAAE,CAAC,GAAG,YAAW;AAChD;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es21.js","sources":["../../../node_modules/uuid/dist/esm-browser/native.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n"],"names":["randomUUID","native"],"mappings":"AAAA,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,cAAc,OAAO,WAAW,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"annotorious-react.es21.js","sources":["../../../node_modules/uuid/dist/esm-browser/native.js"],"sourcesContent":["const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n"],"names":["randomUUID","native"],"mappings":"AAAA,MAAMA,IAAa,OAAO,SAAW,OAAe,OAAO,cAAc,OAAO,WAAW,KAAK,MAAM,GACtGC,IAAe,EAAE,YAAAD,EAAU;","x_google_ignoreList":[0]}
|
|
@@ -1,74 +1,75 @@
|
|
|
1
|
-
const
|
|
1
|
+
const m = Math.min, p = Math.max, j = Math.round, C = Math.floor, L = (t) => ({
|
|
2
2
|
x: t,
|
|
3
3
|
y: t
|
|
4
|
-
}),
|
|
4
|
+
}), h = {
|
|
5
5
|
left: "right",
|
|
6
6
|
right: "left",
|
|
7
7
|
bottom: "top",
|
|
8
8
|
top: "bottom"
|
|
9
|
-
},
|
|
9
|
+
}, x = {
|
|
10
10
|
start: "end",
|
|
11
11
|
end: "start"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
return
|
|
13
|
+
function E(t, e, n) {
|
|
14
|
+
return p(t, m(e, n));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return typeof t == "function" ? t(
|
|
16
|
+
function R(t, e) {
|
|
17
|
+
return typeof t == "function" ? t(e) : t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function a(t) {
|
|
20
20
|
return t.split("-")[0];
|
|
21
21
|
}
|
|
22
22
|
function g(t) {
|
|
23
23
|
return t.split("-")[1];
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function b(t) {
|
|
26
26
|
return t === "x" ? "y" : "x";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function d(t) {
|
|
29
29
|
return t === "y" ? "height" : "width";
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const A = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
32
|
+
function P(t) {
|
|
33
|
+
return A.has(a(t)) ? "y" : "x";
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
35
|
+
function y(t) {
|
|
36
|
+
return b(P(t));
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
const r = g(t),
|
|
40
|
-
let c =
|
|
41
|
-
return
|
|
38
|
+
function T(t, e, n) {
|
|
39
|
+
n === void 0 && (n = !1);
|
|
40
|
+
const r = g(t), i = y(t), o = d(i);
|
|
41
|
+
let c = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
42
|
+
return e.reference[o] > e.floating[o] && (c = f(c)), [c, f(c)];
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
return [s(t),
|
|
44
|
+
function k(t) {
|
|
45
|
+
const e = f(t);
|
|
46
|
+
return [s(t), e, s(e)];
|
|
46
47
|
}
|
|
47
48
|
function s(t) {
|
|
48
|
-
return t.replace(/start|end/g, (
|
|
49
|
+
return t.replace(/start|end/g, (e) => x[e]);
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const u = ["left", "right"], l = ["right", "left"], M = ["top", "bottom"], O = ["bottom", "top"];
|
|
52
|
+
function S(t, e, n) {
|
|
52
53
|
switch (t) {
|
|
53
54
|
case "top":
|
|
54
55
|
case "bottom":
|
|
55
|
-
return
|
|
56
|
+
return n ? e ? l : u : e ? u : l;
|
|
56
57
|
case "left":
|
|
57
58
|
case "right":
|
|
58
|
-
return
|
|
59
|
+
return e ? M : O;
|
|
59
60
|
default:
|
|
60
61
|
return [];
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
const
|
|
65
|
-
let
|
|
66
|
-
return
|
|
64
|
+
function q(t, e, n, r) {
|
|
65
|
+
const i = g(t);
|
|
66
|
+
let o = S(a(t), n === "start", r);
|
|
67
|
+
return i && (o = o.map((c) => c + "-" + i), e && (o = o.concat(o.map(s)))), o;
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
-
return t.replace(/left|right|bottom|top/g, (
|
|
69
|
+
function f(t) {
|
|
70
|
+
return t.replace(/left|right|bottom|top/g, (e) => h[e]);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function w(t) {
|
|
72
73
|
return {
|
|
73
74
|
top: 0,
|
|
74
75
|
right: 0,
|
|
@@ -77,53 +78,53 @@ function y(t) {
|
|
|
77
78
|
...t
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
|
-
function
|
|
81
|
-
return typeof t != "number" ?
|
|
81
|
+
function z(t) {
|
|
82
|
+
return typeof t != "number" ? w(t) : {
|
|
82
83
|
top: t,
|
|
83
84
|
right: t,
|
|
84
85
|
bottom: t,
|
|
85
86
|
left: t
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
+
function B(t) {
|
|
89
90
|
const {
|
|
90
|
-
x:
|
|
91
|
-
y:
|
|
91
|
+
x: e,
|
|
92
|
+
y: n,
|
|
92
93
|
width: r,
|
|
93
|
-
height:
|
|
94
|
+
height: i
|
|
94
95
|
} = t;
|
|
95
96
|
return {
|
|
96
97
|
width: r,
|
|
97
|
-
height:
|
|
98
|
-
top:
|
|
99
|
-
left:
|
|
100
|
-
right:
|
|
101
|
-
bottom:
|
|
102
|
-
x:
|
|
103
|
-
y:
|
|
98
|
+
height: i,
|
|
99
|
+
top: n,
|
|
100
|
+
left: e,
|
|
101
|
+
right: e + r,
|
|
102
|
+
bottom: n + i,
|
|
103
|
+
x: e,
|
|
104
|
+
y: n
|
|
104
105
|
};
|
|
105
106
|
}
|
|
106
107
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
E as clamp,
|
|
109
|
+
L as createCoords,
|
|
110
|
+
R as evaluate,
|
|
111
|
+
w as expandPaddingObject,
|
|
112
|
+
C as floor,
|
|
112
113
|
g as getAlignment,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
y as getAlignmentAxis,
|
|
115
|
+
T as getAlignmentSides,
|
|
116
|
+
d as getAxisLength,
|
|
117
|
+
k as getExpandedPlacements,
|
|
117
118
|
s as getOppositeAlignmentPlacement,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
b as getOppositeAxis,
|
|
120
|
+
q as getOppositeAxisPlacements,
|
|
121
|
+
f as getOppositePlacement,
|
|
122
|
+
z as getPaddingObject,
|
|
123
|
+
a as getSide,
|
|
124
|
+
P as getSideAxis,
|
|
125
|
+
p as max,
|
|
126
|
+
m as min,
|
|
127
|
+
B as rectToClientRect,
|
|
128
|
+
j as round
|
|
128
129
|
};
|
|
129
130
|
//# sourceMappingURL=annotorious-react.es23.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotorious-react.es23.js","sources":["../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"],"sourcesContent":["/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n start: 'end',\n end: 'start'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n return
|
|
1
|
+
{"version":3,"file":"annotorious-react.es23.js","sources":["../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs"],"sourcesContent":["/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n start: 'end',\n end: 'start'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nconst yAxisSides = /*#__PURE__*/new Set(['top', 'bottom']);\nfunction getSideAxis(placement) {\n return yAxisSides.has(getSide(placement)) ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rlPlacement : lrPlacement;\n return isStart ? lrPlacement : rlPlacement;\n case 'left':\n case 'right':\n return isStart ? tbPlacement : btPlacement;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);\n}\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n"],"names":["min","max","round","floor","createCoords","v","oppositeSideMap","oppositeAlignmentMap","clamp","start","value","end","evaluate","param","getSide","placement","getAlignment","getOppositeAxis","axis","getAxisLength","yAxisSides","getSideAxis","getAlignmentAxis","getAlignmentSides","rects","rtl","alignment","alignmentAxis","length","mainAlignmentSide","getOppositePlacement","getExpandedPlacements","oppositePlacement","getOppositeAlignmentPlacement","lrPlacement","rlPlacement","tbPlacement","btPlacement","getSideList","side","isStart","getOppositeAxisPlacements","flipAlignment","direction","list","expandPaddingObject","padding","getPaddingObject","rectToClientRect","rect","x","y","width","height"],"mappings":"AAQK,MAACA,IAAM,KAAK,KACXC,IAAM,KAA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QAAQ;AAAA,IACR,MAAM;AAAA,IACN,GAAGA;AAAA,EACP;AACA;AACA,SAASC,EAAiBD,GAAS;AACjC,SAAO,OAAOA,KAAY,WAAWD,EAAoBC,CAAO,IAAI;AAAA,IAClE,KAAKA;AAAA,IACL,OAAOA;AAAA,IACP,QAAQA;AAAA,IACR,MAAMA;AAAA,EACV;AACA;AACA,SAASE,EAAiBC,GAAM;AAC9B,QAAM;AAAA,IACJ,GAAAC;AAAA,IACA,GAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,EACJ,IAAMJ;AACJ,SAAO;AAAA,IACL,OAAAG;AAAA,IACA,QAAAC;AAAA,IACA,KAAKF;AAAA,IACL,MAAMD;AAAA,IACN,OAAOA,IAAIE;AAAA,IACX,QAAQD,IAAIE;AAAA,IACZ,GAAAH;AAAA,IACA,GAAAC;AAAA,EACJ;AACA;","x_google_ignoreList":[0]}
|
|
@@ -47,7 +47,7 @@ function W(o, c, l) {
|
|
|
47
47
|
}
|
|
48
48
|
return i;
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const ct = async (o, c, l) => {
|
|
51
51
|
const {
|
|
52
52
|
placement: e = "bottom",
|
|
53
53
|
strategy: s = "absolute",
|
|
@@ -62,12 +62,12 @@ const st = async (o, c, l) => {
|
|
|
62
62
|
x: u,
|
|
63
63
|
y: n
|
|
64
64
|
} = W(g, e, d), m = e, i = {}, f = 0;
|
|
65
|
-
for (let
|
|
65
|
+
for (let h = 0; h < r.length; h++) {
|
|
66
66
|
const {
|
|
67
67
|
name: x,
|
|
68
68
|
fn: v
|
|
69
|
-
} = r[
|
|
70
|
-
x:
|
|
69
|
+
} = r[h], {
|
|
70
|
+
x: p,
|
|
71
71
|
y: A,
|
|
72
72
|
data: R,
|
|
73
73
|
reset: w
|
|
@@ -85,7 +85,7 @@ const st = async (o, c, l) => {
|
|
|
85
85
|
floating: c
|
|
86
86
|
}
|
|
87
87
|
});
|
|
88
|
-
u =
|
|
88
|
+
u = p ?? u, n = A ?? n, i = {
|
|
89
89
|
...i,
|
|
90
90
|
[x]: {
|
|
91
91
|
...i[x],
|
|
@@ -98,7 +98,7 @@ const st = async (o, c, l) => {
|
|
|
98
98
|
}) : w.rects), {
|
|
99
99
|
x: u,
|
|
100
100
|
y: n
|
|
101
|
-
} = W(g, m, d)),
|
|
101
|
+
} = W(g, m, d)), h = -1);
|
|
102
102
|
}
|
|
103
103
|
return {
|
|
104
104
|
x: u,
|
|
@@ -129,7 +129,7 @@ async function J(o, c) {
|
|
|
129
129
|
boundary: g,
|
|
130
130
|
rootBoundary: u,
|
|
131
131
|
strategy: d
|
|
132
|
-
})),
|
|
132
|
+
})), p = n === "floating" ? {
|
|
133
133
|
x: e,
|
|
134
134
|
y: s,
|
|
135
135
|
width: a.floating.width,
|
|
@@ -142,10 +142,10 @@ async function J(o, c) {
|
|
|
142
142
|
y: 1
|
|
143
143
|
}, w = $(t.convertOffsetParentRelativeRectToViewportRelativeRect ? await t.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
144
144
|
elements: r,
|
|
145
|
-
rect:
|
|
145
|
+
rect: p,
|
|
146
146
|
offsetParent: A,
|
|
147
147
|
strategy: d
|
|
148
|
-
}) :
|
|
148
|
+
}) : p);
|
|
149
149
|
return {
|
|
150
150
|
top: (v.top - w.top + f.top) / R.y,
|
|
151
151
|
bottom: (w.bottom - v.bottom + f.bottom) / R.y,
|
|
@@ -153,7 +153,7 @@ async function J(o, c) {
|
|
|
153
153
|
right: (w.right - v.right + f.right) / R.x
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
const
|
|
156
|
+
const lt = (o) => ({
|
|
157
157
|
name: "arrow",
|
|
158
158
|
options: o,
|
|
159
159
|
async fn(c) {
|
|
@@ -174,10 +174,10 @@ const ct = (o) => ({
|
|
|
174
174
|
const n = H(u), m = {
|
|
175
175
|
x: l,
|
|
176
176
|
y: e
|
|
177
|
-
}, i = q(s), f = G(i),
|
|
177
|
+
}, i = q(s), f = G(i), h = await a.getDimensions(g), x = i === "y", v = x ? "top" : "left", p = x ? "bottom" : "right", A = x ? "clientHeight" : "clientWidth", R = t.reference[f] + t.reference[i] - m[i] - t.floating[f], w = m[i] - t.reference[i], S = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(g));
|
|
178
178
|
let D = S ? S[A] : 0;
|
|
179
179
|
(!D || !await (a.isElement == null ? void 0 : a.isElement(S))) && (D = r.floating[A] || t.floating[f]);
|
|
180
|
-
const F = R / 2 - w / 2, T = D / 2 -
|
|
180
|
+
const F = R / 2 - w / 2, T = D / 2 - h[f] / 2 - 1, y = X(n[v], T), L = X(n[p], T), E = y, B = D - h[f] - L, b = D / 2 - h[f] / 2 + F, k = _(E, b, B), C = !d.arrow && I(s) != null && b !== k && t.reference[f] / 2 - (b < E ? y : L) - h[f] / 2 < 0, P = C ? b < E ? b - E : b - B : 0;
|
|
181
181
|
return {
|
|
182
182
|
[i]: m[i] + P,
|
|
183
183
|
data: {
|
|
@@ -190,7 +190,7 @@ const ct = (o) => ({
|
|
|
190
190
|
reset: C
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
}),
|
|
193
|
+
}), at = function(o) {
|
|
194
194
|
return o === void 0 && (o = {}), {
|
|
195
195
|
name: "flip",
|
|
196
196
|
options: o,
|
|
@@ -209,13 +209,13 @@ const ct = (o) => ({
|
|
|
209
209
|
fallbackPlacements: m,
|
|
210
210
|
fallbackStrategy: i = "bestFit",
|
|
211
211
|
fallbackAxisSideDirection: f = "none",
|
|
212
|
-
flipAlignment:
|
|
212
|
+
flipAlignment: h = !0,
|
|
213
213
|
...x
|
|
214
214
|
} = Y(o, c);
|
|
215
215
|
if ((l = t.arrow) != null && l.alignmentOffset)
|
|
216
216
|
return {};
|
|
217
|
-
const v = M(s),
|
|
218
|
-
!m && S && w.push(...Z(r,
|
|
217
|
+
const v = M(s), p = j(r), A = M(r) === r, R = await (d.isRTL == null ? void 0 : d.isRTL(g.floating)), w = m || (A || !h ? [Q(r)] : U(r)), S = f !== "none";
|
|
218
|
+
!m && S && w.push(...Z(r, h, f, R));
|
|
219
219
|
const D = [r, ...w], F = await J(c, x), T = [];
|
|
220
220
|
let y = ((e = t.flip) == null ? void 0 : e.overflows) || [];
|
|
221
221
|
if (u && T.push(F[v]), n) {
|
|
@@ -228,9 +228,9 @@ const ct = (o) => ({
|
|
|
228
228
|
}], !T.every((b) => b <= 0)) {
|
|
229
229
|
var L, E;
|
|
230
230
|
const b = (((L = t.flip) == null ? void 0 : L.index) || 0) + 1, k = D[b];
|
|
231
|
-
if (k && (!(n === "alignment" ?
|
|
231
|
+
if (k && (!(n === "alignment" ? p !== j(k) : !1) || // We leave the current main axis only if every placement on that axis
|
|
232
232
|
// overflows the main axis.
|
|
233
|
-
y.every((O) => O.overflows[0] > 0 && j(O.placement) ===
|
|
233
|
+
y.every((O) => O.overflows[0] > 0 && j(O.placement) === p)))
|
|
234
234
|
return {
|
|
235
235
|
data: {
|
|
236
236
|
index: b,
|
|
@@ -248,7 +248,7 @@ const ct = (o) => ({
|
|
|
248
248
|
const P = (B = y.filter((O) => {
|
|
249
249
|
if (S) {
|
|
250
250
|
const V = j(O.placement);
|
|
251
|
-
return V ===
|
|
251
|
+
return V === p || // Create a bias to the `y` side axis due to horizontal
|
|
252
252
|
// reading directions favoring greater width.
|
|
253
253
|
V === "y";
|
|
254
254
|
}
|
|
@@ -290,7 +290,7 @@ function nt(o) {
|
|
|
290
290
|
}
|
|
291
291
|
return l.map((s) => $(K(s)));
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const rt = function(o) {
|
|
294
294
|
return o === void 0 && (o = {}), {
|
|
295
295
|
name: "inline",
|
|
296
296
|
options: o,
|
|
@@ -323,7 +323,7 @@ const at = function(o) {
|
|
|
323
323
|
y: B
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
const x = M(l) === "left", v = z(...n.map((y) => y.right)),
|
|
326
|
+
const x = M(l) === "left", v = z(...n.map((y) => y.right)), p = X(...n.map((y) => y.left)), A = n.filter((y) => x ? y.left === p : y.right === v), R = A[0].top, w = A[A.length - 1].bottom, S = p, D = v, F = D - S, T = w - R;
|
|
327
327
|
return {
|
|
328
328
|
top: R,
|
|
329
329
|
bottom: w,
|
|
@@ -337,27 +337,27 @@ const at = function(o) {
|
|
|
337
337
|
}
|
|
338
338
|
return m;
|
|
339
339
|
}
|
|
340
|
-
const
|
|
340
|
+
const h = await t.getElementRects({
|
|
341
341
|
reference: {
|
|
342
342
|
getBoundingClientRect: f
|
|
343
343
|
},
|
|
344
344
|
floating: e.floating,
|
|
345
345
|
strategy: a
|
|
346
346
|
});
|
|
347
|
-
return s.reference.x !==
|
|
347
|
+
return s.reference.x !== h.reference.x || s.reference.y !== h.reference.y || s.reference.width !== h.reference.width || s.reference.height !== h.reference.height ? {
|
|
348
348
|
reset: {
|
|
349
|
-
rects:
|
|
349
|
+
rects: h
|
|
350
350
|
}
|
|
351
351
|
} : {};
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
|
-
};
|
|
355
|
-
async function
|
|
354
|
+
}, it = /* @__PURE__ */ new Set(["left", "top"]);
|
|
355
|
+
async function ot(o, c) {
|
|
356
356
|
const {
|
|
357
357
|
placement: l,
|
|
358
358
|
platform: e,
|
|
359
359
|
elements: s
|
|
360
|
-
} = o, t = await (e.isRTL == null ? void 0 : e.isRTL(s.floating)), a = M(l), r = I(l), d = j(l) === "y", g =
|
|
360
|
+
} = o, t = await (e.isRTL == null ? void 0 : e.isRTL(s.floating)), a = M(l), r = I(l), d = j(l) === "y", g = it.has(a) ? -1 : 1, u = t && d ? -1 : 1, n = Y(c, o);
|
|
361
361
|
let {
|
|
362
362
|
mainAxis: m,
|
|
363
363
|
crossAxis: i,
|
|
@@ -379,7 +379,7 @@ async function it(o, c) {
|
|
|
379
379
|
y: i * u
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
const
|
|
382
|
+
const ft = function(o) {
|
|
383
383
|
return o === void 0 && (o = 0), {
|
|
384
384
|
name: "offset",
|
|
385
385
|
options: o,
|
|
@@ -390,7 +390,7 @@ const rt = function(o) {
|
|
|
390
390
|
y: t,
|
|
391
391
|
placement: a,
|
|
392
392
|
middlewareData: r
|
|
393
|
-
} = c, d = await
|
|
393
|
+
} = c, d = await ot(c, o);
|
|
394
394
|
return a === ((l = r.offset) == null ? void 0 : l.placement) && (e = r.arrow) != null && e.alignmentOffset ? {} : {
|
|
395
395
|
x: s + d.x,
|
|
396
396
|
y: t + d.y,
|
|
@@ -401,7 +401,7 @@ const rt = function(o) {
|
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
403
|
};
|
|
404
|
-
},
|
|
404
|
+
}, mt = function(o) {
|
|
405
405
|
return o === void 0 && (o = {}), {
|
|
406
406
|
name: "shift",
|
|
407
407
|
options: o,
|
|
@@ -417,11 +417,11 @@ const rt = function(o) {
|
|
|
417
417
|
fn: (x) => {
|
|
418
418
|
let {
|
|
419
419
|
x: v,
|
|
420
|
-
y:
|
|
420
|
+
y: p
|
|
421
421
|
} = x;
|
|
422
422
|
return {
|
|
423
423
|
x: v,
|
|
424
|
-
y:
|
|
424
|
+
y: p
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
427
|
},
|
|
@@ -432,23 +432,23 @@ const rt = function(o) {
|
|
|
432
432
|
}, u = await J(c, d), n = j(M(s)), m = et(n);
|
|
433
433
|
let i = g[m], f = g[n];
|
|
434
434
|
if (t) {
|
|
435
|
-
const x = m === "y" ? "top" : "left", v = m === "y" ? "bottom" : "right",
|
|
436
|
-
i = _(
|
|
435
|
+
const x = m === "y" ? "top" : "left", v = m === "y" ? "bottom" : "right", p = i + u[x], A = i - u[v];
|
|
436
|
+
i = _(p, i, A);
|
|
437
437
|
}
|
|
438
438
|
if (a) {
|
|
439
|
-
const x = n === "y" ? "top" : "left", v = n === "y" ? "bottom" : "right",
|
|
440
|
-
f = _(
|
|
439
|
+
const x = n === "y" ? "top" : "left", v = n === "y" ? "bottom" : "right", p = f + u[x], A = f - u[v];
|
|
440
|
+
f = _(p, f, A);
|
|
441
441
|
}
|
|
442
|
-
const
|
|
442
|
+
const h = r.fn({
|
|
443
443
|
...c,
|
|
444
444
|
[m]: i,
|
|
445
445
|
[n]: f
|
|
446
446
|
});
|
|
447
447
|
return {
|
|
448
|
-
...
|
|
448
|
+
...h,
|
|
449
449
|
data: {
|
|
450
|
-
x:
|
|
451
|
-
y:
|
|
450
|
+
x: h.x - l,
|
|
451
|
+
y: h.y - e,
|
|
452
452
|
enabled: {
|
|
453
453
|
[m]: t,
|
|
454
454
|
[n]: a
|
|
@@ -459,13 +459,13 @@ const rt = function(o) {
|
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
461
|
export {
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
lt as arrow,
|
|
463
|
+
ct as computePosition,
|
|
464
464
|
J as detectOverflow,
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
465
|
+
at as flip,
|
|
466
|
+
rt as inline,
|
|
467
|
+
ft as offset,
|
|
468
468
|
$ as rectToClientRect,
|
|
469
|
-
|
|
469
|
+
mt as shift
|
|
470
470
|
};
|
|
471
471
|
//# sourceMappingURL=annotorious-react.es24.js.map
|