@soomo/react-text-annotator 3.0.0-staging.36 → 3.0.0-staging.38

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,5 +1,61 @@
1
- var reactJsxRuntime_production_min = {};
1
+ function addBehaviors(bhvs) {
2
+ if (bhvs.namespaces) {
3
+ for (let prefix of Object.keys(bhvs.namespaces)) {
4
+ if (!this.namespaces.has(bhvs.namespaces[prefix]) && !Array.from(this.namespaces.values()).includes(prefix)) {
5
+ this.namespaces.set(bhvs.namespaces[prefix], prefix);
6
+ }
7
+ }
8
+ }
9
+ for (let prefix of this.namespaces.values()) {
10
+ if (bhvs[prefix]) {
11
+ for (let b of Object.keys(bhvs[prefix])) {
12
+ this.behaviors[`${prefix}:${b}`] = bhvs[prefix][b];
13
+ }
14
+ }
15
+ }
16
+ if (bhvs["functions"]) {
17
+ for (let fn of Object.keys(bhvs["functions"])) {
18
+ this.utilities[fn] = bhvs["functions"][fn].bind(this.utilities);
19
+ }
20
+ }
21
+ if (bhvs["handlers"]) {
22
+ console.log("Behavior handlers are no longer used.");
23
+ }
24
+ if (bhvs["fallbacks"]) {
25
+ console.log("Fallback behaviors are no longer used.");
26
+ }
27
+ }
28
+ function addBehavior(ns, element, b) {
29
+ let p;
30
+ if (ns === Object(ns)) {
31
+ for (let prefix of Object.keys(ns)) {
32
+ if (!this.namespaces.has(ns[prefix])) {
33
+ this.namespaces.set(ns[prefix], prefix);
34
+ p = prefix;
35
+ }
36
+ }
37
+ } else {
38
+ p = ns;
39
+ }
40
+ this.behaviors[`${p}:${element}`] = b;
41
+ }
42
+ function removeBehavior(ns, element) {
43
+ let p;
44
+ if (ns === Object(ns)) {
45
+ for (let prefix of Object.keys(ns)) {
46
+ if (!this.namespaces.has(ns[prefix])) {
47
+ this.namespaces.set(ns[prefix], prefix);
48
+ p = prefix;
49
+ }
50
+ }
51
+ } else {
52
+ p = ns;
53
+ }
54
+ delete this.behaviors[`${p}:${element}`];
55
+ }
2
56
  export {
3
- reactJsxRuntime_production_min as __exports
57
+ addBehavior,
58
+ addBehaviors,
59
+ removeBehavior
4
60
  };
5
61
  //# sourceMappingURL=react-text-annotator.es22.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es22.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"react-text-annotator.es22.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,MACpD;AAAA,IACF;AAAA,EACF;AACD,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,MAClD;AAAA,IACF;AAAA,EACF;AACD,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,IAC/D;AAAA,EACF;AACD,MAAI,KAAK,UAAU,GAAG;AACpB,YAAQ,IAAI,uCAAuC;AAAA,EACpD;AACD,MAAI,KAAK,WAAW,GAAG;AACrB,YAAQ,IAAI,wCAAwC;AAAA,EACrD;AACH;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,MACL;AAAA,IACF;AAAA,EACL,OAAS;AACL,QAAI;AAAA,EACL;AACD,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,MACL;AAAA,IACF;AAAA,EACL,OAAS;AACL,QAAI;AAAA,EACL;AACD,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.es23.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react-text-annotator.es23.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"react-text-annotator.es23.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,EAC1E;AACE,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,6 +1,6 @@
1
- import { __module as jsxRuntime } from "./react-text-annotator.es13.js";
2
- import { __require as requireReactJsxRuntime_production_min } from "./react-text-annotator.es14.js";
3
- import { __require as requireReactJsxRuntime_development } from "./react-text-annotator.es15.js";
1
+ import { __module as jsxRuntime } from "./react-text-annotator.es15.js";
2
+ import { __require as requireReactJsxRuntime_production_min } from "./react-text-annotator.es16.js";
3
+ import { __require as requireReactJsxRuntime_development } from "./react-text-annotator.es17.js";
4
4
  if (process.env.NODE_ENV === "production") {
5
5
  jsxRuntime.exports = requireReactJsxRuntime_production_min();
6
6
  } else {
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useLayoutEffect, useEffect } from "react";
3
- import { getDocument, isReactEvent, getTarget, isRootElement, contains, isEventTargetWithin } from "./react-text-annotator.es16.js";
4
- import { isElement, getOverflowAncestors, isLastTraversableNode, getParentNode, isHTMLElement, getComputedStyle } from "./react-text-annotator.es17.js";
3
+ import { getDocument, isReactEvent, getTarget, isRootElement, contains, isEventTargetWithin } from "./react-text-annotator.es13.js";
4
+ import { isElement, getOverflowAncestors, isLastTraversableNode, getParentNode, isHTMLElement, getComputedStyle } from "./react-text-annotator.es14.js";
5
5
  import "react-dom";
6
6
  import { useFloating as useFloating$1 } from "./react-text-annotator.es10.js";
7
7
  import { flip, inline, offset, shift } from "./react-text-annotator.es10.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soomo/react-text-annotator",
3
- "version": "3.0.0-staging.36",
3
+ "version": "3.0.0-staging.38",
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.20",
51
- "@soomo/text-annotator": "3.0.0-staging.36",
51
+ "@soomo/text-annotator": "3.0.0-staging.38",
52
52
  "@recogito/text-annotator-tei": "3.0.0-rc.39",
53
53
  "CETEIcean": "^1.9.3"
54
54
  }