You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
8.5 KiB

1 year ago
  1. /******/ (function() { // webpackBootstrap
  2. /******/ "use strict";
  3. /******/ // The require scope
  4. /******/ var __webpack_require__ = {};
  5. /******/
  6. /************************************************************************/
  7. /******/ /* webpack/runtime/compat get default export */
  8. /******/ !function() {
  9. /******/ // getDefaultExport function for compatibility with non-harmony modules
  10. /******/ __webpack_require__.n = function(module) {
  11. /******/ var getter = module && module.__esModule ?
  12. /******/ function() { return module['default']; } :
  13. /******/ function() { return module; };
  14. /******/ __webpack_require__.d(getter, { a: getter });
  15. /******/ return getter;
  16. /******/ };
  17. /******/ }();
  18. /******/
  19. /******/ /* webpack/runtime/define property getters */
  20. /******/ !function() {
  21. /******/ // define getter functions for harmony exports
  22. /******/ __webpack_require__.d = function(exports, definition) {
  23. /******/ for(var key in definition) {
  24. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  25. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  26. /******/ }
  27. /******/ }
  28. /******/ };
  29. /******/ }();
  30. /******/
  31. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  32. /******/ !function() {
  33. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  34. /******/ }();
  35. /******/
  36. /******/ /* webpack/runtime/make namespace object */
  37. /******/ !function() {
  38. /******/ // define __esModule on exports
  39. /******/ __webpack_require__.r = function(exports) {
  40. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  41. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  42. /******/ }
  43. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  44. /******/ };
  45. /******/ }();
  46. /******/
  47. /************************************************************************/
  48. var __webpack_exports__ = {};
  49. // ESM COMPAT FLAG
  50. __webpack_require__.r(__webpack_exports__);
  51. // EXPORTS
  52. __webpack_require__.d(__webpack_exports__, {
  53. setup: function() { return /* binding */ setup; },
  54. speak: function() { return /* binding */ speak; }
  55. });
  56. ;// CONCATENATED MODULE: external ["wp","domReady"]
  57. var external_wp_domReady_namespaceObject = window["wp"]["domReady"];
  58. var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_namespaceObject);
  59. ;// CONCATENATED MODULE: external ["wp","i18n"]
  60. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  61. ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js
  62. /**
  63. * WordPress dependencies
  64. */
  65. /**
  66. * Build the explanatory text to be placed before the aria live regions.
  67. *
  68. * This text is initially hidden from assistive technologies by using a `hidden`
  69. * HTML attribute which is then removed once a message fills the aria-live regions.
  70. *
  71. * @return {HTMLParagraphElement} The explanatory text HTML element.
  72. */
  73. function addIntroText() {
  74. const introText = document.createElement('p');
  75. introText.id = 'a11y-speak-intro-text';
  76. introText.className = 'a11y-speak-intro-text';
  77. introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications');
  78. introText.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;');
  79. introText.setAttribute('hidden', 'hidden');
  80. const {
  81. body
  82. } = document;
  83. if (body) {
  84. body.appendChild(introText);
  85. }
  86. return introText;
  87. }
  88. ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js
  89. /**
  90. * Build the live regions markup.
  91. *
  92. * @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'.
  93. *
  94. * @return {HTMLDivElement} The ARIA live region HTML element.
  95. */
  96. function addContainer(ariaLive = 'polite') {
  97. const container = document.createElement('div');
  98. container.id = `a11y-speak-${ariaLive}`;
  99. container.className = 'a11y-speak-region';
  100. container.setAttribute('style', 'position: absolute;' + 'margin: -1px;' + 'padding: 0;' + 'height: 1px;' + 'width: 1px;' + 'overflow: hidden;' + 'clip: rect(1px, 1px, 1px, 1px);' + '-webkit-clip-path: inset(50%);' + 'clip-path: inset(50%);' + 'border: 0;' + 'word-wrap: normal !important;');
  101. container.setAttribute('aria-live', ariaLive);
  102. container.setAttribute('aria-relevant', 'additions text');
  103. container.setAttribute('aria-atomic', 'true');
  104. const {
  105. body
  106. } = document;
  107. if (body) {
  108. body.appendChild(container);
  109. }
  110. return container;
  111. }
  112. ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js
  113. /**
  114. * Clears the a11y-speak-region elements and hides the explanatory text.
  115. */
  116. function clear() {
  117. const regions = document.getElementsByClassName('a11y-speak-region');
  118. const introText = document.getElementById('a11y-speak-intro-text');
  119. for (let i = 0; i < regions.length; i++) {
  120. regions[i].textContent = '';
  121. }
  122. // Make sure the explanatory text is hidden from assistive technologies.
  123. if (introText) {
  124. introText.setAttribute('hidden', 'hidden');
  125. }
  126. }
  127. ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js
  128. let previousMessage = '';
  129. /**
  130. * Filter the message to be announced to the screenreader.
  131. *
  132. * @param {string} message The message to be announced.
  133. *
  134. * @return {string} The filtered message.
  135. */
  136. function filterMessage(message) {
  137. /*
  138. * Strip HTML tags (if any) from the message string. Ideally, messages should
  139. * be simple strings, carefully crafted for specific use with A11ySpeak.
  140. * When re-using already existing strings this will ensure simple HTML to be
  141. * stripped out and replaced with a space. Browsers will collapse multiple
  142. * spaces natively.
  143. */
  144. message = message.replace(/<[^<>]+>/g, ' ');
  145. /*
  146. * Safari + VoiceOver don't announce repeated, identical strings. We use
  147. * a `no-break space` to force them to think identical strings are different.
  148. */
  149. if (previousMessage === message) {
  150. message += '\u00A0';
  151. }
  152. previousMessage = message;
  153. return message;
  154. }
  155. ;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js
  156. /**
  157. * WordPress dependencies
  158. */
  159. /**
  160. * Internal dependencies
  161. */
  162. /**
  163. * Create the live regions.
  164. */
  165. function setup() {
  166. const introText = document.getElementById('a11y-speak-intro-text');
  167. const containerAssertive = document.getElementById('a11y-speak-assertive');
  168. const containerPolite = document.getElementById('a11y-speak-polite');
  169. if (introText === null) {
  170. addIntroText();
  171. }
  172. if (containerAssertive === null) {
  173. addContainer('assertive');
  174. }
  175. if (containerPolite === null) {
  176. addContainer('polite');
  177. }
  178. }
  179. /**
  180. * Run setup on domReady.
  181. */
  182. external_wp_domReady_default()(setup);
  183. /**
  184. * Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions.
  185. * This module is inspired by the `speak` function in `wp-a11y.js`.
  186. *
  187. * @param {string} message The message to be announced by assistive technologies.
  188. * @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'.
  189. *
  190. * @example
  191. * ```js
  192. * import { speak } from '@wordpress/a11y';
  193. *
  194. * // For polite messages that shouldn't interrupt what screen readers are currently announcing.
  195. * speak( 'The message you want to send to the ARIA live region' );
  196. *
  197. * // For assertive messages that should interrupt what screen readers are currently announcing.
  198. * speak( 'The message you want to send to the ARIA live region', 'assertive' );
  199. * ```
  200. */
  201. function speak(message, ariaLive) {
  202. /*
  203. * Clear previous messages to allow repeated strings being read out and hide
  204. * the explanatory text from assistive technologies.
  205. */
  206. clear();
  207. message = filterMessage(message);
  208. const introText = document.getElementById('a11y-speak-intro-text');
  209. const containerAssertive = document.getElementById('a11y-speak-assertive');
  210. const containerPolite = document.getElementById('a11y-speak-polite');
  211. if (containerAssertive && ariaLive === 'assertive') {
  212. containerAssertive.textContent = message;
  213. } else if (containerPolite) {
  214. containerPolite.textContent = message;
  215. }
  216. /*
  217. * Make the explanatory text available to assistive technologies by removing
  218. * the 'hidden' HTML attribute.
  219. */
  220. if (introText) {
  221. introText.removeAttribute('hidden');
  222. }
  223. }
  224. (window.wp = window.wp || {}).a11y = __webpack_exports__;
  225. /******/ })()
  226. ;