@wordpress/dom 4.32.0 → 4.32.1-next.47f435fc9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +1,7 @@
1
- {"version":3,"names":["_isHtmlInputElement","_interopRequireDefault","require","isTextField","node","nonTextInputs","isHTMLInputElement","type","includes","nodeName","contentEditable"],"sources":["@wordpress/dom/src/dom/is-text-field.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,WAAWA,CAAEC,IAAI,EAAG;EAC3C;EACA,MAAMC,aAAa,GAAG,CACrB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,MAAM,CACN;EACD,OACG,IAAAC,2BAAkB,EAAEF,IAAK,CAAC,IAC3BA,IAAI,CAACG,IAAI,IACT,CAAEF,aAAa,CAACG,QAAQ,CAAEJ,IAAI,CAACG,IAAK,CAAC,IACtCH,IAAI,CAACK,QAAQ,KAAK,UAAU,IAC5B,0BAA6BL,IAAI,CAAGM,eAAe,KAAK,MAAM;AAEhE","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/is-text-field.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport isHTMLInputElement from './is-html-input-element';\n\n/* eslint-disable jsdoc/valid-types */\n/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * See: https://html.spec.whatwg.org/#textFieldSelection\n *\n * @param {Node} node The HTML element.\n * @return {node is HTMLElement} True if the element is an text field, false if not.\n */\nexport default function isTextField( node ) {\n\t/* eslint-enable jsdoc/valid-types */\n\tconst nonTextInputs = [\n\t\t'button',\n\t\t'checkbox',\n\t\t'hidden',\n\t\t'file',\n\t\t'radio',\n\t\t'image',\n\t\t'range',\n\t\t'reset',\n\t\t'submit',\n\t\t'number',\n\t\t'email',\n\t\t'time',\n\t];\n\treturn (\n\t\t( isHTMLInputElement( node ) &&\n\t\t\tnode.type &&\n\t\t\t! nonTextInputs.includes( node.type ) ) ||\n\t\tnode.nodeName === 'TEXTAREA' ||\n\t\t/** @type {HTMLElement} */ ( node ).contentEditable === 'true'\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mCAA+B;AAYhB,SAAR,YAA8B,MAAO;AAE3C,QAAM,gBAAgB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACA,aACG,6BAAAA,SAAoB,IAAK,KAC1B,KAAK,QACL,CAAE,cAAc,SAAU,KAAK,IAAK,KACrC,KAAK,aAAa;AAAA,EACW,KAAO,oBAAoB;AAE1D;",
6
+ "names": ["isHTMLInputElement"]
7
+ }
@@ -1,24 +1,38 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ 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
+ 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;
19
+ };
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
+ var is_vertical_edge_exports = {};
30
+ __export(is_vertical_edge_exports, {
31
+ default: () => isVerticalEdge
6
32
  });
7
- exports.default = isVerticalEdge;
8
- var _isEdge = _interopRequireDefault(require("./is-edge"));
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- /**
14
- * Check whether the selection is vertically at the edge of the container.
15
- *
16
- * @param {HTMLElement} container Focusable element.
17
- * @param {boolean} isReverse Set to true to check top, false for bottom.
18
- *
19
- * @return {boolean} True if at the vertical edge, false if not.
20
- */
33
+ module.exports = __toCommonJS(is_vertical_edge_exports);
34
+ var import_is_edge = __toESM(require("./is-edge"));
21
35
  function isVerticalEdge(container, isReverse) {
22
- return (0, _isEdge.default)(container, isReverse, true);
36
+ return (0, import_is_edge.default)(container, isReverse, true);
23
37
  }
24
- //# sourceMappingURL=is-vertical-edge.js.map
38
+ //# sourceMappingURL=is-vertical-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_isEdge","_interopRequireDefault","require","isVerticalEdge","container","isReverse","isEdge"],"sources":["@wordpress/dom/src/dom/is-vertical-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC9D,OAAO,IAAAC,eAAM,EAAEF,SAAS,EAAEC,SAAS,EAAE,IAAK,CAAC;AAC5C","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/is-vertical-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport isEdge from './is-edge';\n\n/**\n * Check whether the selection is vertically at the edge of the container.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse Set to true to check top, false for bottom.\n *\n * @return {boolean} True if at the vertical edge, false if not.\n */\nexport default function isVerticalEdge( container, isReverse ) {\n\treturn isEdge( container, isReverse, true );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmB;AAUJ,SAAR,eAAiC,WAAW,WAAY;AAC9D,aAAO,eAAAA,SAAQ,WAAW,WAAW,IAAK;AAC3C;",
6
+ "names": ["isEdge"]
7
+ }
@@ -1,40 +1,46 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ 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
+ 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;
19
+ };
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
+ var place_caret_at_edge_exports = {};
30
+ __export(place_caret_at_edge_exports, {
31
+ default: () => placeCaretAtEdge
6
32
  });
7
- exports.default = placeCaretAtEdge;
8
- var _hiddenCaretRangeFromPoint = _interopRequireDefault(require("./hidden-caret-range-from-point"));
9
- var _assertIsDefined = require("../utils/assert-is-defined");
10
- var _isInputOrTextArea = _interopRequireDefault(require("./is-input-or-text-area"));
11
- var _isRtl = _interopRequireDefault(require("./is-rtl"));
12
- var _scrollIfNoRange = require("./scroll-if-no-range");
13
- /**
14
- * Internal dependencies
15
- */
16
-
17
- /**
18
- * Gets the range to place.
19
- *
20
- * @param {HTMLElement} container Focusable element.
21
- * @param {boolean} isReverse True for end, false for start.
22
- * @param {number|undefined} x X coordinate to vertically position.
23
- *
24
- * @return {Range|null} The range to place.
25
- */
33
+ module.exports = __toCommonJS(place_caret_at_edge_exports);
34
+ var import_hidden_caret_range_from_point = __toESM(require("./hidden-caret-range-from-point"));
35
+ var import_assert_is_defined = require("../utils/assert-is-defined");
36
+ var import_is_input_or_text_area = __toESM(require("./is-input-or-text-area"));
37
+ var import_is_rtl = __toESM(require("./is-rtl"));
38
+ var import_scroll_if_no_range = require("./scroll-if-no-range");
26
39
  function getRange(container, isReverse, x) {
27
- const {
28
- ownerDocument
29
- } = container;
30
- // In the case of RTL scripts, the horizontal edge is at the opposite side.
31
- const isReverseDir = (0, _isRtl.default)(container) ? !isReverse : isReverse;
40
+ const { ownerDocument } = container;
41
+ const isReverseDir = (0, import_is_rtl.default)(container) ? !isReverse : isReverse;
32
42
  const containerRect = container.getBoundingClientRect();
33
- // When placing at the end (isReverse), find the closest range to the bottom
34
- // right corner. When placing at the start, to the top left corner.
35
- // Ensure x is defined and within the container's boundaries. When it's
36
- // exactly at the boundary, it's not considered within the boundaries.
37
- if (x === undefined) {
43
+ if (x === void 0) {
38
44
  x = isReverse ? containerRect.right - 1 : containerRect.left + 1;
39
45
  } else if (x <= containerRect.left) {
40
46
  x = containerRect.left + 1;
@@ -42,24 +48,15 @@ function getRange(container, isReverse, x) {
42
48
  x = containerRect.right - 1;
43
49
  }
44
50
  const y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;
45
- return (0, _hiddenCaretRangeFromPoint.default)(ownerDocument, x, y, container);
51
+ return (0, import_hidden_caret_range_from_point.default)(ownerDocument, x, y, container);
46
52
  }
47
-
48
- /**
49
- * Places the caret at start or end of a given element.
50
- *
51
- * @param {HTMLElement} container Focusable element.
52
- * @param {boolean} isReverse True for end, false for start.
53
- * @param {number|undefined} x X coordinate to vertically position.
54
- */
55
53
  function placeCaretAtEdge(container, isReverse, x) {
56
54
  if (!container) {
57
55
  return;
58
56
  }
59
57
  container.focus();
60
- if ((0, _isInputOrTextArea.default)(container)) {
61
- // The element may not support selection setting.
62
- if (typeof container.selectionStart !== 'number') {
58
+ if ((0, import_is_input_or_text_area.default)(container)) {
59
+ if (typeof container.selectionStart !== "number") {
63
60
  return;
64
61
  }
65
62
  if (isReverse) {
@@ -74,20 +71,20 @@ function placeCaretAtEdge(container, isReverse, x) {
74
71
  if (!container.isContentEditable) {
75
72
  return;
76
73
  }
77
- const range = (0, _scrollIfNoRange.scrollIfNoRange)(container, isReverse, () => getRange(container, isReverse, x));
74
+ const range = (0, import_scroll_if_no_range.scrollIfNoRange)(
75
+ container,
76
+ isReverse,
77
+ () => getRange(container, isReverse, x)
78
+ );
78
79
  if (!range) {
79
80
  return;
80
81
  }
81
- const {
82
- ownerDocument
83
- } = container;
84
- const {
85
- defaultView
86
- } = ownerDocument;
87
- (0, _assertIsDefined.assertIsDefined)(defaultView, 'defaultView');
82
+ const { ownerDocument } = container;
83
+ const { defaultView } = ownerDocument;
84
+ (0, import_assert_is_defined.assertIsDefined)(defaultView, "defaultView");
88
85
  const selection = defaultView.getSelection();
89
- (0, _assertIsDefined.assertIsDefined)(selection, 'selection');
86
+ (0, import_assert_is_defined.assertIsDefined)(selection, "selection");
90
87
  selection.removeAllRanges();
91
88
  selection.addRange(range);
92
89
  }
93
- //# sourceMappingURL=place-caret-at-edge.js.map
90
+ //# sourceMappingURL=place-caret-at-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_hiddenCaretRangeFromPoint","_interopRequireDefault","require","_assertIsDefined","_isInputOrTextArea","_isRtl","_scrollIfNoRange","getRange","container","isReverse","x","ownerDocument","isReverseDir","isRTL","containerRect","getBoundingClientRect","undefined","right","left","y","bottom","top","hiddenCaretRangeFromPoint","placeCaretAtEdge","focus","isInputOrTextArea","selectionStart","value","length","selectionEnd","isContentEditable","range","scrollIfNoRange","defaultView","assertIsDefined","selection","getSelection","removeAllRanges","addRange"],"sources":["@wordpress/dom/src/dom/place-caret-at-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n *\n * @return {Range|null} The range to place.\n */\nfunction getRange( container, isReverse, x ) {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge( container, isReverse, x ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAPA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,QAAQA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,CAAC,EAAG;EAC5C,MAAM;IAAEC;EAAc,CAAC,GAAGH,SAAS;EACnC;EACA,MAAMI,YAAY,GAAG,IAAAC,cAAK,EAAEL,SAAU,CAAC,GAAG,CAAEC,SAAS,GAAGA,SAAS;EACjE,MAAMK,aAAa,GAAGN,SAAS,CAACO,qBAAqB,CAAC,CAAC;EACvD;EACA;EACA;EACA;EACA,IAAKL,CAAC,KAAKM,SAAS,EAAG;IACtBN,CAAC,GAAGD,SAAS,GAAGK,aAAa,CAACG,KAAK,GAAG,CAAC,GAAGH,aAAa,CAACI,IAAI,GAAG,CAAC;EACjE,CAAC,MAAM,IAAKR,CAAC,IAAII,aAAa,CAACI,IAAI,EAAG;IACrCR,CAAC,GAAGI,aAAa,CAACI,IAAI,GAAG,CAAC;EAC3B,CAAC,MAAM,IAAKR,CAAC,IAAII,aAAa,CAACG,KAAK,EAAG;IACtCP,CAAC,GAAGI,aAAa,CAACG,KAAK,GAAG,CAAC;EAC5B;EACA,MAAME,CAAC,GAAGP,YAAY,GAAGE,aAAa,CAACM,MAAM,GAAG,CAAC,GAAGN,aAAa,CAACO,GAAG,GAAG,CAAC;EACzE,OAAO,IAAAC,kCAAyB,EAAEX,aAAa,EAAED,CAAC,EAAES,CAAC,EAAEX,SAAU,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASe,gBAAgBA,CAAEf,SAAS,EAAEC,SAAS,EAAEC,CAAC,EAAG;EACnE,IAAK,CAAEF,SAAS,EAAG;IAClB;EACD;EAEAA,SAAS,CAACgB,KAAK,CAAC,CAAC;EAEjB,IAAK,IAAAC,0BAAiB,EAAEjB,SAAU,CAAC,EAAG;IACrC;IACA,IAAK,OAAOA,SAAS,CAACkB,cAAc,KAAK,QAAQ,EAAG;MACnD;IACD;IAEA,IAAKjB,SAAS,EAAG;MAChBD,SAAS,CAACkB,cAAc,GAAGlB,SAAS,CAACmB,KAAK,CAACC,MAAM;MACjDpB,SAAS,CAACqB,YAAY,GAAGrB,SAAS,CAACmB,KAAK,CAACC,MAAM;IAChD,CAAC,MAAM;MACNpB,SAAS,CAACkB,cAAc,GAAG,CAAC;MAC5BlB,SAAS,CAACqB,YAAY,GAAG,CAAC;IAC3B;IAEA;EACD;EAEA,IAAK,CAAErB,SAAS,CAACsB,iBAAiB,EAAG;IACpC;EACD;EAEA,MAAMC,KAAK,GAAG,IAAAC,gCAAe,EAAExB,SAAS,EAAEC,SAAS,EAAE,MACpDF,QAAQ,CAAEC,SAAS,EAAEC,SAAS,EAAEC,CAAE,CACnC,CAAC;EAED,IAAK,CAAEqB,KAAK,EAAG;IACd;EACD;EAEA,MAAM;IAAEpB;EAAc,CAAC,GAAGH,SAAS;EACnC,MAAM;IAAEyB;EAAY,CAAC,GAAGtB,aAAa;EACrC,IAAAuB,gCAAe,EAAED,WAAW,EAAE,aAAc,CAAC;EAC7C,MAAME,SAAS,GAAGF,WAAW,CAACG,YAAY,CAAC,CAAC;EAC5C,IAAAF,gCAAe,EAAEC,SAAS,EAAE,WAAY,CAAC;EACzCA,SAAS,CAACE,eAAe,CAAC,CAAC;EAC3BF,SAAS,CAACG,QAAQ,CAAEP,KAAM,CAAC;AAC5B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/place-caret-at-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport hiddenCaretRangeFromPoint from './hidden-caret-range-from-point';\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport isInputOrTextArea from './is-input-or-text-area';\nimport isRTL from './is-rtl';\nimport { scrollIfNoRange } from './scroll-if-no-range';\n\n/**\n * Gets the range to place.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n *\n * @return {Range|null} The range to place.\n */\nfunction getRange( container, isReverse, x ) {\n\tconst { ownerDocument } = container;\n\t// In the case of RTL scripts, the horizontal edge is at the opposite side.\n\tconst isReverseDir = isRTL( container ) ? ! isReverse : isReverse;\n\tconst containerRect = container.getBoundingClientRect();\n\t// When placing at the end (isReverse), find the closest range to the bottom\n\t// right corner. When placing at the start, to the top left corner.\n\t// Ensure x is defined and within the container's boundaries. When it's\n\t// exactly at the boundary, it's not considered within the boundaries.\n\tif ( x === undefined ) {\n\t\tx = isReverse ? containerRect.right - 1 : containerRect.left + 1;\n\t} else if ( x <= containerRect.left ) {\n\t\tx = containerRect.left + 1;\n\t} else if ( x >= containerRect.right ) {\n\t\tx = containerRect.right - 1;\n\t}\n\tconst y = isReverseDir ? containerRect.bottom - 1 : containerRect.top + 1;\n\treturn hiddenCaretRangeFromPoint( ownerDocument, x, y, container );\n}\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n * @param {number|undefined} x X coordinate to vertically position.\n */\nexport default function placeCaretAtEdge( container, isReverse, x ) {\n\tif ( ! container ) {\n\t\treturn;\n\t}\n\n\tcontainer.focus();\n\n\tif ( isInputOrTextArea( container ) ) {\n\t\t// The element may not support selection setting.\n\t\tif ( typeof container.selectionStart !== 'number' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isReverse ) {\n\t\t\tcontainer.selectionStart = container.value.length;\n\t\t\tcontainer.selectionEnd = container.value.length;\n\t\t} else {\n\t\t\tcontainer.selectionStart = 0;\n\t\t\tcontainer.selectionEnd = 0;\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif ( ! container.isContentEditable ) {\n\t\treturn;\n\t}\n\n\tconst range = scrollIfNoRange( container, isReverse, () =>\n\t\tgetRange( container, isReverse, x )\n\t);\n\n\tif ( ! range ) {\n\t\treturn;\n\t}\n\n\tconst { ownerDocument } = container;\n\tconst { defaultView } = ownerDocument;\n\tassertIsDefined( defaultView, 'defaultView' );\n\tconst selection = defaultView.getSelection();\n\tassertIsDefined( selection, 'selection' );\n\tselection.removeAllRanges();\n\tselection.addRange( range );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,2CAAsC;AACtC,+BAAgC;AAChC,mCAA8B;AAC9B,oBAAkB;AAClB,gCAAgC;AAWhC,SAAS,SAAU,WAAW,WAAW,GAAI;AAC5C,QAAM,EAAE,cAAc,IAAI;AAE1B,QAAM,mBAAe,cAAAA,SAAO,SAAU,IAAI,CAAE,YAAY;AACxD,QAAM,gBAAgB,UAAU,sBAAsB;AAKtD,MAAK,MAAM,QAAY;AACtB,QAAI,YAAY,cAAc,QAAQ,IAAI,cAAc,OAAO;AAAA,EAChE,WAAY,KAAK,cAAc,MAAO;AACrC,QAAI,cAAc,OAAO;AAAA,EAC1B,WAAY,KAAK,cAAc,OAAQ;AACtC,QAAI,cAAc,QAAQ;AAAA,EAC3B;AACA,QAAM,IAAI,eAAe,cAAc,SAAS,IAAI,cAAc,MAAM;AACxE,aAAO,qCAAAC,SAA2B,eAAe,GAAG,GAAG,SAAU;AAClE;AASe,SAAR,iBAAmC,WAAW,WAAW,GAAI;AACnE,MAAK,CAAE,WAAY;AAClB;AAAA,EACD;AAEA,YAAU,MAAM;AAEhB,UAAK,6BAAAC,SAAmB,SAAU,GAAI;AAErC,QAAK,OAAO,UAAU,mBAAmB,UAAW;AACnD;AAAA,IACD;AAEA,QAAK,WAAY;AAChB,gBAAU,iBAAiB,UAAU,MAAM;AAC3C,gBAAU,eAAe,UAAU,MAAM;AAAA,IAC1C,OAAO;AACN,gBAAU,iBAAiB;AAC3B,gBAAU,eAAe;AAAA,IAC1B;AAEA;AAAA,EACD;AAEA,MAAK,CAAE,UAAU,mBAAoB;AACpC;AAAA,EACD;AAEA,QAAM,YAAQ;AAAA,IAAiB;AAAA,IAAW;AAAA,IAAW,MACpD,SAAU,WAAW,WAAW,CAAE;AAAA,EACnC;AAEA,MAAK,CAAE,OAAQ;AACd;AAAA,EACD;AAEA,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,EAAE,YAAY,IAAI;AACxB,gDAAiB,aAAa,aAAc;AAC5C,QAAM,YAAY,YAAY,aAAa;AAC3C,gDAAiB,WAAW,WAAY;AACxC,YAAU,gBAAgB;AAC1B,YAAU,SAAU,KAAM;AAC3B;",
6
+ "names": ["isRTL", "hiddenCaretRangeFromPoint", "isInputOrTextArea"]
7
+ }
@@ -1,22 +1,38 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ 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
+ 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;
19
+ };
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
+ var place_caret_at_horizontal_edge_exports = {};
30
+ __export(place_caret_at_horizontal_edge_exports, {
31
+ default: () => placeCaretAtHorizontalEdge
6
32
  });
7
- exports.default = placeCaretAtHorizontalEdge;
8
- var _placeCaretAtEdge = _interopRequireDefault(require("./place-caret-at-edge"));
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- /**
14
- * Places the caret at start or end of a given element.
15
- *
16
- * @param {HTMLElement} container Focusable element.
17
- * @param {boolean} isReverse True for end, false for start.
18
- */
33
+ module.exports = __toCommonJS(place_caret_at_horizontal_edge_exports);
34
+ var import_place_caret_at_edge = __toESM(require("./place-caret-at-edge"));
19
35
  function placeCaretAtHorizontalEdge(container, isReverse) {
20
- return (0, _placeCaretAtEdge.default)(container, isReverse, undefined);
36
+ return (0, import_place_caret_at_edge.default)(container, isReverse, void 0);
21
37
  }
22
- //# sourceMappingURL=place-caret-at-horizontal-edge.js.map
38
+ //# sourceMappingURL=place-caret-at-horizontal-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_placeCaretAtEdge","_interopRequireDefault","require","placeCaretAtHorizontalEdge","container","isReverse","placeCaretAtEdge","undefined"],"sources":["@wordpress/dom/src/dom/place-caret-at-horizontal-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n */\nexport default function placeCaretAtHorizontalEdge( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,0BAA0BA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EAC1E,OAAO,IAAAC,yBAAgB,EAAEF,SAAS,EAAEC,SAAS,EAAEE,SAAU,CAAC;AAC3D","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/place-caret-at-horizontal-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at start or end of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for end, false for start.\n */\nexport default function placeCaretAtHorizontalEdge( container, isReverse ) {\n\treturn placeCaretAtEdge( container, isReverse, undefined );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAA6B;AAQd,SAAR,2BAA6C,WAAW,WAAY;AAC1E,aAAO,2BAAAA,SAAkB,WAAW,WAAW,MAAU;AAC1D;",
6
+ "names": ["placeCaretAtEdge"]
7
+ }
@@ -1,23 +1,38 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ 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
+ 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;
19
+ };
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
+ var place_caret_at_vertical_edge_exports = {};
30
+ __export(place_caret_at_vertical_edge_exports, {
31
+ default: () => placeCaretAtVerticalEdge
6
32
  });
7
- exports.default = placeCaretAtVerticalEdge;
8
- var _placeCaretAtEdge = _interopRequireDefault(require("./place-caret-at-edge"));
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- /**
14
- * Places the caret at the top or bottom of a given element.
15
- *
16
- * @param {HTMLElement} container Focusable element.
17
- * @param {boolean} isReverse True for bottom, false for top.
18
- * @param {DOMRect} [rect] The rectangle to position the caret with.
19
- */
33
+ module.exports = __toCommonJS(place_caret_at_vertical_edge_exports);
34
+ var import_place_caret_at_edge = __toESM(require("./place-caret-at-edge"));
20
35
  function placeCaretAtVerticalEdge(container, isReverse, rect) {
21
- return (0, _placeCaretAtEdge.default)(container, isReverse, rect?.left);
36
+ return (0, import_place_caret_at_edge.default)(container, isReverse, rect?.left);
22
37
  }
23
- //# sourceMappingURL=place-caret-at-vertical-edge.js.map
38
+ //# sourceMappingURL=place-caret-at-vertical-edge.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_placeCaretAtEdge","_interopRequireDefault","require","placeCaretAtVerticalEdge","container","isReverse","rect","placeCaretAtEdge","left"],"sources":["@wordpress/dom/src/dom/place-caret-at-vertical-edge.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,wBAAwBA,CAAEC,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAG;EAC9E,OAAO,IAAAC,yBAAgB,EAAEH,SAAS,EAAEC,SAAS,EAAEC,IAAI,EAAEE,IAAK,CAAC;AAC5D","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/place-caret-at-vertical-edge.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport placeCaretAtEdge from './place-caret-at-edge';\n\n/**\n * Places the caret at the top or bottom of a given element.\n *\n * @param {HTMLElement} container Focusable element.\n * @param {boolean} isReverse True for bottom, false for top.\n * @param {DOMRect} [rect] The rectangle to position the caret with.\n */\nexport default function placeCaretAtVerticalEdge( container, isReverse, rect ) {\n\treturn placeCaretAtEdge( container, isReverse, rect?.left );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iCAA6B;AASd,SAAR,yBAA2C,WAAW,WAAW,MAAO;AAC9E,aAAO,2BAAAA,SAAkB,WAAW,WAAW,MAAM,IAAK;AAC3D;",
6
+ "names": ["placeCaretAtEdge"]
7
+ }
@@ -1,28 +1,41 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ 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
+ 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;
19
+ };
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
+ var remove_invalid_html_exports = {};
30
+ __export(remove_invalid_html_exports, {
31
+ default: () => removeInvalidHTML
6
32
  });
7
- exports.default = removeInvalidHTML;
8
- var _cleanNodeList = _interopRequireDefault(require("./clean-node-list"));
9
- /**
10
- * Internal dependencies
11
- */
12
-
13
- /**
14
- * Given a schema, unwraps or removes nodes, attributes and classes on HTML.
15
- *
16
- * @param {string} HTML The HTML to clean up.
17
- * @param {import('./clean-node-list').Schema} schema Schema for the HTML.
18
- * @param {boolean} inline Whether to clean for inline mode.
19
- *
20
- * @return {string} The cleaned up HTML.
21
- */
33
+ module.exports = __toCommonJS(remove_invalid_html_exports);
34
+ var import_clean_node_list = __toESM(require("./clean-node-list"));
22
35
  function removeInvalidHTML(HTML, schema, inline) {
23
- const doc = document.implementation.createHTMLDocument('');
36
+ const doc = document.implementation.createHTMLDocument("");
24
37
  doc.body.innerHTML = HTML;
25
- (0, _cleanNodeList.default)(doc.body.childNodes, doc, schema, inline);
38
+ (0, import_clean_node_list.default)(doc.body.childNodes, doc, schema, inline);
26
39
  return doc.body.innerHTML;
27
40
  }
28
- //# sourceMappingURL=remove-invalid-html.js.map
41
+ //# sourceMappingURL=remove-invalid-html.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_cleanNodeList","_interopRequireDefault","require","removeInvalidHTML","HTML","schema","inline","doc","document","implementation","createHTMLDocument","body","innerHTML","cleanNodeList","childNodes"],"sources":["@wordpress/dom/src/dom/remove-invalid-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport cleanNodeList from './clean-node-list';\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on HTML.\n *\n * @param {string} HTML The HTML to clean up.\n * @param {import('./clean-node-list').Schema} schema Schema for the HTML.\n * @param {boolean} inline Whether to clean for inline mode.\n *\n * @return {string} The cleaned up HTML.\n */\nexport default function removeInvalidHTML( HTML, schema, inline ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\n\tdoc.body.innerHTML = HTML;\n\n\tcleanNodeList( doc.body.childNodes, doc, schema, inline );\n\n\treturn doc.body.innerHTML;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,iBAAiBA,CAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,EAAG;EACjE,MAAMC,GAAG,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EAE5DH,GAAG,CAACI,IAAI,CAACC,SAAS,GAAGR,IAAI;EAEzB,IAAAS,sBAAa,EAAEN,GAAG,CAACI,IAAI,CAACG,UAAU,EAAEP,GAAG,EAAEF,MAAM,EAAEC,MAAO,CAAC;EAEzD,OAAOC,GAAG,CAACI,IAAI,CAACC,SAAS;AAC1B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/remove-invalid-html.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport cleanNodeList from './clean-node-list';\n\n/**\n * Given a schema, unwraps or removes nodes, attributes and classes on HTML.\n *\n * @param {string} HTML The HTML to clean up.\n * @param {import('./clean-node-list').Schema} schema Schema for the HTML.\n * @param {boolean} inline Whether to clean for inline mode.\n *\n * @return {string} The cleaned up HTML.\n */\nexport default function removeInvalidHTML( HTML, schema, inline ) {\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\n\tdoc.body.innerHTML = HTML;\n\n\tcleanNodeList( doc.body.childNodes, doc, schema, inline );\n\n\treturn doc.body.innerHTML;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,6BAA0B;AAWX,SAAR,kBAAoC,MAAM,QAAQ,QAAS;AACjE,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAE3D,MAAI,KAAK,YAAY;AAErB,6BAAAA,SAAe,IAAI,KAAK,YAAY,KAAK,QAAQ,MAAO;AAExD,SAAO,IAAI,KAAK;AACjB;",
6
+ "names": ["cleanNodeList"]
7
+ }
@@ -1,22 +1,29 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
+ var remove_exports = {};
20
+ __export(remove_exports, {
21
+ default: () => remove
5
22
  });
6
- exports.default = remove;
7
- var _assertIsDefined = require("../utils/assert-is-defined");
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- /**
13
- * Given a DOM node, removes it from the DOM.
14
- *
15
- * @param {Node} node Node to be removed.
16
- * @return {void}
17
- */
23
+ module.exports = __toCommonJS(remove_exports);
24
+ var import_assert_is_defined = require("../utils/assert-is-defined");
18
25
  function remove(node) {
19
- (0, _assertIsDefined.assertIsDefined)(node.parentNode, 'node.parentNode');
26
+ (0, import_assert_is_defined.assertIsDefined)(node.parentNode, "node.parentNode");
20
27
  node.parentNode.removeChild(node);
21
28
  }
22
- //# sourceMappingURL=remove.js.map
29
+ //# sourceMappingURL=remove.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_assertIsDefined","require","remove","node","assertIsDefined","parentNode","removeChild"],"sources":["@wordpress/dom/src/dom/remove.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param {Node} node Node to be removed.\n * @return {void}\n */\nexport default function remove( node ) {\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.removeChild( node );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,MAAMA,CAAEC,IAAI,EAAG;EACtC,IAAAC,gCAAe,EAAED,IAAI,CAACE,UAAU,EAAE,iBAAkB,CAAC;EACrDF,IAAI,CAACE,UAAU,CAACC,WAAW,CAAEH,IAAK,CAAC;AACpC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/remove.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Given a DOM node, removes it from the DOM.\n *\n * @param {Node} node Node to be removed.\n * @return {void}\n */\nexport default function remove( node ) {\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.removeChild( node );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAQjB,SAAR,OAAyB,MAAO;AACtC,gDAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,YAAa,IAAK;AACnC;",
6
+ "names": []
7
+ }
@@ -1,29 +1,34 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
+ var replace_tag_exports = {};
20
+ __export(replace_tag_exports, {
21
+ default: () => replaceTag
5
22
  });
6
- exports.default = replaceTag;
7
- var _assertIsDefined = require("../utils/assert-is-defined");
8
- /**
9
- * Internal dependencies
10
- */
11
-
12
- /**
13
- * Replaces the given node with a new node with the given tag name.
14
- *
15
- * @param {Element} node The node to replace
16
- * @param {string} tagName The new tag name.
17
- *
18
- * @return {Element} The new node.
19
- */
23
+ module.exports = __toCommonJS(replace_tag_exports);
24
+ var import_assert_is_defined = require("../utils/assert-is-defined");
20
25
  function replaceTag(node, tagName) {
21
26
  const newNode = node.ownerDocument.createElement(tagName);
22
27
  while (node.firstChild) {
23
28
  newNode.appendChild(node.firstChild);
24
29
  }
25
- (0, _assertIsDefined.assertIsDefined)(node.parentNode, 'node.parentNode');
30
+ (0, import_assert_is_defined.assertIsDefined)(node.parentNode, "node.parentNode");
26
31
  node.parentNode.replaceChild(newNode, node);
27
32
  return newNode;
28
33
  }
29
- //# sourceMappingURL=replace-tag.js.map
34
+ //# sourceMappingURL=replace-tag.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_assertIsDefined","require","replaceTag","node","tagName","newNode","ownerDocument","createElement","firstChild","appendChild","assertIsDefined","parentNode","replaceChild"],"sources":["@wordpress/dom/src/dom/replace-tag.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAAEC,IAAI,EAAEC,OAAO,EAAG;EACnD,MAAMC,OAAO,GAAGF,IAAI,CAACG,aAAa,CAACC,aAAa,CAAEH,OAAQ,CAAC;EAE3D,OAAQD,IAAI,CAACK,UAAU,EAAG;IACzBH,OAAO,CAACI,WAAW,CAAEN,IAAI,CAACK,UAAW,CAAC;EACvC;EAEA,IAAAE,gCAAe,EAAEP,IAAI,CAACQ,UAAU,EAAE,iBAAkB,CAAC;EACrDR,IAAI,CAACQ,UAAU,CAACC,YAAY,CAAEP,OAAO,EAAEF,IAAK,CAAC;EAE7C,OAAOE,OAAO;AACf","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/replace-tag.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Replaces the given node with a new node with the given tag name.\n *\n * @param {Element} node The node to replace\n * @param {string} tagName The new tag name.\n *\n * @return {Element} The new node.\n */\nexport default function replaceTag( node, tagName ) {\n\tconst newNode = node.ownerDocument.createElement( tagName );\n\n\twhile ( node.firstChild ) {\n\t\tnewNode.appendChild( node.firstChild );\n\t}\n\n\tassertIsDefined( node.parentNode, 'node.parentNode' );\n\tnode.parentNode.replaceChild( newNode, node );\n\n\treturn newNode;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,+BAAgC;AAUjB,SAAR,WAA6B,MAAM,SAAU;AACnD,QAAM,UAAU,KAAK,cAAc,cAAe,OAAQ;AAE1D,SAAQ,KAAK,YAAa;AACzB,YAAQ,YAAa,KAAK,UAAW;AAAA,EACtC;AAEA,gDAAiB,KAAK,YAAY,iBAAkB;AACpD,OAAK,WAAW,aAAc,SAAS,IAAK;AAE5C,SAAO;AACR;",
6
+ "names": []
7
+ }