@wordpress/dom 5.0.0 → 5.1.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/README.md +1 -1
- package/build/data-transfer.cjs +20 -38
- package/build/data-transfer.cjs.map +1 -7
- package/build/dom/caret-range-from-point.cjs +31 -38
- package/build/dom/caret-range-from-point.cjs.map +1 -7
- package/build/dom/clean-node-list.cjs +87 -132
- package/build/dom/clean-node-list.cjs.map +1 -7
- package/build/dom/compute-caret-rect.cjs +35 -35
- package/build/dom/compute-caret-rect.cjs.map +1 -7
- package/build/dom/document-has-selection.cjs +35 -30
- package/build/dom/document-has-selection.cjs.map +1 -7
- package/build/dom/document-has-text-selection.cjs +24 -30
- package/build/dom/document-has-text-selection.cjs.map +1 -7
- package/build/dom/document-has-uncollapsed-selection.cjs +34 -29
- package/build/dom/document-has-uncollapsed-selection.cjs.map +1 -7
- package/build/dom/get-computed-style.cjs +14 -30
- package/build/dom/get-computed-style.cjs.map +1 -7
- package/build/dom/get-offset-parent.cjs +40 -39
- package/build/dom/get-offset-parent.cjs.map +1 -7
- package/build/dom/get-range-height.cjs +18 -31
- package/build/dom/get-range-height.cjs.map +1 -7
- package/build/dom/get-rectangle-from-range.cjs +82 -128
- package/build/dom/get-rectangle-from-range.cjs.map +1 -7
- package/build/dom/get-scroll-container.cjs +46 -50
- package/build/dom/get-scroll-container.cjs.map +1 -7
- package/build/dom/hidden-caret-range-from-point.cjs +48 -42
- package/build/dom/hidden-caret-range-from-point.cjs.map +1 -7
- package/build/dom/index.cjs +233 -110
- package/build/dom/input-field-has-uncollapsed-selection.cjs +48 -43
- package/build/dom/input-field-has-uncollapsed-selection.cjs.map +1 -7
- package/build/dom/insert-after.cjs +17 -27
- package/build/dom/insert-after.cjs.map +1 -7
- package/build/dom/is-edge.cjs +82 -97
- package/build/dom/is-edge.cjs.map +1 -7
- package/build/dom/is-element.cjs +12 -25
- package/build/dom/is-element.cjs.map +1 -7
- package/build/dom/is-empty.cjs +23 -37
- package/build/dom/is-empty.cjs.map +1 -7
- package/build/dom/is-entirely-selected.cjs +70 -67
- package/build/dom/is-entirely-selected.cjs.map +1 -7
- package/build/dom/is-form-element.cjs +33 -33
- package/build/dom/is-form-element.cjs.map +1 -7
- package/build/dom/is-horizontal-edge.cjs +31 -28
- package/build/dom/is-horizontal-edge.cjs.map +1 -7
- package/build/dom/is-html-input-element.cjs +12 -25
- package/build/dom/is-html-input-element.cjs.map +1 -7
- package/build/dom/is-input-or-text-area.cjs +12 -25
- package/build/dom/is-input-or-text-area.cjs.map +1 -7
- package/build/dom/is-number-input.cjs +36 -33
- package/build/dom/is-number-input.cjs.map +1 -7
- package/build/dom/is-rtl.cjs +30 -28
- package/build/dom/is-rtl.cjs.map +1 -7
- package/build/dom/is-selection-forward.cjs +26 -39
- package/build/dom/is-selection-forward.cjs.map +1 -7
- package/build/dom/is-text-field.cjs +45 -42
- package/build/dom/is-text-field.cjs.map +1 -7
- package/build/dom/is-vertical-edge.cjs +31 -28
- package/build/dom/is-vertical-edge.cjs.map +1 -7
- package/build/dom/place-caret-at-edge.cjs +75 -78
- package/build/dom/place-caret-at-edge.cjs.map +1 -7
- package/build/dom/place-caret-at-horizontal-edge.cjs +29 -28
- package/build/dom/place-caret-at-horizontal-edge.cjs.map +1 -7
- package/build/dom/place-caret-at-vertical-edge.cjs +30 -28
- package/build/dom/place-caret-at-vertical-edge.cjs.map +1 -7
- package/build/dom/remove-invalid-html.cjs +35 -31
- package/build/dom/remove-invalid-html.cjs.map +1 -7
- package/build/dom/remove.cjs +15 -27
- package/build/dom/remove.cjs.map +1 -7
- package/build/dom/replace-tag.cjs +21 -32
- package/build/dom/replace-tag.cjs.map +1 -7
- package/build/dom/replace.cjs +34 -32
- package/build/dom/replace.cjs.map +1 -7
- package/build/dom/safe-html.cjs +45 -46
- package/build/dom/safe-html.cjs.map +1 -7
- package/build/dom/scroll-if-no-range.cjs +24 -37
- package/build/dom/scroll-if-no-range.cjs.map +1 -7
- package/build/dom/strip-html.cjs +33 -31
- package/build/dom/strip-html.cjs.map +1 -7
- package/build/dom/types.cjs +4 -18
- package/build/dom/unwrap.cjs +17 -31
- package/build/dom/unwrap.cjs.map +1 -7
- package/build/dom/wrap.cjs +17 -28
- package/build/dom/wrap.cjs.map +1 -7
- package/build/focusable.cjs +99 -76
- package/build/focusable.cjs.map +1 -7
- package/build/index.cjs +57 -38
- package/build/index.cjs.map +1 -7
- package/build/phrasing-content.cjs +163 -159
- package/build/phrasing-content.cjs.map +1 -7
- package/build/tabbable.cjs +123 -78
- package/build/tabbable.cjs.map +1 -7
- package/build/types.cjs +4 -18
- package/build/utils/assert-is-defined.cjs +8 -33
- package/build/utils/assert-is-defined.cjs.map +1 -7
- package/build-module/data-transfer.mjs +16 -14
- package/build-module/data-transfer.mjs.map +1 -7
- package/build-module/dom/caret-range-from-point.mjs +27 -18
- package/build-module/dom/caret-range-from-point.mjs.map +1 -7
- package/build-module/dom/clean-node-list.mjs +60 -105
- package/build-module/dom/clean-node-list.mjs.map +1 -7
- package/build-module/dom/compute-caret-rect.mjs +16 -12
- package/build-module/dom/compute-caret-rect.mjs.map +1 -7
- package/build-module/dom/document-has-selection.mjs +13 -6
- package/build-module/dom/document-has-selection.mjs.map +1 -7
- package/build-module/dom/document-has-text-selection.mjs +20 -10
- package/build-module/dom/document-has-text-selection.mjs.map +1 -7
- package/build-module/dom/document-has-uncollapsed-selection.mjs +14 -6
- package/build-module/dom/document-has-uncollapsed-selection.mjs.map +1 -7
- package/build-module/dom/get-computed-style.mjs +10 -10
- package/build-module/dom/get-computed-style.mjs.map +1 -7
- package/build-module/dom/get-offset-parent.mjs +20 -16
- package/build-module/dom/get-offset-parent.mjs.map +1 -7
- package/build-module/dom/get-range-height.mjs +14 -11
- package/build-module/dom/get-range-height.mjs.map +1 -7
- package/build-module/dom/get-rectangle-from-range.mjs +78 -108
- package/build-module/dom/get-rectangle-from-range.mjs.map +1 -7
- package/build-module/dom/get-scroll-container.mjs +28 -28
- package/build-module/dom/get-scroll-container.mjs.map +1 -7
- package/build-module/dom/hidden-caret-range-from-point.mjs +28 -19
- package/build-module/dom/hidden-caret-range-from-point.mjs.map +1 -7
- package/build-module/dom/index.mjs +28 -58
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs +28 -20
- package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +1 -7
- package/build-module/dom/insert-after.mjs +13 -7
- package/build-module/dom/insert-after.mjs.map +1 -7
- package/build-module/dom/is-edge.mjs +53 -69
- package/build-module/dom/is-edge.mjs.map +1 -7
- package/build-module/dom/is-element.mjs +8 -5
- package/build-module/dom/is-element.mjs.map +1 -7
- package/build-module/dom/is-empty.mjs +19 -17
- package/build-module/dom/is-empty.mjs.map +1 -7
- package/build-module/dom/is-entirely-selected.mjs +51 -44
- package/build-module/dom/is-entirely-selected.mjs.map +1 -7
- package/build-module/dom/is-form-element.mjs +15 -11
- package/build-module/dom/is-form-element.mjs.map +1 -7
- package/build-module/dom/is-horizontal-edge.mjs +13 -6
- package/build-module/dom/is-horizontal-edge.mjs.map +1 -7
- package/build-module/dom/is-html-input-element.mjs +8 -5
- package/build-module/dom/is-html-input-element.mjs.map +1 -7
- package/build-module/dom/is-input-or-text-area.mjs +8 -5
- package/build-module/dom/is-input-or-text-area.mjs.map +1 -7
- package/build-module/dom/is-number-input.mjs +16 -10
- package/build-module/dom/is-number-input.mjs.map +1 -7
- package/build-module/dom/is-rtl.mjs +12 -6
- package/build-module/dom/is-rtl.mjs.map +1 -7
- package/build-module/dom/is-selection-forward.mjs +22 -19
- package/build-module/dom/is-selection-forward.mjs.map +1 -7
- package/build-module/dom/is-text-field.mjs +27 -20
- package/build-module/dom/is-text-field.mjs.map +1 -7
- package/build-module/dom/is-vertical-edge.mjs +13 -6
- package/build-module/dom/is-vertical-edge.mjs.map +1 -7
- package/build-module/dom/place-caret-at-edge.mjs +51 -52
- package/build-module/dom/place-caret-at-edge.mjs.map +1 -7
- package/build-module/dom/place-caret-at-horizontal-edge.mjs +11 -6
- package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +1 -7
- package/build-module/dom/place-caret-at-vertical-edge.mjs +12 -6
- package/build-module/dom/place-caret-at-vertical-edge.mjs.map +1 -7
- package/build-module/dom/remove-invalid-html.mjs +17 -9
- package/build-module/dom/remove-invalid-html.mjs.map +1 -7
- package/build-module/dom/remove.mjs +11 -7
- package/build-module/dom/remove.mjs.map +1 -7
- package/build-module/dom/replace-tag.mjs +17 -12
- package/build-module/dom/replace-tag.mjs.map +1 -7
- package/build-module/dom/replace.mjs +13 -8
- package/build-module/dom/replace.mjs.map +1 -7
- package/build-module/dom/safe-html.mjs +27 -24
- package/build-module/dom/safe-html.mjs.map +1 -7
- package/build-module/dom/scroll-if-no-range.mjs +20 -13
- package/build-module/dom/scroll-if-no-range.mjs.map +1 -7
- package/build-module/dom/strip-html.mjs +15 -9
- package/build-module/dom/strip-html.mjs.map +1 -7
- package/build-module/dom/types.mjs +0 -1
- package/build-module/dom/unwrap.mjs +13 -11
- package/build-module/dom/unwrap.mjs.map +1 -7
- package/build-module/dom/wrap.mjs +13 -8
- package/build-module/dom/wrap.mjs.map +1 -7
- package/build-module/focusable.mjs +95 -52
- package/build-module/focusable.mjs.map +1 -7
- package/build-module/index.mjs +11 -5
- package/build-module/index.mjs.map +1 -7
- package/build-module/phrasing-content.mjs +157 -133
- package/build-module/phrasing-content.mjs.map +1 -7
- package/build-module/tabbable.mjs +116 -51
- package/build-module/tabbable.mjs.map +1 -7
- package/build-module/types.mjs +0 -1
- package/build-module/utils/assert-is-defined.mjs +4 -9
- package/build-module/utils/assert-is-defined.mjs.map +1 -7
- package/build-types/dom/clean-node-list.d.ts +2 -2
- package/build-types/dom/clean-node-list.d.ts.map +1 -1
- package/build-types/dom/is-edge.d.ts.map +1 -1
- package/build-types/dom/remove-invalid-html.d.ts +4 -4
- package/build-types/dom/remove-invalid-html.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/dom/clean-node-list.ts +2 -2
- package/src/dom/is-edge.ts +35 -43
- package/src/dom/remove-invalid-html.ts +4 -4
- package/src/dom/test/{get-rectangle-from-range.browser.test.js → get-rectangle-from-range.browser.test.ts} +25 -25
- package/src/test/{dom.jsdom.test.js → dom.jsdom.test.ts} +9 -6
- package/src/test/{focusable.browser.test.js → focusable.browser.test.ts} +14 -13
- package/src/test/{tabbable.browser.test.js → tabbable.browser.test.ts} +3 -2
- package/build/dom/index.cjs.map +0 -7
- package/build/dom/types.cjs.map +0 -7
- package/build/types.cjs.map +0 -7
- package/build-module/dom/index.mjs.map +0 -7
- package/build-module/dom/types.mjs.map +0 -7
- package/build-module/types.mjs.map +0 -7
- /package/src/dom/test/{safe-html.jsdom.test.js → safe-html.jsdom.test.ts} +0 -0
- /package/src/dom/test/{strip-html.jsdom.test.js → strip-html.jsdom.test.ts} +0 -0
- /package/src/test/{focusable-area.jsdom.test.js → focusable-area.jsdom.test.ts} +0 -0
- /package/src/test/{utils.js → utils.ts} +0 -0
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
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
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let __is_input_or_text_area_ts = require("./is-input-or-text-area.cjs");
|
|
28
|
+
__is_input_or_text_area_ts = __toESM(__is_input_or_text_area_ts);
|
|
30
29
|
// packages/dom/src/dom/is-form-element.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* Detects if element is a form element.
|
|
33
|
+
*
|
|
34
|
+
* @param element The element to check.
|
|
35
|
+
*
|
|
36
|
+
* @return True if form element and false otherwise.
|
|
37
|
+
*/
|
|
37
38
|
function isFormElement(element) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const { tagName } = element;
|
|
42
|
-
const checkForInputTextarea = (0, import_is_input_or_text_area.default)(element);
|
|
43
|
-
return checkForInputTextarea || tagName === "BUTTON" || tagName === "SELECT";
|
|
39
|
+
if (!element) return false;
|
|
40
|
+
const { tagName } = element;
|
|
41
|
+
return (0, __is_input_or_text_area_ts.default)(element) || tagName === "BUTTON" || tagName === "SELECT";
|
|
44
42
|
}
|
|
45
|
-
|
|
43
|
+
exports.default = isFormElement;
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=is-form-element.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-form-element.ts"],
|
|
4
|
-
"sourcesContent": ["import isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param element The element to check.\n *\n * @return True if form element and false otherwise.\n */\nexport default function isFormElement(\n\telement: Element | null | undefined\n): boolean {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAA8B;AAUf,SAAR,cACN,SACU;AACV,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,4BAAwB,6BAAAA,SAAmB,OAAQ;AACzD,SACC,yBAAyB,YAAY,YAAY,YAAY;AAE/D;",
|
|
6
|
-
"names": ["isInputOrTextArea"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-form-element.cjs","names":["isInputOrTextArea"],"sources":["../../src/dom/is-form-element.ts"],"sourcesContent":["import isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param element The element to check.\n *\n * @return True if form element and false otherwise.\n */\nexport default function isFormElement(\n\telement: Element | null | undefined\n): boolean {\n\tif ( ! element ) {\n\t\treturn false;\n\t}\n\n\tconst { tagName } = element;\n\tconst checkForInputTextarea = isInputOrTextArea( element );\n\treturn (\n\t\tcheckForInputTextarea || tagName === 'BUTTON' || tagName === 'SELECT'\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAwB,cACvB,SACU;CACV,IAAK,CAAE,SACN,OAAO;CAGR,MAAM,EAAE,YAAY;CAEpB,QAAA,GAD8BA,2BAAAA,QAAAA,CAAmB,OAE5B,KAAK,YAAY,YAAY,YAAY;AAE/D"}
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
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
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let __is_edge_ts = require("./is-edge.cjs");
|
|
28
|
+
__is_edge_ts = __toESM(__is_edge_ts);
|
|
30
29
|
// packages/dom/src/dom/is-horizontal-edge.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Check whether the selection is horizontally at the edge of the container.
|
|
32
|
+
*
|
|
33
|
+
* @param {HTMLElement} container Focusable element.
|
|
34
|
+
* @param {boolean} isReverse Set to true to check left, false for right.
|
|
35
|
+
*
|
|
36
|
+
* @return {boolean} True if at the horizontal edge, false if not.
|
|
37
|
+
*/
|
|
37
38
|
function isHorizontalEdge(container, isReverse) {
|
|
38
|
-
|
|
39
|
+
return (0, __is_edge_ts.default)(container, isReverse);
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
exports.default = isHorizontalEdge;
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=is-horizontal-edge.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-horizontal-edge.ts"],
|
|
4
|
-
"sourcesContent": ["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n): boolean {\n\treturn isEdge( container, isReverse );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmB;AAUJ,SAAR,iBACN,WACA,WACU;AACV,aAAO,eAAAA,SAAQ,WAAW,SAAU;AACrC;",
|
|
6
|
-
"names": ["isEdge"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-horizontal-edge.cjs","names":["isEdge"],"sources":["../../src/dom/is-horizontal-edge.ts"],"sourcesContent":["import isEdge from './is-edge';\n\n/**\n * Check whether the selection is horizontally at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false for right.\n *\n * @return {boolean} True if at the horizontal edge, false if not.\n */\nexport default function isHorizontalEdge(\n\tcontainer: HTMLElement,\n\tisReverse: boolean\n): boolean {\n\treturn isEdge( container, isReverse );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAwB,iBACvB,WACA,WACU;CACV,QAAA,GAAOA,aAAAA,QAAAA,CAAQ,WAAW,SAAU;AACrC"}
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
20
|
-
// packages/dom/src/dom/is-html-input-element.ts
|
|
21
|
-
var is_html_input_element_exports = {};
|
|
22
|
-
__export(is_html_input_element_exports, {
|
|
23
|
-
default: () => isHTMLInputElement
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
6
|
+
// packages/dom/src/dom/is-html-input-element.ts
|
|
7
|
+
/**
|
|
8
|
+
* @param {Node} node
|
|
9
|
+
* @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.
|
|
10
|
+
*/
|
|
26
11
|
function isHTMLInputElement(node) {
|
|
27
|
-
|
|
12
|
+
return node?.nodeName === "INPUT";
|
|
28
13
|
}
|
|
29
|
-
|
|
14
|
+
exports.default = isHTMLInputElement;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=is-html-input-element.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-html-input-element.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement(\n\tnode: Node | null | undefined\n): node is HTMLInputElement {\n\treturn node?.nodeName === 'INPUT';\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,mBACN,MAC2B;AAC3B,SAAO,MAAM,aAAa;AAC3B;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-html-input-element.cjs","names":[],"sources":["../../src/dom/is-html-input-element.ts"],"sourcesContent":["/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement(\n\tnode: Node | null | undefined\n): node is HTMLInputElement {\n\treturn node?.nodeName === 'INPUT';\n}\n"],"mappings":";;;;;;;;;;AAIA,SAAwB,mBACvB,MAC2B;CAC3B,OAAO,MAAM,aAAa;AAC3B"}
|
|
@@ -1,29 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
20
|
-
// packages/dom/src/dom/is-input-or-text-area.ts
|
|
21
|
-
var is_input_or_text_area_exports = {};
|
|
22
|
-
__export(is_input_or_text_area_exports, {
|
|
23
|
-
default: () => isInputOrTextArea
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
6
|
+
// packages/dom/src/dom/is-input-or-text-area.ts
|
|
7
|
+
/**
|
|
8
|
+
* @param {Element} element
|
|
9
|
+
* @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea
|
|
10
|
+
*/
|
|
26
11
|
function isInputOrTextArea(element) {
|
|
27
|
-
|
|
12
|
+
return element.tagName === "INPUT" || element.tagName === "TEXTAREA";
|
|
28
13
|
}
|
|
29
|
-
|
|
14
|
+
exports.default = isInputOrTextArea;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=is-input-or-text-area.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-input-or-text-area.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea(\n\telement: Element\n): element is HTMLInputElement | HTMLTextAreaElement {\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIe,SAAR,kBACN,SACoD;AACpD,SAAO,QAAQ,YAAY,WAAW,QAAQ,YAAY;AAC3D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-input-or-text-area.cjs","names":[],"sources":["../../src/dom/is-input-or-text-area.ts"],"sourcesContent":["/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea(\n\telement: Element\n): element is HTMLInputElement | HTMLTextAreaElement {\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],"mappings":";;;;;;;;;;AAIA,SAAwB,kBACvB,SACoD;CACpD,OAAO,QAAQ,YAAY,WAAW,QAAQ,YAAY;AAC3D"}
|
|
@@ -1,45 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
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
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let _wordpress_deprecated = require("@wordpress/deprecated");
|
|
28
|
+
_wordpress_deprecated = __toESM(_wordpress_deprecated);
|
|
29
|
+
let __is_html_input_element_ts = require("./is-html-input-element.cjs");
|
|
30
|
+
__is_html_input_element_ts = __toESM(__is_html_input_element_ts);
|
|
30
31
|
// packages/dom/src/dom/is-number-input.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Check whether the given element is an input field of type number.
|
|
34
|
+
*
|
|
35
|
+
* @param node The HTML node.
|
|
36
|
+
*
|
|
37
|
+
* @return True if the node is number input.
|
|
38
|
+
*/
|
|
38
39
|
function isNumberInput(node) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
(0, _wordpress_deprecated.default)("wp.dom.isNumberInput", {
|
|
41
|
+
since: "6.1",
|
|
42
|
+
version: "6.5"
|
|
43
|
+
});
|
|
44
|
+
return (0, __is_html_input_element_ts.default)(node) && node.type === "number" && !isNaN(node.valueAsNumber);
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
exports.default = isNumberInput;
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=is-number-input.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-number-input.ts"],
|
|
4
|
-
"sourcesContent": ["import deprecated from '@wordpress/deprecated';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param node The HTML node.\n *\n * @return True if the node is number input.\n */\nexport default function isNumberInput( node: Node ): node is HTMLInputElement {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAuB;AACvB,mCAA+B;AAShB,SAAR,cAAgC,MAAuC;AAC7E,wBAAAA,SAAY,wBAAwB;AAAA,IACnC,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AACF,aACC,6BAAAC,SAAoB,IAAK,KACzB,KAAK,SAAS,YACd,CAAE,MAAO,KAAK,aAAc;AAE9B;",
|
|
6
|
-
"names": ["deprecated", "isHTMLInputElement"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-number-input.cjs","names":["isHTMLInputElement"],"sources":["../../src/dom/is-number-input.ts"],"sourcesContent":["import deprecated from '@wordpress/deprecated';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param node The HTML node.\n *\n * @return True if the node is number input.\n */\nexport default function isNumberInput( node: Node ): node is HTMLInputElement {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,SAAwB,cAAe,MAAuC;CAC7E,CAAA,GAAA,sBAAA,QAAA,CAAY,wBAAwB;EACnC,OAAO;EACP,SAAS;CACV,CAAE;CACF,QAAA,GACCA,2BAAAA,QAAAA,CAAoB,IAAK,KACzB,KAAK,SAAS,YACd,CAAE,MAAO,KAAK,aAAc;AAE9B"}
|
package/build/dom/is-rtl.cjs
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
// \0rolldown/runtime.js
|
|
2
7
|
var __create = Object.create;
|
|
3
8
|
var __defProp = Object.defineProperty;
|
|
4
9
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
12
|
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
13
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: ((k) => from[k]).bind(null, key),
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
19
22
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
let __get_computed_style_ts = require("./get-computed-style.cjs");
|
|
28
|
+
__get_computed_style_ts = __toESM(__get_computed_style_ts);
|
|
30
29
|
// packages/dom/src/dom/is-rtl.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Whether the element's text direction is right-to-left.
|
|
32
|
+
*
|
|
33
|
+
* @param element The element to check.
|
|
34
|
+
*
|
|
35
|
+
* @return True if rtl, false if ltr.
|
|
36
|
+
*/
|
|
37
37
|
function isRTL(element) {
|
|
38
|
-
|
|
38
|
+
return (0, __get_computed_style_ts.default)(element).direction === "rtl";
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
exports.default = isRTL;
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=is-rtl.cjs.map
|
package/build/dom/is-rtl.cjs.map
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-rtl.ts"],
|
|
4
|
-
"sourcesContent": ["import getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param element The element to check.\n *\n * @return True if rtl, false if ltr.\n */\nexport default function isRTL( element: Element ): boolean {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA6B;AASd,SAAR,MAAwB,SAA4B;AAC1D,aAAO,0BAAAA,SAAkB,OAAQ,EAAE,cAAc;AAClD;",
|
|
6
|
-
"names": ["getComputedStyle"]
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-rtl.cjs","names":["getComputedStyle"],"sources":["../../src/dom/is-rtl.ts"],"sourcesContent":["import getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param element The element to check.\n *\n * @return True if rtl, false if ltr.\n */\nexport default function isRTL( element: Element ): boolean {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAwB,MAAO,SAA4B;CAC1D,QAAA,GAAOA,wBAAAA,QAAAA,CAAkB,OAAQ,CAAC,CAAC,cAAc;AAClD"}
|
|
@@ -1,43 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
20
|
-
// packages/dom/src/dom/is-selection-forward.ts
|
|
21
|
-
var is_selection_forward_exports = {};
|
|
22
|
-
__export(is_selection_forward_exports, {
|
|
23
|
-
default: () => isSelectionForward
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
24
5
|
});
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
let ___utils_assert_is_defined_ts = require("../utils/assert-is-defined.cjs");
|
|
7
|
+
// packages/dom/src/dom/is-selection-forward.ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the given selection object is in the forward direction, or
|
|
10
|
+
* false otherwise.
|
|
11
|
+
*
|
|
12
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
13
|
+
*
|
|
14
|
+
* @param selection Selection object to check.
|
|
15
|
+
*
|
|
16
|
+
* @return Whether the selection is forward.
|
|
17
|
+
*/
|
|
27
18
|
function isSelectionForward(selection) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
if (position === 0) {
|
|
39
|
-
return anchorOffset <= focusOffset;
|
|
40
|
-
}
|
|
41
|
-
return true;
|
|
19
|
+
const { anchorNode, focusNode, anchorOffset, focusOffset } = selection;
|
|
20
|
+
(0, ___utils_assert_is_defined_ts.assertIsDefined)(anchorNode, "anchorNode");
|
|
21
|
+
(0, ___utils_assert_is_defined_ts.assertIsDefined)(focusNode, "focusNode");
|
|
22
|
+
const position = anchorNode.compareDocumentPosition(focusNode);
|
|
23
|
+
if (position & anchorNode.DOCUMENT_POSITION_PRECEDING) return false;
|
|
24
|
+
if (position & anchorNode.DOCUMENT_POSITION_FOLLOWING) return true;
|
|
25
|
+
if (position === 0) return anchorOffset <= focusOffset;
|
|
26
|
+
return true;
|
|
42
27
|
}
|
|
43
|
-
|
|
28
|
+
exports.default = isSelectionForward;
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=is-selection-forward.cjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/dom/is-selection-forward.ts"],
|
|
4
|
-
"sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param selection Selection object to check.\n *\n * @return Whether the selection is forward.\n */\nexport default function isSelectionForward( selection: Selection ): boolean {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAYjB,SAAR,mBAAqC,WAAgC;AAC3E,QAAM,EAAE,YAAY,WAAW,cAAc,YAAY,IAAI;AAE7D,gDAAiB,YAAY,YAAa;AAC1C,gDAAiB,WAAW,WAAY;AACxC,QAAM,WAAW,WAAW,wBAAyB,SAAU;AAO/D,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAEA,MAAK,WAAW,WAAW,6BAA8B;AACxD,WAAO;AAAA,EACR;AAKA,MAAK,aAAa,GAAI;AACrB,WAAO,gBAAgB;AAAA,EACxB;AAGA,SAAO;AACR;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"is-selection-forward.cjs","names":[],"sources":["../../src/dom/is-selection-forward.ts"],"sourcesContent":["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Returns true if the given selection object is in the forward direction, or\n * false otherwise.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition\n *\n * @param selection Selection object to check.\n *\n * @return Whether the selection is forward.\n */\nexport default function isSelectionForward( selection: Selection ): boolean {\n\tconst { anchorNode, focusNode, anchorOffset, focusOffset } = selection;\n\n\tassertIsDefined( anchorNode, 'anchorNode' );\n\tassertIsDefined( focusNode, 'focusNode' );\n\tconst position = anchorNode.compareDocumentPosition( focusNode );\n\n\t// Disable reason: `Node#compareDocumentPosition` returns a bitmask value,\n\t// so bitwise operators are intended.\n\t/* eslint-disable no-bitwise */\n\t// Compare whether anchor node precedes focus node. If focus node (where\n\t// end of selection occurs) is after the anchor node, it is forward.\n\tif ( position & anchorNode.DOCUMENT_POSITION_PRECEDING ) {\n\t\treturn false;\n\t}\n\n\tif ( position & anchorNode.DOCUMENT_POSITION_FOLLOWING ) {\n\t\treturn true;\n\t}\n\t/* eslint-enable no-bitwise */\n\n\t// `compareDocumentPosition` returns 0 when passed the same node, in which\n\t// case compare offsets.\n\tif ( position === 0 ) {\n\t\treturn anchorOffset <= focusOffset;\n\t}\n\n\t// This should never be reached, but return true as default case.\n\treturn true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,SAAwB,mBAAoB,WAAgC;CAC3E,MAAM,EAAE,YAAY,WAAW,cAAc,gBAAgB;CAE7D,CAAA,GAAA,8BAAA,gBAAA,CAAiB,YAAY,YAAa;CAC1C,CAAA,GAAA,8BAAA,gBAAA,CAAiB,WAAW,WAAY;CACxC,MAAM,WAAW,WAAW,wBAAyB,SAAU;CAO/D,IAAK,WAAW,WAAW,6BAC1B,OAAO;CAGR,IAAK,WAAW,WAAW,6BAC1B,OAAO;CAMR,IAAK,aAAa,GACjB,OAAO,gBAAgB;CAIxB,OAAO;AACR"}
|