@soomo/react-text-annotator 3.1.0-staging.9 → 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 +31 -2
- package/dist/react-text-annotator.es21.js.map +1 -1
- package/dist/react-text-annotator.es22.js +888 -2
- package/dist/react-text-annotator.es22.js.map +1 -1
- package/dist/react-text-annotator.es23.js +111 -124
- package/dist/react-text-annotator.es23.js.map +1 -1
- package/dist/react-text-annotator.es24.js +285 -140
- package/dist/react-text-annotator.es24.js.map +1 -1
- package/dist/react-text-annotator.es25.js +43 -296
- package/dist/react-text-annotator.es25.js.map +1 -1
- package/dist/react-text-annotator.es26.js +19 -113
- package/dist/react-text-annotator.es26.js.map +1 -1
- package/dist/react-text-annotator.es27.js +2 -309
- package/dist/react-text-annotator.es27.js.map +1 -1
- package/dist/react-text-annotator.es28.js +2 -58
- package/dist/react-text-annotator.es28.js.map +1 -1
- package/dist/react-text-annotator.es29.js +124 -17
- 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,566 +1,314 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
y: reference.y - floating.height
|
|
21
|
-
};
|
|
22
|
-
break;
|
|
23
|
-
case "bottom":
|
|
24
|
-
coords = {
|
|
25
|
-
x: commonX,
|
|
26
|
-
y: reference.y + reference.height
|
|
27
|
-
};
|
|
28
|
-
break;
|
|
29
|
-
case "right":
|
|
30
|
-
coords = {
|
|
31
|
-
x: reference.x + reference.width,
|
|
32
|
-
y: commonY
|
|
33
|
-
};
|
|
34
|
-
break;
|
|
35
|
-
case "left":
|
|
36
|
-
coords = {
|
|
37
|
-
x: reference.x - floating.width,
|
|
38
|
-
y: commonY
|
|
39
|
-
};
|
|
40
|
-
break;
|
|
41
|
-
default:
|
|
42
|
-
coords = {
|
|
43
|
-
x: reference.x,
|
|
44
|
-
y: reference.y
|
|
45
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
* tabbable 6.2.0
|
|
3
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
4
|
+
*/
|
|
5
|
+
var candidateSelectors = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"];
|
|
6
|
+
var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
|
|
7
|
+
var NoElement = typeof Element === "undefined";
|
|
8
|
+
var matches = NoElement ? function() {
|
|
9
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
10
|
+
var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
|
|
11
|
+
var _element$getRootNode;
|
|
12
|
+
return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
|
|
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;
|
|
46
20
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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 [];
|
|
54
34
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
fn
|
|
82
|
-
} = validMiddleware[i];
|
|
83
|
-
const {
|
|
84
|
-
x: nextX,
|
|
85
|
-
y: nextY,
|
|
86
|
-
data,
|
|
87
|
-
reset
|
|
88
|
-
} = await fn({
|
|
89
|
-
x,
|
|
90
|
-
y,
|
|
91
|
-
initialPlacement: placement,
|
|
92
|
-
placement: statefulPlacement,
|
|
93
|
-
strategy,
|
|
94
|
-
middlewareData,
|
|
95
|
-
rects,
|
|
96
|
-
platform,
|
|
97
|
-
elements: {
|
|
98
|
-
reference,
|
|
99
|
-
floating
|
|
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
|
+
});
|
|
100
61
|
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
...middlewareData,
|
|
106
|
-
[name]: {
|
|
107
|
-
...middlewareData[name],
|
|
108
|
-
...data
|
|
62
|
+
} else {
|
|
63
|
+
var validCandidate = matches.call(element, candidateSelector);
|
|
64
|
+
if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
|
|
65
|
+
candidates.push(element);
|
|
109
66
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}) : reset.rects;
|
|
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
|
+
});
|
|
123
79
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
y
|
|
127
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
80
|
+
} else {
|
|
81
|
+
elementsToCheck.unshift.apply(elementsToCheck, element.children);
|
|
128
82
|
}
|
|
129
|
-
i = -1;
|
|
130
83
|
}
|
|
131
84
|
}
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
strategy,
|
|
137
|
-
middlewareData
|
|
138
|
-
};
|
|
85
|
+
return candidates;
|
|
86
|
+
};
|
|
87
|
+
var hasTabIndex = function hasTabIndex2(node) {
|
|
88
|
+
return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
|
|
139
89
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
options = {};
|
|
90
|
+
var getTabIndex = function getTabIndex2(node) {
|
|
91
|
+
if (!node) {
|
|
92
|
+
throw new Error("No node provided");
|
|
144
93
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
rects,
|
|
150
|
-
elements,
|
|
151
|
-
strategy
|
|
152
|
-
} = state;
|
|
153
|
-
const {
|
|
154
|
-
boundary = "clippingAncestors",
|
|
155
|
-
rootBoundary = "viewport",
|
|
156
|
-
elementContext = "floating",
|
|
157
|
-
altBoundary = false,
|
|
158
|
-
padding = 0
|
|
159
|
-
} = evaluate(options, state);
|
|
160
|
-
const paddingObject = getPaddingObject(padding);
|
|
161
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
162
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
163
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
164
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
|
|
165
|
-
boundary,
|
|
166
|
-
rootBoundary,
|
|
167
|
-
strategy
|
|
168
|
-
}));
|
|
169
|
-
const rect = elementContext === "floating" ? {
|
|
170
|
-
x,
|
|
171
|
-
y,
|
|
172
|
-
width: rects.floating.width,
|
|
173
|
-
height: rects.floating.height
|
|
174
|
-
} : rects.reference;
|
|
175
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
176
|
-
const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
|
|
177
|
-
x: 1,
|
|
178
|
-
y: 1
|
|
179
|
-
} : {
|
|
180
|
-
x: 1,
|
|
181
|
-
y: 1
|
|
182
|
-
};
|
|
183
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
184
|
-
elements,
|
|
185
|
-
rect,
|
|
186
|
-
offsetParent,
|
|
187
|
-
strategy
|
|
188
|
-
}) : rect);
|
|
189
|
-
return {
|
|
190
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
191
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
192
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
193
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
const flip = function(options) {
|
|
197
|
-
if (options === void 0) {
|
|
198
|
-
options = {};
|
|
94
|
+
if (node.tabIndex < 0) {
|
|
95
|
+
if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
199
98
|
}
|
|
200
|
-
return
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
229
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
230
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
231
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
232
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
233
|
-
}
|
|
234
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
|
235
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
236
|
-
const overflows = [];
|
|
237
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
238
|
-
if (checkMainAxis) {
|
|
239
|
-
overflows.push(overflow[side]);
|
|
240
|
-
}
|
|
241
|
-
if (checkCrossAxis) {
|
|
242
|
-
const sides = getAlignmentSides(placement, rects, rtl);
|
|
243
|
-
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
244
|
-
}
|
|
245
|
-
overflowsData = [...overflowsData, {
|
|
246
|
-
placement,
|
|
247
|
-
overflows
|
|
248
|
-
}];
|
|
249
|
-
if (!overflows.every((side2) => side2 <= 0)) {
|
|
250
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
251
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
252
|
-
const nextPlacement = placements[nextIndex];
|
|
253
|
-
if (nextPlacement) {
|
|
254
|
-
return {
|
|
255
|
-
data: {
|
|
256
|
-
index: nextIndex,
|
|
257
|
-
overflows: overflowsData
|
|
258
|
-
},
|
|
259
|
-
reset: {
|
|
260
|
-
placement: nextPlacement
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
265
|
-
if (!resetPlacement) {
|
|
266
|
-
switch (fallbackStrategy) {
|
|
267
|
-
case "bestFit": {
|
|
268
|
-
var _overflowsData$filter2;
|
|
269
|
-
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
270
|
-
if (hasFallbackAxisSideDirection) {
|
|
271
|
-
const currentSideAxis = getSideAxis(d.placement);
|
|
272
|
-
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
273
|
-
// reading directions favoring greater width.
|
|
274
|
-
currentSideAxis === "y";
|
|
275
|
-
}
|
|
276
|
-
return true;
|
|
277
|
-
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
278
|
-
if (placement2) {
|
|
279
|
-
resetPlacement = placement2;
|
|
280
|
-
}
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
case "initialPlacement":
|
|
284
|
-
resetPlacement = initialPlacement;
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (placement !== resetPlacement) {
|
|
289
|
-
return {
|
|
290
|
-
reset: {
|
|
291
|
-
placement: resetPlacement
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return {};
|
|
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];
|
|
297
127
|
}
|
|
298
|
-
}
|
|
128
|
+
}
|
|
299
129
|
};
|
|
300
|
-
function
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
y: minY,
|
|
308
|
-
width: maxX - minX,
|
|
309
|
-
height: maxY - minY
|
|
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 + '"]');
|
|
310
137
|
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
} else {
|
|
321
|
-
groups[groups.length - 1].push(rect);
|
|
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;
|
|
322
147
|
}
|
|
323
|
-
prevRect = rect;
|
|
324
148
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
+
}
|
|
330
172
|
}
|
|
331
|
-
return
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
if (
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
const bottom2 = lastRect.bottom;
|
|
362
|
-
const left2 = isTop ? firstRect.left : lastRect.left;
|
|
363
|
-
const right2 = isTop ? firstRect.right : lastRect.right;
|
|
364
|
-
const width2 = right2 - left2;
|
|
365
|
-
const height2 = bottom2 - top2;
|
|
366
|
-
return {
|
|
367
|
-
top: top2,
|
|
368
|
-
bottom: bottom2,
|
|
369
|
-
left: left2,
|
|
370
|
-
right: right2,
|
|
371
|
-
width: width2,
|
|
372
|
-
height: height2,
|
|
373
|
-
x: left2,
|
|
374
|
-
y: top2
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
const isLeftSide = getSide(placement) === "left";
|
|
378
|
-
const maxRight = max(...clientRects.map((rect) => rect.right));
|
|
379
|
-
const minLeft = min(...clientRects.map((rect) => rect.left));
|
|
380
|
-
const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
|
|
381
|
-
const top = measureRects[0].top;
|
|
382
|
-
const bottom = measureRects[measureRects.length - 1].bottom;
|
|
383
|
-
const left = minLeft;
|
|
384
|
-
const right = maxRight;
|
|
385
|
-
const width = right - left;
|
|
386
|
-
const height = bottom - top;
|
|
387
|
-
return {
|
|
388
|
-
top,
|
|
389
|
-
bottom,
|
|
390
|
-
left,
|
|
391
|
-
right,
|
|
392
|
-
width,
|
|
393
|
-
height,
|
|
394
|
-
x: left,
|
|
395
|
-
y: top
|
|
396
|
-
};
|
|
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;
|
|
183
|
+
}
|
|
184
|
+
var isDirectSummary = matches.call(node, "details>summary:first-of-type");
|
|
185
|
+
var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
|
|
186
|
+
if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
if (!displayCheck || displayCheck === "full" || displayCheck === "legacy-full") {
|
|
190
|
+
if (typeof getShadowRoot === "function") {
|
|
191
|
+
var originalNode = node;
|
|
192
|
+
while (node) {
|
|
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;
|
|
397
203
|
}
|
|
398
|
-
return fallback;
|
|
399
204
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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);
|
|
411
227
|
}
|
|
412
|
-
}
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
413
230
|
}
|
|
414
|
-
|
|
231
|
+
parentNode = parentNode.parentElement;
|
|
415
232
|
}
|
|
416
|
-
}
|
|
233
|
+
}
|
|
234
|
+
return false;
|
|
417
235
|
};
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
const side = getSide(placement);
|
|
426
|
-
const alignment = getAlignment(placement);
|
|
427
|
-
const isVertical = getSideAxis(placement) === "y";
|
|
428
|
-
const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
|
|
429
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
430
|
-
const rawValue = evaluate(options, state);
|
|
431
|
-
let {
|
|
432
|
-
mainAxis,
|
|
433
|
-
crossAxis,
|
|
434
|
-
alignmentAxis
|
|
435
|
-
} = typeof rawValue === "number" ? {
|
|
436
|
-
mainAxis: rawValue,
|
|
437
|
-
crossAxis: 0,
|
|
438
|
-
alignmentAxis: null
|
|
439
|
-
} : {
|
|
440
|
-
mainAxis: rawValue.mainAxis || 0,
|
|
441
|
-
crossAxis: rawValue.crossAxis || 0,
|
|
442
|
-
alignmentAxis: rawValue.alignmentAxis
|
|
443
|
-
};
|
|
444
|
-
if (alignment && typeof alignmentAxis === "number") {
|
|
445
|
-
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
236
|
+
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
|
|
237
|
+
if (node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
|
|
238
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
239
|
+
// note related to `candidateSelectors`)
|
|
240
|
+
isInert(node) || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
|
|
241
|
+
isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
|
|
242
|
+
return false;
|
|
446
243
|
}
|
|
447
|
-
return
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
y: crossAxis * crossAxisMulti
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
const offset = function(options) {
|
|
456
|
-
if (options === void 0) {
|
|
457
|
-
options = 0;
|
|
244
|
+
return true;
|
|
245
|
+
};
|
|
246
|
+
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
|
|
247
|
+
if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
|
|
248
|
+
return false;
|
|
458
249
|
}
|
|
459
|
-
return
|
|
460
|
-
name: "offset",
|
|
461
|
-
options,
|
|
462
|
-
async fn(state) {
|
|
463
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
464
|
-
const {
|
|
465
|
-
x,
|
|
466
|
-
y,
|
|
467
|
-
placement,
|
|
468
|
-
middlewareData
|
|
469
|
-
} = state;
|
|
470
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
471
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
472
|
-
return {};
|
|
473
|
-
}
|
|
474
|
-
return {
|
|
475
|
-
x: x + diffCoords.x,
|
|
476
|
-
y: y + diffCoords.y,
|
|
477
|
-
data: {
|
|
478
|
-
...diffCoords,
|
|
479
|
-
placement
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
};
|
|
250
|
+
return true;
|
|
484
251
|
};
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
252
|
+
var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {
|
|
253
|
+
var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
|
|
254
|
+
if (isNaN(tabIndex) || tabIndex >= 0) {
|
|
255
|
+
return true;
|
|
488
256
|
}
|
|
489
|
-
return
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
x: x2,
|
|
509
|
-
y: y2
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
...detectOverflowOptions
|
|
514
|
-
} = evaluate(options, state);
|
|
515
|
-
const coords = {
|
|
516
|
-
x,
|
|
517
|
-
y
|
|
518
|
-
};
|
|
519
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
520
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
521
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
522
|
-
let mainAxisCoord = coords[mainAxis];
|
|
523
|
-
let crossAxisCoord = coords[crossAxis];
|
|
524
|
-
if (checkMainAxis) {
|
|
525
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
|
526
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
527
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
|
528
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
|
529
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
530
|
-
}
|
|
531
|
-
if (checkCrossAxis) {
|
|
532
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
533
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
534
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
|
535
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
|
536
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
537
|
-
}
|
|
538
|
-
const limitedCoords = limiter.fn({
|
|
539
|
-
...state,
|
|
540
|
-
[mainAxis]: mainAxisCoord,
|
|
541
|
-
[crossAxis]: crossAxisCoord
|
|
257
|
+
return false;
|
|
258
|
+
};
|
|
259
|
+
var sortByOrder = function sortByOrder2(candidates) {
|
|
260
|
+
var regularTabbables = [];
|
|
261
|
+
var orderedTabbables = [];
|
|
262
|
+
candidates.forEach(function(item, i) {
|
|
263
|
+
var isScope = !!item.scopeParent;
|
|
264
|
+
var element = isScope ? item.scopeParent : item;
|
|
265
|
+
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
266
|
+
var elements = isScope ? sortByOrder2(item.candidates) : element;
|
|
267
|
+
if (candidateTabindex === 0) {
|
|
268
|
+
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
|
|
269
|
+
} else {
|
|
270
|
+
orderedTabbables.push({
|
|
271
|
+
documentOrder: i,
|
|
272
|
+
tabIndex: candidateTabindex,
|
|
273
|
+
item,
|
|
274
|
+
isScope,
|
|
275
|
+
content: elements
|
|
542
276
|
});
|
|
543
|
-
return {
|
|
544
|
-
...limitedCoords,
|
|
545
|
-
data: {
|
|
546
|
-
x: limitedCoords.x - x,
|
|
547
|
-
y: limitedCoords.y - y,
|
|
548
|
-
enabled: {
|
|
549
|
-
[mainAxis]: checkMainAxis,
|
|
550
|
-
[crossAxis]: checkCrossAxis
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
277
|
}
|
|
555
|
-
};
|
|
278
|
+
});
|
|
279
|
+
return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
|
|
280
|
+
sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
|
|
281
|
+
return acc;
|
|
282
|
+
}, []).concat(regularTabbables);
|
|
283
|
+
};
|
|
284
|
+
var tabbable = function tabbable2(container, options) {
|
|
285
|
+
options = options || {};
|
|
286
|
+
var candidates;
|
|
287
|
+
if (options.getShadowRoot) {
|
|
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) {
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
return isNodeMatchingSelectorTabbable(options, node);
|
|
556
308
|
};
|
|
557
309
|
export {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
inline,
|
|
562
|
-
offset,
|
|
563
|
-
rectToClientRect,
|
|
564
|
-
shift
|
|
310
|
+
getTabIndex,
|
|
311
|
+
isTabbable,
|
|
312
|
+
tabbable
|
|
565
313
|
};
|
|
566
314
|
//# sourceMappingURL=react-text-annotator.es31.js.map
|