@soomo/react-text-annotator 3.1.0-staging.2 → 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 (86) hide show
  1. package/dist/TextAnnotationPopup/TextAnnotationPopup.d.ts +21 -0
  2. package/dist/TextAnnotationPopup/TextAnnotationPopup.d.ts.map +1 -0
  3. package/dist/TextAnnotationPopup/index.d.ts +2 -0
  4. package/dist/TextAnnotationPopup/index.d.ts.map +1 -0
  5. package/dist/TextAnnotationPopup/isMobile.d.ts.map +1 -0
  6. package/dist/TextAnnotator.d.ts +4 -4
  7. package/dist/TextAnnotator.d.ts.map +1 -1
  8. package/dist/hooks/index.d.ts +2 -1
  9. package/dist/hooks/index.d.ts.map +1 -1
  10. package/dist/hooks/useAnnotationQuoteIdling.d.ts +4 -0
  11. package/dist/hooks/useAnnotationQuoteIdling.d.ts.map +1 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/react-text-annotator.es.js +6 -3
  15. package/dist/react-text-annotator.es.js.map +1 -1
  16. package/dist/react-text-annotator.es11.js +483 -78
  17. package/dist/react-text-annotator.es11.js.map +1 -1
  18. package/dist/react-text-annotator.es12.js +77 -40
  19. package/dist/react-text-annotator.es12.js.map +1 -1
  20. package/dist/react-text-annotator.es13.js +45 -9
  21. package/dist/react-text-annotator.es13.js.map +1 -1
  22. package/dist/react-text-annotator.es14.js +19 -1442
  23. package/dist/react-text-annotator.es14.js.map +1 -1
  24. package/dist/react-text-annotator.es15.js +1600 -0
  25. package/dist/react-text-annotator.es15.js.map +1 -0
  26. package/dist/react-text-annotator.es16.js +7 -244
  27. package/dist/react-text-annotator.es16.js.map +1 -1
  28. package/dist/react-text-annotator.es18.js +282 -2
  29. package/dist/react-text-annotator.es18.js.map +1 -1
  30. package/dist/react-text-annotator.es19.js +586 -30
  31. package/dist/react-text-annotator.es19.js.map +1 -1
  32. package/dist/react-text-annotator.es2.js +2 -2
  33. package/dist/react-text-annotator.es2.js.map +1 -1
  34. package/dist/react-text-annotator.es20.js +2 -898
  35. package/dist/react-text-annotator.es20.js.map +1 -1
  36. package/dist/react-text-annotator.es21.js +30 -113
  37. package/dist/react-text-annotator.es21.js.map +1 -1
  38. package/dist/react-text-annotator.es22.js +886 -297
  39. package/dist/react-text-annotator.es22.js.map +1 -1
  40. package/dist/react-text-annotator.es23.js +2 -58
  41. package/dist/react-text-annotator.es23.js.map +1 -1
  42. package/dist/react-text-annotator.es24.js +2 -20
  43. package/dist/react-text-annotator.es24.js.map +1 -1
  44. package/dist/react-text-annotator.es25.js +114 -2
  45. package/dist/react-text-annotator.es25.js.map +1 -1
  46. package/dist/react-text-annotator.es26.js +309 -2
  47. package/dist/react-text-annotator.es26.js.map +1 -1
  48. package/dist/react-text-annotator.es27.js +48 -117
  49. package/dist/react-text-annotator.es27.js.map +1 -1
  50. package/dist/react-text-annotator.es28.js +15 -159
  51. package/dist/react-text-annotator.es28.js.map +1 -1
  52. package/dist/react-text-annotator.es29.js +115 -299
  53. package/dist/react-text-annotator.es29.js.map +1 -1
  54. package/dist/react-text-annotator.es3.js +2 -2
  55. package/dist/react-text-annotator.es3.js.map +1 -1
  56. package/dist/react-text-annotator.es30.js +146 -131
  57. package/dist/react-text-annotator.es30.js.map +1 -1
  58. package/dist/react-text-annotator.es31.js +281 -533
  59. package/dist/react-text-annotator.es31.js.map +1 -1
  60. package/dist/react-text-annotator.es32.js +152 -0
  61. package/dist/react-text-annotator.es32.js.map +1 -0
  62. package/dist/react-text-annotator.es33.js +629 -0
  63. package/dist/react-text-annotator.es33.js.map +1 -0
  64. package/dist/react-text-annotator.es4.js +2 -2
  65. package/dist/react-text-annotator.es4.js.map +1 -1
  66. package/dist/react-text-annotator.es5.js +43 -24
  67. package/dist/react-text-annotator.es5.js.map +1 -1
  68. package/dist/react-text-annotator.es6.js +23 -124
  69. package/dist/react-text-annotator.es6.js.map +1 -1
  70. package/dist/react-text-annotator.es7.js +141 -537
  71. package/dist/react-text-annotator.es7.js.map +1 -1
  72. package/dist/react-text-annotator.es8.js +559 -10
  73. package/dist/react-text-annotator.es8.js.map +1 -1
  74. package/dist/react-text-annotator.es9.js +13 -0
  75. package/dist/react-text-annotator.es9.js.map +1 -0
  76. package/package.json +13 -12
  77. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts +0 -15
  78. package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +0 -1
  79. package/dist/TextAnnotatorPopup/index.d.ts +0 -2
  80. package/dist/TextAnnotatorPopup/index.d.ts.map +0 -1
  81. package/dist/TextAnnotatorPopup/isMobile.d.ts.map +0 -1
  82. package/dist/react-text-annotator.es10.js +0 -490
  83. package/dist/react-text-annotator.es10.js.map +0 -1
  84. package/dist/react-text-annotator.es17.js +0 -588
  85. package/dist/react-text-annotator.es17.js.map +0 -1
  86. /package/dist/{TextAnnotatorPopup → TextAnnotationPopup}/isMobile.d.ts +0 -0
@@ -1,490 +0,0 @@
1
- import defaultBehaviors from "./react-text-annotator.es21.js";
2
- import * as utilities from "./react-text-annotator.es22.js";
3
- import { hideContent, defineCustomElement, tagName } from "./react-text-annotator.es22.js";
4
- import { addBehaviors, addBehavior, removeBehavior } from "./react-text-annotator.es23.js";
5
- import { learnElementNames, learnCustomElementNames } from "./react-text-annotator.es24.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.es10.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react-text-annotator.es10.js","sources":["../../../node_modules/CETEIcean/src/CETEI.js"],"sourcesContent":["import defaultBehaviors from './defaultBehaviors.js';\nimport * as utilities from './utilities.js';\nimport {addBehaviors, addBehavior, removeBehavior} from './behaviors.js';\nimport {learnElementNames, learnCustomElementNames} from './dom.js';\n\nclass CETEI {\n constructor(options){\n this.options = options ? options : {}\n\n // Set a local reference to the Document object\n // Determine document in this order of preference: options, window, global \n this.document = this.options.documentObject ? this.options.documentObject : undefined\n if (this.document === undefined) {\n if (typeof window !== 'undefined' && window.document) {\n this.document = window.document\n } else if (typeof global !== 'undefined' && global.document) {\n this.document = global.document\n }\n }\n\n // Bind methods\n this.addBehaviors = addBehaviors.bind(this);\n this.addBehavior = addBehavior.bind(this);\n this.removeBehavior = removeBehavior.bind(this);\n\n // Bind selected utilities\n this.utilities = {}\n for (const u of Object.keys(utilities)) {\n if ([\"getPrefixDef\", \"rw\", \"resolveURI\"].includes(u)) {\n this.utilities[u] = utilities[u].bind(this);\n } else {\n this.utilities[u] = utilities[u];\n }\n }\n\n // Set properties\n this.els = [];\n this.namespaces = new Map();\n this.behaviors = {};\n this.hasStyle = false;\n this.prefixDefs = [];\n this.debug = this.options.debug === true ? true : false;\n this.discardContent = this.options.discardContent === true ? true : false;\n\n if (this.options.base) {\n this.base = this.options.base;\n } else {\n try {\n if (window) {\n this.base = window.location.href.replace(/\\/[^\\/]*$/, \"/\");\n }\n } catch (e) {\n this.base = \"\";\n }\n }\n if (!this.options.omitDefaultBehaviors) {\n this.addBehaviors(defaultBehaviors);\n }\n if (this.options.ignoreFragmentId) {\n if (window) {\n window.removeEventListener(\"ceteiceanload\", CETEI.restorePosition);\n }\n }\n }\n\n /* \n Returns a Promise that fetches an XML source document from the URL\n provided in the first parameter and then calls the makeHTML5 method\n on the returned document.\n */\n async getHTML5(XML_url, callback, perElementFn){\n if (window && window.location.href.startsWith(this.base) && (XML_url.indexOf(\"/\") >= 0)) {\n this.base = XML_url.replace(/\\/[^\\/]*$/, \"/\");\n }\n try {\n const response = await fetch(XML_url);\n if (response.ok) {\n const XML = await response.text();\n return this.makeHTML5(XML, callback, perElementFn);\n } else {\n console.log(`Could not get XML file ${XML_url}.\\nServer returned ${response.status}: ${response.statusText}`);\n }\n }\n catch (error) {\n console.log(error);\n }\n }\n\n /* \n Converts the supplied XML string into HTML5 Custom Elements. If a callback\n function is supplied, calls it on the result.\n */\n makeHTML5(XML, callback, perElementFn){\n // XML is assumed to be a string\n this.XML_dom = ( new DOMParser() ).parseFromString(XML, \"text/xml\");\n return this.domToHTML5(this.XML_dom, callback, perElementFn);\n }\n\n preprocess(XML_dom, callback, perElementFn) {\n this.els = learnElementNames(XML_dom, this.namespaces);\n\n let convertEl = (el) => {\n // Elements with defined namespaces get the prefix mapped to that element. All others keep\n // their namespaces and are copied as-is.\n let newElement;\n if (this.namespaces.has(el.namespaceURI ? el.namespaceURI : \"\")) {\n let prefix = this.namespaces.get(el.namespaceURI ? el.namespaceURI : \"\");\n newElement = this.document.createElement(`${prefix}-${el.localName.toLowerCase()}`);\n } else {\n newElement = this.document.importNode(el, false);\n }\n // Copy attributes; @xmlns, @xml:id, @xml:lang, and\n // @rendition get special handling.\n for (let att of Array.from(el.attributes)) {\n if (att.name == \"xmlns\") {\n //Strip default namespaces, but hang on to the values\n newElement.setAttribute(\"data-xmlns\", att.value);\n } else {\n newElement.setAttribute(att.name, att.value);\n }\n if (att.name == \"xml:id\") {\n newElement.setAttribute(\"id\", att.value);\n }\n if (att.name == \"xml:lang\") {\n newElement.setAttribute(\"lang\", att.value);\n }\n if (att.name == \"rendition\") {\n newElement.setAttribute(\"class\", att.value.replace(/#/g, \"\"));\n }\n }\n // Preserve element name so we can use it later\n newElement.setAttribute(\"data-origname\", el.localName);\n if (el.hasAttributes()) {\n newElement.setAttribute(\"data-origatts\", el.getAttributeNames().join(\" \"));\n }\n // If element is empty, flag it\n if (el.childNodes.length == 0) {\n newElement.setAttribute(\"data-empty\", \"\");\n }\n // <head> elements need to know their level\n if (el.localName == \"head\") {\n // 1 is XPathResult.NUMBER_TYPE\n let level = XML_dom.evaluate(\"count(ancestor::*[tei:head])\", el, function(ns) {\n if (ns == \"tei\") return \"http://www.tei-c.org/ns/1.0\";\n }, 1, null);\n newElement.setAttribute(\"data-level\", level.numberValue);\n }\n // Turn <rendition scheme=\"css\"> elements into HTML styles\n if (el.localName == \"tagsDecl\") {\n let style = this.document.createElement(\"style\");\n for (let node of Array.from(el.childNodes)){\n // nodeType 1 is Node.ELEMENT_NODE\n if (node.nodeType == 1 && node.localName == \"rendition\" && node.getAttribute(\"scheme\") == \"css\") {\n let rule = \"\";\n if (node.hasAttribute(\"selector\")) {\n //rewrite element names in selectors\n rule += node.getAttribute(\"selector\").replace(/([^#, >]+\\w*)/g, \"tei-$1\").replace(/#tei-/g, \"#\") + \"{\\n\";\n rule += node.textContent;\n } else {\n rule += \".\" + node.getAttribute(\"xml:id\") + \"{\\n\";\n rule += node.textContent;\n }\n rule += \"\\n}\\n\";\n style.appendChild(this.document.createTextNode(rule));\n }\n }\n if (style.childNodes.length > 0) {\n newElement.appendChild(style);\n this.hasStyle = true;\n }\n }\n // Get prefix definitions\n if (el.localName == \"prefixDef\") {\n this.prefixDefs.push(el.getAttribute(\"ident\"));\n this.prefixDefs[el.getAttribute(\"ident\")] = {\n \"matchPattern\": el.getAttribute(\"matchPattern\"),\n \"replacementPattern\": el.getAttribute(\"replacementPattern\")\n };\n }\n for (let node of Array.from(el.childNodes)) {\n // Node.ELEMENT_NODE\n if (node.nodeType == 1 ) {\n newElement.appendChild(convertEl(node));\n }\n else {\n newElement.appendChild(node.cloneNode());\n }\n }\n if (perElementFn) {\n perElementFn(newElement, el);\n }\n return newElement;\n }\n\n this.dom = this.document.createDocumentFragment();\n for (let node of Array.from(XML_dom.childNodes)) {\n // Node.ELEMENT_NODE\n if (node.nodeType == 1) {\n this.dom.appendChild(convertEl(node));\n }\n // Node.PROCESSING_INSTRUCTION_NODE\n if (node.nodeType == 7) {\n this.dom.appendChild(this.document.importNode(node, true));\n }\n // Node.COMMENT_NODE\n if (node.nodeType == 8) {\n this.dom.appendChild(this.document.importNode(node, true));\n }\n }\n // DocumentFragments don't work in the same ways as other nodes, so use the root element.\n this.utilities.dom = this.dom.firstElementChild;\n\n if (callback) {\n callback(this.dom, this);\n if (window) {\n window.dispatchEvent(ceteiceanLoad);\n }\n } else {\n if (typeof window !== 'undefined') {\n window.dispatchEvent(ceteiceanLoad);\n }\n return this.dom;\n }\n }\n\n /* \n Converts the supplied XML DOM into HTML5 Custom Elements. If a callback\n function is supplied, calls it on the result.\n */\n domToHTML5(XML_dom, callback, perElementFn){\n\n this.preprocess(XML_dom, null, perElementFn);\n\n this.applyBehaviors();\n this.done = true;\n if (callback) {\n callback(this.dom, this);\n if (window) {\n window.dispatchEvent(ceteiceanLoad);\n }\n } else {\n if (typeof window !== 'undefined') {\n window.dispatchEvent(ceteiceanLoad);\n }\n return this.dom;\n }\n }\n\n /*\n Convenience method for HTML pages containing pre-processed CETEIcean Custom \n Elements. Usage:\n const c = new CETEI();\n c.processPage();\n */\n processPage() {\n this.els = learnCustomElementNames(this.document);\n this.applyBehaviors();\n if (window) {\n window.dispatchEvent(ceteiceanLoad);\n }\n }\n\n /* \n To change a namespace -> prefix mapping, the namespace must first be \n unset. Takes a namespace URI. In order to process a TEI P4 document, e.g.,\n the TEI namespace must be unset before it can be set to the empty string.\n */\n unsetNamespace(ns) {\n this.namespaces.delete(ns);\n }\n\n /* \n Sets the base URL for the document. Used to rewrite relative links in the\n XML source (which may be in a completely different location from the HTML\n wrapper).\n */\n setBaseUrl(base) {\n this.base = base;\n }\n\n /* \n Appends any element returned by the function passed in the first\n parameter to the element in the second parameter. If the function\n returns nothing, this is a no-op aside from any side effects caused\n by the provided function.\n\n Called by getHandler() and fallback()\n */\nappend(fn, elt) {\n let self = this;\n if (elt && !elt.hasAttribute('data-processed')) {\n let content = fn.call(self.utilities, elt);\n if (content) {\n self.appendBasic(elt, content);\n }\n } else {\n return function() {\n if (!this.hasAttribute(\"data-processed\")) {\n let content = fn.call(self.utilities, this);\n if (content) {\n self.appendBasic(this, content);\n }\n }\n }\n }\n}\n\nappendBasic(elt, content) {\n if (this.discardContent) {\n elt.innerHTML = \"\";\n } else {\n utilities.hideContent(elt, true);\n }\n elt.appendChild(content);\n}\n\n// Given an element, return its qualified name as defined in a behaviors object\nbName(e) {\n return e.tagName.substring(0,e.tagName.indexOf(\"-\")).toLowerCase() + \":\" + e.getAttribute(\"data-origname\");\n}\n\n/* \n Private method called by append(). Takes a child element and a name, and recurses through the\n child's siblings until an element with that name is found, returning true if it is and false if not.\n*/\nchildExists(elt, name) {\n if (elt && elt.nodeName == name) {\n return true;\n } else {\n return elt && elt.nextElementSibling && this.childExists(elt.nextElementSibling, name);\n }\n}\n\n/* \n Takes a template in the form of either an array of 1 or 2 \n strings or an object with CSS selector keys and either functions\n or arrays as described above. Returns a closure around a function \n that can be called in the element constructor or applied to an \n individual element. An empty array is considered a no-op.\n\n Called by the getHandler() and getFallback() methods\n*/\ndecorator(template) {\n if (Array.isArray(template) && template.length == 0) {\n return function(e) {};\n }\n if (Array.isArray(template) && !Array.isArray(template[0])) {\n return this.applyDecorator(template)\n } \n let self = this;\n return function(elt) {\n for (let rule of template) {\n if (elt.matches(rule[0]) || rule[0] === \"_\") {\n if (Array.isArray(rule[1])) {\n return self.decorator(rule[1]).call(this, elt);\n } else {\n return rule[1].call(this, elt);\n }\n }\n }\n }\n}\n\napplyDecorator(strings) {\n let self = this;\n return function (elt) {\n let copy = [];\n for (let i = 0; i < strings.length; i++) {\n copy.push(self.template(strings[i], elt));\n }\n return self.insert(elt, copy);\n }\n}\n\n/* \n Returns the fallback function for the given element name.\n Called by fallback().\n*/\ngetFallback(behaviors, fn) {\n if (behaviors[fn]) {\n if (behaviors[fn] instanceof Function) {\n return behaviors[fn];\n } else {\n return this.decorator(behaviors[fn]);\n }\n }\n}\n\n/* \n Returns the handler function for the given element name\n Called by define().\n*/\ngetHandler(behaviors, fn) {\n if (behaviors[fn]) {\n if (behaviors[fn] instanceof Function) {\n return this.append(behaviors[fn]);\n } else {\n return this.append(this.decorator(behaviors[fn]));\n }\n }\n}\n\ninsert(elt, strings) {\n let content = this.document.createElement(\"cetei-content\");\n for (let node of Array.from(elt.childNodes)) {\n // nodeType 1 is Node.ELEMENT_NODE\n if (node.nodeType === 1 && !node.hasAttribute(\"data-processed\")) {\n this.processElement(node);\n }\n } \n // If we have before and after tags have them parsed by\n // .innerHTML and then add the content to the resulting child\n if (strings[0].match(\"<[^>]+>\") && strings[1] && strings[1].match(\"<[^>]+>\")) { \n content.innerHTML = strings[0] + elt.innerHTML + (strings[1]?strings[1]:\"\");\n } else {\n content.innerHTML = strings[0];\n content.setAttribute(\"data-before\", strings[0].replace(/<[^>]+>/g,\"\").length);\n for (let node of Array.from(elt.childNodes)) {\n content.appendChild(node.cloneNode(true));\n }\n if (strings.length > 1) {\n content.innerHTML += strings[1];\n content.setAttribute(\"data-after\", strings[1].replace(/<[^>]+>/g,\"\").length);\n } \n }\n if (content.childNodes.length < 2) {\n return content.firstChild;\n } else {\n return content;\n }\n}\n\n// Runs behaviors recursively on the supplied element and children\nprocessElement(elt) {\n if (elt.hasAttribute(\"data-origname\") && ! elt.hasAttribute(\"data-processed\")) {\n let fn = this.getFallback(this.bName(elt));\n if (fn) {\n this.append(fn,elt);\n elt.setAttribute(\"data-processed\", \"\");\n }\n }\n for (let node of Array.from(elt.childNodes)) {\n // nodeType 1 is Node.ELEMENT_NODE\n if (node.nodeType === 1) {\n this.processElement(node);\n }\n }\n}\n\ntemplate(str, elt) {\n let result = str;\n if (str.search(/\\$(\\w*)(@([a-zA-Z:]+))/ )) {\n let re = /\\$(\\w*)@([a-zA-Z:]+)/g;\n let replacements;\n while (replacements = re.exec(str)) {\n if (elt.hasAttribute(replacements[2])) {\n if (replacements[1] && this.utilities[replacements[1]]) {\n result = result.replace(replacements[0], this.utilities[replacements[1]](elt.getAttribute(replacements[2])));\n } else {\n result = result.replace(replacements[0], elt.getAttribute(replacements[2]));\n }\n } else {\n result = result.replace(replacements[0], \"\");\n }\n }\n }\n return result;\n}\n\n// Define or apply behaviors for the document\napplyBehaviors() {\n if (typeof window !== 'undefined' && window.customElements) {\n this.define.call(this, this.els);\n } else {\n this.fallback.call(this, this.els);\n }\n}\n\n/* \n Registers the list of elements provided with the browser.\n Called by makeHTML5(), but can be called independently if, for example,\n you've created Custom Elements via an XSLT transformation instead.\n*/\ndefine(names) {\n for (let name of names) {\n const fn = this.getHandler(this.behaviors, name);\n utilities.defineCustomElement(name, fn, this.debug);\n }\n}\n\n/* \n Provides fallback functionality for environments where Custom Elements\n are not supported.\n\n Like define(), this is called by makeHTML5(), but can be called\n independently.\n*/\nfallback(names) {\n for (let name of names) {\n let fn = this.getFallback(this.behaviors, name);\n if (fn) {\n for (let elt of Array.from((\n this.dom && !this.done \n ? this.dom\n : this.document\n ).querySelectorAll(utilities.tagName(name)))) {\n if (!elt.hasAttribute(\"data-processed\")) {\n this.append(fn, elt);\n elt.setAttribute(\"data-processed\", \"\");\n }\n }\n }\n }\n}\n\n /**********************\n * Utility functions *\n **********************/\n\n \n static savePosition() {\n window.sessionStorage.setItem(window.location + \"-scroll\", window.scrollY);\n }\n \n static restorePosition() {\n if (!window.location.hash) {\n let scroll;\n if (scroll = window.sessionStorage.getItem(window.location + \"-scroll\")) {\n window.sessionStorage.removeItem(window.location + \"-scroll\");\n setTimeout(function() {\n window.scrollTo(0, scroll);\n }, 100);\n }\n } else {\n setTimeout(function() {\n let h = this.document.querySelector(window.decodeURI(window.location.hash));\n if (h) {\n h.scrollIntoView();\n }\n }, 100);\n }\n }\n\n}\n\ntry {\n if (typeof window !== 'undefined') {\n window.CETEI = CETEI;\n window.addEventListener(\"beforeunload\", CETEI.savePosition);\n var ceteiceanLoad = new Event(\"ceteiceanload\");\n window.addEventListener(\"ceteiceanload\", CETEI.restorePosition);\n }\n} catch (e) {\n console.log(e);\n}\n\nexport default CETEI;\n"],"names":["utilities.hideContent","utilities.defineCustomElement","utilities.tagName"],"mappings":";;;;;AAKA,MAAM,MAAM;AAAA,EACV,YAAY,SAAQ;AAClB,SAAK,UAAU,UAAU,UAAU,CAAE;AAIrC,SAAK,WAAW,KAAK,QAAQ,iBAAiB,KAAK,QAAQ,iBAAiB;AAC5E,QAAI,KAAK,aAAa,QAAW;AAC/B,UAAI,OAAO,WAAW,eAAe,OAAO,UAAU;AACpD,aAAK,WAAW,OAAO;AAAA,MACxB,WAAU,OAAO,WAAW,eAAe,OAAO,UAAU;AAC3D,aAAK,WA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