19
|
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; |
9
|
16 |
/******/ }; |
19
|
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 |
/******/ |
9
|
47 |
/************************************************************************/ |
19
|
48 |
var __webpack_exports__ = {}; |
16
|
49 |
// ESM COMPAT FLAG |
9
|
50 |
__webpack_require__.r(__webpack_exports__); |
|
51 |
|
16
|
52 |
// EXPORTS |
19
|
53 |
__webpack_require__.d(__webpack_exports__, { |
|
54 |
"setup": function() { return /* binding */ setup; }, |
|
55 |
"speak": function() { return /* binding */ speak; } |
|
56 |
}); |
16
|
57 |
|
19
|
58 |
;// CONCATENATED MODULE: external ["wp","domReady"] |
|
59 |
var external_wp_domReady_namespaceObject = window["wp"]["domReady"]; |
|
60 |
var external_wp_domReady_default = /*#__PURE__*/__webpack_require__.n(external_wp_domReady_namespaceObject); |
|
61 |
;// CONCATENATED MODULE: external ["wp","i18n"] |
|
62 |
var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
63 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-intro-text.js |
16
|
64 |
/** |
|
65 |
* WordPress dependencies |
|
66 |
*/ |
|
67 |
|
|
68 |
/** |
|
69 |
* Build the explanatory text to be placed before the aria live regions. |
|
70 |
* |
|
71 |
* This text is initially hidden from assistive technologies by using a `hidden` |
|
72 |
* HTML attribute which is then removed once a message fills the aria-live regions. |
|
73 |
* |
|
74 |
* @return {HTMLParagraphElement} The explanatory text HTML element. |
|
75 |
*/ |
|
76 |
|
|
77 |
function addIntroText() { |
18
|
78 |
const introText = document.createElement('p'); |
16
|
79 |
introText.id = 'a11y-speak-intro-text'; |
|
80 |
introText.className = 'a11y-speak-intro-text'; |
19
|
81 |
introText.textContent = (0,external_wp_i18n_namespaceObject.__)('Notifications'); |
16
|
82 |
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;'); |
|
83 |
introText.setAttribute('hidden', 'hidden'); |
18
|
84 |
const { |
|
85 |
body |
|
86 |
} = document; |
16
|
87 |
|
|
88 |
if (body) { |
|
89 |
body.appendChild(introText); |
|
90 |
} |
|
91 |
|
|
92 |
return introText; |
|
93 |
} |
|
94 |
|
19
|
95 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/add-container.js |
9
|
96 |
/** |
|
97 |
* Build the live regions markup. |
|
98 |
* |
16
|
99 |
* @param {string} [ariaLive] Value for the 'aria-live' attribute; default: 'polite'. |
9
|
100 |
* |
16
|
101 |
* @return {HTMLDivElement} The ARIA live region HTML element. |
9
|
102 |
*/ |
19
|
103 |
function addContainer() { |
|
104 |
let ariaLive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'polite'; |
18
|
105 |
const container = document.createElement('div'); |
|
106 |
container.id = `a11y-speak-${ariaLive}`; |
9
|
107 |
container.className = 'a11y-speak-region'; |
|
108 |
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;'); |
|
109 |
container.setAttribute('aria-live', ariaLive); |
|
110 |
container.setAttribute('aria-relevant', 'additions text'); |
|
111 |
container.setAttribute('aria-atomic', 'true'); |
18
|
112 |
const { |
|
113 |
body |
|
114 |
} = document; |
16
|
115 |
|
|
116 |
if (body) { |
|
117 |
body.appendChild(container); |
|
118 |
} |
|
119 |
|
9
|
120 |
return container; |
16
|
121 |
} |
9
|
122 |
|
19
|
123 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/clear.js |
9
|
124 |
/** |
16
|
125 |
* Clears the a11y-speak-region elements and hides the explanatory text. |
9
|
126 |
*/ |
16
|
127 |
function clear() { |
18
|
128 |
const regions = document.getElementsByClassName('a11y-speak-region'); |
|
129 |
const introText = document.getElementById('a11y-speak-intro-text'); |
9
|
130 |
|
18
|
131 |
for (let i = 0; i < regions.length; i++) { |
9
|
132 |
regions[i].textContent = ''; |
16
|
133 |
} // Make sure the explanatory text is hidden from assistive technologies. |
|
134 |
|
9
|
135 |
|
16
|
136 |
if (introText) { |
|
137 |
introText.setAttribute('hidden', 'hidden'); |
|
138 |
} |
|
139 |
} |
9
|
140 |
|
19
|
141 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/filter-message.js |
18
|
142 |
let previousMessage = ''; |
9
|
143 |
/** |
|
144 |
* Filter the message to be announced to the screenreader. |
|
145 |
* |
|
146 |
* @param {string} message The message to be announced. |
|
147 |
* |
|
148 |
* @return {string} The filtered message. |
|
149 |
*/ |
|
150 |
|
16
|
151 |
function filterMessage(message) { |
9
|
152 |
/* |
|
153 |
* Strip HTML tags (if any) from the message string. Ideally, messages should |
|
154 |
* be simple strings, carefully crafted for specific use with A11ySpeak. |
|
155 |
* When re-using already existing strings this will ensure simple HTML to be |
|
156 |
* stripped out and replaced with a space. Browsers will collapse multiple |
|
157 |
* spaces natively. |
|
158 |
*/ |
|
159 |
message = message.replace(/<[^<>]+>/g, ' '); |
16
|
160 |
/* |
|
161 |
* Safari + VoiceOver don't announce repeated, identical strings. We use |
|
162 |
* a `no-break space` to force them to think identical strings are different. |
|
163 |
*/ |
9
|
164 |
|
|
165 |
if (previousMessage === message) { |
18
|
166 |
message += '\u00A0'; |
9
|
167 |
} |
|
168 |
|
|
169 |
previousMessage = message; |
|
170 |
return message; |
16
|
171 |
} |
9
|
172 |
|
19
|
173 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/a11y/build-module/index.js |
9
|
174 |
/** |
|
175 |
* WordPress dependencies |
|
176 |
*/ |
|
177 |
|
|
178 |
/** |
|
179 |
* Internal dependencies |
|
180 |
*/ |
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
16
|
185 |
|
9
|
186 |
/** |
|
187 |
* Create the live regions. |
|
188 |
*/ |
|
189 |
|
16
|
190 |
function setup() { |
18
|
191 |
const introText = document.getElementById('a11y-speak-intro-text'); |
|
192 |
const containerAssertive = document.getElementById('a11y-speak-assertive'); |
|
193 |
const containerPolite = document.getElementById('a11y-speak-polite'); |
9
|
194 |
|
16
|
195 |
if (introText === null) { |
|
196 |
addIntroText(); |
9
|
197 |
} |
|
198 |
|
|
199 |
if (containerAssertive === null) { |
16
|
200 |
addContainer('assertive'); |
9
|
201 |
} |
16
|
202 |
|
|
203 |
if (containerPolite === null) { |
|
204 |
addContainer('polite'); |
|
205 |
} |
|
206 |
} |
9
|
207 |
/** |
|
208 |
* Run setup on domReady. |
|
209 |
*/ |
|
210 |
|
18
|
211 |
external_wp_domReady_default()(setup); |
9
|
212 |
/** |
|
213 |
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. |
16
|
214 |
* This module is inspired by the `speak` function in `wp-a11y.js`. |
9
|
215 |
* |
19
|
216 |
* @param {string} message The message to be announced by assistive technologies. |
16
|
217 |
* @param {string} [ariaLive] The politeness level for aria-live; default: 'polite'. |
9
|
218 |
* |
|
219 |
* @example |
|
220 |
* ```js |
|
221 |
* import { speak } from '@wordpress/a11y'; |
|
222 |
* |
|
223 |
* // For polite messages that shouldn't interrupt what screen readers are currently announcing. |
|
224 |
* speak( 'The message you want to send to the ARIA live region' ); |
|
225 |
* |
|
226 |
* // For assertive messages that should interrupt what screen readers are currently announcing. |
|
227 |
* speak( 'The message you want to send to the ARIA live region', 'assertive' ); |
|
228 |
* ``` |
|
229 |
*/ |
|
230 |
|
16
|
231 |
function speak(message, ariaLive) { |
|
232 |
/* |
|
233 |
* Clear previous messages to allow repeated strings being read out and hide |
|
234 |
* the explanatory text from assistive technologies. |
|
235 |
*/ |
|
236 |
clear(); |
|
237 |
message = filterMessage(message); |
18
|
238 |
const introText = document.getElementById('a11y-speak-intro-text'); |
|
239 |
const containerAssertive = document.getElementById('a11y-speak-assertive'); |
|
240 |
const containerPolite = document.getElementById('a11y-speak-polite'); |
9
|
241 |
|
16
|
242 |
if (containerAssertive && ariaLive === 'assertive') { |
9
|
243 |
containerAssertive.textContent = message; |
|
244 |
} else if (containerPolite) { |
|
245 |
containerPolite.textContent = message; |
|
246 |
} |
16
|
247 |
/* |
|
248 |
* Make the explanatory text available to assistive technologies by removing |
|
249 |
* the 'hidden' HTML attribute. |
|
250 |
*/ |
|
251 |
|
|
252 |
|
|
253 |
if (introText) { |
|
254 |
introText.removeAttribute('hidden'); |
|
255 |
} |
|
256 |
} |
9
|
257 |
|
19
|
258 |
(window.wp = window.wp || {}).a11y = __webpack_exports__; |
|
259 |
/******/ })() |
|
260 |
; |