praxis-kit 7.5.0 → 7.8.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/_shared/diagnostics.d.ts +3 -0
- package/dist/_shared/diagnostics.js +3 -0
- package/dist/{chunk-SMHJEFNE.js → chunk-QYP7KLRE.js} +316 -154
- package/dist/contract/index.d.ts +3 -3
- package/dist/eslint/index.js +227 -187
- package/dist/html/index.d.ts +6 -1
- package/dist/html/index.js +234 -68
- package/dist/lit/index.d.ts +3 -3
- package/dist/lit/index.js +305 -141
- package/dist/preact/index.d.ts +90 -5
- package/dist/preact/index.js +316 -152
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +8 -5
- package/dist/react/legacy.js +8 -8
- package/dist/{react-options-5GbZ8Tbv.d.ts → react-options-DU3EdFOv.d.ts} +102 -6
- package/dist/solid/index.d.ts +103 -7
- package/dist/solid/index.js +316 -152
- package/dist/svelte/Polymorphic.svelte +8 -0
- package/dist/svelte/index.d.ts +196 -10
- package/dist/svelte/index.js +319 -152
- package/dist/tailwind/index.d.ts +1 -1
- package/dist/vite-plugin/index.d.ts +6 -3
- package/dist/vue/index.d.ts +70 -5
- package/dist/vue/index.js +316 -152
- package/dist/web/index.d.ts +3 -3
- package/dist/web/index.js +305 -141
- package/package.json +9 -9
|
@@ -28,6 +28,9 @@ function dynamic(resolve) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
31
|
+
function isDefined(value) {
|
|
32
|
+
return value !== void 0;
|
|
33
|
+
}
|
|
31
34
|
function isUndefined(value) {
|
|
32
35
|
return value === void 0;
|
|
33
36
|
}
|
|
@@ -799,21 +802,65 @@ function getImplicitRole(tag, props) {
|
|
|
799
802
|
return void 0;
|
|
800
803
|
}
|
|
801
804
|
|
|
802
|
-
// ../../lib/contract/src/diagnostics/
|
|
805
|
+
// ../../lib/contract/src/diagnostics/anchor-accessibility.ts
|
|
803
806
|
import { DiagnosticCategory, DiagnosticCode } from "./_shared/diagnostics.js";
|
|
807
|
+
function createDiagnostic(input) {
|
|
808
|
+
return { category: DiagnosticCategory.Accessibility, ...input };
|
|
809
|
+
}
|
|
810
|
+
var AnchorAccessibilityDiagnostics = {
|
|
811
|
+
roleButtonWithHref() {
|
|
812
|
+
return createDiagnostic({
|
|
813
|
+
code: DiagnosticCode.A11yAnchorRoleButtonWithHref,
|
|
814
|
+
severity: "warning",
|
|
815
|
+
message: 'role="button" on an <a> with an href overrides its navigation semantics for assistive technology; use a real <button> element, or remove href, if this element should not navigate.',
|
|
816
|
+
rationale: 'Assistive technology announces role="button" as a button, not a link \u2014 but the element still follows the link when activated by mouse or keyboard, which is confusing and inconsistent with how a button is expected to behave.',
|
|
817
|
+
suggestions: [
|
|
818
|
+
{
|
|
819
|
+
title: "Use a real <button>",
|
|
820
|
+
description: "If this element should not navigate, render a <button> instead of an <a>."
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
title: 'Remove role="button"',
|
|
824
|
+
description: "If this element should navigate, keep the default link role."
|
|
825
|
+
}
|
|
826
|
+
]
|
|
827
|
+
});
|
|
828
|
+
},
|
|
829
|
+
ariaDisabledInert() {
|
|
830
|
+
return createDiagnostic({
|
|
831
|
+
code: DiagnosticCode.A11yAnchorAriaDisabledInert,
|
|
832
|
+
severity: "warning",
|
|
833
|
+
message: "aria-disabled does not prevent an <a> from being focused, clicked, or navigated via keyboard; remove href, or prevent navigation yourself, if this link should be inert.",
|
|
834
|
+
rationale: "Unlike a native form control, an <a> has no disabled state the browser enforces \u2014 aria-disabled only changes what assistive technology announces, not what actually happens when the link is activated by mouse or keyboard.",
|
|
835
|
+
suggestions: [
|
|
836
|
+
{
|
|
837
|
+
title: "Remove href",
|
|
838
|
+
description: "If this element is temporarily unavailable, remove href until it can be activated."
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
title: "Prevent navigation when disabled",
|
|
842
|
+
description: "Prevent the click and keyboard activation when the link is disabled so it behaves consistently for all users."
|
|
843
|
+
}
|
|
844
|
+
]
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
// ../../lib/contract/src/diagnostics/aria.ts
|
|
850
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "./_shared/diagnostics.js";
|
|
804
851
|
var AriaDiagnostics = {
|
|
805
852
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
806
853
|
fromViolation(v) {
|
|
807
854
|
return {
|
|
808
|
-
code:
|
|
809
|
-
category:
|
|
855
|
+
code: DiagnosticCode2.AriaViolation,
|
|
856
|
+
category: DiagnosticCategory2.ARIA,
|
|
810
857
|
message: v.message
|
|
811
858
|
};
|
|
812
859
|
},
|
|
813
860
|
attributeInvalid(key, role) {
|
|
814
861
|
return {
|
|
815
|
-
code:
|
|
816
|
-
category:
|
|
862
|
+
code: DiagnosticCode2.AriaAttributeInvalid,
|
|
863
|
+
category: DiagnosticCategory2.ARIA,
|
|
817
864
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
818
865
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
819
866
|
suggestions: [
|
|
@@ -826,8 +873,8 @@ var AriaDiagnostics = {
|
|
|
826
873
|
},
|
|
827
874
|
missingLiveRegion(role, impliedLive) {
|
|
828
875
|
return {
|
|
829
|
-
code:
|
|
830
|
-
category:
|
|
876
|
+
code: DiagnosticCode2.AriaMissingLiveRegion,
|
|
877
|
+
category: DiagnosticCategory2.ARIA,
|
|
831
878
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
832
879
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
833
880
|
suggestions: [
|
|
@@ -841,8 +888,8 @@ var AriaDiagnostics = {
|
|
|
841
888
|
},
|
|
842
889
|
missingAtomic(role) {
|
|
843
890
|
return {
|
|
844
|
-
code:
|
|
845
|
-
category:
|
|
891
|
+
code: DiagnosticCode2.AriaMissingAtomic,
|
|
892
|
+
category: DiagnosticCategory2.ARIA,
|
|
846
893
|
message: `role="${role}" is a live region. Consider setting aria-atomic="true" if the full region should be announced as a unit, or aria-atomic="false" if only changed nodes should be read.`,
|
|
847
894
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
848
895
|
};
|
|
@@ -850,8 +897,8 @@ var AriaDiagnostics = {
|
|
|
850
897
|
relevantInvalidTokens(invalid) {
|
|
851
898
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
852
899
|
return {
|
|
853
|
-
code:
|
|
854
|
-
category:
|
|
900
|
+
code: DiagnosticCode2.AriaRelevantInvalidToken,
|
|
901
|
+
category: DiagnosticCategory2.ARIA,
|
|
855
902
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
856
903
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
857
904
|
suggestions: [
|
|
@@ -864,8 +911,8 @@ var AriaDiagnostics = {
|
|
|
864
911
|
},
|
|
865
912
|
relevantSuperseded() {
|
|
866
913
|
return {
|
|
867
|
-
code:
|
|
868
|
-
category:
|
|
914
|
+
code: DiagnosticCode2.AriaRelevantSuperseded,
|
|
915
|
+
category: DiagnosticCategory2.ARIA,
|
|
869
916
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
870
917
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
871
918
|
suggestions: [
|
|
@@ -878,8 +925,8 @@ var AriaDiagnostics = {
|
|
|
878
925
|
},
|
|
879
926
|
missingAccessibleName(tag) {
|
|
880
927
|
return {
|
|
881
|
-
code:
|
|
882
|
-
category:
|
|
928
|
+
code: DiagnosticCode2.AriaMissingAccessibleName,
|
|
929
|
+
category: DiagnosticCategory2.ARIA,
|
|
883
930
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
884
931
|
rationale: "Elements with a landmark or interactive role must have an accessible name so that assistive technology can identify them when presenting the page outline.",
|
|
885
932
|
suggestions: [
|
|
@@ -896,8 +943,8 @@ var AriaDiagnostics = {
|
|
|
896
943
|
},
|
|
897
944
|
attributeOnPresentational(attr, tag) {
|
|
898
945
|
return {
|
|
899
|
-
code:
|
|
900
|
-
category:
|
|
946
|
+
code: DiagnosticCode2.AriaAttributeOnPresentational,
|
|
947
|
+
category: DiagnosticCategory2.ARIA,
|
|
901
948
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
902
949
|
rationale: 'role="none" and role="presentation" (including <img alt="">) remove an element from the accessibility tree. ARIA attributes on such elements are ignored by assistive technology.',
|
|
903
950
|
suggestions: [
|
|
@@ -910,8 +957,8 @@ var AriaDiagnostics = {
|
|
|
910
957
|
},
|
|
911
958
|
ariaHiddenOnFocusable(tag) {
|
|
912
959
|
return {
|
|
913
|
-
code:
|
|
914
|
-
category:
|
|
960
|
+
code: DiagnosticCode2.AriaHiddenOnFocusable,
|
|
961
|
+
category: DiagnosticCategory2.ARIA,
|
|
915
962
|
message: `aria-hidden="true" must not be used on focusable <${tag}> elements. Screen reader users who navigate by keyboard will encounter the element but receive no information about it.`,
|
|
916
963
|
rationale: 'aria-hidden removes an element from the accessibility tree while leaving it keyboard-reachable. This creates a "ghost" \u2014 a focusable element assistive technology cannot describe.',
|
|
917
964
|
suggestions: [
|
|
@@ -929,8 +976,8 @@ var AriaDiagnostics = {
|
|
|
929
976
|
invalidAttributeValue(attr, value, expected) {
|
|
930
977
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
931
978
|
return {
|
|
932
|
-
code:
|
|
933
|
-
category:
|
|
979
|
+
code: DiagnosticCode2.AriaInvalidAttributeValue,
|
|
980
|
+
category: DiagnosticCategory2.ARIA,
|
|
934
981
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
935
982
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
936
983
|
suggestions: [
|
|
@@ -943,8 +990,8 @@ var AriaDiagnostics = {
|
|
|
943
990
|
},
|
|
944
991
|
redundantAriaLevel(tag, level) {
|
|
945
992
|
return {
|
|
946
|
-
code:
|
|
947
|
-
category:
|
|
993
|
+
code: DiagnosticCode2.AriaRedundantLevelAttribute,
|
|
994
|
+
category: DiagnosticCategory2.ARIA,
|
|
948
995
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
949
996
|
rationale: 'Restating the implicit aria-level adds noise without semantic value. Use aria-level only to override the native heading level (e.g. aria-level="3" on <h2>).',
|
|
950
997
|
suggestions: [
|
|
@@ -957,8 +1004,8 @@ var AriaDiagnostics = {
|
|
|
957
1004
|
},
|
|
958
1005
|
requiredProperty(attr, role) {
|
|
959
1006
|
return {
|
|
960
|
-
code:
|
|
961
|
-
category:
|
|
1007
|
+
code: DiagnosticCode2.AriaRequiredProperty,
|
|
1008
|
+
category: DiagnosticCategory2.ARIA,
|
|
962
1009
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
963
1010
|
rationale: `WAI-ARIA 1.2 specifies required states and properties for certain roles. Without "${attr}", assistive technology cannot correctly communicate the element's state to users.`,
|
|
964
1011
|
suggestions: [
|
|
@@ -971,8 +1018,8 @@ var AriaDiagnostics = {
|
|
|
971
1018
|
},
|
|
972
1019
|
invalidRole(role, tag) {
|
|
973
1020
|
return {
|
|
974
|
-
code:
|
|
975
|
-
category:
|
|
1021
|
+
code: DiagnosticCode2.AriaInvalidRole,
|
|
1022
|
+
category: DiagnosticCategory2.ARIA,
|
|
976
1023
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
977
1024
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
978
1025
|
};
|
|
@@ -980,12 +1027,12 @@ var AriaDiagnostics = {
|
|
|
980
1027
|
};
|
|
981
1028
|
|
|
982
1029
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
983
|
-
import { DiagnosticCategory as
|
|
1030
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "./_shared/diagnostics.js";
|
|
984
1031
|
var ContractDiagnostics = {
|
|
985
1032
|
unexpectedChild(typeName, index, context) {
|
|
986
1033
|
return {
|
|
987
|
-
code:
|
|
988
|
-
category:
|
|
1034
|
+
code: DiagnosticCode3.UnexpectedChild,
|
|
1035
|
+
category: DiagnosticCategory3.Contract,
|
|
989
1036
|
component: context,
|
|
990
1037
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
991
1038
|
};
|
|
@@ -993,69 +1040,69 @@ var ContractDiagnostics = {
|
|
|
993
1040
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
994
1041
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
995
1042
|
return {
|
|
996
|
-
code:
|
|
997
|
-
category:
|
|
1043
|
+
code: DiagnosticCode3.AmbiguousChild,
|
|
1044
|
+
category: DiagnosticCategory3.Contract,
|
|
998
1045
|
component: context,
|
|
999
1046
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
1000
1047
|
};
|
|
1001
1048
|
},
|
|
1002
1049
|
cardinalityMin(ruleName, min, context) {
|
|
1003
1050
|
return {
|
|
1004
|
-
code:
|
|
1005
|
-
category:
|
|
1051
|
+
code: DiagnosticCode3.CardinalityMin,
|
|
1052
|
+
category: DiagnosticCategory3.Contract,
|
|
1006
1053
|
component: context,
|
|
1007
1054
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
1008
1055
|
};
|
|
1009
1056
|
},
|
|
1010
1057
|
cardinalityMax(ruleName, max, context) {
|
|
1011
1058
|
return {
|
|
1012
|
-
code:
|
|
1013
|
-
category:
|
|
1059
|
+
code: DiagnosticCode3.CardinalityMax,
|
|
1060
|
+
category: DiagnosticCategory3.Contract,
|
|
1014
1061
|
component: context,
|
|
1015
1062
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
1016
1063
|
};
|
|
1017
1064
|
},
|
|
1018
1065
|
positionViolation(ruleName, position, index, context) {
|
|
1019
1066
|
return {
|
|
1020
|
-
code:
|
|
1021
|
-
category:
|
|
1067
|
+
code: DiagnosticCode3.PositionViolation,
|
|
1068
|
+
category: DiagnosticCategory3.Contract,
|
|
1022
1069
|
component: context,
|
|
1023
1070
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
1024
1071
|
};
|
|
1025
1072
|
},
|
|
1026
1073
|
unknownVariantDim(component, label2, dim) {
|
|
1027
1074
|
return {
|
|
1028
|
-
code:
|
|
1029
|
-
category:
|
|
1075
|
+
code: DiagnosticCode3.ContractUnknownVariantDim,
|
|
1076
|
+
category: DiagnosticCategory3.Contract,
|
|
1030
1077
|
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
1031
1078
|
};
|
|
1032
1079
|
},
|
|
1033
1080
|
unknownVariantValue(component, label2, dim, value, valid) {
|
|
1034
1081
|
return {
|
|
1035
|
-
code:
|
|
1036
|
-
category:
|
|
1082
|
+
code: DiagnosticCode3.ContractUnknownVariantValue,
|
|
1083
|
+
category: DiagnosticCategory3.Contract,
|
|
1037
1084
|
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
1038
1085
|
};
|
|
1039
1086
|
},
|
|
1040
1087
|
unknownRecipeKey(component, key) {
|
|
1041
1088
|
return {
|
|
1042
|
-
code:
|
|
1043
|
-
category:
|
|
1089
|
+
code: DiagnosticCode3.ContractUnknownRecipeKey,
|
|
1090
|
+
category: DiagnosticCategory3.Contract,
|
|
1044
1091
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
1045
1092
|
};
|
|
1046
1093
|
},
|
|
1047
1094
|
invalidVariantValue(component, key, value) {
|
|
1048
1095
|
return {
|
|
1049
|
-
code:
|
|
1050
|
-
category:
|
|
1096
|
+
code: DiagnosticCode3.ContractInvalidVariantValue,
|
|
1097
|
+
category: DiagnosticCategory3.Contract,
|
|
1051
1098
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
1052
1099
|
};
|
|
1053
1100
|
},
|
|
1054
1101
|
allowedAsViolation(tag, allowedAs, component) {
|
|
1055
1102
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
1056
1103
|
return {
|
|
1057
|
-
code:
|
|
1058
|
-
category:
|
|
1104
|
+
code: DiagnosticCode3.AllowedAsViolation,
|
|
1105
|
+
category: DiagnosticCategory3.Contract,
|
|
1059
1106
|
component,
|
|
1060
1107
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
1061
1108
|
};
|
|
@@ -1063,68 +1110,68 @@ var ContractDiagnostics = {
|
|
|
1063
1110
|
};
|
|
1064
1111
|
|
|
1065
1112
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
1066
|
-
import { DiagnosticCategory as
|
|
1113
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "./_shared/diagnostics.js";
|
|
1067
1114
|
var ATTRIBUTE_IGNORED_CODES = {
|
|
1068
|
-
checked:
|
|
1069
|
-
multiple:
|
|
1070
|
-
maxLength:
|
|
1071
|
-
minLength:
|
|
1072
|
-
pattern:
|
|
1073
|
-
min:
|
|
1074
|
-
max:
|
|
1075
|
-
step:
|
|
1076
|
-
accept:
|
|
1077
|
-
capture:
|
|
1078
|
-
size:
|
|
1079
|
-
alt:
|
|
1080
|
-
height:
|
|
1081
|
-
width:
|
|
1115
|
+
checked: DiagnosticCode4.HtmlInputCheckedIgnoredForType,
|
|
1116
|
+
multiple: DiagnosticCode4.HtmlInputMultipleIgnoredForType,
|
|
1117
|
+
maxLength: DiagnosticCode4.HtmlInputMaxLengthIgnoredForType,
|
|
1118
|
+
minLength: DiagnosticCode4.HtmlInputMinLengthIgnoredForType,
|
|
1119
|
+
pattern: DiagnosticCode4.HtmlInputPatternIgnoredForType,
|
|
1120
|
+
min: DiagnosticCode4.HtmlInputMinIgnoredForType,
|
|
1121
|
+
max: DiagnosticCode4.HtmlInputMaxIgnoredForType,
|
|
1122
|
+
step: DiagnosticCode4.HtmlInputStepIgnoredForType,
|
|
1123
|
+
accept: DiagnosticCode4.HtmlInputAcceptIgnoredForType,
|
|
1124
|
+
capture: DiagnosticCode4.HtmlInputCaptureIgnoredForType,
|
|
1125
|
+
size: DiagnosticCode4.HtmlInputSizeIgnoredForType,
|
|
1126
|
+
alt: DiagnosticCode4.HtmlInputAltIgnoredForType,
|
|
1127
|
+
height: DiagnosticCode4.HtmlInputHeightIgnoredForType,
|
|
1128
|
+
width: DiagnosticCode4.HtmlInputWidthIgnoredForType
|
|
1082
1129
|
};
|
|
1083
1130
|
var HtmlDiagnostics = {
|
|
1084
1131
|
emptyRole(tag) {
|
|
1085
1132
|
return {
|
|
1086
|
-
code:
|
|
1087
|
-
category:
|
|
1133
|
+
code: DiagnosticCode4.HtmlEmptyRole,
|
|
1134
|
+
category: DiagnosticCategory4.HTML,
|
|
1088
1135
|
severity: "warning",
|
|
1089
1136
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
1090
1137
|
};
|
|
1091
1138
|
},
|
|
1092
1139
|
implicitRoleRedundant(tag, implicitRole) {
|
|
1093
1140
|
return {
|
|
1094
|
-
code:
|
|
1095
|
-
category:
|
|
1141
|
+
code: DiagnosticCode4.HtmlImplicitRoleRedundant,
|
|
1142
|
+
category: DiagnosticCategory4.HTML,
|
|
1096
1143
|
severity: "warning",
|
|
1097
1144
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
1098
1145
|
};
|
|
1099
1146
|
},
|
|
1100
1147
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
1101
1148
|
return {
|
|
1102
|
-
code:
|
|
1103
|
-
category:
|
|
1149
|
+
code: DiagnosticCode4.HtmlImplicitRoleOverride,
|
|
1150
|
+
category: DiagnosticCategory4.HTML,
|
|
1104
1151
|
severity: "error",
|
|
1105
1152
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
1106
1153
|
};
|
|
1107
1154
|
},
|
|
1108
1155
|
standaloneRegionOverride(tag, implicitRole) {
|
|
1109
1156
|
return {
|
|
1110
|
-
code:
|
|
1111
|
-
category:
|
|
1157
|
+
code: DiagnosticCode4.HtmlStandaloneRegionOverride,
|
|
1158
|
+
category: DiagnosticCategory4.HTML,
|
|
1112
1159
|
severity: "error",
|
|
1113
1160
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
1114
1161
|
};
|
|
1115
1162
|
},
|
|
1116
1163
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
1117
1164
|
return {
|
|
1118
|
-
code:
|
|
1119
|
-
category:
|
|
1165
|
+
code: DiagnosticCode4.HtmlLandmarkRoleOverride,
|
|
1166
|
+
category: DiagnosticCategory4.HTML,
|
|
1120
1167
|
severity: "error",
|
|
1121
1168
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1122
1169
|
};
|
|
1123
1170
|
},
|
|
1124
1171
|
invalidChild(child, parent, allowed) {
|
|
1125
1172
|
return {
|
|
1126
|
-
code:
|
|
1127
|
-
category:
|
|
1173
|
+
code: DiagnosticCode4.HtmlInvalidChild,
|
|
1174
|
+
category: DiagnosticCategory4.HTML,
|
|
1128
1175
|
severity: "error",
|
|
1129
1176
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
1130
1177
|
};
|
|
@@ -1132,8 +1179,8 @@ var HtmlDiagnostics = {
|
|
|
1132
1179
|
roleNotPermitted(tag, role, allowedRoles) {
|
|
1133
1180
|
const allowed = allowedRoles.length > 0 ? allowedRoles.map((r) => `"${r}"`).join(", ") : "none \u2014 no explicit role is permitted on this element";
|
|
1134
1181
|
return {
|
|
1135
|
-
code:
|
|
1136
|
-
category:
|
|
1182
|
+
code: DiagnosticCode4.HtmlRoleNotPermitted,
|
|
1183
|
+
category: DiagnosticCategory4.HTML,
|
|
1137
1184
|
severity: "error",
|
|
1138
1185
|
message: `role="${role}" is not permitted on <${tag}>. Allowed alternate role(s): ${allowed}.`,
|
|
1139
1186
|
rationale: 'The WAI-ARIA "ARIA in HTML" specification restricts which explicit roles a native element may take. A role outside that set is ignored or produces undefined behavior in assistive technology.'
|
|
@@ -1144,8 +1191,8 @@ var HtmlDiagnostics = {
|
|
|
1144
1191
|
input: {
|
|
1145
1192
|
unsupportedType(type) {
|
|
1146
1193
|
return {
|
|
1147
|
-
code:
|
|
1148
|
-
category:
|
|
1194
|
+
code: DiagnosticCode4.HtmlInputUnsupportedType,
|
|
1195
|
+
category: DiagnosticCategory4.HTML,
|
|
1149
1196
|
severity: "warning",
|
|
1150
1197
|
message: `type="${type}" is not a value defined by the HTML specification. Browsers silently fall back to type="text".`,
|
|
1151
1198
|
rationale: 'An unrecognized input type is not invalid markup \u2014 the spec requires the "text" fallback \u2014 but it usually means a typo, since the input keeps working while silently losing the intended type-specific behavior (validation, virtual keyboard, picker UI).',
|
|
@@ -1165,7 +1212,7 @@ var HtmlDiagnostics = {
|
|
|
1165
1212
|
if (!code) throw new Error(`No DiagnosticCode registered for input attribute "${attribute}"`);
|
|
1166
1213
|
return {
|
|
1167
1214
|
code,
|
|
1168
|
-
category:
|
|
1215
|
+
category: DiagnosticCategory4.HTML,
|
|
1169
1216
|
severity: "warning",
|
|
1170
1217
|
message: `"${attribute}" is ignored on <input type="${type}">.`,
|
|
1171
1218
|
rationale: `"${attribute}" only has an effect when type is one of: ${allowed}. Browsers silently ignore it on other input types.`,
|
|
@@ -1177,18 +1224,30 @@ var HtmlDiagnostics = {
|
|
|
1177
1224
|
]
|
|
1178
1225
|
};
|
|
1179
1226
|
}
|
|
1227
|
+
},
|
|
1228
|
+
// Reserved for <a>-specific facts (HTML3201–3299, see codes.ts).
|
|
1229
|
+
anchor: {
|
|
1230
|
+
dangerousHref(href) {
|
|
1231
|
+
return {
|
|
1232
|
+
code: DiagnosticCode4.HtmlAnchorDangerousHref,
|
|
1233
|
+
category: DiagnosticCategory4.HTML,
|
|
1234
|
+
severity: "warning",
|
|
1235
|
+
message: `href="${href}" uses a scheme that executes attacker-controlled content when navigated to. It has been removed.`,
|
|
1236
|
+
rationale: '"javascript:", "data:", and "vbscript:" URLs are a common XSS vector when href comes from untrusted input \u2014 none of the three are needed for legitimate navigation.'
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1180
1239
|
}
|
|
1181
1240
|
};
|
|
1182
1241
|
|
|
1183
1242
|
// ../../lib/contract/src/diagnostics/input-accessibility.ts
|
|
1184
|
-
import { DiagnosticCategory as
|
|
1243
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "./_shared/diagnostics.js";
|
|
1185
1244
|
function accessibilityFact(input) {
|
|
1186
|
-
return { category:
|
|
1245
|
+
return { category: DiagnosticCategory5.Accessibility, ...input };
|
|
1187
1246
|
}
|
|
1188
1247
|
var InputAccessibilityDiagnostics = {
|
|
1189
1248
|
missingAccessibleName() {
|
|
1190
1249
|
return accessibilityFact({
|
|
1191
|
-
code:
|
|
1250
|
+
code: DiagnosticCode5.A11yInputMissingAccessibleName,
|
|
1192
1251
|
severity: "warning",
|
|
1193
1252
|
message: "This input has no accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1194
1253
|
rationale: "Assistive technology announces a form field by its accessible name; without one, users of screen readers cannot tell what the field is for.",
|
|
@@ -1203,7 +1262,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1203
1262
|
},
|
|
1204
1263
|
placeholderIsNotLabel() {
|
|
1205
1264
|
return accessibilityFact({
|
|
1206
|
-
code:
|
|
1265
|
+
code: DiagnosticCode5.A11yInputPlaceholderNotLabel,
|
|
1207
1266
|
severity: "warning",
|
|
1208
1267
|
message: "Placeholder text does not provide an accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1209
1268
|
rationale: "Placeholder text disappears as users interact with the field and is not treated as the control's accessible name by many assistive technologies.",
|
|
@@ -1218,7 +1277,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1218
1277
|
},
|
|
1219
1278
|
passwordMissingAutocomplete() {
|
|
1220
1279
|
return accessibilityFact({
|
|
1221
|
-
code:
|
|
1280
|
+
code: DiagnosticCode5.A11yInputPasswordAutocomplete,
|
|
1222
1281
|
severity: "warning",
|
|
1223
1282
|
message: "Password inputs should specify an autoComplete value.",
|
|
1224
1283
|
rationale: "Without an explicit autocomplete hint, password managers and browsers cannot reliably tell a sign-in field apart from a password-creation field.",
|
|
@@ -1236,7 +1295,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1236
1295
|
},
|
|
1237
1296
|
requiredReadOnlyConflict() {
|
|
1238
1297
|
return accessibilityFact({
|
|
1239
|
-
code:
|
|
1298
|
+
code: DiagnosticCode5.A11yInputRequiredReadOnlyConflict,
|
|
1240
1299
|
severity: "warning",
|
|
1241
1300
|
message: "The required and readOnly attributes are both present. A read-only field cannot satisfy required validation through user interaction.",
|
|
1242
1301
|
rationale: "This combination is valid HTML but usually indicates an unintended state. Consider using disabled instead of readOnly, or only applying required when the field is editable."
|
|
@@ -1245,28 +1304,28 @@ var InputAccessibilityDiagnostics = {
|
|
|
1245
1304
|
};
|
|
1246
1305
|
|
|
1247
1306
|
// ../../lib/contract/src/diagnostics/slot.ts
|
|
1248
|
-
import { DiagnosticCategory as
|
|
1307
|
+
import { DiagnosticCategory as DiagnosticCategory6, DiagnosticCode as DiagnosticCode6 } from "./_shared/diagnostics.js";
|
|
1249
1308
|
var SlotDiagnostics = {
|
|
1250
1309
|
exclusive(name) {
|
|
1251
1310
|
return {
|
|
1252
|
-
code:
|
|
1253
|
-
category:
|
|
1311
|
+
code: DiagnosticCode6.SlotExclusive,
|
|
1312
|
+
category: DiagnosticCategory6.Contract,
|
|
1254
1313
|
component: name,
|
|
1255
1314
|
message: `${name}: "as" and "asChild" are mutually exclusive`
|
|
1256
1315
|
};
|
|
1257
1316
|
},
|
|
1258
1317
|
singleChildRequired(name, elementTerm) {
|
|
1259
1318
|
return {
|
|
1260
|
-
code:
|
|
1261
|
-
category:
|
|
1319
|
+
code: DiagnosticCode6.SlotSingleChild,
|
|
1320
|
+
category: DiagnosticCategory6.Contract,
|
|
1262
1321
|
component: name,
|
|
1263
1322
|
message: `${name}: asChild requires a ${elementTerm} child`
|
|
1264
1323
|
};
|
|
1265
1324
|
},
|
|
1266
1325
|
singleChildExceeded(name, elementTerm, count) {
|
|
1267
1326
|
return {
|
|
1268
|
-
code:
|
|
1269
|
-
category:
|
|
1327
|
+
code: DiagnosticCode6.SlotSingleChild,
|
|
1328
|
+
category: DiagnosticCategory6.Contract,
|
|
1270
1329
|
component: name,
|
|
1271
1330
|
message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
|
|
1272
1331
|
};
|
|
@@ -1274,16 +1333,16 @@ var SlotDiagnostics = {
|
|
|
1274
1333
|
discardedChildren(name, elementTerm, count) {
|
|
1275
1334
|
const suffix = count === 1 ? "" : "ren";
|
|
1276
1335
|
return {
|
|
1277
|
-
code:
|
|
1278
|
-
category:
|
|
1336
|
+
code: DiagnosticCode6.SlotDiscardedChildren,
|
|
1337
|
+
category: DiagnosticCategory6.Contract,
|
|
1279
1338
|
component: name,
|
|
1280
1339
|
message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
|
|
1281
1340
|
};
|
|
1282
1341
|
},
|
|
1283
1342
|
renderFnRequired(name, received) {
|
|
1284
1343
|
return {
|
|
1285
|
-
code:
|
|
1286
|
-
category:
|
|
1344
|
+
code: DiagnosticCode6.SlotRenderFn,
|
|
1345
|
+
category: DiagnosticCategory6.Contract,
|
|
1287
1346
|
component: name,
|
|
1288
1347
|
message: `${name}: asChild requires a render function as children, got ${received}`
|
|
1289
1348
|
};
|
|
@@ -2029,6 +2088,27 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
2029
2088
|
};
|
|
2030
2089
|
|
|
2031
2090
|
// ../../lib/contract/src/aria/factories.ts
|
|
2091
|
+
function invalidWithoutFix(input) {
|
|
2092
|
+
return {
|
|
2093
|
+
valid: false,
|
|
2094
|
+
fixable: false,
|
|
2095
|
+
severity: input.severity,
|
|
2096
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
2097
|
+
...isDefined(input.message) && { message: input.message },
|
|
2098
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic }
|
|
2099
|
+
};
|
|
2100
|
+
}
|
|
2101
|
+
function invalidWithFix(input) {
|
|
2102
|
+
return {
|
|
2103
|
+
valid: false,
|
|
2104
|
+
fixable: true,
|
|
2105
|
+
severity: input.severity,
|
|
2106
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
2107
|
+
...isDefined(input.message) && { message: input.message },
|
|
2108
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic },
|
|
2109
|
+
fix: input.fix
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2032
2112
|
function removeProp(props, key) {
|
|
2033
2113
|
const next = { ...props };
|
|
2034
2114
|
delete next[key];
|
|
@@ -2044,6 +2124,34 @@ function removeAttributeFix(attribute) {
|
|
|
2044
2124
|
}
|
|
2045
2125
|
});
|
|
2046
2126
|
}
|
|
2127
|
+
function defineRuleMetadata(rule, metadata2) {
|
|
2128
|
+
const descriptors = {};
|
|
2129
|
+
for (const key of Object.keys(metadata2)) {
|
|
2130
|
+
descriptors[key] = { value: metadata2[key], enumerable: false };
|
|
2131
|
+
}
|
|
2132
|
+
Object.defineProperties(rule, descriptors);
|
|
2133
|
+
return rule;
|
|
2134
|
+
}
|
|
2135
|
+
function createRemoveAttributeRule(attribute, options) {
|
|
2136
|
+
const { when, severity = "warning", message, diagnostic, readsProps, tags } = options;
|
|
2137
|
+
const fix = removeAttributeFix(attribute);
|
|
2138
|
+
const rule = (context) => {
|
|
2139
|
+
if (!when(context)) return [];
|
|
2140
|
+
return [
|
|
2141
|
+
invalidWithFix({
|
|
2142
|
+
severity,
|
|
2143
|
+
attribute,
|
|
2144
|
+
...isDefined(message) && { message },
|
|
2145
|
+
...isDefined(diagnostic) && { diagnostic: diagnostic(context) },
|
|
2146
|
+
fix
|
|
2147
|
+
})
|
|
2148
|
+
];
|
|
2149
|
+
};
|
|
2150
|
+
return defineRuleMetadata(rule, {
|
|
2151
|
+
...isDefined(readsProps) && { readsProps },
|
|
2152
|
+
...isDefined(tags) && { tags }
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2047
2155
|
|
|
2048
2156
|
// ../../lib/contract/src/children/get-type-name.ts
|
|
2049
2157
|
function getTypeName(value) {
|
|
@@ -2432,6 +2540,52 @@ var P_BLOCKED_TAGS = [
|
|
|
2432
2540
|
"ul"
|
|
2433
2541
|
];
|
|
2434
2542
|
|
|
2543
|
+
// ../core/src/html/anchor-rules.ts
|
|
2544
|
+
var DANGEROUS_URL_SCHEMES = ["javascript:", "data:", "vbscript:"];
|
|
2545
|
+
function normalizeForSchemeCheck(href) {
|
|
2546
|
+
return href.replace(/[\x00-\x20]/g, "").toLowerCase();
|
|
2547
|
+
}
|
|
2548
|
+
function isDangerousUrl(href) {
|
|
2549
|
+
if (!isString(href)) return false;
|
|
2550
|
+
const normalized = normalizeForSchemeCheck(href);
|
|
2551
|
+
return DANGEROUS_URL_SCHEMES.some((scheme) => normalized.startsWith(scheme));
|
|
2552
|
+
}
|
|
2553
|
+
var dangerousHrefRule = createRemoveAttributeRule("href", {
|
|
2554
|
+
when: ({ props }) => isDangerousUrl(props.href),
|
|
2555
|
+
severity: "warning",
|
|
2556
|
+
diagnostic: ({ props }) => HtmlDiagnostics.anchor.dangerousHref(props.href),
|
|
2557
|
+
readsProps: ["href"],
|
|
2558
|
+
tags: ["a"]
|
|
2559
|
+
});
|
|
2560
|
+
var roleButtonWithHrefRule = Object.assign(
|
|
2561
|
+
({ props }) => {
|
|
2562
|
+
if (props.role !== "button" || !isString(props.href) || props.href.length === 0) {
|
|
2563
|
+
return [];
|
|
2564
|
+
}
|
|
2565
|
+
const diagnostic = AnchorAccessibilityDiagnostics.roleButtonWithHref();
|
|
2566
|
+
return [invalidWithoutFix({ severity: diagnostic.severity, attribute: "role", diagnostic })];
|
|
2567
|
+
},
|
|
2568
|
+
{ readsProps: ["role", "href"], tags: ["a"] }
|
|
2569
|
+
);
|
|
2570
|
+
var ariaDisabledInertRule = Object.assign(
|
|
2571
|
+
({ props }) => {
|
|
2572
|
+
const ariaDisabled = props["aria-disabled"];
|
|
2573
|
+
const isDisabled = ariaDisabled === true || ariaDisabled === "true";
|
|
2574
|
+
const hasHref = isString(props.href) && props.href.length > 0;
|
|
2575
|
+
if (!isDisabled || !hasHref) return [];
|
|
2576
|
+
const diagnostic = AnchorAccessibilityDiagnostics.ariaDisabledInert();
|
|
2577
|
+
return [
|
|
2578
|
+
invalidWithoutFix({ severity: diagnostic.severity, attribute: "aria-disabled", diagnostic })
|
|
2579
|
+
];
|
|
2580
|
+
},
|
|
2581
|
+
{ readsProps: ["aria-disabled", "href"], tags: ["a"] }
|
|
2582
|
+
);
|
|
2583
|
+
var ANCHOR_RULES = [
|
|
2584
|
+
dangerousHrefRule,
|
|
2585
|
+
roleButtonWithHrefRule,
|
|
2586
|
+
ariaDisabledInertRule
|
|
2587
|
+
];
|
|
2588
|
+
|
|
2435
2589
|
// ../core/src/html/spec/vocabulary/input.ts
|
|
2436
2590
|
var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
|
|
2437
2591
|
var NUMERIC_INPUT_TYPES = [
|
|
@@ -2511,12 +2665,12 @@ function createInputAttributeTypeRule({
|
|
|
2511
2665
|
// ../core/src/html/spec/validators/mutually-exclusive-validator.ts
|
|
2512
2666
|
function createMutuallyExclusiveRule({
|
|
2513
2667
|
props: conflictingProps,
|
|
2514
|
-
diagnostic:
|
|
2668
|
+
diagnostic: createDiagnostic2
|
|
2515
2669
|
}) {
|
|
2516
2670
|
const [first, second] = conflictingProps;
|
|
2517
2671
|
const rule = ({ tag, props }) => {
|
|
2518
2672
|
if (tag !== "input" || !props[first] || !props[second]) return [];
|
|
2519
|
-
const diagnostic =
|
|
2673
|
+
const diagnostic = createDiagnostic2();
|
|
2520
2674
|
return [{ valid: false, fixable: false, severity: diagnostic.severity, diagnostic }];
|
|
2521
2675
|
};
|
|
2522
2676
|
return Object.assign(rule, { readsProps: conflictingProps, tags: ["input"] });
|
|
@@ -2896,7 +3050,8 @@ var HTML_ARIA_RULES = [
|
|
|
2896
3050
|
landmarkRoleRule,
|
|
2897
3051
|
landmarkAccessibleNameRule,
|
|
2898
3052
|
roleNotPermittedRule,
|
|
2899
|
-
...INPUT_RULES
|
|
3053
|
+
...INPUT_RULES,
|
|
3054
|
+
...ANCHOR_RULES
|
|
2900
3055
|
];
|
|
2901
3056
|
|
|
2902
3057
|
// ../core/src/html/contracts/helpers.ts
|
|
@@ -3306,19 +3461,6 @@ function createClassPipeline(resolved) {
|
|
|
3306
3461
|
};
|
|
3307
3462
|
}
|
|
3308
3463
|
|
|
3309
|
-
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3310
|
-
function definePipeline(factory) {
|
|
3311
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
3312
|
-
return (resolved) => {
|
|
3313
|
-
let pipeline = cache.get(resolved);
|
|
3314
|
-
if (!pipeline) {
|
|
3315
|
-
pipeline = factory(resolved);
|
|
3316
|
-
cache.set(resolved, pipeline);
|
|
3317
|
-
}
|
|
3318
|
-
return pipeline;
|
|
3319
|
-
};
|
|
3320
|
-
}
|
|
3321
|
-
|
|
3322
3464
|
// ../core/src/options/resolve-factory-options.ts
|
|
3323
3465
|
import { resolveDiagnostics, silentDiagnostics } from "./_shared/diagnostics.js";
|
|
3324
3466
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
@@ -3422,25 +3564,66 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
|
3422
3564
|
}
|
|
3423
3565
|
}
|
|
3424
3566
|
|
|
3567
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3568
|
+
function definePipeline(factory) {
|
|
3569
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3570
|
+
return (resolved) => {
|
|
3571
|
+
let pipeline = cache.get(resolved);
|
|
3572
|
+
if (!pipeline) {
|
|
3573
|
+
pipeline = factory(resolved);
|
|
3574
|
+
cache.set(resolved, pipeline);
|
|
3575
|
+
}
|
|
3576
|
+
return pipeline;
|
|
3577
|
+
};
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3580
|
+
// ../core/src/factory/pipelines/generic.ts
|
|
3581
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3582
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3583
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3584
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3585
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3586
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3587
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3588
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3589
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(
|
|
3590
|
+
createHtmlChildrenEvaluatorPipeline
|
|
3591
|
+
);
|
|
3592
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3593
|
+
|
|
3594
|
+
// ../core/src/factory/pipelines/aria.ts
|
|
3595
|
+
function resolveAriaRules(resolved) {
|
|
3596
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3597
|
+
}
|
|
3598
|
+
var createAriaPipeline = (resolved) => {
|
|
3599
|
+
const rules = resolveAriaRules(resolved);
|
|
3600
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3601
|
+
return (tag, props) => engine.validate(tag, props);
|
|
3602
|
+
};
|
|
3603
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3604
|
+
function resolveAriaPassthrough(_tag, props) {
|
|
3605
|
+
return { props };
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3425
3608
|
// ../core/src/factory/plugin-invariants.ts
|
|
3426
3609
|
import { throwDiagnostics } from "./_shared/diagnostics.js";
|
|
3427
3610
|
|
|
3428
3611
|
// ../core/src/factory/plugin-diagnostics.ts
|
|
3429
|
-
import { DiagnosticCategory as
|
|
3612
|
+
import { DiagnosticCategory as DiagnosticCategory7, DiagnosticCode as DiagnosticCode7 } from "./_shared/diagnostics.js";
|
|
3430
3613
|
var PluginDiagnostics = {
|
|
3431
3614
|
invalidShape(received) {
|
|
3432
|
-
const got = received
|
|
3615
|
+
const got = isNull(received) ? "null" : typeof received;
|
|
3433
3616
|
return {
|
|
3434
|
-
code:
|
|
3435
|
-
category:
|
|
3617
|
+
code: DiagnosticCode7.PluginInvalidShape,
|
|
3618
|
+
category: DiagnosticCategory7.Internal,
|
|
3436
3619
|
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
3437
3620
|
};
|
|
3438
3621
|
},
|
|
3439
3622
|
pipelineReturnType(received) {
|
|
3440
|
-
const got = received
|
|
3623
|
+
const got = isNull(received) ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
3441
3624
|
return {
|
|
3442
|
-
code:
|
|
3443
|
-
category:
|
|
3625
|
+
code: DiagnosticCode7.PluginPipelineReturnType,
|
|
3626
|
+
category: DiagnosticCategory7.Internal,
|
|
3444
3627
|
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
3445
3628
|
};
|
|
3446
3629
|
}
|
|
@@ -3448,60 +3631,41 @@ var PluginDiagnostics = {
|
|
|
3448
3631
|
|
|
3449
3632
|
// ../core/src/factory/plugin-invariants.ts
|
|
3450
3633
|
function assertPluginShape(result) {
|
|
3451
|
-
if (result
|
|
3634
|
+
if (isNull(result) || !isObject(result))
|
|
3452
3635
|
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3453
3636
|
const plugin = result;
|
|
3454
|
-
if (
|
|
3455
|
-
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3637
|
+
if (!isFunction(plugin.pipeline)) throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3456
3638
|
}
|
|
3457
3639
|
function guardPipeline(pipeline) {
|
|
3458
3640
|
if (process.env.NODE_ENV === "production") return pipeline;
|
|
3459
3641
|
return function guardedPipeline(tag, props, className, recipe) {
|
|
3460
3642
|
const result = pipeline(tag, props, className, recipe);
|
|
3461
|
-
if (
|
|
3462
|
-
throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3643
|
+
if (!isString(result)) throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3463
3644
|
return result;
|
|
3464
3645
|
};
|
|
3465
3646
|
}
|
|
3466
3647
|
|
|
3467
|
-
// ../core/src/factory/
|
|
3468
|
-
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3469
|
-
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3470
|
-
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3471
|
-
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3472
|
-
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3473
|
-
function resolveAriaRules(resolved) {
|
|
3474
|
-
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3475
|
-
}
|
|
3476
|
-
var createAriaPipeline = (resolved) => {
|
|
3477
|
-
const rules = resolveAriaRules(resolved);
|
|
3478
|
-
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3479
|
-
return (tag, props) => engine.validate(tag, props);
|
|
3480
|
-
};
|
|
3481
|
-
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3482
|
-
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3483
|
-
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3484
|
-
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
3485
|
-
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3486
|
-
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3487
|
-
function resolveAriaPassthrough(_tag, props) {
|
|
3488
|
-
return { props };
|
|
3489
|
-
}
|
|
3648
|
+
// ../core/src/factory/pipelines/styling.ts
|
|
3490
3649
|
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
3491
3650
|
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
3492
3651
|
const pluginResult = factory(resolved, diagnostics);
|
|
3493
3652
|
assertPluginShape(pluginResult);
|
|
3494
3653
|
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
3495
3654
|
}
|
|
3496
|
-
|
|
3655
|
+
|
|
3656
|
+
// ../core/src/factory/create-polymorphic.ts
|
|
3657
|
+
function eraseResolvedShape(resolved) {
|
|
3658
|
+
return resolved;
|
|
3659
|
+
}
|
|
3660
|
+
function createPolymorphic(options = {}) {
|
|
3497
3661
|
const baseResolved = resolveFactoryOptions(options);
|
|
3498
|
-
const anyBaseResolved = baseResolved;
|
|
3662
|
+
const anyBaseResolved = eraseResolvedShape(baseResolved);
|
|
3499
3663
|
const resolved = Object.freeze({
|
|
3500
3664
|
...baseResolved,
|
|
3501
3665
|
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
3502
3666
|
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
3503
3667
|
});
|
|
3504
|
-
const anyResolved = resolved;
|
|
3668
|
+
const anyResolved = eraseResolvedShape(resolved);
|
|
3505
3669
|
if (process.env.NODE_ENV !== "production") {
|
|
3506
3670
|
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
3507
3671
|
}
|
|
@@ -3542,7 +3706,7 @@ function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
|
3542
3706
|
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
3543
3707
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
3544
3708
|
function buildCoreRuntime(normalized) {
|
|
3545
|
-
const runtime =
|
|
3709
|
+
const runtime = createPolymorphic(normalized);
|
|
3546
3710
|
const ownedKeys = "classPlugin" in runtime ? runtime.classPlugin.ownedKeys ?? EMPTY_SET : EMPTY_SET;
|
|
3547
3711
|
return { runtime, ownedKeys };
|
|
3548
3712
|
}
|
|
@@ -3956,9 +4120,7 @@ function buildRuntime(options, defaultSlotComponent, normalizeChildren) {
|
|
|
3956
4120
|
export {
|
|
3957
4121
|
invariant,
|
|
3958
4122
|
defineContractComponent,
|
|
3959
|
-
isString,
|
|
3960
4123
|
SLOT_NAME,
|
|
3961
|
-
COMPONENT_DEFAULT_TAG,
|
|
3962
4124
|
finalizeComponent,
|
|
3963
4125
|
isReactFactoryOptions,
|
|
3964
4126
|
isPolymorphicComponent,
|