@wordpress/dom 4.31.1-next.f56bd8138.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/CHANGELOG.md +2 -0
- 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,28 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { scrollIfNoRange } from './scroll-if-no-range';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Check whether the selection is at the edge of the container. Checks for
|
|
15
|
-
* horizontal position by default. Set `onlyVertical` to true to check only
|
|
16
|
-
* vertically.
|
|
17
|
-
*
|
|
18
|
-
* @param {HTMLElement} container Focusable element.
|
|
19
|
-
* @param {boolean} isReverse Set to true to check left, false to check right.
|
|
20
|
-
* @param {boolean} [onlyVertical=false] Set to true to check only vertical position.
|
|
21
|
-
*
|
|
22
|
-
* @return {boolean} True if at the edge, false if not.
|
|
23
|
-
*/
|
|
24
|
-
export default function isEdge(container, isReverse, onlyVertical = false) {
|
|
25
|
-
if (isInputOrTextArea(container) && typeof container.selectionStart === 'number') {
|
|
1
|
+
import isRTL from "./is-rtl";
|
|
2
|
+
import getRangeHeight from "./get-range-height";
|
|
3
|
+
import getRectangleFromRange from "./get-rectangle-from-range";
|
|
4
|
+
import isSelectionForward from "./is-selection-forward";
|
|
5
|
+
import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point";
|
|
6
|
+
import { assertIsDefined } from "../utils/assert-is-defined";
|
|
7
|
+
import isInputOrTextArea from "./is-input-or-text-area";
|
|
8
|
+
import { scrollIfNoRange } from "./scroll-if-no-range";
|
|
9
|
+
function isEdge(container, isReverse, onlyVertical = false) {
|
|
10
|
+
if (isInputOrTextArea(container) && typeof container.selectionStart === "number") {
|
|
26
11
|
if (container.selectionStart !== container.selectionEnd) {
|
|
27
12
|
return false;
|
|
28
13
|
}
|
|
@@ -34,13 +19,9 @@ export default function isEdge(container, isReverse, onlyVertical = false) {
|
|
|
34
19
|
if (!container.isContentEditable) {
|
|
35
20
|
return true;
|
|
36
21
|
}
|
|
37
|
-
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const {
|
|
41
|
-
defaultView
|
|
42
|
-
} = ownerDocument;
|
|
43
|
-
assertIsDefined(defaultView, 'defaultView');
|
|
22
|
+
const { ownerDocument } = container;
|
|
23
|
+
const { defaultView } = ownerDocument;
|
|
24
|
+
assertIsDefined(defaultView, "defaultView");
|
|
44
25
|
const selection = defaultView.getSelection();
|
|
45
26
|
if (!selection || !selection.rangeCount) {
|
|
46
27
|
return false;
|
|
@@ -49,8 +30,6 @@ export default function isEdge(container, isReverse, onlyVertical = false) {
|
|
|
49
30
|
const collapsedRange = range.cloneRange();
|
|
50
31
|
const isForward = isSelectionForward(selection);
|
|
51
32
|
const isCollapsed = selection.isCollapsed;
|
|
52
|
-
|
|
53
|
-
// Collapse in direction of selection.
|
|
54
33
|
if (!isCollapsed) {
|
|
55
34
|
collapsedRange.collapse(!isForward);
|
|
56
35
|
}
|
|
@@ -59,32 +38,19 @@ export default function isEdge(container, isReverse, onlyVertical = false) {
|
|
|
59
38
|
if (!collapsedRangeRect || !rangeRect) {
|
|
60
39
|
return false;
|
|
61
40
|
}
|
|
62
|
-
|
|
63
|
-
// Only consider the multiline selection at the edge if the direction is
|
|
64
|
-
// towards the edge. The selection is multiline if it is taller than the
|
|
65
|
-
// collapsed selection.
|
|
66
41
|
const rangeHeight = getRangeHeight(range);
|
|
67
42
|
if (!isCollapsed && rangeHeight && rangeHeight > collapsedRangeRect.height && isForward === isReverse) {
|
|
68
43
|
return false;
|
|
69
44
|
}
|
|
70
|
-
|
|
71
|
-
// In the case of RTL scripts, the horizontal edge is at the opposite side.
|
|
72
45
|
const isReverseDir = isRTL(container) ? !isReverse : isReverse;
|
|
73
46
|
const containerRect = container.getBoundingClientRect();
|
|
74
|
-
|
|
75
|
-
// To check if a selection is at the edge, we insert a test selection at the
|
|
76
|
-
// edge of the container and check if the selections have the same vertical
|
|
77
|
-
// or horizontal position. If they do, the selection is at the edge.
|
|
78
|
-
// This method proves to be better than a DOM-based calculation for the
|
|
79
|
-
// horizontal edge, since it ignores empty textnodes and a trailing line
|
|
80
|
-
// break element. In other words, we need to check visual positioning, not
|
|
81
|
-
// DOM positioning.
|
|
82
|
-
// It also proves better than using the computed style for the vertical
|
|
83
|
-
// edge, because we cannot know the padding and line height reliably in
|
|
84
|
-
// pixels. `getComputedStyle` may return a value with different units.
|
|
85
47
|
const x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;
|
|
86
48
|
const y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;
|
|
87
|
-
const testRange = scrollIfNoRange(
|
|
49
|
+
const testRange = scrollIfNoRange(
|
|
50
|
+
container,
|
|
51
|
+
isReverse,
|
|
52
|
+
() => hiddenCaretRangeFromPoint(ownerDocument, x, y, container)
|
|
53
|
+
);
|
|
88
54
|
if (!testRange) {
|
|
89
55
|
return false;
|
|
90
56
|
}
|
|
@@ -92,14 +58,15 @@ export default function isEdge(container, isReverse, onlyVertical = false) {
|
|
|
92
58
|
if (!testRect) {
|
|
93
59
|
return false;
|
|
94
60
|
}
|
|
95
|
-
const verticalSide = isReverse ?
|
|
96
|
-
const horizontalSide = isReverseDir ?
|
|
61
|
+
const verticalSide = isReverse ? "top" : "bottom";
|
|
62
|
+
const horizontalSide = isReverseDir ? "left" : "right";
|
|
97
63
|
const verticalDiff = testRect[verticalSide] - rangeRect[verticalSide];
|
|
98
64
|
const horizontalDiff = testRect[horizontalSide] - collapsedRangeRect[horizontalSide];
|
|
99
|
-
|
|
100
|
-
// Allow the position to be 1px off.
|
|
101
65
|
const hasVerticalDiff = Math.abs(verticalDiff) <= 1;
|
|
102
66
|
const hasHorizontalDiff = Math.abs(horizontalDiff) <= 1;
|
|
103
67
|
return onlyVertical ? hasVerticalDiff : hasVerticalDiff && hasHorizontalDiff;
|
|
104
68
|
}
|
|
105
|
-
|
|
69
|
+
export {
|
|
70
|
+
isEdge as default
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=is-edge.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-edge.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isRTL from './is-rtl';\nimport getRangeHeight from './get-range-height';\nimport getRectangleFromRange from './get-rectangle-from-range';\nimport isSelectionForward from './is-selection-forward';\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Check whether the selection is at the edge of the container. Checks for\n * horizontal position by default. Set `onlyVertical` to true to check only\n * vertically.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check left, false to check right.\n * @param {boolean} [onlyVertical=false] Set to true to check only vertical position.\n *\n * @return {boolean} True if at the edge, false if not.\n */\nexport default function isEdge( container, isReverse, onlyVertical = false ) {\n\tif (\n\t\tisInputOrTextArea( container ) &&\n\t\ttypeof container.selectionStart === 'number'\n\t) {\n\t\tif ( container.selectionStart !== container.selectionEnd ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\treturn container.selectionStart === 0;\n\t\t}\n\n\t\treturn container.value.length === container.selectionStart;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\n\tif ( ! selection || ! selection.rangeCount ) {\n\t\treturn false;\n\t}\n\n\tconst range = selection.getRangeAt( 0 );\n\tconst collapsedRange = range.cloneRange();\n\tconst isForward = isSelectionForward( selection );\n\tconst isCollapsed = selection.isCollapsed;\n\n\t// Collapse in direction of selection.\n\tif ( ! isCollapsed ) {\n\t\tcollapsedRange.collapse( ! isForward );\n\t}\n\n\tconst collapsedRangeRect = getRectangleFromRange( collapsedRange );\n\tconst rangeRect = getRectangleFromRange( range );\n\n\tif ( ! collapsedRangeRect || ! rangeRect ) {\n\t\treturn false;\n\t}\n\n\t// Only consider the multiline selection at the edge if the direction is\n\t// towards the edge. The selection is multiline if it is taller than the\n\t// collapsed selection.\n\tconst rangeHeight = getRangeHeight( range );\n\tif (\n\t\t! isCollapsed &&\n\t\trangeHeight &&\n\t\trangeHeight > collapsedRangeRect.height &&\n\t\tisForward === isReverse\n\t) {\n\t\treturn false;\n\t}\n\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\n\t// To check if a selection is at the edge, we insert a test selection at the\n\t// edge of the container and check if the selections have the same vertical\n\t// or horizontal position. If they do, the selection is at the edge.\n\t// This method proves to be better than a DOM-based calculation for the\n\t// horizontal edge, since it ignores empty textnodes and a trailing line\n\t// break element. In other words, we need to check visual positioning, not\n\t// DOM positioning.\n\t// It also proves better than using the computed style for the vertical\n\t// edge, because we cannot know the padding and line height reliably in\n\t// pixels. `getComputedStyle` may return a value with different units.\n\tconst x = isReverseDir ? containerRect.left + 1 : containerRect.right - 1;\n\tconst y = isReverse ? containerRect.top + 1 : containerRect.bottom - 1;\n\tconst testRange = scrollIfNoRange( container, isReverse, () =>\n\t\thiddenCaretRangeFromPoint( ownerDocument, x, y, container )\n\t);\n\n\tif ( ! testRange ) {\n\t\treturn false;\n\t}\n\n\tconst testRect = getRectangleFromRange( testRange );\n\n\tif ( ! testRect ) {\n\t\treturn false;\n\t}\n\n\tconst verticalSide = isReverse ? 'top' : 'bottom';\n\tconst horizontalSide = isReverseDir ? 'left' : 'right';\n\tconst verticalDiff = testRect[ verticalSide ] - rangeRect[ verticalSide ];\n\tconst horizontalDiff =\n\t\ttestRect[ horizontalSide ] - collapsedRangeRect[ horizontalSide ];\n\n\t// Allow the position to be 1px off.\n\tconst hasVerticalDiff = Math.abs( verticalDiff ) <= 1;\n\tconst hasHorizontalDiff = Math.abs( horizontalDiff ) <= 1;\n\n\treturn onlyVertical\n\t\t? hasVerticalDiff\n\t\t: hasVerticalDiff && hasHorizontalDiff;\n}\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,WAAW;AAClB,OAAO,oBAAoB;AAC3B,OAAO,2BAA2B;AAClC,OAAO,wBAAwB;AAC/B,OAAO,+BAA+B;AACtC,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAC9B,SAAS,uBAAuB;AAajB,SAAR,OAAyB,WAAW,WAAW,eAAe,OAAQ;AAC5E,MACC,kBAAmB,SAAU,KAC7B,OAAO,UAAU,mBAAmB,UACnC;AACD,QAAK,UAAU,mBAAmB,UAAU,cAAe;AAC1D,aAAO;AAAA,IACR;AAEA,QAAK,WAAY;AAChB,aAAO,UAAU,mBAAmB;AAAA,IACrC;AAEA,WAAO,UAAU,MAAM,WAAW,UAAU;AAAA,EAC7C;AAEA,MAAK,CAAE,UAAU,mBAAoB;AACpC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AAExB,kBAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAE3C,MAAK,CAAE,aAAa,CAAE,UAAU,YAAa;AAC5C,WAAO;AAAA,EACR;AAEA,QAAM,QAAQ,UAAU,WAAY,CAAE;AACtC,QAAM,iBAAiB,MAAM,WAAW;AACxC,QAAM,YAAY,mBAAoB,SAAU;AAChD,QAAM,cAAc,UAAU;AAG9B,MAAK,CAAE,aAAc;AACpB,mBAAe,SAAU,CAAE,SAAU;AAAA,EACtC;AAEA,QAAM,qBAAqB,sBAAuB,cAAe;AACjE,QAAM,YAAY,sBAAuB,KAAM;AAE/C,MAAK,CAAE,sBAAsB,CAAE,WAAY;AAC1C,WAAO;AAAA,EACR;AAKA,QAAM,cAAc,eAAgB,KAAM;AAC1C,MACC,CAAE,eACF,eACA,cAAc,mBAAmB,UACjC,cAAc,WACb;AACD,WAAO;AAAA,EACR;AAGA,QAAM,eAAe,MAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAYtD,QAAM,IAAI,eAAe,cAAc,OAAO,IAAI,cAAc,QAAQ;AACxE,QAAM,IAAI,YAAY,cAAc,MAAM,IAAI,cAAc,SAAS;AACrE,QAAM,YAAY;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,MACxD,0BAA2B,eAAe,GAAG,GAAG,SAAU;AAAA,EAC3D;AAEA,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AAEA,QAAM,WAAW,sBAAuB,SAAU;AAElD,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,QAAM,eAAe,YAAY,QAAQ;AACzC,QAAM,iBAAiB,eAAe,SAAS;AAC/C,QAAM,eAAe,SAAU,YAAa,IAAI,UAAW,YAAa;AACxE,QAAM,iBACL,SAAU,cAAe,IAAI,mBAAoB,cAAe;AAGjE,QAAM,kBAAkB,KAAK,IAAK,YAAa,KAAK;AACpD,QAAM,oBAAoB,KAAK,IAAK,cAAe,KAAK;AAExD,SAAO,eACJ,kBACA,mBAAmB;AACvB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @param {Node | null | undefined} node
|
|
4
|
-
* @return {node is Element} True if node is an Element node
|
|
5
|
-
*/
|
|
6
|
-
export default function isElement(node) {
|
|
7
|
-
/* eslint-enable jsdoc/valid-types */
|
|
1
|
+
function isElement(node) {
|
|
8
2
|
return !!node && node.nodeType === node.ELEMENT_NODE;
|
|
9
3
|
}
|
|
10
|
-
|
|
4
|
+
export {
|
|
5
|
+
isElement as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=is-element.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-element.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node | null | undefined} node\n * @return {node is Element} True if node is an Element node\n */\nexport default function isElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn !! node && node.nodeType === node.ELEMENT_NODE;\n}\n"],
|
|
5
|
+
"mappings": "AAKe,SAAR,UAA4B,MAAO;AAEzC,SAAO,CAAC,CAAE,QAAQ,KAAK,aAAa,KAAK;AAC1C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
* Recursively checks if an element is empty. An element is not empty if it
|
|
3
|
-
* contains text or contains elements with attributes such as images.
|
|
4
|
-
*
|
|
5
|
-
* @param {Element} element The element to check.
|
|
6
|
-
*
|
|
7
|
-
* @return {boolean} Whether or not the element is empty.
|
|
8
|
-
*/
|
|
9
|
-
export default function isEmpty(element) {
|
|
1
|
+
function isEmpty(element) {
|
|
10
2
|
switch (element.nodeType) {
|
|
11
3
|
case element.TEXT_NODE:
|
|
12
|
-
|
|
13
|
-
// to preserve.
|
|
14
|
-
return /^[ \f\n\r\t\v\u00a0]*$/.test(element.nodeValue || '');
|
|
4
|
+
return /^[ \f\n\r\t\v\u00a0]*$/.test(element.nodeValue || "");
|
|
15
5
|
case element.ELEMENT_NODE:
|
|
16
6
|
if (element.hasAttributes()) {
|
|
17
7
|
return false;
|
|
18
8
|
} else if (!element.hasChildNodes()) {
|
|
19
9
|
return true;
|
|
20
10
|
}
|
|
21
|
-
return
|
|
11
|
+
return (
|
|
12
|
+
/** @type {Element[]} */
|
|
13
|
+
Array.from(element.childNodes).every(isEmpty)
|
|
14
|
+
);
|
|
22
15
|
default:
|
|
23
16
|
return true;
|
|
24
17
|
}
|
|
25
18
|
}
|
|
26
|
-
|
|
19
|
+
export {
|
|
20
|
+
isEmpty as default
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=is-empty.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-empty.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Recursively checks if an element is empty. An element is not empty if it\n * contains text or contains elements with attributes such as images.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} Whether or not the element is empty.\n */\nexport default function isEmpty( element ) {\n\tswitch ( element.nodeType ) {\n\t\tcase element.TEXT_NODE:\n\t\t\t// We cannot use \\s since it includes special spaces which we want\n\t\t\t// to preserve.\n\t\t\treturn /^[ \\f\\n\\r\\t\\v\\u00a0]*$/.test( element.nodeValue || '' );\n\t\tcase element.ELEMENT_NODE:\n\t\t\tif ( element.hasAttributes() ) {\n\t\t\t\treturn false;\n\t\t\t} else if ( ! element.hasChildNodes() ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn /** @type {Element[]} */ (\n\t\t\t\tArray.from( element.childNodes )\n\t\t\t).every( isEmpty );\n\t\tdefault:\n\t\t\treturn true;\n\t}\n}\n"],
|
|
5
|
+
"mappings": "AAQe,SAAR,QAA0B,SAAU;AAC1C,UAAS,QAAQ,UAAW;AAAA,IAC3B,KAAK,QAAQ;AAGZ,aAAO,yBAAyB,KAAM,QAAQ,aAAa,EAAG;AAAA,IAC/D,KAAK,QAAQ;AACZ,UAAK,QAAQ,cAAc,GAAI;AAC9B,eAAO;AAAA,MACR,WAAY,CAAE,QAAQ,cAAc,GAAI;AACvC,eAAO;AAAA,MACR;AAEA;AAAA;AAAA,QACC,MAAM,KAAM,QAAQ,UAAW,EAC9B,MAAO,OAAQ;AAAA;AAAA,IAClB;AACC,aAAO;AAAA,EACT;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,64 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { assertIsDefined } from '../utils/assert-is-defined';
|
|
5
|
-
import isInputOrTextArea from './is-input-or-text-area';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Check whether the contents of the element have been entirely selected.
|
|
9
|
-
* Returns true if there is no possibility of selection.
|
|
10
|
-
*
|
|
11
|
-
* @param {HTMLElement} element The element to check.
|
|
12
|
-
*
|
|
13
|
-
* @return {boolean} True if entirely selected, false if not.
|
|
14
|
-
*/
|
|
15
|
-
export default function isEntirelySelected(element) {
|
|
1
|
+
import { assertIsDefined } from "../utils/assert-is-defined";
|
|
2
|
+
import isInputOrTextArea from "./is-input-or-text-area";
|
|
3
|
+
function isEntirelySelected(element) {
|
|
16
4
|
if (isInputOrTextArea(element)) {
|
|
17
5
|
return element.selectionStart === 0 && element.value.length === element.selectionEnd;
|
|
18
6
|
}
|
|
19
7
|
if (!element.isContentEditable) {
|
|
20
8
|
return true;
|
|
21
9
|
}
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const {
|
|
26
|
-
defaultView
|
|
27
|
-
} = ownerDocument;
|
|
28
|
-
assertIsDefined(defaultView, 'defaultView');
|
|
10
|
+
const { ownerDocument } = element;
|
|
11
|
+
const { defaultView } = ownerDocument;
|
|
12
|
+
assertIsDefined(defaultView, "defaultView");
|
|
29
13
|
const selection = defaultView.getSelection();
|
|
30
|
-
assertIsDefined(selection,
|
|
14
|
+
assertIsDefined(selection, "selection");
|
|
31
15
|
const range = selection.rangeCount ? selection.getRangeAt(0) : null;
|
|
32
16
|
if (!range) {
|
|
33
17
|
return true;
|
|
34
18
|
}
|
|
35
|
-
const {
|
|
36
|
-
startContainer,
|
|
37
|
-
endContainer,
|
|
38
|
-
startOffset,
|
|
39
|
-
endOffset
|
|
40
|
-
} = range;
|
|
19
|
+
const { startContainer, endContainer, startOffset, endOffset } = range;
|
|
41
20
|
if (startContainer === element && endContainer === element && startOffset === 0 && endOffset === element.childNodes.length) {
|
|
42
21
|
return true;
|
|
43
22
|
}
|
|
44
23
|
const lastChild = element.lastChild;
|
|
45
|
-
assertIsDefined(lastChild,
|
|
46
|
-
const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ?
|
|
47
|
-
|
|
24
|
+
assertIsDefined(lastChild, "lastChild");
|
|
25
|
+
const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? (
|
|
26
|
+
/** @type {Text} */
|
|
27
|
+
endContainer.data.length
|
|
28
|
+
) : endContainer.childNodes.length;
|
|
29
|
+
return isDeepChild(startContainer, element, "firstChild") && isDeepChild(endContainer, element, "lastChild") && startOffset === 0 && endOffset === endContainerContentLength;
|
|
48
30
|
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Check whether the contents of the element have been entirely selected.
|
|
52
|
-
* Returns true if there is no possibility of selection.
|
|
53
|
-
*
|
|
54
|
-
* @param {HTMLElement|Node} query The element to check.
|
|
55
|
-
* @param {HTMLElement} container The container that we suspect "query" may be a first or last child of.
|
|
56
|
-
* @param {"firstChild"|"lastChild"} propName "firstChild" or "lastChild"
|
|
57
|
-
*
|
|
58
|
-
* @return {boolean} True if query is a deep first/last child of container, false otherwise.
|
|
59
|
-
*/
|
|
60
31
|
function isDeepChild(query, container, propName) {
|
|
61
|
-
/** @type {HTMLElement | ChildNode | null} */
|
|
62
32
|
let candidate = container;
|
|
63
33
|
do {
|
|
64
34
|
if (query === candidate) {
|
|
@@ -68,4 +38,7 @@ function isDeepChild(query, container, propName) {
|
|
|
68
38
|
} while (candidate);
|
|
69
39
|
return false;
|
|
70
40
|
}
|
|
71
|
-
|
|
41
|
+
export {
|
|
42
|
+
isEntirelySelected as default
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=is-entirely-selected.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-entirely-selected.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement} element The element to check.\n *\n * @return {boolean} True if entirely selected, false if not.\n */\nexport default function isEntirelySelected( element ) {\n\tif ( isInputOrTextArea( element ) ) {\n\t\treturn (\n\t\t\telement.selectionStart === 0 &&\n\t\t\telement.value.length === element.selectionEnd\n\t\t);\n\t}\n\n\tif ( ! element.isContentEditable ) {\n\t\treturn true;\n\t}\n\n\tconst { ownerDocument } = element;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\n\tif ( ! range ) {\n\t\treturn true;\n\t}\n\n\tconst { startContainer, endContainer, startOffset, endOffset } = range;\n\n\tif (\n\t\tstartContainer === element &&\n\t\tendContainer === element &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === element.childNodes.length\n\t) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = element.lastChild;\n\tassertIsDefined( lastChild, 'lastChild' );\n\tconst endContainerContentLength =\n\t\tendContainer.nodeType === endContainer.TEXT_NODE\n\t\t\t? /** @type {Text} */ ( endContainer ).data.length\n\t\t\t: endContainer.childNodes.length;\n\n\treturn (\n\t\tisDeepChild( startContainer, element, 'firstChild' ) &&\n\t\tisDeepChild( endContainer, element, 'lastChild' ) &&\n\t\tstartOffset === 0 &&\n\t\tendOffset === endContainerContentLength\n\t);\n}\n\n/**\n * Check whether the contents of the element have been entirely selected.\n * Returns true if there is no possibility of selection.\n *\n * @param {HTMLElement|Node} query The element to check.\n * @param {HTMLElement} container The container that we suspect \"query\" may be a first or last child of.\n * @param {\"firstChild\"|\"lastChild\"} propName \"firstChild\" or \"lastChild\"\n *\n * @return {boolean} True if query is a deep first/last child of container, false otherwise.\n */\nfunction isDeepChild( query, container, propName ) {\n\t/** @type {HTMLElement | ChildNode | null} */\n\tlet candidate = container;\n\tdo {\n\t\tif ( query === candidate ) {\n\t\t\treturn true;\n\t\t}\n\t\tcandidate = candidate[ propName ];\n\t} while ( candidate );\n\treturn false;\n}\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,uBAAuB;AAChC,OAAO,uBAAuB;AAUf,SAAR,mBAAqC,SAAU;AACrD,MAAK,kBAAmB,OAAQ,GAAI;AACnC,WACC,QAAQ,mBAAmB,KAC3B,QAAQ,MAAM,WAAW,QAAQ;AAAA,EAEnC;AAEA,MAAK,CAAE,QAAQ,mBAAoB;AAClC,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,kBAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,kBAAiB,WAAW,WAAY;AACxC,QAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;AAEjE,MAAK,CAAE,OAAQ;AACd,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,gBAAgB,cAAc,aAAa,UAAU,IAAI;AAEjE,MACC,mBAAmB,WACnB,iBAAiB,WACjB,gBAAgB,KAChB,cAAc,QAAQ,WAAW,QAChC;AACD,WAAO;AAAA,EACR;AAEA,QAAM,YAAY,QAAQ;AAC1B,kBAAiB,WAAW,WAAY;AACxC,QAAM,4BACL,aAAa,aAAa,aAAa;AAAA;AAAA,IACd,aAAe,KAAK;AAAA,MAC1C,aAAa,WAAW;AAE5B,SACC,YAAa,gBAAgB,SAAS,YAAa,KACnD,YAAa,cAAc,SAAS,WAAY,KAChD,gBAAgB,KAChB,cAAc;AAEhB;AAYA,SAAS,YAAa,OAAO,WAAW,UAAW;AAElD,MAAI,YAAY;AAChB,KAAG;AACF,QAAK,UAAU,WAAY;AAC1B,aAAO;AAAA,IACR;AACA,gBAAY,UAAW,QAAS;AAAA,EACjC,SAAU;AACV,SAAO;AACR;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import isInputOrTextArea from './is-input-or-text-area';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* Detects if element is a form element.
|
|
9
|
-
*
|
|
10
|
-
* @param {Element} element The element to check.
|
|
11
|
-
*
|
|
12
|
-
* @return {boolean} True if form element and false otherwise.
|
|
13
|
-
*/
|
|
14
|
-
export default function isFormElement(element) {
|
|
1
|
+
import isInputOrTextArea from "./is-input-or-text-area";
|
|
2
|
+
function isFormElement(element) {
|
|
15
3
|
if (!element) {
|
|
16
4
|
return false;
|
|
17
5
|
}
|
|
18
|
-
const {
|
|
19
|
-
tagName
|
|
20
|
-
} = element;
|
|
6
|
+
const { tagName } = element;
|
|
21
7
|
const checkForInputTextarea = isInputOrTextArea(element);
|
|
22
|
-
return checkForInputTextarea || tagName ===
|
|
8
|
+
return checkForInputTextarea || tagName === "BUTTON" || tagName === "SELECT";
|
|
23
9
|
}
|
|
24
|
-
|
|
10
|
+
export {
|
|
11
|
+
isFormElement as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=is-form-element.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-form-element.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport isInputOrTextArea from './is-input-or-text-area';\n\n/**\n *\n * Detects if element is a form element.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if form element and false otherwise.\n */\nexport default function isFormElement( element ) {\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": "AAGA,OAAO,uBAAuB;AAUf,SAAR,cAAgC,SAAU;AAChD,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,QAAM,EAAE,QAAQ,IAAI;AACpB,QAAM,wBAAwB,kBAAmB,OAAQ;AACzD,SACC,yBAAyB,YAAY,YAAY,YAAY;AAE/D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import isEdge from './is-edge';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Check whether the selection is horizontally at the edge of the container.
|
|
8
|
-
*
|
|
9
|
-
* @param {HTMLElement} container Focusable element.
|
|
10
|
-
* @param {boolean} isReverse Set to true to check left, false for right.
|
|
11
|
-
*
|
|
12
|
-
* @return {boolean} True if at the horizontal edge, false if not.
|
|
13
|
-
*/
|
|
14
|
-
export default function isHorizontalEdge(container, isReverse) {
|
|
1
|
+
import isEdge from "./is-edge";
|
|
2
|
+
function isHorizontalEdge(container, isReverse) {
|
|
15
3
|
return isEdge(container, isReverse);
|
|
16
4
|
}
|
|
17
|
-
|
|
5
|
+
export {
|
|
6
|
+
isHorizontalEdge as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=is-horizontal-edge.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-horizontal-edge.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport 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( container, isReverse ) {\n\treturn isEdge( container, isReverse );\n}\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,YAAY;AAUJ,SAAR,iBAAmC,WAAW,WAAY;AAChE,SAAO,OAAQ,WAAW,SAAU;AACrC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @param {Node} node
|
|
4
|
-
* @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.
|
|
5
|
-
*/
|
|
6
|
-
export default function isHTMLInputElement(node) {
|
|
7
|
-
/* eslint-enable jsdoc/valid-types */
|
|
8
|
-
return node?.nodeName === 'INPUT';
|
|
1
|
+
function isHTMLInputElement(node) {
|
|
2
|
+
return node?.nodeName === "INPUT";
|
|
9
3
|
}
|
|
10
|
-
|
|
4
|
+
export {
|
|
5
|
+
isHTMLInputElement as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=is-html-input-element.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-html-input-element.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Node} node\n * @return {node is HTMLInputElement} Whether the node is an HTMLInputElement.\n */\nexport default function isHTMLInputElement( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn node?.nodeName === 'INPUT';\n}\n"],
|
|
5
|
+
"mappings": "AAKe,SAAR,mBAAqC,MAAO;AAElD,SAAO,MAAM,aAAa;AAC3B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @param {Element} element
|
|
4
|
-
* @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea
|
|
5
|
-
*/
|
|
6
|
-
export default function isInputOrTextArea(element) {
|
|
7
|
-
/* eslint-enable jsdoc/valid-types */
|
|
8
|
-
return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';
|
|
1
|
+
function isInputOrTextArea(element) {
|
|
2
|
+
return element.tagName === "INPUT" || element.tagName === "TEXTAREA";
|
|
9
3
|
}
|
|
10
|
-
|
|
4
|
+
export {
|
|
5
|
+
isInputOrTextArea as default
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=is-input-or-text-area.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-input-or-text-area.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable jsdoc/valid-types */\n/**\n * @param {Element} element\n * @return {element is HTMLInputElement | HTMLTextAreaElement} Whether the element is an input or textarea\n */\nexport default function isInputOrTextArea( element ) {\n\t/* eslint-enable jsdoc/valid-types */\n\treturn element.tagName === 'INPUT' || element.tagName === 'TEXTAREA';\n}\n"],
|
|
5
|
+
"mappings": "AAKe,SAAR,kBAAoC,SAAU;AAEpD,SAAO,QAAQ,YAAY,WAAW,QAAQ,YAAY;AAC3D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import isHTMLInputElement from './is-html-input-element';
|
|
10
|
-
|
|
11
|
-
/* eslint-disable jsdoc/valid-types */
|
|
12
|
-
/**
|
|
13
|
-
* Check whether the given element is an input field of type number.
|
|
14
|
-
*
|
|
15
|
-
* @param {Node} node The HTML node.
|
|
16
|
-
*
|
|
17
|
-
* @return {node is HTMLInputElement} True if the node is number input.
|
|
18
|
-
*/
|
|
19
|
-
export default function isNumberInput(node) {
|
|
20
|
-
deprecated('wp.dom.isNumberInput', {
|
|
21
|
-
since: '6.1',
|
|
22
|
-
version: '6.5'
|
|
1
|
+
import deprecated from "@wordpress/deprecated";
|
|
2
|
+
import isHTMLInputElement from "./is-html-input-element";
|
|
3
|
+
function isNumberInput(node) {
|
|
4
|
+
deprecated("wp.dom.isNumberInput", {
|
|
5
|
+
since: "6.1",
|
|
6
|
+
version: "6.5"
|
|
23
7
|
});
|
|
24
|
-
|
|
25
|
-
return isHTMLInputElement(node) && node.type === 'number' && !isNaN(node.valueAsNumber);
|
|
8
|
+
return isHTMLInputElement(node) && node.type === "number" && !isNaN(node.valueAsNumber);
|
|
26
9
|
}
|
|
27
|
-
|
|
10
|
+
export {
|
|
11
|
+
isNumberInput as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=is-number-input.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-number-input.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is an input field of type number.\n *\n * @param {Node} node The HTML node.\n *\n * @return {node is HTMLInputElement} True if the node is number input.\n */\nexport default function isNumberInput( node ) {\n\tdeprecated( 'wp.dom.isNumberInput', {\n\t\tsince: '6.1',\n\t\tversion: '6.5',\n\t} );\n\t/* eslint-enable jsdoc/valid-types */\n\treturn (\n\t\tisHTMLInputElement( node ) &&\n\t\tnode.type === 'number' &&\n\t\t! isNaN( node.valueAsNumber )\n\t);\n}\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,gBAAgB;AAKvB,OAAO,wBAAwB;AAUhB,SAAR,cAAgC,MAAO;AAC7C,aAAY,wBAAwB;AAAA,IACnC,OAAO;AAAA,IACP,SAAS;AAAA,EACV,CAAE;AAEF,SACC,mBAAoB,IAAK,KACzB,KAAK,SAAS,YACd,CAAE,MAAO,KAAK,aAAc;AAE9B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import getComputedStyle from './get-computed-style';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Whether the element's text direction is right-to-left.
|
|
8
|
-
*
|
|
9
|
-
* @param {Element} element The element to check.
|
|
10
|
-
*
|
|
11
|
-
* @return {boolean} True if rtl, false if ltr.
|
|
12
|
-
*/
|
|
13
|
-
export default function isRTL(element) {
|
|
14
|
-
return getComputedStyle(element).direction === 'rtl';
|
|
1
|
+
import getComputedStyle from "./get-computed-style";
|
|
2
|
+
function isRTL(element) {
|
|
3
|
+
return getComputedStyle(element).direction === "rtl";
|
|
15
4
|
}
|
|
16
|
-
|
|
5
|
+
export {
|
|
6
|
+
isRTL as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=is-rtl.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/is-rtl.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Whether the element's text direction is right-to-left.\n *\n * @param {Element} element The element to check.\n *\n * @return {boolean} True if rtl, false if ltr.\n */\nexport default function isRTL( element ) {\n\treturn getComputedStyle( element ).direction === 'rtl';\n}\n"],
|
|
5
|
+
"mappings": "AAGA,OAAO,sBAAsB;AASd,SAAR,MAAwB,SAAU;AACxC,SAAO,iBAAkB,OAAQ,EAAE,cAAc;AAClD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|