praxis-kit 6.1.0 → 6.1.1
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/{chunk-VUULGK5M.js → chunk-OGQ7QKKP.js} +104 -64
- package/dist/contract/index.d.ts +4 -2
- package/dist/eslint/index.js +1 -1
- package/dist/guards/index.d.ts +36 -0
- package/dist/guards/index.js +62 -0
- package/dist/lit/index.d.ts +4 -2
- package/dist/lit/index.js +100 -54
- package/dist/preact/index.d.ts +4 -2
- package/dist/preact/index.js +114 -74
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +2 -2
- package/dist/react/legacy.js +1 -1
- package/dist/{react-options-AitAOrje.d.ts → react-options-CjiWrT4q.d.ts} +4 -2
- package/dist/solid/index.d.ts +4 -2
- package/dist/solid/index.js +105 -63
- package/dist/svelte/Polymorphic.svelte +2 -2
- package/dist/svelte/index.d.ts +5 -3
- package/dist/svelte/index.js +95 -53
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/tailwind/index.js +3 -3
- package/dist/vue/index.d.ts +4 -2
- package/dist/vue/index.js +113 -65
- package/dist/web/index.d.ts +4 -2
- package/dist/web/index.js +100 -54
- package/package.json +10 -3
package/dist/preact/index.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
// ../../lib/primitive/src/guards/children/component-id.ts
|
|
2
2
|
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol.for("praxis.component-default-tag");
|
|
3
3
|
|
|
4
|
-
// ../../lib/primitive/src/utils/is-object.ts
|
|
5
|
-
function isObject(value, excludeArrays = false) {
|
|
6
|
-
if (value === null || typeof value !== "object") return false;
|
|
7
|
-
return excludeArrays ? !Array.isArray(value) : true;
|
|
8
|
-
}
|
|
9
|
-
function isString(value) {
|
|
10
|
-
return typeof value === "string";
|
|
11
|
-
}
|
|
12
|
-
function isNumber(value) {
|
|
13
|
-
return typeof value === "number";
|
|
14
|
-
}
|
|
15
|
-
|
|
16
4
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
17
5
|
function isUndefined(value) {
|
|
18
6
|
return value === void 0;
|
|
@@ -22,16 +10,26 @@ function isUndefined(value) {
|
|
|
22
10
|
function isNull(value) {
|
|
23
11
|
return value === null;
|
|
24
12
|
}
|
|
13
|
+
function isNonNull(value) {
|
|
14
|
+
return value != null;
|
|
15
|
+
}
|
|
25
16
|
|
|
26
|
-
// ../../lib/primitive/src/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
// ../../lib/primitive/src/utils/type-guards.ts
|
|
18
|
+
function isObject(value, excludeArrays = false) {
|
|
19
|
+
if (value === null || typeof value !== "object") return false;
|
|
20
|
+
return excludeArrays ? !Array.isArray(value) : true;
|
|
21
|
+
}
|
|
22
|
+
function isString(value) {
|
|
23
|
+
return typeof value === "string";
|
|
24
|
+
}
|
|
25
|
+
function isNumber(value) {
|
|
26
|
+
return typeof value === "number";
|
|
27
|
+
}
|
|
30
28
|
function isFunction(value) {
|
|
31
29
|
return typeof value === "function";
|
|
32
30
|
}
|
|
33
31
|
function isPlainObject(value) {
|
|
34
|
-
if (!isObject(value)) return false;
|
|
32
|
+
if (!isObject(value, true)) return false;
|
|
35
33
|
const proto = Object.getPrototypeOf(value);
|
|
36
34
|
return proto === Object.prototype || proto === null;
|
|
37
35
|
}
|
|
@@ -472,6 +470,9 @@ function makeResolveTag(defaultTag) {
|
|
|
472
470
|
};
|
|
473
471
|
}
|
|
474
472
|
|
|
473
|
+
// ../../lib/primitive/src/merge/constants.ts
|
|
474
|
+
var EVENT_HANDLER_RE = /^on[A-Z]/;
|
|
475
|
+
|
|
475
476
|
// ../../lib/primitive/src/rule/rule-brand.ts
|
|
476
477
|
var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
|
|
477
478
|
|
|
@@ -707,12 +708,12 @@ var LRUCache = class {
|
|
|
707
708
|
|
|
708
709
|
// ../../lib/primitive/src/utils/merge-refs.ts
|
|
709
710
|
function mergeRefsCore(...refs) {
|
|
710
|
-
const
|
|
711
|
-
if (
|
|
712
|
-
if (
|
|
711
|
+
const resolvedRefs = refs.filter((r) => r != null);
|
|
712
|
+
if (resolvedRefs.length === 0) return null;
|
|
713
|
+
if (resolvedRefs.length === 1) return resolvedRefs[0] ?? null;
|
|
713
714
|
return (value) => {
|
|
714
|
-
iterate.forEach(
|
|
715
|
-
if (
|
|
715
|
+
iterate.forEach(resolvedRefs, (ref) => {
|
|
716
|
+
if (isFunction(ref)) {
|
|
716
717
|
ref(value);
|
|
717
718
|
} else {
|
|
718
719
|
ref.current = value;
|
|
@@ -1108,7 +1109,7 @@ var InvariantBase = class {
|
|
|
1108
1109
|
};
|
|
1109
1110
|
|
|
1110
1111
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
1111
|
-
var
|
|
1112
|
+
var NO_VIOLATIONS = [{ valid: true }];
|
|
1112
1113
|
function isIntrinsicTag(tag) {
|
|
1113
1114
|
return isString(tag);
|
|
1114
1115
|
}
|
|
@@ -1150,17 +1151,20 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1150
1151
|
static #deriveContext(tag, props) {
|
|
1151
1152
|
if (!isIntrinsicTag(tag)) return { proceed: false, result: { props, violations: [] } };
|
|
1152
1153
|
const implicitRole = getImplicitRole(tag, props);
|
|
1153
|
-
const hasRole2 = implicitRole
|
|
1154
|
+
const hasRole2 = isNonNull(implicitRole) || isString(props.role) && props.role.length > 0;
|
|
1154
1155
|
if (!hasRole2) return { proceed: false, result: { props, violations: [] } };
|
|
1155
1156
|
const normalized = _AriaPolicyEngine.#normalizeEmptyRole(tag, props);
|
|
1156
|
-
|
|
1157
|
-
const
|
|
1157
|
+
const workingProps = normalized.normalized ? normalized.result.props : props;
|
|
1158
|
+
const preExistingViolations = normalized.normalized ? normalized.result.violations : [];
|
|
1159
|
+
const effectiveRole = workingProps.role ?? implicitRole;
|
|
1158
1160
|
return {
|
|
1159
1161
|
proceed: true,
|
|
1160
1162
|
tag,
|
|
1161
1163
|
implicitRole,
|
|
1162
1164
|
effectiveRole,
|
|
1163
|
-
|
|
1165
|
+
props: workingProps,
|
|
1166
|
+
preExistingViolations,
|
|
1167
|
+
context: { tag, props: workingProps, implicitRole, effectiveRole }
|
|
1164
1168
|
};
|
|
1165
1169
|
}
|
|
1166
1170
|
static #runRules(rules, context) {
|
|
@@ -1175,7 +1179,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1175
1179
|
} = context;
|
|
1176
1180
|
const { message, attribute, severity } = result;
|
|
1177
1181
|
const resolvedMessage = message ?? result.diagnostic?.message;
|
|
1178
|
-
const fallbackDiag = resolvedMessage
|
|
1182
|
+
const fallbackDiag = isNonNull(resolvedMessage) ? void 0 : AriaDiagnostics.invalidRole(role, tag);
|
|
1179
1183
|
violations.push({
|
|
1180
1184
|
message: resolvedMessage ?? fallbackDiag.message,
|
|
1181
1185
|
tag,
|
|
@@ -1183,8 +1187,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1183
1187
|
attribute,
|
|
1184
1188
|
severity,
|
|
1185
1189
|
phase: "evaluate",
|
|
1186
|
-
...result.diagnostic
|
|
1187
|
-
...fallbackDiag
|
|
1190
|
+
...isNonNull(result.diagnostic) && { diagnostic: result.diagnostic },
|
|
1191
|
+
...isNonNull(fallbackDiag) && { diagnostic: fallbackDiag }
|
|
1188
1192
|
});
|
|
1189
1193
|
if (result.fixable) fixes.push(result.fix);
|
|
1190
1194
|
});
|
|
@@ -1192,7 +1196,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1192
1196
|
return { violations, fixes };
|
|
1193
1197
|
}
|
|
1194
1198
|
static #getRules(context) {
|
|
1195
|
-
if (_AriaPolicyEngine.#hasRole(context.props) || context.effectiveRole
|
|
1199
|
+
if (_AriaPolicyEngine.#hasRole(context.props) || isNonNull(context.effectiveRole) && _AriaPolicyEngine.#LIVE_REGION_ROLES.has(context.effectiveRole)) {
|
|
1196
1200
|
return _AriaPolicyEngine.#pipeline;
|
|
1197
1201
|
}
|
|
1198
1202
|
return _AriaPolicyEngine.#implicitOnlyRules;
|
|
@@ -1200,24 +1204,36 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1200
1204
|
static evaluate(tag, props) {
|
|
1201
1205
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1202
1206
|
if (!derived.proceed) return derived.result;
|
|
1203
|
-
const {
|
|
1207
|
+
const {
|
|
1208
|
+
tag: narrowedTag,
|
|
1209
|
+
implicitRole,
|
|
1210
|
+
context,
|
|
1211
|
+
props: workingProps,
|
|
1212
|
+
preExistingViolations
|
|
1213
|
+
} = derived;
|
|
1204
1214
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1205
1215
|
_AriaPolicyEngine.#getRules(context),
|
|
1206
1216
|
context
|
|
1207
1217
|
);
|
|
1208
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1209
|
-
return { props: next, violations };
|
|
1218
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1219
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1210
1220
|
}
|
|
1211
1221
|
static #evaluateWithRules(tag, props, extraRules) {
|
|
1212
1222
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1213
1223
|
if (!derived.proceed) return derived.result;
|
|
1214
|
-
const {
|
|
1224
|
+
const {
|
|
1225
|
+
tag: narrowedTag,
|
|
1226
|
+
implicitRole,
|
|
1227
|
+
context,
|
|
1228
|
+
props: workingProps,
|
|
1229
|
+
preExistingViolations
|
|
1230
|
+
} = derived;
|
|
1215
1231
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1216
1232
|
[..._AriaPolicyEngine.#getRules(context), ...extraRules],
|
|
1217
1233
|
context
|
|
1218
1234
|
);
|
|
1219
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1220
|
-
return { props: next, violations };
|
|
1235
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1236
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1221
1237
|
}
|
|
1222
1238
|
report(violations) {
|
|
1223
1239
|
iterate.forEach(violations, (v) => {
|
|
@@ -1226,12 +1242,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1226
1242
|
else this.warn(d);
|
|
1227
1243
|
});
|
|
1228
1244
|
}
|
|
1229
|
-
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs)
|
|
1230
|
-
// Non-aria props (className, onClick, etc.) do
|
|
1231
|
-
// so cache hits survive re-renders
|
|
1232
|
-
//
|
|
1233
|
-
//
|
|
1234
|
-
//
|
|
1245
|
+
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs) —
|
|
1246
|
+
// exactly what the built-in pipeline reads. Non-aria props (className, onClick, etc.) do
|
|
1247
|
+
// not affect built-in ARIA decisions and are excluded so cache hits survive re-renders
|
|
1248
|
+
// that only change non-aria props. This key alone is unsound for #extraRules, which may
|
|
1249
|
+
// read arbitrary props outside this set — validate() extends it with #extraRulesKeySuffix,
|
|
1250
|
+
// or bypasses the cache, to account for that.
|
|
1235
1251
|
static #createPlanKey(tag, props) {
|
|
1236
1252
|
if (!isIntrinsicTag(tag)) return null;
|
|
1237
1253
|
const parts = [tag];
|
|
@@ -1247,6 +1263,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1247
1263
|
if (ariaEntries.length > 0) parts.push(...ariaEntries.sort());
|
|
1248
1264
|
return parts.join("|");
|
|
1249
1265
|
}
|
|
1266
|
+
// Extends the base cache key with the props each extra rule declares it reads (`readsProps`).
|
|
1267
|
+
// Returns null — meaning "don't cache" — if any extra rule omits `readsProps` (it may read
|
|
1268
|
+
// arbitrary props the key can't account for) or if a declared prop's value isn't a primitive
|
|
1269
|
+
// (object/array identity isn't stably representable in a string key).
|
|
1270
|
+
static #extraRulesKeySuffix(extraRules, props) {
|
|
1271
|
+
const parts = [];
|
|
1272
|
+
for (const rule of extraRules) {
|
|
1273
|
+
const readsProps = rule.readsProps;
|
|
1274
|
+
if (!isNonNull(readsProps)) return null;
|
|
1275
|
+
for (const propKey of readsProps) {
|
|
1276
|
+
const v = props[propKey];
|
|
1277
|
+
if (v !== void 0 && !isString(v) && !isNumber(v) && typeof v !== "boolean") return null;
|
|
1278
|
+
parts.push(`x:${propKey}:${String(v)}`);
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
return parts.sort().join("|");
|
|
1282
|
+
}
|
|
1250
1283
|
static #computePlan(inputProps, resultProps) {
|
|
1251
1284
|
const removals = /* @__PURE__ */ new Set();
|
|
1252
1285
|
const updates = {};
|
|
@@ -1270,7 +1303,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1270
1303
|
return next;
|
|
1271
1304
|
}
|
|
1272
1305
|
validate(tag, props) {
|
|
1273
|
-
const
|
|
1306
|
+
const baseKey = _AriaPolicyEngine.#createPlanKey(tag, props);
|
|
1307
|
+
let key = baseKey;
|
|
1308
|
+
if (this.#extraRules.length > 0) {
|
|
1309
|
+
const suffix = _AriaPolicyEngine.#extraRulesKeySuffix(this.#extraRules, props);
|
|
1310
|
+
key = isNonNull(baseKey) && isNonNull(suffix) ? `${baseKey}|${suffix}` : null;
|
|
1311
|
+
}
|
|
1274
1312
|
if (!isNull(key)) {
|
|
1275
1313
|
const cached = this.#planCache.get(key);
|
|
1276
1314
|
if (cached !== void 0) {
|
|
@@ -1360,7 +1398,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1360
1398
|
implicitRole
|
|
1361
1399
|
}) {
|
|
1362
1400
|
const role = props.role;
|
|
1363
|
-
if (!implicitRole || !role || role === implicitRole) return
|
|
1401
|
+
if (!implicitRole || !role || role === implicitRole) return NO_VIOLATIONS;
|
|
1364
1402
|
if (isStrongImplicitRole(tag) && role === "region") {
|
|
1365
1403
|
return [
|
|
1366
1404
|
{
|
|
@@ -1372,11 +1410,11 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1372
1410
|
}
|
|
1373
1411
|
];
|
|
1374
1412
|
}
|
|
1375
|
-
return
|
|
1413
|
+
return NO_VIOLATIONS;
|
|
1376
1414
|
}
|
|
1377
1415
|
static #checkRedundantRole({ tag, props, implicitRole }) {
|
|
1378
1416
|
const role = props.role;
|
|
1379
|
-
if (!implicitRole || !role || role !== implicitRole) return
|
|
1417
|
+
if (!implicitRole || !role || role !== implicitRole) return NO_VIOLATIONS;
|
|
1380
1418
|
return [
|
|
1381
1419
|
{
|
|
1382
1420
|
valid: false,
|
|
@@ -1389,8 +1427,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1389
1427
|
}
|
|
1390
1428
|
static #checkStandaloneRegion({ tag, props, implicitRole }) {
|
|
1391
1429
|
const role = props.role;
|
|
1392
|
-
if (role !== "region") return
|
|
1393
|
-
if (!isStandaloneTag(tag)) return
|
|
1430
|
+
if (role !== "region") return NO_VIOLATIONS;
|
|
1431
|
+
if (!isStandaloneTag(tag)) return NO_VIOLATIONS;
|
|
1394
1432
|
return [
|
|
1395
1433
|
{
|
|
1396
1434
|
valid: false,
|
|
@@ -1406,7 +1444,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1406
1444
|
props,
|
|
1407
1445
|
effectiveRole
|
|
1408
1446
|
}) {
|
|
1409
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1447
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1410
1448
|
const results = [];
|
|
1411
1449
|
iterate.forEachEntry(props, (key) => {
|
|
1412
1450
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1524,12 +1562,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1524
1562
|
}
|
|
1525
1563
|
}
|
|
1526
1564
|
static #checkAriaAttributeValues({ props, effectiveRole }) {
|
|
1527
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1565
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1528
1566
|
const results = [];
|
|
1529
1567
|
iterate.forEachEntry(props, (key, value) => {
|
|
1530
1568
|
if (!key.startsWith("aria-")) return;
|
|
1531
1569
|
const type = _AriaPolicyEngine.#ARIA_VALUE_TYPES.get(key);
|
|
1532
|
-
if (type
|
|
1570
|
+
if (!isNonNull(type)) return;
|
|
1533
1571
|
if (_AriaPolicyEngine.#isValidAriaValue(value, type)) return;
|
|
1534
1572
|
results.push({
|
|
1535
1573
|
valid: false,
|
|
@@ -1560,13 +1598,13 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1560
1598
|
props,
|
|
1561
1599
|
effectiveRole
|
|
1562
1600
|
}) {
|
|
1563
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1601
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1564
1602
|
const implicitLevel = _AriaPolicyEngine.#HEADING_IMPLICIT_LEVELS.get(tag);
|
|
1565
|
-
if (implicitLevel
|
|
1603
|
+
if (!isNonNull(implicitLevel)) return NO_VIOLATIONS;
|
|
1566
1604
|
const raw = props["aria-level"];
|
|
1567
|
-
if (raw
|
|
1605
|
+
if (!isNonNull(raw)) return NO_VIOLATIONS;
|
|
1568
1606
|
const n = typeof raw === "number" ? raw : typeof raw === "string" ? parseInt(raw, 10) : NaN;
|
|
1569
|
-
if (!Number.isFinite(n) || n !== implicitLevel) return
|
|
1607
|
+
if (!Number.isFinite(n) || n !== implicitLevel) return NO_VIOLATIONS;
|
|
1570
1608
|
return [
|
|
1571
1609
|
{
|
|
1572
1610
|
valid: false,
|
|
@@ -1589,9 +1627,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1589
1627
|
props,
|
|
1590
1628
|
effectiveRole
|
|
1591
1629
|
}) {
|
|
1592
|
-
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1593
|
-
|
|
1594
|
-
if (
|
|
1630
|
+
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1631
|
+
return NO_VIOLATIONS;
|
|
1632
|
+
if ("aria-label" in props || "aria-labelledby" in props) return NO_VIOLATIONS;
|
|
1633
|
+
if (tag === "img" && typeof props.alt === "string" && props.alt.length > 0) return NO_VIOLATIONS;
|
|
1595
1634
|
return [
|
|
1596
1635
|
{
|
|
1597
1636
|
valid: false,
|
|
@@ -1614,9 +1653,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1614
1653
|
props,
|
|
1615
1654
|
effectiveRole
|
|
1616
1655
|
}) {
|
|
1617
|
-
if (!effectiveRole) return
|
|
1656
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1618
1657
|
const required = _AriaPolicyEngine.#REQUIRED_PROPERTIES.get(effectiveRole);
|
|
1619
|
-
if (required
|
|
1658
|
+
if (!isNonNull(required)) return NO_VIOLATIONS;
|
|
1620
1659
|
const results = [];
|
|
1621
1660
|
iterate.forEach(required, (attr) => {
|
|
1622
1661
|
if (attr in props) return;
|
|
@@ -1640,12 +1679,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1640
1679
|
]);
|
|
1641
1680
|
// WAI-ARIA 1.2 §6.6: aria-hidden="true" must not be placed on focusable elements.
|
|
1642
1681
|
static #checkAriaHiddenOnFocusable({ tag, props }) {
|
|
1643
|
-
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return
|
|
1682
|
+
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return NO_VIOLATIONS;
|
|
1644
1683
|
const isInteractive = _AriaPolicyEngine.#INTERACTIVE_TAGS.has(tag);
|
|
1645
1684
|
if (!isInteractive) {
|
|
1646
1685
|
const tabindex = props.tabindex;
|
|
1647
1686
|
const n = typeof tabindex === "number" ? tabindex : typeof tabindex === "string" ? parseInt(tabindex, 10) : NaN;
|
|
1648
|
-
if (!Number.isFinite(n) || n < 0) return
|
|
1687
|
+
if (!Number.isFinite(n) || n < 0) return NO_VIOLATIONS;
|
|
1649
1688
|
}
|
|
1650
1689
|
return [
|
|
1651
1690
|
{
|
|
@@ -1664,7 +1703,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1664
1703
|
props,
|
|
1665
1704
|
effectiveRole
|
|
1666
1705
|
}) {
|
|
1667
|
-
if (effectiveRole !== "none" && effectiveRole !== "presentation") return
|
|
1706
|
+
if (effectiveRole !== "none" && effectiveRole !== "presentation") return NO_VIOLATIONS;
|
|
1668
1707
|
const results = [];
|
|
1669
1708
|
iterate.forEachEntry(props, (key) => {
|
|
1670
1709
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1688,10 +1727,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1688
1727
|
["timer", "off"]
|
|
1689
1728
|
]);
|
|
1690
1729
|
static #checkMissingLiveRegion({ effectiveRole, props }) {
|
|
1691
|
-
if (!effectiveRole) return
|
|
1730
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1692
1731
|
const impliedLive = _AriaPolicyEngine.#LIVE_REGION_ROLES.get(effectiveRole);
|
|
1693
|
-
if (!impliedLive) return
|
|
1694
|
-
if ("aria-live" in props) return
|
|
1732
|
+
if (!impliedLive) return NO_VIOLATIONS;
|
|
1733
|
+
if ("aria-live" in props) return NO_VIOLATIONS;
|
|
1695
1734
|
const injectLive = {
|
|
1696
1735
|
kind: `injectLive:${effectiveRole}`,
|
|
1697
1736
|
apply: (ctx) => ({
|
|
@@ -1711,8 +1750,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1711
1750
|
];
|
|
1712
1751
|
}
|
|
1713
1752
|
static #checkMissingAtomic({ effectiveRole, props }) {
|
|
1714
|
-
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1715
|
-
|
|
1753
|
+
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1754
|
+
return NO_VIOLATIONS;
|
|
1755
|
+
if ("aria-atomic" in props) return NO_VIOLATIONS;
|
|
1716
1756
|
return [
|
|
1717
1757
|
{
|
|
1718
1758
|
valid: false,
|
|
@@ -1736,8 +1776,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1736
1776
|
};
|
|
1737
1777
|
static #checkInvalidAriaRelevant({ props }) {
|
|
1738
1778
|
const relevant = props["aria-relevant"];
|
|
1739
|
-
if (relevant === void 0) return
|
|
1740
|
-
if (typeof relevant !== "string") return
|
|
1779
|
+
if (relevant === void 0) return NO_VIOLATIONS;
|
|
1780
|
+
if (typeof relevant !== "string") return NO_VIOLATIONS;
|
|
1741
1781
|
const tokens = relevant.trim().split(/\s+/);
|
|
1742
1782
|
const invalid = tokens.filter((t) => !_AriaPolicyEngine.#VALID_RELEVANT_TOKENS.has(t));
|
|
1743
1783
|
if (invalid.length > 0) {
|
|
@@ -1764,7 +1804,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1764
1804
|
}
|
|
1765
1805
|
];
|
|
1766
1806
|
}
|
|
1767
|
-
return
|
|
1807
|
+
return NO_VIOLATIONS;
|
|
1768
1808
|
}
|
|
1769
1809
|
};
|
|
1770
1810
|
|
|
@@ -2465,7 +2505,7 @@ function createClassPipeline(resolved) {
|
|
|
2465
2505
|
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
2466
2506
|
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
2467
2507
|
if (!className)
|
|
2468
|
-
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
2508
|
+
return (staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses) || void 0;
|
|
2469
2509
|
return cn(staticClasses, variantClasses, className);
|
|
2470
2510
|
};
|
|
2471
2511
|
}
|
|
@@ -2676,7 +2716,7 @@ function createPolymorphic2(options = {}) {
|
|
|
2676
2716
|
if (process.env.NODE_ENV !== "production") {
|
|
2677
2717
|
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2678
2718
|
}
|
|
2679
|
-
return classPipeline(tag, props, className, recipe);
|
|
2719
|
+
return classPipeline(tag, props, className, recipe) || void 0;
|
|
2680
2720
|
},
|
|
2681
2721
|
resolveAria(tag, props) {
|
|
2682
2722
|
return resolveAriaFn(tag, props);
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { U as UnknownProps, E as ElementType, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-
|
|
2
|
-
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, m as composeRefs, l as defineContractComponent, m as mergeRefs } from '../react-options-
|
|
1
|
+
import { U as UnknownProps, E as ElementType, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-CjiWrT4q.js';
|
|
2
|
+
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, m as composeRefs, l as defineContractComponent, m as mergeRefs } from '../react-options-CjiWrT4q.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactElement, Ref } from 'react';
|
|
5
5
|
import 'type-fest';
|
package/dist/react/index.js
CHANGED
package/dist/react/legacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ElementType, U as UnknownProps, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-
|
|
2
|
-
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, l as defineContractComponent, m as mergeRefs } from '../react-options-
|
|
1
|
+
import { E as ElementType, U as UnknownProps, a as EmptyRecord, V as VariantMap, R as RecipeMap, A as AnyClassPluginFactory, b as ReactFactoryOptions, P as PolymorphicComponent, c as PolymorphicGenerics, d as ExtractPluginProps } from '../react-options-CjiWrT4q.js';
|
|
2
|
+
export { e as AnyFactoryOptions, f as ElementRef, F as FactoryOptions, g as PolymorphicProps, h as PolymorphicWithAsChild, i as PolymorphicWithRender, j as RenderCallbackProps, S as Slottable, k as SlottableProps, l as defineContractComponent, m as mergeRefs } from '../react-options-CjiWrT4q.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import 'type-fest';
|
|
5
5
|
import '../_shared/diagnostics.js';
|
package/dist/react/legacy.js
CHANGED
|
@@ -157,7 +157,7 @@ interface BaseClassOptions {
|
|
|
157
157
|
baseClassName?: ClassName;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
|
|
160
|
+
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
|
|
161
161
|
|
|
162
162
|
interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
|
|
163
163
|
recipeMap?: Record<string, RecipeTarget<TVariants>>;
|
|
@@ -235,7 +235,9 @@ type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
|
235
235
|
type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
|
|
236
236
|
type AriaResult = ValidResult | AriaInvalidResult;
|
|
237
237
|
|
|
238
|
-
type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly AriaResult[]
|
|
238
|
+
type AriaRule<C extends AriaContext = AriaContext> = ((context: C) => readonly AriaResult[]) & {
|
|
239
|
+
readonly readsProps?: readonly string[];
|
|
240
|
+
};
|
|
239
241
|
|
|
240
242
|
type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
|
|
241
243
|
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -156,7 +156,7 @@ interface BaseClassOptions {
|
|
|
156
156
|
baseClassName?: ClassName;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
|
|
159
|
+
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
|
|
160
160
|
|
|
161
161
|
interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
|
|
162
162
|
recipeMap?: Record<string, RecipeTarget<TVariants>>;
|
|
@@ -234,7 +234,9 @@ type AriaInvalidWithoutFix<M extends string = string> = AriaInvalidBase<M> & {
|
|
|
234
234
|
type AriaInvalidResult<M extends string = string> = AriaInvalidWithFix<M> | AriaInvalidWithoutFix<M>;
|
|
235
235
|
type AriaResult = ValidResult | AriaInvalidResult;
|
|
236
236
|
|
|
237
|
-
type AriaRule<C extends AriaContext = AriaContext> = (context: C) => readonly AriaResult[]
|
|
237
|
+
type AriaRule<C extends AriaContext = AriaContext> = ((context: C) => readonly AriaResult[]) & {
|
|
238
|
+
readonly readsProps?: readonly string[];
|
|
239
|
+
};
|
|
238
240
|
|
|
239
241
|
type PropNormalizer = (props: Readonly<AnyRecord & IntrinsicProps>) => Partial<AnyRecord & IntrinsicProps>;
|
|
240
242
|
|