@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.
Files changed (186) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/data-transfer.js +30 -18
  3. package/build/data-transfer.js.map +7 -1
  4. package/build/dom/caret-range-from-point.js +22 -25
  5. package/build/dom/caret-range-from-point.js.map +7 -1
  6. package/build/dom/clean-node-list.js +122 -129
  7. package/build/dom/clean-node-list.js.map +7 -1
  8. package/build/dom/compute-caret-rect.js +36 -21
  9. package/build/dom/compute-caret-rect.js.map +7 -1
  10. package/build/dom/document-has-selection.js +36 -22
  11. package/build/dom/document-has-selection.js.map +7 -1
  12. package/build/dom/document-has-text-selection.js +25 -23
  13. package/build/dom/document-has-text-selection.js.map +7 -1
  14. package/build/dom/document-has-uncollapsed-selection.js +35 -22
  15. package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
  16. package/build/dom/get-computed-style.js +27 -17
  17. package/build/dom/get-computed-style.js.map +7 -1
  18. package/build/dom/get-offset-parent.js +43 -32
  19. package/build/dom/get-offset-parent.js.map +7 -1
  20. package/build/dom/get-range-height.js +24 -18
  21. package/build/dom/get-range-height.js.map +7 -1
  22. package/build/dom/get-rectangle-from-range.js +47 -68
  23. package/build/dom/get-rectangle-from-range.js.map +7 -1
  24. package/build/dom/get-scroll-container.js +44 -37
  25. package/build/dom/get-scroll-container.js.map +7 -1
  26. package/build/dom/hidden-caret-range-from-point.js +39 -33
  27. package/build/dom/hidden-caret-range-from-point.js.map +7 -1
  28. package/build/dom/index.js +116 -195
  29. package/build/dom/index.js.map +7 -1
  30. package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
  31. package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  32. package/build/dom/insert-after.js +24 -19
  33. package/build/dom/insert-after.js.map +7 -1
  34. package/build/dom/is-edge.js +57 -67
  35. package/build/dom/is-edge.js.map +7 -1
  36. package/build/dom/is-element.js +22 -11
  37. package/build/dom/is-element.js.map +7 -1
  38. package/build/dom/is-empty.js +27 -17
  39. package/build/dom/is-empty.js.map +7 -1
  40. package/build/dom/is-entirely-selected.js +46 -50
  41. package/build/dom/is-entirely-selected.js.map +7 -1
  42. package/build/dom/is-form-element.js +36 -24
  43. package/build/dom/is-form-element.js.map +7 -1
  44. package/build/dom/is-horizontal-edge.js +34 -20
  45. package/build/dom/is-horizontal-edge.js.map +7 -1
  46. package/build/dom/is-html-input-element.js +23 -12
  47. package/build/dom/is-html-input-element.js.map +7 -1
  48. package/build/dom/is-input-or-text-area.js +23 -12
  49. package/build/dom/is-input-or-text-area.js.map +7 -1
  50. package/build/dom/is-number-input.js +38 -29
  51. package/build/dom/is-number-input.js.map +7 -1
  52. package/build/dom/is-rtl.js +34 -19
  53. package/build/dom/is-rtl.js.map +7 -1
  54. package/build/dom/is-selection-forward.js +26 -40
  55. package/build/dom/is-selection-forward.js.map +7 -1
  56. package/build/dom/is-text-field.js +49 -24
  57. package/build/dom/is-text-field.js.map +7 -1
  58. package/build/dom/is-vertical-edge.js +34 -20
  59. package/build/dom/is-vertical-edge.js.map +7 -1
  60. package/build/dom/place-caret-at-edge.js +52 -55
  61. package/build/dom/place-caret-at-edge.js.map +7 -1
  62. package/build/dom/place-caret-at-horizontal-edge.js +34 -18
  63. package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
  64. package/build/dom/place-caret-at-vertical-edge.js +34 -19
  65. package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
  66. package/build/dom/remove-invalid-html.js +35 -22
  67. package/build/dom/remove-invalid-html.js.map +7 -1
  68. package/build/dom/remove.js +24 -17
  69. package/build/dom/remove.js.map +7 -1
  70. package/build/dom/replace-tag.js +24 -19
  71. package/build/dom/replace-tag.js.map +7 -1
  72. package/build/dom/replace.js +38 -23
  73. package/build/dom/replace.js.map +7 -1
  74. package/build/dom/safe-html.js +39 -28
  75. package/build/dom/safe-html.js.map +7 -1
  76. package/build/dom/scroll-if-no-range.js +26 -18
  77. package/build/dom/scroll-if-no-range.js.map +7 -1
  78. package/build/dom/strip-html.js +36 -23
  79. package/build/dom/strip-html.js.map +7 -1
  80. package/build/dom/unwrap.js +24 -18
  81. package/build/dom/unwrap.js.map +7 -1
  82. package/build/dom/wrap.js +24 -17
  83. package/build/dom/wrap.js.map +7 -1
  84. package/build/focusable.js +52 -85
  85. package/build/focusable.js.map +7 -1
  86. package/build/index.js +44 -58
  87. package/build/index.js.map +7 -1
  88. package/build/phrasing-content.js +88 -128
  89. package/build/phrasing-content.js.map +7 -1
  90. package/build/tabbable.js +52 -137
  91. package/build/tabbable.js.map +7 -1
  92. package/build/utils/assert-is-defined.js +30 -7
  93. package/build/utils/assert-is-defined.js.map +7 -1
  94. package/build-module/data-transfer.js +9 -15
  95. package/build-module/data-transfer.js.map +7 -1
  96. package/build-module/dom/caret-range-from-point.js +5 -22
  97. package/build-module/dom/caret-range-from-point.js.map +7 -1
  98. package/build-module/dom/clean-node-list.js +94 -123
  99. package/build-module/dom/clean-node-list.js.map +7 -1
  100. package/build-module/dom/compute-caret-rect.js +8 -16
  101. package/build-module/dom/compute-caret-rect.js.map +7 -1
  102. package/build-module/dom/document-has-selection.js +8 -17
  103. package/build-module/dom/document-has-selection.js.map +7 -1
  104. package/build-module/dom/document-has-text-selection.js +8 -20
  105. package/build-module/dom/document-has-text-selection.js.map +7 -1
  106. package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
  107. package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
  108. package/build-module/dom/get-computed-style.js +10 -14
  109. package/build-module/dom/get-computed-style.js.map +7 -1
  110. package/build-module/dom/get-offset-parent.js +16 -28
  111. package/build-module/dom/get-offset-parent.js.map +7 -1
  112. package/build-module/dom/get-range-height.js +7 -15
  113. package/build-module/dom/get-range-height.js.map +7 -1
  114. package/build-module/dom/get-rectangle-from-range.js +30 -65
  115. package/build-module/dom/get-rectangle-from-range.js.map +7 -1
  116. package/build-module/dom/get-scroll-container.js +16 -32
  117. package/build-module/dom/get-scroll-container.js.map +7 -1
  118. package/build-module/dom/hidden-caret-range-from-point.js +11 -28
  119. package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
  120. package/build-module/dom/index.js +57 -28
  121. package/build-module/dom/index.js.map +7 -1
  122. package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
  123. package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  124. package/build-module/dom/insert-after.js +7 -16
  125. package/build-module/dom/insert-after.js.map +7 -1
  126. package/build-module/dom/is-edge.js +24 -57
  127. package/build-module/dom/is-edge.js.map +7 -1
  128. package/build-module/dom/is-element.js +5 -8
  129. package/build-module/dom/is-element.js.map +7 -1
  130. package/build-module/dom/is-empty.js +10 -14
  131. package/build-module/dom/is-empty.js.map +7 -1
  132. package/build-module/dom/is-entirely-selected.js +18 -45
  133. package/build-module/dom/is-entirely-selected.js.map +7 -1
  134. package/build-module/dom/is-form-element.js +8 -19
  135. package/build-module/dom/is-form-element.js.map +7 -1
  136. package/build-module/dom/is-horizontal-edge.js +6 -15
  137. package/build-module/dom/is-horizontal-edge.js.map +7 -1
  138. package/build-module/dom/is-html-input-element.js +6 -9
  139. package/build-module/dom/is-html-input-element.js.map +7 -1
  140. package/build-module/dom/is-input-or-text-area.js +6 -9
  141. package/build-module/dom/is-input-or-text-area.js.map +7 -1
  142. package/build-module/dom/is-number-input.js +11 -25
  143. package/build-module/dom/is-number-input.js.map +7 -1
  144. package/build-module/dom/is-rtl.js +7 -15
  145. package/build-module/dom/is-rtl.js.map +7 -1
  146. package/build-module/dom/is-selection-forward.js +9 -37
  147. package/build-module/dom/is-selection-forward.js.map +7 -1
  148. package/build-module/dom/is-text-field.js +22 -20
  149. package/build-module/dom/is-text-field.js.map +7 -1
  150. package/build-module/dom/is-vertical-edge.js +6 -15
  151. package/build-module/dom/is-vertical-edge.js.map +7 -1
  152. package/build-module/dom/place-caret-at-edge.js +22 -48
  153. package/build-module/dom/place-caret-at-edge.js.map +7 -1
  154. package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
  155. package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
  156. package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
  157. package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
  158. package/build-module/dom/remove-invalid-html.js +7 -17
  159. package/build-module/dom/remove-invalid-html.js.map +7 -1
  160. package/build-module/dom/remove.js +7 -14
  161. package/build-module/dom/remove.js.map +7 -1
  162. package/build-module/dom/replace-tag.js +7 -16
  163. package/build-module/dom/replace-tag.js.map +7 -1
  164. package/build-module/dom/replace.js +9 -17
  165. package/build-module/dom/replace.js.map +7 -1
  166. package/build-module/dom/safe-html.js +11 -23
  167. package/build-module/dom/safe-html.js.map +7 -1
  168. package/build-module/dom/scroll-if-no-range.js +5 -15
  169. package/build-module/dom/scroll-if-no-range.js.map +7 -1
  170. package/build-module/dom/strip-html.js +8 -18
  171. package/build-module/dom/strip-html.js.map +7 -1
  172. package/build-module/dom/unwrap.js +7 -15
  173. package/build-module/dom/unwrap.js.map +7 -1
  174. package/build-module/dom/wrap.js +7 -14
  175. package/build-module/dom/wrap.js.map +7 -1
  176. package/build-module/focusable.js +30 -81
  177. package/build-module/focusable.js.map +7 -1
  178. package/build-module/index.js +9 -17
  179. package/build-module/index.js.map +7 -1
  180. package/build-module/phrasing-content.js +67 -125
  181. package/build-module/phrasing-content.js.map +7 -1
  182. package/build-module/tabbable.js +30 -133
  183. package/build-module/tabbable.js.map +7 -1
  184. package/build-module/utils/assert-is-defined.js +9 -4
  185. package/build-module/utils/assert-is-defined.js.map +7 -1
  186. package/package.json +11 -4
@@ -1,28 +1,13 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import isRTL from './is-rtl';
5
- import getRangeHeight from './get-range-height';
6
- import getRectangleFromRange from './get-rectangle-from-range';
7
- import isSelectionForward from './is-selection-forward';
8
- import hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';
9
- import { assertIsDefined } from '../utils/assert-is-defined';
10
- import isInputOrTextArea from './is-input-or-text-area';
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
- ownerDocument
39
- } = container;
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(container, isReverse, () => hiddenCaretRangeFromPoint(ownerDocument, x, y, container));
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 ? 'top' : 'bottom';
96
- const horizontalSide = isReverseDir ? 'left' : 'right';
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
- //# sourceMappingURL=is-edge.js.map
69
+ export {
70
+ isEdge as default
71
+ };
72
+ //# sourceMappingURL=is-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isRTL","getRangeHeight","getRectangleFromRange","isSelectionForward","hiddenCaretRangeFromPoint","assertIsDefined","isInputOrTextArea","scrollIfNoRange","isEdge","container","isReverse","onlyVertical","selectionStart","selectionEnd","value","length","isContentEditable","ownerDocument","defaultView","selection","getSelection","rangeCount","range","getRangeAt","collapsedRange","cloneRange","isForward","isCollapsed","collapse","collapsedRangeRect","rangeRect","rangeHeight","height","isReverseDir","containerRect","getBoundingClientRect","x","left","right","y","top","bottom","testRange","testRect","verticalSide","horizontalSide","verticalDiff","horizontalDiff","hasVerticalDiff","Math","abs","hasHorizontalDiff"],"sources":["@wordpress/dom/src/dom/is-edge.js"],"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"],"mappings":"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","ignoreList":[]}
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
- /* eslint-disable jsdoc/valid-types */
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
- //# sourceMappingURL=is-element.js.map
4
+ export {
5
+ isElement as default
6
+ };
7
+ //# sourceMappingURL=is-element.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isElement","node","nodeType","ELEMENT_NODE"],"sources":["@wordpress/dom/src/dom/is-element.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA,OAAO,CAAC,CAAEA,IAAI,IAAIA,IAAI,CAACC,QAAQ,KAAKD,IAAI,CAACE,YAAY;AACtD","ignoreList":[]}
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
- // We cannot use \s since it includes special spaces which we want
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 /** @type {Element[]} */Array.from(element.childNodes).every(isEmpty);
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
- //# sourceMappingURL=is-empty.js.map
19
+ export {
20
+ isEmpty as default
21
+ };
22
+ //# sourceMappingURL=is-empty.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isEmpty","element","nodeType","TEXT_NODE","test","nodeValue","ELEMENT_NODE","hasAttributes","hasChildNodes","Array","from","childNodes","every"],"sources":["@wordpress/dom/src/dom/is-empty.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,OAAOA,CAAEC,OAAO,EAAG;EAC1C,QAASA,OAAO,CAACC,QAAQ;IACxB,KAAKD,OAAO,CAACE,SAAS;MACrB;MACA;MACA,OAAO,wBAAwB,CAACC,IAAI,CAAEH,OAAO,CAACI,SAAS,IAAI,EAAG,CAAC;IAChE,KAAKJ,OAAO,CAACK,YAAY;MACxB,IAAKL,OAAO,CAACM,aAAa,CAAC,CAAC,EAAG;QAC9B,OAAO,KAAK;MACb,CAAC,MAAM,IAAK,CAAEN,OAAO,CAACO,aAAa,CAAC,CAAC,EAAG;QACvC,OAAO,IAAI;MACZ;MAEA,OAAO,wBACNC,KAAK,CAACC,IAAI,CAAET,OAAO,CAACU,UAAW,CAAC,CAC/BC,KAAK,CAAEZ,OAAQ,CAAC;IACnB;MACC,OAAO,IAAI;EACb;AACD","ignoreList":[]}
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
- * Internal dependencies
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
- ownerDocument
24
- } = element;
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, '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, 'lastChild');
46
- const endContainerContentLength = endContainer.nodeType === endContainer.TEXT_NODE ? /** @type {Text} */endContainer.data.length : endContainer.childNodes.length;
47
- return isDeepChild(startContainer, element, 'firstChild') && isDeepChild(endContainer, element, 'lastChild') && startOffset === 0 && endOffset === endContainerContentLength;
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
- //# sourceMappingURL=is-entirely-selected.js.map
41
+ export {
42
+ isEntirelySelected as default
43
+ };
44
+ //# sourceMappingURL=is-entirely-selected.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","isInputOrTextArea","isEntirelySelected","element","selectionStart","value","length","selectionEnd","isContentEditable","ownerDocument","defaultView","selection","getSelection","range","rangeCount","getRangeAt","startContainer","endContainer","startOffset","endOffset","childNodes","lastChild","endContainerContentLength","nodeType","TEXT_NODE","data","isDeepChild","query","container","propName","candidate"],"sources":["@wordpress/dom/src/dom/is-entirely-selected.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;AAC5D,OAAOC,iBAAiB,MAAM,yBAAyB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,OAAO,EAAG;EACrD,IAAKF,iBAAiB,CAAEE,OAAQ,CAAC,EAAG;IACnC,OACCA,OAAO,CAACC,cAAc,KAAK,CAAC,IAC5BD,OAAO,CAACE,KAAK,CAACC,MAAM,KAAKH,OAAO,CAACI,YAAY;EAE/C;EAEA,IAAK,CAAEJ,OAAO,CAACK,iBAAiB,EAAG;IAClC,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEC;EAAc,CAAC,GAAGN,OAAO;EACjC,MAAM;IAAEO;EAAY,CAAC,GAAGD,aAAa;EACrCT,eAAe,CAAEU,WAAW,EAAE,aAAc,CAAC;EAC7C,MAAMC,SAAS,GAAGD,WAAW,CAACE,YAAY,CAAC,CAAC;EAC5CZ,eAAe,CAAEW,SAAS,EAAE,WAAY,CAAC;EACzC,MAAME,KAAK,GAAGF,SAAS,CAACG,UAAU,GAAGH,SAAS,CAACI,UAAU,CAAE,CAAE,CAAC,GAAG,IAAI;EAErE,IAAK,CAAEF,KAAK,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAM;IAAEG,cAAc;IAAEC,YAAY;IAAEC,WAAW;IAAEC;EAAU,CAAC,GAAGN,KAAK;EAEtE,IACCG,cAAc,KAAKb,OAAO,IAC1Bc,YAAY,KAAKd,OAAO,IACxBe,WAAW,KAAK,CAAC,IACjBC,SAAS,KAAKhB,OAAO,CAACiB,UAAU,CAACd,MAAM,EACtC;IACD,OAAO,IAAI;EACZ;EAEA,MAAMe,SAAS,GAAGlB,OAAO,CAACkB,SAAS;EACnCrB,eAAe,CAAEqB,SAAS,EAAE,WAAY,CAAC;EACzC,MAAMC,yBAAyB,GAC9BL,YAAY,CAACM,QAAQ,KAAKN,YAAY,CAACO,SAAS,GAC7C,mBAAsBP,YAAY,CAAGQ,IAAI,CAACnB,MAAM,GAChDW,YAAY,CAACG,UAAU,CAACd,MAAM;EAElC,OACCoB,WAAW,CAAEV,cAAc,EAAEb,OAAO,EAAE,YAAa,CAAC,IACpDuB,WAAW,CAAET,YAAY,EAAEd,OAAO,EAAE,WAAY,CAAC,IACjDe,WAAW,KAAK,CAAC,IACjBC,SAAS,KAAKG,yBAAyB;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,WAAWA,CAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAG;EAClD;EACA,IAAIC,SAAS,GAAGF,SAAS;EACzB,GAAG;IACF,IAAKD,KAAK,KAAKG,SAAS,EAAG;MAC1B,OAAO,IAAI;IACZ;IACAA,SAAS,GAAGA,SAAS,CAAED,QAAQ,CAAE;EAClC,CAAC,QAASC,SAAS;EACnB,OAAO,KAAK;AACb","ignoreList":[]}
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
- * Internal dependencies
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 === 'BUTTON' || tagName === 'SELECT';
8
+ return checkForInputTextarea || tagName === "BUTTON" || tagName === "SELECT";
23
9
  }
24
- //# sourceMappingURL=is-form-element.js.map
10
+ export {
11
+ isFormElement as default
12
+ };
13
+ //# sourceMappingURL=is-form-element.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isInputOrTextArea","isFormElement","element","tagName","checkForInputTextarea"],"sources":["@wordpress/dom/src/dom/is-form-element.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,iBAAiB,MAAM,yBAAyB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAEC,OAAO,EAAG;EAChD,IAAK,CAAEA,OAAO,EAAG;IAChB,OAAO,KAAK;EACb;EAEA,MAAM;IAAEC;EAAQ,CAAC,GAAGD,OAAO;EAC3B,MAAME,qBAAqB,GAAGJ,iBAAiB,CAAEE,OAAQ,CAAC;EAC1D,OACCE,qBAAqB,IAAID,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,QAAQ;AAEvE","ignoreList":[]}
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
- * Internal dependencies
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
- //# sourceMappingURL=is-horizontal-edge.js.map
5
+ export {
6
+ isHorizontalEdge as default
7
+ };
8
+ //# sourceMappingURL=is-horizontal-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isEdge","isHorizontalEdge","container","isReverse"],"sources":["@wordpress/dom/src/dom/is-horizontal-edge.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,MAAM,MAAM,WAAW;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,gBAAgBA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAChE,OAAOH,MAAM,CAAEE,SAAS,EAAEC,SAAU,CAAC;AACtC","ignoreList":[]}
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
- /* eslint-disable jsdoc/valid-types */
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
- //# sourceMappingURL=is-html-input-element.js.map
4
+ export {
5
+ isHTMLInputElement as default
6
+ };
7
+ //# sourceMappingURL=is-html-input-element.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isHTMLInputElement","node","nodeName"],"sources":["@wordpress/dom/src/dom/is-html-input-element.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,kBAAkBA,CAAEC,IAAI,EAAG;EAClD;EACA,OAAOA,IAAI,EAAEC,QAAQ,KAAK,OAAO;AAClC","ignoreList":[]}
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
- /* eslint-disable jsdoc/valid-types */
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
- //# sourceMappingURL=is-input-or-text-area.js.map
4
+ export {
5
+ isInputOrTextArea as default
6
+ };
7
+ //# sourceMappingURL=is-input-or-text-area.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isInputOrTextArea","element","tagName"],"sources":["@wordpress/dom/src/dom/is-input-or-text-area.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,iBAAiBA,CAAEC,OAAO,EAAG;EACpD;EACA,OAAOA,OAAO,CAACC,OAAO,KAAK,OAAO,IAAID,OAAO,CAACC,OAAO,KAAK,UAAU;AACrE","ignoreList":[]}
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
- * WordPress dependencies
3
- */
4
- import deprecated from '@wordpress/deprecated';
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
- /* eslint-enable jsdoc/valid-types */
25
- return isHTMLInputElement(node) && node.type === 'number' && !isNaN(node.valueAsNumber);
8
+ return isHTMLInputElement(node) && node.type === "number" && !isNaN(node.valueAsNumber);
26
9
  }
27
- //# sourceMappingURL=is-number-input.js.map
10
+ export {
11
+ isNumberInput as default
12
+ };
13
+ //# sourceMappingURL=is-number-input.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["deprecated","isHTMLInputElement","isNumberInput","node","since","version","type","isNaN","valueAsNumber"],"sources":["@wordpress/dom/src/dom/is-number-input.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,OAAOC,kBAAkB,MAAM,yBAAyB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAAEC,IAAI,EAAG;EAC7CH,UAAU,CAAE,sBAAsB,EAAE;IACnCI,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;EACH;EACA,OACCJ,kBAAkB,CAAEE,IAAK,CAAC,IAC1BA,IAAI,CAACG,IAAI,KAAK,QAAQ,IACtB,CAAEC,KAAK,CAAEJ,IAAI,CAACK,aAAc,CAAC;AAE/B","ignoreList":[]}
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
- * Internal dependencies
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
- //# sourceMappingURL=is-rtl.js.map
5
+ export {
6
+ isRTL as default
7
+ };
8
+ //# sourceMappingURL=is-rtl.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getComputedStyle","isRTL","element","direction"],"sources":["@wordpress/dom/src/dom/is-rtl.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,KAAKA,CAAEC,OAAO,EAAG;EACxC,OAAOF,gBAAgB,CAAEE,OAAQ,CAAC,CAACC,SAAS,KAAK,KAAK;AACvD","ignoreList":[]}
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
+ }