@wordpress/dom 4.32.0 → 4.32.1-next.b8c8708f3.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 (185) hide show
  1. package/build/data-transfer.js +30 -18
  2. package/build/data-transfer.js.map +7 -1
  3. package/build/dom/caret-range-from-point.js +22 -25
  4. package/build/dom/caret-range-from-point.js.map +7 -1
  5. package/build/dom/clean-node-list.js +122 -129
  6. package/build/dom/clean-node-list.js.map +7 -1
  7. package/build/dom/compute-caret-rect.js +36 -21
  8. package/build/dom/compute-caret-rect.js.map +7 -1
  9. package/build/dom/document-has-selection.js +36 -22
  10. package/build/dom/document-has-selection.js.map +7 -1
  11. package/build/dom/document-has-text-selection.js +25 -23
  12. package/build/dom/document-has-text-selection.js.map +7 -1
  13. package/build/dom/document-has-uncollapsed-selection.js +35 -22
  14. package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
  15. package/build/dom/get-computed-style.js +27 -17
  16. package/build/dom/get-computed-style.js.map +7 -1
  17. package/build/dom/get-offset-parent.js +43 -32
  18. package/build/dom/get-offset-parent.js.map +7 -1
  19. package/build/dom/get-range-height.js +24 -18
  20. package/build/dom/get-range-height.js.map +7 -1
  21. package/build/dom/get-rectangle-from-range.js +47 -68
  22. package/build/dom/get-rectangle-from-range.js.map +7 -1
  23. package/build/dom/get-scroll-container.js +44 -37
  24. package/build/dom/get-scroll-container.js.map +7 -1
  25. package/build/dom/hidden-caret-range-from-point.js +39 -33
  26. package/build/dom/hidden-caret-range-from-point.js.map +7 -1
  27. package/build/dom/index.js +116 -195
  28. package/build/dom/index.js.map +7 -1
  29. package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
  30. package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  31. package/build/dom/insert-after.js +24 -19
  32. package/build/dom/insert-after.js.map +7 -1
  33. package/build/dom/is-edge.js +57 -67
  34. package/build/dom/is-edge.js.map +7 -1
  35. package/build/dom/is-element.js +22 -11
  36. package/build/dom/is-element.js.map +7 -1
  37. package/build/dom/is-empty.js +27 -17
  38. package/build/dom/is-empty.js.map +7 -1
  39. package/build/dom/is-entirely-selected.js +46 -50
  40. package/build/dom/is-entirely-selected.js.map +7 -1
  41. package/build/dom/is-form-element.js +36 -24
  42. package/build/dom/is-form-element.js.map +7 -1
  43. package/build/dom/is-horizontal-edge.js +34 -20
  44. package/build/dom/is-horizontal-edge.js.map +7 -1
  45. package/build/dom/is-html-input-element.js +23 -12
  46. package/build/dom/is-html-input-element.js.map +7 -1
  47. package/build/dom/is-input-or-text-area.js +23 -12
  48. package/build/dom/is-input-or-text-area.js.map +7 -1
  49. package/build/dom/is-number-input.js +38 -29
  50. package/build/dom/is-number-input.js.map +7 -1
  51. package/build/dom/is-rtl.js +34 -19
  52. package/build/dom/is-rtl.js.map +7 -1
  53. package/build/dom/is-selection-forward.js +26 -40
  54. package/build/dom/is-selection-forward.js.map +7 -1
  55. package/build/dom/is-text-field.js +49 -24
  56. package/build/dom/is-text-field.js.map +7 -1
  57. package/build/dom/is-vertical-edge.js +34 -20
  58. package/build/dom/is-vertical-edge.js.map +7 -1
  59. package/build/dom/place-caret-at-edge.js +52 -55
  60. package/build/dom/place-caret-at-edge.js.map +7 -1
  61. package/build/dom/place-caret-at-horizontal-edge.js +34 -18
  62. package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
  63. package/build/dom/place-caret-at-vertical-edge.js +34 -19
  64. package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
  65. package/build/dom/remove-invalid-html.js +35 -22
  66. package/build/dom/remove-invalid-html.js.map +7 -1
  67. package/build/dom/remove.js +24 -17
  68. package/build/dom/remove.js.map +7 -1
  69. package/build/dom/replace-tag.js +24 -19
  70. package/build/dom/replace-tag.js.map +7 -1
  71. package/build/dom/replace.js +38 -23
  72. package/build/dom/replace.js.map +7 -1
  73. package/build/dom/safe-html.js +39 -28
  74. package/build/dom/safe-html.js.map +7 -1
  75. package/build/dom/scroll-if-no-range.js +26 -18
  76. package/build/dom/scroll-if-no-range.js.map +7 -1
  77. package/build/dom/strip-html.js +36 -23
  78. package/build/dom/strip-html.js.map +7 -1
  79. package/build/dom/unwrap.js +24 -18
  80. package/build/dom/unwrap.js.map +7 -1
  81. package/build/dom/wrap.js +24 -17
  82. package/build/dom/wrap.js.map +7 -1
  83. package/build/focusable.js +52 -85
  84. package/build/focusable.js.map +7 -1
  85. package/build/index.js +44 -58
  86. package/build/index.js.map +7 -1
  87. package/build/phrasing-content.js +88 -128
  88. package/build/phrasing-content.js.map +7 -1
  89. package/build/tabbable.js +52 -137
  90. package/build/tabbable.js.map +7 -1
  91. package/build/utils/assert-is-defined.js +30 -7
  92. package/build/utils/assert-is-defined.js.map +7 -1
  93. package/build-module/data-transfer.js +9 -15
  94. package/build-module/data-transfer.js.map +7 -1
  95. package/build-module/dom/caret-range-from-point.js +5 -22
  96. package/build-module/dom/caret-range-from-point.js.map +7 -1
  97. package/build-module/dom/clean-node-list.js +94 -123
  98. package/build-module/dom/clean-node-list.js.map +7 -1
  99. package/build-module/dom/compute-caret-rect.js +8 -16
  100. package/build-module/dom/compute-caret-rect.js.map +7 -1
  101. package/build-module/dom/document-has-selection.js +8 -17
  102. package/build-module/dom/document-has-selection.js.map +7 -1
  103. package/build-module/dom/document-has-text-selection.js +8 -20
  104. package/build-module/dom/document-has-text-selection.js.map +7 -1
  105. package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
  106. package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
  107. package/build-module/dom/get-computed-style.js +10 -14
  108. package/build-module/dom/get-computed-style.js.map +7 -1
  109. package/build-module/dom/get-offset-parent.js +16 -28
  110. package/build-module/dom/get-offset-parent.js.map +7 -1
  111. package/build-module/dom/get-range-height.js +7 -15
  112. package/build-module/dom/get-range-height.js.map +7 -1
  113. package/build-module/dom/get-rectangle-from-range.js +30 -65
  114. package/build-module/dom/get-rectangle-from-range.js.map +7 -1
  115. package/build-module/dom/get-scroll-container.js +16 -32
  116. package/build-module/dom/get-scroll-container.js.map +7 -1
  117. package/build-module/dom/hidden-caret-range-from-point.js +11 -28
  118. package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
  119. package/build-module/dom/index.js +57 -28
  120. package/build-module/dom/index.js.map +7 -1
  121. package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
  122. package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  123. package/build-module/dom/insert-after.js +7 -16
  124. package/build-module/dom/insert-after.js.map +7 -1
  125. package/build-module/dom/is-edge.js +24 -57
  126. package/build-module/dom/is-edge.js.map +7 -1
  127. package/build-module/dom/is-element.js +5 -8
  128. package/build-module/dom/is-element.js.map +7 -1
  129. package/build-module/dom/is-empty.js +10 -14
  130. package/build-module/dom/is-empty.js.map +7 -1
  131. package/build-module/dom/is-entirely-selected.js +18 -45
  132. package/build-module/dom/is-entirely-selected.js.map +7 -1
  133. package/build-module/dom/is-form-element.js +8 -19
  134. package/build-module/dom/is-form-element.js.map +7 -1
  135. package/build-module/dom/is-horizontal-edge.js +6 -15
  136. package/build-module/dom/is-horizontal-edge.js.map +7 -1
  137. package/build-module/dom/is-html-input-element.js +6 -9
  138. package/build-module/dom/is-html-input-element.js.map +7 -1
  139. package/build-module/dom/is-input-or-text-area.js +6 -9
  140. package/build-module/dom/is-input-or-text-area.js.map +7 -1
  141. package/build-module/dom/is-number-input.js +11 -25
  142. package/build-module/dom/is-number-input.js.map +7 -1
  143. package/build-module/dom/is-rtl.js +7 -15
  144. package/build-module/dom/is-rtl.js.map +7 -1
  145. package/build-module/dom/is-selection-forward.js +9 -37
  146. package/build-module/dom/is-selection-forward.js.map +7 -1
  147. package/build-module/dom/is-text-field.js +22 -20
  148. package/build-module/dom/is-text-field.js.map +7 -1
  149. package/build-module/dom/is-vertical-edge.js +6 -15
  150. package/build-module/dom/is-vertical-edge.js.map +7 -1
  151. package/build-module/dom/place-caret-at-edge.js +22 -48
  152. package/build-module/dom/place-caret-at-edge.js.map +7 -1
  153. package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
  154. package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
  155. package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
  156. package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
  157. package/build-module/dom/remove-invalid-html.js +7 -17
  158. package/build-module/dom/remove-invalid-html.js.map +7 -1
  159. package/build-module/dom/remove.js +7 -14
  160. package/build-module/dom/remove.js.map +7 -1
  161. package/build-module/dom/replace-tag.js +7 -16
  162. package/build-module/dom/replace-tag.js.map +7 -1
  163. package/build-module/dom/replace.js +9 -17
  164. package/build-module/dom/replace.js.map +7 -1
  165. package/build-module/dom/safe-html.js +11 -23
  166. package/build-module/dom/safe-html.js.map +7 -1
  167. package/build-module/dom/scroll-if-no-range.js +5 -15
  168. package/build-module/dom/scroll-if-no-range.js.map +7 -1
  169. package/build-module/dom/strip-html.js +8 -18
  170. package/build-module/dom/strip-html.js.map +7 -1
  171. package/build-module/dom/unwrap.js +7 -15
  172. package/build-module/dom/unwrap.js.map +7 -1
  173. package/build-module/dom/wrap.js +7 -14
  174. package/build-module/dom/wrap.js.map +7 -1
  175. package/build-module/focusable.js +30 -81
  176. package/build-module/focusable.js.map +7 -1
  177. package/build-module/index.js +9 -17
  178. package/build-module/index.js.map +7 -1
  179. package/build-module/phrasing-content.js +67 -125
  180. package/build-module/phrasing-content.js.map +7 -1
  181. package/build-module/tabbable.js +30 -133
  182. package/build-module/tabbable.js.map +7 -1
  183. package/build-module/utils/assert-is-defined.js +9 -4
  184. package/build-module/utils/assert-is-defined.js.map +7 -1
  185. package/package.json +11 -4
@@ -1,34 +1,11 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Get the rectangle of a given Range. Returns `null` if no suitable rectangle
8
- * can be found.
9
- *
10
- * @param {Range} range The range.
11
- *
12
- * @return {DOMRect?} The rectangle.
13
- */
14
- export default function getRectangleFromRange(range) {
15
- // For uncollapsed ranges, get the rectangle that bounds the contents of the
16
- // range; this a rectangle enclosing the union of the bounding rectangles
17
- // for all the elements in the range.
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function getRectangleFromRange(range) {
18
3
  if (!range.collapsed) {
19
- const rects = Array.from(range.getClientRects());
20
-
21
- // If there's just a single rect, return it.
22
- if (rects.length === 1) {
23
- return rects[0];
4
+ const rects2 = Array.from(range.getClientRects());
5
+ if (rects2.length === 1) {
6
+ return rects2[0];
24
7
  }
25
-
26
- // Ignore tiny selection at the edge of a range.
27
- const filteredRects = rects.filter(({
28
- width
29
- }) => width > 1);
30
-
31
- // If it's full of tiny selections, return browser default.
8
+ const filteredRects = rects2.filter(({ width }) => width > 1);
32
9
  if (filteredRects.length === 0) {
33
10
  return range.getBoundingClientRect();
34
11
  }
@@ -41,12 +18,7 @@ export default function getRectangleFromRange(range) {
41
18
  left: furthestLeft,
42
19
  right: furthestRight
43
20
  } = filteredRects[0];
44
- for (const {
45
- top,
46
- bottom,
47
- left,
48
- right
49
- } of filteredRects) {
21
+ for (const { top, bottom, left, right } of filteredRects) {
50
22
  if (top < furthestTop) {
51
23
  furthestTop = top;
52
24
  }
@@ -60,51 +32,44 @@ export default function getRectangleFromRange(range) {
60
32
  furthestRight = right;
61
33
  }
62
34
  }
63
- return new window.DOMRect(furthestLeft, furthestTop, furthestRight - furthestLeft, furthestBottom - furthestTop);
35
+ return new window.DOMRect(
36
+ furthestLeft,
37
+ furthestTop,
38
+ furthestRight - furthestLeft,
39
+ furthestBottom - furthestTop
40
+ );
64
41
  }
65
- const {
66
- startContainer
67
- } = range;
68
- const {
69
- ownerDocument
70
- } = startContainer;
71
-
72
- // Correct invalid "BR" ranges. The cannot contain any children.
73
- if (startContainer.nodeName === 'BR') {
74
- const {
75
- parentNode
76
- } = startContainer;
77
- assertIsDefined(parentNode, 'parentNode');
78
- const index = /** @type {Node[]} */Array.from(parentNode.childNodes).indexOf(startContainer);
79
- assertIsDefined(ownerDocument, 'ownerDocument');
42
+ const { startContainer } = range;
43
+ const { ownerDocument } = startContainer;
44
+ if (startContainer.nodeName === "BR") {
45
+ const { parentNode } = startContainer;
46
+ assertIsDefined(parentNode, "parentNode");
47
+ const index = (
48
+ /** @type {Node[]} */
49
+ Array.from(parentNode.childNodes).indexOf(startContainer)
50
+ );
51
+ assertIsDefined(ownerDocument, "ownerDocument");
80
52
  range = ownerDocument.createRange();
81
53
  range.setStart(parentNode, index);
82
54
  range.setEnd(parentNode, index);
83
55
  }
84
56
  const rects = range.getClientRects();
85
-
86
- // If we have multiple rectangles for a collapsed range, there's no way to
87
- // know which it is, so don't return anything.
88
57
  if (rects.length > 1) {
89
58
  return null;
90
59
  }
91
60
  let rect = rects[0];
92
-
93
- // If the collapsed range starts (and therefore ends) at an element node,
94
- // `getClientRects` can be empty in some browsers. This can be resolved
95
- // by adding a temporary text node with zero-width space to the range.
96
- //
97
- // See: https://stackoverflow.com/a/6847328/995445
98
61
  if (!rect || rect.height === 0) {
99
- assertIsDefined(ownerDocument, 'ownerDocument');
100
- const padNode = ownerDocument.createTextNode('\u200b');
101
- // Do not modify the live range.
62
+ assertIsDefined(ownerDocument, "ownerDocument");
63
+ const padNode = ownerDocument.createTextNode("\u200B");
102
64
  range = range.cloneRange();
103
65
  range.insertNode(padNode);
104
66
  rect = range.getClientRects()[0];
105
- assertIsDefined(padNode.parentNode, 'padNode.parentNode');
67
+ assertIsDefined(padNode.parentNode, "padNode.parentNode");
106
68
  padNode.parentNode.removeChild(padNode);
107
69
  }
108
70
  return rect;
109
71
  }
110
- //# sourceMappingURL=get-rectangle-from-range.js.map
72
+ export {
73
+ getRectangleFromRange as default
74
+ };
75
+ //# sourceMappingURL=get-rectangle-from-range.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","getRectangleFromRange","range","collapsed","rects","Array","from","getClientRects","length","filteredRects","filter","width","getBoundingClientRect","top","furthestTop","bottom","furthestBottom","left","furthestLeft","right","furthestRight","window","DOMRect","startContainer","ownerDocument","nodeName","parentNode","index","childNodes","indexOf","createRange","setStart","setEnd","rect","height","padNode","createTextNode","cloneRange","insertNode","removeChild"],"sources":["@wordpress/dom/src/dom/get-rectangle-from-range.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) {\n\t\t\t\tfurthestTop = top;\n\t\t\t}\n\t\t\tif ( bottom > furthestBottom ) {\n\t\t\t\tfurthestBottom = bottom;\n\t\t\t}\n\t\t\tif ( left < furthestLeft ) {\n\t\t\t\tfurthestLeft = left;\n\t\t\t}\n\t\t\tif ( right > furthestRight ) {\n\t\t\t\tfurthestRight = right;\n\t\t\t}\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAEC,KAAK,EAAG;EACtD;EACA;EACA;EACA,IAAK,CAAEA,KAAK,CAACC,SAAS,EAAG;I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;EAEA,OAAOF,IAAI;AACZ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/get-rectangle-from-range.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Get the rectangle of a given Range. Returns `null` if no suitable rectangle\n * can be found.\n *\n * @param {Range} range The range.\n *\n * @return {DOMRect?} The rectangle.\n */\nexport default function getRectangleFromRange( range ) {\n\t// For uncollapsed ranges, get the rectangle that bounds the contents of the\n\t// range; this a rectangle enclosing the union of the bounding rectangles\n\t// for all the elements in the range.\n\tif ( ! range.collapsed ) {\n\t\tconst rects = Array.from( range.getClientRects() );\n\n\t\t// If there's just a single rect, return it.\n\t\tif ( rects.length === 1 ) {\n\t\t\treturn rects[ 0 ];\n\t\t}\n\n\t\t// Ignore tiny selection at the edge of a range.\n\t\tconst filteredRects = rects.filter( ( { width } ) => width > 1 );\n\n\t\t// If it's full of tiny selections, return browser default.\n\t\tif ( filteredRects.length === 0 ) {\n\t\t\treturn range.getBoundingClientRect();\n\t\t}\n\n\t\tif ( filteredRects.length === 1 ) {\n\t\t\treturn filteredRects[ 0 ];\n\t\t}\n\n\t\tlet {\n\t\t\ttop: furthestTop,\n\t\t\tbottom: furthestBottom,\n\t\t\tleft: furthestLeft,\n\t\t\tright: furthestRight,\n\t\t} = filteredRects[ 0 ];\n\n\t\tfor ( const { top, bottom, left, right } of filteredRects ) {\n\t\t\tif ( top < furthestTop ) {\n\t\t\t\tfurthestTop = top;\n\t\t\t}\n\t\t\tif ( bottom > furthestBottom ) {\n\t\t\t\tfurthestBottom = bottom;\n\t\t\t}\n\t\t\tif ( left < furthestLeft ) {\n\t\t\t\tfurthestLeft = left;\n\t\t\t}\n\t\t\tif ( right > furthestRight ) {\n\t\t\t\tfurthestRight = right;\n\t\t\t}\n\t\t}\n\n\t\treturn new window.DOMRect(\n\t\t\tfurthestLeft,\n\t\t\tfurthestTop,\n\t\t\tfurthestRight - furthestLeft,\n\t\t\tfurthestBottom - furthestTop\n\t\t);\n\t}\n\n\tconst { startContainer } = range;\n\tconst { ownerDocument } = startContainer;\n\n\t// Correct invalid \"BR\" ranges. The cannot contain any children.\n\tif ( startContainer.nodeName === 'BR' ) {\n\t\tconst { parentNode } = startContainer;\n\t\tassertIsDefined( parentNode, 'parentNode' );\n\t\tconst index = /** @type {Node[]} */ (\n\t\t\tArray.from( parentNode.childNodes )\n\t\t).indexOf( startContainer );\n\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\trange = ownerDocument.createRange();\n\t\trange.setStart( parentNode, index );\n\t\trange.setEnd( parentNode, index );\n\t}\n\n\tconst rects = range.getClientRects();\n\n\t// If we have multiple rectangles for a collapsed range, there's no way to\n\t// know which it is, so don't return anything.\n\tif ( rects.length > 1 ) {\n\t\treturn null;\n\t}\n\n\tlet rect = rects[ 0 ];\n\n\t// If the collapsed range starts (and therefore ends) at an element node,\n\t// `getClientRects` can be empty in some browsers. This can be resolved\n\t// by adding a temporary text node with zero-width space to the range.\n\t//\n\t// See: https://stackoverflow.com/a/6847328/995445\n\tif ( ! rect || rect.height === 0 ) {\n\t\tassertIsDefined( ownerDocument, 'ownerDocument' );\n\t\tconst padNode = ownerDocument.createTextNode( '\\u200b' );\n\t\t// Do not modify the live range.\n\t\trange = range.cloneRange();\n\t\trange.insertNode( padNode );\n\t\trect = range.getClientRects()[ 0 ];\n\t\tassertIsDefined( padNode.parentNode, 'padNode.parentNode' );\n\t\tpadNode.parentNode.removeChild( padNode );\n\t}\n\n\treturn rect;\n}\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAUjB,SAAR,sBAAwC,OAAQ;AAItD,MAAK,CAAE,MAAM,WAAY;AACxB,UAAMA,SAAQ,MAAM,KAAM,MAAM,eAAe,CAAE;AAGjD,QAAKA,OAAM,WAAW,GAAI;AACzB,aAAOA,OAAO,CAAE;AAAA,IACjB;AAGA,UAAM,gBAAgBA,OAAM,OAAQ,CAA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,QAAS;AAEvD,YAAQ,MAAM,WAAW;AACzB,UAAM,WAAY,OAAQ;AAC1B,WAAO,MAAM,eAAe,EAAG,CAAE;AACjC,oBAAiB,QAAQ,YAAY,oBAAqB;AAC1D,YAAQ,WAAW,YAAa,OAAQ;AAAA,EACzC;AAEA,SAAO;AACR;",
6
+ "names": ["rects"]
7
+ }
@@ -1,40 +1,19 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import getComputedStyle from './get-computed-style';
5
-
6
- /**
7
- * Given a DOM node, finds the closest scrollable container node or the node
8
- * itself, if scrollable.
9
- *
10
- * @param {Element | null} node Node from which to start.
11
- * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').
12
- * Defaults to 'vertical'.
13
- * @return {Element | undefined} Scrollable container node, if found.
14
- */
15
- export default function getScrollContainer(node, direction = 'vertical') {
1
+ import getComputedStyle from "./get-computed-style";
2
+ function getScrollContainer(node, direction = "vertical") {
16
3
  if (!node) {
17
- return undefined;
4
+ return void 0;
18
5
  }
19
- if (direction === 'vertical' || direction === 'all') {
20
- // Scrollable if scrollable height exceeds displayed...
6
+ if (direction === "vertical" || direction === "all") {
21
7
  if (node.scrollHeight > node.clientHeight) {
22
- // ...except when overflow is defined to be hidden or visible
23
- const {
24
- overflowY
25
- } = getComputedStyle(node);
8
+ const { overflowY } = getComputedStyle(node);
26
9
  if (/(auto|scroll)/.test(overflowY)) {
27
10
  return node;
28
11
  }
29
12
  }
30
13
  }
31
- if (direction === 'horizontal' || direction === 'all') {
32
- // Scrollable if scrollable width exceeds displayed...
14
+ if (direction === "horizontal" || direction === "all") {
33
15
  if (node.scrollWidth > node.clientWidth) {
34
- // ...except when overflow is defined to be hidden or visible
35
- const {
36
- overflowX
37
- } = getComputedStyle(node);
16
+ const { overflowX } = getComputedStyle(node);
38
17
  if (/(auto|scroll)/.test(overflowX)) {
39
18
  return node;
40
19
  }
@@ -43,8 +22,13 @@ export default function getScrollContainer(node, direction = 'vertical') {
43
22
  if (node.ownerDocument === node.parentNode) {
44
23
  return node;
45
24
  }
46
-
47
- // Continue traversing.
48
- return getScrollContainer(/** @type {Element} */node.parentNode, direction);
25
+ return getScrollContainer(
26
+ /** @type {Element} */
27
+ node.parentNode,
28
+ direction
29
+ );
49
30
  }
50
- //# sourceMappingURL=get-scroll-container.js.map
31
+ export {
32
+ getScrollContainer as default
33
+ };
34
+ //# sourceMappingURL=get-scroll-container.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getComputedStyle","getScrollContainer","node","direction","undefined","scrollHeight","clientHeight","overflowY","test","scrollWidth","clientWidth","overflowX","ownerDocument","parentNode"],"sources":["@wordpress/dom/src/dom/get-scroll-container.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,kBAAkBA,CAAEC,IAAI,EAAEC,SAAS,GAAG,UAAU,EAAG;EAC1E,IAAK,CAAED,IAAI,EAAG;IACb,OAAOE,SAAS;EACjB;EAEA,IAAKD,SAAS,KAAK,UAAU,IAAIA,SAAS,KAAK,KAAK,EAAG;IACtD;IACA,IAAKD,IAAI,CAACG,YAAY,GAAGH,IAAI,CAACI,YAAY,EAAG;MAC5C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAGP,gBAAgB,CAAEE,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACM,IAAI,CAAED,SAAU,CAAC,EAAG;QACxC,OAAOL,IAAI;MACZ;IACD;EACD;EAEA,IAAKC,SAAS,KAAK,YAAY,IAAIA,SAAS,KAAK,KAAK,EAAG;IACxD;IACA,IAAKD,IAAI,CAACO,WAAW,GAAGP,IAAI,CAACQ,WAAW,EAAG;MAC1C;MACA,MAAM;QAAEC;MAAU,CAAC,GAAGX,gBAAgB,CAAEE,IAAK,CAAC;MAE9C,IAAK,eAAe,CAACM,IAAI,CAAEG,SAAU,CAAC,EAAG;QACxC,OAAOT,IAAI;MACZ;IACD;EACD;EAEA,IAAKA,IAAI,CAACU,aAAa,KAAKV,IAAI,CAACW,UAAU,EAAG;IAC7C,OAAOX,IAAI;EACZ;;EAEA;EACA,OAAOD,kBAAkB,CACxB,sBAAyBC,IAAI,CAACW,UAAU,EACxCV,SACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/get-scroll-container.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Given a DOM node, finds the closest scrollable container node or the node\n * itself, if scrollable.\n *\n * @param {Element | null} node Node from which to start.\n * @param {?string} direction Direction of scrollable container to search for ('vertical', 'horizontal', 'all').\n * Defaults to 'vertical'.\n * @return {Element | undefined} Scrollable container node, if found.\n */\nexport default function getScrollContainer( node, direction = 'vertical' ) {\n\tif ( ! node ) {\n\t\treturn undefined;\n\t}\n\n\tif ( direction === 'vertical' || direction === 'all' ) {\n\t\t// Scrollable if scrollable height exceeds displayed...\n\t\tif ( node.scrollHeight > node.clientHeight ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowY } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowY ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( direction === 'horizontal' || direction === 'all' ) {\n\t\t// Scrollable if scrollable width exceeds displayed...\n\t\tif ( node.scrollWidth > node.clientWidth ) {\n\t\t\t// ...except when overflow is defined to be hidden or visible\n\t\t\tconst { overflowX } = getComputedStyle( node );\n\n\t\t\tif ( /(auto|scroll)/.test( overflowX ) ) {\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( node.ownerDocument === node.parentNode ) {\n\t\treturn node;\n\t}\n\n\t// Continue traversing.\n\treturn getScrollContainer(\n\t\t/** @type {Element} */ ( node.parentNode ),\n\t\tdirection\n\t);\n}\n"],
5
+ "mappings": "AAGA,OAAO,sBAAsB;AAWd,SAAR,mBAAqC,MAAM,YAAY,YAAa;AAC1E,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AAEA,MAAK,cAAc,cAAc,cAAc,OAAQ;AAEtD,QAAK,KAAK,eAAe,KAAK,cAAe;AAE5C,YAAM,EAAE,UAAU,IAAI,iBAAkB,IAAK;AAE7C,UAAK,gBAAgB,KAAM,SAAU,GAAI;AACxC,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAEA,MAAK,cAAc,gBAAgB,cAAc,OAAQ;AAExD,QAAK,KAAK,cAAc,KAAK,aAAc;AAE1C,YAAM,EAAE,UAAU,IAAI,iBAAkB,IAAK;AAE7C,UAAK,gBAAgB,KAAM,SAAU,GAAI;AACxC,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AAEA,MAAK,KAAK,kBAAkB,KAAK,YAAa;AAC7C,WAAO;AAAA,EACR;AAGA,SAAO;AAAA;AAAA,IACmB,KAAK;AAAA,IAC9B;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -1,36 +1,19 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import caretRangeFromPoint from './caret-range-from-point';
5
- import getComputedStyle from './get-computed-style';
6
-
7
- /**
8
- * Get a collapsed range for a given point.
9
- * Gives the container a temporary high z-index (above any UI).
10
- * This is preferred over getting the UI nodes and set styles there.
11
- *
12
- * @param {Document} doc The document of the range.
13
- * @param {number} x Horizontal position within the current viewport.
14
- * @param {number} y Vertical position within the current viewport.
15
- * @param {HTMLElement} container Container in which the range is expected to be found.
16
- *
17
- * @return {?Range} The best range for the given point.
18
- */
19
- export default function hiddenCaretRangeFromPoint(doc, x, y, container) {
1
+ import caretRangeFromPoint from "./caret-range-from-point";
2
+ import getComputedStyle from "./get-computed-style";
3
+ function hiddenCaretRangeFromPoint(doc, x, y, container) {
20
4
  const originalZIndex = container.style.zIndex;
21
5
  const originalPosition = container.style.position;
22
- const {
23
- position = 'static'
24
- } = getComputedStyle(container);
25
-
26
- // A z-index only works if the element position is not static.
27
- if (position === 'static') {
28
- container.style.position = 'relative';
6
+ const { position = "static" } = getComputedStyle(container);
7
+ if (position === "static") {
8
+ container.style.position = "relative";
29
9
  }
30
- container.style.zIndex = '10000';
10
+ container.style.zIndex = "10000";
31
11
  const range = caretRangeFromPoint(doc, x, y);
32
12
  container.style.zIndex = originalZIndex;
33
13
  container.style.position = originalPosition;
34
14
  return range;
35
15
  }
36
- //# sourceMappingURL=hidden-caret-range-from-point.js.map
16
+ export {
17
+ hiddenCaretRangeFromPoint as default
18
+ };
19
+ //# sourceMappingURL=hidden-caret-range-from-point.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["caretRangeFromPoint","getComputedStyle","hiddenCaretRangeFromPoint","doc","x","y","container","originalZIndex","style","zIndex","originalPosition","position","range"],"sources":["@wordpress/dom/src/dom/hidden-caret-range-from-point.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,gBAAgB,MAAM,sBAAsB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,yBAAyBA,CAAEC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAG;EACzE,MAAMC,cAAc,GAAGD,SAAS,CAACE,KAAK,CAACC,MAAM;EAC7C,MAAMC,gBAAgB,GAAGJ,SAAS,CAACE,KAAK,CAACG,QAAQ;EAEjD,MAAM;IAAEA,QAAQ,GAAG;EAAS,CAAC,GAAGV,gBAAgB,CAAEK,SAAU,CAAC;;EAE7D;EACA,IAAKK,QAAQ,KAAK,QAAQ,EAAG;IAC5BL,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAG,UAAU;EACtC;EAEAL,SAAS,CAACE,KAAK,CAACC,MAAM,GAAG,OAAO;EAEhC,MAAMG,KAAK,GAAGZ,mBAAmB,CAAEG,GAAG,EAAEC,CAAC,EAAEC,CAAE,CAAC;EAE9CC,SAAS,CAACE,KAAK,CAACC,MAAM,GAAGF,cAAc;EACvCD,SAAS,CAACE,KAAK,CAACG,QAAQ,GAAGD,gBAAgB;EAE3C,OAAOE,KAAK;AACb","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/hidden-caret-range-from-point.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport caretRangeFromPoint from './caret-range-from-point';\nimport getComputedStyle from './get-computed-style';\n\n/**\n * Get a collapsed range for a given point.\n * Gives the container a temporary high z-index (above any UI).\n * This is preferred over getting the UI nodes and set styles there.\n *\n * @param {Document} doc The document of the range.\n * @param {number} x Horizontal position within the current viewport.\n * @param {number} y Vertical position within the current viewport.\n * @param {HTMLElement} container Container in which the range is expected to be found.\n *\n * @return {?Range} The best range for the given point.\n */\nexport default function hiddenCaretRangeFromPoint( doc, x, y, container ) {\n\tconst originalZIndex = container.style.zIndex;\n\tconst originalPosition = container.style.position;\n\n\tconst { position = 'static' } = getComputedStyle( container );\n\n\t// A z-index only works if the element position is not static.\n\tif ( position === 'static' ) {\n\t\tcontainer.style.position = 'relative';\n\t}\n\n\tcontainer.style.zIndex = '10000';\n\n\tconst range = caretRangeFromPoint( doc, x, y );\n\n\tcontainer.style.zIndex = originalZIndex;\n\tcontainer.style.position = originalPosition;\n\n\treturn range;\n}\n"],
5
+ "mappings": "AAGA,OAAO,yBAAyB;AAChC,OAAO,sBAAsB;AAcd,SAAR,0BAA4C,KAAK,GAAG,GAAG,WAAY;AACzE,QAAM,iBAAiB,UAAU,MAAM;AACvC,QAAM,mBAAmB,UAAU,MAAM;AAEzC,QAAM,EAAE,WAAW,SAAS,IAAI,iBAAkB,SAAU;AAG5D,MAAK,aAAa,UAAW;AAC5B,cAAU,MAAM,WAAW;AAAA,EAC5B;AAEA,YAAU,MAAM,SAAS;AAEzB,QAAM,QAAQ,oBAAqB,KAAK,GAAG,CAAE;AAE7C,YAAU,MAAM,SAAS;AACzB,YAAU,MAAM,WAAW;AAE3B,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,28 +1,57 @@
1
- export { default as computeCaretRect } from './compute-caret-rect';
2
- export { default as documentHasTextSelection } from './document-has-text-selection';
3
- export { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';
4
- export { default as documentHasSelection } from './document-has-selection';
5
- export { default as getRectangleFromRange } from './get-rectangle-from-range';
6
- export { default as getScrollContainer } from './get-scroll-container';
7
- export { default as getOffsetParent } from './get-offset-parent';
8
- export { default as isEntirelySelected } from './is-entirely-selected';
9
- export { default as isFormElement } from './is-form-element';
10
- export { default as isHorizontalEdge } from './is-horizontal-edge';
11
- export { default as isNumberInput } from './is-number-input';
12
- export { default as isTextField } from './is-text-field';
13
- export { default as isVerticalEdge } from './is-vertical-edge';
14
- export { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';
15
- export { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';
16
- export { default as replace } from './replace';
17
- export { default as remove } from './remove';
18
- export { default as insertAfter } from './insert-after';
19
- export { default as unwrap } from './unwrap';
20
- export { default as replaceTag } from './replace-tag';
21
- export { default as wrap } from './wrap';
22
- export { default as __unstableStripHTML } from './strip-html';
23
- export { default as isEmpty } from './is-empty';
24
- export { default as removeInvalidHTML } from './remove-invalid-html';
25
- export { default as isRTL } from './is-rtl';
26
- export { default as safeHTML } from './safe-html';
27
- export { default as isSelectionForward } from './is-selection-forward';
28
- //# sourceMappingURL=index.js.map
1
+ import { default as default2 } from "./compute-caret-rect";
2
+ import { default as default3 } from "./document-has-text-selection";
3
+ import { default as default4 } from "./document-has-uncollapsed-selection";
4
+ import { default as default5 } from "./document-has-selection";
5
+ import { default as default6 } from "./get-rectangle-from-range";
6
+ import { default as default7 } from "./get-scroll-container";
7
+ import { default as default8 } from "./get-offset-parent";
8
+ import { default as default9 } from "./is-entirely-selected";
9
+ import { default as default10 } from "./is-form-element";
10
+ import { default as default11 } from "./is-horizontal-edge";
11
+ import { default as default12 } from "./is-number-input";
12
+ import { default as default13 } from "./is-text-field";
13
+ import { default as default14 } from "./is-vertical-edge";
14
+ import { default as default15 } from "./place-caret-at-horizontal-edge";
15
+ import { default as default16 } from "./place-caret-at-vertical-edge";
16
+ import { default as default17 } from "./replace";
17
+ import { default as default18 } from "./remove";
18
+ import { default as default19 } from "./insert-after";
19
+ import { default as default20 } from "./unwrap";
20
+ import { default as default21 } from "./replace-tag";
21
+ import { default as default22 } from "./wrap";
22
+ import { default as default23 } from "./strip-html";
23
+ import { default as default24 } from "./is-empty";
24
+ import { default as default25 } from "./remove-invalid-html";
25
+ import { default as default26 } from "./is-rtl";
26
+ import { default as default27 } from "./safe-html";
27
+ import { default as default28 } from "./is-selection-forward";
28
+ export {
29
+ default23 as __unstableStripHTML,
30
+ default2 as computeCaretRect,
31
+ default5 as documentHasSelection,
32
+ default3 as documentHasTextSelection,
33
+ default4 as documentHasUncollapsedSelection,
34
+ default8 as getOffsetParent,
35
+ default6 as getRectangleFromRange,
36
+ default7 as getScrollContainer,
37
+ default19 as insertAfter,
38
+ default24 as isEmpty,
39
+ default9 as isEntirelySelected,
40
+ default10 as isFormElement,
41
+ default11 as isHorizontalEdge,
42
+ default12 as isNumberInput,
43
+ default26 as isRTL,
44
+ default28 as isSelectionForward,
45
+ default13 as isTextField,
46
+ default14 as isVerticalEdge,
47
+ default15 as placeCaretAtHorizontalEdge,
48
+ default16 as placeCaretAtVerticalEdge,
49
+ default18 as remove,
50
+ default25 as removeInvalidHTML,
51
+ default17 as replace,
52
+ default21 as replaceTag,
53
+ default27 as safeHTML,
54
+ default20 as unwrap,
55
+ default22 as wrap
56
+ };
57
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["default","computeCaretRect","documentHasTextSelection","documentHasUncollapsedSelection","documentHasSelection","getRectangleFromRange","getScrollContainer","getOffsetParent","isEntirelySelected","isFormElement","isHorizontalEdge","isNumberInput","isTextField","isVerticalEdge","placeCaretAtHorizontalEdge","placeCaretAtVerticalEdge","replace","remove","insertAfter","unwrap","replaceTag","wrap","__unstableStripHTML","isEmpty","removeInvalidHTML","isRTL","safeHTML","isSelectionForward"],"sources":["@wordpress/dom/src/dom/index.js"],"sourcesContent":["export { default as computeCaretRect } from './compute-caret-rect';\nexport { default as documentHasTextSelection } from './document-has-text-selection';\nexport { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';\nexport { default as documentHasSelection } from './document-has-selection';\nexport { default as getRectangleFromRange } from './get-rectangle-from-range';\nexport { default as getScrollContainer } from './get-scroll-container';\nexport { default as getOffsetParent } from './get-offset-parent';\nexport { default as isEntirelySelected } from './is-entirely-selected';\nexport { default as isFormElement } from './is-form-element';\nexport { default as isHorizontalEdge } from './is-horizontal-edge';\nexport { default as isNumberInput } from './is-number-input';\nexport { default as isTextField } from './is-text-field';\nexport { default as isVerticalEdge } from './is-vertical-edge';\nexport { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';\nexport { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';\nexport { default as replace } from './replace';\nexport { default as remove } from './remove';\nexport { default as insertAfter } from './insert-after';\nexport { default as unwrap } from './unwrap';\nexport { default as replaceTag } from './replace-tag';\nexport { default as wrap } from './wrap';\nexport { default as __unstableStripHTML } from './strip-html';\nexport { default as isEmpty } from './is-empty';\nexport { default as removeInvalidHTML } from './remove-invalid-html';\nexport { default as isRTL } from './is-rtl';\nexport { default as safeHTML } from './safe-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AAO,IAAIyB,KAAK,QAAQ,UAAU;AAC3C,SAASzB,OAAO,IAAI0B,QAAQ,QAAQ,aAAa;AACjD,SAAS1B,OAAO,IAAI2B,kBAAkB,QAAQ,wBAAwB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/index.js"],
4
+ "sourcesContent": ["export { default as computeCaretRect } from './compute-caret-rect';\nexport { default as documentHasTextSelection } from './document-has-text-selection';\nexport { default as documentHasUncollapsedSelection } from './document-has-uncollapsed-selection';\nexport { default as documentHasSelection } from './document-has-selection';\nexport { default as getRectangleFromRange } from './get-rectangle-from-range';\nexport { default as getScrollContainer } from './get-scroll-container';\nexport { default as getOffsetParent } from './get-offset-parent';\nexport { default as isEntirelySelected } from './is-entirely-selected';\nexport { default as isFormElement } from './is-form-element';\nexport { default as isHorizontalEdge } from './is-horizontal-edge';\nexport { default as isNumberInput } from './is-number-input';\nexport { default as isTextField } from './is-text-field';\nexport { default as isVerticalEdge } from './is-vertical-edge';\nexport { default as placeCaretAtHorizontalEdge } from './place-caret-at-horizontal-edge';\nexport { default as placeCaretAtVerticalEdge } from './place-caret-at-vertical-edge';\nexport { default as replace } from './replace';\nexport { default as remove } from './remove';\nexport { default as insertAfter } from './insert-after';\nexport { default as unwrap } from './unwrap';\nexport { default as replaceTag } from './replace-tag';\nexport { default as wrap } from './wrap';\nexport { default as __unstableStripHTML } from './strip-html';\nexport { default as isEmpty } from './is-empty';\nexport { default as removeInvalidHTML } from './remove-invalid-html';\nexport { default as isRTL } from './is-rtl';\nexport { default as safeHTML } from './safe-html';\nexport { default as isSelectionForward } from './is-selection-forward';\n"],
5
+ "mappings": "AAAA,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAA2C;AACpD,SAAoB,WAAXA,gBAAkD;AAC3D,SAAoB,WAAXA,gBAAuC;AAChD,SAAoB,WAAXA,gBAAwC;AACjD,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAqC;AAC9C,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAAmC;AAC5C,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA6C;AACtD,SAAoB,WAAXA,iBAA2C;AACpD,SAAoB,WAAXA,iBAA0B;AACnC,SAAoB,WAAXA,iBAAyB;AAClC,SAAoB,WAAXA,iBAA8B;AACvC,SAAoB,WAAXA,iBAAyB;AAClC,SAAoB,WAAXA,iBAA6B;AACtC,SAAoB,WAAXA,iBAAuB;AAChC,SAAoB,WAAXA,iBAAsC;AAC/C,SAAoB,WAAXA,iBAA0B;AACnC,SAAoB,WAAXA,iBAAoC;AAC7C,SAAoB,WAAXA,iBAAwB;AACjC,SAAoB,WAAXA,iBAA2B;AACpC,SAAoB,WAAXA,iBAAqC;",
6
+ "names": ["default"]
7
+ }
@@ -1,51 +1,26 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import isTextField from './is-text-field';
5
- import isHTMLInputElement from './is-html-input-element';
6
-
7
- /**
8
- * Check whether the given input field or textarea contains a (uncollapsed)
9
- * selection of text.
10
- *
11
- * CAVEAT: Only specific text-based HTML inputs support the selection APIs
12
- * needed to determine whether they have a collapsed or uncollapsed selection.
13
- * This function defaults to returning `true` when the selection cannot be
14
- * inspected, such as with `<input type="time">`. The rationale is that this
15
- * should cause the block editor to defer to the browser's native selection
16
- * handling (e.g. copying and pasting), thereby reducing friction for the user.
17
- *
18
- * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply
19
- *
20
- * @param {Element} element The HTML element.
21
- *
22
- * @return {boolean} Whether the input/textarea element has some "selection".
23
- */
24
- export default function inputFieldHasUncollapsedSelection(element) {
1
+ import isTextField from "./is-text-field";
2
+ import isHTMLInputElement from "./is-html-input-element";
3
+ function inputFieldHasUncollapsedSelection(element) {
25
4
  if (!isHTMLInputElement(element) && !isTextField(element)) {
26
5
  return false;
27
6
  }
28
-
29
- // Safari throws a type error when trying to get `selectionStart` and
30
- // `selectionEnd` on non-text <input> elements, so a try/catch construct is
31
- // necessary.
32
7
  try {
33
- const {
34
- selectionStart,
35
- selectionEnd
36
- } = /** @type {HTMLInputElement | HTMLTextAreaElement} */element;
8
+ const { selectionStart, selectionEnd } = (
9
+ /** @type {HTMLInputElement | HTMLTextAreaElement} */
10
+ element
11
+ );
37
12
  return (
38
13
  // `null` means the input type doesn't implement selection, thus we
39
14
  // cannot determine whether the selection is collapsed, so we
40
15
  // default to true.
41
- selectionStart === null ||
42
- // when not null, compare the two points
16
+ selectionStart === null || // when not null, compare the two points
43
17
  selectionStart !== selectionEnd
44
18
  );
45
19
  } catch (error) {
46
- // This is Safari's way of saying that the input type doesn't implement
47
- // selection, so we default to true.
48
20
  return true;
49
21
  }
50
22
  }
51
- //# sourceMappingURL=input-field-has-uncollapsed-selection.js.map
23
+ export {
24
+ inputFieldHasUncollapsedSelection as default
25
+ };
26
+ //# sourceMappingURL=input-field-has-uncollapsed-selection.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isTextField","isHTMLInputElement","inputFieldHasUncollapsedSelection","element","selectionStart","selectionEnd","error"],"sources":["@wordpress/dom/src/dom/input-field-has-uncollapsed-selection.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textarea element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,iBAAiB;AACzC,OAAOC,kBAAkB,MAAM,yBAAyB;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,iCAAiCA,CAAEC,OAAO,EAAG;EACpE,IAAK,CAAEF,kBAAkB,CAAEE,OAAQ,CAAC,IAAI,CAAEH,WAAW,CAAEG,OAAQ,CAAC,EAAG;IAClE,OAAO,KAAK;EACb;;EAEA;EACA;EACA;EACA,IAAI;IACH,MAAM;MAAEC,cAAc;MAAEC;IAAa,CAAC,GACrC,qDAAwDF,OAAS;IAClE;MACC;MACA;MACA;MACAC,cAAc,KAAK,IAAI;MACvB;MACAA,cAAc,KAAKC;IAAY;EAEjC,CAAC,CAAC,OAAQC,KAAK,EAAG;IACjB;IACA;IACA,OAAO,IAAI;EACZ;AACD","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/input-field-has-uncollapsed-selection.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\n\n/**\n * Check whether the given input field or textarea contains a (uncollapsed)\n * selection of text.\n *\n * CAVEAT: Only specific text-based HTML inputs support the selection APIs\n * needed to determine whether they have a collapsed or uncollapsed selection.\n * This function defaults to returning `true` when the selection cannot be\n * inspected, such as with `<input type=\"time\">`. The rationale is that this\n * should cause the block editor to defer to the browser's native selection\n * handling (e.g. copying and pasting), thereby reducing friction for the user.\n *\n * See: https://html.spec.whatwg.org/multipage/input.html#do-not-apply\n *\n * @param {Element} element The HTML element.\n *\n * @return {boolean} Whether the input/textarea element has some \"selection\".\n */\nexport default function inputFieldHasUncollapsedSelection( element ) {\n\tif ( ! isHTMLInputElement( element ) && ! isTextField( element ) ) {\n\t\treturn false;\n\t}\n\n\t// Safari throws a type error when trying to get `selectionStart` and\n\t// `selectionEnd` on non-text <input> elements, so a try/catch construct is\n\t// necessary.\n\ttry {\n\t\tconst { selectionStart, selectionEnd } =\n\t\t\t/** @type {HTMLInputElement | HTMLTextAreaElement} */ ( element );\n\t\treturn (\n\t\t\t// `null` means the input type doesn't implement selection, thus we\n\t\t\t// cannot determine whether the selection is collapsed, so we\n\t\t\t// default to true.\n\t\t\tselectionStart === null ||\n\t\t\t// when not null, compare the two points\n\t\t\tselectionStart !== selectionEnd\n\t\t);\n\t} catch ( error ) {\n\t\t// This is Safari's way of saying that the input type doesn't implement\n\t\t// selection, so we default to true.\n\t\treturn true;\n\t}\n}\n"],
5
+ "mappings": "AAGA,OAAO,iBAAiB;AACxB,OAAO,wBAAwB;AAmBhB,SAAR,kCAAoD,SAAU;AACpE,MAAK,CAAE,mBAAoB,OAAQ,KAAK,CAAE,YAAa,OAAQ,GAAI;AAClE,WAAO;AAAA,EACR;AAKA,MAAI;AACH,UAAM,EAAE,gBAAgB,aAAa;AAAA;AAAA,MACoB;AAAA;AACzD;AAAA;AAAA;AAAA;AAAA,MAIC,mBAAmB;AAAA,MAEnB,mBAAmB;AAAA;AAAA,EAErB,SAAU,OAAQ;AAGjB,WAAO;AAAA,EACR;AACD;",
6
+ "names": []
7
+ }
@@ -1,18 +1,9 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Given two DOM nodes, inserts the former in the DOM as the next sibling of
8
- * the latter.
9
- *
10
- * @param {Node} newNode Node to be inserted.
11
- * @param {Node} referenceNode Node after which to perform the insertion.
12
- * @return {void}
13
- */
14
- export default function insertAfter(newNode, referenceNode) {
15
- assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode');
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function insertAfter(newNode, referenceNode) {
3
+ assertIsDefined(referenceNode.parentNode, "referenceNode.parentNode");
16
4
  referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
17
5
  }
18
- //# sourceMappingURL=insert-after.js.map
6
+ export {
7
+ insertAfter as default
8
+ };
9
+ //# sourceMappingURL=insert-after.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","insertAfter","newNode","referenceNode","parentNode","insertBefore","nextSibling"],"sources":["@wordpress/dom/src/dom/insert-after.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param {Node} newNode Node to be inserted.\n * @param {Node} referenceNode Node after which to perform the insertion.\n * @return {void}\n */\nexport default function insertAfter( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,WAAWA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EAC7DH,eAAe,CAAEG,aAAa,CAACC,UAAU,EAAE,0BAA2B,CAAC;EACvED,aAAa,CAACC,UAAU,CAACC,YAAY,CAAEH,OAAO,EAAEC,aAAa,CAACG,WAAY,CAAC;AAC5E","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/insert-after.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given two DOM nodes, inserts the former in the DOM as the next sibling of\n * the latter.\n *\n * @param {Node} newNode Node to be inserted.\n * @param {Node} referenceNode Node after which to perform the insertion.\n * @return {void}\n */\nexport default function insertAfter( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );\n}\n"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAUjB,SAAR,YAA8B,SAAS,eAAgB;AAC7D,kBAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,cAAc,WAAY;AAC3E;",
6
+ "names": []
7
+ }