@nac3/runtime 2.5.0-alpha.5 → 2.5.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/CHANGELOG.md +1017 -887
- package/README.md +145 -145
- package/SPEC.md +1761 -1442
- package/contract-head.json +16 -0
- package/dist/cli-levels.json +214 -0
- package/dist/cli-url.mjs +751 -0
- package/dist/cli.js +232 -38
- package/dist/nac-chat-client.d.ts +5 -75
- package/dist/nac-v2-extensions.d.ts +71 -68
- package/dist/nac.browser.js +118 -31
- package/dist/nac.cjs +118 -31
- package/dist/nac.d.ts +140 -34
- package/dist/nac.mjs +118 -31
- package/package.json +19 -19
package/dist/nac.browser.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// Generated by build.mjs -- do not edit. Source: yujin.app/nac-spec/js/nac.js
|
|
2
2
|
/* =====================================================================
|
|
3
3
|
NAC3 (Native Agent Contract v3) -- reference JavaScript runtime.
|
|
4
|
-
Spec:
|
|
5
|
-
|
|
4
|
+
Spec: SPEC.md (repo root). Public docs: yujin.app/nac-spec/.
|
|
5
|
+
Apache-2.0 License -- Pablo Adrian Kuschniroff + Sumi, 2026.
|
|
6
6
|
=====================================================================
|
|
7
7
|
|
|
8
8
|
AUTHORITATIVE VERSION CONSTANT: see the global.NAC export at the
|
|
9
|
-
bottom of this file. `version: '2.
|
|
10
|
-
the normative declaration. The dated changelog sections below are
|
|
9
|
+
bottom of this file. `version: '2.5.0', spec_version: '2.5'`
|
|
10
|
+
is the normative declaration. The dated changelog sections below are
|
|
11
11
|
historical notes; if they ever drift from the export, the export
|
|
12
12
|
wins.
|
|
13
13
|
|
|
@@ -1136,7 +1136,7 @@
|
|
|
1136
1136
|
|
|
1137
1137
|
function _candidateLabel(el) {
|
|
1138
1138
|
/* Best-effort human label for a DOM element. Used in
|
|
1139
|
-
candidates[].label so voice/
|
|
1139
|
+
candidates[].label so voice/assistive can re-prompt. */
|
|
1140
1140
|
if (!el) return '';
|
|
1141
1141
|
const al = el.getAttribute && el.getAttribute('aria-label');
|
|
1142
1142
|
if (al) return String(al).trim();
|
|
@@ -2362,11 +2362,34 @@
|
|
|
2362
2362
|
fields[], tabs[], kpis[], rows.cells[], breadcrumbs[], etc. */
|
|
2363
2363
|
function _collectManifestIds(m) {
|
|
2364
2364
|
const out = [];
|
|
2365
|
+
/* v2.5 fix (audit N-33): the CANONICAL manifest shape is
|
|
2366
|
+
`elements: [{ id, role, ... }]` -- that is what section 4
|
|
2367
|
+
documents, what every demo ships and what the rest of this
|
|
2368
|
+
runtime reads (see _capabilityFor, which walks
|
|
2369
|
+
m.elements.concat(m.tabs) by `.id`). This collector used to
|
|
2370
|
+
read ONLY the legacy groups below, keyed by `nac_id`, so for
|
|
2371
|
+
a manifest written the documented way it returned an empty
|
|
2372
|
+
list. Everything built on top went quietly wrong in the same
|
|
2373
|
+
direction: validate_global() reported total_ids = 0, called
|
|
2374
|
+
every declared element an orphan, could never report a
|
|
2375
|
+
duplicate, an unmounted id or a convention violation, and
|
|
2376
|
+
still answered ok = true. A validator that cannot see the
|
|
2377
|
+
manifest is not a lenient validator, it is a green light
|
|
2378
|
+
with nothing behind it. Both shapes are read now; the legacy
|
|
2379
|
+
groups stay because manifests in the wild still use them. */
|
|
2380
|
+
const elems = (m && m.elements) || [];
|
|
2381
|
+
elems.forEach(function (e) {
|
|
2382
|
+
if (e && e.id) out.push(String(e.id));
|
|
2383
|
+
});
|
|
2365
2384
|
const groups = ['actions', 'fields', 'tabs', 'kpis', 'charts'];
|
|
2366
2385
|
groups.forEach(function (g) {
|
|
2367
2386
|
const arr = (m && m[g]) || [];
|
|
2368
2387
|
arr.forEach(function (x) {
|
|
2388
|
+
/* tabs are declared with `.id` in the canonical shape and
|
|
2389
|
+
with `.nac_id` in the legacy one; take whichever is there
|
|
2390
|
+
instead of choosing a winner. */
|
|
2369
2391
|
if (x && x.nac_id) out.push(String(x.nac_id));
|
|
2392
|
+
else if (x && x.id) out.push(String(x.id));
|
|
2370
2393
|
});
|
|
2371
2394
|
});
|
|
2372
2395
|
if (m && m.rows && Array.isArray(m.rows.cells)) {
|
|
@@ -2383,7 +2406,14 @@
|
|
|
2383
2406
|
}
|
|
2384
2407
|
});
|
|
2385
2408
|
}
|
|
2386
|
-
|
|
2409
|
+
/* Unique: an id declared in two shapes of the SAME manifest is one
|
|
2410
|
+
id, not a cross-plugin duplicate. */
|
|
2411
|
+
const seen = Object.create(null);
|
|
2412
|
+
return out.filter(function (id) {
|
|
2413
|
+
if (seen[id]) return false;
|
|
2414
|
+
seen[id] = true;
|
|
2415
|
+
return true;
|
|
2416
|
+
});
|
|
2387
2417
|
}
|
|
2388
2418
|
|
|
2389
2419
|
function unregister(slug) {
|
|
@@ -3488,23 +3518,45 @@
|
|
|
3488
3518
|
_focusElement(el);
|
|
3489
3519
|
const ft = el.getAttribute('data-nac-field-type');
|
|
3490
3520
|
|
|
3521
|
+
/* The native property setter, or null when this host has no such
|
|
3522
|
+
constructor (audit N-44).
|
|
3523
|
+
|
|
3524
|
+
Every call site below already had a fallback -- `el.value = v`
|
|
3525
|
+
when the descriptor has no setter -- and the fallback was
|
|
3526
|
+
UNREACHABLE in the only environment it was written for. The guard
|
|
3527
|
+
tested the descriptor and the expression reached through
|
|
3528
|
+
`window.HTMLInputElement.prototype` to produce it, so on a host
|
|
3529
|
+
with a partial DOM (a test shim, an SSR or headless context --
|
|
3530
|
+
the paths this runtime claims to support) fill() threw
|
|
3531
|
+
`Cannot read properties of undefined (reading 'prototype')`
|
|
3532
|
+
before any fallback could run. Worse than the crash: the thrown
|
|
3533
|
+
value is a raw TypeError with no `code`, so a caller relying on
|
|
3534
|
+
the error contract gets nothing it can branch on.
|
|
3535
|
+
|
|
3536
|
+
A real browser is unaffected: the constructors always exist,
|
|
3537
|
+
the descriptor is found, and the native setter is used exactly
|
|
3538
|
+
as before -- which is what keeps React's controlled inputs
|
|
3539
|
+
working. */
|
|
3540
|
+
const _nativeSetter = function (ctorName, prop) {
|
|
3541
|
+
var ctor = (typeof window !== 'undefined') ? window[ctorName] : undefined;
|
|
3542
|
+
if (!ctor || !ctor.prototype) return null;
|
|
3543
|
+
var d = Object.getOwnPropertyDescriptor(ctor.prototype, prop);
|
|
3544
|
+
return (d && d.set) ? d.set : null;
|
|
3545
|
+
};
|
|
3546
|
+
|
|
3491
3547
|
if (ft === 'checkbox' || ft === 'radio') {
|
|
3492
3548
|
/* React tracks `checked` similarly to `value`; use the native
|
|
3493
3549
|
setter so controlled checkboxes/radios update state. */
|
|
3494
|
-
var nativeCheckedSetter =
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
if (nativeCheckedSetter && nativeCheckedSetter.set) {
|
|
3498
|
-
nativeCheckedSetter.set.call(el, !!value);
|
|
3550
|
+
var nativeCheckedSetter = _nativeSetter('HTMLInputElement', 'checked');
|
|
3551
|
+
if (nativeCheckedSetter) {
|
|
3552
|
+
nativeCheckedSetter.call(el, !!value);
|
|
3499
3553
|
} else {
|
|
3500
3554
|
el.checked = !!value;
|
|
3501
3555
|
}
|
|
3502
3556
|
} else if (el.tagName === 'SELECT') {
|
|
3503
|
-
var nativeSelectSetter =
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
if (nativeSelectSetter && nativeSelectSetter.set) {
|
|
3507
|
-
nativeSelectSetter.set.call(el, String(value));
|
|
3557
|
+
var nativeSelectSetter = _nativeSetter('HTMLSelectElement', 'value');
|
|
3558
|
+
if (nativeSelectSetter) {
|
|
3559
|
+
nativeSelectSetter.call(el, String(value));
|
|
3508
3560
|
} else {
|
|
3509
3561
|
el.value = String(value);
|
|
3510
3562
|
}
|
|
@@ -3516,13 +3568,13 @@
|
|
|
3516
3568
|
tracks the original property setter on HTMLInputElement.prototype.
|
|
3517
3569
|
Use the native setter so React's onChange receives the new value
|
|
3518
3570
|
and updates its state. Works on plain DOM inputs unchanged. */
|
|
3519
|
-
var
|
|
3520
|
-
?
|
|
3521
|
-
|
|
3522
|
-
|
|
3571
|
+
var nativeValueSetter = _nativeSetter(
|
|
3572
|
+
(el.tagName === 'TEXTAREA') ? 'HTMLTextAreaElement' : 'HTMLInputElement',
|
|
3573
|
+
'value'
|
|
3574
|
+
);
|
|
3523
3575
|
var newVal = String(value == null ? '' : value);
|
|
3524
|
-
if (nativeValueSetter
|
|
3525
|
-
nativeValueSetter.
|
|
3576
|
+
if (nativeValueSetter) {
|
|
3577
|
+
nativeValueSetter.call(el, newVal);
|
|
3526
3578
|
} else {
|
|
3527
3579
|
el.value = newVal;
|
|
3528
3580
|
}
|
|
@@ -4629,16 +4681,36 @@
|
|
|
4629
4681
|
DOM that belong to no manifest?" The per-plugin validate(slug)
|
|
4630
4682
|
cannot see across boundaries; this one can.
|
|
4631
4683
|
|
|
4632
|
-
Returns
|
|
4684
|
+
Returns an OBJECT OF NAMED BUCKETS -- not a flat array of
|
|
4685
|
+
findings. Every item of every bucket carries `code` and
|
|
4686
|
+
`severity` since 2.5.0 (audit N-14), so a CI integration can
|
|
4687
|
+
gate on a code without parsing a message:
|
|
4633
4688
|
{
|
|
4634
4689
|
ok: boolean,
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4690
|
+
has_errors: boolean,
|
|
4691
|
+
duplicates: [{code nac_id_duplicate_across_plugins,
|
|
4692
|
+
severity error, nac_id, plugins:[...]}],
|
|
4693
|
+
orphans: [{code nac_id_orphan_in_dom, severity warn,
|
|
4694
|
+
nac_id, in_dom:true, in_manifest:false,
|
|
4695
|
+
plugin_root:?}],
|
|
4696
|
+
unmounted: [{code nac_id_declared_not_mounted,
|
|
4697
|
+
severity warn, nac_id, in_manifest:true,
|
|
4698
|
+
in_dom:false, plugin}],
|
|
4699
|
+
convention_violations:
|
|
4700
|
+
[{code nac_id_missing_plugin_prefix,
|
|
4701
|
+
severity warn, nac_id, plugin, hint}],
|
|
4702
|
+
plugin_instance_violations:
|
|
4703
|
+
[{code duplicate_plugin_no_instance_id,
|
|
4704
|
+
severity error, slug, ...}],
|
|
4705
|
+
tolerated: [{kind, nac_id, until, original}],
|
|
4639
4706
|
plugin_count, total_ids,
|
|
4640
4707
|
timestamp
|
|
4641
4708
|
}
|
|
4709
|
+
The five codes are published, with their severity and what to do
|
|
4710
|
+
about each, in api/latest/findings.json. (The code names above are
|
|
4711
|
+
written unquoted on purpose: the catalogue generator greps the
|
|
4712
|
+
emission shape out of this file, and a comment is not an
|
|
4713
|
+
emission.)
|
|
4642
4714
|
|
|
4643
4715
|
A NAC-3 codebase that wants drift to be a CI blocker should run
|
|
4644
4716
|
this in addition to the per-plugin validate(slug) loop. */
|
|
@@ -4677,6 +4749,13 @@
|
|
|
4677
4749
|
ids.forEach(function (id) {
|
|
4678
4750
|
if (id.indexOf(slug + '.') !== 0 && id !== slug) {
|
|
4679
4751
|
out.convention_violations.push({
|
|
4752
|
+
/* v2.5 / audit N-14: every finding of this validator carries
|
|
4753
|
+
a code from the published catalogue, so section 12 promise
|
|
4754
|
+
4 ("the validate_global finding codes will not be reused")
|
|
4755
|
+
covers a real set instead of an empty one. The code is the
|
|
4756
|
+
stable identity; the message is not. */
|
|
4757
|
+
code: 'nac_id_missing_plugin_prefix',
|
|
4758
|
+
severity: 'warn',
|
|
4680
4759
|
nac_id: id, plugin: slug,
|
|
4681
4760
|
hint: 'expected prefix "' + slug + '."',
|
|
4682
4761
|
});
|
|
@@ -4688,7 +4767,11 @@
|
|
|
4688
4767
|
/* Duplicates: any id that appears in 2+ manifests. */
|
|
4689
4768
|
for (const id in idIndex) {
|
|
4690
4769
|
if (idIndex[id].length >= 2) {
|
|
4691
|
-
out.duplicates.push({
|
|
4770
|
+
out.duplicates.push({
|
|
4771
|
+
code: 'nac_id_duplicate_across_plugins',
|
|
4772
|
+
severity: 'error',
|
|
4773
|
+
nac_id: id, plugins: idIndex[id].slice(),
|
|
4774
|
+
});
|
|
4692
4775
|
}
|
|
4693
4776
|
}
|
|
4694
4777
|
|
|
@@ -4709,6 +4792,8 @@
|
|
|
4709
4792
|
severity for the caller to decide. */
|
|
4710
4793
|
const root = el.closest('[data-nac-plugin]');
|
|
4711
4794
|
out.orphans.push({
|
|
4795
|
+
code: 'nac_id_orphan_in_dom',
|
|
4796
|
+
severity: 'warn',
|
|
4712
4797
|
nac_id: id,
|
|
4713
4798
|
in_dom: true,
|
|
4714
4799
|
in_manifest: false,
|
|
@@ -4722,6 +4807,8 @@
|
|
|
4722
4807
|
for (const id in idIndex) {
|
|
4723
4808
|
if (!inDom[id]) {
|
|
4724
4809
|
out.unmounted.push({
|
|
4810
|
+
code: 'nac_id_declared_not_mounted',
|
|
4811
|
+
severity: 'warn',
|
|
4725
4812
|
nac_id: id, in_manifest: true, in_dom: false,
|
|
4726
4813
|
plugin: idIndex[id][0],
|
|
4727
4814
|
});
|
|
@@ -7591,7 +7678,7 @@
|
|
|
7591
7678
|
}
|
|
7592
7679
|
|
|
7593
7680
|
/* ================================================================
|
|
7594
|
-
v2.5 Block C -- RFC V25-03:
|
|
7681
|
+
v2.5 Block C -- RFC V25-03: assistive labels (narrate)
|
|
7595
7682
|
================================================================
|
|
7596
7683
|
|
|
7597
7684
|
NAC.narrate(plugin, nac_id) -> string
|
|
@@ -7834,7 +7921,7 @@
|
|
|
7834
7921
|
|
|
7835
7922
|
global.NAC = {
|
|
7836
7923
|
__nac_v1_installed: true,
|
|
7837
|
-
version: '2.5.0
|
|
7924
|
+
version: '2.5.0',
|
|
7838
7925
|
spec_version: '2.5',
|
|
7839
7926
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7840
7927
|
NAC.register throws on findings (manifest_role_unknown,
|
|
@@ -8085,7 +8172,7 @@
|
|
|
8085
8172
|
read: read,
|
|
8086
8173
|
subscribe: subscribe,
|
|
8087
8174
|
unsubscribe: unsubscribe,
|
|
8088
|
-
/* v2.5 Block C --
|
|
8175
|
+
/* v2.5 Block C -- assistive labels (SPEC.md sec 17 / RFC V25-03).
|
|
8089
8176
|
Canonical human-readable label resolution for screen readers,
|
|
8090
8177
|
TTS, voice flows, audit logs. Priority order: aria-label >
|
|
8091
8178
|
visible text > data-nac-label > nac_id fallback. */
|
package/dist/nac.cjs
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== 'undefined' ? window : {});
|
|
3
3
|
/* =====================================================================
|
|
4
4
|
NAC3 (Native Agent Contract v3) -- reference JavaScript runtime.
|
|
5
|
-
Spec:
|
|
6
|
-
|
|
5
|
+
Spec: SPEC.md (repo root). Public docs: yujin.app/nac-spec/.
|
|
6
|
+
Apache-2.0 License -- Pablo Adrian Kuschniroff + Sumi, 2026.
|
|
7
7
|
=====================================================================
|
|
8
8
|
|
|
9
9
|
AUTHORITATIVE VERSION CONSTANT: see the global.NAC export at the
|
|
10
|
-
bottom of this file. `version: '2.
|
|
11
|
-
the normative declaration. The dated changelog sections below are
|
|
10
|
+
bottom of this file. `version: '2.5.0', spec_version: '2.5'`
|
|
11
|
+
is the normative declaration. The dated changelog sections below are
|
|
12
12
|
historical notes; if they ever drift from the export, the export
|
|
13
13
|
wins.
|
|
14
14
|
|
|
@@ -1137,7 +1137,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
1137
1137
|
|
|
1138
1138
|
function _candidateLabel(el) {
|
|
1139
1139
|
/* Best-effort human label for a DOM element. Used in
|
|
1140
|
-
candidates[].label so voice/
|
|
1140
|
+
candidates[].label so voice/assistive can re-prompt. */
|
|
1141
1141
|
if (!el) return '';
|
|
1142
1142
|
const al = el.getAttribute && el.getAttribute('aria-label');
|
|
1143
1143
|
if (al) return String(al).trim();
|
|
@@ -2363,11 +2363,34 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
2363
2363
|
fields[], tabs[], kpis[], rows.cells[], breadcrumbs[], etc. */
|
|
2364
2364
|
function _collectManifestIds(m) {
|
|
2365
2365
|
const out = [];
|
|
2366
|
+
/* v2.5 fix (audit N-33): the CANONICAL manifest shape is
|
|
2367
|
+
`elements: [{ id, role, ... }]` -- that is what section 4
|
|
2368
|
+
documents, what every demo ships and what the rest of this
|
|
2369
|
+
runtime reads (see _capabilityFor, which walks
|
|
2370
|
+
m.elements.concat(m.tabs) by `.id`). This collector used to
|
|
2371
|
+
read ONLY the legacy groups below, keyed by `nac_id`, so for
|
|
2372
|
+
a manifest written the documented way it returned an empty
|
|
2373
|
+
list. Everything built on top went quietly wrong in the same
|
|
2374
|
+
direction: validate_global() reported total_ids = 0, called
|
|
2375
|
+
every declared element an orphan, could never report a
|
|
2376
|
+
duplicate, an unmounted id or a convention violation, and
|
|
2377
|
+
still answered ok = true. A validator that cannot see the
|
|
2378
|
+
manifest is not a lenient validator, it is a green light
|
|
2379
|
+
with nothing behind it. Both shapes are read now; the legacy
|
|
2380
|
+
groups stay because manifests in the wild still use them. */
|
|
2381
|
+
const elems = (m && m.elements) || [];
|
|
2382
|
+
elems.forEach(function (e) {
|
|
2383
|
+
if (e && e.id) out.push(String(e.id));
|
|
2384
|
+
});
|
|
2366
2385
|
const groups = ['actions', 'fields', 'tabs', 'kpis', 'charts'];
|
|
2367
2386
|
groups.forEach(function (g) {
|
|
2368
2387
|
const arr = (m && m[g]) || [];
|
|
2369
2388
|
arr.forEach(function (x) {
|
|
2389
|
+
/* tabs are declared with `.id` in the canonical shape and
|
|
2390
|
+
with `.nac_id` in the legacy one; take whichever is there
|
|
2391
|
+
instead of choosing a winner. */
|
|
2370
2392
|
if (x && x.nac_id) out.push(String(x.nac_id));
|
|
2393
|
+
else if (x && x.id) out.push(String(x.id));
|
|
2371
2394
|
});
|
|
2372
2395
|
});
|
|
2373
2396
|
if (m && m.rows && Array.isArray(m.rows.cells)) {
|
|
@@ -2384,7 +2407,14 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
2384
2407
|
}
|
|
2385
2408
|
});
|
|
2386
2409
|
}
|
|
2387
|
-
|
|
2410
|
+
/* Unique: an id declared in two shapes of the SAME manifest is one
|
|
2411
|
+
id, not a cross-plugin duplicate. */
|
|
2412
|
+
const seen = Object.create(null);
|
|
2413
|
+
return out.filter(function (id) {
|
|
2414
|
+
if (seen[id]) return false;
|
|
2415
|
+
seen[id] = true;
|
|
2416
|
+
return true;
|
|
2417
|
+
});
|
|
2388
2418
|
}
|
|
2389
2419
|
|
|
2390
2420
|
function unregister(slug) {
|
|
@@ -3489,23 +3519,45 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3489
3519
|
_focusElement(el);
|
|
3490
3520
|
const ft = el.getAttribute('data-nac-field-type');
|
|
3491
3521
|
|
|
3522
|
+
/* The native property setter, or null when this host has no such
|
|
3523
|
+
constructor (audit N-44).
|
|
3524
|
+
|
|
3525
|
+
Every call site below already had a fallback -- `el.value = v`
|
|
3526
|
+
when the descriptor has no setter -- and the fallback was
|
|
3527
|
+
UNREACHABLE in the only environment it was written for. The guard
|
|
3528
|
+
tested the descriptor and the expression reached through
|
|
3529
|
+
`window.HTMLInputElement.prototype` to produce it, so on a host
|
|
3530
|
+
with a partial DOM (a test shim, an SSR or headless context --
|
|
3531
|
+
the paths this runtime claims to support) fill() threw
|
|
3532
|
+
`Cannot read properties of undefined (reading 'prototype')`
|
|
3533
|
+
before any fallback could run. Worse than the crash: the thrown
|
|
3534
|
+
value is a raw TypeError with no `code`, so a caller relying on
|
|
3535
|
+
the error contract gets nothing it can branch on.
|
|
3536
|
+
|
|
3537
|
+
A real browser is unaffected: the constructors always exist,
|
|
3538
|
+
the descriptor is found, and the native setter is used exactly
|
|
3539
|
+
as before -- which is what keeps React's controlled inputs
|
|
3540
|
+
working. */
|
|
3541
|
+
const _nativeSetter = function (ctorName, prop) {
|
|
3542
|
+
var ctor = (typeof window !== 'undefined') ? window[ctorName] : undefined;
|
|
3543
|
+
if (!ctor || !ctor.prototype) return null;
|
|
3544
|
+
var d = Object.getOwnPropertyDescriptor(ctor.prototype, prop);
|
|
3545
|
+
return (d && d.set) ? d.set : null;
|
|
3546
|
+
};
|
|
3547
|
+
|
|
3492
3548
|
if (ft === 'checkbox' || ft === 'radio') {
|
|
3493
3549
|
/* React tracks `checked` similarly to `value`; use the native
|
|
3494
3550
|
setter so controlled checkboxes/radios update state. */
|
|
3495
|
-
var nativeCheckedSetter =
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
if (nativeCheckedSetter && nativeCheckedSetter.set) {
|
|
3499
|
-
nativeCheckedSetter.set.call(el, !!value);
|
|
3551
|
+
var nativeCheckedSetter = _nativeSetter('HTMLInputElement', 'checked');
|
|
3552
|
+
if (nativeCheckedSetter) {
|
|
3553
|
+
nativeCheckedSetter.call(el, !!value);
|
|
3500
3554
|
} else {
|
|
3501
3555
|
el.checked = !!value;
|
|
3502
3556
|
}
|
|
3503
3557
|
} else if (el.tagName === 'SELECT') {
|
|
3504
|
-
var nativeSelectSetter =
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
if (nativeSelectSetter && nativeSelectSetter.set) {
|
|
3508
|
-
nativeSelectSetter.set.call(el, String(value));
|
|
3558
|
+
var nativeSelectSetter = _nativeSetter('HTMLSelectElement', 'value');
|
|
3559
|
+
if (nativeSelectSetter) {
|
|
3560
|
+
nativeSelectSetter.call(el, String(value));
|
|
3509
3561
|
} else {
|
|
3510
3562
|
el.value = String(value);
|
|
3511
3563
|
}
|
|
@@ -3517,13 +3569,13 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
3517
3569
|
tracks the original property setter on HTMLInputElement.prototype.
|
|
3518
3570
|
Use the native setter so React's onChange receives the new value
|
|
3519
3571
|
and updates its state. Works on plain DOM inputs unchanged. */
|
|
3520
|
-
var
|
|
3521
|
-
?
|
|
3522
|
-
|
|
3523
|
-
|
|
3572
|
+
var nativeValueSetter = _nativeSetter(
|
|
3573
|
+
(el.tagName === 'TEXTAREA') ? 'HTMLTextAreaElement' : 'HTMLInputElement',
|
|
3574
|
+
'value'
|
|
3575
|
+
);
|
|
3524
3576
|
var newVal = String(value == null ? '' : value);
|
|
3525
|
-
if (nativeValueSetter
|
|
3526
|
-
nativeValueSetter.
|
|
3577
|
+
if (nativeValueSetter) {
|
|
3578
|
+
nativeValueSetter.call(el, newVal);
|
|
3527
3579
|
} else {
|
|
3528
3580
|
el.value = newVal;
|
|
3529
3581
|
}
|
|
@@ -4630,16 +4682,36 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4630
4682
|
DOM that belong to no manifest?" The per-plugin validate(slug)
|
|
4631
4683
|
cannot see across boundaries; this one can.
|
|
4632
4684
|
|
|
4633
|
-
Returns
|
|
4685
|
+
Returns an OBJECT OF NAMED BUCKETS -- not a flat array of
|
|
4686
|
+
findings. Every item of every bucket carries `code` and
|
|
4687
|
+
`severity` since 2.5.0 (audit N-14), so a CI integration can
|
|
4688
|
+
gate on a code without parsing a message:
|
|
4634
4689
|
{
|
|
4635
4690
|
ok: boolean,
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4691
|
+
has_errors: boolean,
|
|
4692
|
+
duplicates: [{code nac_id_duplicate_across_plugins,
|
|
4693
|
+
severity error, nac_id, plugins:[...]}],
|
|
4694
|
+
orphans: [{code nac_id_orphan_in_dom, severity warn,
|
|
4695
|
+
nac_id, in_dom:true, in_manifest:false,
|
|
4696
|
+
plugin_root:?}],
|
|
4697
|
+
unmounted: [{code nac_id_declared_not_mounted,
|
|
4698
|
+
severity warn, nac_id, in_manifest:true,
|
|
4699
|
+
in_dom:false, plugin}],
|
|
4700
|
+
convention_violations:
|
|
4701
|
+
[{code nac_id_missing_plugin_prefix,
|
|
4702
|
+
severity warn, nac_id, plugin, hint}],
|
|
4703
|
+
plugin_instance_violations:
|
|
4704
|
+
[{code duplicate_plugin_no_instance_id,
|
|
4705
|
+
severity error, slug, ...}],
|
|
4706
|
+
tolerated: [{kind, nac_id, until, original}],
|
|
4640
4707
|
plugin_count, total_ids,
|
|
4641
4708
|
timestamp
|
|
4642
4709
|
}
|
|
4710
|
+
The five codes are published, with their severity and what to do
|
|
4711
|
+
about each, in api/latest/findings.json. (The code names above are
|
|
4712
|
+
written unquoted on purpose: the catalogue generator greps the
|
|
4713
|
+
emission shape out of this file, and a comment is not an
|
|
4714
|
+
emission.)
|
|
4643
4715
|
|
|
4644
4716
|
A NAC-3 codebase that wants drift to be a CI blocker should run
|
|
4645
4717
|
this in addition to the per-plugin validate(slug) loop. */
|
|
@@ -4678,6 +4750,13 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4678
4750
|
ids.forEach(function (id) {
|
|
4679
4751
|
if (id.indexOf(slug + '.') !== 0 && id !== slug) {
|
|
4680
4752
|
out.convention_violations.push({
|
|
4753
|
+
/* v2.5 / audit N-14: every finding of this validator carries
|
|
4754
|
+
a code from the published catalogue, so section 12 promise
|
|
4755
|
+
4 ("the validate_global finding codes will not be reused")
|
|
4756
|
+
covers a real set instead of an empty one. The code is the
|
|
4757
|
+
stable identity; the message is not. */
|
|
4758
|
+
code: 'nac_id_missing_plugin_prefix',
|
|
4759
|
+
severity: 'warn',
|
|
4681
4760
|
nac_id: id, plugin: slug,
|
|
4682
4761
|
hint: 'expected prefix "' + slug + '."',
|
|
4683
4762
|
});
|
|
@@ -4689,7 +4768,11 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4689
4768
|
/* Duplicates: any id that appears in 2+ manifests. */
|
|
4690
4769
|
for (const id in idIndex) {
|
|
4691
4770
|
if (idIndex[id].length >= 2) {
|
|
4692
|
-
out.duplicates.push({
|
|
4771
|
+
out.duplicates.push({
|
|
4772
|
+
code: 'nac_id_duplicate_across_plugins',
|
|
4773
|
+
severity: 'error',
|
|
4774
|
+
nac_id: id, plugins: idIndex[id].slice(),
|
|
4775
|
+
});
|
|
4693
4776
|
}
|
|
4694
4777
|
}
|
|
4695
4778
|
|
|
@@ -4710,6 +4793,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4710
4793
|
severity for the caller to decide. */
|
|
4711
4794
|
const root = el.closest('[data-nac-plugin]');
|
|
4712
4795
|
out.orphans.push({
|
|
4796
|
+
code: 'nac_id_orphan_in_dom',
|
|
4797
|
+
severity: 'warn',
|
|
4713
4798
|
nac_id: id,
|
|
4714
4799
|
in_dom: true,
|
|
4715
4800
|
in_manifest: false,
|
|
@@ -4723,6 +4808,8 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
4723
4808
|
for (const id in idIndex) {
|
|
4724
4809
|
if (!inDom[id]) {
|
|
4725
4810
|
out.unmounted.push({
|
|
4811
|
+
code: 'nac_id_declared_not_mounted',
|
|
4812
|
+
severity: 'warn',
|
|
4726
4813
|
nac_id: id, in_manifest: true, in_dom: false,
|
|
4727
4814
|
plugin: idIndex[id][0],
|
|
4728
4815
|
});
|
|
@@ -7592,7 +7679,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7592
7679
|
}
|
|
7593
7680
|
|
|
7594
7681
|
/* ================================================================
|
|
7595
|
-
v2.5 Block C -- RFC V25-03:
|
|
7682
|
+
v2.5 Block C -- RFC V25-03: assistive labels (narrate)
|
|
7596
7683
|
================================================================
|
|
7597
7684
|
|
|
7598
7685
|
NAC.narrate(plugin, nac_id) -> string
|
|
@@ -7835,7 +7922,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
7835
7922
|
|
|
7836
7923
|
global.NAC = {
|
|
7837
7924
|
__nac_v1_installed: true,
|
|
7838
|
-
version: '2.5.0
|
|
7925
|
+
version: '2.5.0',
|
|
7839
7926
|
spec_version: '2.5',
|
|
7840
7927
|
/* v2.2.0 (V22-01) -- strict validation toggle. When true,
|
|
7841
7928
|
NAC.register throws on findings (manifest_role_unknown,
|
|
@@ -8086,7 +8173,7 @@ const _g = typeof globalThis !== 'undefined' ? globalThis : (typeof window !== '
|
|
|
8086
8173
|
read: read,
|
|
8087
8174
|
subscribe: subscribe,
|
|
8088
8175
|
unsubscribe: unsubscribe,
|
|
8089
|
-
/* v2.5 Block C --
|
|
8176
|
+
/* v2.5 Block C -- assistive labels (SPEC.md sec 17 / RFC V25-03).
|
|
8090
8177
|
Canonical human-readable label resolution for screen readers,
|
|
8091
8178
|
TTS, voice flows, audit logs. Priority order: aria-label >
|
|
8092
8179
|
visible text > data-nac-label > nac_id fallback. */
|