@wordpress/dom 5.0.0 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +1 -1
  2. package/build/data-transfer.cjs +20 -38
  3. package/build/data-transfer.cjs.map +1 -7
  4. package/build/dom/caret-range-from-point.cjs +31 -38
  5. package/build/dom/caret-range-from-point.cjs.map +1 -7
  6. package/build/dom/clean-node-list.cjs +87 -132
  7. package/build/dom/clean-node-list.cjs.map +1 -7
  8. package/build/dom/compute-caret-rect.cjs +35 -35
  9. package/build/dom/compute-caret-rect.cjs.map +1 -7
  10. package/build/dom/document-has-selection.cjs +35 -30
  11. package/build/dom/document-has-selection.cjs.map +1 -7
  12. package/build/dom/document-has-text-selection.cjs +24 -30
  13. package/build/dom/document-has-text-selection.cjs.map +1 -7
  14. package/build/dom/document-has-uncollapsed-selection.cjs +34 -29
  15. package/build/dom/document-has-uncollapsed-selection.cjs.map +1 -7
  16. package/build/dom/get-computed-style.cjs +14 -30
  17. package/build/dom/get-computed-style.cjs.map +1 -7
  18. package/build/dom/get-offset-parent.cjs +40 -39
  19. package/build/dom/get-offset-parent.cjs.map +1 -7
  20. package/build/dom/get-range-height.cjs +18 -31
  21. package/build/dom/get-range-height.cjs.map +1 -7
  22. package/build/dom/get-rectangle-from-range.cjs +82 -128
  23. package/build/dom/get-rectangle-from-range.cjs.map +1 -7
  24. package/build/dom/get-scroll-container.cjs +46 -50
  25. package/build/dom/get-scroll-container.cjs.map +1 -7
  26. package/build/dom/hidden-caret-range-from-point.cjs +48 -42
  27. package/build/dom/hidden-caret-range-from-point.cjs.map +1 -7
  28. package/build/dom/index.cjs +233 -110
  29. package/build/dom/input-field-has-uncollapsed-selection.cjs +48 -43
  30. package/build/dom/input-field-has-uncollapsed-selection.cjs.map +1 -7
  31. package/build/dom/insert-after.cjs +17 -27
  32. package/build/dom/insert-after.cjs.map +1 -7
  33. package/build/dom/is-edge.cjs +82 -97
  34. package/build/dom/is-edge.cjs.map +1 -7
  35. package/build/dom/is-element.cjs +12 -25
  36. package/build/dom/is-element.cjs.map +1 -7
  37. package/build/dom/is-empty.cjs +23 -37
  38. package/build/dom/is-empty.cjs.map +1 -7
  39. package/build/dom/is-entirely-selected.cjs +70 -67
  40. package/build/dom/is-entirely-selected.cjs.map +1 -7
  41. package/build/dom/is-form-element.cjs +33 -33
  42. package/build/dom/is-form-element.cjs.map +1 -7
  43. package/build/dom/is-horizontal-edge.cjs +31 -28
  44. package/build/dom/is-horizontal-edge.cjs.map +1 -7
  45. package/build/dom/is-html-input-element.cjs +12 -25
  46. package/build/dom/is-html-input-element.cjs.map +1 -7
  47. package/build/dom/is-input-or-text-area.cjs +12 -25
  48. package/build/dom/is-input-or-text-area.cjs.map +1 -7
  49. package/build/dom/is-number-input.cjs +36 -33
  50. package/build/dom/is-number-input.cjs.map +1 -7
  51. package/build/dom/is-rtl.cjs +30 -28
  52. package/build/dom/is-rtl.cjs.map +1 -7
  53. package/build/dom/is-selection-forward.cjs +26 -39
  54. package/build/dom/is-selection-forward.cjs.map +1 -7
  55. package/build/dom/is-text-field.cjs +45 -42
  56. package/build/dom/is-text-field.cjs.map +1 -7
  57. package/build/dom/is-vertical-edge.cjs +31 -28
  58. package/build/dom/is-vertical-edge.cjs.map +1 -7
  59. package/build/dom/place-caret-at-edge.cjs +75 -78
  60. package/build/dom/place-caret-at-edge.cjs.map +1 -7
  61. package/build/dom/place-caret-at-horizontal-edge.cjs +29 -28
  62. package/build/dom/place-caret-at-horizontal-edge.cjs.map +1 -7
  63. package/build/dom/place-caret-at-vertical-edge.cjs +30 -28
  64. package/build/dom/place-caret-at-vertical-edge.cjs.map +1 -7
  65. package/build/dom/remove-invalid-html.cjs +35 -31
  66. package/build/dom/remove-invalid-html.cjs.map +1 -7
  67. package/build/dom/remove.cjs +15 -27
  68. package/build/dom/remove.cjs.map +1 -7
  69. package/build/dom/replace-tag.cjs +21 -32
  70. package/build/dom/replace-tag.cjs.map +1 -7
  71. package/build/dom/replace.cjs +34 -32
  72. package/build/dom/replace.cjs.map +1 -7
  73. package/build/dom/safe-html.cjs +45 -46
  74. package/build/dom/safe-html.cjs.map +1 -7
  75. package/build/dom/scroll-if-no-range.cjs +24 -37
  76. package/build/dom/scroll-if-no-range.cjs.map +1 -7
  77. package/build/dom/strip-html.cjs +33 -31
  78. package/build/dom/strip-html.cjs.map +1 -7
  79. package/build/dom/types.cjs +4 -18
  80. package/build/dom/unwrap.cjs +17 -31
  81. package/build/dom/unwrap.cjs.map +1 -7
  82. package/build/dom/wrap.cjs +17 -28
  83. package/build/dom/wrap.cjs.map +1 -7
  84. package/build/focusable.cjs +99 -76
  85. package/build/focusable.cjs.map +1 -7
  86. package/build/index.cjs +57 -38
  87. package/build/index.cjs.map +1 -7
  88. package/build/phrasing-content.cjs +163 -159
  89. package/build/phrasing-content.cjs.map +1 -7
  90. package/build/tabbable.cjs +123 -78
  91. package/build/tabbable.cjs.map +1 -7
  92. package/build/types.cjs +4 -18
  93. package/build/utils/assert-is-defined.cjs +8 -33
  94. package/build/utils/assert-is-defined.cjs.map +1 -7
  95. package/build-module/data-transfer.mjs +16 -14
  96. package/build-module/data-transfer.mjs.map +1 -7
  97. package/build-module/dom/caret-range-from-point.mjs +27 -18
  98. package/build-module/dom/caret-range-from-point.mjs.map +1 -7
  99. package/build-module/dom/clean-node-list.mjs +60 -105
  100. package/build-module/dom/clean-node-list.mjs.map +1 -7
  101. package/build-module/dom/compute-caret-rect.mjs +16 -12
  102. package/build-module/dom/compute-caret-rect.mjs.map +1 -7
  103. package/build-module/dom/document-has-selection.mjs +13 -6
  104. package/build-module/dom/document-has-selection.mjs.map +1 -7
  105. package/build-module/dom/document-has-text-selection.mjs +20 -10
  106. package/build-module/dom/document-has-text-selection.mjs.map +1 -7
  107. package/build-module/dom/document-has-uncollapsed-selection.mjs +14 -6
  108. package/build-module/dom/document-has-uncollapsed-selection.mjs.map +1 -7
  109. package/build-module/dom/get-computed-style.mjs +10 -10
  110. package/build-module/dom/get-computed-style.mjs.map +1 -7
  111. package/build-module/dom/get-offset-parent.mjs +20 -16
  112. package/build-module/dom/get-offset-parent.mjs.map +1 -7
  113. package/build-module/dom/get-range-height.mjs +14 -11
  114. package/build-module/dom/get-range-height.mjs.map +1 -7
  115. package/build-module/dom/get-rectangle-from-range.mjs +78 -108
  116. package/build-module/dom/get-rectangle-from-range.mjs.map +1 -7
  117. package/build-module/dom/get-scroll-container.mjs +28 -28
  118. package/build-module/dom/get-scroll-container.mjs.map +1 -7
  119. package/build-module/dom/hidden-caret-range-from-point.mjs +28 -19
  120. package/build-module/dom/hidden-caret-range-from-point.mjs.map +1 -7
  121. package/build-module/dom/index.mjs +28 -58
  122. package/build-module/dom/input-field-has-uncollapsed-selection.mjs +28 -20
  123. package/build-module/dom/input-field-has-uncollapsed-selection.mjs.map +1 -7
  124. package/build-module/dom/insert-after.mjs +13 -7
  125. package/build-module/dom/insert-after.mjs.map +1 -7
  126. package/build-module/dom/is-edge.mjs +53 -69
  127. package/build-module/dom/is-edge.mjs.map +1 -7
  128. package/build-module/dom/is-element.mjs +8 -5
  129. package/build-module/dom/is-element.mjs.map +1 -7
  130. package/build-module/dom/is-empty.mjs +19 -17
  131. package/build-module/dom/is-empty.mjs.map +1 -7
  132. package/build-module/dom/is-entirely-selected.mjs +51 -44
  133. package/build-module/dom/is-entirely-selected.mjs.map +1 -7
  134. package/build-module/dom/is-form-element.mjs +15 -11
  135. package/build-module/dom/is-form-element.mjs.map +1 -7
  136. package/build-module/dom/is-horizontal-edge.mjs +13 -6
  137. package/build-module/dom/is-horizontal-edge.mjs.map +1 -7
  138. package/build-module/dom/is-html-input-element.mjs +8 -5
  139. package/build-module/dom/is-html-input-element.mjs.map +1 -7
  140. package/build-module/dom/is-input-or-text-area.mjs +8 -5
  141. package/build-module/dom/is-input-or-text-area.mjs.map +1 -7
  142. package/build-module/dom/is-number-input.mjs +16 -10
  143. package/build-module/dom/is-number-input.mjs.map +1 -7
  144. package/build-module/dom/is-rtl.mjs +12 -6
  145. package/build-module/dom/is-rtl.mjs.map +1 -7
  146. package/build-module/dom/is-selection-forward.mjs +22 -19
  147. package/build-module/dom/is-selection-forward.mjs.map +1 -7
  148. package/build-module/dom/is-text-field.mjs +27 -20
  149. package/build-module/dom/is-text-field.mjs.map +1 -7
  150. package/build-module/dom/is-vertical-edge.mjs +13 -6
  151. package/build-module/dom/is-vertical-edge.mjs.map +1 -7
  152. package/build-module/dom/place-caret-at-edge.mjs +51 -52
  153. package/build-module/dom/place-caret-at-edge.mjs.map +1 -7
  154. package/build-module/dom/place-caret-at-horizontal-edge.mjs +11 -6
  155. package/build-module/dom/place-caret-at-horizontal-edge.mjs.map +1 -7
  156. package/build-module/dom/place-caret-at-vertical-edge.mjs +12 -6
  157. package/build-module/dom/place-caret-at-vertical-edge.mjs.map +1 -7
  158. package/build-module/dom/remove-invalid-html.mjs +17 -9
  159. package/build-module/dom/remove-invalid-html.mjs.map +1 -7
  160. package/build-module/dom/remove.mjs +11 -7
  161. package/build-module/dom/remove.mjs.map +1 -7
  162. package/build-module/dom/replace-tag.mjs +17 -12
  163. package/build-module/dom/replace-tag.mjs.map +1 -7
  164. package/build-module/dom/replace.mjs +13 -8
  165. package/build-module/dom/replace.mjs.map +1 -7
  166. package/build-module/dom/safe-html.mjs +27 -24
  167. package/build-module/dom/safe-html.mjs.map +1 -7
  168. package/build-module/dom/scroll-if-no-range.mjs +20 -13
  169. package/build-module/dom/scroll-if-no-range.mjs.map +1 -7
  170. package/build-module/dom/strip-html.mjs +15 -9
  171. package/build-module/dom/strip-html.mjs.map +1 -7
  172. package/build-module/dom/types.mjs +0 -1
  173. package/build-module/dom/unwrap.mjs +13 -11
  174. package/build-module/dom/unwrap.mjs.map +1 -7
  175. package/build-module/dom/wrap.mjs +13 -8
  176. package/build-module/dom/wrap.mjs.map +1 -7
  177. package/build-module/focusable.mjs +95 -52
  178. package/build-module/focusable.mjs.map +1 -7
  179. package/build-module/index.mjs +11 -5
  180. package/build-module/index.mjs.map +1 -7
  181. package/build-module/phrasing-content.mjs +157 -133
  182. package/build-module/phrasing-content.mjs.map +1 -7
  183. package/build-module/tabbable.mjs +116 -51
  184. package/build-module/tabbable.mjs.map +1 -7
  185. package/build-module/types.mjs +0 -1
  186. package/build-module/utils/assert-is-defined.mjs +4 -9
  187. package/build-module/utils/assert-is-defined.mjs.map +1 -7
  188. package/build-types/dom/clean-node-list.d.ts +2 -2
  189. package/build-types/dom/clean-node-list.d.ts.map +1 -1
  190. package/build-types/dom/is-edge.d.ts.map +1 -1
  191. package/build-types/dom/remove-invalid-html.d.ts +4 -4
  192. package/build-types/dom/remove-invalid-html.d.ts.map +1 -1
  193. package/package.json +4 -4
  194. package/src/dom/clean-node-list.ts +2 -2
  195. package/src/dom/is-edge.ts +35 -43
  196. package/src/dom/remove-invalid-html.ts +4 -4
  197. package/src/dom/test/{get-rectangle-from-range.browser.test.js → get-rectangle-from-range.browser.test.ts} +25 -25
  198. package/src/test/{dom.jsdom.test.js → dom.jsdom.test.ts} +9 -6
  199. package/src/test/{focusable.browser.test.js → focusable.browser.test.ts} +14 -13
  200. package/src/test/{tabbable.browser.test.js → tabbable.browser.test.ts} +3 -2
  201. package/build/dom/index.cjs.map +0 -7
  202. package/build/dom/types.cjs.map +0 -7
  203. package/build/types.cjs.map +0 -7
  204. package/build-module/dom/index.mjs.map +0 -7
  205. package/build-module/dom/types.mjs.map +0 -7
  206. package/build-module/types.mjs.map +0 -7
  207. /package/src/dom/test/{safe-html.jsdom.test.js → safe-html.jsdom.test.ts} +0 -0
  208. /package/src/dom/test/{strip-html.jsdom.test.js → strip-html.jsdom.test.ts} +0 -0
  209. /package/src/test/{focusable-area.jsdom.test.js → focusable-area.jsdom.test.ts} +0 -0
  210. /package/src/test/{utils.js → utils.ts} +0 -0
@@ -1,42 +1,47 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __is_text_field_ts = require("./is-text-field.cjs");
28
+ __is_text_field_ts = __toESM(__is_text_field_ts);
29
+ let __is_html_input_element_ts = require("./is-html-input-element.cjs");
30
+ __is_html_input_element_ts = __toESM(__is_html_input_element_ts);
31
+ let __document_has_text_selection_ts = require("./document-has-text-selection.cjs");
32
+ __document_has_text_selection_ts = __toESM(__document_has_text_selection_ts);
30
33
  // packages/dom/src/dom/document-has-selection.ts
31
- var document_has_selection_exports = {};
32
- __export(document_has_selection_exports, {
33
- default: () => documentHasSelection
34
- });
35
- module.exports = __toCommonJS(document_has_selection_exports);
36
- var import_is_text_field = __toESM(require("./is-text-field.cjs"));
37
- var import_is_html_input_element = __toESM(require("./is-html-input-element.cjs"));
38
- var import_document_has_text_selection = __toESM(require("./document-has-text-selection.cjs"));
34
+ /**
35
+ * Check whether the current document has a selection. This includes focus in
36
+ * input fields, textareas, and general rich-text selection.
37
+ *
38
+ * @param doc The document to check.
39
+ *
40
+ * @return True if there is selection, false if not.
41
+ */
39
42
  function documentHasSelection(doc) {
40
- return !!doc.activeElement && ((0, import_is_html_input_element.default)(doc.activeElement) || (0, import_is_text_field.default)(doc.activeElement) || (0, import_document_has_text_selection.default)(doc));
43
+ return !!doc.activeElement && ((0, __is_html_input_element_ts.default)(doc.activeElement) || (0, __is_text_field_ts.default)(doc.activeElement) || (0, __document_has_text_selection_ts.default)(doc));
41
44
  }
42
- //# sourceMappingURL=document-has-selection.cjs.map
45
+ exports.default = documentHasSelection;
46
+
47
+ //# sourceMappingURL=document-has-selection.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/document-has-selection.ts"],
4
- "sourcesContent": ["import isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\nimport documentHasTextSelection from './document-has-text-selection';\n\n/**\n * Check whether the current document has a selection. This includes focus in\n * input fields, textareas, and general rich-text selection.\n *\n * @param doc The document to check.\n *\n * @return True if there is selection, false if not.\n */\nexport default function documentHasSelection( doc: Document ): boolean {\n\treturn (\n\t\t!! doc.activeElement &&\n\t\t( isHTMLInputElement( doc.activeElement ) ||\n\t\t\tisTextField( doc.activeElement ) ||\n\t\t\tdocumentHasTextSelection( doc ) )\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAwB;AACxB,mCAA+B;AAC/B,yCAAqC;AAUtB,SAAR,qBAAuC,KAAyB;AACtE,SACC,CAAC,CAAE,IAAI,sBACL,6BAAAA,SAAoB,IAAI,aAAc,SACvC,qBAAAC,SAAa,IAAI,aAAc,SAC/B,mCAAAC,SAA0B,GAAI;AAEjC;",
6
- "names": ["isHTMLInputElement", "isTextField", "documentHasTextSelection"]
7
- }
1
+ {"version":3,"file":"document-has-selection.cjs","names":["isHTMLInputElement","isTextField","documentHasTextSelection"],"sources":["../../src/dom/document-has-selection.ts"],"sourcesContent":["import isTextField from './is-text-field';\nimport isHTMLInputElement from './is-html-input-element';\nimport documentHasTextSelection from './document-has-text-selection';\n\n/**\n * Check whether the current document has a selection. This includes focus in\n * input fields, textareas, and general rich-text selection.\n *\n * @param doc The document to check.\n *\n * @return True if there is selection, false if not.\n */\nexport default function documentHasSelection( doc: Document ): boolean {\n\treturn (\n\t\t!! doc.activeElement &&\n\t\t( isHTMLInputElement( doc.activeElement ) ||\n\t\t\tisTextField( doc.activeElement ) ||\n\t\t\tdocumentHasTextSelection( doc ) )\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAwB,qBAAsB,KAAyB;CACtE,OACC,CAAC,CAAE,IAAI,mBAAA,GACLA,2BAAAA,QAAAA,CAAoB,IAAI,aAAc,MAAA,GACvCC,mBAAAA,QAAAA,CAAa,IAAI,aAAc,MAAA,GAC/BC,iCAAAA,QAAAA,CAA0B,GAAI;AAEjC"}
@@ -1,34 +1,28 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/dom/src/dom/document-has-text-selection.ts
21
- var document_has_text_selection_exports = {};
22
- __export(document_has_text_selection_exports, {
23
- default: () => documentHasTextSelection
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
24
5
  });
25
- module.exports = __toCommonJS(document_has_text_selection_exports);
26
- var import_assert_is_defined = require("../utils/assert-is-defined.cjs");
6
+ let ___utils_assert_is_defined_ts = require("../utils/assert-is-defined.cjs");
7
+ // packages/dom/src/dom/document-has-text-selection.ts
8
+ /**
9
+ * Check whether the current document has selected text. This applies to ranges
10
+ * of text in the document, and not selection inside `<input>` and `<textarea>`
11
+ * elements.
12
+ *
13
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.
14
+ *
15
+ * @param doc The document to check.
16
+ *
17
+ * @return True if there is selection, false if not.
18
+ */
27
19
  function documentHasTextSelection(doc) {
28
- (0, import_assert_is_defined.assertIsDefined)(doc.defaultView, "doc.defaultView");
29
- const selection = doc.defaultView.getSelection();
30
- (0, import_assert_is_defined.assertIsDefined)(selection, "selection");
31
- const range = selection.rangeCount ? selection.getRangeAt(0) : null;
32
- return !!range && !range.collapsed;
20
+ (0, ___utils_assert_is_defined_ts.assertIsDefined)(doc.defaultView, "doc.defaultView");
21
+ const selection = doc.defaultView.getSelection();
22
+ (0, ___utils_assert_is_defined_ts.assertIsDefined)(selection, "selection");
23
+ const range = selection.rangeCount ? selection.getRangeAt(0) : null;
24
+ return !!range && !range.collapsed;
33
25
  }
34
- //# sourceMappingURL=document-has-text-selection.cjs.map
26
+ exports.default = documentHasTextSelection;
27
+
28
+ //# sourceMappingURL=document-has-text-selection.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/document-has-text-selection.ts"],
4
- "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param doc The document to check.\n *\n * @return True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc: Document ): boolean {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAajB,SAAR,yBAA2C,KAAyB;AAC1E,gDAAiB,IAAI,aAAa,iBAAkB;AACpD,QAAM,YAAY,IAAI,YAAY,aAAa;AAC/C,gDAAiB,WAAW,WAAY;AACxC,QAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;AACjE,SAAO,CAAC,CAAE,SAAS,CAAE,MAAM;AAC5B;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"document-has-text-selection.cjs","names":[],"sources":["../../src/dom/document-has-text-selection.ts"],"sourcesContent":["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Check whether the current document has selected text. This applies to ranges\n * of text in the document, and not selection inside `<input>` and `<textarea>`\n * elements.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection#Related_objects.\n *\n * @param doc The document to check.\n *\n * @return True if there is selection, false if not.\n */\nexport default function documentHasTextSelection( doc: Document ): boolean {\n\tassertIsDefined( doc.defaultView, 'doc.defaultView' );\n\tconst selection = doc.defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tconst range = selection.rangeCount ? selection.getRangeAt( 0 ) : null;\n\treturn !! range && ! range.collapsed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAaA,SAAwB,yBAA0B,KAAyB;CAC1E,CAAA,GAAA,8BAAA,gBAAA,CAAiB,IAAI,aAAa,iBAAkB;CACpD,MAAM,YAAY,IAAI,YAAY,aAAa;CAC/C,CAAA,GAAA,8BAAA,gBAAA,CAAiB,WAAW,WAAY;CACxC,MAAM,QAAQ,UAAU,aAAa,UAAU,WAAY,CAAE,IAAI;CACjE,OAAO,CAAC,CAAE,SAAS,CAAE,MAAM;AAC5B"}
@@ -1,41 +1,46 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __document_has_text_selection_ts = require("./document-has-text-selection.cjs");
28
+ __document_has_text_selection_ts = __toESM(__document_has_text_selection_ts);
29
+ let __input_field_has_uncollapsed_selection_ts = require("./input-field-has-uncollapsed-selection.cjs");
30
+ __input_field_has_uncollapsed_selection_ts = __toESM(__input_field_has_uncollapsed_selection_ts);
30
31
  // packages/dom/src/dom/document-has-uncollapsed-selection.ts
31
- var document_has_uncollapsed_selection_exports = {};
32
- __export(document_has_uncollapsed_selection_exports, {
33
- default: () => documentHasUncollapsedSelection
34
- });
35
- module.exports = __toCommonJS(document_has_uncollapsed_selection_exports);
36
- var import_document_has_text_selection = __toESM(require("./document-has-text-selection.cjs"));
37
- var import_input_field_has_uncollapsed_selection = __toESM(require("./input-field-has-uncollapsed-selection.cjs"));
32
+ /**
33
+ * Check whether the current document has any sort of (uncollapsed) selection.
34
+ * This includes ranges of text across elements and any selection inside
35
+ * textual `<input>` and `<textarea>` elements.
36
+ *
37
+ * @param doc The document to check.
38
+ *
39
+ * @return Whether there is any recognizable text selection in the document.
40
+ */
38
41
  function documentHasUncollapsedSelection(doc) {
39
- return (0, import_document_has_text_selection.default)(doc) || !!doc.activeElement && (0, import_input_field_has_uncollapsed_selection.default)(doc.activeElement);
42
+ return (0, __document_has_text_selection_ts.default)(doc) || !!doc.activeElement && (0, __input_field_has_uncollapsed_selection_ts.default)(doc.activeElement);
40
43
  }
41
- //# sourceMappingURL=document-has-uncollapsed-selection.cjs.map
44
+ exports.default = documentHasUncollapsedSelection;
45
+
46
+ //# sourceMappingURL=document-has-uncollapsed-selection.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/document-has-uncollapsed-selection.ts"],
4
- "sourcesContent": ["import documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param doc The document to check.\n *\n * @return Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection(\n\tdoc: Document\n): boolean {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAAqC;AACrC,mDAA8C;AAW/B,SAAR,gCACN,KACU;AACV,aACC,mCAAAA,SAA0B,GAAI,KAC5B,CAAC,CAAE,IAAI,qBACR,6CAAAC,SAAmC,IAAI,aAAc;AAExD;",
6
- "names": ["documentHasTextSelection", "inputFieldHasUncollapsedSelection"]
7
- }
1
+ {"version":3,"file":"document-has-uncollapsed-selection.cjs","names":["documentHasTextSelection","inputFieldHasUncollapsedSelection"],"sources":["../../src/dom/document-has-uncollapsed-selection.ts"],"sourcesContent":["import documentHasTextSelection from './document-has-text-selection';\nimport inputFieldHasUncollapsedSelection from './input-field-has-uncollapsed-selection';\n\n/**\n * Check whether the current document has any sort of (uncollapsed) selection.\n * This includes ranges of text across elements and any selection inside\n * textual `<input>` and `<textarea>` elements.\n *\n * @param doc The document to check.\n *\n * @return Whether there is any recognizable text selection in the document.\n */\nexport default function documentHasUncollapsedSelection(\n\tdoc: Document\n): boolean {\n\treturn (\n\t\tdocumentHasTextSelection( doc ) ||\n\t\t( !! doc.activeElement &&\n\t\t\tinputFieldHasUncollapsedSelection( doc.activeElement ) )\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAwB,gCACvB,KACU;CACV,QAAA,GACCA,iCAAAA,QAAAA,CAA0B,GAAI,KAC5B,CAAC,CAAE,IAAI,kBAAA,GACRC,2CAAAA,QAAAA,CAAmC,IAAI,aAAc;AAExD"}
@@ -1,34 +1,18 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/dom/src/dom/get-computed-style.ts
21
- var get_computed_style_exports = {};
22
- __export(get_computed_style_exports, {
23
- default: () => getComputedStyle
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
24
5
  });
25
- module.exports = __toCommonJS(get_computed_style_exports);
26
- var import_assert_is_defined = require("../utils/assert-is-defined.cjs");
6
+ let ___utils_assert_is_defined_ts = require("../utils/assert-is-defined.cjs");
7
+ // packages/dom/src/dom/get-computed-style.ts
8
+ /**
9
+ * @param element
10
+ * @return The computed style for the element.
11
+ */
27
12
  function getComputedStyle(element) {
28
- (0, import_assert_is_defined.assertIsDefined)(
29
- element.ownerDocument.defaultView,
30
- "element.ownerDocument.defaultView"
31
- );
32
- return element.ownerDocument.defaultView.getComputedStyle(element);
13
+ (0, ___utils_assert_is_defined_ts.assertIsDefined)(element.ownerDocument.defaultView, "element.ownerDocument.defaultView");
14
+ return element.ownerDocument.defaultView.getComputedStyle(element);
33
15
  }
34
- //# sourceMappingURL=get-computed-style.cjs.map
16
+ exports.default = getComputedStyle;
17
+
18
+ //# sourceMappingURL=get-computed-style.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/get-computed-style.ts"],
4
- "sourcesContent": ["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * @param element\n * @return The computed style for the element.\n */\nexport default function getComputedStyle(\n\telement: Element\n): CSSStyleDeclaration {\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAAgC;AAMjB,SAAR,iBACN,SACsB;AACtB;AAAA,IACC,QAAQ,cAAc;AAAA,IACtB;AAAA,EACD;AACA,SAAO,QAAQ,cAAc,YAAY,iBAAkB,OAAQ;AACpE;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"get-computed-style.cjs","names":[],"sources":["../../src/dom/get-computed-style.ts"],"sourcesContent":["import { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * @param element\n * @return The computed style for the element.\n */\nexport default function getComputedStyle(\n\telement: Element\n): CSSStyleDeclaration {\n\tassertIsDefined(\n\t\telement.ownerDocument.defaultView,\n\t\t'element.ownerDocument.defaultView'\n\t);\n\treturn element.ownerDocument.defaultView.getComputedStyle( element );\n}\n"],"mappings":";;;;;;;;;;;AAMA,SAAwB,iBACvB,SACsB;CACtB,CAAA,GAAA,8BAAA,gBAAA,CACC,QAAQ,cAAc,aACtB,mCACD;CACA,OAAO,QAAQ,cAAc,YAAY,iBAAkB,OAAQ;AACpE"}
@@ -1,51 +1,52 @@
1
1
  "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ // \0rolldown/runtime.js
2
7
  var __create = Object.create;
3
8
  var __defProp = Object.defineProperty;
4
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
11
  var __getProtoOf = Object.getPrototypeOf;
7
12
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
13
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
14
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: ((k) => from[k]).bind(null, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
19
22
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ let __get_computed_style_ts = require("./get-computed-style.cjs");
28
+ __get_computed_style_ts = __toESM(__get_computed_style_ts);
29
+ let __is_element_ts = require("./is-element.cjs");
30
+ __is_element_ts = __toESM(__is_element_ts);
30
31
  // packages/dom/src/dom/get-offset-parent.ts
31
- var get_offset_parent_exports = {};
32
- __export(get_offset_parent_exports, {
33
- default: () => getOffsetParent
34
- });
35
- module.exports = __toCommonJS(get_offset_parent_exports);
36
- var import_get_computed_style = __toESM(require("./get-computed-style.cjs"));
37
- var import_is_element = __toESM(require("./is-element.cjs"));
32
+ /**
33
+ * Returns the closest positioned element, or null under any of the conditions
34
+ * of the offsetParent specification. Unlike offsetParent, this function is not
35
+ * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).
36
+ *
37
+ * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent
38
+ *
39
+ * @param node Node from which to find offset parent.
40
+ *
41
+ * @return Offset parent.
42
+ */
38
43
  function getOffsetParent(node) {
39
- let closestElement = node.parentNode;
40
- while (closestElement && !(0, import_is_element.default)(closestElement)) {
41
- closestElement = closestElement.parentNode;
42
- }
43
- if (!closestElement) {
44
- return null;
45
- }
46
- if ((0, import_get_computed_style.default)(closestElement).position !== "static") {
47
- return closestElement;
48
- }
49
- return closestElement.offsetParent;
44
+ let closestElement = node.parentNode;
45
+ while (closestElement && !(0, __is_element_ts.default)(closestElement)) closestElement = closestElement.parentNode;
46
+ if (!closestElement) return null;
47
+ if ((0, __get_computed_style_ts.default)(closestElement).position !== "static") return closestElement;
48
+ return closestElement.offsetParent;
50
49
  }
51
- //# sourceMappingURL=get-offset-parent.cjs.map
50
+ exports.default = getOffsetParent;
51
+
52
+ //# sourceMappingURL=get-offset-parent.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/get-offset-parent.ts"],
4
- "sourcesContent": ["import getComputedStyle from './get-computed-style';\nimport isElement from './is-element';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param node Node from which to find offset parent.\n *\n * @return Offset parent.\n */\nexport default function getOffsetParent( node: Node ): Node | null {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement = node.parentNode;\n\twhile ( closestElement && ! isElement( closestElement ) ) {\n\t\tclosestElement = closestElement.parentNode;\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif ( getComputedStyle( closestElement ).position !== 'static' ) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn ( closestElement as HTMLElement ).offsetParent;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA6B;AAC7B,wBAAsB;AAaP,SAAR,gBAAkC,MAA0B;AAGlE,MAAI,iBAAiB,KAAK;AAC1B,SAAQ,kBAAkB,KAAE,kBAAAA,SAAW,cAAe,GAAI;AACzD,qBAAiB,eAAe;AAAA,EACjC;AAEA,MAAK,CAAE,gBAAiB;AACvB,WAAO;AAAA,EACR;AAIA,UAAK,0BAAAC,SAAkB,cAAe,EAAE,aAAa,UAAW;AAC/D,WAAO;AAAA,EACR;AAGA,SAAS,eAAgC;AAC1C;",
6
- "names": ["isElement", "getComputedStyle"]
7
- }
1
+ {"version":3,"file":"get-offset-parent.cjs","names":["isElement","getComputedStyle"],"sources":["../../src/dom/get-offset-parent.ts"],"sourcesContent":["import getComputedStyle from './get-computed-style';\nimport isElement from './is-element';\n\n/**\n * Returns the closest positioned element, or null under any of the conditions\n * of the offsetParent specification. Unlike offsetParent, this function is not\n * limited to HTMLElement and accepts any Node (e.g. Node.TEXT_NODE).\n *\n * @see https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent\n *\n * @param node Node from which to find offset parent.\n *\n * @return Offset parent.\n */\nexport default function getOffsetParent( node: Node ): Node | null {\n\t// Cannot retrieve computed style or offset parent only anything other than\n\t// an element node, so find the closest element node.\n\tlet closestElement = node.parentNode;\n\twhile ( closestElement && ! isElement( closestElement ) ) {\n\t\tclosestElement = closestElement.parentNode;\n\t}\n\n\tif ( ! closestElement ) {\n\t\treturn null;\n\t}\n\n\t// If the closest element is already positioned, return it, as offsetParent\n\t// does not otherwise consider the node itself.\n\tif ( getComputedStyle( closestElement ).position !== 'static' ) {\n\t\treturn closestElement;\n\t}\n\n\t// offsetParent is undocumented/draft.\n\treturn ( closestElement as HTMLElement ).offsetParent;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,SAAwB,gBAAiB,MAA0B;CAGlE,IAAI,iBAAiB,KAAK;CAC1B,OAAQ,kBAAkB,EAAA,GAAEA,gBAAAA,QAAAA,CAAW,cAAe,GACrD,iBAAiB,eAAe;CAGjC,IAAK,CAAE,gBACN,OAAO;CAKR,KAAA,GAAKC,wBAAAA,QAAAA,CAAkB,cAAe,CAAC,CAAC,aAAa,UACpD,OAAO;CAIR,OAAS,eAAgC;AAC1C"}
@@ -1,35 +1,22 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/dom/src/dom/get-range-height.ts
21
- var get_range_height_exports = {};
22
- __export(get_range_height_exports, {
23
- default: () => getRangeHeight
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
24
5
  });
25
- module.exports = __toCommonJS(get_range_height_exports);
6
+ // packages/dom/src/dom/get-range-height.ts
7
+ /**
8
+ * Gets the height of the range without ignoring zero width rectangles, which
9
+ * some browsers ignore when creating a union.
10
+ *
11
+ * @param range The range to check.
12
+ * @return Height of the range or undefined if the range has no client rectangles.
13
+ */
26
14
  function getRangeHeight(range) {
27
- const rects = Array.from(range.getClientRects());
28
- if (!rects.length) {
29
- return;
30
- }
31
- const highestTop = Math.min(...rects.map(({ top }) => top));
32
- const lowestBottom = Math.max(...rects.map(({ bottom }) => bottom));
33
- return lowestBottom - highestTop;
15
+ const rects = Array.from(range.getClientRects());
16
+ if (!rects.length) return;
17
+ const highestTop = Math.min(...rects.map(({ top }) => top));
18
+ return Math.max(...rects.map(({ bottom }) => bottom)) - highestTop;
34
19
  }
35
- //# sourceMappingURL=get-range-height.cjs.map
20
+ exports.default = getRangeHeight;
21
+
22
+ //# sourceMappingURL=get-range-height.cjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/dom/get-range-height.ts"],
4
- "sourcesContent": ["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param range The range to check.\n * @return Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range: Range ): number | undefined {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOe,SAAR,eAAiC,OAAmC;AAC1E,QAAM,QAAQ,MAAM,KAAM,MAAM,eAAe,CAAE;AAEjD,MAAK,CAAE,MAAM,QAAS;AACrB;AAAA,EACD;AAEA,QAAM,aAAa,KAAK,IAAK,GAAG,MAAM,IAAK,CAAE,EAAE,IAAI,MAAO,GAAI,CAAE;AAChE,QAAM,eAAe,KAAK,IAAK,GAAG,MAAM,IAAK,CAAE,EAAE,OAAO,MAAO,MAAO,CAAE;AAExE,SAAO,eAAe;AACvB;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"get-range-height.cjs","names":[],"sources":["../../src/dom/get-range-height.ts"],"sourcesContent":["/**\n * Gets the height of the range without ignoring zero width rectangles, which\n * some browsers ignore when creating a union.\n *\n * @param range The range to check.\n * @return Height of the range or undefined if the range has no client rectangles.\n */\nexport default function getRangeHeight( range: Range ): number | undefined {\n\tconst rects = Array.from( range.getClientRects() );\n\n\tif ( ! rects.length ) {\n\t\treturn;\n\t}\n\n\tconst highestTop = Math.min( ...rects.map( ( { top } ) => top ) );\n\tconst lowestBottom = Math.max( ...rects.map( ( { bottom } ) => bottom ) );\n\n\treturn lowestBottom - highestTop;\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,SAAwB,eAAgB,OAAmC;CAC1E,MAAM,QAAQ,MAAM,KAAM,MAAM,eAAe,CAAE;CAEjD,IAAK,CAAE,MAAM,QACZ;CAGD,MAAM,aAAa,KAAK,IAAK,GAAG,MAAM,KAAO,EAAE,UAAW,GAAI,CAAE;CAGhE,OAFqB,KAAK,IAAK,GAAG,MAAM,KAAO,EAAE,aAAc,MAAO,CAEpD,IAAI;AACvB"}