Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a11y-status

Package Overview
Dependencies
Maintainers
1
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a11y-status - npm Package Compare versions

Comparing version 1.0.0-next.60 to 1.0.0-pr706

86

dist/a11y-status.cjs.prod.js

@@ -1,28 +0,72 @@

"use strict";
'use strict';
Object.defineProperty(exports, "__esModule", {
value: !0
Object.defineProperty(exports, '__esModule', { value: true });
var throttleDebounce = require('throttle-debounce');
var statusDiv;
/**
* Get the status node or create it if it does not already exist.
*
* @param doc - document passed by the user.
* @return the singleton status node.
*/
var getStatusDiv = function getStatusDiv() {
var doc = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
if (statusDiv) {
return statusDiv;
}
statusDiv = doc.createElement('div');
statusDiv.setAttribute('id', 'a11y-status-message');
statusDiv.setAttribute('role', 'status');
statusDiv.setAttribute('aria-live', 'polite');
statusDiv.setAttribute('aria-relevant', 'additions text');
Object.assign(statusDiv.style, {
border: '0',
clip: 'rect(0 0 0 0)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: '0',
position: 'absolute',
width: '1px'
});
doc.body.append(statusDiv);
return statusDiv;
};
/**
* Remove the current live status when no changes occur within a 500ms period.
*/
var cleanupStatus = /*#__PURE__*/throttleDebounce.debounce(500, () => {
getStatusDiv().textContent = '';
});
/**
* Set the status of the created live region so that screen readers
* announce the changes for a11y.
*
* @remarks
*
* The status is using a singleton html div. This means that the same invisible
* live status element is used for the lifetime of your code.
*
* @param status the status message
* @param doc document passed by the user.
*/
var statusDiv, throttleDebounce = require("throttle-debounce"), getStatusDiv = function() {
var doc = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : document;
return statusDiv || ((statusDiv = doc.createElement("div")).setAttribute("id", "a11y-status-message"),
statusDiv.setAttribute("role", "status"), statusDiv.setAttribute("aria-live", "polite"),
statusDiv.setAttribute("aria-relevant", "additions text"), Object.assign(statusDiv.style, {
border: "0",
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: "0",
position: "absolute",
width: "1px"
}), doc.body.append(statusDiv), statusDiv);
}, cleanupStatus = throttleDebounce.debounce(500, (() => {
getStatusDiv().textContent = "";
})), setStatus = (status, doc) => {
var setStatus = (status, doc) => {
var div = getStatusDiv(doc);
status && (div.textContent = status, cleanupStatus());
if (!status) {
return;
}
div.textContent = status;
cleanupStatus();
};
exports.setStatus = setStatus;
{
"name": "a11y-status",
"version": "1.0.0-next.60",
"version": "1.0.0-pr706",
"description": "Create a singleton live region for a11y status updates",

@@ -11,2 +11,13 @@ "homepage": "https://github.com/remirror/remirror/tree/HEAD/packages/a11y-status",

],
"exports": {
".": {
"import": "./dist/a11y-status.esm.js",
"require": "./dist/a11y-status.cjs.js",
"browser": "./dist/a11y-status.browser.esm.js",
"types": "./dist/a11y-status.cjs.d.ts",
"default": "./dist/a11y-status.esm.js"
},
"./package.json": "./package.json",
"./types/*": "./dist/declarations/src/*.d.ts"
},
"main": "dist/a11y-status.cjs.js",

@@ -23,3 +34,3 @@ "module": "dist/a11y-status.esm.js",

"dependencies": {
"@babel/runtime": "^7.12.0",
"@babel/runtime": "^7.12.13",
"@types/throttle-debounce": "^2.1.0",

@@ -31,5 +42,6 @@ "throttle-debounce": "^3.0.1"

},
"meta": {
"@remirror": {
"sizeLimit": "1 KB"
}
},
"rn:dev": "src/index.ts"
}

@@ -16,5 +16,5 @@ # a11y-status

```bash
yarn add a11y-status@next # yarn
pnpm add a11y-status@next # pnpm
npm install a11y-status@next # npm
yarn add a11y-status # yarn
pnpm add a11y-status # pnpm
npm install a11y-status # npm
```

@@ -21,0 +21,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc