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
package/dist/vue/index.js
CHANGED
|
@@ -41,6 +41,9 @@ function dynamic(resolve) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
44
|
+
function isDefined(value) {
|
|
45
|
+
return value !== void 0;
|
|
46
|
+
}
|
|
44
47
|
function isUndefined(value) {
|
|
45
48
|
return value === void 0;
|
|
46
49
|
}
|
|
@@ -774,21 +777,65 @@ function getImplicitRole(tag, props) {
|
|
|
774
777
|
return void 0;
|
|
775
778
|
}
|
|
776
779
|
|
|
777
|
-
// ../../lib/contract/src/diagnostics/
|
|
780
|
+
// ../../lib/contract/src/diagnostics/anchor-accessibility.ts
|
|
778
781
|
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
782
|
+
function createDiagnostic(input) {
|
|
783
|
+
return { category: DiagnosticCategory.Accessibility, ...input };
|
|
784
|
+
}
|
|
785
|
+
var AnchorAccessibilityDiagnostics = {
|
|
786
|
+
roleButtonWithHref() {
|
|
787
|
+
return createDiagnostic({
|
|
788
|
+
code: DiagnosticCode.A11yAnchorRoleButtonWithHref,
|
|
789
|
+
severity: "warning",
|
|
790
|
+
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.',
|
|
791
|
+
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.',
|
|
792
|
+
suggestions: [
|
|
793
|
+
{
|
|
794
|
+
title: "Use a real <button>",
|
|
795
|
+
description: "If this element should not navigate, render a <button> instead of an <a>."
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
title: 'Remove role="button"',
|
|
799
|
+
description: "If this element should navigate, keep the default link role."
|
|
800
|
+
}
|
|
801
|
+
]
|
|
802
|
+
});
|
|
803
|
+
},
|
|
804
|
+
ariaDisabledInert() {
|
|
805
|
+
return createDiagnostic({
|
|
806
|
+
code: DiagnosticCode.A11yAnchorAriaDisabledInert,
|
|
807
|
+
severity: "warning",
|
|
808
|
+
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.",
|
|
809
|
+
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.",
|
|
810
|
+
suggestions: [
|
|
811
|
+
{
|
|
812
|
+
title: "Remove href",
|
|
813
|
+
description: "If this element is temporarily unavailable, remove href until it can be activated."
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
title: "Prevent navigation when disabled",
|
|
817
|
+
description: "Prevent the click and keyboard activation when the link is disabled so it behaves consistently for all users."
|
|
818
|
+
}
|
|
819
|
+
]
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
// ../../lib/contract/src/diagnostics/aria.ts
|
|
825
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
779
826
|
var AriaDiagnostics = {
|
|
780
827
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
781
828
|
fromViolation(v) {
|
|
782
829
|
return {
|
|
783
|
-
code:
|
|
784
|
-
category:
|
|
830
|
+
code: DiagnosticCode2.AriaViolation,
|
|
831
|
+
category: DiagnosticCategory2.ARIA,
|
|
785
832
|
message: v.message
|
|
786
833
|
};
|
|
787
834
|
},
|
|
788
835
|
attributeInvalid(key, role) {
|
|
789
836
|
return {
|
|
790
|
-
code:
|
|
791
|
-
category:
|
|
837
|
+
code: DiagnosticCode2.AriaAttributeInvalid,
|
|
838
|
+
category: DiagnosticCategory2.ARIA,
|
|
792
839
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
793
840
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
794
841
|
suggestions: [
|
|
@@ -801,8 +848,8 @@ var AriaDiagnostics = {
|
|
|
801
848
|
},
|
|
802
849
|
missingLiveRegion(role, impliedLive) {
|
|
803
850
|
return {
|
|
804
|
-
code:
|
|
805
|
-
category:
|
|
851
|
+
code: DiagnosticCode2.AriaMissingLiveRegion,
|
|
852
|
+
category: DiagnosticCategory2.ARIA,
|
|
806
853
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
807
854
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
808
855
|
suggestions: [
|
|
@@ -816,8 +863,8 @@ var AriaDiagnostics = {
|
|
|
816
863
|
},
|
|
817
864
|
missingAtomic(role) {
|
|
818
865
|
return {
|
|
819
|
-
code:
|
|
820
|
-
category:
|
|
866
|
+
code: DiagnosticCode2.AriaMissingAtomic,
|
|
867
|
+
category: DiagnosticCategory2.ARIA,
|
|
821
868
|
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.`,
|
|
822
869
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
823
870
|
};
|
|
@@ -825,8 +872,8 @@ var AriaDiagnostics = {
|
|
|
825
872
|
relevantInvalidTokens(invalid) {
|
|
826
873
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
827
874
|
return {
|
|
828
|
-
code:
|
|
829
|
-
category:
|
|
875
|
+
code: DiagnosticCode2.AriaRelevantInvalidToken,
|
|
876
|
+
category: DiagnosticCategory2.ARIA,
|
|
830
877
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
831
878
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
832
879
|
suggestions: [
|
|
@@ -839,8 +886,8 @@ var AriaDiagnostics = {
|
|
|
839
886
|
},
|
|
840
887
|
relevantSuperseded() {
|
|
841
888
|
return {
|
|
842
|
-
code:
|
|
843
|
-
category:
|
|
889
|
+
code: DiagnosticCode2.AriaRelevantSuperseded,
|
|
890
|
+
category: DiagnosticCategory2.ARIA,
|
|
844
891
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
845
892
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
846
893
|
suggestions: [
|
|
@@ -853,8 +900,8 @@ var AriaDiagnostics = {
|
|
|
853
900
|
},
|
|
854
901
|
missingAccessibleName(tag) {
|
|
855
902
|
return {
|
|
856
|
-
code:
|
|
857
|
-
category:
|
|
903
|
+
code: DiagnosticCode2.AriaMissingAccessibleName,
|
|
904
|
+
category: DiagnosticCategory2.ARIA,
|
|
858
905
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
859
906
|
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.",
|
|
860
907
|
suggestions: [
|
|
@@ -871,8 +918,8 @@ var AriaDiagnostics = {
|
|
|
871
918
|
},
|
|
872
919
|
attributeOnPresentational(attr, tag) {
|
|
873
920
|
return {
|
|
874
|
-
code:
|
|
875
|
-
category:
|
|
921
|
+
code: DiagnosticCode2.AriaAttributeOnPresentational,
|
|
922
|
+
category: DiagnosticCategory2.ARIA,
|
|
876
923
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
877
924
|
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.',
|
|
878
925
|
suggestions: [
|
|
@@ -885,8 +932,8 @@ var AriaDiagnostics = {
|
|
|
885
932
|
},
|
|
886
933
|
ariaHiddenOnFocusable(tag) {
|
|
887
934
|
return {
|
|
888
|
-
code:
|
|
889
|
-
category:
|
|
935
|
+
code: DiagnosticCode2.AriaHiddenOnFocusable,
|
|
936
|
+
category: DiagnosticCategory2.ARIA,
|
|
890
937
|
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.`,
|
|
891
938
|
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.',
|
|
892
939
|
suggestions: [
|
|
@@ -904,8 +951,8 @@ var AriaDiagnostics = {
|
|
|
904
951
|
invalidAttributeValue(attr, value, expected) {
|
|
905
952
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
906
953
|
return {
|
|
907
|
-
code:
|
|
908
|
-
category:
|
|
954
|
+
code: DiagnosticCode2.AriaInvalidAttributeValue,
|
|
955
|
+
category: DiagnosticCategory2.ARIA,
|
|
909
956
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
910
957
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
911
958
|
suggestions: [
|
|
@@ -918,8 +965,8 @@ var AriaDiagnostics = {
|
|
|
918
965
|
},
|
|
919
966
|
redundantAriaLevel(tag, level) {
|
|
920
967
|
return {
|
|
921
|
-
code:
|
|
922
|
-
category:
|
|
968
|
+
code: DiagnosticCode2.AriaRedundantLevelAttribute,
|
|
969
|
+
category: DiagnosticCategory2.ARIA,
|
|
923
970
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
924
971
|
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>).',
|
|
925
972
|
suggestions: [
|
|
@@ -932,8 +979,8 @@ var AriaDiagnostics = {
|
|
|
932
979
|
},
|
|
933
980
|
requiredProperty(attr, role) {
|
|
934
981
|
return {
|
|
935
|
-
code:
|
|
936
|
-
category:
|
|
982
|
+
code: DiagnosticCode2.AriaRequiredProperty,
|
|
983
|
+
category: DiagnosticCategory2.ARIA,
|
|
937
984
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
938
985
|
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.`,
|
|
939
986
|
suggestions: [
|
|
@@ -946,8 +993,8 @@ var AriaDiagnostics = {
|
|
|
946
993
|
},
|
|
947
994
|
invalidRole(role, tag) {
|
|
948
995
|
return {
|
|
949
|
-
code:
|
|
950
|
-
category:
|
|
996
|
+
code: DiagnosticCode2.AriaInvalidRole,
|
|
997
|
+
category: DiagnosticCategory2.ARIA,
|
|
951
998
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
952
999
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
953
1000
|
};
|
|
@@ -955,12 +1002,12 @@ var AriaDiagnostics = {
|
|
|
955
1002
|
};
|
|
956
1003
|
|
|
957
1004
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
958
|
-
import { DiagnosticCategory as
|
|
1005
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
959
1006
|
var ContractDiagnostics = {
|
|
960
1007
|
unexpectedChild(typeName, index, context) {
|
|
961
1008
|
return {
|
|
962
|
-
code:
|
|
963
|
-
category:
|
|
1009
|
+
code: DiagnosticCode3.UnexpectedChild,
|
|
1010
|
+
category: DiagnosticCategory3.Contract,
|
|
964
1011
|
component: context,
|
|
965
1012
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
966
1013
|
};
|
|
@@ -968,69 +1015,69 @@ var ContractDiagnostics = {
|
|
|
968
1015
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
969
1016
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
970
1017
|
return {
|
|
971
|
-
code:
|
|
972
|
-
category:
|
|
1018
|
+
code: DiagnosticCode3.AmbiguousChild,
|
|
1019
|
+
category: DiagnosticCategory3.Contract,
|
|
973
1020
|
component: context,
|
|
974
1021
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
975
1022
|
};
|
|
976
1023
|
},
|
|
977
1024
|
cardinalityMin(ruleName, min, context) {
|
|
978
1025
|
return {
|
|
979
|
-
code:
|
|
980
|
-
category:
|
|
1026
|
+
code: DiagnosticCode3.CardinalityMin,
|
|
1027
|
+
category: DiagnosticCategory3.Contract,
|
|
981
1028
|
component: context,
|
|
982
1029
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
983
1030
|
};
|
|
984
1031
|
},
|
|
985
1032
|
cardinalityMax(ruleName, max, context) {
|
|
986
1033
|
return {
|
|
987
|
-
code:
|
|
988
|
-
category:
|
|
1034
|
+
code: DiagnosticCode3.CardinalityMax,
|
|
1035
|
+
category: DiagnosticCategory3.Contract,
|
|
989
1036
|
component: context,
|
|
990
1037
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
991
1038
|
};
|
|
992
1039
|
},
|
|
993
1040
|
positionViolation(ruleName, position, index, context) {
|
|
994
1041
|
return {
|
|
995
|
-
code:
|
|
996
|
-
category:
|
|
1042
|
+
code: DiagnosticCode3.PositionViolation,
|
|
1043
|
+
category: DiagnosticCategory3.Contract,
|
|
997
1044
|
component: context,
|
|
998
1045
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
999
1046
|
};
|
|
1000
1047
|
},
|
|
1001
1048
|
unknownVariantDim(component, label2, dim) {
|
|
1002
1049
|
return {
|
|
1003
|
-
code:
|
|
1004
|
-
category:
|
|
1050
|
+
code: DiagnosticCode3.ContractUnknownVariantDim,
|
|
1051
|
+
category: DiagnosticCategory3.Contract,
|
|
1005
1052
|
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
1006
1053
|
};
|
|
1007
1054
|
},
|
|
1008
1055
|
unknownVariantValue(component, label2, dim, value, valid) {
|
|
1009
1056
|
return {
|
|
1010
|
-
code:
|
|
1011
|
-
category:
|
|
1057
|
+
code: DiagnosticCode3.ContractUnknownVariantValue,
|
|
1058
|
+
category: DiagnosticCategory3.Contract,
|
|
1012
1059
|
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
1013
1060
|
};
|
|
1014
1061
|
},
|
|
1015
1062
|
unknownRecipeKey(component, key) {
|
|
1016
1063
|
return {
|
|
1017
|
-
code:
|
|
1018
|
-
category:
|
|
1064
|
+
code: DiagnosticCode3.ContractUnknownRecipeKey,
|
|
1065
|
+
category: DiagnosticCategory3.Contract,
|
|
1019
1066
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
1020
1067
|
};
|
|
1021
1068
|
},
|
|
1022
1069
|
invalidVariantValue(component, key, value) {
|
|
1023
1070
|
return {
|
|
1024
|
-
code:
|
|
1025
|
-
category:
|
|
1071
|
+
code: DiagnosticCode3.ContractInvalidVariantValue,
|
|
1072
|
+
category: DiagnosticCategory3.Contract,
|
|
1026
1073
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
1027
1074
|
};
|
|
1028
1075
|
},
|
|
1029
1076
|
allowedAsViolation(tag, allowedAs, component) {
|
|
1030
1077
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
1031
1078
|
return {
|
|
1032
|
-
code:
|
|
1033
|
-
category:
|
|
1079
|
+
code: DiagnosticCode3.AllowedAsViolation,
|
|
1080
|
+
category: DiagnosticCategory3.Contract,
|
|
1034
1081
|
component,
|
|
1035
1082
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
1036
1083
|
};
|
|
@@ -1038,68 +1085,68 @@ var ContractDiagnostics = {
|
|
|
1038
1085
|
};
|
|
1039
1086
|
|
|
1040
1087
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
1041
|
-
import { DiagnosticCategory as
|
|
1088
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
1042
1089
|
var ATTRIBUTE_IGNORED_CODES = {
|
|
1043
|
-
checked:
|
|
1044
|
-
multiple:
|
|
1045
|
-
maxLength:
|
|
1046
|
-
minLength:
|
|
1047
|
-
pattern:
|
|
1048
|
-
min:
|
|
1049
|
-
max:
|
|
1050
|
-
step:
|
|
1051
|
-
accept:
|
|
1052
|
-
capture:
|
|
1053
|
-
size:
|
|
1054
|
-
alt:
|
|
1055
|
-
height:
|
|
1056
|
-
width:
|
|
1090
|
+
checked: DiagnosticCode4.HtmlInputCheckedIgnoredForType,
|
|
1091
|
+
multiple: DiagnosticCode4.HtmlInputMultipleIgnoredForType,
|
|
1092
|
+
maxLength: DiagnosticCode4.HtmlInputMaxLengthIgnoredForType,
|
|
1093
|
+
minLength: DiagnosticCode4.HtmlInputMinLengthIgnoredForType,
|
|
1094
|
+
pattern: DiagnosticCode4.HtmlInputPatternIgnoredForType,
|
|
1095
|
+
min: DiagnosticCode4.HtmlInputMinIgnoredForType,
|
|
1096
|
+
max: DiagnosticCode4.HtmlInputMaxIgnoredForType,
|
|
1097
|
+
step: DiagnosticCode4.HtmlInputStepIgnoredForType,
|
|
1098
|
+
accept: DiagnosticCode4.HtmlInputAcceptIgnoredForType,
|
|
1099
|
+
capture: DiagnosticCode4.HtmlInputCaptureIgnoredForType,
|
|
1100
|
+
size: DiagnosticCode4.HtmlInputSizeIgnoredForType,
|
|
1101
|
+
alt: DiagnosticCode4.HtmlInputAltIgnoredForType,
|
|
1102
|
+
height: DiagnosticCode4.HtmlInputHeightIgnoredForType,
|
|
1103
|
+
width: DiagnosticCode4.HtmlInputWidthIgnoredForType
|
|
1057
1104
|
};
|
|
1058
1105
|
var HtmlDiagnostics = {
|
|
1059
1106
|
emptyRole(tag) {
|
|
1060
1107
|
return {
|
|
1061
|
-
code:
|
|
1062
|
-
category:
|
|
1108
|
+
code: DiagnosticCode4.HtmlEmptyRole,
|
|
1109
|
+
category: DiagnosticCategory4.HTML,
|
|
1063
1110
|
severity: "warning",
|
|
1064
1111
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
1065
1112
|
};
|
|
1066
1113
|
},
|
|
1067
1114
|
implicitRoleRedundant(tag, implicitRole) {
|
|
1068
1115
|
return {
|
|
1069
|
-
code:
|
|
1070
|
-
category:
|
|
1116
|
+
code: DiagnosticCode4.HtmlImplicitRoleRedundant,
|
|
1117
|
+
category: DiagnosticCategory4.HTML,
|
|
1071
1118
|
severity: "warning",
|
|
1072
1119
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
1073
1120
|
};
|
|
1074
1121
|
},
|
|
1075
1122
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
1076
1123
|
return {
|
|
1077
|
-
code:
|
|
1078
|
-
category:
|
|
1124
|
+
code: DiagnosticCode4.HtmlImplicitRoleOverride,
|
|
1125
|
+
category: DiagnosticCategory4.HTML,
|
|
1079
1126
|
severity: "error",
|
|
1080
1127
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
1081
1128
|
};
|
|
1082
1129
|
},
|
|
1083
1130
|
standaloneRegionOverride(tag, implicitRole) {
|
|
1084
1131
|
return {
|
|
1085
|
-
code:
|
|
1086
|
-
category:
|
|
1132
|
+
code: DiagnosticCode4.HtmlStandaloneRegionOverride,
|
|
1133
|
+
category: DiagnosticCategory4.HTML,
|
|
1087
1134
|
severity: "error",
|
|
1088
1135
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
1089
1136
|
};
|
|
1090
1137
|
},
|
|
1091
1138
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
1092
1139
|
return {
|
|
1093
|
-
code:
|
|
1094
|
-
category:
|
|
1140
|
+
code: DiagnosticCode4.HtmlLandmarkRoleOverride,
|
|
1141
|
+
category: DiagnosticCategory4.HTML,
|
|
1095
1142
|
severity: "error",
|
|
1096
1143
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1097
1144
|
};
|
|
1098
1145
|
},
|
|
1099
1146
|
invalidChild(child, parent, allowed) {
|
|
1100
1147
|
return {
|
|
1101
|
-
code:
|
|
1102
|
-
category:
|
|
1148
|
+
code: DiagnosticCode4.HtmlInvalidChild,
|
|
1149
|
+
category: DiagnosticCategory4.HTML,
|
|
1103
1150
|
severity: "error",
|
|
1104
1151
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
1105
1152
|
};
|
|
@@ -1107,8 +1154,8 @@ var HtmlDiagnostics = {
|
|
|
1107
1154
|
roleNotPermitted(tag, role, allowedRoles) {
|
|
1108
1155
|
const allowed = allowedRoles.length > 0 ? allowedRoles.map((r) => `"${r}"`).join(", ") : "none \u2014 no explicit role is permitted on this element";
|
|
1109
1156
|
return {
|
|
1110
|
-
code:
|
|
1111
|
-
category:
|
|
1157
|
+
code: DiagnosticCode4.HtmlRoleNotPermitted,
|
|
1158
|
+
category: DiagnosticCategory4.HTML,
|
|
1112
1159
|
severity: "error",
|
|
1113
1160
|
message: `role="${role}" is not permitted on <${tag}>. Allowed alternate role(s): ${allowed}.`,
|
|
1114
1161
|
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.'
|
|
@@ -1119,8 +1166,8 @@ var HtmlDiagnostics = {
|
|
|
1119
1166
|
input: {
|
|
1120
1167
|
unsupportedType(type) {
|
|
1121
1168
|
return {
|
|
1122
|
-
code:
|
|
1123
|
-
category:
|
|
1169
|
+
code: DiagnosticCode4.HtmlInputUnsupportedType,
|
|
1170
|
+
category: DiagnosticCategory4.HTML,
|
|
1124
1171
|
severity: "warning",
|
|
1125
1172
|
message: `type="${type}" is not a value defined by the HTML specification. Browsers silently fall back to type="text".`,
|
|
1126
1173
|
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).',
|
|
@@ -1140,7 +1187,7 @@ var HtmlDiagnostics = {
|
|
|
1140
1187
|
if (!code) throw new Error(`No DiagnosticCode registered for input attribute "${attribute}"`);
|
|
1141
1188
|
return {
|
|
1142
1189
|
code,
|
|
1143
|
-
category:
|
|
1190
|
+
category: DiagnosticCategory4.HTML,
|
|
1144
1191
|
severity: "warning",
|
|
1145
1192
|
message: `"${attribute}" is ignored on <input type="${type}">.`,
|
|
1146
1193
|
rationale: `"${attribute}" only has an effect when type is one of: ${allowed}. Browsers silently ignore it on other input types.`,
|
|
@@ -1152,18 +1199,30 @@ var HtmlDiagnostics = {
|
|
|
1152
1199
|
]
|
|
1153
1200
|
};
|
|
1154
1201
|
}
|
|
1202
|
+
},
|
|
1203
|
+
// Reserved for <a>-specific facts (HTML3201–3299, see codes.ts).
|
|
1204
|
+
anchor: {
|
|
1205
|
+
dangerousHref(href) {
|
|
1206
|
+
return {
|
|
1207
|
+
code: DiagnosticCode4.HtmlAnchorDangerousHref,
|
|
1208
|
+
category: DiagnosticCategory4.HTML,
|
|
1209
|
+
severity: "warning",
|
|
1210
|
+
message: `href="${href}" uses a scheme that executes attacker-controlled content when navigated to. It has been removed.`,
|
|
1211
|
+
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.'
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1155
1214
|
}
|
|
1156
1215
|
};
|
|
1157
1216
|
|
|
1158
1217
|
// ../../lib/contract/src/diagnostics/input-accessibility.ts
|
|
1159
|
-
import { DiagnosticCategory as
|
|
1218
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
|
|
1160
1219
|
function accessibilityFact(input) {
|
|
1161
|
-
return { category:
|
|
1220
|
+
return { category: DiagnosticCategory5.Accessibility, ...input };
|
|
1162
1221
|
}
|
|
1163
1222
|
var InputAccessibilityDiagnostics = {
|
|
1164
1223
|
missingAccessibleName() {
|
|
1165
1224
|
return accessibilityFact({
|
|
1166
|
-
code:
|
|
1225
|
+
code: DiagnosticCode5.A11yInputMissingAccessibleName,
|
|
1167
1226
|
severity: "warning",
|
|
1168
1227
|
message: "This input has no accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1169
1228
|
rationale: "Assistive technology announces a form field by its accessible name; without one, users of screen readers cannot tell what the field is for.",
|
|
@@ -1178,7 +1237,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1178
1237
|
},
|
|
1179
1238
|
placeholderIsNotLabel() {
|
|
1180
1239
|
return accessibilityFact({
|
|
1181
|
-
code:
|
|
1240
|
+
code: DiagnosticCode5.A11yInputPlaceholderNotLabel,
|
|
1182
1241
|
severity: "warning",
|
|
1183
1242
|
message: "Placeholder text does not provide an accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1184
1243
|
rationale: "Placeholder text disappears as users interact with the field and is not treated as the control's accessible name by many assistive technologies.",
|
|
@@ -1193,7 +1252,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1193
1252
|
},
|
|
1194
1253
|
passwordMissingAutocomplete() {
|
|
1195
1254
|
return accessibilityFact({
|
|
1196
|
-
code:
|
|
1255
|
+
code: DiagnosticCode5.A11yInputPasswordAutocomplete,
|
|
1197
1256
|
severity: "warning",
|
|
1198
1257
|
message: "Password inputs should specify an autoComplete value.",
|
|
1199
1258
|
rationale: "Without an explicit autocomplete hint, password managers and browsers cannot reliably tell a sign-in field apart from a password-creation field.",
|
|
@@ -1211,7 +1270,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1211
1270
|
},
|
|
1212
1271
|
requiredReadOnlyConflict() {
|
|
1213
1272
|
return accessibilityFact({
|
|
1214
|
-
code:
|
|
1273
|
+
code: DiagnosticCode5.A11yInputRequiredReadOnlyConflict,
|
|
1215
1274
|
severity: "warning",
|
|
1216
1275
|
message: "The required and readOnly attributes are both present. A read-only field cannot satisfy required validation through user interaction.",
|
|
1217
1276
|
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."
|
|
@@ -1220,28 +1279,28 @@ var InputAccessibilityDiagnostics = {
|
|
|
1220
1279
|
};
|
|
1221
1280
|
|
|
1222
1281
|
// ../../lib/contract/src/diagnostics/slot.ts
|
|
1223
|
-
import { DiagnosticCategory as
|
|
1282
|
+
import { DiagnosticCategory as DiagnosticCategory6, DiagnosticCode as DiagnosticCode6 } from "../_shared/diagnostics.js";
|
|
1224
1283
|
var SlotDiagnostics = {
|
|
1225
1284
|
exclusive(name) {
|
|
1226
1285
|
return {
|
|
1227
|
-
code:
|
|
1228
|
-
category:
|
|
1286
|
+
code: DiagnosticCode6.SlotExclusive,
|
|
1287
|
+
category: DiagnosticCategory6.Contract,
|
|
1229
1288
|
component: name,
|
|
1230
1289
|
message: `${name}: "as" and "asChild" are mutually exclusive`
|
|
1231
1290
|
};
|
|
1232
1291
|
},
|
|
1233
1292
|
singleChildRequired(name, elementTerm) {
|
|
1234
1293
|
return {
|
|
1235
|
-
code:
|
|
1236
|
-
category:
|
|
1294
|
+
code: DiagnosticCode6.SlotSingleChild,
|
|
1295
|
+
category: DiagnosticCategory6.Contract,
|
|
1237
1296
|
component: name,
|
|
1238
1297
|
message: `${name}: asChild requires a ${elementTerm} child`
|
|
1239
1298
|
};
|
|
1240
1299
|
},
|
|
1241
1300
|
singleChildExceeded(name, elementTerm, count) {
|
|
1242
1301
|
return {
|
|
1243
|
-
code:
|
|
1244
|
-
category:
|
|
1302
|
+
code: DiagnosticCode6.SlotSingleChild,
|
|
1303
|
+
category: DiagnosticCategory6.Contract,
|
|
1245
1304
|
component: name,
|
|
1246
1305
|
message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
|
|
1247
1306
|
};
|
|
@@ -1249,16 +1308,16 @@ var SlotDiagnostics = {
|
|
|
1249
1308
|
discardedChildren(name, elementTerm, count) {
|
|
1250
1309
|
const suffix = count === 1 ? "" : "ren";
|
|
1251
1310
|
return {
|
|
1252
|
-
code:
|
|
1253
|
-
category:
|
|
1311
|
+
code: DiagnosticCode6.SlotDiscardedChildren,
|
|
1312
|
+
category: DiagnosticCategory6.Contract,
|
|
1254
1313
|
component: name,
|
|
1255
1314
|
message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
|
|
1256
1315
|
};
|
|
1257
1316
|
},
|
|
1258
1317
|
renderFnRequired(name, received) {
|
|
1259
1318
|
return {
|
|
1260
|
-
code:
|
|
1261
|
-
category:
|
|
1319
|
+
code: DiagnosticCode6.SlotRenderFn,
|
|
1320
|
+
category: DiagnosticCategory6.Contract,
|
|
1262
1321
|
component: name,
|
|
1263
1322
|
message: `${name}: asChild requires a render function as children, got ${received}`
|
|
1264
1323
|
};
|
|
@@ -2004,6 +2063,27 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
2004
2063
|
};
|
|
2005
2064
|
|
|
2006
2065
|
// ../../lib/contract/src/aria/factories.ts
|
|
2066
|
+
function invalidWithoutFix(input) {
|
|
2067
|
+
return {
|
|
2068
|
+
valid: false,
|
|
2069
|
+
fixable: false,
|
|
2070
|
+
severity: input.severity,
|
|
2071
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
2072
|
+
...isDefined(input.message) && { message: input.message },
|
|
2073
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic }
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
function invalidWithFix(input) {
|
|
2077
|
+
return {
|
|
2078
|
+
valid: false,
|
|
2079
|
+
fixable: true,
|
|
2080
|
+
severity: input.severity,
|
|
2081
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
2082
|
+
...isDefined(input.message) && { message: input.message },
|
|
2083
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic },
|
|
2084
|
+
fix: input.fix
|
|
2085
|
+
};
|
|
2086
|
+
}
|
|
2007
2087
|
function removeProp(props, key) {
|
|
2008
2088
|
const next = { ...props };
|
|
2009
2089
|
delete next[key];
|
|
@@ -2019,6 +2099,34 @@ function removeAttributeFix(attribute) {
|
|
|
2019
2099
|
}
|
|
2020
2100
|
});
|
|
2021
2101
|
}
|
|
2102
|
+
function defineRuleMetadata(rule, metadata2) {
|
|
2103
|
+
const descriptors = {};
|
|
2104
|
+
for (const key of Object.keys(metadata2)) {
|
|
2105
|
+
descriptors[key] = { value: metadata2[key], enumerable: false };
|
|
2106
|
+
}
|
|
2107
|
+
Object.defineProperties(rule, descriptors);
|
|
2108
|
+
return rule;
|
|
2109
|
+
}
|
|
2110
|
+
function createRemoveAttributeRule(attribute, options) {
|
|
2111
|
+
const { when, severity = "warning", message, diagnostic, readsProps, tags } = options;
|
|
2112
|
+
const fix = removeAttributeFix(attribute);
|
|
2113
|
+
const rule = (context) => {
|
|
2114
|
+
if (!when(context)) return [];
|
|
2115
|
+
return [
|
|
2116
|
+
invalidWithFix({
|
|
2117
|
+
severity,
|
|
2118
|
+
attribute,
|
|
2119
|
+
...isDefined(message) && { message },
|
|
2120
|
+
...isDefined(diagnostic) && { diagnostic: diagnostic(context) },
|
|
2121
|
+
fix
|
|
2122
|
+
})
|
|
2123
|
+
];
|
|
2124
|
+
};
|
|
2125
|
+
return defineRuleMetadata(rule, {
|
|
2126
|
+
...isDefined(readsProps) && { readsProps },
|
|
2127
|
+
...isDefined(tags) && { tags }
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2022
2130
|
|
|
2023
2131
|
// ../../lib/contract/src/children/get-type-name.ts
|
|
2024
2132
|
function getTypeName(value) {
|
|
@@ -2407,6 +2515,52 @@ var P_BLOCKED_TAGS = [
|
|
|
2407
2515
|
"ul"
|
|
2408
2516
|
];
|
|
2409
2517
|
|
|
2518
|
+
// ../core/src/html/anchor-rules.ts
|
|
2519
|
+
var DANGEROUS_URL_SCHEMES = ["javascript:", "data:", "vbscript:"];
|
|
2520
|
+
function normalizeForSchemeCheck(href) {
|
|
2521
|
+
return href.replace(/[\x00-\x20]/g, "").toLowerCase();
|
|
2522
|
+
}
|
|
2523
|
+
function isDangerousUrl(href) {
|
|
2524
|
+
if (!isString(href)) return false;
|
|
2525
|
+
const normalized = normalizeForSchemeCheck(href);
|
|
2526
|
+
return DANGEROUS_URL_SCHEMES.some((scheme) => normalized.startsWith(scheme));
|
|
2527
|
+
}
|
|
2528
|
+
var dangerousHrefRule = createRemoveAttributeRule("href", {
|
|
2529
|
+
when: ({ props }) => isDangerousUrl(props.href),
|
|
2530
|
+
severity: "warning",
|
|
2531
|
+
diagnostic: ({ props }) => HtmlDiagnostics.anchor.dangerousHref(props.href),
|
|
2532
|
+
readsProps: ["href"],
|
|
2533
|
+
tags: ["a"]
|
|
2534
|
+
});
|
|
2535
|
+
var roleButtonWithHrefRule = Object.assign(
|
|
2536
|
+
({ props }) => {
|
|
2537
|
+
if (props.role !== "button" || !isString(props.href) || props.href.length === 0) {
|
|
2538
|
+
return [];
|
|
2539
|
+
}
|
|
2540
|
+
const diagnostic = AnchorAccessibilityDiagnostics.roleButtonWithHref();
|
|
2541
|
+
return [invalidWithoutFix({ severity: diagnostic.severity, attribute: "role", diagnostic })];
|
|
2542
|
+
},
|
|
2543
|
+
{ readsProps: ["role", "href"], tags: ["a"] }
|
|
2544
|
+
);
|
|
2545
|
+
var ariaDisabledInertRule = Object.assign(
|
|
2546
|
+
({ props }) => {
|
|
2547
|
+
const ariaDisabled = props["aria-disabled"];
|
|
2548
|
+
const isDisabled = ariaDisabled === true || ariaDisabled === "true";
|
|
2549
|
+
const hasHref = isString(props.href) && props.href.length > 0;
|
|
2550
|
+
if (!isDisabled || !hasHref) return [];
|
|
2551
|
+
const diagnostic = AnchorAccessibilityDiagnostics.ariaDisabledInert();
|
|
2552
|
+
return [
|
|
2553
|
+
invalidWithoutFix({ severity: diagnostic.severity, attribute: "aria-disabled", diagnostic })
|
|
2554
|
+
];
|
|
2555
|
+
},
|
|
2556
|
+
{ readsProps: ["aria-disabled", "href"], tags: ["a"] }
|
|
2557
|
+
);
|
|
2558
|
+
var ANCHOR_RULES = [
|
|
2559
|
+
dangerousHrefRule,
|
|
2560
|
+
roleButtonWithHrefRule,
|
|
2561
|
+
ariaDisabledInertRule
|
|
2562
|
+
];
|
|
2563
|
+
|
|
2410
2564
|
// ../core/src/html/spec/vocabulary/input.ts
|
|
2411
2565
|
var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
|
|
2412
2566
|
var NUMERIC_INPUT_TYPES = [
|
|
@@ -2486,12 +2640,12 @@ function createInputAttributeTypeRule({
|
|
|
2486
2640
|
// ../core/src/html/spec/validators/mutually-exclusive-validator.ts
|
|
2487
2641
|
function createMutuallyExclusiveRule({
|
|
2488
2642
|
props: conflictingProps,
|
|
2489
|
-
diagnostic:
|
|
2643
|
+
diagnostic: createDiagnostic2
|
|
2490
2644
|
}) {
|
|
2491
2645
|
const [first, second] = conflictingProps;
|
|
2492
2646
|
const rule = ({ tag, props }) => {
|
|
2493
2647
|
if (tag !== "input" || !props[first] || !props[second]) return [];
|
|
2494
|
-
const diagnostic =
|
|
2648
|
+
const diagnostic = createDiagnostic2();
|
|
2495
2649
|
return [{ valid: false, fixable: false, severity: diagnostic.severity, diagnostic }];
|
|
2496
2650
|
};
|
|
2497
2651
|
return Object.assign(rule, { readsProps: conflictingProps, tags: ["input"] });
|
|
@@ -2871,7 +3025,8 @@ var HTML_ARIA_RULES = [
|
|
|
2871
3025
|
landmarkRoleRule,
|
|
2872
3026
|
landmarkAccessibleNameRule,
|
|
2873
3027
|
roleNotPermittedRule,
|
|
2874
|
-
...INPUT_RULES
|
|
3028
|
+
...INPUT_RULES,
|
|
3029
|
+
...ANCHOR_RULES
|
|
2875
3030
|
];
|
|
2876
3031
|
|
|
2877
3032
|
// ../core/src/html/contracts/helpers.ts
|
|
@@ -3281,19 +3436,6 @@ function createClassPipeline(resolved) {
|
|
|
3281
3436
|
};
|
|
3282
3437
|
}
|
|
3283
3438
|
|
|
3284
|
-
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3285
|
-
function definePipeline(factory) {
|
|
3286
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
3287
|
-
return (resolved) => {
|
|
3288
|
-
let pipeline = cache.get(resolved);
|
|
3289
|
-
if (!pipeline) {
|
|
3290
|
-
pipeline = factory(resolved);
|
|
3291
|
-
cache.set(resolved, pipeline);
|
|
3292
|
-
}
|
|
3293
|
-
return pipeline;
|
|
3294
|
-
};
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
3439
|
// ../core/src/options/resolve-factory-options.ts
|
|
3298
3440
|
import { resolveDiagnostics, silentDiagnostics } from "../_shared/diagnostics.js";
|
|
3299
3441
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
@@ -3397,25 +3539,66 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
|
3397
3539
|
}
|
|
3398
3540
|
}
|
|
3399
3541
|
|
|
3542
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3543
|
+
function definePipeline(factory) {
|
|
3544
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3545
|
+
return (resolved) => {
|
|
3546
|
+
let pipeline = cache.get(resolved);
|
|
3547
|
+
if (!pipeline) {
|
|
3548
|
+
pipeline = factory(resolved);
|
|
3549
|
+
cache.set(resolved, pipeline);
|
|
3550
|
+
}
|
|
3551
|
+
return pipeline;
|
|
3552
|
+
};
|
|
3553
|
+
}
|
|
3554
|
+
|
|
3555
|
+
// ../core/src/factory/pipelines/generic.ts
|
|
3556
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3557
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3558
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3559
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3560
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3561
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3562
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3563
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3564
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(
|
|
3565
|
+
createHtmlChildrenEvaluatorPipeline
|
|
3566
|
+
);
|
|
3567
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3568
|
+
|
|
3569
|
+
// ../core/src/factory/pipelines/aria.ts
|
|
3570
|
+
function resolveAriaRules(resolved) {
|
|
3571
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3572
|
+
}
|
|
3573
|
+
var createAriaPipeline = (resolved) => {
|
|
3574
|
+
const rules = resolveAriaRules(resolved);
|
|
3575
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3576
|
+
return (tag, props) => engine.validate(tag, props);
|
|
3577
|
+
};
|
|
3578
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3579
|
+
function resolveAriaPassthrough(_tag, props) {
|
|
3580
|
+
return { props };
|
|
3581
|
+
}
|
|
3582
|
+
|
|
3400
3583
|
// ../core/src/factory/plugin-invariants.ts
|
|
3401
3584
|
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
3402
3585
|
|
|
3403
3586
|
// ../core/src/factory/plugin-diagnostics.ts
|
|
3404
|
-
import { DiagnosticCategory as
|
|
3587
|
+
import { DiagnosticCategory as DiagnosticCategory7, DiagnosticCode as DiagnosticCode7 } from "../_shared/diagnostics.js";
|
|
3405
3588
|
var PluginDiagnostics = {
|
|
3406
3589
|
invalidShape(received) {
|
|
3407
|
-
const got = received
|
|
3590
|
+
const got = isNull(received) ? "null" : typeof received;
|
|
3408
3591
|
return {
|
|
3409
|
-
code:
|
|
3410
|
-
category:
|
|
3592
|
+
code: DiagnosticCode7.PluginInvalidShape,
|
|
3593
|
+
category: DiagnosticCategory7.Internal,
|
|
3411
3594
|
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
3412
3595
|
};
|
|
3413
3596
|
},
|
|
3414
3597
|
pipelineReturnType(received) {
|
|
3415
|
-
const got = received
|
|
3598
|
+
const got = isNull(received) ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
3416
3599
|
return {
|
|
3417
|
-
code:
|
|
3418
|
-
category:
|
|
3600
|
+
code: DiagnosticCode7.PluginPipelineReturnType,
|
|
3601
|
+
category: DiagnosticCategory7.Internal,
|
|
3419
3602
|
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
3420
3603
|
};
|
|
3421
3604
|
}
|
|
@@ -3423,60 +3606,41 @@ var PluginDiagnostics = {
|
|
|
3423
3606
|
|
|
3424
3607
|
// ../core/src/factory/plugin-invariants.ts
|
|
3425
3608
|
function assertPluginShape(result) {
|
|
3426
|
-
if (result
|
|
3609
|
+
if (isNull(result) || !isObject(result))
|
|
3427
3610
|
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3428
3611
|
const plugin = result;
|
|
3429
|
-
if (
|
|
3430
|
-
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3612
|
+
if (!isFunction(plugin.pipeline)) throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3431
3613
|
}
|
|
3432
3614
|
function guardPipeline(pipeline) {
|
|
3433
3615
|
if (process.env.NODE_ENV === "production") return pipeline;
|
|
3434
3616
|
return function guardedPipeline(tag, props, className, recipe) {
|
|
3435
3617
|
const result = pipeline(tag, props, className, recipe);
|
|
3436
|
-
if (
|
|
3437
|
-
throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3618
|
+
if (!isString(result)) throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3438
3619
|
return result;
|
|
3439
3620
|
};
|
|
3440
3621
|
}
|
|
3441
3622
|
|
|
3442
|
-
// ../core/src/factory/
|
|
3443
|
-
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3444
|
-
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3445
|
-
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3446
|
-
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3447
|
-
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3448
|
-
function resolveAriaRules(resolved) {
|
|
3449
|
-
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3450
|
-
}
|
|
3451
|
-
var createAriaPipeline = (resolved) => {
|
|
3452
|
-
const rules = resolveAriaRules(resolved);
|
|
3453
|
-
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3454
|
-
return (tag, props) => engine.validate(tag, props);
|
|
3455
|
-
};
|
|
3456
|
-
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3457
|
-
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3458
|
-
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3459
|
-
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
3460
|
-
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3461
|
-
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3462
|
-
function resolveAriaPassthrough(_tag, props) {
|
|
3463
|
-
return { props };
|
|
3464
|
-
}
|
|
3623
|
+
// ../core/src/factory/pipelines/styling.ts
|
|
3465
3624
|
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
3466
3625
|
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
3467
3626
|
const pluginResult = factory(resolved, diagnostics);
|
|
3468
3627
|
assertPluginShape(pluginResult);
|
|
3469
3628
|
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
3470
3629
|
}
|
|
3471
|
-
|
|
3630
|
+
|
|
3631
|
+
// ../core/src/factory/create-polymorphic.ts
|
|
3632
|
+
function eraseResolvedShape(resolved) {
|
|
3633
|
+
return resolved;
|
|
3634
|
+
}
|
|
3635
|
+
function createPolymorphic(options = {}) {
|
|
3472
3636
|
const baseResolved = resolveFactoryOptions(options);
|
|
3473
|
-
const anyBaseResolved = baseResolved;
|
|
3637
|
+
const anyBaseResolved = eraseResolvedShape(baseResolved);
|
|
3474
3638
|
const resolved = Object.freeze({
|
|
3475
3639
|
...baseResolved,
|
|
3476
3640
|
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
3477
3641
|
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
3478
3642
|
});
|
|
3479
|
-
const anyResolved = resolved;
|
|
3643
|
+
const anyResolved = eraseResolvedShape(resolved);
|
|
3480
3644
|
if (process.env.NODE_ENV !== "production") {
|
|
3481
3645
|
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
3482
3646
|
}
|
|
@@ -3517,7 +3681,7 @@ function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
|
3517
3681
|
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
3518
3682
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
3519
3683
|
function buildCoreRuntime(normalized) {
|
|
3520
|
-
const runtime =
|
|
3684
|
+
const runtime = createPolymorphic(normalized);
|
|
3521
3685
|
const ownedKeys = "classPlugin" in runtime ? runtime.classPlugin.ownedKeys ?? EMPTY_SET : EMPTY_SET;
|
|
3522
3686
|
return { runtime, ownedKeys };
|
|
3523
3687
|
}
|