@wordpress/dom 4.36.1-next.8b30e05b0.0 → 4.36.1-next.8fd3f8831.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 (136) hide show
  1. package/README.md +1 -1
  2. package/build/{data-transfer.js → data-transfer.cjs} +1 -1
  3. package/build/dom/{caret-range-from-point.js → caret-range-from-point.cjs} +1 -1
  4. package/build/dom/{clean-node-list.js → clean-node-list.cjs} +7 -7
  5. package/build/dom/{compute-caret-rect.js → compute-caret-rect.cjs} +3 -3
  6. package/build/dom/{document-has-selection.js → document-has-selection.cjs} +4 -4
  7. package/build/dom/{document-has-text-selection.js → document-has-text-selection.cjs} +2 -2
  8. package/build/dom/{document-has-uncollapsed-selection.js → document-has-uncollapsed-selection.cjs} +3 -3
  9. package/build/dom/{get-computed-style.js → get-computed-style.cjs} +2 -2
  10. package/build/dom/{get-offset-parent.js → get-offset-parent.cjs} +2 -2
  11. package/build/dom/{get-range-height.js → get-range-height.cjs} +1 -1
  12. package/build/dom/{get-rectangle-from-range.js → get-rectangle-from-range.cjs} +2 -2
  13. package/build/dom/get-rectangle-from-range.cjs.map +7 -0
  14. package/build/dom/{get-scroll-container.js → get-scroll-container.cjs} +2 -2
  15. package/build/dom/{hidden-caret-range-from-point.js → hidden-caret-range-from-point.cjs} +3 -3
  16. package/build/dom/{index.js → index.cjs} +28 -28
  17. package/build/dom/{input-field-has-uncollapsed-selection.js → input-field-has-uncollapsed-selection.cjs} +3 -3
  18. package/build/dom/{insert-after.js → insert-after.cjs} +2 -2
  19. package/build/dom/{is-edge.js → is-edge.cjs} +9 -9
  20. package/build/dom/{is-element.js → is-element.cjs} +1 -1
  21. package/build/dom/{is-empty.js → is-empty.cjs} +1 -1
  22. package/build/dom/{is-entirely-selected.js → is-entirely-selected.cjs} +3 -3
  23. package/build/dom/{is-form-element.js → is-form-element.cjs} +2 -2
  24. package/build/dom/{is-horizontal-edge.js → is-horizontal-edge.cjs} +2 -2
  25. package/build/dom/{is-html-input-element.js → is-html-input-element.cjs} +1 -1
  26. package/build/dom/{is-input-or-text-area.js → is-input-or-text-area.cjs} +1 -1
  27. package/build/dom/{is-number-input.js → is-number-input.cjs} +3 -3
  28. package/build/dom/{is-rtl.js → is-rtl.cjs} +2 -2
  29. package/build/dom/{is-selection-forward.js → is-selection-forward.cjs} +2 -2
  30. package/build/dom/{is-text-field.js → is-text-field.cjs} +2 -2
  31. package/build/dom/{is-vertical-edge.js → is-vertical-edge.cjs} +2 -2
  32. package/build/dom/{place-caret-at-edge.js → place-caret-at-edge.cjs} +6 -6
  33. package/build/dom/{place-caret-at-horizontal-edge.js → place-caret-at-horizontal-edge.cjs} +2 -2
  34. package/build/dom/{place-caret-at-vertical-edge.js → place-caret-at-vertical-edge.cjs} +2 -2
  35. package/build/dom/{remove-invalid-html.js → remove-invalid-html.cjs} +2 -2
  36. package/build/dom/{remove.js → remove.cjs} +2 -2
  37. package/build/dom/{replace-tag.js → replace-tag.cjs} +2 -2
  38. package/build/dom/{replace.js → replace.cjs} +4 -4
  39. package/build/dom/{safe-html.js → safe-html.cjs} +2 -2
  40. package/build/dom/{scroll-if-no-range.js → scroll-if-no-range.cjs} +1 -1
  41. package/build/dom/{strip-html.js → strip-html.cjs} +2 -2
  42. package/build/dom/{unwrap.js → unwrap.cjs} +2 -2
  43. package/build/dom/{wrap.js → wrap.cjs} +2 -2
  44. package/build/{focusable.js → focusable.cjs} +1 -1
  45. package/build/{index.js → index.cjs} +9 -9
  46. package/build/{index.js.map → index.cjs.map} +1 -1
  47. package/build/{phrasing-content.js → phrasing-content.cjs} +1 -1
  48. package/build/{tabbable.js → tabbable.cjs} +2 -2
  49. package/build/utils/{assert-is-defined.js → assert-is-defined.cjs} +1 -1
  50. package/build-module/dom/clean-node-list.js +6 -6
  51. package/build-module/dom/compute-caret-rect.js +2 -2
  52. package/build-module/dom/document-has-selection.js +3 -3
  53. package/build-module/dom/document-has-text-selection.js +1 -1
  54. package/build-module/dom/document-has-uncollapsed-selection.js +2 -2
  55. package/build-module/dom/get-computed-style.js +1 -1
  56. package/build-module/dom/get-offset-parent.js +1 -1
  57. package/build-module/dom/get-rectangle-from-range.js +1 -1
  58. package/build-module/dom/get-rectangle-from-range.js.map +2 -2
  59. package/build-module/dom/get-scroll-container.js +1 -1
  60. package/build-module/dom/hidden-caret-range-from-point.js +2 -2
  61. package/build-module/dom/index.js +27 -27
  62. package/build-module/dom/input-field-has-uncollapsed-selection.js +2 -2
  63. package/build-module/dom/insert-after.js +1 -1
  64. package/build-module/dom/is-edge.js +8 -8
  65. package/build-module/dom/is-entirely-selected.js +2 -2
  66. package/build-module/dom/is-form-element.js +1 -1
  67. package/build-module/dom/is-horizontal-edge.js +1 -1
  68. package/build-module/dom/is-number-input.js +1 -1
  69. package/build-module/dom/is-rtl.js +1 -1
  70. package/build-module/dom/is-selection-forward.js +1 -1
  71. package/build-module/dom/is-text-field.js +1 -1
  72. package/build-module/dom/is-vertical-edge.js +1 -1
  73. package/build-module/dom/place-caret-at-edge.js +5 -5
  74. package/build-module/dom/place-caret-at-horizontal-edge.js +1 -1
  75. package/build-module/dom/place-caret-at-vertical-edge.js +1 -1
  76. package/build-module/dom/remove-invalid-html.js +1 -1
  77. package/build-module/dom/remove.js +1 -1
  78. package/build-module/dom/replace-tag.js +1 -1
  79. package/build-module/dom/replace.js +3 -3
  80. package/build-module/dom/safe-html.js +1 -1
  81. package/build-module/dom/strip-html.js +1 -1
  82. package/build-module/dom/unwrap.js +1 -1
  83. package/build-module/dom/wrap.js +1 -1
  84. package/build-module/index.js +5 -5
  85. package/build-module/tabbable.js +1 -1
  86. package/build-types/dom/get-rectangle-from-range.d.ts +2 -1
  87. package/build-types/dom/get-rectangle-from-range.d.ts.map +1 -1
  88. package/package.json +13 -5
  89. package/src/dom/get-rectangle-from-range.js +2 -1
  90. package/build/dom/get-rectangle-from-range.js.map +0 -7
  91. package/tsconfig.json +0 -8
  92. package/tsconfig.tsbuildinfo +0 -1
  93. /package/build/{data-transfer.js.map → data-transfer.cjs.map} +0 -0
  94. /package/build/dom/{caret-range-from-point.js.map → caret-range-from-point.cjs.map} +0 -0
  95. /package/build/dom/{clean-node-list.js.map → clean-node-list.cjs.map} +0 -0
  96. /package/build/dom/{compute-caret-rect.js.map → compute-caret-rect.cjs.map} +0 -0
  97. /package/build/dom/{document-has-selection.js.map → document-has-selection.cjs.map} +0 -0
  98. /package/build/dom/{document-has-text-selection.js.map → document-has-text-selection.cjs.map} +0 -0
  99. /package/build/dom/{document-has-uncollapsed-selection.js.map → document-has-uncollapsed-selection.cjs.map} +0 -0
  100. /package/build/dom/{get-computed-style.js.map → get-computed-style.cjs.map} +0 -0
  101. /package/build/dom/{get-offset-parent.js.map → get-offset-parent.cjs.map} +0 -0
  102. /package/build/dom/{get-range-height.js.map → get-range-height.cjs.map} +0 -0
  103. /package/build/dom/{get-scroll-container.js.map → get-scroll-container.cjs.map} +0 -0
  104. /package/build/dom/{hidden-caret-range-from-point.js.map → hidden-caret-range-from-point.cjs.map} +0 -0
  105. /package/build/dom/{index.js.map → index.cjs.map} +0 -0
  106. /package/build/dom/{input-field-has-uncollapsed-selection.js.map → input-field-has-uncollapsed-selection.cjs.map} +0 -0
  107. /package/build/dom/{insert-after.js.map → insert-after.cjs.map} +0 -0
  108. /package/build/dom/{is-edge.js.map → is-edge.cjs.map} +0 -0
  109. /package/build/dom/{is-element.js.map → is-element.cjs.map} +0 -0
  110. /package/build/dom/{is-empty.js.map → is-empty.cjs.map} +0 -0
  111. /package/build/dom/{is-entirely-selected.js.map → is-entirely-selected.cjs.map} +0 -0
  112. /package/build/dom/{is-form-element.js.map → is-form-element.cjs.map} +0 -0
  113. /package/build/dom/{is-horizontal-edge.js.map → is-horizontal-edge.cjs.map} +0 -0
  114. /package/build/dom/{is-html-input-element.js.map → is-html-input-element.cjs.map} +0 -0
  115. /package/build/dom/{is-input-or-text-area.js.map → is-input-or-text-area.cjs.map} +0 -0
  116. /package/build/dom/{is-number-input.js.map → is-number-input.cjs.map} +0 -0
  117. /package/build/dom/{is-rtl.js.map → is-rtl.cjs.map} +0 -0
  118. /package/build/dom/{is-selection-forward.js.map → is-selection-forward.cjs.map} +0 -0
  119. /package/build/dom/{is-text-field.js.map → is-text-field.cjs.map} +0 -0
  120. /package/build/dom/{is-vertical-edge.js.map → is-vertical-edge.cjs.map} +0 -0
  121. /package/build/dom/{place-caret-at-edge.js.map → place-caret-at-edge.cjs.map} +0 -0
  122. /package/build/dom/{place-caret-at-horizontal-edge.js.map → place-caret-at-horizontal-edge.cjs.map} +0 -0
  123. /package/build/dom/{place-caret-at-vertical-edge.js.map → place-caret-at-vertical-edge.cjs.map} +0 -0
  124. /package/build/dom/{remove-invalid-html.js.map → remove-invalid-html.cjs.map} +0 -0
  125. /package/build/dom/{remove.js.map → remove.cjs.map} +0 -0
  126. /package/build/dom/{replace-tag.js.map → replace-tag.cjs.map} +0 -0
  127. /package/build/dom/{replace.js.map → replace.cjs.map} +0 -0
  128. /package/build/dom/{safe-html.js.map → safe-html.cjs.map} +0 -0
  129. /package/build/dom/{scroll-if-no-range.js.map → scroll-if-no-range.cjs.map} +0 -0
  130. /package/build/dom/{strip-html.js.map → strip-html.cjs.map} +0 -0
  131. /package/build/dom/{unwrap.js.map → unwrap.cjs.map} +0 -0
  132. /package/build/dom/{wrap.js.map → wrap.cjs.map} +0 -0
  133. /package/build/{focusable.js.map → focusable.cjs.map} +0 -0
  134. /package/build/{phrasing-content.js.map → phrasing-content.cjs.map} +0 -0
  135. /package/build/{tabbable.js.map → tabbable.cjs.map} +0 -0
  136. /package/build/utils/{assert-is-defined.js.map → assert-is-defined.cjs.map} +0 -0
@@ -33,7 +33,7 @@ __export(safe_html_exports, {
33
33
  default: () => safeHTML
34
34
  });
35
35
  module.exports = __toCommonJS(safe_html_exports);
36
- var import_remove = __toESM(require("./remove"));
36
+ var import_remove = __toESM(require("./remove.cjs"), 1);
37
37
  function safeHTML(html) {
38
38
  const { body } = document.implementation.createHTMLDocument("");
39
39
  body.innerHTML = html;
@@ -55,4 +55,4 @@ function safeHTML(html) {
55
55
  }
56
56
  return body.innerHTML;
57
57
  }
58
- //# sourceMappingURL=safe-html.js.map
58
+ //# sourceMappingURL=safe-html.cjs.map
@@ -38,4 +38,4 @@ function scrollIfNoRange(container, alignToTop, callback) {
38
38
  0 && (module.exports = {
39
39
  scrollIfNoRange
40
40
  });
41
- //# sourceMappingURL=scroll-if-no-range.js.map
41
+ //# sourceMappingURL=scroll-if-no-range.cjs.map
@@ -33,11 +33,11 @@ __export(strip_html_exports, {
33
33
  default: () => stripHTML
34
34
  });
35
35
  module.exports = __toCommonJS(strip_html_exports);
36
- var import_safe_html = __toESM(require("./safe-html"));
36
+ var import_safe_html = __toESM(require("./safe-html.cjs"), 1);
37
37
  function stripHTML(html) {
38
38
  html = (0, import_safe_html.default)(html);
39
39
  const doc = document.implementation.createHTMLDocument("");
40
40
  doc.body.innerHTML = html;
41
41
  return doc.body.textContent || "";
42
42
  }
43
- //# sourceMappingURL=strip-html.js.map
43
+ //# sourceMappingURL=strip-html.cjs.map
@@ -23,7 +23,7 @@ __export(unwrap_exports, {
23
23
  default: () => unwrap
24
24
  });
25
25
  module.exports = __toCommonJS(unwrap_exports);
26
- var import_assert_is_defined = require("../utils/assert-is-defined");
26
+ var import_assert_is_defined = require("../utils/assert-is-defined.cjs");
27
27
  function unwrap(node) {
28
28
  const parent = node.parentNode;
29
29
  (0, import_assert_is_defined.assertIsDefined)(parent, "node.parentNode");
@@ -32,4 +32,4 @@ function unwrap(node) {
32
32
  }
33
33
  parent.removeChild(node);
34
34
  }
35
- //# sourceMappingURL=unwrap.js.map
35
+ //# sourceMappingURL=unwrap.cjs.map
@@ -23,10 +23,10 @@ __export(wrap_exports, {
23
23
  default: () => wrap
24
24
  });
25
25
  module.exports = __toCommonJS(wrap_exports);
26
- var import_assert_is_defined = require("../utils/assert-is-defined");
26
+ var import_assert_is_defined = require("../utils/assert-is-defined.cjs");
27
27
  function wrap(newNode, referenceNode) {
28
28
  (0, import_assert_is_defined.assertIsDefined)(referenceNode.parentNode, "referenceNode.parentNode");
29
29
  referenceNode.parentNode.insertBefore(newNode, referenceNode);
30
30
  newNode.appendChild(referenceNode);
31
31
  }
32
- //# sourceMappingURL=wrap.js.map
32
+ //# sourceMappingURL=wrap.cjs.map
@@ -72,4 +72,4 @@ function find(context, { sequential = false } = {}) {
72
72
  0 && (module.exports = {
73
73
  find
74
74
  });
75
- //# sourceMappingURL=focusable.js.map
75
+ //# sourceMappingURL=focusable.cjs.map
@@ -34,17 +34,17 @@ __export(index_exports, {
34
34
  focus: () => focus
35
35
  });
36
36
  module.exports = __toCommonJS(index_exports);
37
- var focusable = __toESM(require("./focusable"));
38
- var tabbable = __toESM(require("./tabbable"));
39
- __reExport(index_exports, require("./dom"), module.exports);
40
- __reExport(index_exports, require("./phrasing-content"), module.exports);
41
- __reExport(index_exports, require("./data-transfer"), module.exports);
37
+ var focusable = __toESM(require("./focusable.cjs"), 1);
38
+ var tabbable = __toESM(require("./tabbable.cjs"), 1);
39
+ __reExport(index_exports, require("./dom/index.cjs"), module.exports);
40
+ __reExport(index_exports, require("./phrasing-content.cjs"), module.exports);
41
+ __reExport(index_exports, require("./data-transfer.cjs"), module.exports);
42
42
  var focus = { focusable, tabbable };
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
45
  focus,
46
- ...require("./dom"),
47
- ...require("./phrasing-content"),
48
- ...require("./data-transfer")
46
+ ...require("./dom/index.cjs"),
47
+ ...require("./phrasing-content.cjs"),
48
+ ...require("./data-transfer.cjs")
49
49
  });
50
- //# sourceMappingURL=index.js.map
50
+ //# sourceMappingURL=index.cjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.js"],
4
4
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA2B;AAC3B,eAA0B;AAQ1B,0BAAc,kBAZd;AAaA,0BAAc,+BAbd;AAcA,0BAAc,4BAdd;AAUO,IAAM,QAAQ,EAAE,WAAW,SAAS;",
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAA2B;AAC3B,eAA0B;AAQ1B,0BAAc,4BAZd;AAaA,0BAAc,mCAbd;AAcA,0BAAc,gCAdd;AAUO,IAAM,QAAQ,EAAE,WAAW,SAAS;",
6
6
  "names": []
7
7
  }
@@ -166,4 +166,4 @@ function isTextContent(node) {
166
166
  isPhrasingContent,
167
167
  isTextContent
168
168
  });
169
- //# sourceMappingURL=phrasing-content.js.map
169
+ //# sourceMappingURL=phrasing-content.cjs.map
@@ -26,7 +26,7 @@ __export(tabbable_exports, {
26
26
  isTabbableIndex: () => isTabbableIndex
27
27
  });
28
28
  module.exports = __toCommonJS(tabbable_exports);
29
- var import_focusable = require("./focusable");
29
+ var import_focusable = require("./focusable.cjs");
30
30
  function getTabIndex(element) {
31
31
  const tabIndex = element.getAttribute("tabindex");
32
32
  return tabIndex === null ? 0 : parseInt(tabIndex, 10);
@@ -97,4 +97,4 @@ function findNext(element) {
97
97
  findPrevious,
98
98
  isTabbableIndex
99
99
  });
100
- //# sourceMappingURL=tabbable.js.map
100
+ //# sourceMappingURL=tabbable.cjs.map
@@ -34,4 +34,4 @@ function assertIsDefined(val, name) {
34
34
  0 && (module.exports = {
35
35
  assertIsDefined
36
36
  });
37
- //# sourceMappingURL=assert-is-defined.js.map
37
+ //# sourceMappingURL=assert-is-defined.cjs.map
@@ -1,10 +1,10 @@
1
1
  // packages/dom/src/dom/clean-node-list.js
2
- import isEmpty from "./is-empty";
3
- import remove from "./remove";
4
- import unwrap from "./unwrap";
5
- import { isPhrasingContent } from "../phrasing-content";
6
- import insertAfter from "./insert-after";
7
- import isElement from "./is-element";
2
+ import isEmpty from "./is-empty.js";
3
+ import remove from "./remove.js";
4
+ import unwrap from "./unwrap.js";
5
+ import { isPhrasingContent } from "../phrasing-content.js";
6
+ import insertAfter from "./insert-after.js";
7
+ import isElement from "./is-element.js";
8
8
  var noop = () => {
9
9
  };
10
10
  function cleanNodeList(nodeList, doc, schema, inline) {
@@ -1,6 +1,6 @@
1
1
  // packages/dom/src/dom/compute-caret-rect.js
2
- import getRectangleFromRange from "./get-rectangle-from-range";
3
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import getRectangleFromRange from "./get-rectangle-from-range.js";
3
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
4
4
  function computeCaretRect(win) {
5
5
  const selection = win.getSelection();
6
6
  assertIsDefined(selection, "selection");
@@ -1,7 +1,7 @@
1
1
  // packages/dom/src/dom/document-has-selection.js
2
- import isTextField from "./is-text-field";
3
- import isHTMLInputElement from "./is-html-input-element";
4
- import documentHasTextSelection from "./document-has-text-selection";
2
+ import isTextField from "./is-text-field.js";
3
+ import isHTMLInputElement from "./is-html-input-element.js";
4
+ import documentHasTextSelection from "./document-has-text-selection.js";
5
5
  function documentHasSelection(doc) {
6
6
  return !!doc.activeElement && (isHTMLInputElement(doc.activeElement) || isTextField(doc.activeElement) || documentHasTextSelection(doc));
7
7
  }
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/document-has-text-selection.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function documentHasTextSelection(doc) {
4
4
  assertIsDefined(doc.defaultView, "doc.defaultView");
5
5
  const selection = doc.defaultView.getSelection();
@@ -1,6 +1,6 @@
1
1
  // packages/dom/src/dom/document-has-uncollapsed-selection.js
2
- import documentHasTextSelection from "./document-has-text-selection";
3
- import inputFieldHasUncollapsedSelection from "./input-field-has-uncollapsed-selection";
2
+ import documentHasTextSelection from "./document-has-text-selection.js";
3
+ import inputFieldHasUncollapsedSelection from "./input-field-has-uncollapsed-selection.js";
4
4
  function documentHasUncollapsedSelection(doc) {
5
5
  return documentHasTextSelection(doc) || !!doc.activeElement && inputFieldHasUncollapsedSelection(doc.activeElement);
6
6
  }
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/get-computed-style.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function getComputedStyle(element) {
4
4
  assertIsDefined(
5
5
  element.ownerDocument.defaultView,
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/get-offset-parent.js
2
- import getComputedStyle from "./get-computed-style";
2
+ import getComputedStyle from "./get-computed-style.js";
3
3
  function getOffsetParent(node) {
4
4
  let closestElement;
5
5
  while (closestElement = /** @type {Node} */
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/get-rectangle-from-range.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function getRectangleFromRange(range) {
4
4
  if (!range.collapsed) {
5
5
  const rects2 = Array.from(range.getClientRects());
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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,CAAE,EAAE,MAAM,MAAO,QAAQ,CAAE;AAG/D,QAAK,cAAc,WAAW,GAAI;AACjC,aAAO,MAAM,sBAAsB;AAAA,IACpC;AAEA,QAAK,cAAc,WAAW,GAAI;AACjC,aAAO,cAAe,CAAE;AAAA,IACzB;AAEA,QAAI;AAAA,MACH,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACR,IAAI,cAAe,CAAE;AAErB,eAAY,EAAE,KAAK,QAAQ,MAAM,MAAM,KAAK,eAAgB;AAC3D,UAAK,MAAM,aAAc;AACxB,sBAAc;AAAA,MACf;AACA,UAAK,SAAS,gBAAiB;AAC9B,yBAAiB;AAAA,MAClB;AACA,UAAK,OAAO,cAAe;AAC1B,uBAAe;AAAA,MAChB;AACA,UAAK,QAAQ,eAAgB;AAC5B,wBAAgB;AAAA,MACjB;AAAA,IACD;AAEA,WAAO,IAAI,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,IAClB;AAAA,EACD;AAEA,QAAM,EAAE,eAAe,IAAI;AAC3B,QAAM,EAAE,cAAc,IAAI;AAG1B,MAAK,eAAe,aAAa,MAAO;AACvC,UAAM,EAAE,WAAW,IAAI;AACvB,oBAAiB,YAAY,YAAa;AAC1C,UAAM;AAAA;AAAA,MACL,MAAM,KAAM,WAAW,UAAW,EACjC,QAAS,cAAe;AAAA;AAE1B,oBAAiB,eAAe,eAAgB;AAChD,YAAQ,cAAc,YAAY;AAClC,UAAM,SAAU,YAAY,KAAM;AAClC,UAAM,OAAQ,YAAY,KAAM;AAAA,EACjC;AAEA,QAAM,QAAQ,MAAM,eAAe;AAInC,MAAK,MAAM,SAAS,GAAI;AACvB,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,MAAO,CAAE;AAOpB,MAAK,CAAE,QAAQ,KAAK,WAAW,GAAI;AAClC,oBAAiB,eAAe,eAAgB;AAChD,UAAM,UAAU,cAAc,eAAgB,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;",
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. Use instead of `Range.getBoundingClientRect()`, which is often\n * broken, especially for collapsed ranges.\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;AAWjB,SAAR,sBAAwC,OAAQ;AAItD,MAAK,CAAE,MAAM,WAAY;AACxB,UAAMA,SAAQ,MAAM,KAAM,MAAM,eAAe,CAAE;AAGjD,QAAKA,OAAM,WAAW,GAAI;AACzB,aAAOA,OAAO,CAAE;AAAA,IACjB;AAGA,UAAM,gBAAgBA,OAAM,OAAQ,CAAE,EAAE,MAAM,MAAO,QAAQ,CAAE;AAG/D,QAAK,cAAc,WAAW,GAAI;AACjC,aAAO,MAAM,sBAAsB;AAAA,IACpC;AAEA,QAAK,cAAc,WAAW,GAAI;AACjC,aAAO,cAAe,CAAE;AAAA,IACzB;AAEA,QAAI;AAAA,MACH,KAAK;AAAA,MACL,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,IACR,IAAI,cAAe,CAAE;AAErB,eAAY,EAAE,KAAK,QAAQ,MAAM,MAAM,KAAK,eAAgB;AAC3D,UAAK,MAAM,aAAc;AACxB,sBAAc;AAAA,MACf;AACA,UAAK,SAAS,gBAAiB;AAC9B,yBAAiB;AAAA,MAClB;AACA,UAAK,OAAO,cAAe;AAC1B,uBAAe;AAAA,MAChB;AACA,UAAK,QAAQ,eAAgB;AAC5B,wBAAgB;AAAA,MACjB;AAAA,IACD;AAEA,WAAO,IAAI,OAAO;AAAA,MACjB;AAAA,MACA;AAAA,MACA,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,IAClB;AAAA,EACD;AAEA,QAAM,EAAE,eAAe,IAAI;AAC3B,QAAM,EAAE,cAAc,IAAI;AAG1B,MAAK,eAAe,aAAa,MAAO;AACvC,UAAM,EAAE,WAAW,IAAI;AACvB,oBAAiB,YAAY,YAAa;AAC1C,UAAM;AAAA;AAAA,MACL,MAAM,KAAM,WAAW,UAAW,EACjC,QAAS,cAAe;AAAA;AAE1B,oBAAiB,eAAe,eAAgB;AAChD,YAAQ,cAAc,YAAY;AAClC,UAAM,SAAU,YAAY,KAAM;AAClC,UAAM,OAAQ,YAAY,KAAM;AAAA,EACjC;AAEA,QAAM,QAAQ,MAAM,eAAe;AAInC,MAAK,MAAM,SAAS,GAAI;AACvB,WAAO;AAAA,EACR;AAEA,MAAI,OAAO,MAAO,CAAE;AAOpB,MAAK,CAAE,QAAQ,KAAK,WAAW,GAAI;AAClC,oBAAiB,eAAe,eAAgB;AAChD,UAAM,UAAU,cAAc,eAAgB,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
6
  "names": ["rects"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/get-scroll-container.js
2
- import getComputedStyle from "./get-computed-style";
2
+ import getComputedStyle from "./get-computed-style.js";
3
3
  function getScrollContainer(node, direction = "vertical") {
4
4
  if (!node) {
5
5
  return void 0;
@@ -1,6 +1,6 @@
1
1
  // packages/dom/src/dom/hidden-caret-range-from-point.js
2
- import caretRangeFromPoint from "./caret-range-from-point";
3
- import getComputedStyle from "./get-computed-style";
2
+ import caretRangeFromPoint from "./caret-range-from-point.js";
3
+ import getComputedStyle from "./get-computed-style.js";
4
4
  function hiddenCaretRangeFromPoint(doc, x, y, container) {
5
5
  const originalZIndex = container.style.zIndex;
6
6
  const originalPosition = container.style.position;
@@ -1,31 +1,31 @@
1
1
  // packages/dom/src/dom/index.js
2
- import { default as default2 } from "./compute-caret-rect";
3
- import { default as default3 } from "./document-has-text-selection";
4
- import { default as default4 } from "./document-has-uncollapsed-selection";
5
- import { default as default5 } from "./document-has-selection";
6
- import { default as default6 } from "./get-rectangle-from-range";
7
- import { default as default7 } from "./get-scroll-container";
8
- import { default as default8 } from "./get-offset-parent";
9
- import { default as default9 } from "./is-entirely-selected";
10
- import { default as default10 } from "./is-form-element";
11
- import { default as default11 } from "./is-horizontal-edge";
12
- import { default as default12 } from "./is-number-input";
13
- import { default as default13 } from "./is-text-field";
14
- import { default as default14 } from "./is-vertical-edge";
15
- import { default as default15 } from "./place-caret-at-horizontal-edge";
16
- import { default as default16 } from "./place-caret-at-vertical-edge";
17
- import { default as default17 } from "./replace";
18
- import { default as default18 } from "./remove";
19
- import { default as default19 } from "./insert-after";
20
- import { default as default20 } from "./unwrap";
21
- import { default as default21 } from "./replace-tag";
22
- import { default as default22 } from "./wrap";
23
- import { default as default23 } from "./strip-html";
24
- import { default as default24 } from "./is-empty";
25
- import { default as default25 } from "./remove-invalid-html";
26
- import { default as default26 } from "./is-rtl";
27
- import { default as default27 } from "./safe-html";
28
- import { default as default28 } from "./is-selection-forward";
2
+ import { default as default2 } from "./compute-caret-rect.js";
3
+ import { default as default3 } from "./document-has-text-selection.js";
4
+ import { default as default4 } from "./document-has-uncollapsed-selection.js";
5
+ import { default as default5 } from "./document-has-selection.js";
6
+ import { default as default6 } from "./get-rectangle-from-range.js";
7
+ import { default as default7 } from "./get-scroll-container.js";
8
+ import { default as default8 } from "./get-offset-parent.js";
9
+ import { default as default9 } from "./is-entirely-selected.js";
10
+ import { default as default10 } from "./is-form-element.js";
11
+ import { default as default11 } from "./is-horizontal-edge.js";
12
+ import { default as default12 } from "./is-number-input.js";
13
+ import { default as default13 } from "./is-text-field.js";
14
+ import { default as default14 } from "./is-vertical-edge.js";
15
+ import { default as default15 } from "./place-caret-at-horizontal-edge.js";
16
+ import { default as default16 } from "./place-caret-at-vertical-edge.js";
17
+ import { default as default17 } from "./replace.js";
18
+ import { default as default18 } from "./remove.js";
19
+ import { default as default19 } from "./insert-after.js";
20
+ import { default as default20 } from "./unwrap.js";
21
+ import { default as default21 } from "./replace-tag.js";
22
+ import { default as default22 } from "./wrap.js";
23
+ import { default as default23 } from "./strip-html.js";
24
+ import { default as default24 } from "./is-empty.js";
25
+ import { default as default25 } from "./remove-invalid-html.js";
26
+ import { default as default26 } from "./is-rtl.js";
27
+ import { default as default27 } from "./safe-html.js";
28
+ import { default as default28 } from "./is-selection-forward.js";
29
29
  export {
30
30
  default23 as __unstableStripHTML,
31
31
  default2 as computeCaretRect,
@@ -1,6 +1,6 @@
1
1
  // packages/dom/src/dom/input-field-has-uncollapsed-selection.js
2
- import isTextField from "./is-text-field";
3
- import isHTMLInputElement from "./is-html-input-element";
2
+ import isTextField from "./is-text-field.js";
3
+ import isHTMLInputElement from "./is-html-input-element.js";
4
4
  function inputFieldHasUncollapsedSelection(element) {
5
5
  if (!isHTMLInputElement(element) && !isTextField(element)) {
6
6
  return false;
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/insert-after.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function insertAfter(newNode, referenceNode) {
4
4
  assertIsDefined(referenceNode.parentNode, "referenceNode.parentNode");
5
5
  referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
@@ -1,12 +1,12 @@
1
1
  // packages/dom/src/dom/is-edge.js
2
- import isRTL from "./is-rtl";
3
- import getRangeHeight from "./get-range-height";
4
- import getRectangleFromRange from "./get-rectangle-from-range";
5
- import isSelectionForward from "./is-selection-forward";
6
- import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point";
7
- import { assertIsDefined } from "../utils/assert-is-defined";
8
- import isInputOrTextArea from "./is-input-or-text-area";
9
- import { scrollIfNoRange } from "./scroll-if-no-range";
2
+ import isRTL from "./is-rtl.js";
3
+ import getRangeHeight from "./get-range-height.js";
4
+ import getRectangleFromRange from "./get-rectangle-from-range.js";
5
+ import isSelectionForward from "./is-selection-forward.js";
6
+ import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point.js";
7
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
8
+ import isInputOrTextArea from "./is-input-or-text-area.js";
9
+ import { scrollIfNoRange } from "./scroll-if-no-range.js";
10
10
  function isEdge(container, isReverse, onlyVertical = false) {
11
11
  if (isInputOrTextArea(container) && typeof container.selectionStart === "number") {
12
12
  if (container.selectionStart !== container.selectionEnd) {
@@ -1,6 +1,6 @@
1
1
  // packages/dom/src/dom/is-entirely-selected.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
3
- import isInputOrTextArea from "./is-input-or-text-area";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
+ import isInputOrTextArea from "./is-input-or-text-area.js";
4
4
  function isEntirelySelected(element) {
5
5
  if (isInputOrTextArea(element)) {
6
6
  return element.selectionStart === 0 && element.value.length === element.selectionEnd;
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/is-form-element.js
2
- import isInputOrTextArea from "./is-input-or-text-area";
2
+ import isInputOrTextArea from "./is-input-or-text-area.js";
3
3
  function isFormElement(element) {
4
4
  if (!element) {
5
5
  return false;
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/is-horizontal-edge.js
2
- import isEdge from "./is-edge";
2
+ import isEdge from "./is-edge.js";
3
3
  function isHorizontalEdge(container, isReverse) {
4
4
  return isEdge(container, isReverse);
5
5
  }
@@ -1,6 +1,6 @@
1
1
  // packages/dom/src/dom/is-number-input.js
2
2
  import deprecated from "@wordpress/deprecated";
3
- import isHTMLInputElement from "./is-html-input-element";
3
+ import isHTMLInputElement from "./is-html-input-element.js";
4
4
  function isNumberInput(node) {
5
5
  deprecated("wp.dom.isNumberInput", {
6
6
  since: "6.1",
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/is-rtl.js
2
- import getComputedStyle from "./get-computed-style";
2
+ import getComputedStyle from "./get-computed-style.js";
3
3
  function isRTL(element) {
4
4
  return getComputedStyle(element).direction === "rtl";
5
5
  }
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/is-selection-forward.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function isSelectionForward(selection) {
4
4
  const { anchorNode, focusNode, anchorOffset, focusOffset } = selection;
5
5
  assertIsDefined(anchorNode, "anchorNode");
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/is-text-field.js
2
- import isHTMLInputElement from "./is-html-input-element";
2
+ import isHTMLInputElement from "./is-html-input-element.js";
3
3
  function isTextField(node) {
4
4
  const nonTextInputs = [
5
5
  "button",
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/is-vertical-edge.js
2
- import isEdge from "./is-edge";
2
+ import isEdge from "./is-edge.js";
3
3
  function isVerticalEdge(container, isReverse) {
4
4
  return isEdge(container, isReverse, true);
5
5
  }
@@ -1,9 +1,9 @@
1
1
  // packages/dom/src/dom/place-caret-at-edge.js
2
- import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point";
3
- import { assertIsDefined } from "../utils/assert-is-defined";
4
- import isInputOrTextArea from "./is-input-or-text-area";
5
- import isRTL from "./is-rtl";
6
- import { scrollIfNoRange } from "./scroll-if-no-range";
2
+ import hiddenCaretRangeFromPoint from "./hidden-caret-range-from-point.js";
3
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
4
+ import isInputOrTextArea from "./is-input-or-text-area.js";
5
+ import isRTL from "./is-rtl.js";
6
+ import { scrollIfNoRange } from "./scroll-if-no-range.js";
7
7
  function getRange(container, isReverse, x) {
8
8
  const { ownerDocument } = container;
9
9
  const isReverseDir = isRTL(container) ? !isReverse : isReverse;
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/place-caret-at-horizontal-edge.js
2
- import placeCaretAtEdge from "./place-caret-at-edge";
2
+ import placeCaretAtEdge from "./place-caret-at-edge.js";
3
3
  function placeCaretAtHorizontalEdge(container, isReverse) {
4
4
  return placeCaretAtEdge(container, isReverse, void 0);
5
5
  }
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/place-caret-at-vertical-edge.js
2
- import placeCaretAtEdge from "./place-caret-at-edge";
2
+ import placeCaretAtEdge from "./place-caret-at-edge.js";
3
3
  function placeCaretAtVerticalEdge(container, isReverse, rect) {
4
4
  return placeCaretAtEdge(container, isReverse, rect?.left);
5
5
  }
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/remove-invalid-html.js
2
- import cleanNodeList from "./clean-node-list";
2
+ import cleanNodeList from "./clean-node-list.js";
3
3
  function removeInvalidHTML(HTML, schema, inline) {
4
4
  const doc = document.implementation.createHTMLDocument("");
5
5
  doc.body.innerHTML = HTML;
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/remove.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function remove(node) {
4
4
  assertIsDefined(node.parentNode, "node.parentNode");
5
5
  node.parentNode.removeChild(node);
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/replace-tag.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function replaceTag(node, tagName) {
4
4
  const newNode = node.ownerDocument.createElement(tagName);
5
5
  while (node.firstChild) {
@@ -1,7 +1,7 @@
1
1
  // packages/dom/src/dom/replace.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
3
- import insertAfter from "./insert-after";
4
- import remove from "./remove";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
+ import insertAfter from "./insert-after.js";
4
+ import remove from "./remove.js";
5
5
  function replace(processedNode, newNode) {
6
6
  assertIsDefined(processedNode.parentNode, "processedNode.parentNode");
7
7
  insertAfter(newNode, processedNode.parentNode);
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/safe-html.js
2
- import remove from "./remove";
2
+ import remove from "./remove.js";
3
3
  function safeHTML(html) {
4
4
  const { body } = document.implementation.createHTMLDocument("");
5
5
  body.innerHTML = html;
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/strip-html.js
2
- import safeHTML from "./safe-html";
2
+ import safeHTML from "./safe-html.js";
3
3
  function stripHTML(html) {
4
4
  html = safeHTML(html);
5
5
  const doc = document.implementation.createHTMLDocument("");
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/unwrap.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function unwrap(node) {
4
4
  const parent = node.parentNode;
5
5
  assertIsDefined(parent, "node.parentNode");
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/dom/wrap.js
2
- import { assertIsDefined } from "../utils/assert-is-defined";
2
+ import { assertIsDefined } from "../utils/assert-is-defined.js";
3
3
  function wrap(newNode, referenceNode) {
4
4
  assertIsDefined(referenceNode.parentNode, "referenceNode.parentNode");
5
5
  referenceNode.parentNode.insertBefore(newNode, referenceNode);
@@ -1,9 +1,9 @@
1
1
  // packages/dom/src/index.js
2
- import * as focusable from "./focusable";
3
- import * as tabbable from "./tabbable";
4
- export * from "./dom";
5
- export * from "./phrasing-content";
6
- export * from "./data-transfer";
2
+ import * as focusable from "./focusable.js";
3
+ import * as tabbable from "./tabbable.js";
4
+ export * from "./dom/index.js";
5
+ export * from "./phrasing-content.js";
6
+ export * from "./data-transfer.js";
7
7
  var focus = { focusable, tabbable };
8
8
  export {
9
9
  focus
@@ -1,5 +1,5 @@
1
1
  // packages/dom/src/tabbable.js
2
- import { find as findFocusable } from "./focusable";
2
+ import { find as findFocusable } from "./focusable.js";
3
3
  function getTabIndex(element) {
4
4
  const tabIndex = element.getAttribute("tabindex");
5
5
  return tabIndex === null ? 0 : parseInt(tabIndex, 10);
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Get the rectangle of a given Range. Returns `null` if no suitable rectangle
3
- * can be found.
3
+ * can be found. Use instead of `Range.getBoundingClientRect()`, which is often
4
+ * broken, especially for collapsed ranges.
4
5
  *
5
6
  * @param {Range} range The range.
6
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"get-rectangle-from-range.d.ts","sourceRoot":"","sources":["../../src/dom/get-rectangle-from-range.js"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,qDAJW,KAAK,GAEJ,OAAO,OAAC,CAoGnB"}
1
+ {"version":3,"file":"get-rectangle-from-range.d.ts","sourceRoot":"","sources":["../../src/dom/get-rectangle-from-range.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,qDAJW,KAAK,GAEJ,OAAO,OAAC,CAoGnB"}