@wordpress/a11y
Advanced tools
Comparing version 4.7.1-next.5368f64a9.0 to 4.8.0
@@ -5,3 +5,2 @@ /** | ||
import domReady from '@wordpress/dom-ready'; | ||
import { __ } from '@wordpress/i18n'; | ||
@@ -11,3 +10,4 @@ /** | ||
*/ | ||
import { makeSetupFunction } from './shared/index'; | ||
import addContainer from './script/add-container'; | ||
import addIntroText from './script/add-intro-text'; | ||
export { speak } from './shared/index'; | ||
@@ -18,3 +18,16 @@ | ||
*/ | ||
export const setup = makeSetupFunction(__('Notifications')); | ||
export function setup() { | ||
const introText = document.getElementById('a11y-speak-intro-text'); | ||
const containerAssertive = document.getElementById('a11y-speak-assertive'); | ||
const containerPolite = document.getElementById('a11y-speak-polite'); | ||
if (introText === null) { | ||
addIntroText(); | ||
} | ||
if (containerAssertive === null) { | ||
addContainer('assertive'); | ||
} | ||
if (containerPolite === null) { | ||
addContainer('polite'); | ||
} | ||
} | ||
@@ -21,0 +34,0 @@ /** |
/** | ||
* Internal dependencies | ||
*/ | ||
import { makeSetupFunction } from '../shared/index'; | ||
export { speak } from '../shared/index'; | ||
// Without an i18n Script Module, "Notifications" (the only localized text used in this module) | ||
// will be translated on the server and provided as script-module data. | ||
let notificationsText = 'Notifications'; | ||
try { | ||
const textContent = document.getElementById('wp-script-module-data-@wordpress/a11y')?.textContent; | ||
if (textContent) { | ||
var _parsed$i18n$Notifica; | ||
const parsed = JSON.parse(textContent); | ||
notificationsText = (_parsed$i18n$Notifica = parsed?.i18n?.Notifications) !== null && _parsed$i18n$Notifica !== void 0 ? _parsed$i18n$Notifica : notificationsText; | ||
} | ||
} catch {} | ||
/** | ||
* Create the live regions. | ||
* This no-op function is exported to provide compatibility with the `wp-a11y` Script. | ||
* | ||
* Filters should inject the relevant HTML on page load instead of requiring setup. | ||
*/ | ||
export const setup = makeSetupFunction(notificationsText); | ||
setup(); | ||
export const setup = () => {}; | ||
//# sourceMappingURL=index.js.map |
/** | ||
* Internal dependencies | ||
*/ | ||
import addContainer from './add-container'; | ||
import addIntroText from './add-intro-text'; | ||
import clear from './clear'; | ||
@@ -10,23 +8,2 @@ import filterMessage from './filter-message'; | ||
/** | ||
* Create the live regions. | ||
* @param {string} introTextContent The intro text content. | ||
*/ | ||
export function makeSetupFunction(introTextContent) { | ||
return function setup() { | ||
const introText = document.getElementById('a11y-speak-intro-text'); | ||
const containerAssertive = document.getElementById('a11y-speak-assertive'); | ||
const containerPolite = document.getElementById('a11y-speak-polite'); | ||
if (introText === null) { | ||
addIntroText(introTextContent); | ||
} | ||
if (containerAssertive === null) { | ||
addContainer('assertive'); | ||
} | ||
if (containerPolite === null) { | ||
addContainer('polite'); | ||
} | ||
}; | ||
} | ||
/** | ||
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. | ||
@@ -33,0 +10,0 @@ * This module is inspired by the `speak` function in `wp-a11y.js`. |
@@ -1,6 +0,6 @@ | ||
export { speak } from "./shared/index"; | ||
/** | ||
* Create the live regions. | ||
*/ | ||
export const setup: () => void; | ||
export function setup(): void; | ||
export { speak } from "./shared/index"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,6 +1,11 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
export { speak } from '../shared/index'; | ||
/** | ||
* Create the live regions. | ||
* This no-op function is exported to provide compatibility with the `wp-a11y` Script. | ||
* | ||
* Filters should inject the relevant HTML on page load instead of requiring setup. | ||
*/ | ||
export declare const setup: () => void; | ||
//# sourceMappingURL=index.d.ts.map |
/** | ||
* Create the live regions. | ||
* @param {string} introTextContent The intro text content. | ||
*/ | ||
export function makeSetupFunction(introTextContent: string): () => void; | ||
/** | ||
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. | ||
@@ -8,0 +3,0 @@ * This module is inspired by the `speak` function in `wp-a11y.js`. |
@@ -7,3 +7,3 @@ "use strict"; | ||
}); | ||
exports.setup = void 0; | ||
exports.setup = setup; | ||
Object.defineProperty(exports, "speak", { | ||
@@ -16,3 +16,4 @@ enumerable: true, | ||
var _domReady = _interopRequireDefault(require("@wordpress/dom-ready")); | ||
var _i18n = require("@wordpress/i18n"); | ||
var _addContainer = _interopRequireDefault(require("./script/add-container")); | ||
var _addIntroText = _interopRequireDefault(require("./script/add-intro-text")); | ||
var _index = require("./shared/index"); | ||
@@ -30,3 +31,16 @@ /** | ||
*/ | ||
const setup = exports.setup = (0, _index.makeSetupFunction)((0, _i18n.__)('Notifications')); | ||
function setup() { | ||
const introText = document.getElementById('a11y-speak-intro-text'); | ||
const containerAssertive = document.getElementById('a11y-speak-assertive'); | ||
const containerPolite = document.getElementById('a11y-speak-polite'); | ||
if (introText === null) { | ||
(0, _addIntroText.default)(); | ||
} | ||
if (containerAssertive === null) { | ||
(0, _addContainer.default)('assertive'); | ||
} | ||
if (containerPolite === null) { | ||
(0, _addContainer.default)('polite'); | ||
} | ||
} | ||
@@ -33,0 +47,0 @@ /** |
@@ -18,19 +18,9 @@ "use strict"; | ||
// Without an i18n Script Module, "Notifications" (the only localized text used in this module) | ||
// will be translated on the server and provided as script-module data. | ||
let notificationsText = 'Notifications'; | ||
try { | ||
const textContent = document.getElementById('wp-script-module-data-@wordpress/a11y')?.textContent; | ||
if (textContent) { | ||
var _parsed$i18n$Notifica; | ||
const parsed = JSON.parse(textContent); | ||
notificationsText = (_parsed$i18n$Notifica = parsed?.i18n?.Notifications) !== null && _parsed$i18n$Notifica !== void 0 ? _parsed$i18n$Notifica : notificationsText; | ||
} | ||
} catch {} | ||
/** | ||
* Create the live regions. | ||
* This no-op function is exported to provide compatibility with the `wp-a11y` Script. | ||
* | ||
* Filters should inject the relevant HTML on page load instead of requiring setup. | ||
*/ | ||
const setup = exports.setup = (0, _index.makeSetupFunction)(notificationsText); | ||
setup(); | ||
const setup = () => {}; | ||
exports.setup = setup; | ||
//# sourceMappingURL=index.js.map |
@@ -7,6 +7,3 @@ "use strict"; | ||
}); | ||
exports.makeSetupFunction = makeSetupFunction; | ||
exports.speak = speak; | ||
var _addContainer = _interopRequireDefault(require("./add-container")); | ||
var _addIntroText = _interopRequireDefault(require("./add-intro-text")); | ||
var _clear = _interopRequireDefault(require("./clear")); | ||
@@ -19,23 +16,2 @@ var _filterMessage = _interopRequireDefault(require("./filter-message")); | ||
/** | ||
* Create the live regions. | ||
* @param {string} introTextContent The intro text content. | ||
*/ | ||
function makeSetupFunction(introTextContent) { | ||
return function setup() { | ||
const introText = document.getElementById('a11y-speak-intro-text'); | ||
const containerAssertive = document.getElementById('a11y-speak-assertive'); | ||
const containerPolite = document.getElementById('a11y-speak-polite'); | ||
if (introText === null) { | ||
(0, _addIntroText.default)(introTextContent); | ||
} | ||
if (containerAssertive === null) { | ||
(0, _addContainer.default)('assertive'); | ||
} | ||
if (containerPolite === null) { | ||
(0, _addContainer.default)('polite'); | ||
} | ||
}; | ||
} | ||
/** | ||
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. | ||
@@ -42,0 +18,0 @@ * This module is inspired by the `speak` function in `wp-a11y.js`. |
@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
## 4.8.0 (2024-09-19) | ||
## 4.7.0 (2024-09-05) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@wordpress/a11y", | ||
"version": "4.7.1-next.5368f64a9.0", | ||
"version": "4.8.0", | ||
"description": "Accessibility (a11y) utilities for WordPress.", | ||
@@ -34,4 +34,4 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.16.0", | ||
"@wordpress/dom-ready": "^4.7.1-next.5368f64a9.0", | ||
"@wordpress/i18n": "^5.7.1-next.5368f64a9.0" | ||
"@wordpress/dom-ready": "^4.8.0", | ||
"@wordpress/i18n": "^5.8.0" | ||
}, | ||
@@ -41,3 +41,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "24934a1f5251bbee15045d1fd953d9c5650317cd" | ||
"gitHead": "cecf5e14d317aa67407f77a7e5c8b6a43016bd42" | ||
} |
@@ -5,3 +5,2 @@ /** | ||
import domReady from '@wordpress/dom-ready'; | ||
import { __ } from '@wordpress/i18n'; | ||
@@ -11,3 +10,5 @@ /** | ||
*/ | ||
import { makeSetupFunction } from './shared/index'; | ||
import addContainer from './script/add-container'; | ||
import addIntroText from './script/add-intro-text'; | ||
export { speak } from './shared/index'; | ||
@@ -18,4 +19,22 @@ | ||
*/ | ||
export const setup = makeSetupFunction( __( 'Notifications' ) ); | ||
export function setup() { | ||
const introText = document.getElementById( 'a11y-speak-intro-text' ); | ||
const containerAssertive = document.getElementById( | ||
'a11y-speak-assertive' | ||
); | ||
const containerPolite = document.getElementById( 'a11y-speak-polite' ); | ||
if ( introText === null ) { | ||
addIntroText(); | ||
} | ||
if ( containerAssertive === null ) { | ||
addContainer( 'assertive' ); | ||
} | ||
if ( containerPolite === null ) { | ||
addContainer( 'polite' ); | ||
} | ||
} | ||
/** | ||
@@ -22,0 +41,0 @@ * Run setup on domReady. |
/** | ||
* Internal dependencies | ||
*/ | ||
import { makeSetupFunction } from '../shared/index'; | ||
export { speak } from '../shared/index'; | ||
// Without an i18n Script Module, "Notifications" (the only localized text used in this module) | ||
// will be translated on the server and provided as script-module data. | ||
let notificationsText = 'Notifications'; | ||
try { | ||
const textContent = document.getElementById( | ||
'wp-script-module-data-@wordpress/a11y' | ||
)?.textContent; | ||
if ( textContent ) { | ||
const parsed = JSON.parse( textContent ); | ||
notificationsText = parsed?.i18n?.Notifications ?? notificationsText; | ||
} | ||
} catch {} | ||
/** | ||
* Create the live regions. | ||
* This no-op function is exported to provide compatibility with the `wp-a11y` Script. | ||
* | ||
* Filters should inject the relevant HTML on page load instead of requiring setup. | ||
*/ | ||
export const setup = makeSetupFunction( notificationsText ); | ||
setup(); | ||
export const setup = () => {}; |
/** | ||
* Internal dependencies | ||
*/ | ||
import addContainer from './add-container'; | ||
import addIntroText from './add-intro-text'; | ||
import clear from './clear'; | ||
@@ -10,28 +8,2 @@ import filterMessage from './filter-message'; | ||
/** | ||
* Create the live regions. | ||
* @param {string} introTextContent The intro text content. | ||
*/ | ||
export function makeSetupFunction( introTextContent ) { | ||
return function setup() { | ||
const introText = document.getElementById( 'a11y-speak-intro-text' ); | ||
const containerAssertive = document.getElementById( | ||
'a11y-speak-assertive' | ||
); | ||
const containerPolite = document.getElementById( 'a11y-speak-polite' ); | ||
if ( introText === null ) { | ||
addIntroText( introTextContent ); | ||
} | ||
if ( containerAssertive === null ) { | ||
addContainer( 'assertive' ); | ||
} | ||
if ( containerPolite === null ) { | ||
addContainer( 'polite' ); | ||
} | ||
}; | ||
} | ||
/** | ||
* Allows you to easily announce dynamic interface updates to screen readers using ARIA live regions. | ||
@@ -38,0 +10,0 @@ * This module is inspired by the `speak` function in `wp-a11y.js`. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
0
119191
939
Updated@wordpress/dom-ready@^4.8.0
Updated@wordpress/i18n@^5.8.0