@wordpress/dom 4.32.0 → 4.32.1-next.47f435fc9.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/build/data-transfer.js +30 -18
- package/build/data-transfer.js.map +7 -1
- package/build/dom/caret-range-from-point.js +22 -25
- package/build/dom/caret-range-from-point.js.map +7 -1
- package/build/dom/clean-node-list.js +122 -129
- package/build/dom/clean-node-list.js.map +7 -1
- package/build/dom/compute-caret-rect.js +36 -21
- package/build/dom/compute-caret-rect.js.map +7 -1
- package/build/dom/document-has-selection.js +36 -22
- package/build/dom/document-has-selection.js.map +7 -1
- package/build/dom/document-has-text-selection.js +25 -23
- package/build/dom/document-has-text-selection.js.map +7 -1
- package/build/dom/document-has-uncollapsed-selection.js +35 -22
- package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
- package/build/dom/get-computed-style.js +27 -17
- package/build/dom/get-computed-style.js.map +7 -1
- package/build/dom/get-offset-parent.js +43 -32
- package/build/dom/get-offset-parent.js.map +7 -1
- package/build/dom/get-range-height.js +24 -18
- package/build/dom/get-range-height.js.map +7 -1
- package/build/dom/get-rectangle-from-range.js +47 -68
- package/build/dom/get-rectangle-from-range.js.map +7 -1
- package/build/dom/get-scroll-container.js +44 -37
- package/build/dom/get-scroll-container.js.map +7 -1
- package/build/dom/hidden-caret-range-from-point.js +39 -33
- package/build/dom/hidden-caret-range-from-point.js.map +7 -1
- package/build/dom/index.js +116 -195
- package/build/dom/index.js.map +7 -1
- package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
- package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
- package/build/dom/insert-after.js +24 -19
- package/build/dom/insert-after.js.map +7 -1
- package/build/dom/is-edge.js +57 -67
- package/build/dom/is-edge.js.map +7 -1
- package/build/dom/is-element.js +22 -11
- package/build/dom/is-element.js.map +7 -1
- package/build/dom/is-empty.js +27 -17
- package/build/dom/is-empty.js.map +7 -1
- package/build/dom/is-entirely-selected.js +46 -50
- package/build/dom/is-entirely-selected.js.map +7 -1
- package/build/dom/is-form-element.js +36 -24
- package/build/dom/is-form-element.js.map +7 -1
- package/build/dom/is-horizontal-edge.js +34 -20
- package/build/dom/is-horizontal-edge.js.map +7 -1
- package/build/dom/is-html-input-element.js +23 -12
- package/build/dom/is-html-input-element.js.map +7 -1
- package/build/dom/is-input-or-text-area.js +23 -12
- package/build/dom/is-input-or-text-area.js.map +7 -1
- package/build/dom/is-number-input.js +38 -29
- package/build/dom/is-number-input.js.map +7 -1
- package/build/dom/is-rtl.js +34 -19
- package/build/dom/is-rtl.js.map +7 -1
- package/build/dom/is-selection-forward.js +26 -40
- package/build/dom/is-selection-forward.js.map +7 -1
- package/build/dom/is-text-field.js +49 -24
- package/build/dom/is-text-field.js.map +7 -1
- package/build/dom/is-vertical-edge.js +34 -20
- package/build/dom/is-vertical-edge.js.map +7 -1
- package/build/dom/place-caret-at-edge.js +52 -55
- package/build/dom/place-caret-at-edge.js.map +7 -1
- package/build/dom/place-caret-at-horizontal-edge.js +34 -18
- package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
- package/build/dom/place-caret-at-vertical-edge.js +34 -19
- package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
- package/build/dom/remove-invalid-html.js +35 -22
- package/build/dom/remove-invalid-html.js.map +7 -1
- package/build/dom/remove.js +24 -17
- package/build/dom/remove.js.map +7 -1
- package/build/dom/replace-tag.js +24 -19
- package/build/dom/replace-tag.js.map +7 -1
- package/build/dom/replace.js +38 -23
- package/build/dom/replace.js.map +7 -1
- package/build/dom/safe-html.js +39 -28
- package/build/dom/safe-html.js.map +7 -1
- package/build/dom/scroll-if-no-range.js +26 -18
- package/build/dom/scroll-if-no-range.js.map +7 -1
- package/build/dom/strip-html.js +36 -23
- package/build/dom/strip-html.js.map +7 -1
- package/build/dom/unwrap.js +24 -18
- package/build/dom/unwrap.js.map +7 -1
- package/build/dom/wrap.js +24 -17
- package/build/dom/wrap.js.map +7 -1
- package/build/focusable.js +52 -85
- package/build/focusable.js.map +7 -1
- package/build/index.js +44 -58
- package/build/index.js.map +7 -1
- package/build/phrasing-content.js +88 -128
- package/build/phrasing-content.js.map +7 -1
- package/build/tabbable.js +52 -137
- package/build/tabbable.js.map +7 -1
- package/build/utils/assert-is-defined.js +30 -7
- package/build/utils/assert-is-defined.js.map +7 -1
- package/build-module/data-transfer.js +9 -15
- package/build-module/data-transfer.js.map +7 -1
- package/build-module/dom/caret-range-from-point.js +5 -22
- package/build-module/dom/caret-range-from-point.js.map +7 -1
- package/build-module/dom/clean-node-list.js +94 -123
- package/build-module/dom/clean-node-list.js.map +7 -1
- package/build-module/dom/compute-caret-rect.js +8 -16
- package/build-module/dom/compute-caret-rect.js.map +7 -1
- package/build-module/dom/document-has-selection.js +8 -17
- package/build-module/dom/document-has-selection.js.map +7 -1
- package/build-module/dom/document-has-text-selection.js +8 -20
- package/build-module/dom/document-has-text-selection.js.map +7 -1
- package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
- package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
- package/build-module/dom/get-computed-style.js +10 -14
- package/build-module/dom/get-computed-style.js.map +7 -1
- package/build-module/dom/get-offset-parent.js +16 -28
- package/build-module/dom/get-offset-parent.js.map +7 -1
- package/build-module/dom/get-range-height.js +7 -15
- package/build-module/dom/get-range-height.js.map +7 -1
- package/build-module/dom/get-rectangle-from-range.js +30 -65
- package/build-module/dom/get-rectangle-from-range.js.map +7 -1
- package/build-module/dom/get-scroll-container.js +16 -32
- package/build-module/dom/get-scroll-container.js.map +7 -1
- package/build-module/dom/hidden-caret-range-from-point.js +11 -28
- package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
- package/build-module/dom/index.js +57 -28
- package/build-module/dom/index.js.map +7 -1
- package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
- package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
- package/build-module/dom/insert-after.js +7 -16
- package/build-module/dom/insert-after.js.map +7 -1
- package/build-module/dom/is-edge.js +24 -57
- package/build-module/dom/is-edge.js.map +7 -1
- package/build-module/dom/is-element.js +5 -8
- package/build-module/dom/is-element.js.map +7 -1
- package/build-module/dom/is-empty.js +10 -14
- package/build-module/dom/is-empty.js.map +7 -1
- package/build-module/dom/is-entirely-selected.js +18 -45
- package/build-module/dom/is-entirely-selected.js.map +7 -1
- package/build-module/dom/is-form-element.js +8 -19
- package/build-module/dom/is-form-element.js.map +7 -1
- package/build-module/dom/is-horizontal-edge.js +6 -15
- package/build-module/dom/is-horizontal-edge.js.map +7 -1
- package/build-module/dom/is-html-input-element.js +6 -9
- package/build-module/dom/is-html-input-element.js.map +7 -1
- package/build-module/dom/is-input-or-text-area.js +6 -9
- package/build-module/dom/is-input-or-text-area.js.map +7 -1
- package/build-module/dom/is-number-input.js +11 -25
- package/build-module/dom/is-number-input.js.map +7 -1
- package/build-module/dom/is-rtl.js +7 -15
- package/build-module/dom/is-rtl.js.map +7 -1
- package/build-module/dom/is-selection-forward.js +9 -37
- package/build-module/dom/is-selection-forward.js.map +7 -1
- package/build-module/dom/is-text-field.js +22 -20
- package/build-module/dom/is-text-field.js.map +7 -1
- package/build-module/dom/is-vertical-edge.js +6 -15
- package/build-module/dom/is-vertical-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-edge.js +22 -48
- package/build-module/dom/place-caret-at-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
- package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
- package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
- package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
- package/build-module/dom/remove-invalid-html.js +7 -17
- package/build-module/dom/remove-invalid-html.js.map +7 -1
- package/build-module/dom/remove.js +7 -14
- package/build-module/dom/remove.js.map +7 -1
- package/build-module/dom/replace-tag.js +7 -16
- package/build-module/dom/replace-tag.js.map +7 -1
- package/build-module/dom/replace.js +9 -17
- package/build-module/dom/replace.js.map +7 -1
- package/build-module/dom/safe-html.js +11 -23
- package/build-module/dom/safe-html.js.map +7 -1
- package/build-module/dom/scroll-if-no-range.js +5 -15
- package/build-module/dom/scroll-if-no-range.js.map +7 -1
- package/build-module/dom/strip-html.js +8 -18
- package/build-module/dom/strip-html.js.map +7 -1
- package/build-module/dom/unwrap.js +7 -15
- package/build-module/dom/unwrap.js.map +7 -1
- package/build-module/dom/wrap.js +7 -14
- package/build-module/dom/wrap.js.map +7 -1
- package/build-module/focusable.js +30 -81
- package/build-module/focusable.js.map +7 -1
- package/build-module/index.js +9 -17
- package/build-module/index.js.map +7 -1
- package/build-module/phrasing-content.js +67 -125
- package/build-module/phrasing-content.js.map +7 -1
- package/build-module/tabbable.js +30 -133
- package/build-module/tabbable.js.map +7 -1
- package/build-module/utils/assert-is-defined.js +9 -4
- package/build-module/utils/assert-is-defined.js.map +7 -1
- package/package.json +11 -4
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var document_has_text_selection_exports = {};
|
|
20
|
+
__export(document_has_text_selection_exports, {
|
|
21
|
+
default: () => documentHasTextSelection
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Check whether the current document has selected text. This applies to ranges
|
|
14
|
-
* of text in the document, and not selection inside `<input>` and `<textarea>`
|
|
15
|
-
* elements.
|
|
16
|
-
*
|
|
17
|
-
* See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
|
|
18
|
-
*
|
|
19
|
-
* @param {Document} doc The document to check.
|
|
20
|
-
*
|
|
21
|
-
* @return {boolean} True if there is selection, false if not.
|
|
22
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(document_has_text_selection_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
23
25
|
function documentHasTextSelection(doc) {
|
|
24
|
-
(0,
|
|
26
|
+
(0, import_assert_is_defined.assertIsDefined)(doc.defaultView, "doc.defaultView");
|
|
25
27
|
const selection = doc.defaultView.getSelection();
|
|
26
|
-
(0,
|
|
28
|
+
(0, import_assert_is_defined.assertIsDefined)(selection, "selection");
|
|
27
29
|
const range = selection.rangeCount ? selection.getRangeAt(0) : null;
|
|
28
30
|
return !!range && !range.collapsed;
|
|
29
31
|
}
|
|
30
|
-
//# sourceMappingURL=document-has-text-selection.js.map
|
|
32
|
+
//# sourceMappingURL=document-has-text-selection.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/document-has-text-selection.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc ) {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAajB,SAAR,yBAA2C,KAAM;AACvD,gDAAiB,IAAI,aAAa,iBAAkB;AACpD,QAAM,YAAY,IAAI,YAAY,aAAa;AAC/C,gDAAiB,WAAW,WAAY;AACxC,QAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;AACjE,SAAO,CAAC,CAAE,SAAS,CAAE,MAAM;AAC5B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var document_has_uncollapsed_selection_exports = {};
|
|
30
|
+
__export(document_has_uncollapsed_selection_exports, {
|
|
31
|
+
default: () => documentHasUncollapsedSelection
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check whether the current document has any sort of (uncollapsed) selection.
|
|
16
|
-
* This includes ranges of text across elements and any selection inside
|
|
17
|
-
* textual `<input>` and `<textarea>` elements.
|
|
18
|
-
*
|
|
19
|
-
* @param {Document} doc The document to check.
|
|
20
|
-
*
|
|
21
|
-
* @return {boolean} Whether there is any recognizable text selection in the document.
|
|
22
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(document_has_uncollapsed_selection_exports);
|
|
34
|
+
var import_document_has_text_selection = __toESM(require("./document-has-text-selection"));
|
|
35
|
+
var import_input_field_has_uncollapsed_selection = __toESM(require("./input-field-has-uncollapsed-selection"));
|
|
23
36
|
function documentHasUncollapsedSelection(doc) {
|
|
24
|
-
return (0,
|
|
37
|
+
return (0, import_document_has_text_selection.default)(doc) || !!doc.activeElement && (0, import_input_field_has_uncollapsed_selection.default)(doc.activeElement);
|
|
25
38
|
}
|
|
26
|
-
//# sourceMappingURL=document-has-uncollapsed-selection.js.map
|
|
39
|
+
//# sourceMappingURL=document-has-uncollapsed-selection.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/document-has-uncollapsed-selection.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param {Document} doc The document to check.\n *\n * @return {boolean} Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection( doc ) {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yCAAqC;AACrC,mDAA8C;AAW/B,SAAR,gCAAkD,KAAM;AAC9D,aACC,mCAAAA,SAA0B,GAAI,KAC5B,CAAC,CAAE,IAAI,qBACR,6CAAAC,SAAmC,IAAI,aAAc;AAExD;",
|
|
6
|
+
"names": ["documentHasTextSelection", "inputFieldHasUncollapsedSelection"]
|
|
7
|
+
}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_computed_style_exports = {};
|
|
20
|
+
__export(get_computed_style_exports, {
|
|
21
|
+
default: () => getComputedStyle
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/* eslint-disable jsdoc/valid-types */
|
|
13
|
-
/**
|
|
14
|
-
* @param {Element} element
|
|
15
|
-
* @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.
|
|
16
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(get_computed_style_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
17
25
|
function getComputedStyle(element) {
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
(0, import_assert_is_defined.assertIsDefined)(
|
|
27
|
+
element.ownerDocument.defaultView,
|
|
28
|
+
"element.ownerDocument.defaultView"
|
|
29
|
+
);
|
|
20
30
|
return element.ownerDocument.defaultView.getComputedStyle(element);
|
|
21
31
|
}
|
|
22
|
-
//# sourceMappingURL=get-computed-style.js.map
|
|
32
|
+
//# sourceMappingURL=get-computed-style.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/get-computed-style.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {ReturnType<Window['getComputedStyle']>} The computed style for the element.\n */\nexport default function getComputedStyle( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAOjB,SAAR,iBAAmC,SAAU;AAEnD;AAAA,IACC,QAAQ,cAAc;AAAA,IACtB;AAAA,EACD;AACA,SAAO,QAAQ,cAAc,YAAY,iBAAkB,OAAQ;AACpE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var get_offset_parent_exports = {};
|
|
30
|
+
__export(get_offset_parent_exports, {
|
|
31
|
+
default: () => getOffsetParent
|
|
6
32
|
});
|
|
7
|
-
exports
|
|
8
|
-
var
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Returns the closest positioned element, or null under any of the conditions
|
|
15
|
-
* of the offsetParent specification. Unlike offsetParent, this function is not
|
|
16
|
-
* limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).
|
|
17
|
-
*
|
|
18
|
-
* @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent
|
|
19
|
-
*
|
|
20
|
-
* @param {Node} node Node from which to find offset parent.
|
|
21
|
-
*
|
|
22
|
-
* @return {Node | null} Offset parent.
|
|
23
|
-
*/
|
|
33
|
+
module.exports = __toCommonJS(get_offset_parent_exports);
|
|
34
|
+
var import_get_computed_style = __toESM(require("./get-computed-style"));
|
|
24
35
|
function getOffsetParent(node) {
|
|
25
|
-
// Cannot retrieve computed style or offset parent only anything other than
|
|
26
|
-
// an element node, so find the closest element node.
|
|
27
36
|
let closestElement;
|
|
28
|
-
while (closestElement = /** @type {Node} */
|
|
37
|
+
while (closestElement = /** @type {Node} */
|
|
38
|
+
node.parentNode) {
|
|
29
39
|
if (closestElement.nodeType === closestElement.ELEMENT_NODE) {
|
|
30
40
|
break;
|
|
31
41
|
}
|
|
@@ -33,14 +43,15 @@ function getOffsetParent(node) {
|
|
|
33
43
|
if (!closestElement) {
|
|
34
44
|
return null;
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
if ((0, import_get_computed_style.default)(
|
|
47
|
+
/** @type {Element} */
|
|
48
|
+
closestElement
|
|
49
|
+
).position !== "static") {
|
|
40
50
|
return closestElement;
|
|
41
51
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
return (
|
|
53
|
+
/** @type {Node & { offsetParent: Node }} */
|
|
54
|
+
closestElement.offsetParent
|
|
55
|
+
);
|
|
45
56
|
}
|
|
46
|
-
//# sourceMappingURL=get-offset-parent.js.map
|
|
57
|
+
//# sourceMappingURL=get-offset-parent.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/get-offset-parent.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param {Node} node Node from which to find offset parent.\n *\n * @return {Node | null} Offset parent.\n */\nexport default function getOffsetParent( node ) {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement;\n\twhile ( ( closestElement = /** @type {Node} */ ( node.parentNode ) ) ) {\n\t\tif ( closestElement.nodeType === closestElement.ELEMENT_NODE ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif (\n\t\tgetComputedStyle( /** @type {Element} */ ( closestElement ) )\n\t\t\t.position !== 'static'\n\t) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn /** @type {Node & { offsetParent: Node }} */ ( closestElement )\n\t\t.offsetParent;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gCAA6B;AAad,SAAR,gBAAkC,MAAO;AAG/C,MAAI;AACJ,SAAU;AAAA,EAAuC,KAAK,YAAiB;AACtE,QAAK,eAAe,aAAa,eAAe,cAAe;AAC9D;AAAA,IACD;AAAA,EACD;AAEA,MAAK,CAAE,gBAAiB;AACvB,WAAO;AAAA,EACR;AAIA,UACC,0BAAAA;AAAA;AAAA,IAA2C;AAAA,EAAiB,EAC1D,aAAa,UACd;AACD,WAAO;AAAA,EACR;AAGA;AAAA;AAAA,IAAsD,eACpD;AAAA;AACH;",
|
|
6
|
+
"names": ["getComputedStyle"]
|
|
7
|
+
}
|
|
@@ -1,27 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_range_height_exports = {};
|
|
20
|
+
__export(get_range_height_exports, {
|
|
21
|
+
default: () => getRangeHeight
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* Gets the height of the range without ignoring zero width rectangles, which
|
|
9
|
-
* some browsers ignore when creating a union.
|
|
10
|
-
*
|
|
11
|
-
* @param {Range} range The range to check.
|
|
12
|
-
* @return {number | undefined} Height of the range or undefined if the range has no client rectangles.
|
|
13
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(get_range_height_exports);
|
|
14
24
|
function getRangeHeight(range) {
|
|
15
25
|
const rects = Array.from(range.getClientRects());
|
|
16
26
|
if (!rects.length) {
|
|
17
27
|
return;
|
|
18
28
|
}
|
|
19
|
-
const highestTop = Math.min(...rects.map(({
|
|
20
|
-
|
|
21
|
-
}) => top));
|
|
22
|
-
const lowestBottom = Math.max(...rects.map(({
|
|
23
|
-
bottom
|
|
24
|
-
}) => bottom));
|
|
29
|
+
const highestTop = Math.min(...rects.map(({ top }) => top));
|
|
30
|
+
const lowestBottom = Math.max(...rects.map(({ bottom }) => bottom));
|
|
25
31
|
return lowestBottom - highestTop;
|
|
26
32
|
}
|
|
27
|
-
//# sourceMappingURL=get-range-height.js.map
|
|
33
|
+
//# sourceMappingURL=get-range-height.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/get-range-height.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param {Range} range The range to check.\n * @return {number | undefined} Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range ) {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,eAAiC,OAAQ;AAC/C,QAAM,QAAQ,MAAM,KAAM,MAAM,eAAe,CAAE;AAEjD,MAAK,CAAE,MAAM,QAAS;AACrB;AAAA,EACD;AAEA,QAAM,aAAa,KAAK,IAAK,GAAG,MAAM,IAAK,CAAE,EAAE,IAAI,MAAO,GAAI,CAAE;AAChE,QAAM,eAAe,KAAK,IAAK,GAAG,MAAM,IAAK,CAAE,EAAE,OAAO,MAAO,MAAO,CAAE;AAExE,SAAO,eAAe;AACvB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,40 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var get_rectangle_from_range_exports = {};
|
|
20
|
+
__export(get_rectangle_from_range_exports, {
|
|
21
|
+
default: () => getRectangleFromRange
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Get the rectangle of a given Range. Returns `null` if no suitable rectangle
|
|
14
|
-
* can be found.
|
|
15
|
-
*
|
|
16
|
-
* @param {Range} range The range.
|
|
17
|
-
*
|
|
18
|
-
* @return {DOMRect?} The rectangle.
|
|
19
|
-
*/
|
|
23
|
+
module.exports = __toCommonJS(get_rectangle_from_range_exports);
|
|
24
|
+
var import_assert_is_defined = require("../utils/assert-is-defined");
|
|
20
25
|
function getRectangleFromRange(range) {
|
|
21
|
-
// For uncollapsed ranges, get the rectangle that bounds the contents of the
|
|
22
|
-
// range; this a rectangle enclosing the union of the bounding rectangles
|
|
23
|
-
// for all the elements in the range.
|
|
24
26
|
if (!range.collapsed) {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (rects.length === 1) {
|
|
29
|
-
return rects[0];
|
|
27
|
+
const rects2 = Array.from(range.getClientRects());
|
|
28
|
+
if (rects2.length === 1) {
|
|
29
|
+
return rects2[0];
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
// Ignore tiny selection at the edge of a range.
|
|
33
|
-
const filteredRects = rects.filter(({
|
|
34
|
-
width
|
|
35
|
-
}) => width > 1);
|
|
36
|
-
|
|
37
|
-
// If it's full of tiny selections, return browser default.
|
|
31
|
+
const filteredRects = rects2.filter(({ width }) => width > 1);
|
|
38
32
|
if (filteredRects.length === 0) {
|
|
39
33
|
return range.getBoundingClientRect();
|
|
40
34
|
}
|
|
@@ -47,12 +41,7 @@ function getRectangleFromRange(range) {
|
|
|
47
41
|
left: furthestLeft,
|
|
48
42
|
right: furthestRight
|
|
49
43
|
} = filteredRects[0];
|
|
50
|
-
for (const {
|
|
51
|
-
top,
|
|
52
|
-
bottom,
|
|
53
|
-
left,
|
|
54
|
-
right
|
|
55
|
-
} of filteredRects) {
|
|
44
|
+
for (const { top, bottom, left, right } of filteredRects) {
|
|
56
45
|
if (top < furthestTop) {
|
|
57
46
|
furthestTop = top;
|
|
58
47
|
}
|
|
@@ -66,51 +55,41 @@ function getRectangleFromRange(range) {
|
|
|
66
55
|
furthestRight = right;
|
|
67
56
|
}
|
|
68
57
|
}
|
|
69
|
-
return new window.DOMRect(
|
|
58
|
+
return new window.DOMRect(
|
|
59
|
+
furthestLeft,
|
|
60
|
+
furthestTop,
|
|
61
|
+
furthestRight - furthestLeft,
|
|
62
|
+
furthestBottom - furthestTop
|
|
63
|
+
);
|
|
70
64
|
}
|
|
71
|
-
const {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
parentNode
|
|
82
|
-
} = startContainer;
|
|
83
|
-
(0, _assertIsDefined.assertIsDefined)(parentNode, 'parentNode');
|
|
84
|
-
const index = /** @type {Node[]} */Array.from(parentNode.childNodes).indexOf(startContainer);
|
|
85
|
-
(0, _assertIsDefined.assertIsDefined)(ownerDocument, 'ownerDocument');
|
|
65
|
+
const { startContainer } = range;
|
|
66
|
+
const { ownerDocument } = startContainer;
|
|
67
|
+
if (startContainer.nodeName === "BR") {
|
|
68
|
+
const { parentNode } = startContainer;
|
|
69
|
+
(0, import_assert_is_defined.assertIsDefined)(parentNode, "parentNode");
|
|
70
|
+
const index = (
|
|
71
|
+
/** @type {Node[]} */
|
|
72
|
+
Array.from(parentNode.childNodes).indexOf(startContainer)
|
|
73
|
+
);
|
|
74
|
+
(0, import_assert_is_defined.assertIsDefined)(ownerDocument, "ownerDocument");
|
|
86
75
|
range = ownerDocument.createRange();
|
|
87
76
|
range.setStart(parentNode, index);
|
|
88
77
|
range.setEnd(parentNode, index);
|
|
89
78
|
}
|
|
90
79
|
const rects = range.getClientRects();
|
|
91
|
-
|
|
92
|
-
// If we have multiple rectangles for a collapsed range, there's no way to
|
|
93
|
-
// know which it is, so don't return anything.
|
|
94
80
|
if (rects.length > 1) {
|
|
95
81
|
return null;
|
|
96
82
|
}
|
|
97
83
|
let rect = rects[0];
|
|
98
|
-
|
|
99
|
-
// If the collapsed range starts (and therefore ends) at an element node,
|
|
100
|
-
// `getClientRects` can be empty in some browsers. This can be resolved
|
|
101
|
-
// by adding a temporary text node with zero-width space to the range.
|
|
102
|
-
//
|
|
103
|
-
// See: https://stackoverflow.com/a/6847328/995445
|
|
104
84
|
if (!rect || rect.height === 0) {
|
|
105
|
-
(0,
|
|
106
|
-
const padNode = ownerDocument.createTextNode(
|
|
107
|
-
// Do not modify the live range.
|
|
85
|
+
(0, import_assert_is_defined.assertIsDefined)(ownerDocument, "ownerDocument");
|
|
86
|
+
const padNode = ownerDocument.createTextNode("\u200B");
|
|
108
87
|
range = range.cloneRange();
|
|
109
88
|
range.insertNode(padNode);
|
|
110
89
|
rect = range.getClientRects()[0];
|
|
111
|
-
(0,
|
|
90
|
+
(0, import_assert_is_defined.assertIsDefined)(padNode.parentNode, "padNode.parentNode");
|
|
112
91
|
padNode.parentNode.removeChild(padNode);
|
|
113
92
|
}
|
|
114
93
|
return rect;
|
|
115
94
|
}
|
|
116
|
-
//# sourceMappingURL=get-rectangle-from-range.js.map
|
|
95
|
+
//# sourceMappingURL=get-rectangle-from-range.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/get-rectangle-from-range.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) {\n\t\t\t\tfurthestTop = top;\n\t\t\t}\n\t\t\tif ( bottom > furthestBottom ) {\n\t\t\t\tfurthestBottom = bottom;\n\t\t\t}\n\t\t\tif ( left < furthestLeft ) {\n\t\t\t\tfurthestLeft = left;\n\t\t\t}\n\t\t\tif ( right > furthestRight ) {\n\t\t\t\tfurthestRight = right;\n\t\t\t}\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAUjB,SAAR,sBAAwC,OAAQ;AAItD,MAAK,CAAE,MAAM,WAAY;AACxB,UAAMA,SAAQ,MAAM,KAAM,MAAM,eAAe,CAAE;AAGjD,QAAKA,OAAM,WAAW,GAAI;AACzB,aAAOA,OAAO,CAAE;AAAA,IACjB;AAGA,UAAM,gBAAgBA,OAAM,OAAQ,CAAE,EAAE,MAAM,MAAO,QAAQ,CAAE;AAG/D,QAAK,cAAc,WAAW,GAAI;AACjC,aAAO,MAAM,sBAAsB;AAAA,IACpC;AAEA,QAAK,cAAc,WAAW,GAAI;AACjC,aAAO,cAAe,CAAE;AAAA,IACzB;AAEA,QAAI;AAAA,MACH,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACR,IAAI,cAAe,CAAE;AAErB,eAAY,EAAE,KAAK,QAAQ,MAAM,MAAM,KAAK,eAAgB;AAC3D,UAAK,MAAM,aAAc;AACxB,sBAAc;AAAA,MACf;AACA,UAAK,SAAS,gBAAiB;AAC9B,yBAAiB;AAAA,MAClB;AACA,UAAK,OAAO,cAAe;AAC1B,uBAAe;AAAA,MAChB;AACA,UAAK,QAAQ,eAAgB;AAC5B,wBAAgB;AAAA,MACjB;AAAA,IACD;AAEA,WAAO,IAAI,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,IAClB;AAAA,EACD;AAEA,QAAM,EAAE,eAAe,IAAI;AAC3B,QAAM,EAAE,cAAc,IAAI;AAG1B,MAAK,eAAe,aAAa,MAAO;AACvC,UAAM,EAAE,WAAW,IAAI;AACvB,kDAAiB,YAAY,YAAa;AAC1C,UAAM;AAAA;AAAA,MACL,MAAM,KAAM,WAAW,UAAW,EACjC,QAAS,cAAe;AAAA;AAE1B,kDAAiB,eAAe,eAAgB;AAChD,YAAQ,cAAc,YAAY;AAClC,UAAM,SAAU,YAAY,KAAM;AAClC,UAAM,OAAQ,YAAY,KAAM;AAAA,EACjC;AAEA,QAAM,QAAQ,MAAM,eAAe;AAInC,MAAK,MAAM,SAAS,GAAI;AACvB,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,MAAO,CAAE;AAOpB,MAAK,CAAE,QAAQ,KAAK,WAAW,GAAI;AAClC,kDAAiB,eAAe,eAAgB;AAChD,UAAM,UAAU,cAAc,eAAgB,QAAS;AAEvD,YAAQ,MAAM,WAAW;AACzB,UAAM,WAAY,OAAQ;AAC1B,WAAO,MAAM,eAAe,EAAG,CAAE;AACjC,kDAAiB,QAAQ,YAAY,oBAAqB;AAC1D,YAAQ,WAAW,YAAa,OAAQ;AAAA,EACzC;AAEA,SAAO;AACR;",
|
|
6
|
+
"names": ["rects"]
|
|
7
|
+
}
|