@soomo/react-text-annotator 3.1.0-staging.8 → 3.2.0-staging.0
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/TextAnnotationPopup/TextAnnotationPopup.d.ts +32 -0
- package/dist/TextAnnotationPopup/TextAnnotationPopup.d.ts.map +1 -0
- package/dist/TextAnnotationPopup/index.d.ts +2 -0
- package/dist/TextAnnotationPopup/index.d.ts.map +1 -0
- package/dist/TextAnnotationPopup/isMobile.d.ts.map +1 -0
- package/dist/TextAnnotator.d.ts +5 -5
- package/dist/TextAnnotator.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useAnnotationQuoteIdling.d.ts +4 -0
- package/dist/hooks/useAnnotationQuoteIdling.d.ts.map +1 -0
- package/dist/hooks/useAnnouncePopupNavigation.d.ts.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/react-text-annotator.es.js +10 -4
- package/dist/react-text-annotator.es.js.map +1 -1
- package/dist/react-text-annotator.es10.js +24 -10
- package/dist/react-text-annotator.es10.js.map +1 -1
- package/dist/react-text-annotator.es11.js +82 -9
- package/dist/react-text-annotator.es11.js.map +1 -1
- package/dist/react-text-annotator.es12.js +33 -1436
- package/dist/react-text-annotator.es12.js.map +1 -1
- package/dist/react-text-annotator.es13.js +28 -0
- package/dist/react-text-annotator.es13.js.map +1 -0
- package/dist/react-text-annotator.es14.js +1590 -193
- package/dist/react-text-annotator.es14.js.map +1 -1
- package/dist/react-text-annotator.es15.js +9 -584
- package/dist/react-text-annotator.es15.js.map +1 -1
- package/dist/react-text-annotator.es17.js +592 -33
- package/dist/react-text-annotator.es17.js.map +1 -1
- package/dist/react-text-annotator.es18.js +282 -2
- package/dist/react-text-annotator.es18.js.map +1 -1
- package/dist/react-text-annotator.es19.js +13 -29
- package/dist/react-text-annotator.es19.js.map +1 -1
- package/dist/react-text-annotator.es2.js +5 -2
- package/dist/react-text-annotator.es2.js.map +1 -1
- package/dist/react-text-annotator.es20.js +2 -898
- package/dist/react-text-annotator.es20.js.map +1 -1
- package/dist/react-text-annotator.es21.js +30 -113
- package/dist/react-text-annotator.es21.js.map +1 -1
- package/dist/react-text-annotator.es22.js +876 -297
- package/dist/react-text-annotator.es22.js.map +1 -1
- package/dist/react-text-annotator.es23.js +109 -53
- package/dist/react-text-annotator.es23.js.map +1 -1
- package/dist/react-text-annotator.es24.js +306 -17
- package/dist/react-text-annotator.es24.js.map +1 -1
- package/dist/react-text-annotator.es25.js +58 -2
- package/dist/react-text-annotator.es25.js.map +1 -1
- package/dist/react-text-annotator.es26.js +20 -2
- package/dist/react-text-annotator.es26.js.map +1 -1
- package/dist/react-text-annotator.es27.js +2 -127
- package/dist/react-text-annotator.es27.js.map +1 -1
- package/dist/react-text-annotator.es28.js +2 -164
- package/dist/react-text-annotator.es28.js.map +1 -1
- package/dist/react-text-annotator.es29.js +115 -299
- package/dist/react-text-annotator.es29.js.map +1 -1
- package/dist/react-text-annotator.es3.js +3 -3
- package/dist/react-text-annotator.es3.js.map +1 -1
- package/dist/react-text-annotator.es30.js +146 -131
- package/dist/react-text-annotator.es30.js.map +1 -1
- package/dist/react-text-annotator.es31.js +281 -533
- package/dist/react-text-annotator.es31.js.map +1 -1
- package/dist/react-text-annotator.es32.js +152 -0
- package/dist/react-text-annotator.es32.js.map +1 -0
- package/dist/react-text-annotator.es33.js +629 -0
- package/dist/react-text-annotator.es33.js.map +1 -0
- package/dist/react-text-annotator.es4.js +2 -2
- package/dist/react-text-annotator.es4.js.map +1 -1
- package/dist/react-text-annotator.es5.js +43 -24
- package/dist/react-text-annotator.es5.js.map +1 -1
- package/dist/react-text-annotator.es6.js +23 -122
- package/dist/react-text-annotator.es6.js.map +1 -1
- package/dist/react-text-annotator.es7.js +133 -537
- package/dist/react-text-annotator.es7.js.map +1 -1
- package/dist/react-text-annotator.es8.js +2 -9
- package/dist/react-text-annotator.es8.js.map +1 -1
- package/dist/tei/CETEIcean.d.ts +1 -0
- package/dist/tei/CETEIcean.d.ts.map +1 -1
- package/dist/tei/TEIAnnotator.d.ts +1 -1
- package/dist/tei/TEIAnnotator.d.ts.map +1 -1
- package/package.json +16 -14
- package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts +0 -25
- package/dist/TextAnnotatorPopup/TextAnnotatorPopup.d.ts.map +0 -1
- package/dist/TextAnnotatorPopup/index.d.ts +0 -2
- package/dist/TextAnnotatorPopup/index.d.ts.map +0 -1
- package/dist/TextAnnotatorPopup/isMobile.d.ts.map +0 -1
- package/dist/react-text-annotator.es16.js +0 -85
- package/dist/react-text-annotator.es16.js.map +0 -1
- /package/dist/{TextAnnotatorPopup → TextAnnotationPopup}/isMobile.d.ts +0 -0
|
@@ -1,167 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
return typeof window !== "undefined";
|
|
3
|
-
}
|
|
4
|
-
function getNodeName(node) {
|
|
5
|
-
if (isNode(node)) {
|
|
6
|
-
return (node.nodeName || "").toLowerCase();
|
|
7
|
-
}
|
|
8
|
-
return "#document";
|
|
9
|
-
}
|
|
10
|
-
function getWindow(node) {
|
|
11
|
-
var _node$ownerDocument;
|
|
12
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
13
|
-
}
|
|
14
|
-
function getDocumentElement(node) {
|
|
15
|
-
var _ref;
|
|
16
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
17
|
-
}
|
|
18
|
-
function isNode(value) {
|
|
19
|
-
if (!hasWindow()) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
23
|
-
}
|
|
24
|
-
function isElement(value) {
|
|
25
|
-
if (!hasWindow()) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
29
|
-
}
|
|
30
|
-
function isHTMLElement(value) {
|
|
31
|
-
if (!hasWindow()) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
35
|
-
}
|
|
36
|
-
function isShadowRoot(value) {
|
|
37
|
-
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
41
|
-
}
|
|
42
|
-
function isOverflowElement(element) {
|
|
43
|
-
const {
|
|
44
|
-
overflow,
|
|
45
|
-
overflowX,
|
|
46
|
-
overflowY,
|
|
47
|
-
display
|
|
48
|
-
} = getComputedStyle(element);
|
|
49
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
50
|
-
}
|
|
51
|
-
function isTableElement(element) {
|
|
52
|
-
return ["table", "td", "th"].includes(getNodeName(element));
|
|
53
|
-
}
|
|
54
|
-
function isTopLayer(element) {
|
|
55
|
-
return [":popover-open", ":modal"].some((selector) => {
|
|
56
|
-
try {
|
|
57
|
-
return element.matches(selector);
|
|
58
|
-
} catch (e) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function isContainingBlock(elementOrCss) {
|
|
64
|
-
const webkit = isWebKit();
|
|
65
|
-
const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
|
|
66
|
-
return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
67
|
-
}
|
|
68
|
-
function getContainingBlock(element) {
|
|
69
|
-
let currentNode = getParentNode(element);
|
|
70
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
71
|
-
if (isContainingBlock(currentNode)) {
|
|
72
|
-
return currentNode;
|
|
73
|
-
} else if (isTopLayer(currentNode)) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
currentNode = getParentNode(currentNode);
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
function isWebKit() {
|
|
81
|
-
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
82
|
-
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
83
|
-
}
|
|
84
|
-
function isLastTraversableNode(node) {
|
|
85
|
-
return ["html", "body", "#document"].includes(getNodeName(node));
|
|
86
|
-
}
|
|
87
|
-
function getComputedStyle(element) {
|
|
88
|
-
return getWindow(element).getComputedStyle(element);
|
|
89
|
-
}
|
|
90
|
-
function getNodeScroll(element) {
|
|
91
|
-
if (isElement(element)) {
|
|
92
|
-
return {
|
|
93
|
-
scrollLeft: element.scrollLeft,
|
|
94
|
-
scrollTop: element.scrollTop
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
scrollLeft: element.scrollX,
|
|
99
|
-
scrollTop: element.scrollY
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function getParentNode(node) {
|
|
103
|
-
if (getNodeName(node) === "html") {
|
|
104
|
-
return node;
|
|
105
|
-
}
|
|
106
|
-
const result = (
|
|
107
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
108
|
-
node.assignedSlot || // DOM Element detected.
|
|
109
|
-
node.parentNode || // ShadowRoot detected.
|
|
110
|
-
isShadowRoot(node) && node.host || // Fallback.
|
|
111
|
-
getDocumentElement(node)
|
|
112
|
-
);
|
|
113
|
-
return isShadowRoot(result) ? result.host : result;
|
|
114
|
-
}
|
|
115
|
-
function getNearestOverflowAncestor(node) {
|
|
116
|
-
const parentNode = getParentNode(node);
|
|
117
|
-
if (isLastTraversableNode(parentNode)) {
|
|
118
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
119
|
-
}
|
|
120
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
121
|
-
return parentNode;
|
|
122
|
-
}
|
|
123
|
-
return getNearestOverflowAncestor(parentNode);
|
|
124
|
-
}
|
|
125
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
126
|
-
var _node$ownerDocument2;
|
|
127
|
-
if (list === void 0) {
|
|
128
|
-
list = [];
|
|
129
|
-
}
|
|
130
|
-
if (traverseIframes === void 0) {
|
|
131
|
-
traverseIframes = true;
|
|
132
|
-
}
|
|
133
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
134
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
135
|
-
const win = getWindow(scrollableAncestor);
|
|
136
|
-
if (isBody) {
|
|
137
|
-
const frameElement = getFrameElement(win);
|
|
138
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
139
|
-
}
|
|
140
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
141
|
-
}
|
|
142
|
-
function getFrameElement(win) {
|
|
143
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
144
|
-
}
|
|
1
|
+
var reactJsxRuntime_development = {};
|
|
145
2
|
export {
|
|
146
|
-
|
|
147
|
-
getContainingBlock,
|
|
148
|
-
getDocumentElement,
|
|
149
|
-
getFrameElement,
|
|
150
|
-
getNearestOverflowAncestor,
|
|
151
|
-
getNodeName,
|
|
152
|
-
getNodeScroll,
|
|
153
|
-
getOverflowAncestors,
|
|
154
|
-
getParentNode,
|
|
155
|
-
getWindow,
|
|
156
|
-
isContainingBlock,
|
|
157
|
-
isElement,
|
|
158
|
-
isHTMLElement,
|
|
159
|
-
isLastTraversableNode,
|
|
160
|
-
isNode,
|
|
161
|
-
isOverflowElement,
|
|
162
|
-
isShadowRoot,
|
|
163
|
-
isTableElement,
|
|
164
|
-
isTopLayer,
|
|
165
|
-
isWebKit
|
|
3
|
+
reactJsxRuntime_development as __exports
|
|
166
4
|
};
|
|
167
5
|
//# sourceMappingURL=react-text-annotator.es28.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-text-annotator.es28.js","sources":[
|
|
1
|
+
{"version":3,"file":"react-text-annotator.es28.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,314 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} : function(element) {
|
|
14
|
-
return element === null || element === void 0 ? void 0 : element.ownerDocument;
|
|
15
|
-
};
|
|
16
|
-
var isInert = function isInert2(node, lookUp) {
|
|
17
|
-
var _node$getAttribute;
|
|
18
|
-
if (lookUp === void 0) {
|
|
19
|
-
lookUp = true;
|
|
20
|
-
}
|
|
21
|
-
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
|
|
22
|
-
var inert = inertAtt === "" || inertAtt === "true";
|
|
23
|
-
var result = inert || lookUp && node && isInert2(node.parentNode);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var isContentEditable = function isContentEditable2(node) {
|
|
27
|
-
var _node$getAttribute2;
|
|
28
|
-
var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable");
|
|
29
|
-
return attValue === "" || attValue === "true";
|
|
30
|
-
};
|
|
31
|
-
var getCandidates = function getCandidates2(el, includeContainer, filter) {
|
|
32
|
-
if (isInert(el)) {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
|
|
36
|
-
if (includeContainer && matches.call(el, candidateSelector)) {
|
|
37
|
-
candidates.unshift(el);
|
|
38
|
-
}
|
|
39
|
-
candidates = candidates.filter(filter);
|
|
40
|
-
return candidates;
|
|
41
|
-
};
|
|
42
|
-
var getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {
|
|
43
|
-
var candidates = [];
|
|
44
|
-
var elementsToCheck = Array.from(elements);
|
|
45
|
-
while (elementsToCheck.length) {
|
|
46
|
-
var element = elementsToCheck.shift();
|
|
47
|
-
if (isInert(element, false)) {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (element.tagName === "SLOT") {
|
|
51
|
-
var assigned = element.assignedElements();
|
|
52
|
-
var content = assigned.length ? assigned : element.children;
|
|
53
|
-
var nestedCandidates = getCandidatesIteratively2(content, true, options);
|
|
54
|
-
if (options.flatten) {
|
|
55
|
-
candidates.push.apply(candidates, nestedCandidates);
|
|
56
|
-
} else {
|
|
57
|
-
candidates.push({
|
|
58
|
-
scopeParent: element,
|
|
59
|
-
candidates: nestedCandidates
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
var validCandidate = matches.call(element, candidateSelector);
|
|
64
|
-
if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
|
|
65
|
-
candidates.push(element);
|
|
66
|
-
}
|
|
67
|
-
var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
|
|
68
|
-
typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
|
|
69
|
-
var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
|
|
70
|
-
if (shadowRoot && validShadowRoot) {
|
|
71
|
-
var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);
|
|
72
|
-
if (options.flatten) {
|
|
73
|
-
candidates.push.apply(candidates, _nestedCandidates);
|
|
74
|
-
} else {
|
|
75
|
-
candidates.push({
|
|
76
|
-
scopeParent: element,
|
|
77
|
-
candidates: _nestedCandidates
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
} else {
|
|
81
|
-
elementsToCheck.unshift.apply(elementsToCheck, element.children);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return candidates;
|
|
86
|
-
};
|
|
87
|
-
var hasTabIndex = function hasTabIndex2(node) {
|
|
88
|
-
return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
|
|
89
|
-
};
|
|
90
|
-
var getTabIndex = function getTabIndex2(node) {
|
|
91
|
-
if (!node) {
|
|
92
|
-
throw new Error("No node provided");
|
|
93
|
-
}
|
|
94
|
-
if (node.tabIndex < 0) {
|
|
95
|
-
if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
|
|
96
|
-
return 0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return node.tabIndex;
|
|
100
|
-
};
|
|
101
|
-
var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
|
|
102
|
-
var tabIndex = getTabIndex(node);
|
|
103
|
-
if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
|
|
104
|
-
return 0;
|
|
105
|
-
}
|
|
106
|
-
return tabIndex;
|
|
107
|
-
};
|
|
108
|
-
var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
|
|
109
|
-
return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
|
|
110
|
-
};
|
|
111
|
-
var isInput = function isInput2(node) {
|
|
112
|
-
return node.tagName === "INPUT";
|
|
113
|
-
};
|
|
114
|
-
var isHiddenInput = function isHiddenInput2(node) {
|
|
115
|
-
return isInput(node) && node.type === "hidden";
|
|
116
|
-
};
|
|
117
|
-
var isDetailsWithSummary = function isDetailsWithSummary2(node) {
|
|
118
|
-
var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
|
|
119
|
-
return child.tagName === "SUMMARY";
|
|
120
|
-
});
|
|
121
|
-
return r;
|
|
122
|
-
};
|
|
123
|
-
var getCheckedRadio = function getCheckedRadio2(nodes, form) {
|
|
124
|
-
for (var i = 0; i < nodes.length; i++) {
|
|
125
|
-
if (nodes[i].checked && nodes[i].form === form) {
|
|
126
|
-
return nodes[i];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
var isTabbableRadio = function isTabbableRadio2(node) {
|
|
131
|
-
if (!node.name) {
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
var radioScope = node.form || getRootNode(node);
|
|
135
|
-
var queryRadios = function queryRadios2(name) {
|
|
136
|
-
return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
|
|
137
|
-
};
|
|
138
|
-
var radioSet;
|
|
139
|
-
if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
|
|
140
|
-
radioSet = queryRadios(window.CSS.escape(node.name));
|
|
141
|
-
} else {
|
|
142
|
-
try {
|
|
143
|
-
radioSet = queryRadios(node.name);
|
|
144
|
-
} catch (err) {
|
|
145
|
-
console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message);
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
var checked = getCheckedRadio(radioSet, node.form);
|
|
150
|
-
return !checked || checked === node;
|
|
151
|
-
};
|
|
152
|
-
var isRadio = function isRadio2(node) {
|
|
153
|
-
return isInput(node) && node.type === "radio";
|
|
154
|
-
};
|
|
155
|
-
var isNonTabbableRadio = function isNonTabbableRadio2(node) {
|
|
156
|
-
return isRadio(node) && !isTabbableRadio(node);
|
|
157
|
-
};
|
|
158
|
-
var isNodeAttached = function isNodeAttached2(node) {
|
|
159
|
-
var _nodeRoot;
|
|
160
|
-
var nodeRoot = node && getRootNode(node);
|
|
161
|
-
var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
|
|
162
|
-
var attached = false;
|
|
163
|
-
if (nodeRoot && nodeRoot !== node) {
|
|
164
|
-
var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
|
|
165
|
-
attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
|
|
166
|
-
while (!attached && nodeRootHost) {
|
|
167
|
-
var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
|
|
168
|
-
nodeRoot = getRootNode(nodeRootHost);
|
|
169
|
-
nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
|
|
170
|
-
attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return attached;
|
|
174
|
-
};
|
|
175
|
-
var isZeroArea = function isZeroArea2(node) {
|
|
176
|
-
var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
|
|
177
|
-
return width === 0 && height === 0;
|
|
178
|
-
};
|
|
179
|
-
var isHidden = function isHidden2(node, _ref) {
|
|
180
|
-
var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
|
|
181
|
-
if (getComputedStyle(node).visibility === "hidden") {
|
|
182
|
-
return true;
|
|
1
|
+
import { isShadowRoot, isHTMLElement } from "./react-text-annotator.es30.js";
|
|
2
|
+
function activeElement(doc) {
|
|
3
|
+
let activeElement2 = doc.activeElement;
|
|
4
|
+
while (((_activeElement = activeElement2) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {
|
|
5
|
+
var _activeElement;
|
|
6
|
+
activeElement2 = activeElement2.shadowRoot.activeElement;
|
|
7
|
+
}
|
|
8
|
+
return activeElement2;
|
|
9
|
+
}
|
|
10
|
+
function contains(parent, child) {
|
|
11
|
+
if (!parent || !child) {
|
|
12
|
+
return false;
|
|
183
13
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
|
|
14
|
+
const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
|
|
15
|
+
if (parent.contains(child)) {
|
|
187
16
|
return true;
|
|
188
17
|
}
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var parentElement = node.parentElement;
|
|
194
|
-
var rootNode = getRootNode(node);
|
|
195
|
-
if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
|
|
196
|
-
return isZeroArea(node);
|
|
197
|
-
} else if (node.assignedSlot) {
|
|
198
|
-
node = node.assignedSlot;
|
|
199
|
-
} else if (!parentElement && rootNode !== node.ownerDocument) {
|
|
200
|
-
node = rootNode.host;
|
|
201
|
-
} else {
|
|
202
|
-
node = parentElement;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
node = originalNode;
|
|
206
|
-
}
|
|
207
|
-
if (isNodeAttached(node)) {
|
|
208
|
-
return !node.getClientRects().length;
|
|
209
|
-
}
|
|
210
|
-
if (displayCheck !== "legacy-full") {
|
|
211
|
-
return true;
|
|
212
|
-
}
|
|
213
|
-
} else if (displayCheck === "non-zero-area") {
|
|
214
|
-
return isZeroArea(node);
|
|
215
|
-
}
|
|
216
|
-
return false;
|
|
217
|
-
};
|
|
218
|
-
var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
|
|
219
|
-
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
|
|
220
|
-
var parentNode = node.parentElement;
|
|
221
|
-
while (parentNode) {
|
|
222
|
-
if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
|
|
223
|
-
for (var i = 0; i < parentNode.children.length; i++) {
|
|
224
|
-
var child = parentNode.children.item(i);
|
|
225
|
-
if (child.tagName === "LEGEND") {
|
|
226
|
-
return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
18
|
+
if (rootNode && isShadowRoot(rootNode)) {
|
|
19
|
+
let next = child;
|
|
20
|
+
while (next) {
|
|
21
|
+
if (parent === next) {
|
|
229
22
|
return true;
|
|
230
23
|
}
|
|
231
|
-
|
|
24
|
+
next = next.parentNode || next.host;
|
|
232
25
|
}
|
|
233
26
|
}
|
|
234
27
|
return false;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
28
|
+
}
|
|
29
|
+
function getPlatform() {
|
|
30
|
+
const uaData = navigator.userAgentData;
|
|
31
|
+
if (uaData != null && uaData.platform) {
|
|
32
|
+
return uaData.platform;
|
|
33
|
+
}
|
|
34
|
+
return navigator.platform;
|
|
35
|
+
}
|
|
36
|
+
function getUserAgent() {
|
|
37
|
+
const uaData = navigator.userAgentData;
|
|
38
|
+
if (uaData && Array.isArray(uaData.brands)) {
|
|
39
|
+
return uaData.brands.map((_ref) => {
|
|
40
|
+
let {
|
|
41
|
+
brand,
|
|
42
|
+
version
|
|
43
|
+
} = _ref;
|
|
44
|
+
return brand + "/" + version;
|
|
45
|
+
}).join(" ");
|
|
46
|
+
}
|
|
47
|
+
return navigator.userAgent;
|
|
48
|
+
}
|
|
49
|
+
function isVirtualClick(event) {
|
|
50
|
+
if (event.mozInputSource === 0 && event.isTrusted) {
|
|
255
51
|
return true;
|
|
256
52
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (
|
|
288
|
-
candidates = getCandidatesIteratively([container], options.includeContainer, {
|
|
289
|
-
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
290
|
-
flatten: false,
|
|
291
|
-
getShadowRoot: options.getShadowRoot,
|
|
292
|
-
shadowRootFilter: isValidShadowRootTabbable
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
296
|
-
}
|
|
297
|
-
return sortByOrder(candidates);
|
|
298
|
-
};
|
|
299
|
-
var isTabbable = function isTabbable2(node, options) {
|
|
300
|
-
options = options || {};
|
|
301
|
-
if (!node) {
|
|
302
|
-
throw new Error("No node provided");
|
|
303
|
-
}
|
|
304
|
-
if (matches.call(node, candidateSelector) === false) {
|
|
53
|
+
if (isAndroid() && event.pointerType) {
|
|
54
|
+
return event.type === "click" && event.buttons === 1;
|
|
55
|
+
}
|
|
56
|
+
return event.detail === 0 && !event.pointerType;
|
|
57
|
+
}
|
|
58
|
+
function isVirtualPointerEvent(event) {
|
|
59
|
+
if (isJSDOM()) return false;
|
|
60
|
+
return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height.
|
|
61
|
+
event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch";
|
|
62
|
+
}
|
|
63
|
+
function isSafari() {
|
|
64
|
+
return /apple/i.test(navigator.vendor);
|
|
65
|
+
}
|
|
66
|
+
function isAndroid() {
|
|
67
|
+
const re = /android/i;
|
|
68
|
+
return re.test(getPlatform()) || re.test(getUserAgent());
|
|
69
|
+
}
|
|
70
|
+
function isJSDOM() {
|
|
71
|
+
return getUserAgent().includes("jsdom/");
|
|
72
|
+
}
|
|
73
|
+
function isReactEvent(event) {
|
|
74
|
+
return "nativeEvent" in event;
|
|
75
|
+
}
|
|
76
|
+
function isRootElement(element) {
|
|
77
|
+
return element.matches("html,body");
|
|
78
|
+
}
|
|
79
|
+
function getDocument(node) {
|
|
80
|
+
return (node == null ? void 0 : node.ownerDocument) || document;
|
|
81
|
+
}
|
|
82
|
+
function isEventTargetWithin(event, node) {
|
|
83
|
+
if (node == null) {
|
|
305
84
|
return false;
|
|
306
85
|
}
|
|
307
|
-
|
|
308
|
-
|
|
86
|
+
if ("composedPath" in event) {
|
|
87
|
+
return event.composedPath().includes(node);
|
|
88
|
+
}
|
|
89
|
+
const e = event;
|
|
90
|
+
return e.target != null && node.contains(e.target);
|
|
91
|
+
}
|
|
92
|
+
function getTarget(event) {
|
|
93
|
+
if ("composedPath" in event) {
|
|
94
|
+
return event.composedPath()[0];
|
|
95
|
+
}
|
|
96
|
+
return event.target;
|
|
97
|
+
}
|
|
98
|
+
const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
99
|
+
function isTypeableElement(element) {
|
|
100
|
+
return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
|
|
101
|
+
}
|
|
102
|
+
function stopEvent(event) {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
event.stopPropagation();
|
|
105
|
+
}
|
|
106
|
+
function isTypeableCombobox(element) {
|
|
107
|
+
if (!element) return false;
|
|
108
|
+
return element.getAttribute("role") === "combobox" && isTypeableElement(element);
|
|
109
|
+
}
|
|
309
110
|
export {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
111
|
+
TYPEABLE_SELECTOR,
|
|
112
|
+
activeElement,
|
|
113
|
+
contains,
|
|
114
|
+
getDocument,
|
|
115
|
+
getPlatform,
|
|
116
|
+
getTarget,
|
|
117
|
+
getUserAgent,
|
|
118
|
+
isAndroid,
|
|
119
|
+
isEventTargetWithin,
|
|
120
|
+
isJSDOM,
|
|
121
|
+
isReactEvent,
|
|
122
|
+
isRootElement,
|
|
123
|
+
isSafari,
|
|
124
|
+
isTypeableCombobox,
|
|
125
|
+
isTypeableElement,
|
|
126
|
+
isVirtualClick,
|
|
127
|
+
isVirtualPointerEvent,
|
|
128
|
+
stopEvent
|
|
313
129
|
};
|
|
314
130
|
//# sourceMappingURL=react-text-annotator.es29.js.map
|