@soomo/react-text-annotator 3.0.0-staging.41 → 3.0.0-staging.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-text-annotator.es11.js +417 -1381
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +67 -0
- package/dist/react-text-annotator.es12.js.map +1 -0
- package/dist/react-text-annotator.es13.js +36 -232
- package/dist/react-text-annotator.es13.js.map +1 -1
- package/dist/react-text-annotator.es14.js +1373 -491
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es16.js +234 -57
- package/dist/react-text-annotator.es16.js.map +1 -1
- package/dist/react-text-annotator.es17.js +557 -33
- package/dist/react-text-annotator.es17.js.map +1 -1
- package/dist/react-text-annotator.es19.js +1 -1
- package/dist/react-text-annotator.es2.js +1 -1
- package/dist/react-text-annotator.es20.js +1 -1
- package/dist/react-text-annotator.es21.js +2 -127
- package/dist/react-text-annotator.es21.js.map +1 -1
- package/dist/react-text-annotator.es22.js +2 -152
- package/dist/react-text-annotator.es22.js.map +1 -1
- package/dist/react-text-annotator.es23.js +104 -301
- package/dist/react-text-annotator.es23.js.map +1 -1
- package/dist/react-text-annotator.es24.js +302 -107
- package/dist/react-text-annotator.es24.js.map +1 -1
- package/dist/react-text-annotator.es25.js +39 -290
- package/dist/react-text-annotator.es25.js.map +1 -1
- package/dist/react-text-annotator.es26.js +17 -55
- package/dist/react-text-annotator.es26.js.map +1 -1
- package/dist/react-text-annotator.es27.js +124 -17
- package/dist/react-text-annotator.es27.js.map +1 -1
- package/dist/react-text-annotator.es28.js +152 -2
- package/dist/react-text-annotator.es28.js.map +1 -1
- package/dist/react-text-annotator.es29.js +311 -2
- package/dist/react-text-annotator.es29.js.map +1 -1
- package/dist/react-text-annotator.es5.js +2 -2
- package/dist/react-text-annotator.es7.js +3 -3
- package/package.json +2 -2
- package/dist/react-text-annotator.es15.js +0 -490
- package/dist/react-text-annotator.es15.js.map +0 -1
|
@@ -1,1454 +1,490 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
-
args[_key] = arguments[_key];
|
|
26
|
-
}
|
|
27
|
-
return ref.current == null ? void 0 : ref.current(...args);
|
|
28
|
-
}, []);
|
|
29
|
-
}
|
|
30
|
-
let rafId = 0;
|
|
31
|
-
function enqueueFocus(el, options) {
|
|
32
|
-
if (options === void 0) {
|
|
33
|
-
options = {};
|
|
34
|
-
}
|
|
35
|
-
const {
|
|
36
|
-
preventScroll = false,
|
|
37
|
-
cancelPrevious = true,
|
|
38
|
-
sync = false
|
|
39
|
-
} = options;
|
|
40
|
-
cancelPrevious && cancelAnimationFrame(rafId);
|
|
41
|
-
const exec = () => el == null ? void 0 : el.focus({
|
|
42
|
-
preventScroll
|
|
43
|
-
});
|
|
44
|
-
if (sync) {
|
|
45
|
-
exec();
|
|
46
|
-
} else {
|
|
47
|
-
rafId = requestAnimationFrame(exec);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
|
|
51
|
-
function _extends() {
|
|
52
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
53
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
54
|
-
var source = arguments[i];
|
|
55
|
-
for (var key in source) {
|
|
56
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
57
|
-
target[key] = source[key];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return target;
|
|
62
|
-
};
|
|
63
|
-
return _extends.apply(this, arguments);
|
|
64
|
-
}
|
|
65
|
-
let serverHandoffComplete = false;
|
|
66
|
-
let count = 0;
|
|
67
|
-
const genId = () => (
|
|
68
|
-
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
69
|
-
// on <React 18
|
|
70
|
-
"floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
|
|
71
|
-
);
|
|
72
|
-
function useFloatingId() {
|
|
73
|
-
const [id, setId] = React.useState(() => serverHandoffComplete ? genId() : void 0);
|
|
74
|
-
index(() => {
|
|
75
|
-
if (id == null) {
|
|
76
|
-
setId(genId());
|
|
77
|
-
}
|
|
78
|
-
}, []);
|
|
79
|
-
React.useEffect(() => {
|
|
80
|
-
serverHandoffComplete = true;
|
|
81
|
-
}, []);
|
|
82
|
-
return id;
|
|
83
|
-
}
|
|
84
|
-
const useReactId = SafeReact.useId;
|
|
85
|
-
const useId = useReactId || useFloatingId;
|
|
86
|
-
let devMessageSet;
|
|
87
|
-
if (process.env.NODE_ENV !== "production") {
|
|
88
|
-
devMessageSet = /* @__PURE__ */ new Set();
|
|
89
|
-
}
|
|
90
|
-
function error() {
|
|
91
|
-
var _devMessageSet3;
|
|
92
|
-
for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
93
|
-
messages[_key2] = arguments[_key2];
|
|
94
|
-
}
|
|
95
|
-
const message = "Floating UI: " + messages.join(" ");
|
|
96
|
-
if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
|
|
97
|
-
var _devMessageSet4;
|
|
98
|
-
(_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
|
|
99
|
-
console.error(message);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function createPubSub() {
|
|
103
|
-
const map = /* @__PURE__ */ new Map();
|
|
104
|
-
return {
|
|
105
|
-
emit(event, data) {
|
|
106
|
-
var _map$get;
|
|
107
|
-
(_map$get = map.get(event)) == null || _map$get.forEach((handler) => handler(data));
|
|
108
|
-
},
|
|
109
|
-
on(event, listener) {
|
|
110
|
-
map.set(event, [...map.get(event) || [], listener]);
|
|
111
|
-
},
|
|
112
|
-
off(event, listener) {
|
|
113
|
-
var _map$get2;
|
|
114
|
-
map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter((l) => l !== listener)) || []);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
const FloatingNodeContext = /* @__PURE__ */ React.createContext(null);
|
|
119
|
-
const FloatingTreeContext = /* @__PURE__ */ React.createContext(null);
|
|
120
|
-
const useFloatingParentNodeId = () => {
|
|
121
|
-
var _React$useContext;
|
|
122
|
-
return ((_React$useContext = React.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
|
|
123
|
-
};
|
|
124
|
-
const useFloatingTree = () => React.useContext(FloatingTreeContext);
|
|
125
|
-
function createAttribute(name) {
|
|
126
|
-
return "data-floating-ui-" + name;
|
|
127
|
-
}
|
|
128
|
-
function useLatestRef(value) {
|
|
129
|
-
const ref = useRef(value);
|
|
130
|
-
index(() => {
|
|
131
|
-
ref.current = value;
|
|
132
|
-
});
|
|
133
|
-
return ref;
|
|
134
|
-
}
|
|
135
|
-
function getAncestors(nodes, id) {
|
|
136
|
-
var _nodes$find;
|
|
137
|
-
let allAncestors = [];
|
|
138
|
-
let currentParentId = (_nodes$find = nodes.find((node) => node.id === id)) == null ? void 0 : _nodes$find.parentId;
|
|
139
|
-
while (currentParentId) {
|
|
140
|
-
const currentNode = nodes.find((node) => node.id === currentParentId);
|
|
141
|
-
currentParentId = currentNode == null ? void 0 : currentNode.parentId;
|
|
142
|
-
if (currentNode) {
|
|
143
|
-
allAncestors = allAncestors.concat(currentNode);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return allAncestors;
|
|
147
|
-
}
|
|
148
|
-
function getChildren(nodes, id) {
|
|
149
|
-
let allChildren = nodes.filter((node) => {
|
|
150
|
-
var _node$context;
|
|
151
|
-
return node.parentId === id && ((_node$context = node.context) == null ? void 0 : _node$context.open);
|
|
152
|
-
});
|
|
153
|
-
let currentChildren = allChildren;
|
|
154
|
-
while (currentChildren.length) {
|
|
155
|
-
currentChildren = nodes.filter((node) => {
|
|
156
|
-
var _currentChildren;
|
|
157
|
-
return (_currentChildren = currentChildren) == null ? void 0 : _currentChildren.some((n) => {
|
|
158
|
-
var _node$context2;
|
|
159
|
-
return node.parentId === n.id && ((_node$context2 = node.context) == null ? void 0 : _node$context2.open);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
allChildren = allChildren.concat(currentChildren);
|
|
163
|
-
}
|
|
164
|
-
return allChildren;
|
|
165
|
-
}
|
|
166
|
-
let counterMap = /* @__PURE__ */ new WeakMap();
|
|
167
|
-
let uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
|
|
168
|
-
let markerMap = {};
|
|
169
|
-
let lockCount = 0;
|
|
170
|
-
const supportsInert = () => typeof HTMLElement !== "undefined" && "inert" in HTMLElement.prototype;
|
|
171
|
-
const unwrapHost = (node) => node && (node.host || unwrapHost(node.parentNode));
|
|
172
|
-
const correctElements = (parent, targets) => targets.map((target) => {
|
|
173
|
-
if (parent.contains(target)) {
|
|
174
|
-
return target;
|
|
175
|
-
}
|
|
176
|
-
const correctedTarget = unwrapHost(target);
|
|
177
|
-
if (parent.contains(correctedTarget)) {
|
|
178
|
-
return correctedTarget;
|
|
179
|
-
}
|
|
180
|
-
return null;
|
|
181
|
-
}).filter((x) => x != null);
|
|
182
|
-
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert) {
|
|
183
|
-
const markerName = "data-floating-ui-inert";
|
|
184
|
-
const controlAttribute = inert ? "inert" : ariaHidden ? "aria-hidden" : null;
|
|
185
|
-
const avoidElements = correctElements(body, uncorrectedAvoidElements);
|
|
186
|
-
const elementsToKeep = /* @__PURE__ */ new Set();
|
|
187
|
-
const elementsToStop = new Set(avoidElements);
|
|
188
|
-
const hiddenElements = [];
|
|
189
|
-
if (!markerMap[markerName]) {
|
|
190
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
191
|
-
}
|
|
192
|
-
const markerCounter = markerMap[markerName];
|
|
193
|
-
avoidElements.forEach(keep);
|
|
194
|
-
deep(body);
|
|
195
|
-
elementsToKeep.clear();
|
|
196
|
-
function keep(el) {
|
|
197
|
-
if (!el || elementsToKeep.has(el)) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
elementsToKeep.add(el);
|
|
201
|
-
el.parentNode && keep(el.parentNode);
|
|
202
|
-
}
|
|
203
|
-
function deep(parent) {
|
|
204
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
[].forEach.call(parent.children, (node) => {
|
|
208
|
-
if (getNodeName(node) === "script") return;
|
|
209
|
-
if (elementsToKeep.has(node)) {
|
|
210
|
-
deep(node);
|
|
1
|
+
import defaultBehaviors from "./react-text-annotator.es23.js";
|
|
2
|
+
import * as utilities from "./react-text-annotator.es24.js";
|
|
3
|
+
import { hideContent, defineCustomElement, tagName } from "./react-text-annotator.es24.js";
|
|
4
|
+
import { addBehaviors, addBehavior, removeBehavior } from "./react-text-annotator.es25.js";
|
|
5
|
+
import { learnElementNames, learnCustomElementNames } from "./react-text-annotator.es26.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);
|
|
211
24
|
} else {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
lockCount++;
|
|
232
|
-
return () => {
|
|
233
|
-
hiddenElements.forEach((element) => {
|
|
234
|
-
const counterValue = (counterMap.get(element) || 0) - 1;
|
|
235
|
-
const markerValue = (markerCounter.get(element) || 0) - 1;
|
|
236
|
-
counterMap.set(element, counterValue);
|
|
237
|
-
markerCounter.set(element, markerValue);
|
|
238
|
-
if (!counterValue) {
|
|
239
|
-
if (!uncontrolledElementsSet.has(element) && controlAttribute) {
|
|
240
|
-
element.removeAttribute(controlAttribute);
|
|
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(/\/[^\/]*$/, "/");
|
|
241
41
|
}
|
|
242
|
-
|
|
42
|
+
} catch (e) {
|
|
43
|
+
this.base = "";
|
|
243
44
|
}
|
|
244
|
-
if (!markerValue) {
|
|
245
|
-
element.removeAttribute(markerName);
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
lockCount--;
|
|
249
|
-
if (!lockCount) {
|
|
250
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
251
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
252
|
-
uncontrolledElementsSet = /* @__PURE__ */ new WeakSet();
|
|
253
|
-
markerMap = {};
|
|
254
45
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
function markOthers(avoidElements, ariaHidden, inert) {
|
|
258
|
-
if (ariaHidden === void 0) {
|
|
259
|
-
ariaHidden = false;
|
|
260
|
-
}
|
|
261
|
-
if (inert === void 0) {
|
|
262
|
-
inert = false;
|
|
263
|
-
}
|
|
264
|
-
const body = getDocument(avoidElements[0]).body;
|
|
265
|
-
return applyAttributeToOthers(avoidElements.concat(Array.from(body.querySelectorAll("[aria-live]"))), body, ariaHidden, inert);
|
|
266
|
-
}
|
|
267
|
-
const getTabbableOptions = () => ({
|
|
268
|
-
getShadowRoot: true,
|
|
269
|
-
displayCheck: (
|
|
270
|
-
// JSDOM does not support the `tabbable` library. To solve this we can
|
|
271
|
-
// check if `ResizeObserver` is a real function (not polyfilled), which
|
|
272
|
-
// determines if the current environment is JSDOM-like.
|
|
273
|
-
typeof ResizeObserver === "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
|
|
274
|
-
)
|
|
275
|
-
});
|
|
276
|
-
function getTabbableIn(container, direction) {
|
|
277
|
-
const allTabbable = tabbable(container, getTabbableOptions());
|
|
278
|
-
if (direction === "prev") {
|
|
279
|
-
allTabbable.reverse();
|
|
280
|
-
}
|
|
281
|
-
const activeIndex = allTabbable.indexOf(activeElement(getDocument(container)));
|
|
282
|
-
const nextTabbableElements = allTabbable.slice(activeIndex + 1);
|
|
283
|
-
return nextTabbableElements[0];
|
|
284
|
-
}
|
|
285
|
-
function getNextTabbable() {
|
|
286
|
-
return getTabbableIn(document.body, "next");
|
|
287
|
-
}
|
|
288
|
-
function getPreviousTabbable() {
|
|
289
|
-
return getTabbableIn(document.body, "prev");
|
|
290
|
-
}
|
|
291
|
-
function isOutsideEvent(event, container) {
|
|
292
|
-
const containerElement = container || event.currentTarget;
|
|
293
|
-
const relatedTarget = event.relatedTarget;
|
|
294
|
-
return !relatedTarget || !contains(containerElement, relatedTarget);
|
|
295
|
-
}
|
|
296
|
-
function disableFocusInside(container) {
|
|
297
|
-
const tabbableElements = tabbable(container, getTabbableOptions());
|
|
298
|
-
tabbableElements.forEach((element) => {
|
|
299
|
-
element.dataset.tabindex = element.getAttribute("tabindex") || "";
|
|
300
|
-
element.setAttribute("tabindex", "-1");
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
function enableFocusInside(container) {
|
|
304
|
-
const elements = container.querySelectorAll("[data-tabindex]");
|
|
305
|
-
elements.forEach((element) => {
|
|
306
|
-
const tabindex = element.dataset.tabindex;
|
|
307
|
-
delete element.dataset.tabindex;
|
|
308
|
-
if (tabindex) {
|
|
309
|
-
element.setAttribute("tabindex", tabindex);
|
|
310
|
-
} else {
|
|
311
|
-
element.removeAttribute("tabindex");
|
|
46
|
+
if (!this.options.omitDefaultBehaviors) {
|
|
47
|
+
this.addBehaviors(defaultBehaviors);
|
|
312
48
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
const elementIndex = tabbableElements.indexOf(element);
|
|
317
|
-
function traverseTabbableElements(next2) {
|
|
318
|
-
const attr2 = createAttribute("focus-guard");
|
|
319
|
-
let index2 = elementIndex + (next2 ? 1 : 0);
|
|
320
|
-
let currentElement = tabbableElements[index2];
|
|
321
|
-
while (currentElement && (!currentElement.isConnected || currentElement.hasAttribute(attr2) || contains(floating, currentElement))) {
|
|
322
|
-
if (next2) {
|
|
323
|
-
index2++;
|
|
324
|
-
} else {
|
|
325
|
-
index2--;
|
|
49
|
+
if (this.options.ignoreFragmentId) {
|
|
50
|
+
if (window) {
|
|
51
|
+
window.removeEventListener("ceteiceanload", CETEI.restorePosition);
|
|
326
52
|
}
|
|
327
|
-
currentElement = tabbableElements[index2];
|
|
328
53
|
}
|
|
329
|
-
return currentElement;
|
|
330
54
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
whiteSpace: "nowrap",
|
|
346
|
-
width: "1px",
|
|
347
|
-
top: 0,
|
|
348
|
-
left: 0
|
|
349
|
-
};
|
|
350
|
-
let timeoutId;
|
|
351
|
-
function setActiveElementOnTab(event) {
|
|
352
|
-
if (event.key === "Tab") {
|
|
353
|
-
event.target;
|
|
354
|
-
clearTimeout(timeoutId);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
const FocusGuard = /* @__PURE__ */ React.forwardRef(function FocusGuard2(props, ref) {
|
|
358
|
-
const [role, setRole] = React.useState();
|
|
359
|
-
index(() => {
|
|
360
|
-
if (isSafari()) {
|
|
361
|
-
setRole("button");
|
|
362
|
-
}
|
|
363
|
-
document.addEventListener("keydown", setActiveElementOnTab);
|
|
364
|
-
return () => {
|
|
365
|
-
document.removeEventListener("keydown", setActiveElementOnTab);
|
|
366
|
-
};
|
|
367
|
-
}, []);
|
|
368
|
-
const restProps = {
|
|
369
|
-
ref,
|
|
370
|
-
tabIndex: 0,
|
|
371
|
-
// Role is only for VoiceOver
|
|
372
|
-
role,
|
|
373
|
-
"aria-hidden": role ? void 0 : true,
|
|
374
|
-
[createAttribute("focus-guard")]: "",
|
|
375
|
-
style: HIDDEN_STYLES
|
|
376
|
-
};
|
|
377
|
-
return /* @__PURE__ */ React.createElement("span", _extends({}, props, restProps));
|
|
378
|
-
});
|
|
379
|
-
const PortalContext = /* @__PURE__ */ React.createContext(null);
|
|
380
|
-
const attr = /* @__PURE__ */ createAttribute("portal");
|
|
381
|
-
function useFloatingPortalNode(props) {
|
|
382
|
-
if (props === void 0) {
|
|
383
|
-
props = {};
|
|
384
|
-
}
|
|
385
|
-
const {
|
|
386
|
-
id,
|
|
387
|
-
root
|
|
388
|
-
} = props;
|
|
389
|
-
const uniqueId = useId();
|
|
390
|
-
const portalContext = usePortalContext();
|
|
391
|
-
const [portalNode, setPortalNode] = React.useState(null);
|
|
392
|
-
const portalNodeRef = React.useRef(null);
|
|
393
|
-
index(() => {
|
|
394
|
-
return () => {
|
|
395
|
-
portalNode == null || portalNode.remove();
|
|
396
|
-
queueMicrotask(() => {
|
|
397
|
-
portalNodeRef.current = null;
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
}, [portalNode]);
|
|
401
|
-
index(() => {
|
|
402
|
-
if (!uniqueId) return;
|
|
403
|
-
if (portalNodeRef.current) return;
|
|
404
|
-
const existingIdRoot = id ? document.getElementById(id) : null;
|
|
405
|
-
if (!existingIdRoot) return;
|
|
406
|
-
const subRoot = document.createElement("div");
|
|
407
|
-
subRoot.id = uniqueId;
|
|
408
|
-
subRoot.setAttribute(attr, "");
|
|
409
|
-
existingIdRoot.appendChild(subRoot);
|
|
410
|
-
portalNodeRef.current = subRoot;
|
|
411
|
-
setPortalNode(subRoot);
|
|
412
|
-
}, [id, uniqueId]);
|
|
413
|
-
index(() => {
|
|
414
|
-
if (!uniqueId) return;
|
|
415
|
-
if (portalNodeRef.current) return;
|
|
416
|
-
let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
|
|
417
|
-
if (container && !isElement(container)) container = container.current;
|
|
418
|
-
container = container || document.body;
|
|
419
|
-
let idWrapper = null;
|
|
420
|
-
if (id) {
|
|
421
|
-
idWrapper = document.createElement("div");
|
|
422
|
-
idWrapper.id = id;
|
|
423
|
-
container.appendChild(idWrapper);
|
|
424
|
-
}
|
|
425
|
-
const subRoot = document.createElement("div");
|
|
426
|
-
subRoot.id = uniqueId;
|
|
427
|
-
subRoot.setAttribute(attr, "");
|
|
428
|
-
container = idWrapper || container;
|
|
429
|
-
container.appendChild(subRoot);
|
|
430
|
-
portalNodeRef.current = subRoot;
|
|
431
|
-
setPortalNode(subRoot);
|
|
432
|
-
}, [id, root, uniqueId, portalContext]);
|
|
433
|
-
return portalNode;
|
|
434
|
-
}
|
|
435
|
-
function FloatingPortal(props) {
|
|
436
|
-
const {
|
|
437
|
-
children,
|
|
438
|
-
id,
|
|
439
|
-
root = null,
|
|
440
|
-
preserveTabOrder = true
|
|
441
|
-
} = props;
|
|
442
|
-
const portalNode = useFloatingPortalNode({
|
|
443
|
-
id,
|
|
444
|
-
root
|
|
445
|
-
});
|
|
446
|
-
const [focusManagerState, setFocusManagerState] = React.useState(null);
|
|
447
|
-
const beforeOutsideRef = React.useRef(null);
|
|
448
|
-
const afterOutsideRef = React.useRef(null);
|
|
449
|
-
const beforeInsideRef = React.useRef(null);
|
|
450
|
-
const afterInsideRef = React.useRef(null);
|
|
451
|
-
const shouldRenderGuards = (
|
|
452
|
-
// The FocusManager and therefore floating element are currently open/
|
|
453
|
-
// rendered.
|
|
454
|
-
!!focusManagerState && // Guards are only for non-modal focus management.
|
|
455
|
-
!focusManagerState.modal && // Don't render if unmount is transitioning.
|
|
456
|
-
focusManagerState.open && preserveTabOrder && !!(root || portalNode)
|
|
457
|
-
);
|
|
458
|
-
React.useEffect(() => {
|
|
459
|
-
if (!portalNode || !preserveTabOrder || focusManagerState != null && focusManagerState.modal) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
function onFocus(event) {
|
|
463
|
-
if (portalNode && isOutsideEvent(event)) {
|
|
464
|
-
const focusing = event.type === "focusin";
|
|
465
|
-
const manageFocus = focusing ? enableFocusInside : disableFocusInside;
|
|
466
|
-
manageFocus(portalNode);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
portalNode.addEventListener("focusin", onFocus, true);
|
|
470
|
-
portalNode.addEventListener("focusout", onFocus, true);
|
|
471
|
-
return () => {
|
|
472
|
-
portalNode.removeEventListener("focusin", onFocus, true);
|
|
473
|
-
portalNode.removeEventListener("focusout", onFocus, true);
|
|
474
|
-
};
|
|
475
|
-
}, [portalNode, preserveTabOrder, focusManagerState == null ? void 0 : focusManagerState.modal]);
|
|
476
|
-
return /* @__PURE__ */ React.createElement(PortalContext.Provider, {
|
|
477
|
-
value: React.useMemo(() => ({
|
|
478
|
-
preserveTabOrder,
|
|
479
|
-
beforeOutsideRef,
|
|
480
|
-
afterOutsideRef,
|
|
481
|
-
beforeInsideRef,
|
|
482
|
-
afterInsideRef,
|
|
483
|
-
portalNode,
|
|
484
|
-
setFocusManagerState
|
|
485
|
-
}), [preserveTabOrder, portalNode])
|
|
486
|
-
}, shouldRenderGuards && portalNode && /* @__PURE__ */ React.createElement(FocusGuard, {
|
|
487
|
-
"data-type": "outside",
|
|
488
|
-
ref: beforeOutsideRef,
|
|
489
|
-
onFocus: (event) => {
|
|
490
|
-
if (isOutsideEvent(event, portalNode)) {
|
|
491
|
-
var _beforeInsideRef$curr;
|
|
492
|
-
(_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus();
|
|
493
|
-
} else {
|
|
494
|
-
const prevTabbable = getPreviousTabbable() || (focusManagerState == null ? void 0 : focusManagerState.refs.domReference.current);
|
|
495
|
-
prevTabbable == null || prevTabbable.focus();
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}), shouldRenderGuards && portalNode && /* @__PURE__ */ React.createElement("span", {
|
|
499
|
-
"aria-owns": portalNode.id,
|
|
500
|
-
style: HIDDEN_STYLES
|
|
501
|
-
}), portalNode && /* @__PURE__ */ ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ React.createElement(FocusGuard, {
|
|
502
|
-
"data-type": "outside",
|
|
503
|
-
ref: afterOutsideRef,
|
|
504
|
-
onFocus: (event) => {
|
|
505
|
-
if (isOutsideEvent(event, portalNode)) {
|
|
506
|
-
var _afterInsideRef$curre;
|
|
507
|
-
(_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus();
|
|
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);
|
|
508
69
|
} else {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
(focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null ? void 0 : focusManagerState.onOpenChange(false, event.nativeEvent));
|
|
70
|
+
console.log(`Could not get XML file ${XML_url}.
|
|
71
|
+
Server returned ${response.status}: ${response.statusText}`);
|
|
512
72
|
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
const usePortalContext = () => React.useContext(PortalContext);
|
|
517
|
-
const LIST_LIMIT = 20;
|
|
518
|
-
let previouslyFocusedElements = [];
|
|
519
|
-
function addPreviouslyFocusedElement(element) {
|
|
520
|
-
previouslyFocusedElements = previouslyFocusedElements.filter((el) => el.isConnected);
|
|
521
|
-
let tabbableEl = element;
|
|
522
|
-
if (!tabbableEl || getNodeName(tabbableEl) === "body") return;
|
|
523
|
-
if (!isTabbable(tabbableEl, getTabbableOptions())) {
|
|
524
|
-
const tabbableChild = tabbable(tabbableEl, getTabbableOptions())[0];
|
|
525
|
-
if (tabbableChild) {
|
|
526
|
-
tabbableEl = tabbableChild;
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.log(error);
|
|
527
75
|
}
|
|
528
76
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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);
|
|
532
84
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
style: HIDDEN_STYLES
|
|
543
|
-
}));
|
|
544
|
-
});
|
|
545
|
-
function FloatingFocusManager(props) {
|
|
546
|
-
const {
|
|
547
|
-
context,
|
|
548
|
-
children,
|
|
549
|
-
disabled = false,
|
|
550
|
-
order = ["content"],
|
|
551
|
-
guards: _guards = true,
|
|
552
|
-
initialFocus = 0,
|
|
553
|
-
returnFocus = true,
|
|
554
|
-
restoreFocus = false,
|
|
555
|
-
modal = true,
|
|
556
|
-
visuallyHiddenDismiss = false,
|
|
557
|
-
closeOnFocusOut = true
|
|
558
|
-
} = props;
|
|
559
|
-
const {
|
|
560
|
-
open,
|
|
561
|
-
refs,
|
|
562
|
-
nodeId,
|
|
563
|
-
onOpenChange,
|
|
564
|
-
events,
|
|
565
|
-
dataRef,
|
|
566
|
-
floatingId,
|
|
567
|
-
elements: {
|
|
568
|
-
domReference,
|
|
569
|
-
floating
|
|
570
|
-
}
|
|
571
|
-
} = context;
|
|
572
|
-
const ignoreInitialFocus = typeof initialFocus === "number" && initialFocus < 0;
|
|
573
|
-
const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
|
|
574
|
-
const guards = supportsInert() ? _guards : true;
|
|
575
|
-
const orderRef = useLatestRef(order);
|
|
576
|
-
const initialFocusRef = useLatestRef(initialFocus);
|
|
577
|
-
const returnFocusRef = useLatestRef(returnFocus);
|
|
578
|
-
const tree = useFloatingTree();
|
|
579
|
-
const portalContext = usePortalContext();
|
|
580
|
-
const startDismissButtonRef = React.useRef(null);
|
|
581
|
-
const endDismissButtonRef = React.useRef(null);
|
|
582
|
-
const preventReturnFocusRef = React.useRef(false);
|
|
583
|
-
const isPointerDownRef = React.useRef(false);
|
|
584
|
-
const tabbableIndexRef = React.useRef(-1);
|
|
585
|
-
const isInsidePortal = portalContext != null;
|
|
586
|
-
const firstElementChild = floating == null ? void 0 : floating.firstElementChild;
|
|
587
|
-
const floatingFocusNode = (firstElementChild == null ? void 0 : firstElementChild.id) === floatingId ? firstElementChild : floating;
|
|
588
|
-
const getTabbableContent = useEffectEvent(function(container) {
|
|
589
|
-
if (container === void 0) {
|
|
590
|
-
container = floatingFocusNode;
|
|
591
|
-
}
|
|
592
|
-
return container ? tabbable(container, getTabbableOptions()) : [];
|
|
593
|
-
});
|
|
594
|
-
const getTabbableElements = useEffectEvent((container) => {
|
|
595
|
-
const content = getTabbableContent(container);
|
|
596
|
-
return orderRef.current.map((type) => {
|
|
597
|
-
if (domReference && type === "reference") {
|
|
598
|
-
return domReference;
|
|
599
|
-
}
|
|
600
|
-
if (floatingFocusNode && type === "floating") {
|
|
601
|
-
return floatingFocusNode;
|
|
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);
|
|
602
94
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if (!modal) return;
|
|
609
|
-
function onKeyDown(event) {
|
|
610
|
-
if (event.key === "Tab") {
|
|
611
|
-
if (contains(floatingFocusNode, activeElement(getDocument(floatingFocusNode))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {
|
|
612
|
-
stopEvent(event);
|
|
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);
|
|
613
100
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
if (orderRef.current[0] === "reference" && target === domReference) {
|
|
617
|
-
stopEvent(event);
|
|
618
|
-
if (event.shiftKey) {
|
|
619
|
-
enqueueFocus(els[els.length - 1]);
|
|
620
|
-
} else {
|
|
621
|
-
enqueueFocus(els[1]);
|
|
622
|
-
}
|
|
101
|
+
if (att.name == "xml:id") {
|
|
102
|
+
newElement.setAttribute("id", att.value);
|
|
623
103
|
}
|
|
624
|
-
if (
|
|
625
|
-
|
|
626
|
-
|
|
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, ""));
|
|
627
109
|
}
|
|
628
110
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
isPointerDownRef.current = true;
|
|
657
|
-
setTimeout(() => {
|
|
658
|
-
isPointerDownRef.current = false;
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
function handleFocusOutside(event) {
|
|
662
|
-
const relatedTarget = event.relatedTarget;
|
|
663
|
-
queueMicrotask(() => {
|
|
664
|
-
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext == null ? void 0 : portalContext.portalNode, relatedTarget) || relatedTarget != null && relatedTarget.hasAttribute(createAttribute("focus-guard")) || tree && (getChildren(tree.nodesRef.current, nodeId).find((node) => {
|
|
665
|
-
var _node$context, _node$context2;
|
|
666
|
-
return contains((_node$context = node.context) == null ? void 0 : _node$context.elements.floating, relatedTarget) || contains((_node$context2 = node.context) == null ? void 0 : _node$context2.elements.domReference, relatedTarget);
|
|
667
|
-
}) || getAncestors(tree.nodesRef.current, nodeId).find((node) => {
|
|
668
|
-
var _node$context3, _node$context4;
|
|
669
|
-
return ((_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating) === relatedTarget || ((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.domReference) === relatedTarget;
|
|
670
|
-
})));
|
|
671
|
-
if (restoreFocus && movedToUnrelatedNode && activeElement(getDocument(floatingFocusNode)) === getDocument(floatingFocusNode).body) {
|
|
672
|
-
if (isHTMLElement(floatingFocusNode)) {
|
|
673
|
-
floatingFocusNode == null || floatingFocusNode.focus();
|
|
674
|
-
}
|
|
675
|
-
const prevTabbableIndex = tabbableIndexRef.current;
|
|
676
|
-
const tabbableContent = getTabbableContent();
|
|
677
|
-
const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusNode;
|
|
678
|
-
if (isHTMLElement(nodeToFocus)) {
|
|
679
|
-
nodeToFocus.focus();
|
|
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));
|
|
680
138
|
}
|
|
681
139
|
}
|
|
682
|
-
if (
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
onOpenChange(false, event);
|
|
140
|
+
if (style.childNodes.length > 0) {
|
|
141
|
+
newElement.appendChild(style);
|
|
142
|
+
this.hasStyle = true;
|
|
686
143
|
}
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
if (floating && isHTMLElement(domReference)) {
|
|
690
|
-
domReference.addEventListener("focusout", handleFocusOutside);
|
|
691
|
-
domReference.addEventListener("pointerdown", handlePointerDown);
|
|
692
|
-
floating.addEventListener("focusout", handleFocusOutside);
|
|
693
|
-
return () => {
|
|
694
|
-
domReference.removeEventListener("focusout", handleFocusOutside);
|
|
695
|
-
domReference.removeEventListener("pointerdown", handlePointerDown);
|
|
696
|
-
floating.removeEventListener("focusout", handleFocusOutside);
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
}, [disabled, domReference, floating, floatingFocusNode, modal, nodeId, tree, portalContext, onOpenChange, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox]);
|
|
700
|
-
React.useEffect(() => {
|
|
701
|
-
var _portalContext$portal;
|
|
702
|
-
if (disabled) return;
|
|
703
|
-
const portalNodes = Array.from((portalContext == null || (_portalContext$portal = portalContext.portalNode) == null ? void 0 : _portalContext$portal.querySelectorAll("[" + createAttribute("portal") + "]")) || []);
|
|
704
|
-
if (floating) {
|
|
705
|
-
const insideElements = [floating, ...portalNodes, startDismissButtonRef.current, endDismissButtonRef.current, orderRef.current.includes("reference") || isUntrappedTypeableCombobox ? domReference : null].filter((x) => x != null);
|
|
706
|
-
const cleanup = modal || isUntrappedTypeableCombobox ? markOthers(insideElements, guards, !guards) : markOthers(insideElements);
|
|
707
|
-
return () => {
|
|
708
|
-
cleanup();
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
}, [disabled, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, guards]);
|
|
712
|
-
index(() => {
|
|
713
|
-
if (disabled || !isHTMLElement(floatingFocusNode)) return;
|
|
714
|
-
const doc = getDocument(floatingFocusNode);
|
|
715
|
-
const previouslyFocusedElement = activeElement(doc);
|
|
716
|
-
queueMicrotask(() => {
|
|
717
|
-
const focusableElements = getTabbableElements(floatingFocusNode);
|
|
718
|
-
const initialFocusValue = initialFocusRef.current;
|
|
719
|
-
const elToFocus = (typeof initialFocusValue === "number" ? focusableElements[initialFocusValue] : initialFocusValue.current) || floatingFocusNode;
|
|
720
|
-
const focusAlreadyInsideFloatingEl = contains(floatingFocusNode, previouslyFocusedElement);
|
|
721
|
-
if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) {
|
|
722
|
-
enqueueFocus(elToFocus, {
|
|
723
|
-
preventScroll: elToFocus === floatingFocusNode
|
|
724
|
-
});
|
|
725
144
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
const previouslyFocusedElement = activeElement(doc);
|
|
733
|
-
const contextData = dataRef.current;
|
|
734
|
-
let openEvent = contextData.openEvent;
|
|
735
|
-
const domReference2 = refs.domReference.current;
|
|
736
|
-
addPreviouslyFocusedElement(previouslyFocusedElement);
|
|
737
|
-
function onOpenChange2(_ref) {
|
|
738
|
-
let {
|
|
739
|
-
open: open2,
|
|
740
|
-
reason,
|
|
741
|
-
event,
|
|
742
|
-
nested
|
|
743
|
-
} = _ref;
|
|
744
|
-
if (open2) {
|
|
745
|
-
openEvent = event;
|
|
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
|
+
};
|
|
746
151
|
}
|
|
747
|
-
|
|
748
|
-
|
|
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
|
+
}
|
|
749
158
|
}
|
|
750
|
-
if (
|
|
751
|
-
|
|
159
|
+
if (perElementFn) {
|
|
160
|
+
perElementFn(newElement, el);
|
|
752
161
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
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));
|
|
759
168
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
return () => {
|
|
763
|
-
events.off("openchange", onOpenChange2);
|
|
764
|
-
const activeEl = activeElement(doc);
|
|
765
|
-
const isFocusInsideFloatingTree = contains(floating, activeEl) || tree && getChildren(tree.nodesRef.current, nodeId).some((node) => {
|
|
766
|
-
var _node$context5;
|
|
767
|
-
return contains((_node$context5 = node.context) == null ? void 0 : _node$context5.elements.floating, activeEl);
|
|
768
|
-
});
|
|
769
|
-
const shouldFocusReference = isFocusInsideFloatingTree || openEvent && ["click", "mousedown"].includes(openEvent.type);
|
|
770
|
-
if (shouldFocusReference && refs.domReference.current) {
|
|
771
|
-
addPreviouslyFocusedElement(refs.domReference.current);
|
|
169
|
+
if (node.nodeType == 7) {
|
|
170
|
+
this.dom.appendChild(this.document.importNode(node, true));
|
|
772
171
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
queueMicrotask(() => {
|
|
776
|
-
let returnElement = getPreviouslyFocusedElement();
|
|
777
|
-
if (!returnElement && isHTMLElement(returnContextElement) && floating) {
|
|
778
|
-
returnElement = getClosestTabbableElement(tabbableElements, returnContextElement, floating);
|
|
779
|
-
}
|
|
780
|
-
if (
|
|
781
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
782
|
-
returnFocusRef.current && !preventReturnFocusRef.current && isHTMLElement(returnElement) && // If the focus moved somewhere else after mount, avoid returning focus
|
|
783
|
-
// since it likely entered a different element which should be
|
|
784
|
-
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
785
|
-
(returnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)
|
|
786
|
-
) {
|
|
787
|
-
returnElement.focus({
|
|
788
|
-
preventScroll: preventReturnFocusScroll
|
|
789
|
-
});
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
};
|
|
793
|
-
}, [disabled, floating, floatingFocusNode, returnFocusRef, dataRef, refs, events, tree, nodeId]);
|
|
794
|
-
index(() => {
|
|
795
|
-
if (disabled) return;
|
|
796
|
-
if (!portalContext) return;
|
|
797
|
-
portalContext.setFocusManagerState({
|
|
798
|
-
modal,
|
|
799
|
-
closeOnFocusOut,
|
|
800
|
-
open,
|
|
801
|
-
onOpenChange,
|
|
802
|
-
refs
|
|
803
|
-
});
|
|
804
|
-
return () => {
|
|
805
|
-
portalContext.setFocusManagerState(null);
|
|
806
|
-
};
|
|
807
|
-
}, [disabled, portalContext, modal, open, onOpenChange, refs, closeOnFocusOut]);
|
|
808
|
-
index(() => {
|
|
809
|
-
if (disabled) return;
|
|
810
|
-
if (!floatingFocusNode) return;
|
|
811
|
-
if (typeof MutationObserver !== "function") return;
|
|
812
|
-
if (ignoreInitialFocus) return;
|
|
813
|
-
const handleMutation = () => {
|
|
814
|
-
const tabIndex = floatingFocusNode.getAttribute("tabindex");
|
|
815
|
-
const tabbableContent = getTabbableContent();
|
|
816
|
-
const activeEl = activeElement(getDocument(floating));
|
|
817
|
-
const tabbableIndex = tabbableContent.indexOf(activeEl);
|
|
818
|
-
if (tabbableIndex !== -1) {
|
|
819
|
-
tabbableIndexRef.current = tabbableIndex;
|
|
172
|
+
if (node.nodeType == 8) {
|
|
173
|
+
this.dom.appendChild(this.document.importNode(node, true));
|
|
820
174
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
175
|
+
}
|
|
176
|
+
this.utilities.dom = this.dom.firstElementChild;
|
|
177
|
+
if (callback) {
|
|
178
|
+
callback(this.dom, this);
|
|
179
|
+
if (window) {
|
|
180
|
+
window.dispatchEvent(ceteiceanLoad);
|
|
827
181
|
}
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
subtree: true,
|
|
834
|
-
attributes: true
|
|
835
|
-
});
|
|
836
|
-
return () => {
|
|
837
|
-
observer.disconnect();
|
|
838
|
-
};
|
|
839
|
-
}, [disabled, floating, floatingFocusNode, refs, orderRef, getTabbableContent, ignoreInitialFocus]);
|
|
840
|
-
function renderDismissButton(location) {
|
|
841
|
-
if (disabled || !visuallyHiddenDismiss || !modal) {
|
|
842
|
-
return null;
|
|
182
|
+
} else {
|
|
183
|
+
if (typeof window !== "undefined") {
|
|
184
|
+
window.dispatchEvent(ceteiceanLoad);
|
|
185
|
+
}
|
|
186
|
+
return this.dom;
|
|
843
187
|
}
|
|
844
|
-
return /* @__PURE__ */ React.createElement(VisuallyHiddenDismiss, {
|
|
845
|
-
ref: location === "start" ? startDismissButtonRef : endDismissButtonRef,
|
|
846
|
-
onClick: (event) => onOpenChange(false, event.nativeEvent)
|
|
847
|
-
}, typeof visuallyHiddenDismiss === "string" ? visuallyHiddenDismiss : "Dismiss");
|
|
848
188
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
nextTabbable == null || nextTabbable.focus();
|
|
862
|
-
} else {
|
|
863
|
-
var _portalContext$before;
|
|
864
|
-
(_portalContext$before = portalContext.beforeOutsideRef.current) == null || _portalContext$before.focus();
|
|
865
|
-
}
|
|
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);
|
|
866
201
|
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
ref: portalContext == null ? void 0 : portalContext.afterInsideRef,
|
|
871
|
-
onFocus: (event) => {
|
|
872
|
-
if (modal) {
|
|
873
|
-
enqueueFocus(getTabbableElements()[0]);
|
|
874
|
-
} else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) {
|
|
875
|
-
if (closeOnFocusOut) {
|
|
876
|
-
preventReturnFocusRef.current = true;
|
|
877
|
-
}
|
|
878
|
-
if (isOutsideEvent(event, portalContext.portalNode)) {
|
|
879
|
-
const prevTabbable = getPreviousTabbable() || domReference;
|
|
880
|
-
prevTabbable == null || prevTabbable.focus();
|
|
881
|
-
} else {
|
|
882
|
-
var _portalContext$afterO;
|
|
883
|
-
(_portalContext$afterO = portalContext.afterOutsideRef.current) == null || _portalContext$afterO.focus();
|
|
884
|
-
}
|
|
202
|
+
} else {
|
|
203
|
+
if (typeof window !== "undefined") {
|
|
204
|
+
window.dispatchEvent(ceteiceanLoad);
|
|
885
205
|
}
|
|
206
|
+
return this.dom;
|
|
886
207
|
}
|
|
887
|
-
}));
|
|
888
|
-
}
|
|
889
|
-
const bubbleHandlerKeys = {
|
|
890
|
-
pointerdown: "onPointerDown",
|
|
891
|
-
mousedown: "onMouseDown",
|
|
892
|
-
click: "onClick"
|
|
893
|
-
};
|
|
894
|
-
const captureHandlerKeys = {
|
|
895
|
-
pointerdown: "onPointerDownCapture",
|
|
896
|
-
mousedown: "onMouseDownCapture",
|
|
897
|
-
click: "onClickCapture"
|
|
898
|
-
};
|
|
899
|
-
const normalizeProp = (normalizable) => {
|
|
900
|
-
var _normalizable$escapeK, _normalizable$outside;
|
|
901
|
-
return {
|
|
902
|
-
escapeKey: typeof normalizable === "boolean" ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,
|
|
903
|
-
outsidePress: typeof normalizable === "boolean" ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true
|
|
904
|
-
};
|
|
905
|
-
};
|
|
906
|
-
function useDismiss(context, props) {
|
|
907
|
-
if (props === void 0) {
|
|
908
|
-
props = {};
|
|
909
208
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
referencePress = false,
|
|
922
|
-
referencePressEvent = "pointerdown",
|
|
923
|
-
ancestorScroll = false,
|
|
924
|
-
bubbles,
|
|
925
|
-
capture
|
|
926
|
-
} = props;
|
|
927
|
-
const tree = useFloatingTree();
|
|
928
|
-
const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === "function" ? unstable_outsidePress : () => false);
|
|
929
|
-
const outsidePress = typeof unstable_outsidePress === "function" ? outsidePressFn : unstable_outsidePress;
|
|
930
|
-
const insideReactTreeRef = React.useRef(false);
|
|
931
|
-
const endedOrStartedInsideRef = React.useRef(false);
|
|
932
|
-
const {
|
|
933
|
-
escapeKey: escapeKeyBubbles,
|
|
934
|
-
outsidePress: outsidePressBubbles
|
|
935
|
-
} = normalizeProp(bubbles);
|
|
936
|
-
const {
|
|
937
|
-
escapeKey: escapeKeyCapture,
|
|
938
|
-
outsidePress: outsidePressCapture
|
|
939
|
-
} = normalizeProp(capture);
|
|
940
|
-
const closeOnEscapeKeyDown = useEffectEvent((event) => {
|
|
941
|
-
var _dataRef$current$floa;
|
|
942
|
-
if (!open || !enabled || !escapeKey || event.key !== "Escape") {
|
|
943
|
-
return;
|
|
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);
|
|
944
220
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
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);
|
|
956
259
|
}
|
|
957
|
-
});
|
|
958
|
-
if (!shouldDismiss) {
|
|
959
|
-
return;
|
|
960
260
|
}
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, "escape-key");
|
|
964
|
-
});
|
|
965
|
-
const closeOnEscapeKeyDownCapture = useEffectEvent((event) => {
|
|
966
|
-
var _getTarget2;
|
|
967
|
-
const callback = () => {
|
|
968
|
-
var _getTarget;
|
|
969
|
-
closeOnEscapeKeyDown(event);
|
|
970
|
-
(_getTarget = getTarget(event)) == null || _getTarget.removeEventListener("keydown", callback);
|
|
971
|
-
};
|
|
972
|
-
(_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener("keydown", callback);
|
|
973
|
-
});
|
|
974
|
-
const closeOnPressOutside = useEffectEvent((event) => {
|
|
975
|
-
var _dataRef$current$floa2;
|
|
976
|
-
const insideReactTree = insideReactTreeRef.current;
|
|
977
|
-
insideReactTreeRef.current = false;
|
|
978
|
-
const endedOrStartedInside = endedOrStartedInsideRef.current;
|
|
979
|
-
endedOrStartedInsideRef.current = false;
|
|
980
|
-
if (outsidePressEvent === "click" && endedOrStartedInside) {
|
|
981
|
-
return;
|
|
261
|
+
};
|
|
982
262
|
}
|
|
983
|
-
|
|
984
|
-
|
|
263
|
+
}
|
|
264
|
+
appendBasic(elt, content) {
|
|
265
|
+
if (this.discardContent) {
|
|
266
|
+
elt.innerHTML = "";
|
|
267
|
+
} else {
|
|
268
|
+
hideContent(elt, true);
|
|
985
269
|
}
|
|
986
|
-
|
|
987
|
-
|
|
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);
|
|
988
285
|
}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
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
|
+
};
|
|
999
300
|
}
|
|
1000
|
-
if (
|
|
1001
|
-
|
|
1002
|
-
// element was injected after the floating element rendered.
|
|
1003
|
-
Array.from(markers).every((marker) => !contains(targetRootAncestor, marker))) {
|
|
1004
|
-
return;
|
|
301
|
+
if (Array.isArray(template) && !Array.isArray(template[0])) {
|
|
302
|
+
return this.applyDecorator(template);
|
|
1005
303
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
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
|
+
}
|
|
1014
313
|
}
|
|
1015
314
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
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]);
|
|
1018
337
|
}
|
|
1019
338
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
children.forEach((child) => {
|
|
1032
|
-
var _child$context2;
|
|
1033
|
-
if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {
|
|
1034
|
-
shouldDismiss = false;
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
});
|
|
1038
|
-
if (!shouldDismiss) {
|
|
1039
|
-
return;
|
|
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]));
|
|
1040
350
|
}
|
|
1041
351
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
closeOnPressOutside(event);
|
|
1049
|
-
(_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);
|
|
1050
|
-
};
|
|
1051
|
-
(_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);
|
|
1052
|
-
});
|
|
1053
|
-
React.useEffect(() => {
|
|
1054
|
-
if (!open || !enabled) {
|
|
1055
|
-
return;
|
|
1056
|
-
}
|
|
1057
|
-
dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
|
|
1058
|
-
dataRef.current.__outsidePressBubbles = outsidePressBubbles;
|
|
1059
|
-
function onScroll(event) {
|
|
1060
|
-
onOpenChange(false, event, "ancestor-scroll");
|
|
1061
|
-
}
|
|
1062
|
-
const doc = getDocument(elements.floating);
|
|
1063
|
-
escapeKey && doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
|
|
1064
|
-
outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
1065
|
-
let ancestors = [];
|
|
1066
|
-
if (ancestorScroll) {
|
|
1067
|
-
if (isElement(elements.domReference)) {
|
|
1068
|
-
ancestors = getOverflowAncestors(elements.domReference);
|
|
1069
|
-
}
|
|
1070
|
-
if (isElement(elements.floating)) {
|
|
1071
|
-
ancestors = ancestors.concat(getOverflowAncestors(elements.floating));
|
|
1072
|
-
}
|
|
1073
|
-
if (!isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
|
|
1074
|
-
ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement));
|
|
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);
|
|
1075
358
|
}
|
|
1076
359
|
}
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
|
|
1089
|
-
ancestors.forEach((ancestor) => {
|
|
1090
|
-
ancestor.removeEventListener("scroll", onScroll);
|
|
1091
|
-
});
|
|
1092
|
-
};
|
|
1093
|
-
}, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);
|
|
1094
|
-
React.useEffect(() => {
|
|
1095
|
-
insideReactTreeRef.current = false;
|
|
1096
|
-
}, [outsidePress, outsidePressEvent]);
|
|
1097
|
-
const reference = React.useMemo(() => ({
|
|
1098
|
-
onKeyDown: closeOnEscapeKeyDown,
|
|
1099
|
-
[bubbleHandlerKeys[referencePressEvent]]: (event) => {
|
|
1100
|
-
if (referencePress) {
|
|
1101
|
-
onOpenChange(false, event.nativeEvent, "reference-press");
|
|
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);
|
|
1102
371
|
}
|
|
1103
372
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
endedOrStartedInsideRef.current = true;
|
|
1109
|
-
},
|
|
1110
|
-
onMouseUp() {
|
|
1111
|
-
endedOrStartedInsideRef.current = true;
|
|
1112
|
-
},
|
|
1113
|
-
[captureHandlerKeys[outsidePressEvent]]: () => {
|
|
1114
|
-
insideReactTreeRef.current = true;
|
|
1115
|
-
}
|
|
1116
|
-
}), [closeOnEscapeKeyDown, outsidePressEvent]);
|
|
1117
|
-
return React.useMemo(() => enabled ? {
|
|
1118
|
-
reference,
|
|
1119
|
-
floating
|
|
1120
|
-
} : {}, [enabled, reference, floating]);
|
|
1121
|
-
}
|
|
1122
|
-
function useFloatingRootContext(options) {
|
|
1123
|
-
const {
|
|
1124
|
-
open = false,
|
|
1125
|
-
onOpenChange: onOpenChangeProp,
|
|
1126
|
-
elements: elementsProp
|
|
1127
|
-
} = options;
|
|
1128
|
-
const floatingId = useId();
|
|
1129
|
-
const dataRef = React.useRef({});
|
|
1130
|
-
const [events] = React.useState(() => createPubSub());
|
|
1131
|
-
const nested = useFloatingParentNodeId() != null;
|
|
1132
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1133
|
-
const optionDomReference = elementsProp.reference;
|
|
1134
|
-
if (optionDomReference && !isElement(optionDomReference)) {
|
|
1135
|
-
error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
373
|
+
if (content.childNodes.length < 2) {
|
|
374
|
+
return content.firstChild;
|
|
375
|
+
} else {
|
|
376
|
+
return content;
|
|
1136
377
|
}
|
|
1137
378
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
nested
|
|
1146
|
-
});
|
|
1147
|
-
onOpenChangeProp == null || onOpenChangeProp(open2, event, reason);
|
|
1148
|
-
});
|
|
1149
|
-
const refs = React.useMemo(() => ({
|
|
1150
|
-
setPositionReference
|
|
1151
|
-
}), []);
|
|
1152
|
-
const elements = React.useMemo(() => ({
|
|
1153
|
-
reference: positionReference || elementsProp.reference || null,
|
|
1154
|
-
floating: elementsProp.floating || null,
|
|
1155
|
-
domReference: elementsProp.reference
|
|
1156
|
-
}), [positionReference, elementsProp.reference, elementsProp.floating]);
|
|
1157
|
-
return React.useMemo(() => ({
|
|
1158
|
-
dataRef,
|
|
1159
|
-
open,
|
|
1160
|
-
onOpenChange,
|
|
1161
|
-
elements,
|
|
1162
|
-
events,
|
|
1163
|
-
floatingId,
|
|
1164
|
-
refs
|
|
1165
|
-
}), [open, onOpenChange, elements, events, floatingId, refs]);
|
|
1166
|
-
}
|
|
1167
|
-
function useFloating(options) {
|
|
1168
|
-
if (options === void 0) {
|
|
1169
|
-
options = {};
|
|
1170
|
-
}
|
|
1171
|
-
const {
|
|
1172
|
-
nodeId
|
|
1173
|
-
} = options;
|
|
1174
|
-
const internalRootContext = useFloatingRootContext({
|
|
1175
|
-
...options,
|
|
1176
|
-
elements: {
|
|
1177
|
-
reference: null,
|
|
1178
|
-
floating: null,
|
|
1179
|
-
...options.elements
|
|
1180
|
-
}
|
|
1181
|
-
});
|
|
1182
|
-
const rootContext = options.rootContext || internalRootContext;
|
|
1183
|
-
const computedElements = rootContext.elements;
|
|
1184
|
-
const [_domReference, setDomReference] = React.useState(null);
|
|
1185
|
-
const [positionReference, _setPositionReference] = React.useState(null);
|
|
1186
|
-
const optionDomReference = computedElements == null ? void 0 : computedElements.reference;
|
|
1187
|
-
const domReference = optionDomReference || _domReference;
|
|
1188
|
-
const domReferenceRef = React.useRef(null);
|
|
1189
|
-
const tree = useFloatingTree();
|
|
1190
|
-
index(() => {
|
|
1191
|
-
if (domReference) {
|
|
1192
|
-
domReferenceRef.current = domReference;
|
|
1193
|
-
}
|
|
1194
|
-
}, [domReference]);
|
|
1195
|
-
const position = useFloating$1({
|
|
1196
|
-
...options,
|
|
1197
|
-
elements: {
|
|
1198
|
-
...computedElements,
|
|
1199
|
-
...positionReference && {
|
|
1200
|
-
reference: positionReference
|
|
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", "");
|
|
1201
386
|
}
|
|
1202
387
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
contextElement: node
|
|
1208
|
-
} : node;
|
|
1209
|
-
_setPositionReference(computedPositionReference);
|
|
1210
|
-
position.refs.setReference(computedPositionReference);
|
|
1211
|
-
}, [position.refs]);
|
|
1212
|
-
const setReference = React.useCallback((node) => {
|
|
1213
|
-
if (isElement(node) || node === null) {
|
|
1214
|
-
domReferenceRef.current = node;
|
|
1215
|
-
setDomReference(node);
|
|
1216
|
-
}
|
|
1217
|
-
if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
1218
|
-
// `null` to support `positionReference` + an unstable `reference`
|
|
1219
|
-
// callback ref.
|
|
1220
|
-
node !== null && !isElement(node)) {
|
|
1221
|
-
position.refs.setReference(node);
|
|
1222
|
-
}
|
|
1223
|
-
}, [position.refs]);
|
|
1224
|
-
const refs = React.useMemo(() => ({
|
|
1225
|
-
...position.refs,
|
|
1226
|
-
setReference,
|
|
1227
|
-
setPositionReference,
|
|
1228
|
-
domReference: domReferenceRef
|
|
1229
|
-
}), [position.refs, setReference, setPositionReference]);
|
|
1230
|
-
const elements = React.useMemo(() => ({
|
|
1231
|
-
...position.elements,
|
|
1232
|
-
domReference
|
|
1233
|
-
}), [position.elements, domReference]);
|
|
1234
|
-
const context = React.useMemo(() => ({
|
|
1235
|
-
...position,
|
|
1236
|
-
...rootContext,
|
|
1237
|
-
refs,
|
|
1238
|
-
elements,
|
|
1239
|
-
nodeId
|
|
1240
|
-
}), [position, refs, elements, nodeId, rootContext]);
|
|
1241
|
-
index(() => {
|
|
1242
|
-
rootContext.dataRef.current.floatingContext = context;
|
|
1243
|
-
const node = tree == null ? void 0 : tree.nodesRef.current.find((node2) => node2.id === nodeId);
|
|
1244
|
-
if (node) {
|
|
1245
|
-
node.context = context;
|
|
388
|
+
for (let node of Array.from(elt.childNodes)) {
|
|
389
|
+
if (node.nodeType === 1) {
|
|
390
|
+
this.processElement(node);
|
|
391
|
+
}
|
|
1246
392
|
}
|
|
1247
|
-
});
|
|
1248
|
-
return React.useMemo(() => ({
|
|
1249
|
-
...position,
|
|
1250
|
-
context,
|
|
1251
|
-
refs,
|
|
1252
|
-
elements
|
|
1253
|
-
}), [position, refs, elements, context]);
|
|
1254
|
-
}
|
|
1255
|
-
const ACTIVE_KEY = "active";
|
|
1256
|
-
const SELECTED_KEY = "selected";
|
|
1257
|
-
function mergeProps(userProps, propsList, elementKey) {
|
|
1258
|
-
const map = /* @__PURE__ */ new Map();
|
|
1259
|
-
const isItem = elementKey === "item";
|
|
1260
|
-
let domUserProps = userProps;
|
|
1261
|
-
if (isItem && userProps) {
|
|
1262
|
-
const {
|
|
1263
|
-
[ACTIVE_KEY]: _,
|
|
1264
|
-
[SELECTED_KEY]: __,
|
|
1265
|
-
...validProps
|
|
1266
|
-
} = userProps;
|
|
1267
|
-
domUserProps = validProps;
|
|
1268
393
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
}).concat(userProps).reduce((acc, props) => {
|
|
1281
|
-
if (!props) {
|
|
1282
|
-
return acc;
|
|
1283
|
-
}
|
|
1284
|
-
Object.entries(props).forEach((_ref) => {
|
|
1285
|
-
let [key, value] = _ref;
|
|
1286
|
-
if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
if (key.indexOf("on") === 0) {
|
|
1290
|
-
if (!map.has(key)) {
|
|
1291
|
-
map.set(key, []);
|
|
1292
|
-
}
|
|
1293
|
-
if (typeof value === "function") {
|
|
1294
|
-
var _map$get;
|
|
1295
|
-
(_map$get = map.get(key)) == null || _map$get.push(value);
|
|
1296
|
-
acc[key] = function() {
|
|
1297
|
-
var _map$get2;
|
|
1298
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1299
|
-
args[_key] = arguments[_key];
|
|
1300
|
-
}
|
|
1301
|
-
return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn) => fn(...args)).find((val) => val !== void 0);
|
|
1302
|
-
};
|
|
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]));
|
|
1303
405
|
}
|
|
1304
406
|
} else {
|
|
1305
|
-
|
|
407
|
+
result = result.replace(replacements[0], "");
|
|
1306
408
|
}
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
function useInteractions(propsList) {
|
|
1313
|
-
if (propsList === void 0) {
|
|
1314
|
-
propsList = [];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return result;
|
|
1315
412
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
);
|
|
1324
|
-
const getFloatingProps = React.useCallback(
|
|
1325
|
-
(userProps) => mergeProps(userProps, propsList, "floating"),
|
|
1326
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1327
|
-
floatingDeps
|
|
1328
|
-
);
|
|
1329
|
-
const getItemProps = React.useCallback(
|
|
1330
|
-
(userProps) => mergeProps(userProps, propsList, "item"),
|
|
1331
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1332
|
-
itemDeps
|
|
1333
|
-
);
|
|
1334
|
-
return React.useMemo(() => ({
|
|
1335
|
-
getReferenceProps,
|
|
1336
|
-
getFloatingProps,
|
|
1337
|
-
getItemProps
|
|
1338
|
-
}), [getReferenceProps, getFloatingProps, getItemProps]);
|
|
1339
|
-
}
|
|
1340
|
-
const componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", false]]);
|
|
1341
|
-
function useRole(context, props) {
|
|
1342
|
-
var _componentRoleToAriaR;
|
|
1343
|
-
if (props === void 0) {
|
|
1344
|
-
props = {};
|
|
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
|
+
}
|
|
1345
420
|
}
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
const referenceId = useId();
|
|
1356
|
-
const parentId = useFloatingParentNodeId();
|
|
1357
|
-
const isNested = parentId != null;
|
|
1358
|
-
const reference = React.useMemo(() => {
|
|
1359
|
-
if (ariaRole === "tooltip" || role === "label") {
|
|
1360
|
-
return {
|
|
1361
|
-
["aria-" + (role === "label" ? "labelledby" : "describedby")]: open ? floatingId : void 0
|
|
1362
|
-
};
|
|
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);
|
|
1363
430
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
}
|
|
1383
|
-
};
|
|
1384
|
-
}, [ariaRole, floatingId, isNested, open, referenceId, role]);
|
|
1385
|
-
const floating = React.useMemo(() => {
|
|
1386
|
-
const floatingProps = {
|
|
1387
|
-
id: floatingId,
|
|
1388
|
-
...ariaRole && {
|
|
1389
|
-
role: ariaRole
|
|
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
|
+
}
|
|
1390
449
|
}
|
|
1391
|
-
};
|
|
1392
|
-
if (ariaRole === "tooltip" || role === "label") {
|
|
1393
|
-
return floatingProps;
|
|
1394
450
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
id: floatingId + "-option"
|
|
1411
|
-
}
|
|
1412
|
-
};
|
|
1413
|
-
switch (role) {
|
|
1414
|
-
case "select":
|
|
1415
|
-
return {
|
|
1416
|
-
...commonProps,
|
|
1417
|
-
"aria-selected": active && selected
|
|
1418
|
-
};
|
|
1419
|
-
case "combobox": {
|
|
1420
|
-
return {
|
|
1421
|
-
...commonProps,
|
|
1422
|
-
...active && {
|
|
1423
|
-
"aria-selected": true
|
|
1424
|
-
}
|
|
1425
|
-
};
|
|
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);
|
|
1426
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);
|
|
1427
474
|
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
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);
|
|
1435
486
|
}
|
|
1436
487
|
export {
|
|
1437
|
-
|
|
1438
|
-
FloatingPortal,
|
|
1439
|
-
flip,
|
|
1440
|
-
getOverflowAncestors,
|
|
1441
|
-
inline,
|
|
1442
|
-
offset,
|
|
1443
|
-
shift,
|
|
1444
|
-
useDismiss,
|
|
1445
|
-
useFloating,
|
|
1446
|
-
useFloatingParentNodeId,
|
|
1447
|
-
useFloatingPortalNode,
|
|
1448
|
-
useFloatingRootContext,
|
|
1449
|
-
useFloatingTree,
|
|
1450
|
-
useId,
|
|
1451
|
-
useInteractions,
|
|
1452
|
-
useRole
|
|
488
|
+
CETEI as default
|
|
1453
489
|
};
|
|
1454
490
|
//# sourceMappingURL=react-text-annotator.es11.js.map
|