@primer/live-region-element
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -335,9 +335,30 @@ const Ordering = { | ||
function compareMessages(a, b) { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Equal; | ||
if (a.politeness === b.politeness) { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Equal; | ||
} | ||
if (a.scheduled < b.scheduled) { | ||
return Ordering.Less; | ||
} | ||
return Ordering.Greater; | ||
} | ||
if (a.scheduled < b.scheduled) { | ||
if (a.politeness === "assertive" && b.politeness !== "assertive") { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Less; | ||
} | ||
if (a.scheduled < b.scheduled) { | ||
return Ordering.Less; | ||
} | ||
return Ordering.Greater; | ||
} | ||
if (a.politeness !== "assertive" && b.politeness === "assertive") { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Greater; | ||
} | ||
if (a.scheduled > b.scheduled) { | ||
return Ordering.Greater; | ||
} | ||
return Ordering.Less; | ||
} | ||
return Ordering.Greater; | ||
return Ordering.Equal; | ||
} | ||
@@ -344,0 +365,0 @@ function noop() { |
@@ -0,1 +1,2 @@ | ||
import { type Order } from './order'; | ||
type Politeness = 'polite' | 'assertive'; | ||
@@ -19,2 +20,7 @@ type AnnounceOptions = { | ||
}; | ||
type Message = { | ||
contents: string; | ||
politeness: Politeness; | ||
scheduled: number; | ||
}; | ||
/** | ||
@@ -50,3 +56,4 @@ * A function to cancel a scheduled message. | ||
declare const templateContent = "\n<style>\n:host {\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n</style>\n<div id=\"polite\" aria-live=\"polite\" aria-atomic=\"true\"></div>\n<div id=\"assertive\" aria-live=\"assertive\" aria-atomic=\"true\"></div>\n"; | ||
export declare function compareMessages(a: Message, b: Message): Order; | ||
export { LiveRegionElement, templateContent }; | ||
export type { AnnounceOptions }; |
@@ -337,9 +337,30 @@ import { HTMLElement, customElements } from '@lit-labs/ssr-dom-shim'; | ||
function compareMessages(a, b) { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Equal; | ||
if (a.politeness === b.politeness) { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Equal; | ||
} | ||
if (a.scheduled < b.scheduled) { | ||
return Ordering.Less; | ||
} | ||
return Ordering.Greater; | ||
} | ||
if (a.scheduled < b.scheduled) { | ||
if (a.politeness === "assertive" && b.politeness !== "assertive") { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Less; | ||
} | ||
if (a.scheduled < b.scheduled) { | ||
return Ordering.Less; | ||
} | ||
return Ordering.Greater; | ||
} | ||
if (a.politeness !== "assertive" && b.politeness === "assertive") { | ||
if (a.scheduled === b.scheduled) { | ||
return Ordering.Greater; | ||
} | ||
if (a.scheduled > b.scheduled) { | ||
return Ordering.Greater; | ||
} | ||
return Ordering.Less; | ||
} | ||
return Ordering.Greater; | ||
return Ordering.Equal; | ||
} | ||
@@ -346,0 +367,0 @@ function noop() { |
{ | ||
"name": "@primer/live-region-element", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./dist/esm/index.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
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
66622
1781