@soomo/react-text-annotator 3.1.0-staging.20 → 3.1.0-staging.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/TextAnnotator.d.ts +4 -4
  2. package/dist/TextAnnotator.d.ts.map +1 -1
  3. package/dist/react-text-annotator.es11.js +5 -5
  4. package/dist/react-text-annotator.es12.js +78 -1593
  5. package/dist/react-text-annotator.es12.js.map +1 -1
  6. package/dist/react-text-annotator.es13.js +45 -9
  7. package/dist/react-text-annotator.es13.js.map +1 -1
  8. package/dist/react-text-annotator.es14.js +28 -0
  9. package/dist/react-text-annotator.es14.js.map +1 -0
  10. package/dist/react-text-annotator.es15.js +1537 -222
  11. package/dist/react-text-annotator.es15.js.map +1 -1
  12. package/dist/react-text-annotator.es16.js +8 -586
  13. package/dist/react-text-annotator.es16.js.map +1 -1
  14. package/dist/react-text-annotator.es18.js +274 -37
  15. package/dist/react-text-annotator.es18.js.map +1 -1
  16. package/dist/react-text-annotator.es19.js +581 -19
  17. package/dist/react-text-annotator.es19.js.map +1 -1
  18. package/dist/react-text-annotator.es21.js +1 -1
  19. package/dist/react-text-annotator.es22.js +1 -1
  20. package/dist/react-text-annotator.es23.js +2 -114
  21. package/dist/react-text-annotator.es23.js.map +1 -1
  22. package/dist/react-text-annotator.es24.js +2 -309
  23. package/dist/react-text-annotator.es24.js.map +1 -1
  24. package/dist/react-text-annotator.es25.js +109 -53
  25. package/dist/react-text-annotator.es25.js.map +1 -1
  26. package/dist/react-text-annotator.es26.js +306 -17
  27. package/dist/react-text-annotator.es26.js.map +1 -1
  28. package/dist/react-text-annotator.es27.js +58 -2
  29. package/dist/react-text-annotator.es27.js.map +1 -1
  30. package/dist/react-text-annotator.es28.js +20 -2
  31. package/dist/react-text-annotator.es28.js.map +1 -1
  32. package/dist/react-text-annotator.es4.js +2 -2
  33. package/dist/react-text-annotator.es5.js +1 -1
  34. package/dist/react-text-annotator.es6.js.map +1 -1
  35. package/dist/react-text-annotator.es7.js +4 -4
  36. package/package.json +1 -1
  37. package/dist/react-text-annotator.es17.js +0 -85
  38. package/dist/react-text-annotator.es17.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es27.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"react-text-annotator.es27.js","sources":["../../../node_modules/CETEIcean/src/behaviors.js"],"sourcesContent":["\n/* \n Add a user-defined set of behaviors to CETEIcean's processing\n workflow. Added behaviors will override predefined behaviors with the\n same name.\n*/\nexport function addBehaviors(bhvs) {\n if (bhvs.namespaces) {\n for (let prefix of Object.keys(bhvs.namespaces)) {\n if (!this.namespaces.has(bhvs.namespaces[prefix]) && !Array.from(this.namespaces.values()).includes(prefix)) {\n this.namespaces.set(bhvs.namespaces[prefix], prefix);\n }\n }\n }\n for (let prefix of this.namespaces.values()) {\n if (bhvs[prefix]) {\n for (let b of Object.keys(bhvs[prefix])) {\n this.behaviors[`${prefix}:${b}`] = bhvs[prefix][b];\n }\n }\n }\n if (bhvs[\"functions\"]) {\n for (let fn of Object.keys(bhvs[\"functions\"])) {\n this.utilities[fn] = bhvs[\"functions\"][fn].bind(this.utilities);\n }\n }\n if (bhvs[\"handlers\"]) {\n console.log(\"Behavior handlers are no longer used.\")\n }\n if (bhvs[\"fallbacks\"]) {\n console.log(\"Fallback behaviors are no longer used.\")\n }\n}\n\n/* \n Adds or replaces an individual behavior. Takes a namespace prefix or namespace definition,\n the element name, and the behavior. E.g.\n addBehavior(\"tei\", \"add\", [\"`\",\"`\"]) for an already-declared namespace or\n addBehavior({\"doc\": \"http://docbook.org/ns/docbook\"}, \"note\", [\"[\",\"]\"]) for a new one\n*/\nexport function addBehavior(ns, element, b) {\n let p;\n if (ns === Object(ns)) {\n for (let prefix of Object.keys(ns)) {\n if (!this.namespaces.has(ns[prefix])) {\n this.namespaces.set(ns[prefix], prefix);\n p = prefix;\n }\n }\n } else {\n p = ns;\n }\n this.behaviors[`${p}:${element}`] = b;\n}\n\n/*\n Removes a previously-defined or default behavior. Takes a namespace prefix or namespace definition\n and the element name.\n*/\nexport function removeBehavior(ns, element) {\n let p;\n if (ns === Object(ns)) {\n for (let prefix of Object.keys(ns)) {\n if (!this.namespaces.has(ns[prefix])) {\n this.namespaces.set(ns[prefix], prefix);\n p = prefix;\n }\n }\n } else {\n p = ns;\n }\n delete this.behaviors[`${p}:${element}`];\n}\n"],"names":[],"mappings":"AAMO,SAAS,aAAa,MAAM;AACjC,MAAI,KAAK,YAAY;AACnB,aAAS,UAAU,OAAO,KAAK,KAAK,UAAU,GAAG;AAC/C,UAAI,CAAC,KAAK,WAAW,IAAI,KAAK,WAAW,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,KAAK,WAAW,OAAM,CAAE,EAAE,SAAS,MAAM,GAAG;AAC3G,aAAK,WAAW,IAAI,KAAK,WAAW,MAAM,GAAG,MAAM;AAAA,MAC3D;AAAA,IACA;AAAA,EACA;AACE,WAAS,UAAU,KAAK,WAAW,OAAM,GAAI;AAC3C,QAAI,KAAK,MAAM,GAAG;AAChB,eAAS,KAAK,OAAO,KAAK,KAAK,MAAM,CAAC,GAAG;AACvC,aAAK,UAAU,GAAG,MAAM,IAAI,CAAC,EAAE,IAAI,KAAK,MAAM,EAAE,CAAC;AAAA,MACzD;AAAA,IACA;AAAA,EACA;AACE,MAAI,KAAK,WAAW,GAAG;AACrB,aAAS,MAAM,OAAO,KAAK,KAAK,WAAW,CAAC,GAAG;AAC7C,WAAK,UAAU,EAAE,IAAI,KAAK,WAAW,EAAE,EAAE,EAAE,KAAK,KAAK,SAAS;AAAA,IACpE;AAAA,EACA;AACE,MAAI,KAAK,UAAU,GAAG;AACpB,YAAQ,IAAI,uCAAuC;AAAA,EACvD;AACE,MAAI,KAAK,WAAW,GAAG;AACrB,YAAQ,IAAI,wCAAwC;AAAA,EACxD;AACA;AAQO,SAAS,YAAY,IAAI,SAAS,GAAG;AAC1C,MAAI;AACJ,MAAI,OAAO,OAAO,EAAE,GAAG;AACrB,aAAS,UAAU,OAAO,KAAK,EAAE,GAAG;AAClC,UAAI,CAAC,KAAK,WAAW,IAAI,GAAG,MAAM,CAAC,GAAG;AACpC,aAAK,WAAW,IAAI,GAAG,MAAM,GAAG,MAAM;AACtC,YAAI;AAAA,MACZ;AAAA,IACA;AAAA,EACA,OAAS;AACL,QAAI;AAAA,EACR;AACE,OAAK,UAAU,GAAG,CAAC,IAAI,OAAO,EAAE,IAAI;AACtC;AAMO,SAAS,eAAe,IAAI,SAAS;AAC1C,MAAI;AACJ,MAAI,OAAO,OAAO,EAAE,GAAG;AACrB,aAAS,UAAU,OAAO,KAAK,EAAE,GAAG;AAClC,UAAI,CAAC,KAAK,WAAW,IAAI,GAAG,MAAM,CAAC,GAAG;AACpC,aAAK,WAAW,IAAI,GAAG,MAAM,GAAG,MAAM;AACtC,YAAI;AAAA,MACZ;AAAA,IACA;AAAA,EACA,OAAS;AACL,QAAI;AAAA,EACR;AACE,SAAO,KAAK,UAAU,GAAG,CAAC,IAAI,OAAO,EAAE;AACzC;","x_google_ignoreList":[0]}
@@ -1,5 +1,23 @@
1
- var reactJsxRuntime_development = {};
1
+ function learnElementNames(XML_dom, namespaces) {
2
+ const root = XML_dom.documentElement;
3
+ let i = 1;
4
+ let qname = function(e) {
5
+ if (!namespaces.has(e.namespaceURI ? e.namespaceURI : "")) {
6
+ namespaces.set(e.namespaceURI, "ns" + i++);
7
+ }
8
+ return namespaces.get(e.namespaceURI ? e.namespaceURI : "") + ":" + e.localName;
9
+ };
10
+ const els = new Set(
11
+ Array.from(root.querySelectorAll("*"), qname)
12
+ );
13
+ els.add(qname(root));
14
+ return els;
15
+ }
16
+ function learnCustomElementNames(HTML_dom) {
17
+ return new Set(Array.from(HTML_dom.querySelectorAll("*[data-origname]"), (e) => e.localName.replace(/(\w+)-.+/, "$1:") + e.getAttribute("data-origname")));
18
+ }
2
19
  export {
3
- reactJsxRuntime_development as __exports
20
+ learnCustomElementNames,
21
+ learnElementNames
4
22
  };
5
23
  //# sourceMappingURL=react-text-annotator.es28.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es28.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"react-text-annotator.es28.js","sources":["../../../node_modules/CETEIcean/src/dom.js"],"sourcesContent":["export function learnElementNames(XML_dom, namespaces) {\n const root = XML_dom.documentElement;\n let i = 1;\n let qname = function(e) { \n if (!namespaces.has(e.namespaceURI ? e.namespaceURI : \"\")) {\n namespaces.set(e.namespaceURI, \"ns\" + i++);\n } \n return namespaces.get(e.namespaceURI ? e.namespaceURI : \"\") + \":\" + e.localName;\n };\n const els = new Set(\n Array.from(root.querySelectorAll(\"*\"), qname));\n \n // Add the root element to the array\n els.add(qname(root));\n return els\n}\n\nexport function learnCustomElementNames(HTML_dom) {\n return new Set(Array.from(HTML_dom.querySelectorAll(\"*[data-origname]\"), e => e.localName.replace(/(\\w+)-.+/,\"$1:\") + e.getAttribute(\"data-origname\")));\n}"],"names":[],"mappings":"AAAO,SAAS,kBAAkB,SAAS,YAAY;AACrD,QAAM,OAAO,QAAQ;AACrB,MAAI,IAAI;AACR,MAAI,QAAQ,SAAS,GAAG;AACtB,QAAI,CAAC,WAAW,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG;AACzD,iBAAW,IAAI,EAAE,cAAc,OAAO,GAAG;AAAA,IAC1C;AACD,WAAO,WAAW,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,IAAI,MAAM,EAAE;AAAA,EACvE;AACD,QAAM,MAAM,IAAI;AAAA,IACd,MAAM,KAAK,KAAK,iBAAiB,GAAG,GAAG,KAAK;AAAA,EAAC;AAG/C,MAAI,IAAI,MAAM,IAAI,CAAC;AACnB,SAAO;AACT;AAEO,SAAS,wBAAwB,UAAU;AAChD,SAAO,IAAI,IAAI,MAAM,KAAK,SAAS,iBAAiB,kBAAkB,GAAG,OAAK,EAAE,UAAU,QAAQ,YAAW,KAAK,IAAI,EAAE,aAAa,eAAe,CAAC,CAAC;AACxJ;","x_google_ignoreList":[0]}
@@ -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.es17.js";
4
- import { exhaustiveUniqueRandom } from "./react-text-annotator.es18.js";
3
+ import { announce as $319e236875307eab$export$a9b970dcc4ae71a9, destroyAnnouncer as $319e236875307eab$export$d8686216b8b81b2f } from "./react-text-annotator.es12.js";
4
+ import { exhaustiveUniqueRandom } from "./react-text-annotator.es13.js";
5
5
  const useAnnouncePopupNavigation = (args) => {
6
6
  const {
7
7
  message = "Press Tab to move to Notes Dialog",
@@ -1,5 +1,5 @@
1
1
  import { useState, useEffect } from "react";
2
- import { dequal } from "./react-text-annotator.es19.js";
2
+ import { dequal } from "./react-text-annotator.es14.js";
3
3
  import { useAnnotationStore, Origin } from "@annotorious/react";
4
4
  import { Ignore } from "@annotorious/core";
5
5
  const useAnnotationQuoteIdling = (annotationId, options = { timeout: 500 }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es6.js","sources":["../src/TextAnnotator.tsx"],"sourcesContent":["import { ReactNode, useContext, useEffect, useRef } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport type { FormatAdapter } from '@annotorious/core';\nimport type { HighlightStyleExpression, TextAnnotation, TextAnnotatorOptions } from '@soomo/text-annotator';\nimport { createTextAnnotator } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport interface TextAnnotatorProps<E extends unknown> extends Omit<TextAnnotatorOptions<TextAnnotation, E>, 'adapter'> {\n\n children?: ReactNode | JSX.Element;\n\n adapter?: FormatAdapter<TextAnnotation, E> | ((container: HTMLElement) => FormatAdapter<TextAnnotation, E>) | null;\n\n filter?: Filter;\n\n style?: HighlightStyleExpression;\n\n className?: string;\n\n}\n\nexport const TextAnnotator = <E extends unknown>(props: TextAnnotatorProps<E>) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n const { className, children, ...opts } = props;\n const { style, filter, user, annotatingEnabled, userSelectAction } = opts;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useEffect(() => {\n if (!setAnno) return;\n\n const adapter = typeof opts.adapter === 'function' ? opts.adapter(el.current) : opts.adapter;\n\n const anno = createTextAnnotator(el.current, { ...opts, adapter });\n setAnno(anno);\n\n return () => anno.destroy();\n }, [setAnno]);\n\n useEffect(() => anno?.setStyle(style), [anno, style]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);\n\n useEffect(() => anno?.setUser(user), [anno, user]);\n\n useEffect(() => anno?.setAnnotatingEnabled(annotatingEnabled), [anno, annotatingEnabled]);\n\n return (\n <div ref={el} className={className}>\n {children}\n </div>\n );\n\n};\n"],"names":["anno","jsx"],"mappings":";;;;;AAsBa,MAAA,gBAAgB,CAAoB,UAAiC;AAE1E,QAAA,KAAK,OAAuB,IAAI;AAEtC,QAAM,EAAE,WAAW,UAAU,GAAG,KAAS,IAAA;AACzC,QAAM,EAAE,OAAO,QAAQ,MAAM,mBAAmB,qBAAqB;AAErE,QAAM,EAAE,MAAM,YAAY,WAAW,kBAAkB;AAEvD,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAER,UAAA,UAAU,OAAO,KAAK,YAAY,aAAa,KAAK,QAAQ,GAAG,OAAO,IAAI,KAAK;AAE/EA,UAAAA,QAAO,oBAAoB,GAAG,SAAS,EAAE,GAAG,MAAM,SAAS;AACjE,YAAQA,KAAI;AAEL,WAAA,MAAMA,MAAK,QAAQ;AAAA,EAAA,GACzB,CAAC,OAAO,CAAC;AAEF,YAAA,MAAM,6BAAM,SAAS,QAAQ,CAAC,MAAM,KAAK,CAAC;AAE1C,YAAA,MAAM,6BAAM,UAAU,SAAS,CAAC,MAAM,MAAM,CAAC;AAE7C,YAAA,MAAM,6BAAM,UAAU,SAAS,CAAC,MAAM,MAAM,CAAC;AAE7C,YAAA,MAAM,6BAAM,oBAAoB,mBAAmB,CAAC,MAAM,gBAAgB,CAAC;AAE3E,YAAA,MAAM,6BAAM,QAAQ,OAAO,CAAC,MAAM,IAAI,CAAC;AAEvC,YAAA,MAAM,6BAAM,qBAAqB,oBAAoB,CAAC,MAAM,iBAAiB,CAAC;AAExF,SACGC,kCAAAA,IAAA,OAAA,EAAI,KAAK,IAAI,WACX,UACH;AAGJ;"}
1
+ {"version":3,"file":"react-text-annotator.es6.js","sources":["../src/TextAnnotator.tsx"],"sourcesContent":["import { ReactNode, useContext, useEffect, useRef } from 'react';\nimport { AnnotoriousContext, Filter } from '@annotorious/react';\nimport type { FormatAdapter } from '@annotorious/core';\nimport type { HighlightStyleExpression, TextAnnotation, TextAnnotatorOptions } from '@soomo/text-annotator';\nimport { createTextAnnotator } from '@soomo/text-annotator';\n\nimport '@soomo/text-annotator/dist/text-annotator.css';\n\nexport interface TextAnnotatorProps<I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation> extends Omit<TextAnnotatorOptions<I, E>, 'adapter'> {\n\n children?: ReactNode | JSX.Element;\n\n adapter?: FormatAdapter<I, E> | ((container: HTMLElement) => FormatAdapter<I, E>) | null;\n\n filter?: Filter<I>;\n\n style?: HighlightStyleExpression;\n\n className?: string;\n\n}\n\nexport const TextAnnotator = <I extends TextAnnotation = TextAnnotation, E extends unknown = TextAnnotation>(\n props: TextAnnotatorProps<I, E>\n) => {\n\n const el = useRef<HTMLDivElement>(null);\n\n const { className, children, ...opts } = props;\n const { style, filter, user, annotatingEnabled, userSelectAction } = opts;\n\n const { anno, setAnno } = useContext(AnnotoriousContext);\n\n useEffect(() => {\n if (!setAnno) return;\n\n const adapter = typeof opts.adapter === 'function' ? opts.adapter(el.current) : opts.adapter;\n\n const anno = createTextAnnotator(el.current, { ...opts, adapter });\n setAnno(anno);\n\n return () => anno.destroy();\n }, [setAnno]);\n\n useEffect(() => anno?.setStyle(style), [anno, style]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setFilter(filter), [anno, filter]);\n\n useEffect(() => anno?.setUserSelectAction(userSelectAction), [anno, userSelectAction]);\n\n useEffect(() => anno?.setUser(user), [anno, user]);\n\n useEffect(() => anno?.setAnnotatingEnabled(annotatingEnabled), [anno, annotatingEnabled]);\n\n return (\n <div ref={el} className={className}>\n {children}\n </div>\n );\n\n};\n"],"names":["anno","jsx"],"mappings":";;;;;AAsBa,MAAA,gBAAgB,CAC3B,UACG;AAEG,QAAA,KAAK,OAAuB,IAAI;AAEtC,QAAM,EAAE,WAAW,UAAU,GAAG,KAAS,IAAA;AACzC,QAAM,EAAE,OAAO,QAAQ,MAAM,mBAAmB,qBAAqB;AAErE,QAAM,EAAE,MAAM,YAAY,WAAW,kBAAkB;AAEvD,YAAU,MAAM;AACd,QAAI,CAAC,QAAS;AAER,UAAA,UAAU,OAAO,KAAK,YAAY,aAAa,KAAK,QAAQ,GAAG,OAAO,IAAI,KAAK;AAE/EA,UAAAA,QAAO,oBAAoB,GAAG,SAAS,EAAE,GAAG,MAAM,SAAS;AACjE,YAAQA,KAAI;AAEL,WAAA,MAAMA,MAAK,QAAQ;AAAA,EAAA,GACzB,CAAC,OAAO,CAAC;AAEF,YAAA,MAAM,6BAAM,SAAS,QAAQ,CAAC,MAAM,KAAK,CAAC;AAE1C,YAAA,MAAM,6BAAM,UAAU,SAAS,CAAC,MAAM,MAAM,CAAC;AAE7C,YAAA,MAAM,6BAAM,UAAU,SAAS,CAAC,MAAM,MAAM,CAAC;AAE7C,YAAA,MAAM,6BAAM,oBAAoB,mBAAmB,CAAC,MAAM,gBAAgB,CAAC;AAE3E,YAAA,MAAM,6BAAM,QAAQ,OAAO,CAAC,MAAM,IAAI,CAAC;AAEvC,YAAA,MAAM,6BAAM,qBAAqB,oBAAoB,CAAC,MAAM,iBAAiB,CAAC;AAExF,SACGC,kCAAAA,IAAA,OAAA,EAAI,KAAK,IAAI,WACX,UACH;AAGJ;"}
@@ -2,13 +2,13 @@ import { j as jsxRuntimeExports } from "./react-text-annotator.es9.js";
2
2
  import { useState, useCallback, useEffect, useRef, useMemo } from "react";
3
3
  import { useAnnotator, useSelection } from "@annotorious/react";
4
4
  import { denormalizeRectWithOffset, toDomRectList, NOT_ANNOTATABLE_CLASS } from "@soomo/text-annotator";
5
- import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, FloatingArrow } from "./react-text-annotator.es12.js";
6
- import { isMobile } from "./react-text-annotator.es13.js";
5
+ import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingFocusManager, FloatingArrow } from "./react-text-annotator.es15.js";
6
+ import { isMobile } from "./react-text-annotator.es16.js";
7
7
  import { useAnnouncePopupNavigation } from "./react-text-annotator.es4.js";
8
8
  import { useAnnotationQuoteIdling } from "./react-text-annotator.es5.js";
9
9
  /* empty css */
10
- import { inline, offset, flip, shift, arrow } from "./react-text-annotator.es15.js";
11
- import { autoUpdate } from "./react-text-annotator.es16.js";
10
+ import { inline, offset, flip, shift, arrow } from "./react-text-annotator.es18.js";
11
+ import { autoUpdate } from "./react-text-annotator.es19.js";
12
12
  const TextAnnotationPopup = (props) => {
13
13
  var _a;
14
14
  const { popup, ariaNavigationMessage } = props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soomo/react-text-annotator",
3
- "version": "3.1.0-staging.20",
3
+ "version": "3.1.0-staging.21",
4
4
  "description": "Recogito Text Annotator React bindings",
5
5
  "author": "Rainer Simon",
6
6
  "license": "BSD-3-Clause",
@@ -1,85 +0,0 @@
1
- const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7e3;
2
- let $319e236875307eab$var$liveAnnouncer = null;
3
- function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
4
- if (!$319e236875307eab$var$liveAnnouncer) {
5
- $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
6
- if (!(typeof IS_REACT_ACT_ENVIRONMENT === "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== "undefined")) setTimeout(() => {
7
- if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
8
- }, 100);
9
- else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
10
- } else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
11
- }
12
- function $319e236875307eab$export$d8686216b8b81b2f() {
13
- if ($319e236875307eab$var$liveAnnouncer) {
14
- $319e236875307eab$var$liveAnnouncer.destroy();
15
- $319e236875307eab$var$liveAnnouncer = null;
16
- }
17
- }
18
- class $319e236875307eab$var$LiveAnnouncer {
19
- isAttached() {
20
- var _this_node;
21
- return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
22
- }
23
- createLog(ariaLive) {
24
- let node = document.createElement("div");
25
- node.setAttribute("role", "log");
26
- node.setAttribute("aria-live", ariaLive);
27
- node.setAttribute("aria-relevant", "additions");
28
- return node;
29
- }
30
- destroy() {
31
- if (!this.node) return;
32
- document.body.removeChild(this.node);
33
- this.node = null;
34
- }
35
- announce(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
36
- var _this_assertiveLog, _this_politeLog;
37
- if (!this.node) return;
38
- let node = document.createElement("div");
39
- if (typeof message === "object") {
40
- node.setAttribute("role", "img");
41
- node.setAttribute("aria-labelledby", message["aria-labelledby"]);
42
- } else node.textContent = message;
43
- if (assertiveness === "assertive") (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);
44
- else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);
45
- if (message !== "") setTimeout(() => {
46
- node.remove();
47
- }, timeout);
48
- }
49
- clear(assertiveness) {
50
- if (!this.node) return;
51
- if ((!assertiveness || assertiveness === "assertive") && this.assertiveLog) this.assertiveLog.innerHTML = "";
52
- if ((!assertiveness || assertiveness === "polite") && this.politeLog) this.politeLog.innerHTML = "";
53
- }
54
- constructor() {
55
- this.node = null;
56
- this.assertiveLog = null;
57
- this.politeLog = null;
58
- if (typeof document !== "undefined") {
59
- this.node = document.createElement("div");
60
- this.node.dataset.liveAnnouncer = "true";
61
- Object.assign(this.node.style, {
62
- border: 0,
63
- clip: "rect(0 0 0 0)",
64
- clipPath: "inset(50%)",
65
- height: "1px",
66
- margin: "-1px",
67
- overflow: "hidden",
68
- padding: 0,
69
- position: "absolute",
70
- width: "1px",
71
- whiteSpace: "nowrap"
72
- });
73
- this.assertiveLog = this.createLog("assertive");
74
- this.node.appendChild(this.assertiveLog);
75
- this.politeLog = this.createLog("polite");
76
- this.node.appendChild(this.politeLog);
77
- document.body.prepend(this.node);
78
- }
79
- }
80
- }
81
- export {
82
- $319e236875307eab$export$a9b970dcc4ae71a9 as announce,
83
- $319e236875307eab$export$d8686216b8b81b2f as destroyAnnouncer
84
- };
85
- //# sourceMappingURL=react-text-annotator.es17.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-text-annotator.es17.js","sources":["../../../node_modules/@react-aria/live-announcer/dist/LiveAnnouncer.mjs"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */ /* Inspired by https://github.com/AlmeroSteyn/react-aria-live */ const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7000;\nlet $319e236875307eab$var$liveAnnouncer = null;\nfunction $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {\n if (!$319e236875307eab$var$liveAnnouncer) {\n $319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();\n // wait for the live announcer regions to be added to the dom, then announce\n // otherwise Safari won't announce the message if it's added too quickly\n // found most times less than 100ms were not consistent when announcing with Safari\n // IS_REACT_ACT_ENVIRONMENT is used by React 18. Previous versions checked for the `jest` global.\n // https://github.com/reactwg/react-18/discussions/102\n // if we're in a test environment, announce without waiting\n // @ts-ignore\n if (!(typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== 'undefined')) setTimeout(()=>{\n if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n }, 100);\n else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n } else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);\n}\nfunction $319e236875307eab$export$d10ae4f68404609a(assertiveness) {\n if ($319e236875307eab$var$liveAnnouncer) $319e236875307eab$var$liveAnnouncer.clear(assertiveness);\n}\nfunction $319e236875307eab$export$d8686216b8b81b2f() {\n if ($319e236875307eab$var$liveAnnouncer) {\n $319e236875307eab$var$liveAnnouncer.destroy();\n $319e236875307eab$var$liveAnnouncer = null;\n }\n}\n// LiveAnnouncer is implemented using vanilla DOM, not React. That's because as of React 18\n// ReactDOM.render is deprecated, and the replacement, ReactDOM.createRoot is moved into a\n// subpath import `react-dom/client`. That makes it hard for us to support multiple React versions.\n// As a global API, we can't use portals without introducing a breaking API change. LiveAnnouncer\n// is simple enough to implement without React, so that's what we do here.\n// See this discussion for more details: https://github.com/reactwg/react-18/discussions/125#discussioncomment-2382638\nclass $319e236875307eab$var$LiveAnnouncer {\n isAttached() {\n var _this_node;\n return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;\n }\n createLog(ariaLive) {\n let node = document.createElement('div');\n node.setAttribute('role', 'log');\n node.setAttribute('aria-live', ariaLive);\n node.setAttribute('aria-relevant', 'additions');\n return node;\n }\n destroy() {\n if (!this.node) return;\n document.body.removeChild(this.node);\n this.node = null;\n }\n announce(message, assertiveness = 'assertive', timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {\n var _this_assertiveLog, _this_politeLog;\n if (!this.node) return;\n let node = document.createElement('div');\n if (typeof message === 'object') {\n // To read an aria-labelledby, the element must have an appropriate role, such as img.\n node.setAttribute('role', 'img');\n node.setAttribute('aria-labelledby', message['aria-labelledby']);\n } else node.textContent = message;\n if (assertiveness === 'assertive') (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);\n else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);\n if (message !== '') setTimeout(()=>{\n node.remove();\n }, timeout);\n }\n clear(assertiveness) {\n if (!this.node) return;\n if ((!assertiveness || assertiveness === 'assertive') && this.assertiveLog) this.assertiveLog.innerHTML = '';\n if ((!assertiveness || assertiveness === 'polite') && this.politeLog) this.politeLog.innerHTML = '';\n }\n constructor(){\n this.node = null;\n this.assertiveLog = null;\n this.politeLog = null;\n if (typeof document !== 'undefined') {\n this.node = document.createElement('div');\n this.node.dataset.liveAnnouncer = 'true';\n // copied from VisuallyHidden\n Object.assign(this.node.style, {\n border: 0,\n clip: 'rect(0 0 0 0)',\n clipPath: 'inset(50%)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: 0,\n position: 'absolute',\n width: '1px',\n whiteSpace: 'nowrap'\n });\n this.assertiveLog = this.createLog('assertive');\n this.node.appendChild(this.assertiveLog);\n this.politeLog = this.createLog('polite');\n this.node.appendChild(this.politeLog);\n document.body.prepend(this.node);\n }\n }\n}\n\n\nexport {$319e236875307eab$export$a9b970dcc4ae71a9 as announce, $319e236875307eab$export$d10ae4f68404609a as clearAnnouncer, $319e236875307eab$export$d8686216b8b81b2f as destroyAnnouncer};\n//# sourceMappingURL=LiveAnnouncer.module.js.map\n"],"names":[],"mappings":"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","x_google_ignoreList":[0]}