praxis-kit 7.5.0 → 7.8.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/_shared/diagnostics.d.ts +3 -0
- package/dist/_shared/diagnostics.js +3 -0
- package/dist/{chunk-SMHJEFNE.js → chunk-CCWOPNX2.js} +335 -163
- 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 +323 -149
- package/dist/preact/index.d.ts +90 -5
- package/dist/preact/index.js +335 -161
- 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 +337 -163
- package/dist/svelte/Polymorphic.svelte +12 -2
- package/dist/svelte/index.d.ts +197 -11
- package/dist/svelte/index.js +337 -160
- 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 +339 -161
- package/dist/web/index.d.ts +3 -3
- package/dist/web/index.js +323 -149
- package/package.json +9 -9
package/dist/lit/index.js
CHANGED
|
@@ -33,6 +33,9 @@ function dynamic(resolve) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
36
|
+
function isDefined(value) {
|
|
37
|
+
return value !== void 0;
|
|
38
|
+
}
|
|
36
39
|
function isUndefined(value) {
|
|
37
40
|
return value === void 0;
|
|
38
41
|
}
|
|
@@ -667,21 +670,65 @@ function getImplicitRole(tag, props) {
|
|
|
667
670
|
return void 0;
|
|
668
671
|
}
|
|
669
672
|
|
|
670
|
-
// ../../lib/contract/src/diagnostics/
|
|
673
|
+
// ../../lib/contract/src/diagnostics/anchor-accessibility.ts
|
|
671
674
|
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
675
|
+
function createDiagnostic(input) {
|
|
676
|
+
return { category: DiagnosticCategory.Accessibility, ...input };
|
|
677
|
+
}
|
|
678
|
+
var AnchorAccessibilityDiagnostics = {
|
|
679
|
+
roleButtonWithHref() {
|
|
680
|
+
return createDiagnostic({
|
|
681
|
+
code: DiagnosticCode.A11yAnchorRoleButtonWithHref,
|
|
682
|
+
severity: "warning",
|
|
683
|
+
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.',
|
|
684
|
+
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.',
|
|
685
|
+
suggestions: [
|
|
686
|
+
{
|
|
687
|
+
title: "Use a real <button>",
|
|
688
|
+
description: "If this element should not navigate, render a <button> instead of an <a>."
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
title: 'Remove role="button"',
|
|
692
|
+
description: "If this element should navigate, keep the default link role."
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
});
|
|
696
|
+
},
|
|
697
|
+
ariaDisabledInert() {
|
|
698
|
+
return createDiagnostic({
|
|
699
|
+
code: DiagnosticCode.A11yAnchorAriaDisabledInert,
|
|
700
|
+
severity: "warning",
|
|
701
|
+
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.",
|
|
702
|
+
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.",
|
|
703
|
+
suggestions: [
|
|
704
|
+
{
|
|
705
|
+
title: "Remove href",
|
|
706
|
+
description: "If this element is temporarily unavailable, remove href until it can be activated."
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
title: "Prevent navigation when disabled",
|
|
710
|
+
description: "Prevent the click and keyboard activation when the link is disabled so it behaves consistently for all users."
|
|
711
|
+
}
|
|
712
|
+
]
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
// ../../lib/contract/src/diagnostics/aria.ts
|
|
718
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
672
719
|
var AriaDiagnostics = {
|
|
673
720
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
674
721
|
fromViolation(v) {
|
|
675
722
|
return {
|
|
676
|
-
code:
|
|
677
|
-
category:
|
|
723
|
+
code: DiagnosticCode2.AriaViolation,
|
|
724
|
+
category: DiagnosticCategory2.ARIA,
|
|
678
725
|
message: v.message
|
|
679
726
|
};
|
|
680
727
|
},
|
|
681
728
|
attributeInvalid(key, role) {
|
|
682
729
|
return {
|
|
683
|
-
code:
|
|
684
|
-
category:
|
|
730
|
+
code: DiagnosticCode2.AriaAttributeInvalid,
|
|
731
|
+
category: DiagnosticCategory2.ARIA,
|
|
685
732
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
686
733
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
687
734
|
suggestions: [
|
|
@@ -694,8 +741,8 @@ var AriaDiagnostics = {
|
|
|
694
741
|
},
|
|
695
742
|
missingLiveRegion(role, impliedLive) {
|
|
696
743
|
return {
|
|
697
|
-
code:
|
|
698
|
-
category:
|
|
744
|
+
code: DiagnosticCode2.AriaMissingLiveRegion,
|
|
745
|
+
category: DiagnosticCategory2.ARIA,
|
|
699
746
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
700
747
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
701
748
|
suggestions: [
|
|
@@ -709,8 +756,8 @@ var AriaDiagnostics = {
|
|
|
709
756
|
},
|
|
710
757
|
missingAtomic(role) {
|
|
711
758
|
return {
|
|
712
|
-
code:
|
|
713
|
-
category:
|
|
759
|
+
code: DiagnosticCode2.AriaMissingAtomic,
|
|
760
|
+
category: DiagnosticCategory2.ARIA,
|
|
714
761
|
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.`,
|
|
715
762
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
716
763
|
};
|
|
@@ -718,8 +765,8 @@ var AriaDiagnostics = {
|
|
|
718
765
|
relevantInvalidTokens(invalid) {
|
|
719
766
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
720
767
|
return {
|
|
721
|
-
code:
|
|
722
|
-
category:
|
|
768
|
+
code: DiagnosticCode2.AriaRelevantInvalidToken,
|
|
769
|
+
category: DiagnosticCategory2.ARIA,
|
|
723
770
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
724
771
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
725
772
|
suggestions: [
|
|
@@ -732,8 +779,8 @@ var AriaDiagnostics = {
|
|
|
732
779
|
},
|
|
733
780
|
relevantSuperseded() {
|
|
734
781
|
return {
|
|
735
|
-
code:
|
|
736
|
-
category:
|
|
782
|
+
code: DiagnosticCode2.AriaRelevantSuperseded,
|
|
783
|
+
category: DiagnosticCategory2.ARIA,
|
|
737
784
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
738
785
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
739
786
|
suggestions: [
|
|
@@ -746,8 +793,8 @@ var AriaDiagnostics = {
|
|
|
746
793
|
},
|
|
747
794
|
missingAccessibleName(tag) {
|
|
748
795
|
return {
|
|
749
|
-
code:
|
|
750
|
-
category:
|
|
796
|
+
code: DiagnosticCode2.AriaMissingAccessibleName,
|
|
797
|
+
category: DiagnosticCategory2.ARIA,
|
|
751
798
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
752
799
|
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.",
|
|
753
800
|
suggestions: [
|
|
@@ -764,8 +811,8 @@ var AriaDiagnostics = {
|
|
|
764
811
|
},
|
|
765
812
|
attributeOnPresentational(attr, tag) {
|
|
766
813
|
return {
|
|
767
|
-
code:
|
|
768
|
-
category:
|
|
814
|
+
code: DiagnosticCode2.AriaAttributeOnPresentational,
|
|
815
|
+
category: DiagnosticCategory2.ARIA,
|
|
769
816
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
770
817
|
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.',
|
|
771
818
|
suggestions: [
|
|
@@ -778,8 +825,8 @@ var AriaDiagnostics = {
|
|
|
778
825
|
},
|
|
779
826
|
ariaHiddenOnFocusable(tag) {
|
|
780
827
|
return {
|
|
781
|
-
code:
|
|
782
|
-
category:
|
|
828
|
+
code: DiagnosticCode2.AriaHiddenOnFocusable,
|
|
829
|
+
category: DiagnosticCategory2.ARIA,
|
|
783
830
|
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.`,
|
|
784
831
|
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.',
|
|
785
832
|
suggestions: [
|
|
@@ -797,8 +844,8 @@ var AriaDiagnostics = {
|
|
|
797
844
|
invalidAttributeValue(attr, value, expected) {
|
|
798
845
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
799
846
|
return {
|
|
800
|
-
code:
|
|
801
|
-
category:
|
|
847
|
+
code: DiagnosticCode2.AriaInvalidAttributeValue,
|
|
848
|
+
category: DiagnosticCategory2.ARIA,
|
|
802
849
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
803
850
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
804
851
|
suggestions: [
|
|
@@ -811,8 +858,8 @@ var AriaDiagnostics = {
|
|
|
811
858
|
},
|
|
812
859
|
redundantAriaLevel(tag, level) {
|
|
813
860
|
return {
|
|
814
|
-
code:
|
|
815
|
-
category:
|
|
861
|
+
code: DiagnosticCode2.AriaRedundantLevelAttribute,
|
|
862
|
+
category: DiagnosticCategory2.ARIA,
|
|
816
863
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
817
864
|
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>).',
|
|
818
865
|
suggestions: [
|
|
@@ -825,8 +872,8 @@ var AriaDiagnostics = {
|
|
|
825
872
|
},
|
|
826
873
|
requiredProperty(attr, role) {
|
|
827
874
|
return {
|
|
828
|
-
code:
|
|
829
|
-
category:
|
|
875
|
+
code: DiagnosticCode2.AriaRequiredProperty,
|
|
876
|
+
category: DiagnosticCategory2.ARIA,
|
|
830
877
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
831
878
|
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.`,
|
|
832
879
|
suggestions: [
|
|
@@ -839,8 +886,8 @@ var AriaDiagnostics = {
|
|
|
839
886
|
},
|
|
840
887
|
invalidRole(role, tag) {
|
|
841
888
|
return {
|
|
842
|
-
code:
|
|
843
|
-
category:
|
|
889
|
+
code: DiagnosticCode2.AriaInvalidRole,
|
|
890
|
+
category: DiagnosticCategory2.ARIA,
|
|
844
891
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
845
892
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
846
893
|
};
|
|
@@ -848,12 +895,12 @@ var AriaDiagnostics = {
|
|
|
848
895
|
};
|
|
849
896
|
|
|
850
897
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
851
|
-
import { DiagnosticCategory as
|
|
898
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
852
899
|
var ContractDiagnostics = {
|
|
853
900
|
unexpectedChild(typeName, index, context) {
|
|
854
901
|
return {
|
|
855
|
-
code:
|
|
856
|
-
category:
|
|
902
|
+
code: DiagnosticCode3.UnexpectedChild,
|
|
903
|
+
category: DiagnosticCategory3.Contract,
|
|
857
904
|
component: context,
|
|
858
905
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
859
906
|
};
|
|
@@ -861,69 +908,69 @@ var ContractDiagnostics = {
|
|
|
861
908
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
862
909
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
863
910
|
return {
|
|
864
|
-
code:
|
|
865
|
-
category:
|
|
911
|
+
code: DiagnosticCode3.AmbiguousChild,
|
|
912
|
+
category: DiagnosticCategory3.Contract,
|
|
866
913
|
component: context,
|
|
867
914
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
868
915
|
};
|
|
869
916
|
},
|
|
870
917
|
cardinalityMin(ruleName, min, context) {
|
|
871
918
|
return {
|
|
872
|
-
code:
|
|
873
|
-
category:
|
|
919
|
+
code: DiagnosticCode3.CardinalityMin,
|
|
920
|
+
category: DiagnosticCategory3.Contract,
|
|
874
921
|
component: context,
|
|
875
922
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
876
923
|
};
|
|
877
924
|
},
|
|
878
925
|
cardinalityMax(ruleName, max, context) {
|
|
879
926
|
return {
|
|
880
|
-
code:
|
|
881
|
-
category:
|
|
927
|
+
code: DiagnosticCode3.CardinalityMax,
|
|
928
|
+
category: DiagnosticCategory3.Contract,
|
|
882
929
|
component: context,
|
|
883
930
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
884
931
|
};
|
|
885
932
|
},
|
|
886
933
|
positionViolation(ruleName, position, index, context) {
|
|
887
934
|
return {
|
|
888
|
-
code:
|
|
889
|
-
category:
|
|
935
|
+
code: DiagnosticCode3.PositionViolation,
|
|
936
|
+
category: DiagnosticCategory3.Contract,
|
|
890
937
|
component: context,
|
|
891
938
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
892
939
|
};
|
|
893
940
|
},
|
|
894
941
|
unknownVariantDim(component, label2, dim) {
|
|
895
942
|
return {
|
|
896
|
-
code:
|
|
897
|
-
category:
|
|
943
|
+
code: DiagnosticCode3.ContractUnknownVariantDim,
|
|
944
|
+
category: DiagnosticCategory3.Contract,
|
|
898
945
|
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
899
946
|
};
|
|
900
947
|
},
|
|
901
948
|
unknownVariantValue(component, label2, dim, value, valid) {
|
|
902
949
|
return {
|
|
903
|
-
code:
|
|
904
|
-
category:
|
|
950
|
+
code: DiagnosticCode3.ContractUnknownVariantValue,
|
|
951
|
+
category: DiagnosticCategory3.Contract,
|
|
905
952
|
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
906
953
|
};
|
|
907
954
|
},
|
|
908
955
|
unknownRecipeKey(component, key) {
|
|
909
956
|
return {
|
|
910
|
-
code:
|
|
911
|
-
category:
|
|
957
|
+
code: DiagnosticCode3.ContractUnknownRecipeKey,
|
|
958
|
+
category: DiagnosticCategory3.Contract,
|
|
912
959
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
913
960
|
};
|
|
914
961
|
},
|
|
915
962
|
invalidVariantValue(component, key, value) {
|
|
916
963
|
return {
|
|
917
|
-
code:
|
|
918
|
-
category:
|
|
964
|
+
code: DiagnosticCode3.ContractInvalidVariantValue,
|
|
965
|
+
category: DiagnosticCategory3.Contract,
|
|
919
966
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
920
967
|
};
|
|
921
968
|
},
|
|
922
969
|
allowedAsViolation(tag, allowedAs, component) {
|
|
923
970
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
924
971
|
return {
|
|
925
|
-
code:
|
|
926
|
-
category:
|
|
972
|
+
code: DiagnosticCode3.AllowedAsViolation,
|
|
973
|
+
category: DiagnosticCategory3.Contract,
|
|
927
974
|
component,
|
|
928
975
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
929
976
|
};
|
|
@@ -931,68 +978,68 @@ var ContractDiagnostics = {
|
|
|
931
978
|
};
|
|
932
979
|
|
|
933
980
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
934
|
-
import { DiagnosticCategory as
|
|
981
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
935
982
|
var ATTRIBUTE_IGNORED_CODES = {
|
|
936
|
-
checked:
|
|
937
|
-
multiple:
|
|
938
|
-
maxLength:
|
|
939
|
-
minLength:
|
|
940
|
-
pattern:
|
|
941
|
-
min:
|
|
942
|
-
max:
|
|
943
|
-
step:
|
|
944
|
-
accept:
|
|
945
|
-
capture:
|
|
946
|
-
size:
|
|
947
|
-
alt:
|
|
948
|
-
height:
|
|
949
|
-
width:
|
|
983
|
+
checked: DiagnosticCode4.HtmlInputCheckedIgnoredForType,
|
|
984
|
+
multiple: DiagnosticCode4.HtmlInputMultipleIgnoredForType,
|
|
985
|
+
maxLength: DiagnosticCode4.HtmlInputMaxLengthIgnoredForType,
|
|
986
|
+
minLength: DiagnosticCode4.HtmlInputMinLengthIgnoredForType,
|
|
987
|
+
pattern: DiagnosticCode4.HtmlInputPatternIgnoredForType,
|
|
988
|
+
min: DiagnosticCode4.HtmlInputMinIgnoredForType,
|
|
989
|
+
max: DiagnosticCode4.HtmlInputMaxIgnoredForType,
|
|
990
|
+
step: DiagnosticCode4.HtmlInputStepIgnoredForType,
|
|
991
|
+
accept: DiagnosticCode4.HtmlInputAcceptIgnoredForType,
|
|
992
|
+
capture: DiagnosticCode4.HtmlInputCaptureIgnoredForType,
|
|
993
|
+
size: DiagnosticCode4.HtmlInputSizeIgnoredForType,
|
|
994
|
+
alt: DiagnosticCode4.HtmlInputAltIgnoredForType,
|
|
995
|
+
height: DiagnosticCode4.HtmlInputHeightIgnoredForType,
|
|
996
|
+
width: DiagnosticCode4.HtmlInputWidthIgnoredForType
|
|
950
997
|
};
|
|
951
998
|
var HtmlDiagnostics = {
|
|
952
999
|
emptyRole(tag) {
|
|
953
1000
|
return {
|
|
954
|
-
code:
|
|
955
|
-
category:
|
|
1001
|
+
code: DiagnosticCode4.HtmlEmptyRole,
|
|
1002
|
+
category: DiagnosticCategory4.HTML,
|
|
956
1003
|
severity: "warning",
|
|
957
1004
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
958
1005
|
};
|
|
959
1006
|
},
|
|
960
1007
|
implicitRoleRedundant(tag, implicitRole) {
|
|
961
1008
|
return {
|
|
962
|
-
code:
|
|
963
|
-
category:
|
|
1009
|
+
code: DiagnosticCode4.HtmlImplicitRoleRedundant,
|
|
1010
|
+
category: DiagnosticCategory4.HTML,
|
|
964
1011
|
severity: "warning",
|
|
965
1012
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
966
1013
|
};
|
|
967
1014
|
},
|
|
968
1015
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
969
1016
|
return {
|
|
970
|
-
code:
|
|
971
|
-
category:
|
|
1017
|
+
code: DiagnosticCode4.HtmlImplicitRoleOverride,
|
|
1018
|
+
category: DiagnosticCategory4.HTML,
|
|
972
1019
|
severity: "error",
|
|
973
1020
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
974
1021
|
};
|
|
975
1022
|
},
|
|
976
1023
|
standaloneRegionOverride(tag, implicitRole) {
|
|
977
1024
|
return {
|
|
978
|
-
code:
|
|
979
|
-
category:
|
|
1025
|
+
code: DiagnosticCode4.HtmlStandaloneRegionOverride,
|
|
1026
|
+
category: DiagnosticCategory4.HTML,
|
|
980
1027
|
severity: "error",
|
|
981
1028
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
982
1029
|
};
|
|
983
1030
|
},
|
|
984
1031
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
985
1032
|
return {
|
|
986
|
-
code:
|
|
987
|
-
category:
|
|
1033
|
+
code: DiagnosticCode4.HtmlLandmarkRoleOverride,
|
|
1034
|
+
category: DiagnosticCategory4.HTML,
|
|
988
1035
|
severity: "error",
|
|
989
1036
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
990
1037
|
};
|
|
991
1038
|
},
|
|
992
1039
|
invalidChild(child, parent, allowed) {
|
|
993
1040
|
return {
|
|
994
|
-
code:
|
|
995
|
-
category:
|
|
1041
|
+
code: DiagnosticCode4.HtmlInvalidChild,
|
|
1042
|
+
category: DiagnosticCategory4.HTML,
|
|
996
1043
|
severity: "error",
|
|
997
1044
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
998
1045
|
};
|
|
@@ -1000,8 +1047,8 @@ var HtmlDiagnostics = {
|
|
|
1000
1047
|
roleNotPermitted(tag, role, allowedRoles) {
|
|
1001
1048
|
const allowed = allowedRoles.length > 0 ? allowedRoles.map((r) => `"${r}"`).join(", ") : "none \u2014 no explicit role is permitted on this element";
|
|
1002
1049
|
return {
|
|
1003
|
-
code:
|
|
1004
|
-
category:
|
|
1050
|
+
code: DiagnosticCode4.HtmlRoleNotPermitted,
|
|
1051
|
+
category: DiagnosticCategory4.HTML,
|
|
1005
1052
|
severity: "error",
|
|
1006
1053
|
message: `role="${role}" is not permitted on <${tag}>. Allowed alternate role(s): ${allowed}.`,
|
|
1007
1054
|
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.'
|
|
@@ -1012,8 +1059,8 @@ var HtmlDiagnostics = {
|
|
|
1012
1059
|
input: {
|
|
1013
1060
|
unsupportedType(type) {
|
|
1014
1061
|
return {
|
|
1015
|
-
code:
|
|
1016
|
-
category:
|
|
1062
|
+
code: DiagnosticCode4.HtmlInputUnsupportedType,
|
|
1063
|
+
category: DiagnosticCategory4.HTML,
|
|
1017
1064
|
severity: "warning",
|
|
1018
1065
|
message: `type="${type}" is not a value defined by the HTML specification. Browsers silently fall back to type="text".`,
|
|
1019
1066
|
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).',
|
|
@@ -1033,7 +1080,7 @@ var HtmlDiagnostics = {
|
|
|
1033
1080
|
if (!code) throw new Error(`No DiagnosticCode registered for input attribute "${attribute}"`);
|
|
1034
1081
|
return {
|
|
1035
1082
|
code,
|
|
1036
|
-
category:
|
|
1083
|
+
category: DiagnosticCategory4.HTML,
|
|
1037
1084
|
severity: "warning",
|
|
1038
1085
|
message: `"${attribute}" is ignored on <input type="${type}">.`,
|
|
1039
1086
|
rationale: `"${attribute}" only has an effect when type is one of: ${allowed}. Browsers silently ignore it on other input types.`,
|
|
@@ -1045,18 +1092,30 @@ var HtmlDiagnostics = {
|
|
|
1045
1092
|
]
|
|
1046
1093
|
};
|
|
1047
1094
|
}
|
|
1095
|
+
},
|
|
1096
|
+
// Reserved for <a>-specific facts (HTML3201–3299, see codes.ts).
|
|
1097
|
+
anchor: {
|
|
1098
|
+
dangerousHref(href) {
|
|
1099
|
+
return {
|
|
1100
|
+
code: DiagnosticCode4.HtmlAnchorDangerousHref,
|
|
1101
|
+
category: DiagnosticCategory4.HTML,
|
|
1102
|
+
severity: "warning",
|
|
1103
|
+
message: `href="${href}" uses a scheme that executes attacker-controlled content when navigated to. It has been removed.`,
|
|
1104
|
+
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.'
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1048
1107
|
}
|
|
1049
1108
|
};
|
|
1050
1109
|
|
|
1051
1110
|
// ../../lib/contract/src/diagnostics/input-accessibility.ts
|
|
1052
|
-
import { DiagnosticCategory as
|
|
1111
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
|
|
1053
1112
|
function accessibilityFact(input) {
|
|
1054
|
-
return { category:
|
|
1113
|
+
return { category: DiagnosticCategory5.Accessibility, ...input };
|
|
1055
1114
|
}
|
|
1056
1115
|
var InputAccessibilityDiagnostics = {
|
|
1057
1116
|
missingAccessibleName() {
|
|
1058
1117
|
return accessibilityFact({
|
|
1059
|
-
code:
|
|
1118
|
+
code: DiagnosticCode5.A11yInputMissingAccessibleName,
|
|
1060
1119
|
severity: "warning",
|
|
1061
1120
|
message: "This input has no accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1062
1121
|
rationale: "Assistive technology announces a form field by its accessible name; without one, users of screen readers cannot tell what the field is for.",
|
|
@@ -1071,7 +1130,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1071
1130
|
},
|
|
1072
1131
|
placeholderIsNotLabel() {
|
|
1073
1132
|
return accessibilityFact({
|
|
1074
|
-
code:
|
|
1133
|
+
code: DiagnosticCode5.A11yInputPlaceholderNotLabel,
|
|
1075
1134
|
severity: "warning",
|
|
1076
1135
|
message: "Placeholder text does not provide an accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1077
1136
|
rationale: "Placeholder text disappears as users interact with the field and is not treated as the control's accessible name by many assistive technologies.",
|
|
@@ -1086,7 +1145,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1086
1145
|
},
|
|
1087
1146
|
passwordMissingAutocomplete() {
|
|
1088
1147
|
return accessibilityFact({
|
|
1089
|
-
code:
|
|
1148
|
+
code: DiagnosticCode5.A11yInputPasswordAutocomplete,
|
|
1090
1149
|
severity: "warning",
|
|
1091
1150
|
message: "Password inputs should specify an autoComplete value.",
|
|
1092
1151
|
rationale: "Without an explicit autocomplete hint, password managers and browsers cannot reliably tell a sign-in field apart from a password-creation field.",
|
|
@@ -1104,7 +1163,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1104
1163
|
},
|
|
1105
1164
|
requiredReadOnlyConflict() {
|
|
1106
1165
|
return accessibilityFact({
|
|
1107
|
-
code:
|
|
1166
|
+
code: DiagnosticCode5.A11yInputRequiredReadOnlyConflict,
|
|
1108
1167
|
severity: "warning",
|
|
1109
1168
|
message: "The required and readOnly attributes are both present. A read-only field cannot satisfy required validation through user interaction.",
|
|
1110
1169
|
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."
|
|
@@ -1371,7 +1430,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1371
1430
|
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1372
1431
|
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1373
1432
|
}
|
|
1374
|
-
static #evaluateWithRules(tag, props, extraRules) {
|
|
1433
|
+
static #evaluateWithRules(tag, props, extraRules, extraProps) {
|
|
1375
1434
|
const derived = _AriaPolicyEngine.#deriveContext(tag, props);
|
|
1376
1435
|
if (!derived.proceed) return derived.result;
|
|
1377
1436
|
const {
|
|
@@ -1381,8 +1440,12 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1381
1440
|
props: workingProps,
|
|
1382
1441
|
preExistingViolations
|
|
1383
1442
|
} = derived;
|
|
1384
|
-
const
|
|
1385
|
-
const
|
|
1443
|
+
const builtinRules = derived.hasRole ? _AriaPolicyEngine.#getRules(context) : [];
|
|
1444
|
+
const builtin = _AriaPolicyEngine.#runRules(builtinRules, context);
|
|
1445
|
+
const extraContext = extraProps === void 0 ? context : { ...context, props: extraProps };
|
|
1446
|
+
const extra = _AriaPolicyEngine.#runRules(extraRules, extraContext);
|
|
1447
|
+
const violations = [...builtin.violations, ...extra.violations];
|
|
1448
|
+
const fixes = [...builtin.fixes, ...extra.fixes];
|
|
1386
1449
|
const next = _AriaPolicyEngine.#applyFixes(narrowedTag, implicitRole, workingProps, fixes);
|
|
1387
1450
|
return { props: next, violations: [...preExistingViolations, ...violations] };
|
|
1388
1451
|
}
|
|
@@ -1453,11 +1516,17 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1453
1516
|
Object.assign(next, updates);
|
|
1454
1517
|
return next;
|
|
1455
1518
|
}
|
|
1456
|
-
|
|
1519
|
+
// `extraProps`, when supplied, is the pre-variant-filter props object (the same one
|
|
1520
|
+
// `normalize()` receives) — used only as the evaluation context for this engine's own
|
|
1521
|
+
// #extraRules (a consumer's `enforcement.aria`/`enforcement.rules`), never for the built-in
|
|
1522
|
+
// role-semantic pipeline or for the props a fix can apply to. Defaults to `props` so callers
|
|
1523
|
+
// that don't have a separate pre-filter object (or don't need one) see unchanged behavior.
|
|
1524
|
+
validate(tag, props, extraProps) {
|
|
1525
|
+
const ruleProps = extraProps ?? props;
|
|
1457
1526
|
const baseKey = _AriaPolicyEngine.#createPlanKey(tag, props);
|
|
1458
1527
|
let key = baseKey;
|
|
1459
1528
|
if (this.#extraRules.length > 0) {
|
|
1460
|
-
const suffix = _AriaPolicyEngine.#extraRulesKeySuffix(this.#extraRules,
|
|
1529
|
+
const suffix = _AriaPolicyEngine.#extraRulesKeySuffix(this.#extraRules, ruleProps);
|
|
1461
1530
|
key = isNonNull(baseKey) && isNonNull(suffix) ? `${baseKey}|${suffix}` : null;
|
|
1462
1531
|
}
|
|
1463
1532
|
if (!isNull(key)) {
|
|
@@ -1470,7 +1539,7 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1470
1539
|
};
|
|
1471
1540
|
}
|
|
1472
1541
|
}
|
|
1473
|
-
const result = this.#extraRules.length ? _AriaPolicyEngine.#evaluateWithRules(tag, props, this.#extraRules) : _AriaPolicyEngine.evaluate(tag, props);
|
|
1542
|
+
const result = this.#extraRules.length ? _AriaPolicyEngine.#evaluateWithRules(tag, props, this.#extraRules, extraProps) : _AriaPolicyEngine.evaluate(tag, props);
|
|
1474
1543
|
if (result.violations.length > 0) this.report(result.violations);
|
|
1475
1544
|
if (!isNull(key)) {
|
|
1476
1545
|
const { removals, updates } = _AriaPolicyEngine.#computePlan(
|
|
@@ -1851,6 +1920,27 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1851
1920
|
};
|
|
1852
1921
|
|
|
1853
1922
|
// ../../lib/contract/src/aria/factories.ts
|
|
1923
|
+
function invalidWithoutFix(input) {
|
|
1924
|
+
return {
|
|
1925
|
+
valid: false,
|
|
1926
|
+
fixable: false,
|
|
1927
|
+
severity: input.severity,
|
|
1928
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
1929
|
+
...isDefined(input.message) && { message: input.message },
|
|
1930
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic }
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
function invalidWithFix(input) {
|
|
1934
|
+
return {
|
|
1935
|
+
valid: false,
|
|
1936
|
+
fixable: true,
|
|
1937
|
+
severity: input.severity,
|
|
1938
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
1939
|
+
...isDefined(input.message) && { message: input.message },
|
|
1940
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic },
|
|
1941
|
+
fix: input.fix
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1854
1944
|
function removeProp(props, key) {
|
|
1855
1945
|
const next = { ...props };
|
|
1856
1946
|
delete next[key];
|
|
@@ -1866,6 +1956,34 @@ function removeAttributeFix(attribute) {
|
|
|
1866
1956
|
}
|
|
1867
1957
|
});
|
|
1868
1958
|
}
|
|
1959
|
+
function defineRuleMetadata(rule, metadata2) {
|
|
1960
|
+
const descriptors = {};
|
|
1961
|
+
for (const key of Object.keys(metadata2)) {
|
|
1962
|
+
descriptors[key] = { value: metadata2[key], enumerable: false };
|
|
1963
|
+
}
|
|
1964
|
+
Object.defineProperties(rule, descriptors);
|
|
1965
|
+
return rule;
|
|
1966
|
+
}
|
|
1967
|
+
function createRemoveAttributeRule(attribute, options) {
|
|
1968
|
+
const { when, severity = "warning", message, diagnostic, readsProps, tags } = options;
|
|
1969
|
+
const fix = removeAttributeFix(attribute);
|
|
1970
|
+
const rule = (context) => {
|
|
1971
|
+
if (!when(context)) return [];
|
|
1972
|
+
return [
|
|
1973
|
+
invalidWithFix({
|
|
1974
|
+
severity,
|
|
1975
|
+
attribute,
|
|
1976
|
+
...isDefined(message) && { message },
|
|
1977
|
+
...isDefined(diagnostic) && { diagnostic: diagnostic(context) },
|
|
1978
|
+
fix
|
|
1979
|
+
})
|
|
1980
|
+
];
|
|
1981
|
+
};
|
|
1982
|
+
return defineRuleMetadata(rule, {
|
|
1983
|
+
...isDefined(readsProps) && { readsProps },
|
|
1984
|
+
...isDefined(tags) && { tags }
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1869
1987
|
|
|
1870
1988
|
// ../../lib/contract/src/children/get-type-name.ts
|
|
1871
1989
|
function getTypeName(value) {
|
|
@@ -2254,6 +2372,52 @@ var P_BLOCKED_TAGS = [
|
|
|
2254
2372
|
"ul"
|
|
2255
2373
|
];
|
|
2256
2374
|
|
|
2375
|
+
// ../core/src/html/anchor-rules.ts
|
|
2376
|
+
var DANGEROUS_URL_SCHEMES = ["javascript:", "data:", "vbscript:"];
|
|
2377
|
+
function normalizeForSchemeCheck(href) {
|
|
2378
|
+
return href.replace(/[\x00-\x20]/g, "").toLowerCase();
|
|
2379
|
+
}
|
|
2380
|
+
function isDangerousUrl(href) {
|
|
2381
|
+
if (!isString(href)) return false;
|
|
2382
|
+
const normalized = normalizeForSchemeCheck(href);
|
|
2383
|
+
return DANGEROUS_URL_SCHEMES.some((scheme) => normalized.startsWith(scheme));
|
|
2384
|
+
}
|
|
2385
|
+
var dangerousHrefRule = createRemoveAttributeRule("href", {
|
|
2386
|
+
when: ({ props }) => isDangerousUrl(props.href),
|
|
2387
|
+
severity: "warning",
|
|
2388
|
+
diagnostic: ({ props }) => HtmlDiagnostics.anchor.dangerousHref(props.href),
|
|
2389
|
+
readsProps: ["href"],
|
|
2390
|
+
tags: ["a"]
|
|
2391
|
+
});
|
|
2392
|
+
var roleButtonWithHrefRule = Object.assign(
|
|
2393
|
+
({ props }) => {
|
|
2394
|
+
if (props.role !== "button" || !isString(props.href) || props.href.length === 0) {
|
|
2395
|
+
return [];
|
|
2396
|
+
}
|
|
2397
|
+
const diagnostic = AnchorAccessibilityDiagnostics.roleButtonWithHref();
|
|
2398
|
+
return [invalidWithoutFix({ severity: diagnostic.severity, attribute: "role", diagnostic })];
|
|
2399
|
+
},
|
|
2400
|
+
{ readsProps: ["role", "href"], tags: ["a"] }
|
|
2401
|
+
);
|
|
2402
|
+
var ariaDisabledInertRule = Object.assign(
|
|
2403
|
+
({ props }) => {
|
|
2404
|
+
const ariaDisabled = props["aria-disabled"];
|
|
2405
|
+
const isDisabled = ariaDisabled === true || ariaDisabled === "true";
|
|
2406
|
+
const hasHref = isString(props.href) && props.href.length > 0;
|
|
2407
|
+
if (!isDisabled || !hasHref) return [];
|
|
2408
|
+
const diagnostic = AnchorAccessibilityDiagnostics.ariaDisabledInert();
|
|
2409
|
+
return [
|
|
2410
|
+
invalidWithoutFix({ severity: diagnostic.severity, attribute: "aria-disabled", diagnostic })
|
|
2411
|
+
];
|
|
2412
|
+
},
|
|
2413
|
+
{ readsProps: ["aria-disabled", "href"], tags: ["a"] }
|
|
2414
|
+
);
|
|
2415
|
+
var ANCHOR_RULES = [
|
|
2416
|
+
dangerousHrefRule,
|
|
2417
|
+
roleButtonWithHrefRule,
|
|
2418
|
+
ariaDisabledInertRule
|
|
2419
|
+
];
|
|
2420
|
+
|
|
2257
2421
|
// ../core/src/html/spec/vocabulary/input.ts
|
|
2258
2422
|
var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
|
|
2259
2423
|
var NUMERIC_INPUT_TYPES = [
|
|
@@ -2333,12 +2497,12 @@ function createInputAttributeTypeRule({
|
|
|
2333
2497
|
// ../core/src/html/spec/validators/mutually-exclusive-validator.ts
|
|
2334
2498
|
function createMutuallyExclusiveRule({
|
|
2335
2499
|
props: conflictingProps,
|
|
2336
|
-
diagnostic:
|
|
2500
|
+
diagnostic: createDiagnostic2
|
|
2337
2501
|
}) {
|
|
2338
2502
|
const [first, second] = conflictingProps;
|
|
2339
2503
|
const rule = ({ tag, props }) => {
|
|
2340
2504
|
if (tag !== "input" || !props[first] || !props[second]) return [];
|
|
2341
|
-
const diagnostic =
|
|
2505
|
+
const diagnostic = createDiagnostic2();
|
|
2342
2506
|
return [{ valid: false, fixable: false, severity: diagnostic.severity, diagnostic }];
|
|
2343
2507
|
};
|
|
2344
2508
|
return Object.assign(rule, { readsProps: conflictingProps, tags: ["input"] });
|
|
@@ -2718,7 +2882,8 @@ var HTML_ARIA_RULES = [
|
|
|
2718
2882
|
landmarkRoleRule,
|
|
2719
2883
|
landmarkAccessibleNameRule,
|
|
2720
2884
|
roleNotPermittedRule,
|
|
2721
|
-
...INPUT_RULES
|
|
2885
|
+
...INPUT_RULES,
|
|
2886
|
+
...ANCHOR_RULES
|
|
2722
2887
|
];
|
|
2723
2888
|
|
|
2724
2889
|
// ../core/src/html/contracts/helpers.ts
|
|
@@ -3128,19 +3293,6 @@ function createClassPipeline(resolved) {
|
|
|
3128
3293
|
};
|
|
3129
3294
|
}
|
|
3130
3295
|
|
|
3131
|
-
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3132
|
-
function definePipeline(factory) {
|
|
3133
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
3134
|
-
return (resolved) => {
|
|
3135
|
-
let pipeline = cache.get(resolved);
|
|
3136
|
-
if (!pipeline) {
|
|
3137
|
-
pipeline = factory(resolved);
|
|
3138
|
-
cache.set(resolved, pipeline);
|
|
3139
|
-
}
|
|
3140
|
-
return pipeline;
|
|
3141
|
-
};
|
|
3142
|
-
}
|
|
3143
|
-
|
|
3144
3296
|
// ../core/src/options/resolve-factory-options.ts
|
|
3145
3297
|
import { resolveDiagnostics, silentDiagnostics } from "../_shared/diagnostics.js";
|
|
3146
3298
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
@@ -3244,25 +3396,66 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
|
3244
3396
|
}
|
|
3245
3397
|
}
|
|
3246
3398
|
|
|
3399
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3400
|
+
function definePipeline(factory) {
|
|
3401
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3402
|
+
return (resolved) => {
|
|
3403
|
+
let pipeline = cache.get(resolved);
|
|
3404
|
+
if (!pipeline) {
|
|
3405
|
+
pipeline = factory(resolved);
|
|
3406
|
+
cache.set(resolved, pipeline);
|
|
3407
|
+
}
|
|
3408
|
+
return pipeline;
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
// ../core/src/factory/pipelines/generic.ts
|
|
3413
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3414
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3415
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3416
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3417
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3418
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3419
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3420
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3421
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(
|
|
3422
|
+
createHtmlChildrenEvaluatorPipeline
|
|
3423
|
+
);
|
|
3424
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3425
|
+
|
|
3426
|
+
// ../core/src/factory/pipelines/aria.ts
|
|
3427
|
+
function resolveAriaRules(resolved) {
|
|
3428
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3429
|
+
}
|
|
3430
|
+
var createAriaPipeline = (resolved) => {
|
|
3431
|
+
const rules = resolveAriaRules(resolved);
|
|
3432
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3433
|
+
return (tag, props, extraProps) => engine.validate(tag, props, extraProps);
|
|
3434
|
+
};
|
|
3435
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3436
|
+
function resolveAriaPassthrough(_tag, props, _extraProps) {
|
|
3437
|
+
return { props };
|
|
3438
|
+
}
|
|
3439
|
+
|
|
3247
3440
|
// ../core/src/factory/plugin-invariants.ts
|
|
3248
3441
|
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
3249
3442
|
|
|
3250
3443
|
// ../core/src/factory/plugin-diagnostics.ts
|
|
3251
|
-
import { DiagnosticCategory as
|
|
3444
|
+
import { DiagnosticCategory as DiagnosticCategory6, DiagnosticCode as DiagnosticCode6 } from "../_shared/diagnostics.js";
|
|
3252
3445
|
var PluginDiagnostics = {
|
|
3253
3446
|
invalidShape(received) {
|
|
3254
|
-
const got = received
|
|
3447
|
+
const got = isNull(received) ? "null" : typeof received;
|
|
3255
3448
|
return {
|
|
3256
|
-
code:
|
|
3257
|
-
category:
|
|
3449
|
+
code: DiagnosticCode6.PluginInvalidShape,
|
|
3450
|
+
category: DiagnosticCategory6.Internal,
|
|
3258
3451
|
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
3259
3452
|
};
|
|
3260
3453
|
},
|
|
3261
3454
|
pipelineReturnType(received) {
|
|
3262
|
-
const got = received
|
|
3455
|
+
const got = isNull(received) ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
3263
3456
|
return {
|
|
3264
|
-
code:
|
|
3265
|
-
category:
|
|
3457
|
+
code: DiagnosticCode6.PluginPipelineReturnType,
|
|
3458
|
+
category: DiagnosticCategory6.Internal,
|
|
3266
3459
|
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
3267
3460
|
};
|
|
3268
3461
|
}
|
|
@@ -3270,60 +3463,41 @@ var PluginDiagnostics = {
|
|
|
3270
3463
|
|
|
3271
3464
|
// ../core/src/factory/plugin-invariants.ts
|
|
3272
3465
|
function assertPluginShape(result) {
|
|
3273
|
-
if (result
|
|
3466
|
+
if (isNull(result) || !isObject(result))
|
|
3274
3467
|
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3275
3468
|
const plugin = result;
|
|
3276
|
-
if (
|
|
3277
|
-
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3469
|
+
if (!isFunction(plugin.pipeline)) throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3278
3470
|
}
|
|
3279
3471
|
function guardPipeline(pipeline) {
|
|
3280
3472
|
if (process.env.NODE_ENV === "production") return pipeline;
|
|
3281
3473
|
return function guardedPipeline(tag, props, className, recipe) {
|
|
3282
3474
|
const result = pipeline(tag, props, className, recipe);
|
|
3283
|
-
if (
|
|
3284
|
-
throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3475
|
+
if (!isString(result)) throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3285
3476
|
return result;
|
|
3286
3477
|
};
|
|
3287
3478
|
}
|
|
3288
3479
|
|
|
3289
|
-
// ../core/src/factory/
|
|
3290
|
-
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3291
|
-
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3292
|
-
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3293
|
-
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3294
|
-
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3295
|
-
function resolveAriaRules(resolved) {
|
|
3296
|
-
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3297
|
-
}
|
|
3298
|
-
var createAriaPipeline = (resolved) => {
|
|
3299
|
-
const rules = resolveAriaRules(resolved);
|
|
3300
|
-
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3301
|
-
return (tag, props) => engine.validate(tag, props);
|
|
3302
|
-
};
|
|
3303
|
-
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3304
|
-
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3305
|
-
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3306
|
-
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
3307
|
-
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3308
|
-
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3309
|
-
function resolveAriaPassthrough(_tag, props) {
|
|
3310
|
-
return { props };
|
|
3311
|
-
}
|
|
3480
|
+
// ../core/src/factory/pipelines/styling.ts
|
|
3312
3481
|
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
3313
3482
|
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
3314
3483
|
const pluginResult = factory(resolved, diagnostics);
|
|
3315
3484
|
assertPluginShape(pluginResult);
|
|
3316
3485
|
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
3317
3486
|
}
|
|
3318
|
-
|
|
3487
|
+
|
|
3488
|
+
// ../core/src/factory/create-polymorphic.ts
|
|
3489
|
+
function eraseResolvedShape(resolved) {
|
|
3490
|
+
return resolved;
|
|
3491
|
+
}
|
|
3492
|
+
function createPolymorphic(options = {}) {
|
|
3319
3493
|
const baseResolved = resolveFactoryOptions(options);
|
|
3320
|
-
const anyBaseResolved = baseResolved;
|
|
3494
|
+
const anyBaseResolved = eraseResolvedShape(baseResolved);
|
|
3321
3495
|
const resolved = Object.freeze({
|
|
3322
3496
|
...baseResolved,
|
|
3323
3497
|
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
3324
3498
|
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
3325
3499
|
});
|
|
3326
|
-
const anyResolved = resolved;
|
|
3500
|
+
const anyResolved = eraseResolvedShape(resolved);
|
|
3327
3501
|
if (process.env.NODE_ENV !== "production") {
|
|
3328
3502
|
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
3329
3503
|
}
|
|
@@ -3344,8 +3518,8 @@ function createPolymorphic2(options = {}) {
|
|
|
3344
3518
|
}
|
|
3345
3519
|
return classPipeline(tag, props, className, recipe) || void 0;
|
|
3346
3520
|
},
|
|
3347
|
-
resolveAria(tag, props) {
|
|
3348
|
-
return resolveAriaFn(tag, props);
|
|
3521
|
+
resolveAria(tag, props, extraProps) {
|
|
3522
|
+
return resolveAriaFn(tag, props, extraProps);
|
|
3349
3523
|
}
|
|
3350
3524
|
};
|
|
3351
3525
|
const runtimeObject = pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
@@ -3364,7 +3538,7 @@ function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
|
3364
3538
|
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
3365
3539
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
3366
3540
|
function buildCoreRuntime(normalized) {
|
|
3367
|
-
const runtime =
|
|
3541
|
+
const runtime = createPolymorphic(normalized);
|
|
3368
3542
|
const ownedKeys = "classPlugin" in runtime ? runtime.classPlugin.ownedKeys ?? EMPTY_SET : EMPTY_SET;
|
|
3369
3543
|
return { runtime, ownedKeys };
|
|
3370
3544
|
}
|