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/web/index.js
CHANGED
|
@@ -12,8 +12,11 @@ function isUndefined(value) {
|
|
|
12
12
|
function isNull(value) {
|
|
13
13
|
return value === null;
|
|
14
14
|
}
|
|
15
|
+
function isNonNull(value) {
|
|
16
|
+
return value != null;
|
|
17
|
+
}
|
|
15
18
|
|
|
16
|
-
// ../../lib/primitive/src/utils/
|
|
19
|
+
// ../../lib/primitive/src/utils/type-guards.ts
|
|
17
20
|
function isObject(value, excludeArrays = false) {
|
|
18
21
|
if (value === null || typeof value !== "object") return false;
|
|
19
22
|
return excludeArrays ? !Array.isArray(value) : true;
|
|
@@ -923,7 +926,7 @@ var InvariantBase = class {
|
|
|
923
926
|
};
|
|
924
927
|
|
|
925
928
|
// ../../lib/contract/src/aria/polymorphic-validator.ts
|
|
926
|
-
var
|
|
929
|
+
var NO_VIOLATIONS = [{ valid: true }];
|
|
927
930
|
function isIntrinsicTag(tag) {
|
|
928
931
|
return isString(tag);
|
|
929
932
|
}
|
|
@@ -965,17 +968,20 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
965
968
|
static #deriveContext(tag, props) {
|
|
966
969
|
if (!isIntrinsicTag(tag)) return { proceed: false, result: { props, violations: [] } };
|
|
967
970
|
const implicitRole = getImplicitRole(tag, props);
|
|
968
|
-
const hasRole = implicitRole
|
|
971
|
+
const hasRole = isNonNull(implicitRole) || isString(props.role) && props.role.length > 0;
|
|
969
972
|
if (!hasRole) return { proceed: false, result: { props, violations: [] } };
|
|
970
973
|
const normalized = _AriaPolicyEngine.#normalizeEmptyRole(tag, props);
|
|
971
|
-
|
|
972
|
-
const
|
|
974
|
+
const workingProps = normalized.normalized ? normalized.result.props : props;
|
|
975
|
+
const preExistingViolations = normalized.normalized ? normalized.result.violations : [];
|
|
976
|
+
const effectiveRole = workingProps.role ?? implicitRole;
|
|
973
977
|
return {
|
|
974
978
|
proceed: true,
|
|
975
979
|
tag,
|
|
976
980
|
implicitRole,
|
|
977
981
|
effectiveRole,
|
|
978
|
-
|
|
982
|
+
props: workingProps,
|
|
983
|
+
preExistingViolations,
|
|
984
|
+
context: { tag, props: workingProps, implicitRole, effectiveRole }
|
|
979
985
|
};
|
|
980
986
|
}
|
|
981
987
|
static #runRules(rules, context) {
|
|
@@ -990,7 +996,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
990
996
|
} = context;
|
|
991
997
|
const { message, attribute, severity } = result;
|
|
992
998
|
const resolvedMessage = message ?? result.diagnostic?.message;
|
|
993
|
-
const fallbackDiag = resolvedMessage
|
|
999
|
+
const fallbackDiag = isNonNull(resolvedMessage) ? void 0 : AriaDiagnostics.invalidRole(role, tag);
|
|
994
1000
|
violations.push({
|
|
995
1001
|
message: resolvedMessage ?? fallbackDiag.message,
|
|
996
1002
|
tag,
|
|
@@ -998,8 +1004,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
998
1004
|
attribute,
|
|
999
1005
|
severity,
|
|
1000
1006
|
phase: "evaluate",
|
|
1001
|
-
...result.diagnostic
|
|
1002
|
-
...fallbackDiag
|
|
1007
|
+
...isNonNull(result.diagnostic) && { diagnostic: result.diagnostic },
|
|
1008
|
+
...isNonNull(fallbackDiag) && { diagnostic: fallbackDiag }
|
|
1003
1009
|
});
|
|
1004
1010
|
if (result.fixable) fixes.push(result.fix);
|
|
1005
1011
|
});
|
|
@@ -1007,7 +1013,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1007
1013
|
return { violations, fixes };
|
|
1008
1014
|
}
|
|
1009
1015
|
static #getRules(context) {
|
|
1010
|
-
if (_AriaPolicyEngine.#hasRole(context.props) || context.effectiveRole
|
|
1016
|
+
if (_AriaPolicyEngine.#hasRole(context.props) || isNonNull(context.effectiveRole) && _AriaPolicyEngine.#LIVE_REGION_ROLES.has(context.effectiveRole)) {
|
|
1011
1017
|
return _AriaPolicyEngine.#pipeline;
|
|
1012
1018
|
}
|
|
1013
1019
|
return _AriaPolicyEngine.#implicitOnlyRules;
|
|
@@ -1015,24 +1021,36 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1015
1021
|
static evaluate(tag, props) {
|
|
1016
1022
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1017
1023
|
if (!derived.proceed) return derived.result;
|
|
1018
|
-
const {
|
|
1024
|
+
const {
|
|
1025
|
+
tag: narrowedTag,
|
|
1026
|
+
implicitRole,
|
|
1027
|
+
context,
|
|
1028
|
+
props: workingProps,
|
|
1029
|
+
preExistingViolations
|
|
1030
|
+
} = derived;
|
|
1019
1031
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1020
1032
|
_AriaPolicyEngine.#getRules(context),
|
|
1021
1033
|
context
|
|
1022
1034
|
);
|
|
1023
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1024
|
-
return { props: next, violations };
|
|
1035
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1036
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1025
1037
|
}
|
|
1026
1038
|
static #evaluateWithRules(tag, props, extraRules) {
|
|
1027
1039
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1028
1040
|
if (!derived.proceed) return derived.result;
|
|
1029
|
-
const {
|
|
1041
|
+
const {
|
|
1042
|
+
tag: narrowedTag,
|
|
1043
|
+
implicitRole,
|
|
1044
|
+
context,
|
|
1045
|
+
props: workingProps,
|
|
1046
|
+
preExistingViolations
|
|
1047
|
+
} = derived;
|
|
1030
1048
|
const { violations, fixes } = _AriaPolicyEngine.#runRules(
|
|
1031
1049
|
[..._AriaPolicyEngine.#getRules(context), ...extraRules],
|
|
1032
1050
|
context
|
|
1033
1051
|
);
|
|
1034
|
-
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole,
|
|
1035
|
-
return { props: next, violations };
|
|
1052
|
+
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1053
|
+
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1036
1054
|
}
|
|
1037
1055
|
report(violations) {
|
|
1038
1056
|
iterate.forEach(violations, (v) => {
|
|
@@ -1041,12 +1059,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1041
1059
|
else this.warn(d);
|
|
1042
1060
|
});
|
|
1043
1061
|
}
|
|
1044
|
-
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs)
|
|
1045
|
-
// Non-aria props (className, onClick, etc.) do
|
|
1046
|
-
// so cache hits survive re-renders
|
|
1047
|
-
//
|
|
1048
|
-
//
|
|
1049
|
-
//
|
|
1062
|
+
// Cache key covers only the aria-relevant subset of props (tag + role + aria-* attrs) —
|
|
1063
|
+
// exactly what the built-in pipeline reads. Non-aria props (className, onClick, etc.) do
|
|
1064
|
+
// not affect built-in ARIA decisions and are excluded so cache hits survive re-renders
|
|
1065
|
+
// that only change non-aria props. This key alone is unsound for #extraRules, which may
|
|
1066
|
+
// read arbitrary props outside this set — validate() extends it with #extraRulesKeySuffix,
|
|
1067
|
+
// or bypasses the cache, to account for that.
|
|
1050
1068
|
static #createPlanKey(tag, props) {
|
|
1051
1069
|
if (!isIntrinsicTag(tag)) return null;
|
|
1052
1070
|
const parts = [tag];
|
|
@@ -1062,6 +1080,23 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1062
1080
|
if (ariaEntries.length > 0) parts.push(...ariaEntries.sort());
|
|
1063
1081
|
return parts.join("|");
|
|
1064
1082
|
}
|
|
1083
|
+
// Extends the base cache key with the props each extra rule declares it reads (`readsProps`).
|
|
1084
|
+
// Returns null — meaning "don't cache" — if any extra rule omits `readsProps` (it may read
|
|
1085
|
+
// arbitrary props the key can't account for) or if a declared prop's value isn't a primitive
|
|
1086
|
+
// (object/array identity isn't stably representable in a string key).
|
|
1087
|
+
static #extraRulesKeySuffix(extraRules, props) {
|
|
1088
|
+
const parts = [];
|
|
1089
|
+
for (const rule of extraRules) {
|
|
1090
|
+
const readsProps = rule.readsProps;
|
|
1091
|
+
if (!isNonNull(readsProps)) return null;
|
|
1092
|
+
for (const propKey of readsProps) {
|
|
1093
|
+
const v = props[propKey];
|
|
1094
|
+
if (v !== void 0 && !isString(v) && !isNumber(v) && typeof v !== "boolean") return null;
|
|
1095
|
+
parts.push(`x:${propKey}:${String(v)}`);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return parts.sort().join("|");
|
|
1099
|
+
}
|
|
1065
1100
|
static #computePlan(inputProps, resultProps) {
|
|
1066
1101
|
const removals = /* @__PURE__ */ new Set();
|
|
1067
1102
|
const updates = {};
|
|
@@ -1085,7 +1120,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1085
1120
|
return next;
|
|
1086
1121
|
}
|
|
1087
1122
|
validate(tag, props) {
|
|
1088
|
-
const
|
|
1123
|
+
const baseKey = _AriaPolicyEngine.#createPlanKey(tag, props);
|
|
1124
|
+
let key = baseKey;
|
|
1125
|
+
if (this.#extraRules.length > 0) {
|
|
1126
|
+
const suffix = _AriaPolicyEngine.#extraRulesKeySuffix(this.#extraRules, props);
|
|
1127
|
+
key = isNonNull(baseKey) && isNonNull(suffix) ? `${baseKey}|${suffix}` : null;
|
|
1128
|
+
}
|
|
1089
1129
|
if (!isNull(key)) {
|
|
1090
1130
|
const cached = this.#planCache.get(key);
|
|
1091
1131
|
if (cached !== void 0) {
|
|
@@ -1175,7 +1215,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1175
1215
|
implicitRole
|
|
1176
1216
|
}) {
|
|
1177
1217
|
const role = props.role;
|
|
1178
|
-
if (!implicitRole || !role || role === implicitRole) return
|
|
1218
|
+
if (!implicitRole || !role || role === implicitRole) return NO_VIOLATIONS;
|
|
1179
1219
|
if (isStrongImplicitRole(tag) && role === "region") {
|
|
1180
1220
|
return [
|
|
1181
1221
|
{
|
|
@@ -1187,11 +1227,11 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1187
1227
|
}
|
|
1188
1228
|
];
|
|
1189
1229
|
}
|
|
1190
|
-
return
|
|
1230
|
+
return NO_VIOLATIONS;
|
|
1191
1231
|
}
|
|
1192
1232
|
static #checkRedundantRole({ tag, props, implicitRole }) {
|
|
1193
1233
|
const role = props.role;
|
|
1194
|
-
if (!implicitRole || !role || role !== implicitRole) return
|
|
1234
|
+
if (!implicitRole || !role || role !== implicitRole) return NO_VIOLATIONS;
|
|
1195
1235
|
return [
|
|
1196
1236
|
{
|
|
1197
1237
|
valid: false,
|
|
@@ -1204,8 +1244,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1204
1244
|
}
|
|
1205
1245
|
static #checkStandaloneRegion({ tag, props, implicitRole }) {
|
|
1206
1246
|
const role = props.role;
|
|
1207
|
-
if (role !== "region") return
|
|
1208
|
-
if (!isStandaloneTag(tag)) return
|
|
1247
|
+
if (role !== "region") return NO_VIOLATIONS;
|
|
1248
|
+
if (!isStandaloneTag(tag)) return NO_VIOLATIONS;
|
|
1209
1249
|
return [
|
|
1210
1250
|
{
|
|
1211
1251
|
valid: false,
|
|
@@ -1221,7 +1261,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1221
1261
|
props,
|
|
1222
1262
|
effectiveRole
|
|
1223
1263
|
}) {
|
|
1224
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1264
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1225
1265
|
const results = [];
|
|
1226
1266
|
iterate.forEachEntry(props, (key) => {
|
|
1227
1267
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1339,12 +1379,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1339
1379
|
}
|
|
1340
1380
|
}
|
|
1341
1381
|
static #checkAriaAttributeValues({ props, effectiveRole }) {
|
|
1342
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1382
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1343
1383
|
const results = [];
|
|
1344
1384
|
iterate.forEachEntry(props, (key, value) => {
|
|
1345
1385
|
if (!key.startsWith("aria-")) return;
|
|
1346
1386
|
const type = _AriaPolicyEngine.#ARIA_VALUE_TYPES.get(key);
|
|
1347
|
-
if (type
|
|
1387
|
+
if (!isNonNull(type)) return;
|
|
1348
1388
|
if (_AriaPolicyEngine.#isValidAriaValue(value, type)) return;
|
|
1349
1389
|
results.push({
|
|
1350
1390
|
valid: false,
|
|
@@ -1375,13 +1415,13 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1375
1415
|
props,
|
|
1376
1416
|
effectiveRole
|
|
1377
1417
|
}) {
|
|
1378
|
-
if (effectiveRole === "none" || effectiveRole === "presentation") return
|
|
1418
|
+
if (effectiveRole === "none" || effectiveRole === "presentation") return NO_VIOLATIONS;
|
|
1379
1419
|
const implicitLevel = _AriaPolicyEngine.#HEADING_IMPLICIT_LEVELS.get(tag);
|
|
1380
|
-
if (implicitLevel
|
|
1420
|
+
if (!isNonNull(implicitLevel)) return NO_VIOLATIONS;
|
|
1381
1421
|
const raw = props["aria-level"];
|
|
1382
|
-
if (raw
|
|
1422
|
+
if (!isNonNull(raw)) return NO_VIOLATIONS;
|
|
1383
1423
|
const n = typeof raw === "number" ? raw : typeof raw === "string" ? parseInt(raw, 10) : NaN;
|
|
1384
|
-
if (!Number.isFinite(n) || n !== implicitLevel) return
|
|
1424
|
+
if (!Number.isFinite(n) || n !== implicitLevel) return NO_VIOLATIONS;
|
|
1385
1425
|
return [
|
|
1386
1426
|
{
|
|
1387
1427
|
valid: false,
|
|
@@ -1404,9 +1444,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1404
1444
|
props,
|
|
1405
1445
|
effectiveRole
|
|
1406
1446
|
}) {
|
|
1407
|
-
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1408
|
-
|
|
1409
|
-
if (
|
|
1447
|
+
if (!effectiveRole || !_AriaPolicyEngine.#NAME_REQUIRED_ROLES.has(effectiveRole))
|
|
1448
|
+
return NO_VIOLATIONS;
|
|
1449
|
+
if ("aria-label" in props || "aria-labelledby" in props) return NO_VIOLATIONS;
|
|
1450
|
+
if (tag === "img" && typeof props.alt === "string" && props.alt.length > 0) return NO_VIOLATIONS;
|
|
1410
1451
|
return [
|
|
1411
1452
|
{
|
|
1412
1453
|
valid: false,
|
|
@@ -1429,9 +1470,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1429
1470
|
props,
|
|
1430
1471
|
effectiveRole
|
|
1431
1472
|
}) {
|
|
1432
|
-
if (!effectiveRole) return
|
|
1473
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1433
1474
|
const required = _AriaPolicyEngine.#REQUIRED_PROPERTIES.get(effectiveRole);
|
|
1434
|
-
if (required
|
|
1475
|
+
if (!isNonNull(required)) return NO_VIOLATIONS;
|
|
1435
1476
|
const results = [];
|
|
1436
1477
|
iterate.forEach(required, (attr) => {
|
|
1437
1478
|
if (attr in props) return;
|
|
@@ -1455,12 +1496,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1455
1496
|
]);
|
|
1456
1497
|
// WAI-ARIA 1.2 §6.6: aria-hidden="true" must not be placed on focusable elements.
|
|
1457
1498
|
static #checkAriaHiddenOnFocusable({ tag, props }) {
|
|
1458
|
-
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return
|
|
1499
|
+
if (props["aria-hidden"] !== "true" && props["aria-hidden"] !== true) return NO_VIOLATIONS;
|
|
1459
1500
|
const isInteractive = _AriaPolicyEngine.#INTERACTIVE_TAGS.has(tag);
|
|
1460
1501
|
if (!isInteractive) {
|
|
1461
1502
|
const tabindex = props.tabindex;
|
|
1462
1503
|
const n = typeof tabindex === "number" ? tabindex : typeof tabindex === "string" ? parseInt(tabindex, 10) : NaN;
|
|
1463
|
-
if (!Number.isFinite(n) || n < 0) return
|
|
1504
|
+
if (!Number.isFinite(n) || n < 0) return NO_VIOLATIONS;
|
|
1464
1505
|
}
|
|
1465
1506
|
return [
|
|
1466
1507
|
{
|
|
@@ -1479,7 +1520,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1479
1520
|
props,
|
|
1480
1521
|
effectiveRole
|
|
1481
1522
|
}) {
|
|
1482
|
-
if (effectiveRole !== "none" && effectiveRole !== "presentation") return
|
|
1523
|
+
if (effectiveRole !== "none" && effectiveRole !== "presentation") return NO_VIOLATIONS;
|
|
1483
1524
|
const results = [];
|
|
1484
1525
|
iterate.forEachEntry(props, (key) => {
|
|
1485
1526
|
if (!key.startsWith("aria-")) return;
|
|
@@ -1503,10 +1544,10 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1503
1544
|
["timer", "off"]
|
|
1504
1545
|
]);
|
|
1505
1546
|
static #checkMissingLiveRegion({ effectiveRole, props }) {
|
|
1506
|
-
if (!effectiveRole) return
|
|
1547
|
+
if (!effectiveRole) return NO_VIOLATIONS;
|
|
1507
1548
|
const impliedLive = _AriaPolicyEngine.#LIVE_REGION_ROLES.get(effectiveRole);
|
|
1508
|
-
if (!impliedLive) return
|
|
1509
|
-
if ("aria-live" in props) return
|
|
1549
|
+
if (!impliedLive) return NO_VIOLATIONS;
|
|
1550
|
+
if ("aria-live" in props) return NO_VIOLATIONS;
|
|
1510
1551
|
const injectLive = {
|
|
1511
1552
|
kind: `injectLive:${effectiveRole}`,
|
|
1512
1553
|
apply: (ctx) => ({
|
|
@@ -1526,8 +1567,9 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1526
1567
|
];
|
|
1527
1568
|
}
|
|
1528
1569
|
static #checkMissingAtomic({ effectiveRole, props }) {
|
|
1529
|
-
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1530
|
-
|
|
1570
|
+
if (!effectiveRole || !_AriaPolicyEngine.#LIVE_REGION_ROLES.has(effectiveRole))
|
|
1571
|
+
return NO_VIOLATIONS;
|
|
1572
|
+
if ("aria-atomic" in props) return NO_VIOLATIONS;
|
|
1531
1573
|
return [
|
|
1532
1574
|
{
|
|
1533
1575
|
valid: false,
|
|
@@ -1551,8 +1593,8 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1551
1593
|
};
|
|
1552
1594
|
static #checkInvalidAriaRelevant({ props }) {
|
|
1553
1595
|
const relevant = props["aria-relevant"];
|
|
1554
|
-
if (relevant === void 0) return
|
|
1555
|
-
if (typeof relevant !== "string") return
|
|
1596
|
+
if (relevant === void 0) return NO_VIOLATIONS;
|
|
1597
|
+
if (typeof relevant !== "string") return NO_VIOLATIONS;
|
|
1556
1598
|
const tokens = relevant.trim().split(/\s+/);
|
|
1557
1599
|
const invalid = tokens.filter((t) => !_AriaPolicyEngine.#VALID_RELEVANT_TOKENS.has(t));
|
|
1558
1600
|
if (invalid.length > 0) {
|
|
@@ -1579,7 +1621,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1579
1621
|
}
|
|
1580
1622
|
];
|
|
1581
1623
|
}
|
|
1582
|
-
return
|
|
1624
|
+
return NO_VIOLATIONS;
|
|
1583
1625
|
}
|
|
1584
1626
|
};
|
|
1585
1627
|
|
|
@@ -2280,7 +2322,7 @@ function createClassPipeline(resolved) {
|
|
|
2280
2322
|
const staticClasses = staticResolver.resolve(tag, recipe !== void 0);
|
|
2281
2323
|
const variantClasses = variantResolver.resolve({ props, recipe });
|
|
2282
2324
|
if (!className)
|
|
2283
|
-
return staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses;
|
|
2325
|
+
return (staticClasses && variantClasses ? `${staticClasses} ${variantClasses}` : staticClasses || variantClasses) || void 0;
|
|
2284
2326
|
return cn(staticClasses, variantClasses, className);
|
|
2285
2327
|
};
|
|
2286
2328
|
}
|
|
@@ -2491,7 +2533,7 @@ function createPolymorphic2(options = {}) {
|
|
|
2491
2533
|
if (process.env.NODE_ENV !== "production") {
|
|
2492
2534
|
validateRenderProps(resolved.diagnostics, resolved, props, recipe);
|
|
2493
2535
|
}
|
|
2494
|
-
return classPipeline(tag, props, className, recipe);
|
|
2536
|
+
return classPipeline(tag, props, className, recipe) || void 0;
|
|
2495
2537
|
},
|
|
2496
2538
|
resolveAria(tag, props) {
|
|
2497
2539
|
return resolveAriaFn(tag, props);
|
|
@@ -2661,7 +2703,11 @@ function resolveHostState(bundle, props) {
|
|
|
2661
2703
|
function diffAndApplyAttributes(host, state, prevPipelineAttrs, incomingProps) {
|
|
2662
2704
|
const hasOwn2 = Object.hasOwn;
|
|
2663
2705
|
const attrs = state.attributes;
|
|
2664
|
-
|
|
2706
|
+
if (state.className) {
|
|
2707
|
+
host.className = state.className;
|
|
2708
|
+
} else {
|
|
2709
|
+
host.removeAttribute("class");
|
|
2710
|
+
}
|
|
2665
2711
|
for (const key of prevPipelineAttrs) {
|
|
2666
2712
|
if (!hasOwn2(attrs, key)) host.removeAttribute(key);
|
|
2667
2713
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "praxis-kit",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./react": {
|
|
@@ -62,6 +62,10 @@
|
|
|
62
62
|
"./contract": {
|
|
63
63
|
"types": "./dist/contract/index.d.ts",
|
|
64
64
|
"import": "./dist/contract/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./guards": {
|
|
67
|
+
"types": "./dist/guards/index.d.ts",
|
|
68
|
+
"import": "./dist/guards/index.js"
|
|
65
69
|
}
|
|
66
70
|
},
|
|
67
71
|
"typesVersions": {
|
|
@@ -107,6 +111,9 @@
|
|
|
107
111
|
],
|
|
108
112
|
"contract": [
|
|
109
113
|
"./dist/contract/index.d.ts"
|
|
114
|
+
],
|
|
115
|
+
"guards": [
|
|
116
|
+
"./dist/guards/index.d.ts"
|
|
110
117
|
]
|
|
111
118
|
}
|
|
112
119
|
},
|
|
@@ -183,10 +190,10 @@
|
|
|
183
190
|
"vite": "^8.1.4",
|
|
184
191
|
"vue": "^3.5.38",
|
|
185
192
|
"@praxis-kit/adapter-utils": "0.0.0",
|
|
186
|
-
"@praxis-kit/diagnostics": "0.0.0",
|
|
187
193
|
"@praxis-kit/core": "0.0.0",
|
|
188
|
-
"@praxis-kit/primitive": "0.0.0",
|
|
189
194
|
"@praxis-kit/pipeline": "0.0.0",
|
|
195
|
+
"@praxis-kit/primitive": "0.0.0",
|
|
196
|
+
"@praxis-kit/diagnostics": "0.0.0",
|
|
190
197
|
"@praxis-kit/vite-plugin": "0.0.0"
|
|
191
198
|
},
|
|
192
199
|
"publishConfig": {
|