@soomo/react-text-annotator 3.0.0-staging.49 → 3.0.0-staging.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs"],"sourcesContent":["import { rectToClientRect, detectOverflow as detectOverflow$1, offset as offset$1, autoPlacement as autoPlacement$1, shift as shift$1, flip as flip$1, size as size$1, hide as hide$1, arrow as arrow$1, inline as inline$1, limitShift as limitShift$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getNodeScroll, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n return false;\n }\n return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement) {\n const win = getWindow(domElement);\n const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y\n };\n}\n\nfunction getClientRects(element) {\n return Array.from(element.getClientRects());\n}\n\nfunction getWindowScrollBarX(element) {\n // If <html> has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = element.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n if (getComputedStyle(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\nfunction getViewportRect(element, strategy) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n const visualViewportBased = isWebKit();\n if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport') {\n rect = getViewportRect(element, strategy);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n ...clippingAncestor,\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y\n };\n }\n return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n const parentNode = getParentNode(element);\n if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n return false;\n }\n return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let currentContainingBlockComputedStyle = null;\n const elementIsFixed = getComputedStyle(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n currentContainingBlockComputedStyle = null;\n }\n const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // Record last containing block for next iteration.\n currentContainingBlockComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstClippingAncestor = clippingAncestors[0];\n const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));\n return {\n width: clippingRect.right - clippingRect.left,\n height: clippingRect.bottom - clippingRect.top,\n x: clippingRect.left,\n y: clippingRect.top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n const x = rect.left + scroll.scrollLeft - offsets.x;\n const y = rect.top + scroll.scrollTop - offsets.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n return element.offsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const {\n left,\n top,\n width,\n height\n } = element.getBoundingClientRect();\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped, the ratio is 0. Throttle the refresh\n // to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n refresh(true);\n return cleanup;\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update, {\n passive: true\n });\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n resizeObserver.observe(floating);\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = {\n platform,\n ...options\n };\n const platformWithCache = {\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n"],"names":[],"mappings":";;;AAKA,SAAS,iBAAiB,SAAS;AACjC,QAAM,MAAM,iBAAiB,OAAO;AAGpC,MAAI,QAAQ,WAAW,IAAI,KAAK,KAAK;AACrC,MAAI,SAAS,WAAW,IAAI,MAAM,KAAK;AACvC,QAAM,YAAY,cAAc,OAAO;AACvC,QAAM,cAAc,YAAY,QAAQ,cAAc;AACtD,QAAM,eAAe,YAAY,QAAQ,eAAe;AACxD,QAAM,iBAAiB,MAAM,KAAK,MAAM,eAAe,MAAM,MAAM,MAAM;AACzE,MAAI,gBAAgB;AAClB,YAAQ;AACR,aAAS;AAAA,EACV;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACP;AACA;AAEA,SAAS,cAAc,SAAS;AAC9B,SAAO,CAAC,UAAU,OAAO,IAAI,QAAQ,iBAAiB;AACxD;AAEA,SAAS,SAAS,SAAS;AACzB,QAAM,aAAa,cAAc,OAAO;AACxC,MAAI,CAAC,cAAc,UAAU,GAAG;AAC9B,WAAO,aAAa,CAAC;AAAA,EACtB;AACD,QAAM,OAAO,WAAW;AACxB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,EACJ,IAAM,iBAAiB,UAAU;AAC/B,MAAI,KAAK,IAAI,MAAM,KAAK,KAAK,IAAI,KAAK,SAAS;AAC/C,MAAI,KAAK,IAAI,MAAM,KAAK,MAAM,IAAI,KAAK,UAAU;AAIjD,MAAI,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,GAAG;AAC7B,QAAI;AAAA,EACL;AACD,MAAI,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,GAAG;AAC7B,QAAI;AAAA,EACL;AACD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACJ;AACA;AAEA,MAAM,YAAyB,6BAAa,CAAC;AAC7C,SAAS,iBAAiB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AAkB,SAAS,oBAAoB,UAAU,MAAM;AAC/D,wBAAkB,SAAS,oBAAoB,UAAU,MAAM;AAAA,IACrE,CAAK;AACD,iBAAa,QAAQ;AACrB,KAAC,mBAAmB,mBAAmB,QAAQ,iBAAiB,WAAU;AAC1E,qBAAiB;AACjB,QAAI,gBAAgB;AAClB,2BAAqB,OAAO;AAAA,IAC7B;AAAA,EACL;AACA;AAmBK,MAAC,SAAS;AAeV,MAAC,QAAQ;AAQT,MAAC,OAAO;AA6BR,MAAC,SAAS;AAWV,MAAC,kBAAkB,CAAC,WAAW,UAAU,YAAY;AAIxD,QAAM,QAAQ,oBAAI;AAClB,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA,GAAG;AAAA,EACP;AACE,QAAM,oBAAoB;AAAA,IACxB,GAAG,cAAc;AAAA,IACjB,IAAI;AAAA,EACR;AACE,SAAO,kBAAkB,WAAW,UAAU;AAAA,IAC5C,GAAG;AAAA,IACH,UAAU;AAAA,EACd,CAAG;AACH;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"react-text-annotator.es16.js","sources":["../../../node_modules/unique-random/index.js"],"sourcesContent":["function * range(minimum, maximum) {\n\tfor (let number = minimum; number <= maximum; number++) {\n\t\tyield number;\n\t}\n}\n\nfunction randomInteger(minimum, maximum) {\n\treturn Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;\n}\n\nfunction randomIntegerWithout(minimum, maximum, excludedValue) {\n\tconst number = randomInteger(minimum, maximum - 1);\n\n\treturn number >= excludedValue ? number + 1 : number;\n}\n\nfunction makeCallable(generator) {\n\tconst iterator = generator();\n\n\tfunction random() {\n\t\treturn iterator.next().value;\n\t}\n\n\trandom[Symbol.iterator] = function * () {\n\t\twhile (true) {\n\t\t\tyield random();\n\t\t}\n\t};\n\n\treturn random;\n}\n\nexport function consecutiveUniqueRandom(minimum, maximum) {\n\treturn makeCallable(function * () {\n\t\tif (minimum === maximum) {\n\t\t\twhile (true) {\n\t\t\t\tyield minimum;\n\t\t\t}\n\t\t}\n\n\t\tlet previousValue = randomInteger(minimum, maximum);\n\t\tyield previousValue;\n\n\t\twhile (true) {\n\t\t\tpreviousValue = randomIntegerWithout(minimum, maximum, previousValue);\n\t\t\tyield previousValue;\n\t\t}\n\t});\n}\n\nexport function exhaustiveUniqueRandom(minimum, maximum) {\n\treturn makeCallable(function * () {\n\t\tif (minimum === maximum) {\n\t\t\twhile (true) {\n\t\t\t\tyield minimum;\n\t\t\t}\n\t\t}\n\n\t\tlet unconsumedValues = [...range(minimum, maximum)];\n\n\t\twhile (true) {\n\t\t\twhile (unconsumedValues.length > 1) {\n\t\t\t\tyield unconsumedValues.splice(\n\t\t\t\t\trandomInteger(0, unconsumedValues.length - 1),\n\t\t\t\t\t1,\n\t\t\t\t)[0];\n\t\t\t}\n\n\t\t\tconst [previousValue] = unconsumedValues;\n\n\t\t\tyield previousValue;\n\n\t\t\tunconsumedValues = [...range(minimum, maximum)];\n\n\t\t\tyield unconsumedValues.splice(\n\t\t\t\trandomIntegerWithout(0, unconsumedValues.length - 1, previousValue - minimum),\n\t\t\t\t1,\n\t\t\t)[0];\n\t\t}\n\t});\n}\n"],"names":[],"mappings":"AAAA,UAAW,MAAM,SAAS,SAAS;AAClC,WAAS,SAAS,SAAS,UAAU,SAAS,UAAU;AACvD,UAAM;AAAA,EACN;AACF;AAEA,SAAS,cAAc,SAAS,SAAS;AACxC,SAAO,KAAK,MAAM,KAAK,OAAM,KAAM,UAAU,UAAU,EAAE,IAAI;AAC9D;AAEA,SAAS,qBAAqB,SAAS,SAAS,eAAe;AAC9D,QAAM,SAAS,cAAc,SAAS,UAAU,CAAC;AAEjD,SAAO,UAAU,gBAAgB,SAAS,IAAI;AAC/C;AAEA,SAAS,aAAa,WAAW;AAChC,QAAM,WAAW;AAEjB,WAAS,SAAS;AACjB,WAAO,SAAS,KAAM,EAAC;AAAA,EACvB;AAED,SAAO,OAAO,QAAQ,IAAI,aAAc;AACvC,WAAO,MAAM;AACZ,YAAM,OAAM;AAAA,IACZ;AAAA,EACH;AAEC,SAAO;AACR;AAoBO,SAAS,uBAAuB,SAAS,SAAS;AACxD,SAAO,aAAa,aAAc;AAOjC,QAAI,mBAAmB,CAAC,GAAG,MAAM,SAAS,OAAO,CAAC;AAElD,WAAO,MAAM;AACZ,aAAO,iBAAiB,SAAS,GAAG;AACnC,cAAM,iBAAiB;AAAA,UACtB,cAAc,GAAG,iBAAiB,SAAS,CAAC;AAAA,UAC5C;AAAA,QACA,EAAC,CAAC;AAAA,MACH;AAED,YAAM,CAAC,aAAa,IAAI;AAExB,YAAM;AAEN,yBAAmB,CAAC,GAAG,MAAM,SAAS,OAAO,CAAC;AAE9C,YAAM,iBAAiB;AAAA,QACtB,qBAAqB,GAAG,iBAAiB,SAAS,GAAG,gBAAgB,OAAO;AAAA,QAC5E;AAAA,MACA,EAAC,CAAC;AAAA,IACH;AAAA,EACH,CAAE;AACF;","x_google_ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  import { j as jsxRuntimeExports } from "./react-text-annotator.es8.js";
2
2
  import { useRef, useEffect } from "react";
3
- import CETEI from "./react-text-annotator.es12.js";
3
+ import CETEI from "./react-text-annotator.es10.js";
4
4
  const PRESET_BEHAVIORS = {
5
5
  tei: {
6
6
  ref: (elem) => {
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useLayoutEffect, useMemo, useRef, useEffect } from "react";
2
2
  import { useAnnotationStore, useSelection, Origin } from "@annotorious/react";
3
- import { announce as $319e236875307eab$export$a9b970dcc4ae71a9, destroyAnnouncer as $319e236875307eab$export$d8686216b8b81b2f } from "./react-text-annotator.es10.js";
4
- import { exhaustiveUniqueRandom } from "./react-text-annotator.es11.js";
3
+ import { announce as $319e236875307eab$export$a9b970dcc4ae71a9, destroyAnnouncer as $319e236875307eab$export$d8686216b8b81b2f } from "./react-text-annotator.es15.js";
4
+ import { exhaustiveUniqueRandom } from "./react-text-annotator.es16.js";
5
5
  const useAnnouncePopupNavigation = (args) => {
6
6
  const {
7
7
  message = "Press Tab to move to Notes Dialog",
@@ -1,12 +1,12 @@
1
1
  import { j as jsxRuntimeExports } from "./react-text-annotator.es8.js";
2
2
  import { useState, useEffect, useCallback } from "react";
3
- import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager } from "./react-text-annotator.es13.js";
3
+ import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager } from "./react-text-annotator.es11.js";
4
4
  import { useAnnotator, useSelection } from "@annotorious/react";
5
5
  import { denormalizeRectWithOffset, toDomRectList } from "@soomo/text-annotator";
6
6
  import { useAnnouncePopupNavigation } from "./react-text-annotator.es4.js";
7
7
  /* empty css */
8
- import { offset, inline, flip, shift } from "./react-text-annotator.es15.js";
9
- import { autoUpdate } from "./react-text-annotator.es16.js";
8
+ import { offset, inline, flip, shift } from "./react-text-annotator.es13.js";
9
+ import { autoUpdate } from "./react-text-annotator.es14.js";
10
10
  const TextAnnotatorPopup = (props) => {
11
11
  var _a;
12
12
  const { popup, popupNavigationMessage } = props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soomo/react-text-annotator",
3
- "version": "3.0.0-staging.49",
3
+ "version": "3.0.0-staging.50",
4
4
  "description": "Recogito Text Annotator React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -48,7 +48,7 @@
48
48
  "@annotorious/core": "^3.0.0-rc.31",
49
49
  "@annotorious/react": "^3.0.0-rc.31",
50
50
  "@floating-ui/react": "^0.26.23",
51
- "@soomo/text-annotator": "3.0.0-staging.49",
51
+ "@soomo/text-annotator": "3.0.0-staging.50",
52
52
  "@react-aria/live-announcer": "^3.3.4",
53
53
  "@recogito/text-annotator-tei": "3.0.0-rc.39",
54
54
  "CETEIcean": "^1.9.3",
@@ -1,490 +0,0 @@
1
- import defaultBehaviors from "./react-text-annotator.es22.js";
2
- import * as utilities from "./react-text-annotator.es23.js";
3
- import { hideContent, defineCustomElement, tagName } from "./react-text-annotator.es23.js";
4
- import { addBehaviors, addBehavior, removeBehavior } from "./react-text-annotator.es24.js";
5
- import { learnElementNames, learnCustomElementNames } from "./react-text-annotator.es25.js";
6
- class CETEI {
7
- constructor(options) {
8
- this.options = options ? options : {};
9
- this.document = this.options.documentObject ? this.options.documentObject : void 0;
10
- if (this.document === void 0) {
11
- if (typeof window !== "undefined" && window.document) {
12
- this.document = window.document;
13
- } else if (typeof global !== "undefined" && global.document) {
14
- this.document = global.document;
15
- }
16
- }
17
- this.addBehaviors = addBehaviors.bind(this);
18
- this.addBehavior = addBehavior.bind(this);
19
- this.removeBehavior = removeBehavior.bind(this);
20
- this.utilities = {};
21
- for (const u of Object.keys(utilities)) {
22
- if (["getPrefixDef", "rw", "resolveURI"].includes(u)) {
23
- this.utilities[u] = utilities[u].bind(this);
24
- } else {
25
- this.utilities[u] = utilities[u];
26
- }
27
- }
28
- this.els = [];
29
- this.namespaces = /* @__PURE__ */ new Map();
30
- this.behaviors = {};
31
- this.hasStyle = false;
32
- this.prefixDefs = [];
33
- this.debug = this.options.debug === true ? true : false;
34
- this.discardContent = this.options.discardContent === true ? true : false;
35
- if (this.options.base) {
36
- this.base = this.options.base;
37
- } else {
38
- try {
39
- if (window) {
40
- this.base = window.location.href.replace(/\/[^\/]*$/, "/");
41
- }
42
- } catch (e) {
43
- this.base = "";
44
- }
45
- }
46
- if (!this.options.omitDefaultBehaviors) {
47
- this.addBehaviors(defaultBehaviors);
48
- }
49
- if (this.options.ignoreFragmentId) {
50
- if (window) {
51
- window.removeEventListener("ceteiceanload", CETEI.restorePosition);
52
- }
53
- }
54
- }
55
- /*
56
- Returns a Promise that fetches an XML source document from the URL
57
- provided in the first parameter and then calls the makeHTML5 method
58
- on the returned document.
59
- */
60
- async getHTML5(XML_url, callback, perElementFn) {
61
- if (window && window.location.href.startsWith(this.base) && XML_url.indexOf("/") >= 0) {
62
- this.base = XML_url.replace(/\/[^\/]*$/, "/");
63
- }
64
- try {
65
- const response = await fetch(XML_url);
66
- if (response.ok) {
67
- const XML = await response.text();
68
- return this.makeHTML5(XML, callback, perElementFn);
69
- } else {
70
- console.log(`Could not get XML file ${XML_url}.
71
- Server returned ${response.status}: ${response.statusText}`);
72
- }
73
- } catch (error) {
74
- console.log(error);
75
- }
76
- }
77
- /*
78
- Converts the supplied XML string into HTML5 Custom Elements. If a callback
79
- function is supplied, calls it on the result.
80
- */
81
- makeHTML5(XML, callback, perElementFn) {
82
- this.XML_dom = new DOMParser().parseFromString(XML, "text/xml");
83
- return this.domToHTML5(this.XML_dom, callback, perElementFn);
84
- }
85
- preprocess(XML_dom, callback, perElementFn) {
86
- this.els = learnElementNames(XML_dom, this.namespaces);
87
- let convertEl = (el) => {
88
- let newElement;
89
- if (this.namespaces.has(el.namespaceURI ? el.namespaceURI : "")) {
90
- let prefix = this.namespaces.get(el.namespaceURI ? el.namespaceURI : "");
91
- newElement = this.document.createElement(`${prefix}-${el.localName.toLowerCase()}`);
92
- } else {
93
- newElement = this.document.importNode(el, false);
94
- }
95
- for (let att of Array.from(el.attributes)) {
96
- if (att.name == "xmlns") {
97
- newElement.setAttribute("data-xmlns", att.value);
98
- } else {
99
- newElement.setAttribute(att.name, att.value);
100
- }
101
- if (att.name == "xml:id") {
102
- newElement.setAttribute("id", att.value);
103
- }
104
- if (att.name == "xml:lang") {
105
- newElement.setAttribute("lang", att.value);
106
- }
107
- if (att.name == "rendition") {
108
- newElement.setAttribute("class", att.value.replace(/#/g, ""));
109
- }
110
- }
111
- newElement.setAttribute("data-origname", el.localName);
112
- if (el.hasAttributes()) {
113
- newElement.setAttribute("data-origatts", el.getAttributeNames().join(" "));
114
- }
115
- if (el.childNodes.length == 0) {
116
- newElement.setAttribute("data-empty", "");
117
- }
118
- if (el.localName == "head") {
119
- let level = XML_dom.evaluate("count(ancestor::*[tei:head])", el, function(ns) {
120
- if (ns == "tei") return "http://www.tei-c.org/ns/1.0";
121
- }, 1, null);
122
- newElement.setAttribute("data-level", level.numberValue);
123
- }
124
- if (el.localName == "tagsDecl") {
125
- let style = this.document.createElement("style");
126
- for (let node of Array.from(el.childNodes)) {
127
- if (node.nodeType == 1 && node.localName == "rendition" && node.getAttribute("scheme") == "css") {
128
- let rule = "";
129
- if (node.hasAttribute("selector")) {
130
- rule += node.getAttribute("selector").replace(/([^#, >]+\w*)/g, "tei-$1").replace(/#tei-/g, "#") + "{\n";
131
- rule += node.textContent;
132
- } else {
133
- rule += "." + node.getAttribute("xml:id") + "{\n";
134
- rule += node.textContent;
135
- }
136
- rule += "\n}\n";
137
- style.appendChild(this.document.createTextNode(rule));
138
- }
139
- }
140
- if (style.childNodes.length > 0) {
141
- newElement.appendChild(style);
142
- this.hasStyle = true;
143
- }
144
- }
145
- if (el.localName == "prefixDef") {
146
- this.prefixDefs.push(el.getAttribute("ident"));
147
- this.prefixDefs[el.getAttribute("ident")] = {
148
- "matchPattern": el.getAttribute("matchPattern"),
149
- "replacementPattern": el.getAttribute("replacementPattern")
150
- };
151
- }
152
- for (let node of Array.from(el.childNodes)) {
153
- if (node.nodeType == 1) {
154
- newElement.appendChild(convertEl(node));
155
- } else {
156
- newElement.appendChild(node.cloneNode());
157
- }
158
- }
159
- if (perElementFn) {
160
- perElementFn(newElement, el);
161
- }
162
- return newElement;
163
- };
164
- this.dom = this.document.createDocumentFragment();
165
- for (let node of Array.from(XML_dom.childNodes)) {
166
- if (node.nodeType == 1) {
167
- this.dom.appendChild(convertEl(node));
168
- }
169
- if (node.nodeType == 7) {
170
- this.dom.appendChild(this.document.importNode(node, true));
171
- }
172
- if (node.nodeType == 8) {
173
- this.dom.appendChild(this.document.importNode(node, true));
174
- }
175
- }
176
- this.utilities.dom = this.dom.firstElementChild;
177
- if (callback) {
178
- callback(this.dom, this);
179
- if (window) {
180
- window.dispatchEvent(ceteiceanLoad);
181
- }
182
- } else {
183
- if (typeof window !== "undefined") {
184
- window.dispatchEvent(ceteiceanLoad);
185
- }
186
- return this.dom;
187
- }
188
- }
189
- /*
190
- Converts the supplied XML DOM into HTML5 Custom Elements. If a callback
191
- function is supplied, calls it on the result.
192
- */
193
- domToHTML5(XML_dom, callback, perElementFn) {
194
- this.preprocess(XML_dom, null, perElementFn);
195
- this.applyBehaviors();
196
- this.done = true;
197
- if (callback) {
198
- callback(this.dom, this);
199
- if (window) {
200
- window.dispatchEvent(ceteiceanLoad);
201
- }
202
- } else {
203
- if (typeof window !== "undefined") {
204
- window.dispatchEvent(ceteiceanLoad);
205
- }
206
- return this.dom;
207
- }
208
- }
209
- /*
210
- Convenience method for HTML pages containing pre-processed CETEIcean Custom
211
- Elements. Usage:
212
- const c = new CETEI();
213
- c.processPage();
214
- */
215
- processPage() {
216
- this.els = learnCustomElementNames(this.document);
217
- this.applyBehaviors();
218
- if (window) {
219
- window.dispatchEvent(ceteiceanLoad);
220
- }
221
- }
222
- /*
223
- To change a namespace -> prefix mapping, the namespace must first be
224
- unset. Takes a namespace URI. In order to process a TEI P4 document, e.g.,
225
- the TEI namespace must be unset before it can be set to the empty string.
226
- */
227
- unsetNamespace(ns) {
228
- this.namespaces.delete(ns);
229
- }
230
- /*
231
- Sets the base URL for the document. Used to rewrite relative links in the
232
- XML source (which may be in a completely different location from the HTML
233
- wrapper).
234
- */
235
- setBaseUrl(base) {
236
- this.base = base;
237
- }
238
- /*
239
- Appends any element returned by the function passed in the first
240
- parameter to the element in the second parameter. If the function
241
- returns nothing, this is a no-op aside from any side effects caused
242
- by the provided function.
243
-
244
- Called by getHandler() and fallback()
245
- */
246
- append(fn, elt) {
247
- let self = this;
248
- if (elt && !elt.hasAttribute("data-processed")) {
249
- let content = fn.call(self.utilities, elt);
250
- if (content) {
251
- self.appendBasic(elt, content);
252
- }
253
- } else {
254
- return function() {
255
- if (!this.hasAttribute("data-processed")) {
256
- let content = fn.call(self.utilities, this);
257
- if (content) {
258
- self.appendBasic(this, content);
259
- }
260
- }
261
- };
262
- }
263
- }
264
- appendBasic(elt, content) {
265
- if (this.discardContent) {
266
- elt.innerHTML = "";
267
- } else {
268
- hideContent(elt, true);
269
- }
270
- elt.appendChild(content);
271
- }
272
- // Given an element, return its qualified name as defined in a behaviors object
273
- bName(e) {
274
- return e.tagName.substring(0, e.tagName.indexOf("-")).toLowerCase() + ":" + e.getAttribute("data-origname");
275
- }
276
- /*
277
- Private method called by append(). Takes a child element and a name, and recurses through the
278
- child's siblings until an element with that name is found, returning true if it is and false if not.
279
- */
280
- childExists(elt, name) {
281
- if (elt && elt.nodeName == name) {
282
- return true;
283
- } else {
284
- return elt && elt.nextElementSibling && this.childExists(elt.nextElementSibling, name);
285
- }
286
- }
287
- /*
288
- Takes a template in the form of either an array of 1 or 2
289
- strings or an object with CSS selector keys and either functions
290
- or arrays as described above. Returns a closure around a function
291
- that can be called in the element constructor or applied to an
292
- individual element. An empty array is considered a no-op.
293
-
294
- Called by the getHandler() and getFallback() methods
295
- */
296
- decorator(template) {
297
- if (Array.isArray(template) && template.length == 0) {
298
- return function(e) {
299
- };
300
- }
301
- if (Array.isArray(template) && !Array.isArray(template[0])) {
302
- return this.applyDecorator(template);
303
- }
304
- let self = this;
305
- return function(elt) {
306
- for (let rule of template) {
307
- if (elt.matches(rule[0]) || rule[0] === "_") {
308
- if (Array.isArray(rule[1])) {
309
- return self.decorator(rule[1]).call(this, elt);
310
- } else {
311
- return rule[1].call(this, elt);
312
- }
313
- }
314
- }
315
- };
316
- }
317
- applyDecorator(strings) {
318
- let self = this;
319
- return function(elt) {
320
- let copy = [];
321
- for (let i = 0; i < strings.length; i++) {
322
- copy.push(self.template(strings[i], elt));
323
- }
324
- return self.insert(elt, copy);
325
- };
326
- }
327
- /*
328
- Returns the fallback function for the given element name.
329
- Called by fallback().
330
- */
331
- getFallback(behaviors, fn) {
332
- if (behaviors[fn]) {
333
- if (behaviors[fn] instanceof Function) {
334
- return behaviors[fn];
335
- } else {
336
- return this.decorator(behaviors[fn]);
337
- }
338
- }
339
- }
340
- /*
341
- Returns the handler function for the given element name
342
- Called by define().
343
- */
344
- getHandler(behaviors, fn) {
345
- if (behaviors[fn]) {
346
- if (behaviors[fn] instanceof Function) {
347
- return this.append(behaviors[fn]);
348
- } else {
349
- return this.append(this.decorator(behaviors[fn]));
350
- }
351
- }
352
- }
353
- insert(elt, strings) {
354
- let content = this.document.createElement("cetei-content");
355
- for (let node of Array.from(elt.childNodes)) {
356
- if (node.nodeType === 1 && !node.hasAttribute("data-processed")) {
357
- this.processElement(node);
358
- }
359
- }
360
- if (strings[0].match("<[^>]+>") && strings[1] && strings[1].match("<[^>]+>")) {
361
- content.innerHTML = strings[0] + elt.innerHTML + (strings[1] ? strings[1] : "");
362
- } else {
363
- content.innerHTML = strings[0];
364
- content.setAttribute("data-before", strings[0].replace(/<[^>]+>/g, "").length);
365
- for (let node of Array.from(elt.childNodes)) {
366
- content.appendChild(node.cloneNode(true));
367
- }
368
- if (strings.length > 1) {
369
- content.innerHTML += strings[1];
370
- content.setAttribute("data-after", strings[1].replace(/<[^>]+>/g, "").length);
371
- }
372
- }
373
- if (content.childNodes.length < 2) {
374
- return content.firstChild;
375
- } else {
376
- return content;
377
- }
378
- }
379
- // Runs behaviors recursively on the supplied element and children
380
- processElement(elt) {
381
- if (elt.hasAttribute("data-origname") && !elt.hasAttribute("data-processed")) {
382
- let fn = this.getFallback(this.bName(elt));
383
- if (fn) {
384
- this.append(fn, elt);
385
- elt.setAttribute("data-processed", "");
386
- }
387
- }
388
- for (let node of Array.from(elt.childNodes)) {
389
- if (node.nodeType === 1) {
390
- this.processElement(node);
391
- }
392
- }
393
- }
394
- template(str, elt) {
395
- let result = str;
396
- if (str.search(/\$(\w*)(@([a-zA-Z:]+))/)) {
397
- let re = /\$(\w*)@([a-zA-Z:]+)/g;
398
- let replacements;
399
- while (replacements = re.exec(str)) {
400
- if (elt.hasAttribute(replacements[2])) {
401
- if (replacements[1] && this.utilities[replacements[1]]) {
402
- result = result.replace(replacements[0], this.utilities[replacements[1]](elt.getAttribute(replacements[2])));
403
- } else {
404
- result = result.replace(replacements[0], elt.getAttribute(replacements[2]));
405
- }
406
- } else {
407
- result = result.replace(replacements[0], "");
408
- }
409
- }
410
- }
411
- return result;
412
- }
413
- // Define or apply behaviors for the document
414
- applyBehaviors() {
415
- if (typeof window !== "undefined" && window.customElements) {
416
- this.define.call(this, this.els);
417
- } else {
418
- this.fallback.call(this, this.els);
419
- }
420
- }
421
- /*
422
- Registers the list of elements provided with the browser.
423
- Called by makeHTML5(), but can be called independently if, for example,
424
- you've created Custom Elements via an XSLT transformation instead.
425
- */
426
- define(names) {
427
- for (let name of names) {
428
- const fn = this.getHandler(this.behaviors, name);
429
- defineCustomElement(name, fn, this.debug);
430
- }
431
- }
432
- /*
433
- Provides fallback functionality for environments where Custom Elements
434
- are not supported.
435
-
436
- Like define(), this is called by makeHTML5(), but can be called
437
- independently.
438
- */
439
- fallback(names) {
440
- for (let name of names) {
441
- let fn = this.getFallback(this.behaviors, name);
442
- if (fn) {
443
- for (let elt of Array.from((this.dom && !this.done ? this.dom : this.document).querySelectorAll(tagName(name)))) {
444
- if (!elt.hasAttribute("data-processed")) {
445
- this.append(fn, elt);
446
- elt.setAttribute("data-processed", "");
447
- }
448
- }
449
- }
450
- }
451
- }
452
- /**********************
453
- * Utility functions *
454
- **********************/
455
- static savePosition() {
456
- window.sessionStorage.setItem(window.location + "-scroll", window.scrollY);
457
- }
458
- static restorePosition() {
459
- if (!window.location.hash) {
460
- let scroll;
461
- if (scroll = window.sessionStorage.getItem(window.location + "-scroll")) {
462
- window.sessionStorage.removeItem(window.location + "-scroll");
463
- setTimeout(function() {
464
- window.scrollTo(0, scroll);
465
- }, 100);
466
- }
467
- } else {
468
- setTimeout(function() {
469
- let h = this.document.querySelector(window.decodeURI(window.location.hash));
470
- if (h) {
471
- h.scrollIntoView();
472
- }
473
- }, 100);
474
- }
475
- }
476
- }
477
- try {
478
- if (typeof window !== "undefined") {
479
- window.CETEI = CETEI;
480
- window.addEventListener("beforeunload", CETEI.savePosition);
481
- var ceteiceanLoad = new Event("ceteiceanload");
482
- window.addEventListener("ceteiceanload", CETEI.restorePosition);
483
- }
484
- } catch (e) {
485
- console.log(e);
486
- }
487
- export {
488
- CETEI as default
489
- };
490
- //# sourceMappingURL=react-text-annotator.es12.js.map