@wordpress/dom 3.38.0 → 3.40.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 (202) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +2 -2
  3. package/build/data-transfer.js +0 -2
  4. package/build/data-transfer.js.map +1 -1
  5. package/build/dom/caret-range-from-point.js +3 -5
  6. package/build/dom/caret-range-from-point.js.map +1 -1
  7. package/build/dom/clean-node-list.js +25 -42
  8. package/build/dom/clean-node-list.js.map +1 -1
  9. package/build/dom/compute-caret-rect.js +0 -6
  10. package/build/dom/compute-caret-rect.js.map +1 -1
  11. package/build/dom/document-has-selection.js +0 -5
  12. package/build/dom/document-has-selection.js.map +1 -1
  13. package/build/dom/document-has-text-selection.js +0 -2
  14. package/build/dom/document-has-text-selection.js.map +1 -1
  15. package/build/dom/document-has-uncollapsed-selection.js +0 -4
  16. package/build/dom/document-has-uncollapsed-selection.js.map +1 -1
  17. package/build/dom/get-computed-style.js +0 -3
  18. package/build/dom/get-computed-style.js.map +1 -1
  19. package/build/dom/get-offset-parent.js +8 -19
  20. package/build/dom/get-offset-parent.js.map +1 -1
  21. package/build/dom/get-range-height.js +0 -3
  22. package/build/dom/get-range-height.js.map +1 -1
  23. package/build/dom/get-rectangle-from-range.js +15 -22
  24. package/build/dom/get-rectangle-from-range.js.map +1 -1
  25. package/build/dom/get-scroll-container.js +3 -13
  26. package/build/dom/get-scroll-container.js.map +1 -1
  27. package/build/dom/hidden-caret-range-from-point.js +2 -6
  28. package/build/dom/hidden-caret-range-from-point.js.map +1 -1
  29. package/build/dom/index.js +0 -27
  30. package/build/dom/index.js.map +1 -1
  31. package/build/dom/input-field-has-uncollapsed-selection.js +8 -12
  32. package/build/dom/input-field-has-uncollapsed-selection.js.map +1 -1
  33. package/build/dom/insert-after.js +0 -2
  34. package/build/dom/insert-after.js.map +1 -1
  35. package/build/dom/is-edge.js +18 -40
  36. package/build/dom/is-edge.js.map +1 -1
  37. package/build/dom/is-element.js +0 -2
  38. package/build/dom/is-element.js.map +1 -1
  39. package/build/dom/is-empty.js +1 -7
  40. package/build/dom/is-empty.js.map +1 -1
  41. package/build/dom/is-entirely-selected.js +2 -18
  42. package/build/dom/is-entirely-selected.js.map +1 -1
  43. package/build/dom/is-form-element.js +0 -4
  44. package/build/dom/is-form-element.js.map +1 -1
  45. package/build/dom/is-horizontal-edge.js +2 -5
  46. package/build/dom/is-horizontal-edge.js.map +1 -1
  47. package/build/dom/is-html-input-element.js +0 -2
  48. package/build/dom/is-html-input-element.js.map +1 -1
  49. package/build/dom/is-input-or-text-area.js +0 -2
  50. package/build/dom/is-input-or-text-area.js.map +1 -1
  51. package/build/dom/is-number-input.js +0 -6
  52. package/build/dom/is-number-input.js.map +1 -1
  53. package/build/dom/is-rtl.js +0 -3
  54. package/build/dom/is-rtl.js.map +1 -1
  55. package/build/dom/is-selection-forward.js +6 -10
  56. package/build/dom/is-selection-forward.js.map +1 -1
  57. package/build/dom/is-text-field.js +1 -7
  58. package/build/dom/is-text-field.js.map +1 -1
  59. package/build/dom/is-vertical-edge.js +2 -5
  60. package/build/dom/is-vertical-edge.js.map +1 -1
  61. package/build/dom/place-caret-at-edge.js +8 -31
  62. package/build/dom/place-caret-at-edge.js.map +1 -1
  63. package/build/dom/place-caret-at-horizontal-edge.js +0 -3
  64. package/build/dom/place-caret-at-horizontal-edge.js.map +1 -1
  65. package/build/dom/place-caret-at-vertical-edge.js +0 -3
  66. package/build/dom/place-caret-at-vertical-edge.js.map +1 -1
  67. package/build/dom/remove-invalid-html.js +0 -3
  68. package/build/dom/remove-invalid-html.js.map +1 -1
  69. package/build/dom/remove.js +0 -2
  70. package/build/dom/remove.js.map +1 -1
  71. package/build/dom/replace-tag.js +0 -4
  72. package/build/dom/replace-tag.js.map +1 -1
  73. package/build/dom/replace.js +0 -5
  74. package/build/dom/replace.js.map +1 -1
  75. package/build/dom/safe-html.js +0 -8
  76. package/build/dom/safe-html.js.map +1 -1
  77. package/build/dom/scroll-if-no-range.js +31 -0
  78. package/build/dom/scroll-if-no-range.js.map +1 -0
  79. package/build/dom/strip-html.js +0 -3
  80. package/build/dom/strip-html.js.map +1 -1
  81. package/build/dom/unwrap.js +0 -4
  82. package/build/dom/unwrap.js.map +1 -1
  83. package/build/dom/wrap.js +0 -2
  84. package/build/dom/wrap.js.map +1 -1
  85. package/build/focusable.js +5 -18
  86. package/build/focusable.js.map +1 -1
  87. package/build/index.js +0 -11
  88. package/build/index.js.map +1 -1
  89. package/build/phrasing-content.js +13 -14
  90. package/build/phrasing-content.js.map +1 -1
  91. package/build/tabbable.js +21 -37
  92. package/build/tabbable.js.map +1 -1
  93. package/build/utils/assert-is-defined.js +0 -1
  94. package/build/utils/assert-is-defined.js.map +1 -1
  95. package/build-module/data-transfer.js +0 -1
  96. package/build-module/data-transfer.js.map +1 -1
  97. package/build-module/dom/caret-range-from-point.js +3 -4
  98. package/build-module/dom/caret-range-from-point.js.map +1 -1
  99. package/build-module/dom/clean-node-list.js +24 -35
  100. package/build-module/dom/clean-node-list.js.map +1 -1
  101. package/build-module/dom/compute-caret-rect.js +1 -3
  102. package/build-module/dom/compute-caret-rect.js.map +1 -1
  103. package/build-module/dom/document-has-selection.js +1 -1
  104. package/build-module/dom/document-has-selection.js.map +1 -1
  105. package/build-module/dom/document-has-text-selection.js +1 -1
  106. package/build-module/dom/document-has-text-selection.js.map +1 -1
  107. package/build-module/dom/document-has-uncollapsed-selection.js +1 -1
  108. package/build-module/dom/document-has-uncollapsed-selection.js.map +1 -1
  109. package/build-module/dom/get-computed-style.js +1 -2
  110. package/build-module/dom/get-computed-style.js.map +1 -1
  111. package/build-module/dom/get-offset-parent.js +9 -17
  112. package/build-module/dom/get-offset-parent.js.map +1 -1
  113. package/build-module/dom/get-range-height.js +0 -2
  114. package/build-module/dom/get-range-height.js.map +1 -1
  115. package/build-module/dom/get-rectangle-from-range.js +16 -21
  116. package/build-module/dom/get-rectangle-from-range.js.map +1 -1
  117. package/build-module/dom/get-scroll-container.js +4 -11
  118. package/build-module/dom/get-scroll-container.js.map +1 -1
  119. package/build-module/dom/hidden-caret-range-from-point.js +3 -3
  120. package/build-module/dom/hidden-caret-range-from-point.js.map +1 -1
  121. package/build-module/dom/index.js.map +1 -1
  122. package/build-module/dom/input-field-has-uncollapsed-selection.js +9 -9
  123. package/build-module/dom/input-field-has-uncollapsed-selection.js.map +1 -1
  124. package/build-module/dom/insert-after.js +1 -1
  125. package/build-module/dom/insert-after.js.map +1 -1
  126. package/build-module/dom/is-edge.js +19 -32
  127. package/build-module/dom/is-edge.js.map +1 -1
  128. package/build-module/dom/is-element.js +0 -1
  129. package/build-module/dom/is-element.js.map +1 -1
  130. package/build-module/dom/is-empty.js +1 -6
  131. package/build-module/dom/is-empty.js.map +1 -1
  132. package/build-module/dom/is-entirely-selected.js +3 -14
  133. package/build-module/dom/is-entirely-selected.js.map +1 -1
  134. package/build-module/dom/is-form-element.js +1 -2
  135. package/build-module/dom/is-form-element.js.map +1 -1
  136. package/build-module/dom/is-horizontal-edge.js +3 -3
  137. package/build-module/dom/is-horizontal-edge.js.map +1 -1
  138. package/build-module/dom/is-html-input-element.js +0 -1
  139. package/build-module/dom/is-html-input-element.js.map +1 -1
  140. package/build-module/dom/is-input-or-text-area.js +0 -1
  141. package/build-module/dom/is-input-or-text-area.js.map +1 -1
  142. package/build-module/dom/is-number-input.js +2 -4
  143. package/build-module/dom/is-number-input.js.map +1 -1
  144. package/build-module/dom/is-rtl.js +1 -1
  145. package/build-module/dom/is-rtl.js.map +1 -1
  146. package/build-module/dom/is-selection-forward.js +7 -9
  147. package/build-module/dom/is-selection-forward.js.map +1 -1
  148. package/build-module/dom/is-text-field.js +2 -5
  149. package/build-module/dom/is-text-field.js.map +1 -1
  150. package/build-module/dom/is-vertical-edge.js +3 -3
  151. package/build-module/dom/is-vertical-edge.js.map +1 -1
  152. package/build-module/dom/place-caret-at-edge.js +9 -26
  153. package/build-module/dom/place-caret-at-edge.js.map +1 -1
  154. package/build-module/dom/place-caret-at-horizontal-edge.js +1 -1
  155. package/build-module/dom/place-caret-at-horizontal-edge.js.map +1 -1
  156. package/build-module/dom/place-caret-at-vertical-edge.js +1 -1
  157. package/build-module/dom/place-caret-at-vertical-edge.js.map +1 -1
  158. package/build-module/dom/remove-invalid-html.js +1 -1
  159. package/build-module/dom/remove-invalid-html.js.map +1 -1
  160. package/build-module/dom/remove.js +1 -1
  161. package/build-module/dom/remove.js.map +1 -1
  162. package/build-module/dom/replace-tag.js +1 -3
  163. package/build-module/dom/replace-tag.js.map +1 -1
  164. package/build-module/dom/replace.js +1 -1
  165. package/build-module/dom/replace.js.map +1 -1
  166. package/build-module/dom/safe-html.js +1 -6
  167. package/build-module/dom/safe-html.js.map +1 -1
  168. package/build-module/dom/scroll-if-no-range.js +25 -0
  169. package/build-module/dom/scroll-if-no-range.js.map +1 -0
  170. package/build-module/dom/strip-html.js +1 -1
  171. package/build-module/dom/strip-html.js.map +1 -1
  172. package/build-module/dom/unwrap.js +1 -3
  173. package/build-module/dom/unwrap.js.map +1 -1
  174. package/build-module/dom/wrap.js +1 -1
  175. package/build-module/dom/wrap.js.map +1 -1
  176. package/build-module/focusable.js +5 -17
  177. package/build-module/focusable.js.map +1 -1
  178. package/build-module/index.js +1 -1
  179. package/build-module/index.js.map +1 -1
  180. package/build-module/phrasing-content.js +13 -11
  181. package/build-module/phrasing-content.js.map +1 -1
  182. package/build-module/tabbable.js +22 -33
  183. package/build-module/tabbable.js.map +1 -1
  184. package/build-module/utils/assert-is-defined.js.map +1 -1
  185. package/build-types/dom/is-edge.d.ts +4 -4
  186. package/build-types/dom/is-edge.d.ts.map +1 -1
  187. package/build-types/dom/is-horizontal-edge.d.ts +3 -3
  188. package/build-types/dom/is-horizontal-edge.d.ts.map +1 -1
  189. package/build-types/dom/is-vertical-edge.d.ts +3 -3
  190. package/build-types/dom/is-vertical-edge.d.ts.map +1 -1
  191. package/build-types/dom/place-caret-at-edge.d.ts.map +1 -1
  192. package/build-types/dom/scroll-if-no-range.d.ts +12 -0
  193. package/build-types/dom/scroll-if-no-range.d.ts.map +1 -0
  194. package/build-types/index.d.ts +2 -2
  195. package/build-types/index.d.ts.map +1 -1
  196. package/package.json +3 -3
  197. package/src/dom/is-edge.js +6 -8
  198. package/src/dom/is-horizontal-edge.js +2 -2
  199. package/src/dom/is-vertical-edge.js +2 -2
  200. package/src/dom/place-caret-at-edge.js +5 -19
  201. package/src/dom/scroll-if-no-range.js +34 -0
  202. package/tsconfig.tsbuildinfo +1 -1
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = placeCaretAtVerticalEdge;
9
-
10
8
  var _placeCaretAtEdge = _interopRequireDefault(require("./place-caret-at-edge"));
11
-
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/place-caret-at-vertical-edge.js"],"names":["placeCaretAtVerticalEdge","container","isReverse","rect","left"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,wBAAT,CAAmCC,SAAnC,EAA8CC,SAA9C,EAAyDC,IAAzD,EAAgE;AAC9E,SAAO,+BAAkBF,SAAlB,EAA6BC,SAA7B,EAAwCC,IAAI,EAAEC,IAA9C,CAAP;AACA","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"]}
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"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = removeInvalidHTML;
9
-
10
8
  var _cleanNodeList = _interopRequireDefault(require("./clean-node-list"));
11
-
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/remove-invalid-html.js"],"names":["removeInvalidHTML","HTML","schema","inline","doc","document","implementation","createHTMLDocument","body","innerHTML","childNodes"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,iBAAT,CAA4BC,IAA5B,EAAkCC,MAAlC,EAA0CC,MAA1C,EAAmD;AACjE,QAAMC,GAAG,GAAGC,QAAQ,CAACC,cAAT,CAAwBC,kBAAxB,CAA4C,EAA5C,CAAZ;AAEAH,EAAAA,GAAG,CAACI,IAAJ,CAASC,SAAT,GAAqBR,IAArB;AAEA,8BAAeG,GAAG,CAACI,IAAJ,CAASE,UAAxB,EAAoCN,GAApC,EAAyCF,MAAzC,EAAiDC,MAAjD;AAEA,SAAOC,GAAG,CAACI,IAAJ,CAASC,SAAhB;AACA","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"]}
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"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = remove;
7
-
8
7
  var _assertIsDefined = require("../utils/assert-is-defined");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/remove.js"],"names":["remove","node","parentNode","removeChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAT,CAAiBC,IAAjB,EAAwB;AACtC,wCAAiBA,IAAI,CAACC,UAAtB,EAAkC,iBAAlC;AACAD,EAAAA,IAAI,CAACC,UAAL,CAAgBC,WAAhB,CAA6BF,IAA7B;AACA","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"]}
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"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = replaceTag;
7
-
8
7
  var _assertIsDefined = require("../utils/assert-is-defined");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
@@ -21,11 +19,9 @@ var _assertIsDefined = require("../utils/assert-is-defined");
21
19
  */
22
20
  function replaceTag(node, tagName) {
23
21
  const newNode = node.ownerDocument.createElement(tagName);
24
-
25
22
  while (node.firstChild) {
26
23
  newNode.appendChild(node.firstChild);
27
24
  }
28
-
29
25
  (0, _assertIsDefined.assertIsDefined)(node.parentNode, 'node.parentNode');
30
26
  node.parentNode.replaceChild(newNode, node);
31
27
  return newNode;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/replace-tag.js"],"names":["replaceTag","node","tagName","newNode","ownerDocument","createElement","firstChild","appendChild","parentNode","replaceChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,UAAT,CAAqBC,IAArB,EAA2BC,OAA3B,EAAqC;AACnD,QAAMC,OAAO,GAAGF,IAAI,CAACG,aAAL,CAAmBC,aAAnB,CAAkCH,OAAlC,CAAhB;;AAEA,SAAQD,IAAI,CAACK,UAAb,EAA0B;AACzBH,IAAAA,OAAO,CAACI,WAAR,CAAqBN,IAAI,CAACK,UAA1B;AACA;;AAED,wCAAiBL,IAAI,CAACO,UAAtB,EAAkC,iBAAlC;AACAP,EAAAA,IAAI,CAACO,UAAL,CAAgBC,YAAhB,CAA8BN,OAA9B,EAAuCF,IAAvC;AAEA,SAAOE,OAAP;AACA","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"]}
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"}
@@ -1,18 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = replace;
9
-
10
8
  var _assertIsDefined = require("../utils/assert-is-defined");
11
-
12
9
  var _insertAfter = _interopRequireDefault(require("./insert-after"));
13
-
14
10
  var _remove = _interopRequireDefault(require("./remove"));
15
-
16
11
  /**
17
12
  * Internal dependencies
18
13
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/replace.js"],"names":["replace","processedNode","newNode","parentNode"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,OAAT,CAAkBC,aAAlB,EAAiCC,OAAjC,EAA2C;AACzD,wCAAiBD,aAAa,CAACE,UAA/B,EAA2C,0BAA3C;AACA,4BAAaD,OAAb,EAAsBD,aAAa,CAACE,UAApC;AACA,uBAAQF,aAAR;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"]}
1
+ {"version":3,"names":["_assertIsDefined","require","_insertAfter","_interopRequireDefault","_remove","replace","processedNode","newNode","assertIsDefined","parentNode","insertAfter","remove"],"sources":["@wordpress/dom/src/dom/replace.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\nimport insertAfter from './insert-after';\nimport remove from './remove';\n\n/**\n * Given two DOM nodes, replaces the former with the latter in the DOM.\n *\n * @param {Element} processedNode Node to be removed.\n * @param {Element} newNode Node to be inserted in its place.\n * @return {void}\n */\nexport default function replace( processedNode, newNode ) {\n\tassertIsDefined( processedNode.parentNode, 'processedNode.parentNode' );\n\tinsertAfter( newNode, processedNode.parentNode );\n\tremove( processedNode );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASI,OAAOA,CAAEC,aAAa,EAAEC,OAAO,EAAG;EACzD,IAAAC,gCAAe,EAAEF,aAAa,CAACG,UAAU,EAAE,0BAA2B,CAAC;EACvE,IAAAC,oBAAW,EAAEH,OAAO,EAAED,aAAa,CAACG,UAAW,CAAC;EAChD,IAAAE,eAAM,EAAEL,aAAc,CAAC;AACxB"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = safeHTML;
9
-
10
8
  var _remove = _interopRequireDefault(require("./remove"));
11
-
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
@@ -27,27 +24,22 @@ function safeHTML(html) {
27
24
  body.innerHTML = html;
28
25
  const elements = body.getElementsByTagName('*');
29
26
  let elementIndex = elements.length;
30
-
31
27
  while (elementIndex--) {
32
28
  const element = elements[elementIndex];
33
-
34
29
  if (element.tagName === 'SCRIPT') {
35
30
  (0, _remove.default)(element);
36
31
  } else {
37
32
  let attributeIndex = element.attributes.length;
38
-
39
33
  while (attributeIndex--) {
40
34
  const {
41
35
  name: key
42
36
  } = element.attributes[attributeIndex];
43
-
44
37
  if (key.startsWith('on')) {
45
38
  element.removeAttribute(key);
46
39
  }
47
40
  }
48
41
  }
49
42
  }
50
-
51
43
  return body.innerHTML;
52
44
  }
53
45
  //# sourceMappingURL=safe-html.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/safe-html.js"],"names":["safeHTML","html","body","document","implementation","createHTMLDocument","innerHTML","elements","getElementsByTagName","elementIndex","length","element","tagName","attributeIndex","attributes","name","key","startsWith","removeAttribute"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,QAAT,CAAmBC,IAAnB,EAA0B;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAWC,QAAQ,CAACC,cAAT,CAAwBC,kBAAxB,CAA4C,EAA5C,CAAjB;AACAH,EAAAA,IAAI,CAACI,SAAL,GAAiBL,IAAjB;AACA,QAAMM,QAAQ,GAAGL,IAAI,CAACM,oBAAL,CAA2B,GAA3B,CAAjB;AACA,MAAIC,YAAY,GAAGF,QAAQ,CAACG,MAA5B;;AAEA,SAAQD,YAAY,EAApB,EAAyB;AACxB,UAAME,OAAO,GAAGJ,QAAQ,CAAEE,YAAF,CAAxB;;AAEA,QAAKE,OAAO,CAACC,OAAR,KAAoB,QAAzB,EAAoC;AACnC,2BAAQD,OAAR;AACA,KAFD,MAEO;AACN,UAAIE,cAAc,GAAGF,OAAO,CAACG,UAAR,CAAmBJ,MAAxC;;AAEA,aAAQG,cAAc,EAAtB,EAA2B;AAC1B,cAAM;AAAEE,UAAAA,IAAI,EAAEC;AAAR,YAAgBL,OAAO,CAACG,UAAR,CAAoBD,cAApB,CAAtB;;AAEA,YAAKG,GAAG,CAACC,UAAJ,CAAgB,IAAhB,CAAL,EAA8B;AAC7BN,UAAAA,OAAO,CAACO,eAAR,CAAyBF,GAAzB;AACA;AACD;AACD;AACD;;AAED,SAAOd,IAAI,CAACI,SAAZ;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"]}
1
+ {"version":3,"names":["_remove","_interopRequireDefault","require","safeHTML","html","body","document","implementation","createHTMLDocument","innerHTML","elements","getElementsByTagName","elementIndex","length","element","tagName","remove","attributeIndex","attributes","name","key","startsWith","removeAttribute"],"sources":["@wordpress/dom/src/dom/safe-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport remove from './remove';\n\n/**\n * Strips scripts and on* attributes from HTML.\n *\n * @param {string} html HTML to sanitize.\n *\n * @return {string} The sanitized HTML.\n */\nexport default function safeHTML( html ) {\n\tconst { body } = document.implementation.createHTMLDocument( '' );\n\tbody.innerHTML = html;\n\tconst elements = body.getElementsByTagName( '*' );\n\tlet elementIndex = elements.length;\n\n\twhile ( elementIndex-- ) {\n\t\tconst element = elements[ elementIndex ];\n\n\t\tif ( element.tagName === 'SCRIPT' ) {\n\t\t\tremove( element );\n\t\t} else {\n\t\t\tlet attributeIndex = element.attributes.length;\n\n\t\t\twhile ( attributeIndex-- ) {\n\t\t\t\tconst { name: key } = element.attributes[ attributeIndex ];\n\n\t\t\t\tif ( key.startsWith( 'on' ) ) {\n\t\t\t\t\telement.removeAttribute( key );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn body.innerHTML;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,QAAQA,CAAEC,IAAI,EAAG;EACxC,MAAM;IAAEC;EAAK,CAAC,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EACjEH,IAAI,CAACI,SAAS,GAAGL,IAAI;EACrB,MAAMM,QAAQ,GAAGL,IAAI,CAACM,oBAAoB,CAAE,GAAI,CAAC;EACjD,IAAIC,YAAY,GAAGF,QAAQ,CAACG,MAAM;EAElC,OAAQD,YAAY,EAAE,EAAG;IACxB,MAAME,OAAO,GAAGJ,QAAQ,CAAEE,YAAY,CAAE;IAExC,IAAKE,OAAO,CAACC,OAAO,KAAK,QAAQ,EAAG;MACnC,IAAAC,eAAM,EAAEF,OAAQ,CAAC;IAClB,CAAC,MAAM;MACN,IAAIG,cAAc,GAAGH,OAAO,CAACI,UAAU,CAACL,MAAM;MAE9C,OAAQI,cAAc,EAAE,EAAG;QAC1B,MAAM;UAAEE,IAAI,EAAEC;QAAI,CAAC,GAAGN,OAAO,CAACI,UAAU,CAAED,cAAc,CAAE;QAE1D,IAAKG,GAAG,CAACC,UAAU,CAAE,IAAK,CAAC,EAAG;UAC7BP,OAAO,CAACQ,eAAe,CAAEF,GAAI,CAAC;QAC/B;MACD;IACD;EACD;EAEA,OAAOf,IAAI,CAACI,SAAS;AACtB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scrollIfNoRange = scrollIfNoRange;
7
+ /**
8
+ * If no range range can be created or it is outside the container, the element
9
+ * may be out of view, so scroll it into view and try again.
10
+ *
11
+ * @param {HTMLElement} container The container to scroll.
12
+ * @param {boolean} alignToTop True to align to top, false to bottom.
13
+ * @param {Function} callback The callback to create the range.
14
+ *
15
+ * @return {?Range} The range returned by the callback.
16
+ */
17
+ function scrollIfNoRange(container, alignToTop, callback) {
18
+ let range = callback();
19
+
20
+ // If no range range can be created or it is outside the container, the
21
+ // element may be out of view.
22
+ if (!range || !range.startContainer || !container.contains(range.startContainer)) {
23
+ container.scrollIntoView(alignToTop);
24
+ range = callback();
25
+ if (!range || !range.startContainer || !container.contains(range.startContainer)) {
26
+ return null;
27
+ }
28
+ }
29
+ return range;
30
+ }
31
+ //# sourceMappingURL=scroll-if-no-range.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["scrollIfNoRange","container","alignToTop","callback","range","startContainer","contains","scrollIntoView"],"sources":["@wordpress/dom/src/dom/scroll-if-no-range.js"],"sourcesContent":["/**\n * If no range range can be created or it is outside the container, the element\n * may be out of view, so scroll it into view and try again.\n *\n * @param {HTMLElement} container The container to scroll.\n * @param {boolean} alignToTop True to align to top, false to bottom.\n * @param {Function} callback The callback to create the range.\n *\n * @return {?Range} The range returned by the callback.\n */\nexport function scrollIfNoRange( container, alignToTop, callback ) {\n\tlet range = callback();\n\n\t// If no range range can be created or it is outside the container, the\n\t// element may be out of view.\n\tif (\n\t\t! range ||\n\t\t! range.startContainer ||\n\t\t! container.contains( range.startContainer )\n\t) {\n\t\tcontainer.scrollIntoView( alignToTop );\n\t\trange = callback();\n\n\t\tif (\n\t\t\t! range ||\n\t\t\t! range.startContainer ||\n\t\t\t! container.contains( range.startContainer )\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t}\n\n\treturn range;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,eAAeA,CAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAG;EAClE,IAAIC,KAAK,GAAGD,QAAQ,CAAC,CAAC;;EAEtB;EACA;EACA,IACC,CAAEC,KAAK,IACP,CAAEA,KAAK,CAACC,cAAc,IACtB,CAAEJ,SAAS,CAACK,QAAQ,CAAEF,KAAK,CAACC,cAAe,CAAC,EAC3C;IACDJ,SAAS,CAACM,cAAc,CAAEL,UAAW,CAAC;IACtCE,KAAK,GAAGD,QAAQ,CAAC,CAAC;IAElB,IACC,CAAEC,KAAK,IACP,CAAEA,KAAK,CAACC,cAAc,IACtB,CAAEJ,SAAS,CAACK,QAAQ,CAAEF,KAAK,CAACC,cAAe,CAAC,EAC3C;MACD,OAAO,IAAI;IACZ;EACD;EAEA,OAAOD,KAAK;AACb"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = stripHTML;
9
-
10
8
  var _safeHtml = _interopRequireDefault(require("./safe-html"));
11
-
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/strip-html.js"],"names":["stripHTML","html","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,SAAT,CAAoBC,IAApB,EAA2B;AACzC;AACA;AACAA,EAAAA,IAAI,GAAG,uBAAUA,IAAV,CAAP;AAEA,QAAMC,GAAG,GAAGC,QAAQ,CAACC,cAAT,CAAwBC,kBAAxB,CAA4C,EAA5C,CAAZ;AACAH,EAAAA,GAAG,CAACI,IAAJ,CAASC,SAAT,GAAqBN,IAArB;AACA,SAAOC,GAAG,CAACI,IAAJ,CAASE,WAAT,IAAwB,EAA/B;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param {string} html The string containing html.\n *\n * @return {string} The text content with any html removed.\n */\nexport default function stripHTML( html ) {\n\t// Remove any script tags or on* attributes otherwise their *contents* will be left\n\t// in place following removal of HTML tags.\n\thtml = safeHTML( html );\n\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n"]}
1
+ {"version":3,"names":["_safeHtml","_interopRequireDefault","require","stripHTML","html","safeHTML","doc","document","implementation","createHTMLDocument","body","innerHTML","textContent"],"sources":["@wordpress/dom/src/dom/strip-html.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport safeHTML from './safe-html';\n\n/**\n * Removes any HTML tags from the provided string.\n *\n * @param {string} html The string containing html.\n *\n * @return {string} The text content with any html removed.\n */\nexport default function stripHTML( html ) {\n\t// Remove any script tags or on* attributes otherwise their *contents* will be left\n\t// in place following removal of HTML tags.\n\thtml = safeHTML( html );\n\n\tconst doc = document.implementation.createHTMLDocument( '' );\n\tdoc.body.innerHTML = html;\n\treturn doc.body.textContent || '';\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA;EACAA,IAAI,GAAG,IAAAC,iBAAQ,EAAED,IAAK,CAAC;EAEvB,MAAME,GAAG,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EAC5DH,GAAG,CAACI,IAAI,CAACC,SAAS,GAAGP,IAAI;EACzB,OAAOE,GAAG,CAACI,IAAI,CAACE,WAAW,IAAI,EAAE;AAClC"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = unwrap;
7
-
8
7
  var _assertIsDefined = require("../utils/assert-is-defined");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
@@ -21,11 +19,9 @@ var _assertIsDefined = require("../utils/assert-is-defined");
21
19
  function unwrap(node) {
22
20
  const parent = node.parentNode;
23
21
  (0, _assertIsDefined.assertIsDefined)(parent, 'node.parentNode');
24
-
25
22
  while (node.firstChild) {
26
23
  parent.insertBefore(node.firstChild, node);
27
24
  }
28
-
29
25
  parent.removeChild(node);
30
26
  }
31
27
  //# sourceMappingURL=unwrap.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/unwrap.js"],"names":["unwrap","node","parent","parentNode","firstChild","insertBefore","removeChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,MAAT,CAAiBC,IAAjB,EAAwB;AACtC,QAAMC,MAAM,GAAGD,IAAI,CAACE,UAApB;AAEA,wCAAiBD,MAAjB,EAAyB,iBAAzB;;AAEA,SAAQD,IAAI,CAACG,UAAb,EAA0B;AACzBF,IAAAA,MAAM,CAACG,YAAP,CAAqBJ,IAAI,CAACG,UAA1B,EAAsCH,IAAtC;AACA;;AAEDC,EAAAA,MAAM,CAACI,WAAP,CAAoBL,IAApB;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param {Node} node The node to unwrap.\n *\n * @return {void}\n */\nexport default function unwrap( node ) {\n\tconst parent = node.parentNode;\n\n\tassertIsDefined( parent, 'node.parentNode' );\n\n\twhile ( node.firstChild ) {\n\t\tparent.insertBefore( node.firstChild, node );\n\t}\n\n\tparent.removeChild( node );\n}\n"]}
1
+ {"version":3,"names":["_assertIsDefined","require","unwrap","node","parent","parentNode","assertIsDefined","firstChild","insertBefore","removeChild"],"sources":["@wordpress/dom/src/dom/unwrap.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Unwrap the given node. This means any child nodes are moved to the parent.\n *\n * @param {Node} node The node to unwrap.\n *\n * @return {void}\n */\nexport default function unwrap( node ) {\n\tconst parent = node.parentNode;\n\n\tassertIsDefined( parent, 'node.parentNode' );\n\n\twhile ( node.firstChild ) {\n\t\tparent.insertBefore( node.firstChild, node );\n\t}\n\n\tparent.removeChild( node );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,MAAMA,CAAEC,IAAI,EAAG;EACtC,MAAMC,MAAM,GAAGD,IAAI,CAACE,UAAU;EAE9B,IAAAC,gCAAe,EAAEF,MAAM,EAAE,iBAAkB,CAAC;EAE5C,OAAQD,IAAI,CAACI,UAAU,EAAG;IACzBH,MAAM,CAACI,YAAY,CAAEL,IAAI,CAACI,UAAU,EAAEJ,IAAK,CAAC;EAC7C;EAEAC,MAAM,CAACK,WAAW,CAAEN,IAAK,CAAC;AAC3B"}
package/build/dom/wrap.js CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = wrap;
7
-
8
7
  var _assertIsDefined = require("../utils/assert-is-defined");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/dom/wrap.js"],"names":["wrap","newNode","referenceNode","parentNode","insertBefore","appendChild"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,IAAT,CAAeC,OAAf,EAAwBC,aAAxB,EAAwC;AACtD,wCAAiBA,aAAa,CAACC,UAA/B,EAA2C,0BAA3C;AACAD,EAAAA,aAAa,CAACC,UAAd,CAAyBC,YAAzB,CAAuCH,OAAvC,EAAgDC,aAAhD;AACAD,EAAAA,OAAO,CAACI,WAAR,CAAqBH,aAArB;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param {Element} newNode The node to insert.\n * @param {Element} referenceNode The node to wrap.\n */\nexport default function wrap( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"]}
1
+ {"version":3,"names":["_assertIsDefined","require","wrap","newNode","referenceNode","assertIsDefined","parentNode","insertBefore","appendChild"],"sources":["@wordpress/dom/src/dom/wrap.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { assertIsDefined } from '../utils/assert-is-defined';\n\n/**\n * Wraps the given node with a new node with the given tag name.\n *\n * @param {Element} newNode The node to insert.\n * @param {Element} referenceNode The node to wrap.\n */\nexport default function wrap( newNode, referenceNode ) {\n\tassertIsDefined( referenceNode.parentNode, 'referenceNode.parentNode' );\n\treferenceNode.parentNode.insertBefore( newNode, referenceNode );\n\tnewNode.appendChild( referenceNode );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,gBAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,IAAIA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EACtD,IAAAC,gCAAe,EAAED,aAAa,CAACE,UAAU,EAAE,0BAA2B,CAAC;EACvEF,aAAa,CAACE,UAAU,CAACC,YAAY,CAAEJ,OAAO,EAAEC,aAAc,CAAC;EAC/DD,OAAO,CAACK,WAAW,CAAEJ,aAAc,CAAC;AACrC"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.find = find;
7
-
8
7
  /**
9
8
  * References:
10
9
  *
@@ -38,6 +37,7 @@ exports.find = find;
38
37
  function buildSelector(sequential) {
39
38
  return [sequential ? '[tabindex]:not([tabindex^="-"])' : '[tabindex]', 'a[href]', 'button:not([disabled])', 'input:not([type="hidden"]):not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'iframe:not([tabindex^="-"])', 'object', 'embed', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(',');
40
39
  }
40
+
41
41
  /**
42
42
  * Returns true if the specified element is visible (i.e. neither display: none
43
43
  * nor visibility: hidden).
@@ -46,11 +46,10 @@ function buildSelector(sequential) {
46
46
  *
47
47
  * @return {boolean} Whether element is visible.
48
48
  */
49
-
50
-
51
49
  function isVisible(element) {
52
50
  return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
53
51
  }
52
+
54
53
  /**
55
54
  * Returns true if the specified area element is a valid focusable element, or
56
55
  * false otherwise. Area is only focusable if within a map where a named map
@@ -60,21 +59,18 @@ function isVisible(element) {
60
59
  *
61
60
  * @return {boolean} Whether area element is valid for focus.
62
61
  */
63
-
64
-
65
62
  function isValidFocusableArea(element) {
66
63
  /** @type {HTMLMapElement | null} */
67
64
  const map = element.closest('map[name]');
68
-
69
65
  if (!map) {
70
66
  return false;
71
67
  }
72
- /** @type {HTMLImageElement | null} */
73
-
74
68
 
69
+ /** @type {HTMLImageElement | null} */
75
70
  const img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]');
76
71
  return !!img && isVisible(img);
77
72
  }
73
+
78
74
  /**
79
75
  * Returns all focusable elements within a given context.
80
76
  *
@@ -89,32 +85,23 @@ function isValidFocusableArea(element) {
89
85
  *
90
86
  * @return {HTMLElement[]} Focusable elements.
91
87
  */
92
-
93
-
94
88
  function find(context, {
95
89
  sequential = false
96
90
  } = {}) {
97
91
  /* eslint-disable jsdoc/no-undefined-types */
98
-
99
92
  /** @type {NodeListOf<HTMLElement>} */
100
-
101
93
  /* eslint-enable jsdoc/no-undefined-types */
102
94
  const elements = context.querySelectorAll(buildSelector(sequential));
103
95
  return Array.from(elements).filter(element => {
104
96
  if (!isVisible(element)) {
105
97
  return false;
106
98
  }
107
-
108
99
  const {
109
100
  nodeName
110
101
  } = element;
111
-
112
102
  if ('AREA' === nodeName) {
113
- return isValidFocusableArea(
114
- /** @type {HTMLAreaElement} */
115
- element);
103
+ return isValidFocusableArea( /** @type {HTMLAreaElement} */element);
116
104
  }
117
-
118
105
  return true;
119
106
  });
120
107
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/focusable.js"],"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAT,CAAwBC,UAAxB,EAAqC;AACpC,SAAO,CACNA,UAAU,GAAG,iCAAH,GAAuC,YAD3C,EAEN,SAFM,EAGN,wBAHM,EAIN,4CAJM,EAKN,wBALM,EAMN,0BANM,EAON,6BAPM,EAQN,QARM,EASN,OATM,EAUN,YAVM,EAWN,gDAXM,EAYLC,IAZK,CAYC,GAZD,CAAP;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,SACCA,OAAO,CAACC,WAAR,GAAsB,CAAtB,IACAD,OAAO,CAACE,YAAR,GAAuB,CADvB,IAEAF,OAAO,CAACG,cAAR,GAAyBC,MAAzB,GAAkC,CAHnC;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,oBAAT,CAA+BL,OAA/B,EAAyC;AACxC;AACA,QAAMM,GAAG,GAAGN,OAAO,CAACO,OAAR,CAAiB,WAAjB,CAAZ;;AACA,MAAK,CAAED,GAAP,EAAa;AACZ,WAAO,KAAP;AACA;AAED;;;AACA,QAAME,GAAG,GAAGR,OAAO,CAACS,aAAR,CAAsBC,aAAtB,CACX,kBAAkBJ,GAAG,CAACK,IAAtB,GAA6B,IADlB,CAAZ;AAGA,SAAO,CAAC,CAAEH,GAAH,IAAUT,SAAS,CAAES,GAAF,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,IAAT,CAAeC,OAAf,EAAwB;AAAEhB,EAAAA,UAAU,GAAG;AAAf,IAAyB,EAAjD,EAAsD;AAC5D;;AACA;;AACA;AACA,QAAMiB,QAAQ,GAAGD,OAAO,CAACE,gBAAR,CAA0BnB,aAAa,CAAEC,UAAF,CAAvC,CAAjB;AAEA,SAAOmB,KAAK,CAACC,IAAN,CAAYH,QAAZ,EAAuBI,MAAvB,CAAiClB,OAAF,IAAe;AACpD,QAAK,CAAED,SAAS,CAAEC,OAAF,CAAhB,EAA8B;AAC7B,aAAO,KAAP;AACA;;AAED,UAAM;AAAEmB,MAAAA;AAAF,QAAenB,OAArB;;AACA,QAAK,WAAWmB,QAAhB,EAA2B;AAC1B,aAAOd,oBAAoB;AAC1B;AAAiCL,MAAAA,OADP,CAA3B;AAGA;;AAED,WAAO,IAAP;AACA,GAbM,CAAP;AAcA","sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} options\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {HTMLElement[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"]}
1
+ {"version":3,"names":["buildSelector","sequential","join","isVisible","element","offsetWidth","offsetHeight","getClientRects","length","isValidFocusableArea","map","closest","img","ownerDocument","querySelector","name","find","context","elements","querySelectorAll","Array","from","filter","nodeName"],"sources":["@wordpress/dom/src/focusable.js"],"sourcesContent":["/**\n * References:\n *\n * Focusable:\n * - https://www.w3.org/TR/html5/editing.html#focus-management\n *\n * Sequential focus navigation:\n * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute\n *\n * Disabled elements:\n * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements\n *\n * getClientRects algorithm (requiring layout box):\n * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface\n *\n * AREA elements associated with an IMG:\n * - https://w3c.github.io/html/editing.html#data-model\n */\n\n/**\n * Returns a CSS selector used to query for focusable elements.\n *\n * @param {boolean} sequential If set, only query elements that are sequentially\n * focusable. Non-interactive elements with a\n * negative `tabindex` are focusable but not\n * sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {string} CSS selector.\n */\nfunction buildSelector( sequential ) {\n\treturn [\n\t\tsequential ? '[tabindex]:not([tabindex^=\"-\"])' : '[tabindex]',\n\t\t'a[href]',\n\t\t'button:not([disabled])',\n\t\t'input:not([type=\"hidden\"]):not([disabled])',\n\t\t'select:not([disabled])',\n\t\t'textarea:not([disabled])',\n\t\t'iframe:not([tabindex^=\"-\"])',\n\t\t'object',\n\t\t'embed',\n\t\t'area[href]',\n\t\t'[contenteditable]:not([contenteditable=false])',\n\t].join( ',' );\n}\n\n/**\n * Returns true if the specified element is visible (i.e. neither display: none\n * nor visibility: hidden).\n *\n * @param {HTMLElement} element DOM element to test.\n *\n * @return {boolean} Whether element is visible.\n */\nfunction isVisible( element ) {\n\treturn (\n\t\telement.offsetWidth > 0 ||\n\t\telement.offsetHeight > 0 ||\n\t\telement.getClientRects().length > 0\n\t);\n}\n\n/**\n * Returns true if the specified area element is a valid focusable element, or\n * false otherwise. Area is only focusable if within a map where a named map\n * referenced by an image somewhere in the document.\n *\n * @param {HTMLAreaElement} element DOM area element to test.\n *\n * @return {boolean} Whether area element is valid for focus.\n */\nfunction isValidFocusableArea( element ) {\n\t/** @type {HTMLMapElement | null} */\n\tconst map = element.closest( 'map[name]' );\n\tif ( ! map ) {\n\t\treturn false;\n\t}\n\n\t/** @type {HTMLImageElement | null} */\n\tconst img = element.ownerDocument.querySelector(\n\t\t'img[usemap=\"#' + map.name + '\"]'\n\t);\n\treturn !! img && isVisible( img );\n}\n\n/**\n * Returns all focusable elements within a given context.\n *\n * @param {Element} context Element in which to search.\n * @param {Object} options\n * @param {boolean} [options.sequential] If set, only return elements that are\n * sequentially focusable.\n * Non-interactive elements with a\n * negative `tabindex` are focusable but\n * not sequentially focusable.\n * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute\n *\n * @return {HTMLElement[]} Focusable elements.\n */\nexport function find( context, { sequential = false } = {} ) {\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {NodeListOf<HTMLElement>} */\n\t/* eslint-enable jsdoc/no-undefined-types */\n\tconst elements = context.querySelectorAll( buildSelector( sequential ) );\n\n\treturn Array.from( elements ).filter( ( element ) => {\n\t\tif ( ! isVisible( element ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst { nodeName } = element;\n\t\tif ( 'AREA' === nodeName ) {\n\t\t\treturn isValidFocusableArea(\n\t\t\t\t/** @type {HTMLAreaElement} */ ( element )\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t} );\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAaA,CAAEC,UAAU,EAAG;EACpC,OAAO,CACNA,UAAU,GAAG,iCAAiC,GAAG,YAAY,EAC7D,SAAS,EACT,wBAAwB,EACxB,4CAA4C,EAC5C,wBAAwB,EACxB,0BAA0B,EAC1B,6BAA6B,EAC7B,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,gDAAgD,CAChD,CAACC,IAAI,CAAE,GAAI,CAAC;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAAEC,OAAO,EAAG;EAC7B,OACCA,OAAO,CAACC,WAAW,GAAG,CAAC,IACvBD,OAAO,CAACE,YAAY,GAAG,CAAC,IACxBF,OAAO,CAACG,cAAc,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC;AAErC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,oBAAoBA,CAAEL,OAAO,EAAG;EACxC;EACA,MAAMM,GAAG,GAAGN,OAAO,CAACO,OAAO,CAAE,WAAY,CAAC;EAC1C,IAAK,CAAED,GAAG,EAAG;IACZ,OAAO,KAAK;EACb;;EAEA;EACA,MAAME,GAAG,GAAGR,OAAO,CAACS,aAAa,CAACC,aAAa,CAC9C,eAAe,GAAGJ,GAAG,CAACK,IAAI,GAAG,IAC9B,CAAC;EACD,OAAO,CAAC,CAAEH,GAAG,IAAIT,SAAS,CAAES,GAAI,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,IAAIA,CAAEC,OAAO,EAAE;EAAEhB,UAAU,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,EAAG;EAC5D;EACA;EACA;EACA,MAAMiB,QAAQ,GAAGD,OAAO,CAACE,gBAAgB,CAAEnB,aAAa,CAAEC,UAAW,CAAE,CAAC;EAExE,OAAOmB,KAAK,CAACC,IAAI,CAAEH,QAAS,CAAC,CAACI,MAAM,CAAIlB,OAAO,IAAM;IACpD,IAAK,CAAED,SAAS,CAAEC,OAAQ,CAAC,EAAG;MAC7B,OAAO,KAAK;IACb;IAEA,MAAM;MAAEmB;IAAS,CAAC,GAAGnB,OAAO;IAC5B,IAAK,MAAM,KAAKmB,QAAQ,EAAG;MAC1B,OAAOd,oBAAoB,EAC1B,8BAAiCL,OAClC,CAAC;IACF;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ"}
package/build/index.js CHANGED
@@ -7,13 +7,9 @@ var _exportNames = {
7
7
  focus: true
8
8
  };
9
9
  exports.focus = void 0;
10
-
11
10
  var focusable = _interopRequireWildcard(require("./focusable"));
12
-
13
11
  var tabbable = _interopRequireWildcard(require("./tabbable"));
14
-
15
12
  var _dom = require("./dom");
16
-
17
13
  Object.keys(_dom).forEach(function (key) {
18
14
  if (key === "default" || key === "__esModule") return;
19
15
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -25,9 +21,7 @@ Object.keys(_dom).forEach(function (key) {
25
21
  }
26
22
  });
27
23
  });
28
-
29
24
  var _phrasingContent = require("./phrasing-content");
30
-
31
25
  Object.keys(_phrasingContent).forEach(function (key) {
32
26
  if (key === "default" || key === "__esModule") return;
33
27
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -39,9 +33,7 @@ Object.keys(_phrasingContent).forEach(function (key) {
39
33
  }
40
34
  });
41
35
  });
42
-
43
36
  var _dataTransfer = require("./data-transfer");
44
-
45
37
  Object.keys(_dataTransfer).forEach(function (key) {
46
38
  if (key === "default" || key === "__esModule") return;
47
39
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -53,11 +45,8 @@ Object.keys(_dataTransfer).forEach(function (key) {
53
45
  }
54
46
  });
55
47
  });
56
-
57
48
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
58
-
59
49
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
60
-
61
50
  /**
62
51
  * Internal dependencies
63
52
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/dom/src/index.js"],"names":["focus","focusable","tabbable"],"mappings":";;;;;;;;;;AAGA;;AACA;;AAQA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;AAdA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,MAAMA,KAAK,GAAG;AAAEC,EAAAA,SAAF;AAAaC,EAAAA;AAAb,CAAd","sourcesContent":["/**\n * Internal dependencies\n */\nimport * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"]}
1
+ {"version":3,"names":["focusable","_interopRequireWildcard","require","tabbable","_dom","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_phrasingContent","_dataTransfer","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","focus"],"sources":["@wordpress/dom/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"],"mappings":";;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,uBAAA,CAAAC,OAAA;AAQA,IAAAE,IAAA,GAAAF,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAF,IAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,IAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,IAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,gBAAA,GAAAf,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAW,gBAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,gBAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,aAAA,GAAAhB,OAAA;AAAAG,MAAA,CAAAC,IAAA,CAAAY,aAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,aAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,aAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AAAgC,SAAAW,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAnB,wBAAAuB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAX,GAAA,CAAAQ,GAAA,SAAAK,MAAA,WAAAC,qBAAA,GAAAzB,MAAA,CAAAS,cAAA,IAAAT,MAAA,CAAA0B,wBAAA,WAAAvB,GAAA,IAAAgB,GAAA,QAAAhB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAa,GAAA,EAAAhB,GAAA,SAAAwB,IAAA,GAAAF,qBAAA,GAAAzB,MAAA,CAAA0B,wBAAA,CAAAP,GAAA,EAAAhB,GAAA,cAAAwB,IAAA,KAAAA,IAAA,CAAAhB,GAAA,IAAAgB,IAAA,CAAAC,GAAA,KAAA5B,MAAA,CAAAS,cAAA,CAAAe,MAAA,EAAArB,GAAA,EAAAwB,IAAA,YAAAH,MAAA,CAAArB,GAAA,IAAAgB,GAAA,CAAAhB,GAAA,SAAAqB,MAAA,CAAAH,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAM,GAAA,CAAAT,GAAA,EAAAK,MAAA,YAAAA,MAAA;AAdhC;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,MAAMK,KAAK,GAAG;EAAElC,SAAS;EAAEG;AAAS,CAAC;AAACU,OAAA,CAAAqB,KAAA,GAAAA,KAAA"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getPhrasingContentSchema = getPhrasingContentSchema;
7
7
  exports.isPhrasingContent = isPhrasingContent;
8
8
  exports.isTextContent = isTextContent;
9
-
10
9
  /**
11
10
  * All phrasing content elements.
12
11
  *
@@ -79,10 +78,11 @@ const textContentSchema = {
79
78
  },
80
79
  wbr: {},
81
80
  '#text': {}
82
- }; // Recursion is needed.
81
+ };
82
+
83
+ // Recursion is needed.
83
84
  // Possible: strong > em > strong.
84
85
  // Impossible: strong > strong.
85
-
86
86
  const excludedElements = ['#text', 'br'];
87
87
  Object.keys(textContentSchema).filter(element => !excludedElements.includes(element)).forEach(tag => {
88
88
  const {
@@ -91,6 +91,7 @@ Object.keys(textContentSchema).filter(element => !excludedElements.includes(elem
91
91
  } = textContentSchema;
92
92
  textContentSchema[tag].children = restSchema;
93
93
  });
94
+
94
95
  /**
95
96
  * Embedded content elements.
96
97
  *
@@ -98,7 +99,6 @@ Object.keys(textContentSchema).filter(element => !excludedElements.includes(elem
98
99
  *
99
100
  * @type {ContentSchema}
100
101
  */
101
-
102
102
  const embeddedContentSchema = {
103
103
  audio: {
104
104
  attributes: ['src', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted']
@@ -119,15 +119,17 @@ const embeddedContentSchema = {
119
119
  attributes: ['src', 'poster', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls', 'width', 'height']
120
120
  }
121
121
  };
122
+
122
123
  /**
123
124
  * Phrasing content elements.
124
125
  *
125
126
  * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
126
127
  */
127
-
128
- const phrasingContentSchema = { ...textContentSchema,
128
+ const phrasingContentSchema = {
129
+ ...textContentSchema,
129
130
  ...embeddedContentSchema
130
131
  };
132
+
131
133
  /**
132
134
  * Get schema of possible paths for phrasing content.
133
135
  *
@@ -138,16 +140,14 @@ const phrasingContentSchema = { ...textContentSchema,
138
140
  *
139
141
  * @return {Partial<ContentSchema>} Schema.
140
142
  */
141
-
142
143
  function getPhrasingContentSchema(context) {
143
144
  if (context !== 'paste') {
144
145
  return phrasingContentSchema;
145
146
  }
147
+
146
148
  /**
147
149
  * @type {Partial<ContentSchema>}
148
150
  */
149
-
150
-
151
151
  const {
152
152
  u,
153
153
  // Used to mark misspelling. Shouldn't be pasted.
@@ -164,7 +164,8 @@ function getPhrasingContentSchema(context) {
164
164
  bdo,
165
165
  // Invisible.
166
166
  ...remainingContentSchema
167
- } = { ...phrasingContentSchema,
167
+ } = {
168
+ ...phrasingContentSchema,
168
169
  // We shouldn't paste potentially sensitive information which is not
169
170
  // visible to the user when pasted, so strip the attributes.
170
171
  ins: {
@@ -176,6 +177,7 @@ function getPhrasingContentSchema(context) {
176
177
  };
177
178
  return remainingContentSchema;
178
179
  }
180
+
179
181
  /**
180
182
  * Find out whether or not the given node is phrasing content.
181
183
  *
@@ -185,18 +187,15 @@ function getPhrasingContentSchema(context) {
185
187
  *
186
188
  * @return {boolean} True if phrasing content, false if not.
187
189
  */
188
-
189
-
190
190
  function isPhrasingContent(node) {
191
191
  const tag = node.nodeName.toLowerCase();
192
192
  return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span';
193
193
  }
194
+
194
195
  /**
195
196
  * @param {Node} node
196
197
  * @return {boolean} Node is text content
197
198
  */
198
-
199
-
200
199
  function isTextContent(node) {
201
200
  const tag = node.nodeName.toLowerCase();
202
201
  return textContentSchema.hasOwnProperty(tag) || tag === 'span';