@wordpress/dom 4.32.0 → 4.32.1-next.b8c8708f3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/build/data-transfer.js +30 -18
  2. package/build/data-transfer.js.map +7 -1
  3. package/build/dom/caret-range-from-point.js +22 -25
  4. package/build/dom/caret-range-from-point.js.map +7 -1
  5. package/build/dom/clean-node-list.js +122 -129
  6. package/build/dom/clean-node-list.js.map +7 -1
  7. package/build/dom/compute-caret-rect.js +36 -21
  8. package/build/dom/compute-caret-rect.js.map +7 -1
  9. package/build/dom/document-has-selection.js +36 -22
  10. package/build/dom/document-has-selection.js.map +7 -1
  11. package/build/dom/document-has-text-selection.js +25 -23
  12. package/build/dom/document-has-text-selection.js.map +7 -1
  13. package/build/dom/document-has-uncollapsed-selection.js +35 -22
  14. package/build/dom/document-has-uncollapsed-selection.js.map +7 -1
  15. package/build/dom/get-computed-style.js +27 -17
  16. package/build/dom/get-computed-style.js.map +7 -1
  17. package/build/dom/get-offset-parent.js +43 -32
  18. package/build/dom/get-offset-parent.js.map +7 -1
  19. package/build/dom/get-range-height.js +24 -18
  20. package/build/dom/get-range-height.js.map +7 -1
  21. package/build/dom/get-rectangle-from-range.js +47 -68
  22. package/build/dom/get-rectangle-from-range.js.map +7 -1
  23. package/build/dom/get-scroll-container.js +44 -37
  24. package/build/dom/get-scroll-container.js.map +7 -1
  25. package/build/dom/hidden-caret-range-from-point.js +39 -33
  26. package/build/dom/hidden-caret-range-from-point.js.map +7 -1
  27. package/build/dom/index.js +116 -195
  28. package/build/dom/index.js.map +7 -1
  29. package/build/dom/input-field-has-uncollapsed-selection.js +40 -42
  30. package/build/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  31. package/build/dom/insert-after.js +24 -19
  32. package/build/dom/insert-after.js.map +7 -1
  33. package/build/dom/is-edge.js +57 -67
  34. package/build/dom/is-edge.js.map +7 -1
  35. package/build/dom/is-element.js +22 -11
  36. package/build/dom/is-element.js.map +7 -1
  37. package/build/dom/is-empty.js +27 -17
  38. package/build/dom/is-empty.js.map +7 -1
  39. package/build/dom/is-entirely-selected.js +46 -50
  40. package/build/dom/is-entirely-selected.js.map +7 -1
  41. package/build/dom/is-form-element.js +36 -24
  42. package/build/dom/is-form-element.js.map +7 -1
  43. package/build/dom/is-horizontal-edge.js +34 -20
  44. package/build/dom/is-horizontal-edge.js.map +7 -1
  45. package/build/dom/is-html-input-element.js +23 -12
  46. package/build/dom/is-html-input-element.js.map +7 -1
  47. package/build/dom/is-input-or-text-area.js +23 -12
  48. package/build/dom/is-input-or-text-area.js.map +7 -1
  49. package/build/dom/is-number-input.js +38 -29
  50. package/build/dom/is-number-input.js.map +7 -1
  51. package/build/dom/is-rtl.js +34 -19
  52. package/build/dom/is-rtl.js.map +7 -1
  53. package/build/dom/is-selection-forward.js +26 -40
  54. package/build/dom/is-selection-forward.js.map +7 -1
  55. package/build/dom/is-text-field.js +49 -24
  56. package/build/dom/is-text-field.js.map +7 -1
  57. package/build/dom/is-vertical-edge.js +34 -20
  58. package/build/dom/is-vertical-edge.js.map +7 -1
  59. package/build/dom/place-caret-at-edge.js +52 -55
  60. package/build/dom/place-caret-at-edge.js.map +7 -1
  61. package/build/dom/place-caret-at-horizontal-edge.js +34 -18
  62. package/build/dom/place-caret-at-horizontal-edge.js.map +7 -1
  63. package/build/dom/place-caret-at-vertical-edge.js +34 -19
  64. package/build/dom/place-caret-at-vertical-edge.js.map +7 -1
  65. package/build/dom/remove-invalid-html.js +35 -22
  66. package/build/dom/remove-invalid-html.js.map +7 -1
  67. package/build/dom/remove.js +24 -17
  68. package/build/dom/remove.js.map +7 -1
  69. package/build/dom/replace-tag.js +24 -19
  70. package/build/dom/replace-tag.js.map +7 -1
  71. package/build/dom/replace.js +38 -23
  72. package/build/dom/replace.js.map +7 -1
  73. package/build/dom/safe-html.js +39 -28
  74. package/build/dom/safe-html.js.map +7 -1
  75. package/build/dom/scroll-if-no-range.js +26 -18
  76. package/build/dom/scroll-if-no-range.js.map +7 -1
  77. package/build/dom/strip-html.js +36 -23
  78. package/build/dom/strip-html.js.map +7 -1
  79. package/build/dom/unwrap.js +24 -18
  80. package/build/dom/unwrap.js.map +7 -1
  81. package/build/dom/wrap.js +24 -17
  82. package/build/dom/wrap.js.map +7 -1
  83. package/build/focusable.js +52 -85
  84. package/build/focusable.js.map +7 -1
  85. package/build/index.js +44 -58
  86. package/build/index.js.map +7 -1
  87. package/build/phrasing-content.js +88 -128
  88. package/build/phrasing-content.js.map +7 -1
  89. package/build/tabbable.js +52 -137
  90. package/build/tabbable.js.map +7 -1
  91. package/build/utils/assert-is-defined.js +30 -7
  92. package/build/utils/assert-is-defined.js.map +7 -1
  93. package/build-module/data-transfer.js +9 -15
  94. package/build-module/data-transfer.js.map +7 -1
  95. package/build-module/dom/caret-range-from-point.js +5 -22
  96. package/build-module/dom/caret-range-from-point.js.map +7 -1
  97. package/build-module/dom/clean-node-list.js +94 -123
  98. package/build-module/dom/clean-node-list.js.map +7 -1
  99. package/build-module/dom/compute-caret-rect.js +8 -16
  100. package/build-module/dom/compute-caret-rect.js.map +7 -1
  101. package/build-module/dom/document-has-selection.js +8 -17
  102. package/build-module/dom/document-has-selection.js.map +7 -1
  103. package/build-module/dom/document-has-text-selection.js +8 -20
  104. package/build-module/dom/document-has-text-selection.js.map +7 -1
  105. package/build-module/dom/document-has-uncollapsed-selection.js +7 -17
  106. package/build-module/dom/document-has-uncollapsed-selection.js.map +7 -1
  107. package/build-module/dom/get-computed-style.js +10 -14
  108. package/build-module/dom/get-computed-style.js.map +7 -1
  109. package/build-module/dom/get-offset-parent.js +16 -28
  110. package/build-module/dom/get-offset-parent.js.map +7 -1
  111. package/build-module/dom/get-range-height.js +7 -15
  112. package/build-module/dom/get-range-height.js.map +7 -1
  113. package/build-module/dom/get-rectangle-from-range.js +30 -65
  114. package/build-module/dom/get-rectangle-from-range.js.map +7 -1
  115. package/build-module/dom/get-scroll-container.js +16 -32
  116. package/build-module/dom/get-scroll-container.js.map +7 -1
  117. package/build-module/dom/hidden-caret-range-from-point.js +11 -28
  118. package/build-module/dom/hidden-caret-range-from-point.js.map +7 -1
  119. package/build-module/dom/index.js +57 -28
  120. package/build-module/dom/index.js.map +7 -1
  121. package/build-module/dom/input-field-has-uncollapsed-selection.js +12 -37
  122. package/build-module/dom/input-field-has-uncollapsed-selection.js.map +7 -1
  123. package/build-module/dom/insert-after.js +7 -16
  124. package/build-module/dom/insert-after.js.map +7 -1
  125. package/build-module/dom/is-edge.js +24 -57
  126. package/build-module/dom/is-edge.js.map +7 -1
  127. package/build-module/dom/is-element.js +5 -8
  128. package/build-module/dom/is-element.js.map +7 -1
  129. package/build-module/dom/is-empty.js +10 -14
  130. package/build-module/dom/is-empty.js.map +7 -1
  131. package/build-module/dom/is-entirely-selected.js +18 -45
  132. package/build-module/dom/is-entirely-selected.js.map +7 -1
  133. package/build-module/dom/is-form-element.js +8 -19
  134. package/build-module/dom/is-form-element.js.map +7 -1
  135. package/build-module/dom/is-horizontal-edge.js +6 -15
  136. package/build-module/dom/is-horizontal-edge.js.map +7 -1
  137. package/build-module/dom/is-html-input-element.js +6 -9
  138. package/build-module/dom/is-html-input-element.js.map +7 -1
  139. package/build-module/dom/is-input-or-text-area.js +6 -9
  140. package/build-module/dom/is-input-or-text-area.js.map +7 -1
  141. package/build-module/dom/is-number-input.js +11 -25
  142. package/build-module/dom/is-number-input.js.map +7 -1
  143. package/build-module/dom/is-rtl.js +7 -15
  144. package/build-module/dom/is-rtl.js.map +7 -1
  145. package/build-module/dom/is-selection-forward.js +9 -37
  146. package/build-module/dom/is-selection-forward.js.map +7 -1
  147. package/build-module/dom/is-text-field.js +22 -20
  148. package/build-module/dom/is-text-field.js.map +7 -1
  149. package/build-module/dom/is-vertical-edge.js +6 -15
  150. package/build-module/dom/is-vertical-edge.js.map +7 -1
  151. package/build-module/dom/place-caret-at-edge.js +22 -48
  152. package/build-module/dom/place-caret-at-edge.js.map +7 -1
  153. package/build-module/dom/place-caret-at-horizontal-edge.js +7 -14
  154. package/build-module/dom/place-caret-at-horizontal-edge.js.map +7 -1
  155. package/build-module/dom/place-caret-at-vertical-edge.js +6 -14
  156. package/build-module/dom/place-caret-at-vertical-edge.js.map +7 -1
  157. package/build-module/dom/remove-invalid-html.js +7 -17
  158. package/build-module/dom/remove-invalid-html.js.map +7 -1
  159. package/build-module/dom/remove.js +7 -14
  160. package/build-module/dom/remove.js.map +7 -1
  161. package/build-module/dom/replace-tag.js +7 -16
  162. package/build-module/dom/replace-tag.js.map +7 -1
  163. package/build-module/dom/replace.js +9 -17
  164. package/build-module/dom/replace.js.map +7 -1
  165. package/build-module/dom/safe-html.js +11 -23
  166. package/build-module/dom/safe-html.js.map +7 -1
  167. package/build-module/dom/scroll-if-no-range.js +5 -15
  168. package/build-module/dom/scroll-if-no-range.js.map +7 -1
  169. package/build-module/dom/strip-html.js +8 -18
  170. package/build-module/dom/strip-html.js.map +7 -1
  171. package/build-module/dom/unwrap.js +7 -15
  172. package/build-module/dom/unwrap.js.map +7 -1
  173. package/build-module/dom/wrap.js +7 -14
  174. package/build-module/dom/wrap.js.map +7 -1
  175. package/build-module/focusable.js +30 -81
  176. package/build-module/focusable.js.map +7 -1
  177. package/build-module/index.js +9 -17
  178. package/build-module/index.js.map +7 -1
  179. package/build-module/phrasing-content.js +67 -125
  180. package/build-module/phrasing-content.js.map +7 -1
  181. package/build-module/tabbable.js +30 -133
  182. package/build-module/tabbable.js.map +7 -1
  183. package/build-module/utils/assert-is-defined.js +9 -4
  184. package/build-module/utils/assert-is-defined.js.map +7 -1
  185. package/package.json +11 -4
@@ -1,18 +1,5 @@
1
- /**
2
- * If no range range can be created or it is outside the container, the element
3
- * may be out of view, so scroll it into view and try again.
4
- *
5
- * @param {HTMLElement} container The container to scroll.
6
- * @param {boolean} alignToTop True to align to top, false to bottom.
7
- * @param {Function} callback The callback to create the range.
8
- *
9
- * @return {?Range} The range returned by the callback.
10
- */
11
- export function scrollIfNoRange(container, alignToTop, callback) {
1
+ function scrollIfNoRange(container, alignToTop, callback) {
12
2
  let range = callback();
13
-
14
- // If no range range can be created or it is outside the container, the
15
- // element may be out of view.
16
3
  if (!range || !range.startContainer || !container.contains(range.startContainer)) {
17
4
  container.scrollIntoView(alignToTop);
18
5
  range = callback();
@@ -22,4 +9,7 @@ export function scrollIfNoRange(container, alignToTop, callback) {
22
9
  }
23
10
  return range;
24
11
  }
25
- //# sourceMappingURL=scroll-if-no-range.js.map
12
+ export {
13
+ scrollIfNoRange
14
+ };
15
+ //# sourceMappingURL=scroll-if-no-range.js.map
@@ -1 +1,7 @@
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;AACA,OAAO,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","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/scroll-if-no-range.js"],
4
+ "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"],
5
+ "mappings": "AAUO,SAAS,gBAAiB,WAAW,YAAY,UAAW;AAClE,MAAI,QAAQ,SAAS;AAIrB,MACC,CAAE,SACF,CAAE,MAAM,kBACR,CAAE,UAAU,SAAU,MAAM,cAAe,GAC1C;AACD,cAAU,eAAgB,UAAW;AACrC,YAAQ,SAAS;AAEjB,QACC,CAAE,SACF,CAAE,MAAM,kBACR,CAAE,UAAU,SAAU,MAAM,cAAe,GAC1C;AACD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,21 +1,11 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import safeHTML from './safe-html';
5
-
6
- /**
7
- * Removes any HTML tags from the provided string.
8
- *
9
- * @param {string} html The string containing html.
10
- *
11
- * @return {string} The text content with any html removed.
12
- */
13
- export default function stripHTML(html) {
14
- // Remove any script tags or on* attributes otherwise their *contents* will be left
15
- // in place following removal of HTML tags.
1
+ import safeHTML from "./safe-html";
2
+ function stripHTML(html) {
16
3
  html = safeHTML(html);
17
- const doc = document.implementation.createHTMLDocument('');
4
+ const doc = document.implementation.createHTMLDocument("");
18
5
  doc.body.innerHTML = html;
19
- return doc.body.textContent || '';
6
+ return doc.body.textContent || "";
20
7
  }
21
- //# sourceMappingURL=strip-html.js.map
8
+ export {
9
+ stripHTML as default
10
+ };
11
+ //# sourceMappingURL=strip-html.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["safeHTML","stripHTML","html","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":"AAAA;AACA;AACA;AACA,OAAOA,QAAQ,MAAM,aAAa;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,SAASA,CAAEC,IAAI,EAAG;EACzC;EACA;EACAA,IAAI,GAAGF,QAAQ,CAAEE,IAAK,CAAC;EAEvB,MAAMC,GAAG,GAAGC,QAAQ,CAACC,cAAc,CAACC,kBAAkB,CAAE,EAAG,CAAC;EAC5DH,GAAG,CAACI,IAAI,CAACC,SAAS,GAAGN,IAAI;EACzB,OAAOC,GAAG,CAACI,IAAI,CAACE,WAAW,IAAI,EAAE;AAClC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/strip-html.js"],
4
+ "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"],
5
+ "mappings": "AAGA,OAAO,cAAc;AASN,SAAR,UAA4B,MAAO;AAGzC,SAAO,SAAU,IAAK;AAEtB,QAAM,MAAM,SAAS,eAAe,mBAAoB,EAAG;AAC3D,MAAI,KAAK,YAAY;AACrB,SAAO,IAAI,KAAK,eAAe;AAChC;",
6
+ "names": []
7
+ }
@@ -1,21 +1,13 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Unwrap the given node. This means any child nodes are moved to the parent.
8
- *
9
- * @param {Node} node The node to unwrap.
10
- *
11
- * @return {void}
12
- */
13
- export default function unwrap(node) {
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function unwrap(node) {
14
3
  const parent = node.parentNode;
15
- assertIsDefined(parent, 'node.parentNode');
4
+ assertIsDefined(parent, "node.parentNode");
16
5
  while (node.firstChild) {
17
6
  parent.insertBefore(node.firstChild, node);
18
7
  }
19
8
  parent.removeChild(node);
20
9
  }
21
- //# sourceMappingURL=unwrap.js.map
10
+ export {
11
+ unwrap as default
12
+ };
13
+ //# sourceMappingURL=unwrap.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","unwrap","node","parent","parentNode","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":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,MAAMA,CAAEC,IAAI,EAAG;EACtC,MAAMC,MAAM,GAAGD,IAAI,CAACE,UAAU;EAE9BJ,eAAe,CAAEG,MAAM,EAAE,iBAAkB,CAAC;EAE5C,OAAQD,IAAI,CAACG,UAAU,EAAG;IACzBF,MAAM,CAACG,YAAY,CAAEJ,IAAI,CAACG,UAAU,EAAEH,IAAK,CAAC;EAC7C;EAEAC,MAAM,CAACI,WAAW,CAAEL,IAAK,CAAC;AAC3B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/unwrap.js"],
4
+ "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"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AASjB,SAAR,OAAyB,MAAO;AACtC,QAAM,SAAS,KAAK;AAEpB,kBAAiB,QAAQ,iBAAkB;AAE3C,SAAQ,KAAK,YAAa;AACzB,WAAO,aAAc,KAAK,YAAY,IAAK;AAAA,EAC5C;AAEA,SAAO,YAAa,IAAK;AAC1B;",
6
+ "names": []
7
+ }
@@ -1,17 +1,10 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { assertIsDefined } from '../utils/assert-is-defined';
5
-
6
- /**
7
- * Wraps the given node with a new node with the given tag name.
8
- *
9
- * @param {Element} newNode The node to insert.
10
- * @param {Element} referenceNode The node to wrap.
11
- */
12
- export default function wrap(newNode, referenceNode) {
13
- assertIsDefined(referenceNode.parentNode, 'referenceNode.parentNode');
1
+ import { assertIsDefined } from "../utils/assert-is-defined";
2
+ function wrap(newNode, referenceNode) {
3
+ assertIsDefined(referenceNode.parentNode, "referenceNode.parentNode");
14
4
  referenceNode.parentNode.insertBefore(newNode, referenceNode);
15
5
  newNode.appendChild(referenceNode);
16
6
  }
17
- //# sourceMappingURL=wrap.js.map
7
+ export {
8
+ wrap as default
9
+ };
10
+ //# sourceMappingURL=wrap.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["assertIsDefined","wrap","newNode","referenceNode","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":"AAAA;AACA;AACA;AACA,SAASA,eAAe,QAAQ,4BAA4B;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,IAAIA,CAAEC,OAAO,EAAEC,aAAa,EAAG;EACtDH,eAAe,CAAEG,aAAa,CAACC,UAAU,EAAE,0BAA2B,CAAC;EACvED,aAAa,CAACC,UAAU,CAACC,YAAY,CAAEH,OAAO,EAAEC,aAAc,CAAC;EAC/DD,OAAO,CAACI,WAAW,CAAEH,aAAc,CAAC;AACrC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/dom/wrap.js"],
4
+ "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"],
5
+ "mappings": "AAGA,SAAS,uBAAuB;AAQjB,SAAR,KAAuB,SAAS,eAAgB;AACtD,kBAAiB,cAAc,YAAY,0BAA2B;AACtE,gBAAc,WAAW,aAAc,SAAS,aAAc;AAC9D,UAAQ,YAAa,aAAc;AACpC;",
6
+ "names": []
7
+ }
@@ -1,100 +1,49 @@
1
- /**
2
- * References:
3
- *
4
- * Focusable:
5
- * - https://www.w3.org/TR/html5/editing.html#focus-management
6
- *
7
- * Sequential focus navigation:
8
- * - https://www.w3.org/TR/html5/editing.html#sequential-focus-navigation-and-the-tabindex-attribute
9
- *
10
- * Disabled elements:
11
- * - https://www.w3.org/TR/html5/disabled-elements.html#disabled-elements
12
- *
13
- * getClientRects algorithm (requiring layout box):
14
- * - https://www.w3.org/TR/cssom-view-1/#extension-to-the-element-interface
15
- *
16
- * AREA elements associated with an IMG:
17
- * - https://w3c.github.io/html/editing.html#data-model
18
- */
19
-
20
- /**
21
- * Returns a CSS selector used to query for focusable elements.
22
- *
23
- * @param {boolean} sequential If set, only query elements that are sequentially
24
- * focusable. Non-interactive elements with a
25
- * negative `tabindex` are focusable but not
26
- * sequentially focusable.
27
- * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
28
- *
29
- * @return {string} CSS selector.
30
- */
31
1
  function buildSelector(sequential) {
32
- 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', 'summary', 'area[href]', '[contenteditable]:not([contenteditable=false])'].join(',');
2
+ return [
3
+ sequential ? '[tabindex]:not([tabindex^="-"])' : "[tabindex]",
4
+ "a[href]",
5
+ "button:not([disabled])",
6
+ 'input:not([type="hidden"]):not([disabled])',
7
+ "select:not([disabled])",
8
+ "textarea:not([disabled])",
9
+ 'iframe:not([tabindex^="-"])',
10
+ "object",
11
+ "embed",
12
+ "summary",
13
+ "area[href]",
14
+ "[contenteditable]:not([contenteditable=false])"
15
+ ].join(",");
33
16
  }
34
-
35
- /**
36
- * Returns true if the specified element is visible (i.e. neither display: none
37
- * nor visibility: hidden).
38
- *
39
- * @param {HTMLElement} element DOM element to test.
40
- *
41
- * @return {boolean} Whether element is visible.
42
- */
43
17
  function isVisible(element) {
44
18
  return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0;
45
19
  }
46
-
47
- /**
48
- * Returns true if the specified area element is a valid focusable element, or
49
- * false otherwise. Area is only focusable if within a map where a named map
50
- * referenced by an image somewhere in the document.
51
- *
52
- * @param {HTMLAreaElement} element DOM area element to test.
53
- *
54
- * @return {boolean} Whether area element is valid for focus.
55
- */
56
20
  function isValidFocusableArea(element) {
57
- /** @type {HTMLMapElement | null} */
58
- const map = element.closest('map[name]');
21
+ const map = element.closest("map[name]");
59
22
  if (!map) {
60
23
  return false;
61
24
  }
62
-
63
- /** @type {HTMLImageElement | null} */
64
- const img = element.ownerDocument.querySelector('img[usemap="#' + map.name + '"]');
25
+ const img = element.ownerDocument.querySelector(
26
+ 'img[usemap="#' + map.name + '"]'
27
+ );
65
28
  return !!img && isVisible(img);
66
29
  }
67
-
68
- /**
69
- * Returns all focusable elements within a given context.
70
- *
71
- * @param {Element} context Element in which to search.
72
- * @param {Object} options
73
- * @param {boolean} [options.sequential] If set, only return elements that are
74
- * sequentially focusable.
75
- * Non-interactive elements with a
76
- * negative `tabindex` are focusable but
77
- * not sequentially focusable.
78
- * https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute
79
- *
80
- * @return {HTMLElement[]} Focusable elements.
81
- */
82
- export function find(context, {
83
- sequential = false
84
- } = {}) {
85
- /** @type {NodeListOf<HTMLElement>} */
30
+ function find(context, { sequential = false } = {}) {
86
31
  const elements = context.querySelectorAll(buildSelector(sequential));
87
- return Array.from(elements).filter(element => {
32
+ return Array.from(elements).filter((element) => {
88
33
  if (!isVisible(element)) {
89
34
  return false;
90
35
  }
91
- const {
92
- nodeName
93
- } = element;
94
- if ('AREA' === nodeName) {
95
- return isValidFocusableArea(/** @type {HTMLAreaElement} */element);
36
+ const { nodeName } = element;
37
+ if ("AREA" === nodeName) {
38
+ return isValidFocusableArea(
39
+ /** @type {HTMLAreaElement} */
40
+ element
41
+ );
96
42
  }
97
43
  return true;
98
44
  });
99
45
  }
100
- //# sourceMappingURL=focusable.js.map
46
+ export {
47
+ find
48
+ };
49
+ //# sourceMappingURL=focusable.js.map
@@ -1 +1,7 @@
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'summary',\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/** @type {NodeListOf<HTMLElement>} */\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,SAAS,EACT,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;AACA,OAAO,SAASI,IAAIA,CAAEC,OAAO,EAAE;EAAEhB,UAAU,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,EAAG;EAC5D;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,CAC1B,8BAAiCL,OAClC,CAAC;IACF;IAEA,OAAO,IAAI;EACZ,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/focusable.js"],
4
+ "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'summary',\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/** @type {NodeListOf<HTMLElement>} */\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"],
5
+ "mappings": "AA8BA,SAAS,cAAe,YAAa;AACpC,SAAO;AAAA,IACN,aAAa,oCAAoC;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAM,GAAI;AACb;AAUA,SAAS,UAAW,SAAU;AAC7B,SACC,QAAQ,cAAc,KACtB,QAAQ,eAAe,KACvB,QAAQ,eAAe,EAAE,SAAS;AAEpC;AAWA,SAAS,qBAAsB,SAAU;AAExC,QAAM,MAAM,QAAQ,QAAS,WAAY;AACzC,MAAK,CAAE,KAAM;AACZ,WAAO;AAAA,EACR;AAGA,QAAM,MAAM,QAAQ,cAAc;AAAA,IACjC,kBAAkB,IAAI,OAAO;AAAA,EAC9B;AACA,SAAO,CAAC,CAAE,OAAO,UAAW,GAAI;AACjC;AAgBO,SAAS,KAAM,SAAS,EAAE,aAAa,MAAM,IAAI,CAAC,GAAI;AAE5D,QAAM,WAAW,QAAQ,iBAAkB,cAAe,UAAW,CAAE;AAEvE,SAAO,MAAM,KAAM,QAAS,EAAE,OAAQ,CAAE,YAAa;AACpD,QAAK,CAAE,UAAW,OAAQ,GAAI;AAC7B,aAAO;AAAA,IACR;AAEA,UAAM,EAAE,SAAS,IAAI;AACrB,QAAK,WAAW,UAAW;AAC1B,aAAO;AAAA;AAAA,QAC2B;AAAA,MAClC;AAAA,IACD;AAEA,WAAO;AAAA,EACR,CAAE;AACH;",
6
+ "names": []
7
+ }
@@ -1,18 +1,10 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import * as focusable from './focusable';
5
- import * as tabbable from './tabbable';
6
-
7
- /**
8
- * Object grouping `focusable` and `tabbable` utils
9
- * under the keys with the same name.
10
- */
11
- export const focus = {
12
- focusable,
13
- tabbable
1
+ import * as focusable from "./focusable";
2
+ import * as tabbable from "./tabbable";
3
+ const focus = { focusable, tabbable };
4
+ export * from "./dom";
5
+ export * from "./phrasing-content";
6
+ export * from "./data-transfer";
7
+ export {
8
+ focus
14
9
  };
15
- export * from './dom';
16
- export * from './phrasing-content';
17
- export * from './data-transfer';
18
- //# sourceMappingURL=index.js.map
10
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["focusable","tabbable","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":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,SAAS,MAAM,aAAa;AACxC,OAAO,KAAKC,QAAQ,MAAM,YAAY;;AAEtC;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAG;EAAEF,SAAS;EAAEC;AAAS,CAAC;AAE5C,cAAc,OAAO;AACrB,cAAc,oBAAoB;AAClC,cAAc,iBAAiB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport * as focusable from './focusable';\nimport * as tabbable from './tabbable';\n\n/**\n * Object grouping `focusable` and `tabbable` utils\n * under the keys with the same name.\n */\nexport const focus = { focusable, tabbable };\n\nexport * from './dom';\nexport * from './phrasing-content';\nexport * from './data-transfer';\n"],
5
+ "mappings": "AAGA,YAAY,eAAe;AAC3B,YAAY,cAAc;AAMnB,MAAM,QAAQ,EAAE,WAAW,SAAS;AAE3C,cAAc;AACd,cAAc;AACd,cAAc;",
6
+ "names": []
7
+ }
@@ -1,57 +1,22 @@
1
- /**
2
- * All phrasing content elements.
3
- *
4
- * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
5
- */
6
-
7
- /**
8
- * @typedef {Record<string,SemanticElementDefinition>} ContentSchema
9
- */
10
-
11
- /**
12
- * @typedef SemanticElementDefinition
13
- * @property {string[]} [attributes] Content attributes
14
- * @property {ContentSchema} [children] Content attributes
15
- */
16
-
17
- /**
18
- * All text-level semantic elements.
19
- *
20
- * @see https://html.spec.whatwg.org/multipage/text-level-semantics.html
21
- *
22
- * @type {ContentSchema}
23
- */
24
1
  const textContentSchema = {
25
2
  strong: {},
26
3
  em: {},
27
4
  s: {},
28
5
  del: {},
29
6
  ins: {},
30
- a: {
31
- attributes: ['href', 'target', 'rel', 'id']
32
- },
7
+ a: { attributes: ["href", "target", "rel", "id"] },
33
8
  code: {},
34
- abbr: {
35
- attributes: ['title']
36
- },
9
+ abbr: { attributes: ["title"] },
37
10
  sub: {},
38
11
  sup: {},
39
12
  br: {},
40
13
  small: {},
41
14
  // To do: fix blockquote.
42
15
  // cite: {},
43
- q: {
44
- attributes: ['cite']
45
- },
46
- dfn: {
47
- attributes: ['title']
48
- },
49
- data: {
50
- attributes: ['value']
51
- },
52
- time: {
53
- attributes: ['datetime']
54
- },
16
+ q: { attributes: ["cite"] },
17
+ dfn: { attributes: ["title"] },
18
+ data: { attributes: ["value"] },
19
+ time: { attributes: ["datetime"] },
55
20
  var: {},
56
21
  samp: {},
57
22
  kbd: {},
@@ -62,84 +27,75 @@ const textContentSchema = {
62
27
  ruby: {},
63
28
  rt: {},
64
29
  rp: {},
65
- bdi: {
66
- attributes: ['dir']
67
- },
68
- bdo: {
69
- attributes: ['dir']
70
- },
30
+ bdi: { attributes: ["dir"] },
31
+ bdo: { attributes: ["dir"] },
71
32
  wbr: {},
72
- '#text': {}
33
+ "#text": {}
73
34
  };
74
-
75
- // Recursion is needed.
76
- // Possible: strong > em > strong.
77
- // Impossible: strong > strong.
78
- const excludedElements = ['#text', 'br'];
79
- Object.keys(textContentSchema).filter(element => !excludedElements.includes(element)).forEach(tag => {
80
- const {
81
- [tag]: removedTag,
82
- ...restSchema
83
- } = textContentSchema;
35
+ const excludedElements = ["#text", "br"];
36
+ Object.keys(textContentSchema).filter((element) => !excludedElements.includes(element)).forEach((tag) => {
37
+ const { [tag]: removedTag, ...restSchema } = textContentSchema;
84
38
  textContentSchema[tag].children = restSchema;
85
39
  });
86
-
87
- /**
88
- * Embedded content elements.
89
- *
90
- * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#embedded-content-0
91
- *
92
- * @type {ContentSchema}
93
- */
94
40
  const embeddedContentSchema = {
95
41
  audio: {
96
- attributes: ['src', 'preload', 'autoplay', 'mediagroup', 'loop', 'muted']
97
- },
98
- canvas: {
99
- attributes: ['width', 'height']
100
- },
101
- embed: {
102
- attributes: ['src', 'type', 'width', 'height']
42
+ attributes: [
43
+ "src",
44
+ "preload",
45
+ "autoplay",
46
+ "mediagroup",
47
+ "loop",
48
+ "muted"
49
+ ]
103
50
  },
51
+ canvas: { attributes: ["width", "height"] },
52
+ embed: { attributes: ["src", "type", "width", "height"] },
104
53
  img: {
105
- attributes: ['alt', 'src', 'srcset', 'usemap', 'ismap', 'width', 'height']
54
+ attributes: [
55
+ "alt",
56
+ "src",
57
+ "srcset",
58
+ "usemap",
59
+ "ismap",
60
+ "width",
61
+ "height"
62
+ ]
106
63
  },
107
64
  object: {
108
- attributes: ['data', 'type', 'name', 'usemap', 'form', 'width', 'height']
65
+ attributes: [
66
+ "data",
67
+ "type",
68
+ "name",
69
+ "usemap",
70
+ "form",
71
+ "width",
72
+ "height"
73
+ ]
109
74
  },
110
75
  video: {
111
- attributes: ['src', 'poster', 'preload', 'playsinline', 'autoplay', 'mediagroup', 'loop', 'muted', 'controls', 'width', 'height']
76
+ attributes: [
77
+ "src",
78
+ "poster",
79
+ "preload",
80
+ "playsinline",
81
+ "autoplay",
82
+ "mediagroup",
83
+ "loop",
84
+ "muted",
85
+ "controls",
86
+ "width",
87
+ "height"
88
+ ]
112
89
  }
113
90
  };
114
-
115
- /**
116
- * Phrasing content elements.
117
- *
118
- * @see https://www.w3.org/TR/2011/WD-html5-20110525/content-models.html#phrasing-content-0
119
- */
120
91
  const phrasingContentSchema = {
121
92
  ...textContentSchema,
122
93
  ...embeddedContentSchema
123
94
  };
124
-
125
- /**
126
- * Get schema of possible paths for phrasing content.
127
- *
128
- * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
129
- *
130
- * @param {string} [context] Set to "paste" to exclude invisible elements and
131
- * sensitive data.
132
- *
133
- * @return {Partial<ContentSchema>} Schema.
134
- */
135
- export function getPhrasingContentSchema(context) {
136
- if (context !== 'paste') {
95
+ function getPhrasingContentSchema(context) {
96
+ if (context !== "paste") {
137
97
  return phrasingContentSchema;
138
98
  }
139
-
140
- /**
141
- * @type {Partial<ContentSchema>}
142
- */
143
99
  const {
144
100
  u,
145
101
  // Used to mark misspelling. Shouldn't be pasted.
@@ -160,36 +116,22 @@ export function getPhrasingContentSchema(context) {
160
116
  ...phrasingContentSchema,
161
117
  // We shouldn't paste potentially sensitive information which is not
162
118
  // visible to the user when pasted, so strip the attributes.
163
- ins: {
164
- children: phrasingContentSchema.ins.children
165
- },
166
- del: {
167
- children: phrasingContentSchema.del.children
168
- }
119
+ ins: { children: phrasingContentSchema.ins.children },
120
+ del: { children: phrasingContentSchema.del.children }
169
121
  };
170
122
  return remainingContentSchema;
171
123
  }
172
-
173
- /**
174
- * Find out whether or not the given node is phrasing content.
175
- *
176
- * @see https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content
177
- *
178
- * @param {Node} node The node to test.
179
- *
180
- * @return {boolean} True if phrasing content, false if not.
181
- */
182
- export function isPhrasingContent(node) {
124
+ function isPhrasingContent(node) {
183
125
  const tag = node.nodeName.toLowerCase();
184
- return getPhrasingContentSchema().hasOwnProperty(tag) || tag === 'span';
126
+ return getPhrasingContentSchema().hasOwnProperty(tag) || tag === "span";
185
127
  }
186
-
187
- /**
188
- * @param {Node} node
189
- * @return {boolean} Node is text content
190
- */
191
- export function isTextContent(node) {
128
+ function isTextContent(node) {
192
129
  const tag = node.nodeName.toLowerCase();
193
- return textContentSchema.hasOwnProperty(tag) || tag === 'span';
130
+ return textContentSchema.hasOwnProperty(tag) || tag === "span";
194
131
  }
195
- //# sourceMappingURL=phrasing-content.js.map
132
+ export {
133
+ getPhrasingContentSchema,
134
+ isPhrasingContent,
135
+ isTextContent
136
+ };
137
+ //# sourceMappingURL=phrasing-content.js.map