se-design 1.0.83 → 1.0.84-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/style.css +1 -1
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/InfoTooltip/index.d.ts +6 -1
- package/dist/components/TableLayout/index.d.ts +10 -0
- package/dist/index16.js +4 -4
- package/dist/index16.js.map +1 -1
- package/dist/index18.js +61 -58
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +27 -27
- package/dist/index19.js.map +1 -1
- package/dist/index207.js +16 -15
- package/dist/index207.js.map +1 -1
- package/dist/index215.js +17 -12
- package/dist/index215.js.map +1 -1
- package/dist/index22.js +51 -46
- package/dist/index22.js.map +1 -1
- package/dist/index25.js +257 -212
- package/dist/index25.js.map +1 -1
- package/dist/index28.js +49 -45
- package/dist/index28.js.map +1 -1
- package/dist/index31.js +43 -36
- package/dist/index31.js.map +1 -1
- package/dist/index38.js +184 -172
- package/dist/index38.js.map +1 -1
- package/dist/index4.js +53 -48
- package/dist/index4.js.map +1 -1
- package/dist/index43.js +30 -30
- package/dist/index43.js.map +1 -1
- package/dist/index48.js +15 -12
- package/dist/index48.js.map +1 -1
- package/dist/index53.js +22 -17
- package/dist/index53.js.map +1 -1
- package/dist/index61.js +57 -47
- package/dist/index61.js.map +1 -1
- package/dist/index68.js +46 -49
- package/dist/index68.js.map +1 -1
- package/dist/index75.js +107 -44
- package/dist/index75.js.map +1 -1
- package/package.json +1 -1
package/dist/index75.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
function
|
|
7
|
-
return
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var g = (r, e, t) => e in r ? m(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => g(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const u = "sr-only", h = "data-batch-id", f = "data-modal-announcer";
|
|
5
|
+
let c = null;
|
|
6
|
+
function p() {
|
|
7
|
+
return c || (c = new T()), c;
|
|
8
8
|
}
|
|
9
|
-
class
|
|
9
|
+
class T {
|
|
10
10
|
constructor() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
o(this, "container", null);
|
|
12
|
+
o(this, "assertiveLog", null);
|
|
13
|
+
o(this, "politeLog", null);
|
|
14
|
+
o(this, "cleanupTimers", /* @__PURE__ */ new Map());
|
|
15
|
+
o(this, "delayTimers", /* @__PURE__ */ new Map());
|
|
16
|
+
o(this, "pendingRafByBatchId", /* @__PURE__ */ new Map());
|
|
17
|
+
o(this, "ready", !1);
|
|
18
|
+
o(this, "pendingQueue", []);
|
|
19
|
+
typeof document > "u" || (this.container = document.createElement("div"), this.container.dataset.liveAnnouncer = "true", this.container.className = u, this.assertiveLog = this.createLog("assertive"), this.politeLog = this.createLog("polite"), this.container.appendChild(this.assertiveLog), this.container.appendChild(this.politeLog), document.body.prepend(this.container), this.isTestEnvironment() ? this.ready = !0 : setTimeout(() => {
|
|
18
20
|
this.ready = !0, this.flushPendingQueue();
|
|
19
21
|
}, 100));
|
|
20
22
|
}
|
|
@@ -22,25 +24,37 @@ class f {
|
|
|
22
24
|
// Public
|
|
23
25
|
// -----------------------------------------------------------------------
|
|
24
26
|
announce(e, t = {}) {
|
|
25
|
-
const
|
|
27
|
+
const i = {
|
|
26
28
|
assertiveness: t.assertiveness ?? "polite",
|
|
27
29
|
timeout: t.timeout ?? 7e3,
|
|
28
|
-
batchId: t.batchId ?? ""
|
|
30
|
+
batchId: t.batchId ?? "",
|
|
31
|
+
delay: t.delay ?? 0
|
|
29
32
|
};
|
|
33
|
+
if (i.batchId) {
|
|
34
|
+
const n = this.delayTimers.get(i.batchId);
|
|
35
|
+
n && (clearTimeout(n), this.delayTimers.delete(i.batchId));
|
|
36
|
+
}
|
|
30
37
|
if (!this.ready) {
|
|
31
38
|
this.pendingQueue.push({
|
|
32
39
|
message: e,
|
|
33
|
-
options:
|
|
40
|
+
options: i
|
|
34
41
|
});
|
|
35
42
|
return;
|
|
36
43
|
}
|
|
37
|
-
|
|
44
|
+
if (i.delay > 0) {
|
|
45
|
+
const n = i.batchId || `__delay_${Date.now()}_${Math.random()}`, a = setTimeout(() => {
|
|
46
|
+
this.delayTimers.delete(n), this.doAnnounce(e, i);
|
|
47
|
+
}, i.delay);
|
|
48
|
+
this.delayTimers.set(n, a);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.doAnnounce(e, i);
|
|
38
52
|
}
|
|
39
53
|
clear(e) {
|
|
40
54
|
(!e || e === "assertive") && this.clearLog(this.assertiveLog), (!e || e === "polite") && this.clearLog(this.politeLog);
|
|
41
55
|
}
|
|
42
56
|
destroy() {
|
|
43
|
-
this.cleanupTimers.forEach((e) => clearTimeout(e)), this.cleanupTimers.clear(), this.container?.remove(), this.container = null, this.assertiveLog = null, this.politeLog = null, this.ready = !1, this.pendingQueue = [],
|
|
57
|
+
this.cleanupTimers.forEach((e) => clearTimeout(e)), this.cleanupTimers.clear(), this.delayTimers.forEach((e) => clearTimeout(e)), this.delayTimers.clear(), this.pendingRafByBatchId.forEach((e) => cancelAnimationFrame(e)), this.pendingRafByBatchId.clear(), this.container?.remove(), this.container = null, this.assertiveLog = null, this.politeLog = null, this.ready = !1, this.pendingQueue = [], c === this && (c = null);
|
|
44
58
|
}
|
|
45
59
|
isAttached() {
|
|
46
60
|
return this.container?.isConnected ?? !1;
|
|
@@ -52,20 +66,69 @@ class f {
|
|
|
52
66
|
const t = document.createElement("div");
|
|
53
67
|
return t.setAttribute("role", "log"), t.setAttribute("aria-live", e), t.setAttribute("aria-relevant", "additions"), t;
|
|
54
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns the appropriate log element for the current context.
|
|
71
|
+
* When an aria-modal dialog is active, announcements must be made from
|
|
72
|
+
* within the modal (screen readers ignore content outside aria-modal).
|
|
73
|
+
* A live region is lazily created inside the modal and cleaned up when
|
|
74
|
+
* the modal is removed from the DOM.
|
|
75
|
+
*/
|
|
76
|
+
getLogForContext(e) {
|
|
77
|
+
const t = this.findVisibleModal();
|
|
78
|
+
if (!t)
|
|
79
|
+
return e === "assertive" ? this.assertiveLog : this.politeLog;
|
|
80
|
+
let i = t.querySelector(`[${f}]`);
|
|
81
|
+
if (!i) {
|
|
82
|
+
i = document.createElement("div"), i.setAttribute(f, "true"), i.className = u;
|
|
83
|
+
const s = this.createLog("assertive"), d = this.createLog("polite");
|
|
84
|
+
i.appendChild(s), i.appendChild(d), t.appendChild(i);
|
|
85
|
+
}
|
|
86
|
+
const n = i.querySelectorAll('[role="log"]'), a = n[0], l = n[1];
|
|
87
|
+
return e === "assertive" ? a : l;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Returns the first aria-modal element that is actually visible.
|
|
91
|
+
* A modal is considered hidden if:
|
|
92
|
+
* - it or an ancestor has aria-hidden="true", or
|
|
93
|
+
* - its computed visibility is "hidden" (se-design Modal uses the
|
|
94
|
+
* `invisible` CSS class on the wrapper when closed).
|
|
95
|
+
*/
|
|
96
|
+
findVisibleModal() {
|
|
97
|
+
const e = document.querySelectorAll('[aria-modal="true"]');
|
|
98
|
+
for (const t of e) {
|
|
99
|
+
const i = t;
|
|
100
|
+
if (!i.closest('[aria-hidden="true"]') && getComputedStyle(i).visibility !== "hidden")
|
|
101
|
+
return i;
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
55
105
|
doAnnounce(e, t) {
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
106
|
+
const i = this.getLogForContext(t.assertiveness);
|
|
107
|
+
if (!i) return;
|
|
108
|
+
let n = !1;
|
|
58
109
|
if (t.batchId) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
const o = document.createElement("div");
|
|
63
|
-
if (o.textContent = e, t.batchId && o.setAttribute(a, t.batchId), n.appendChild(o), e !== "") {
|
|
64
|
-
const c = setTimeout(() => {
|
|
65
|
-
this.removeNode(o);
|
|
66
|
-
}, t.timeout);
|
|
67
|
-
this.cleanupTimers.set(o, c);
|
|
110
|
+
const s = i.querySelector(`[${h}="${CSS.escape(t.batchId)}"]`);
|
|
111
|
+
s && (this.removeNode(s), n = !0);
|
|
68
112
|
}
|
|
113
|
+
const a = document.createElement("div");
|
|
114
|
+
a.textContent = e, t.batchId && a.setAttribute(h, t.batchId);
|
|
115
|
+
const l = () => {
|
|
116
|
+
if (i.isConnected && (i.appendChild(a), e !== "")) {
|
|
117
|
+
const s = setTimeout(() => {
|
|
118
|
+
this.removeNode(a);
|
|
119
|
+
}, t.timeout);
|
|
120
|
+
this.cleanupTimers.set(a, s);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
if (n) {
|
|
124
|
+
const s = this.pendingRafByBatchId.get(t.batchId);
|
|
125
|
+
s !== void 0 && cancelAnimationFrame(s);
|
|
126
|
+
const d = requestAnimationFrame(() => {
|
|
127
|
+
this.pendingRafByBatchId.delete(t.batchId), l();
|
|
128
|
+
});
|
|
129
|
+
this.pendingRafByBatchId.set(t.batchId, d);
|
|
130
|
+
} else
|
|
131
|
+
l();
|
|
69
132
|
}
|
|
70
133
|
removeNode(e) {
|
|
71
134
|
const t = this.cleanupTimers.get(e);
|
|
@@ -73,15 +136,15 @@ class f {
|
|
|
73
136
|
}
|
|
74
137
|
clearLog(e) {
|
|
75
138
|
e && (Array.from(e.children).forEach((t) => {
|
|
76
|
-
const
|
|
77
|
-
|
|
139
|
+
const i = this.cleanupTimers.get(t);
|
|
140
|
+
i && (clearTimeout(i), this.cleanupTimers.delete(t));
|
|
78
141
|
}), e.innerHTML = "");
|
|
79
142
|
}
|
|
80
143
|
flushPendingQueue() {
|
|
81
144
|
this.pendingQueue.splice(0).forEach(({
|
|
82
145
|
message: t,
|
|
83
|
-
options:
|
|
84
|
-
}) => this.doAnnounce(t,
|
|
146
|
+
options: i
|
|
147
|
+
}) => this.doAnnounce(t, i));
|
|
85
148
|
}
|
|
86
149
|
isTestEnvironment() {
|
|
87
150
|
try {
|
|
@@ -91,21 +154,21 @@ class f {
|
|
|
91
154
|
return !1;
|
|
92
155
|
}
|
|
93
156
|
}
|
|
94
|
-
function
|
|
157
|
+
function A(r, e) {
|
|
95
158
|
const t = typeof e == "string" ? {
|
|
96
159
|
assertiveness: e
|
|
97
160
|
} : e ?? {};
|
|
98
|
-
|
|
161
|
+
p().announce(r, t);
|
|
99
162
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
163
|
+
function L(r) {
|
|
164
|
+
c?.clear(r);
|
|
102
165
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
166
|
+
function I() {
|
|
167
|
+
c?.destroy();
|
|
105
168
|
}
|
|
106
169
|
export {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
170
|
+
A as announce,
|
|
171
|
+
L as clearAnnouncer,
|
|
172
|
+
I as destroyAnnouncer
|
|
110
173
|
};
|
|
111
174
|
//# sourceMappingURL=index75.js.map
|
package/dist/index75.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index75.js","sources":["../src/utils/a11y/liveAnnouncer/LiveAnnouncer.ts"],"sourcesContent":["/**\n * LiveAnnouncer — singleton vanilla-DOM announcer for screen readers.\n *\n * Architecture:\n * - Prepends a visually-hidden container to document.body on first use.\n * - Two <div role=\"log\" aria-live=\"...\"> regions: one polite, one assertive.\n * - Each announce() appends a NEW child node (aria-relevant=\"additions\" makes\n * screen readers announce only additions, never re-read existing content).\n * - Child nodes auto-remove after a timeout (default 7 s) to keep the DOM clean.\n * - batchId option: if a node with the same batchId already exists in a log,\n * it is replaced — so only the final value is announced (e.g. \"N results\").\n *\n * No React dependency. No role=\"status\" or role=\"alert\" (avoids double-announce\n * bugs on iOS VoiceOver).\n */\n\nexport type Assertiveness = 'assertive' | 'polite';\n\nexport interface AnnounceOptions {\n /** Default: 'polite' */\n assertiveness?: Assertiveness;\n /** Auto-clear timeout in ms. Default: 7000 */\n timeout?: number;\n /**\n * When provided, any pending node with the same batchId is replaced rather\n * than appending a second node. Useful for rapidly-updating counts\n * (e.g. search results, selection count).\n */\n batchId?: string;\n}\n\nconst DEFAULT_TIMEOUT = 7000;\nconst SAFARI_INIT_DELAY = 100;\n\nconst SR_ONLY_CLASS = 'sr-only';\n\n/** Attribute used to find batchId nodes for replacement. */\nconst BATCH_ATTR = 'data-batch-id';\n\n// ---------------------------------------------------------------------------\n// Singleton\n// ---------------------------------------------------------------------------\n\nlet instance: LiveAnnouncer | null = null;\n\n/**\n * Get or create the singleton LiveAnnouncer.\n * Safe to call multiple times — returns the same instance.\n */\nfunction getInstance(): LiveAnnouncer {\n if (!instance) {\n instance = new LiveAnnouncer();\n }\n return instance;\n}\n\n// ---------------------------------------------------------------------------\n// Class\n// ---------------------------------------------------------------------------\n\nclass LiveAnnouncer {\n private container: HTMLDivElement | null = null;\n private assertiveLog: HTMLDivElement | null = null;\n private politeLog: HTMLDivElement | null = null;\n private cleanupTimers: Map<HTMLElement, ReturnType<typeof setTimeout>> = new Map();\n private ready = false;\n private pendingQueue: Array<{ message: string; options: Required<AnnounceOptions> }> = [];\n\n constructor() {\n if (typeof document === 'undefined') return;\n\n this.container = document.createElement('div');\n this.container.dataset.liveAnnouncer = 'true';\n this.container.className = SR_ONLY_CLASS;\n\n this.assertiveLog = this.createLog('assertive');\n this.politeLog = this.createLog('polite');\n\n this.container.appendChild(this.assertiveLog);\n this.container.appendChild(this.politeLog);\n\n // Prepend so screen readers encounter it early in the DOM.\n document.body.prepend(this.container);\n\n // Safari/VoiceOver ignores content injected within ~100 ms of the live\n // region being added to the DOM. Delay readiness accordingly.\n // In test environments, skip the delay.\n if (this.isTestEnvironment()) {\n this.ready = true;\n } else {\n setTimeout(() => {\n this.ready = true;\n this.flushPendingQueue();\n }, SAFARI_INIT_DELAY);\n }\n }\n\n // -----------------------------------------------------------------------\n // Public\n // -----------------------------------------------------------------------\n\n announce(message: string, options: AnnounceOptions = {}): void {\n const resolved: Required<AnnounceOptions> = {\n assertiveness: options.assertiveness ?? 'polite',\n timeout: options.timeout ?? DEFAULT_TIMEOUT,\n batchId: options.batchId ?? '',\n };\n\n if (!this.ready) {\n this.pendingQueue.push({ message, options: resolved });\n return;\n }\n\n this.doAnnounce(message, resolved);\n }\n\n clear(assertiveness?: Assertiveness): void {\n if (!assertiveness || assertiveness === 'assertive') {\n this.clearLog(this.assertiveLog);\n }\n if (!assertiveness || assertiveness === 'polite') {\n this.clearLog(this.politeLog);\n }\n }\n\n destroy(): void {\n // Cancel all pending auto-clear timers.\n this.cleanupTimers.forEach((timer) => clearTimeout(timer));\n this.cleanupTimers.clear();\n\n this.container?.remove();\n this.container = null;\n this.assertiveLog = null;\n this.politeLog = null;\n this.ready = false;\n this.pendingQueue = [];\n\n if (instance === this) {\n instance = null;\n }\n }\n\n isAttached(): boolean {\n return this.container?.isConnected ?? false;\n }\n\n // -----------------------------------------------------------------------\n // Private\n // -----------------------------------------------------------------------\n\n private createLog(ariaLive: Assertiveness): HTMLDivElement {\n const log = document.createElement('div');\n log.setAttribute('role', 'log');\n log.setAttribute('aria-live', ariaLive);\n log.setAttribute('aria-relevant', 'additions');\n return log;\n }\n\n private doAnnounce(message: string, options: Required<AnnounceOptions>): void {\n const log = options.assertiveness === 'assertive' ? this.assertiveLog : this.politeLog;\n if (!log) return;\n\n // batchId dedup: remove any existing node with the same batchId.\n if (options.batchId) {\n const existing = log.querySelector(`[${BATCH_ATTR}=\"${CSS.escape(options.batchId)}\"]`) as HTMLElement | null;\n if (existing) {\n this.removeNode(existing);\n }\n }\n\n const node = document.createElement('div');\n node.textContent = message;\n\n if (options.batchId) {\n node.setAttribute(BATCH_ATTR, options.batchId);\n }\n\n log.appendChild(node);\n\n // Auto-remove after timeout to keep the DOM clean.\n if (message !== '') {\n const timer = setTimeout(() => {\n this.removeNode(node);\n }, options.timeout);\n this.cleanupTimers.set(node, timer);\n }\n }\n\n private removeNode(node: HTMLElement): void {\n const timer = this.cleanupTimers.get(node);\n if (timer) {\n clearTimeout(timer);\n this.cleanupTimers.delete(node);\n }\n node.remove();\n }\n\n private clearLog(log: HTMLDivElement | null): void {\n if (!log) return;\n // Cancel timers for all children in this log.\n Array.from(log.children).forEach((child) => {\n const timer = this.cleanupTimers.get(child as HTMLElement);\n if (timer) {\n clearTimeout(timer);\n this.cleanupTimers.delete(child as HTMLElement);\n }\n });\n log.innerHTML = '';\n }\n\n private flushPendingQueue(): void {\n const queued = this.pendingQueue.splice(0);\n queued.forEach(({ message, options }) => this.doAnnounce(message, options));\n }\n\n private isTestEnvironment(): boolean {\n try {\n // React 18+ test flag\n // @ts-expect-error – global test flag\n if (typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' && IS_REACT_ACT_ENVIRONMENT) return true;\n // Jest / Vitest\n // @ts-expect-error – jest global may not be typed\n if (typeof jest !== 'undefined') return true;\n // @ts-expect-error – Vitest global\n if (typeof vitest !== 'undefined') return true;\n } catch {\n // ignore\n }\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Public imperative API (module-level)\n// ---------------------------------------------------------------------------\n\n/**\n * Announce a message to screen readers.\n *\n * Works anywhere — React components, event handlers, thunks, vanilla JS.\n * The singleton live region is lazily created on first call.\n *\n * @example\n * announce('5 results found');\n * announce('Error: upload failed', { assertiveness: 'assertive' });\n * announce('3 items selected', { batchId: 'selection-count' });\n */\nexport function announce(message: string, options?: AnnounceOptions): void;\nexport function announce(message: string, assertiveness?: Assertiveness): void;\nexport function announce(\n message: string,\n optionsOrAssertiveness?: AnnounceOptions | Assertiveness\n): void {\n const options: AnnounceOptions =\n typeof optionsOrAssertiveness === 'string'\n ? { assertiveness: optionsOrAssertiveness }\n : optionsOrAssertiveness ?? {};\n\n getInstance().announce(message, options);\n}\n\n/**\n * Clear all pending announcements.\n * @param assertiveness — if omitted, clears both polite and assertive logs.\n */\nexport function clearAnnouncer(assertiveness?: Assertiveness): void {\n instance?.clear(assertiveness);\n}\n\n/**\n * Remove the live-region container from the DOM and reset the singleton.\n * Typically called when the host app unmounts (via LiveAnnouncerProvider).\n */\nexport function destroyAnnouncer(): void {\n instance?.destroy();\n}\n\n/**\n * Check whether the live-region container is currently in the DOM.\n */\nexport function isAnnouncerAttached(): boolean {\n return instance?.isAttached() ?? false;\n}\n"],"names":["SR_ONLY_CLASS","BATCH_ATTR","instance","getInstance","LiveAnnouncer","constructor","container","assertiveLog","politeLog","cleanupTimers","Map","ready","pendingQueue","document","createElement","dataset","liveAnnouncer","className","createLog","appendChild","body","prepend","isTestEnvironment","setTimeout","flushPendingQueue","SAFARI_INIT_DELAY","announce","message","options","resolved","assertiveness","timeout","DEFAULT_TIMEOUT","batchId","push","doAnnounce","clear","clearLog","destroy","forEach","timer","clearTimeout","remove","isAttached","isConnected","ariaLive","log","setAttribute","existing","querySelector","CSS","escape","removeNode","node","textContent","set","get","delete","Array","from","children","child","innerHTML","queued","splice","IS_REACT_ACT_ENVIRONMENT","jest","vitest","optionsOrAssertiveness","clearAnnouncer","destroyAnnouncer"],"mappings":";;;AAkCA,MAAMA,IAAgB,WAGhBC,IAAa;AAMnB,IAAIC,IAAiC;AAMrC,SAASC,IAA6B;AACpC,SAAKD,MACHA,IAAW,IAAIE,EAAAA,IAEVF;AACT;AAMA,MAAME,EAAc;AAAA,EAQlBC,cAAc;AAPNC,IAAAA,EAAAA,mBAAmC;AACnCC,IAAAA,EAAAA,sBAAsC;AACtCC,IAAAA,EAAAA,mBAAmC;AACnCC,IAAAA,EAAAA,2CAAqEC,IAAAA;AACrEC,IAAAA,EAAAA,eAAQ;AACRC,IAAAA,EAAAA,sBAA+E,CAAA;AAGrF,IAAI,OAAOC,WAAa,QAExB,KAAKP,YAAYO,SAASC,cAAc,KAAK,GAC7C,KAAKR,UAAUS,QAAQC,gBAAgB,QAC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AK/B,cAAc+C,IAAIK,CAAoB;AACzD,MAAIrB,MACFC,aAAaD,CAAK,GAClB,KAAK/B,cAAcgD,OAAOI,CAAoB;AAAA,IAElD,CAAC,GACDf,EAAIgB,YAAY;AAAA,EAClB;AAAA,EAEQtC,oBAA0B;AAEhCuC,IADe,KAAKnD,aAAaoD,OAAO,CAAC,EAClCzB,QAAQ,CAAC;AAAA,MAAEZ,SAAAA;AAAAA,MAASC,SAAAA;AAAAA,IAAAA,MAAc,KAAKO,WAAWR,GAASC,CAAO,CAAC;AAAA,EAC5E;AAAA,EAEQN,oBAA6B;AACnC,QAAI;AAQF,UALI,OAAO2C,4BAA6B,aAAaA,4BAGjD,OAAOC,OAAS,OAEhB,OAAOC,SAAW,IAAa,QAAO;AAAA,IAC5C,QAAQ;AAAA,IACN;AAEF,WAAO;AAAA,EACT;AACF;AAmBO,SAASzC,EACdC,GACAyC,GACM;AACN,QAAMxC,IACJ,OAAOwC,KAA2B,WAC9B;AAAA,IAAEtC,eAAesC;AAAAA,EAAAA,IACjBA,KAA0B,CAAA;AAEhCjE,EAAAA,IAAcuB,SAASC,GAASC,CAAO;AACzC;AAMO,SAASyC,EAAevC,GAAqC;AAClE5B,EAAAA,GAAUkC,MAAMN,CAAa;AAC/B;AAMO,SAASwC,IAAyB;AACvCpE,EAAAA,GAAUoC,QAAAA;AACZ;"}
|
|
1
|
+
{"version":3,"file":"index75.js","sources":["../src/utils/a11y/liveAnnouncer/LiveAnnouncer.ts"],"sourcesContent":["/**\n * LiveAnnouncer — singleton vanilla-DOM announcer for screen readers.\n *\n * Architecture:\n * - Prepends a visually-hidden container to document.body on first use.\n * - Two <div role=\"log\" aria-live=\"...\"> regions: one polite, one assertive.\n * - Each announce() appends a NEW child node (aria-relevant=\"additions\" makes\n * screen readers announce only additions, never re-read existing content).\n * - Child nodes auto-remove after a timeout (default 7 s) to keep the DOM clean.\n * - batchId option: if a node with the same batchId already exists in a log,\n * it is replaced — so only the final value is announced (e.g. \"N results\").\n *\n * No React dependency. No role=\"status\" or role=\"alert\" (avoids double-announce\n * bugs on iOS VoiceOver).\n */\n\nexport type Assertiveness = 'assertive' | 'polite';\n\nexport interface AnnounceOptions {\n /** Default: 'polite' */\n assertiveness?: Assertiveness;\n /** Auto-clear timeout in ms. Default: 7000 */\n timeout?: number;\n /**\n * When provided, any pending node with the same batchId is replaced rather\n * than appending a second node. Useful for rapidly-updating counts\n * (e.g. search results, selection count).\n */\n batchId?: string;\n /**\n * Delay in ms before the announcement is made. Useful when focus changes\n * would otherwise swallow the announcement (e.g. after adding a tag in\n * a combobox). A subsequent call with the same batchId cancels any\n * pending delayed announcement.\n */\n delay?: number;\n}\n\nconst DEFAULT_TIMEOUT = 7000;\nconst SAFARI_INIT_DELAY = 100;\n\nconst SR_ONLY_CLASS = 'sr-only';\n\n/** Attribute used to find batchId nodes for replacement. */\nconst BATCH_ATTR = 'data-batch-id';\n\n/** Attribute used to identify announcer containers injected into modals. */\nconst MODAL_ANNOUNCER_ATTR = 'data-modal-announcer';\n\n// ---------------------------------------------------------------------------\n// Singleton\n// ---------------------------------------------------------------------------\n\nlet instance: LiveAnnouncer | null = null;\n\n/**\n * Get or create the singleton LiveAnnouncer.\n * Safe to call multiple times — returns the same instance.\n */\nfunction getInstance(): LiveAnnouncer {\n if (!instance) {\n instance = new LiveAnnouncer();\n }\n return instance;\n}\n\n// ---------------------------------------------------------------------------\n// Class\n// ---------------------------------------------------------------------------\n\nclass LiveAnnouncer {\n private container: HTMLDivElement | null = null;\n private assertiveLog: HTMLDivElement | null = null;\n private politeLog: HTMLDivElement | null = null;\n private cleanupTimers: Map<HTMLElement, ReturnType<typeof setTimeout>> = new Map();\n private delayTimers: Map<string, ReturnType<typeof setTimeout>> = new Map();\n private pendingRafByBatchId: Map<string, number> = new Map();\n private ready = false;\n private pendingQueue: Array<{ message: string; options: Required<AnnounceOptions> }> = [];\n\n constructor() {\n if (typeof document === 'undefined') return;\n\n this.container = document.createElement('div');\n this.container.dataset.liveAnnouncer = 'true';\n this.container.className = SR_ONLY_CLASS;\n\n this.assertiveLog = this.createLog('assertive');\n this.politeLog = this.createLog('polite');\n\n this.container.appendChild(this.assertiveLog);\n this.container.appendChild(this.politeLog);\n\n // Prepend so screen readers encounter it early in the DOM.\n document.body.prepend(this.container);\n\n // Safari/VoiceOver ignores content injected within ~100 ms of the live\n // region being added to the DOM. Delay readiness accordingly.\n // In test environments, skip the delay.\n if (this.isTestEnvironment()) {\n this.ready = true;\n } else {\n setTimeout(() => {\n this.ready = true;\n this.flushPendingQueue();\n }, SAFARI_INIT_DELAY);\n }\n }\n\n // -----------------------------------------------------------------------\n // Public\n // -----------------------------------------------------------------------\n\n announce(message: string, options: AnnounceOptions = {}): void {\n const resolved: Required<AnnounceOptions> = {\n assertiveness: options.assertiveness ?? 'polite',\n timeout: options.timeout ?? DEFAULT_TIMEOUT,\n batchId: options.batchId ?? '',\n delay: options.delay ?? 0,\n };\n\n // Cancel any pending delayed announcement with the same batchId.\n if (resolved.batchId) {\n const pendingTimer = this.delayTimers.get(resolved.batchId);\n if (pendingTimer) {\n clearTimeout(pendingTimer);\n this.delayTimers.delete(resolved.batchId);\n }\n }\n\n if (!this.ready) {\n this.pendingQueue.push({ message, options: resolved });\n return;\n }\n\n if (resolved.delay > 0) {\n const key = resolved.batchId || `__delay_${Date.now()}_${Math.random()}`;\n const timer = setTimeout(() => {\n this.delayTimers.delete(key);\n this.doAnnounce(message, resolved);\n }, resolved.delay);\n this.delayTimers.set(key, timer);\n return;\n }\n\n this.doAnnounce(message, resolved);\n }\n\n clear(assertiveness?: Assertiveness): void {\n if (!assertiveness || assertiveness === 'assertive') {\n this.clearLog(this.assertiveLog);\n }\n if (!assertiveness || assertiveness === 'polite') {\n this.clearLog(this.politeLog);\n }\n }\n\n destroy(): void {\n // Cancel all pending auto-clear timers.\n this.cleanupTimers.forEach((timer) => clearTimeout(timer));\n this.cleanupTimers.clear();\n // Cancel all pending delayed announcements.\n this.delayTimers.forEach((timer) => clearTimeout(timer));\n this.delayTimers.clear();\n // Cancel any pending rAF deferred appends.\n this.pendingRafByBatchId.forEach((rafId) => cancelAnimationFrame(rafId));\n this.pendingRafByBatchId.clear();\n\n this.container?.remove();\n this.container = null;\n this.assertiveLog = null;\n this.politeLog = null;\n this.ready = false;\n this.pendingQueue = [];\n\n if (instance === this) {\n instance = null;\n }\n }\n\n isAttached(): boolean {\n return this.container?.isConnected ?? false;\n }\n\n // -----------------------------------------------------------------------\n // Private\n // -----------------------------------------------------------------------\n\n private createLog(ariaLive: Assertiveness): HTMLDivElement {\n const log = document.createElement('div');\n log.setAttribute('role', 'log');\n log.setAttribute('aria-live', ariaLive);\n log.setAttribute('aria-relevant', 'additions');\n return log;\n }\n\n /**\n * Returns the appropriate log element for the current context.\n * When an aria-modal dialog is active, announcements must be made from\n * within the modal (screen readers ignore content outside aria-modal).\n * A live region is lazily created inside the modal and cleaned up when\n * the modal is removed from the DOM.\n */\n private getLogForContext(assertiveness: Assertiveness): HTMLDivElement | null {\n // Find the first *visible* aria-modal dialog. Hidden modals (e.g. pre-\n // rendered paywall, upload-contacts) must be skipped — otherwise the\n // announcement lands inside a hidden container and is never read.\n const modal = this.findVisibleModal();\n if (!modal) {\n return assertiveness === 'assertive' ? this.assertiveLog : this.politeLog;\n }\n\n // Find or create a live region container inside the modal.\n let modalAnnouncer = modal.querySelector(`[${MODAL_ANNOUNCER_ATTR}]`) as HTMLDivElement | null;\n if (!modalAnnouncer) {\n modalAnnouncer = document.createElement('div');\n modalAnnouncer.setAttribute(MODAL_ANNOUNCER_ATTR, 'true');\n modalAnnouncer.className = SR_ONLY_CLASS;\n\n const assertiveLog = this.createLog('assertive');\n const politeLog = this.createLog('polite');\n modalAnnouncer.appendChild(assertiveLog);\n modalAnnouncer.appendChild(politeLog);\n\n modal.appendChild(modalAnnouncer);\n }\n\n const logs = modalAnnouncer.querySelectorAll('[role=\"log\"]');\n const assertiveLog = logs[0] as HTMLDivElement | null;\n const politeLog = logs[1] as HTMLDivElement | null;\n\n return assertiveness === 'assertive' ? assertiveLog : politeLog;\n }\n\n /**\n * Returns the first aria-modal element that is actually visible.\n * A modal is considered hidden if:\n * - it or an ancestor has aria-hidden=\"true\", or\n * - its computed visibility is \"hidden\" (se-design Modal uses the\n * `invisible` CSS class on the wrapper when closed).\n */\n private findVisibleModal(): HTMLElement | null {\n const modals = document.querySelectorAll('[aria-modal=\"true\"]');\n for (const m of modals) {\n const el = m as HTMLElement;\n if (el.closest('[aria-hidden=\"true\"]')) continue;\n if (getComputedStyle(el).visibility === 'hidden') continue;\n return el;\n }\n return null;\n }\n\n private doAnnounce(message: string, options: Required<AnnounceOptions>): void {\n const log = this.getLogForContext(options.assertiveness);\n if (!log) return;\n\n // batchId dedup: remove any existing node with the same batchId.\n let hadExisting = false;\n if (options.batchId) {\n const existing = log.querySelector(`[${BATCH_ATTR}=\"${CSS.escape(options.batchId)}\"]`) as HTMLElement | null;\n if (existing) {\n this.removeNode(existing);\n hadExisting = true;\n }\n }\n\n const node = document.createElement('div');\n node.textContent = message;\n\n if (options.batchId) {\n node.setAttribute(BATCH_ATTR, options.batchId);\n }\n\n const appendNode = () => {\n // Guard: destroy() may have been called during the rAF window\n if (!log.isConnected) return;\n log.appendChild(node);\n // Auto-remove after timeout to keep the DOM clean.\n if (message !== '') {\n const timer = setTimeout(() => {\n this.removeNode(node);\n }, options.timeout);\n this.cleanupTimers.set(node, timer);\n }\n };\n\n // When replacing a batched node, defer the append by one animation frame.\n // Remove + append in the same tick looks like a mutation to screen readers\n // (aria-relevant=\"additions\" is not triggered), so the announcement is missed.\n // Deferring ensures the SR sees a clean addition event.\n // Cancel any pending rAF for this batchId to avoid duplicate nodes if two\n // announce() calls fire before the first rAF runs.\n if (hadExisting) {\n const pendingRaf = this.pendingRafByBatchId.get(options.batchId);\n if (pendingRaf !== undefined) {\n cancelAnimationFrame(pendingRaf);\n }\n const rafId = requestAnimationFrame(() => {\n this.pendingRafByBatchId.delete(options.batchId);\n appendNode();\n });\n this.pendingRafByBatchId.set(options.batchId, rafId);\n } else {\n appendNode();\n }\n }\n\n private removeNode(node: HTMLElement): void {\n const timer = this.cleanupTimers.get(node);\n if (timer) {\n clearTimeout(timer);\n this.cleanupTimers.delete(node);\n }\n node.remove();\n }\n\n private clearLog(log: HTMLDivElement | null): void {\n if (!log) return;\n // Cancel timers for all children in this log.\n Array.from(log.children).forEach((child) => {\n const timer = this.cleanupTimers.get(child as HTMLElement);\n if (timer) {\n clearTimeout(timer);\n this.cleanupTimers.delete(child as HTMLElement);\n }\n });\n log.innerHTML = '';\n }\n\n private flushPendingQueue(): void {\n const queued = this.pendingQueue.splice(0);\n queued.forEach(({ message, options }) => this.doAnnounce(message, options));\n }\n\n private isTestEnvironment(): boolean {\n try {\n // React 18+ test flag\n // @ts-expect-error – global test flag\n if (typeof IS_REACT_ACT_ENVIRONMENT === 'boolean' && IS_REACT_ACT_ENVIRONMENT) return true;\n // Jest / Vitest\n // @ts-expect-error – jest global may not be typed\n if (typeof jest !== 'undefined') return true;\n // @ts-expect-error – Vitest global\n if (typeof vitest !== 'undefined') return true;\n } catch {\n // ignore\n }\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Public imperative API (module-level)\n// ---------------------------------------------------------------------------\n\n/**\n * Announce a message to screen readers.\n *\n * Works anywhere — React components, event handlers, thunks, vanilla JS.\n * The singleton live region is lazily created on first call.\n *\n * @example\n * announce('5 results found');\n * announce('Error: upload failed', { assertiveness: 'assertive' });\n * announce('3 items selected', { batchId: 'selection-count' });\n * announce('Invalid email', { assertiveness: 'assertive', delay: 300 });\n */\nexport function announce(message: string, options?: AnnounceOptions): void;\nexport function announce(message: string, assertiveness?: Assertiveness): void;\nexport function announce(\n message: string,\n optionsOrAssertiveness?: AnnounceOptions | Assertiveness\n): void {\n const options: AnnounceOptions =\n typeof optionsOrAssertiveness === 'string'\n ? { assertiveness: optionsOrAssertiveness }\n : optionsOrAssertiveness ?? {};\n\n getInstance().announce(message, options);\n}\n\n/**\n * Clear all pending announcements.\n * @param assertiveness — if omitted, clears both polite and assertive logs.\n */\nexport function clearAnnouncer(assertiveness?: Assertiveness): void {\n instance?.clear(assertiveness);\n}\n\n/**\n * Remove the live-region container from the DOM and reset the singleton.\n * Typically called when the host app unmounts (via LiveAnnouncerProvider).\n */\nexport function destroyAnnouncer(): void {\n instance?.destroy();\n}\n\n/**\n * Check whether the live-region container is currently in the DOM.\n */\nexport function isAnnouncerAttached(): boolean {\n return instance?.isAttached() ?? false;\n}\n"],"names":["SR_ONLY_CLASS","BATCH_ATTR","MODAL_ANNOUNCER_ATTR","instance","getInstance","LiveAnnouncer","constructor","container","assertiveLog","politeLog","cleanupTimers","Map","delayTimers","pendingRafByBatchId","ready","pendingQueue","document","createElement","dataset","liveAnnouncer","className","createLog","appendChild","body","prepend","isTestEnvironment","setTimeout","flushPendingQueue","SAFARI_INIT_DELAY","announce","message","options","resolved","assertiveness","timeout","DEFAULT_TIMEOUT","batchId","delay","pendingTimer","get","clearTimeout","delete","push","key","Date","now","Math","random","timer","doAnnounce","set","clear","clearLog","destroy","forEach","rafId","cancelAnimationFrame","remove","isAttached","isConnected","ariaLive","log","setAttribute","getLogForContext","modal","findVisibleModal","modalAnnouncer","querySelector","logs","querySelectorAll","modals","m","el","closest","getComputedStyle","visibility","hadExisting","existing","CSS","escape","removeNode","node","textContent","appendNode","pendingRaf","undefined","requestAnimationFrame","Array","from","children","child","innerHTML","queued","splice","IS_REACT_ACT_ENVIRONMENT","jest","vitest","optionsOrAssertiveness","clearAnnouncer","destroyAnnouncer"],"mappings":";;;AAyCA,MAAMA,IAAgB,WAGhBC,IAAa,iBAGbC,IAAuB;AAM7B,IAAIC,IAAiC;AAMrC,SAASC,IAA6B;AACpC,SAAKD,MACHA,IAAW,IAAIE,EAAAA,IAEVF;AACT;AAMA,MAAME,EAAc;AAAA,EAUlBC,cAAc;AATNC,IAAAA,EAAAA,mBAAmC;AACnCC,IAAAA,EAAAA,sBAAsC;AACtCC,IAAAA,EAAAA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