praxis-kit 7.4.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-EIKPSL26.js → chunk-QYP7KLRE.js} +316 -154
- package/dist/contract/index.d.ts +27 -4
- 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 +27 -4
- package/dist/lit/index.js +305 -141
- package/dist/preact/index.d.ts +114 -6
- package/dist/preact/index.js +321 -153
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +7 -2
- package/dist/react/legacy.d.ts +8 -5
- package/dist/react/legacy.js +13 -9
- package/dist/{react-options-BnjZpdVh.d.ts → react-options-DU3EdFOv.d.ts} +126 -7
- package/dist/solid/index.d.ts +127 -8
- package/dist/solid/index.js +320 -153
- package/dist/svelte/Polymorphic.svelte +8 -0
- package/dist/svelte/index.d.ts +224 -13
- 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 +94 -6
- package/dist/vue/index.js +320 -153
- package/dist/web/index.d.ts +27 -4
- package/dist/web/index.js +305 -141
- package/package.json +9 -9
package/dist/svelte/index.js
CHANGED
|
@@ -25,6 +25,9 @@ function dynamic(resolve) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
// ../../lib/primitive/src/guards/foundational/is-defined.ts
|
|
28
|
+
function isDefined(value) {
|
|
29
|
+
return value !== void 0;
|
|
30
|
+
}
|
|
28
31
|
function isUndefined(value) {
|
|
29
32
|
return value === void 0;
|
|
30
33
|
}
|
|
@@ -51,6 +54,9 @@ function isString(value) {
|
|
|
51
54
|
function isNumber(value) {
|
|
52
55
|
return typeof value === "number";
|
|
53
56
|
}
|
|
57
|
+
function isFunction(value) {
|
|
58
|
+
return typeof value === "function";
|
|
59
|
+
}
|
|
54
60
|
|
|
55
61
|
// ../../lib/primitive/src/rule/is-dynamic-rule.ts
|
|
56
62
|
function isDynamicRule(rule) {
|
|
@@ -634,21 +640,65 @@ function getImplicitRole(tag, props) {
|
|
|
634
640
|
return void 0;
|
|
635
641
|
}
|
|
636
642
|
|
|
637
|
-
// ../../lib/contract/src/diagnostics/
|
|
643
|
+
// ../../lib/contract/src/diagnostics/anchor-accessibility.ts
|
|
638
644
|
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
645
|
+
function createDiagnostic(input) {
|
|
646
|
+
return { category: DiagnosticCategory.Accessibility, ...input };
|
|
647
|
+
}
|
|
648
|
+
var AnchorAccessibilityDiagnostics = {
|
|
649
|
+
roleButtonWithHref() {
|
|
650
|
+
return createDiagnostic({
|
|
651
|
+
code: DiagnosticCode.A11yAnchorRoleButtonWithHref,
|
|
652
|
+
severity: "warning",
|
|
653
|
+
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.',
|
|
654
|
+
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.',
|
|
655
|
+
suggestions: [
|
|
656
|
+
{
|
|
657
|
+
title: "Use a real <button>",
|
|
658
|
+
description: "If this element should not navigate, render a <button> instead of an <a>."
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
title: 'Remove role="button"',
|
|
662
|
+
description: "If this element should navigate, keep the default link role."
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
});
|
|
666
|
+
},
|
|
667
|
+
ariaDisabledInert() {
|
|
668
|
+
return createDiagnostic({
|
|
669
|
+
code: DiagnosticCode.A11yAnchorAriaDisabledInert,
|
|
670
|
+
severity: "warning",
|
|
671
|
+
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.",
|
|
672
|
+
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.",
|
|
673
|
+
suggestions: [
|
|
674
|
+
{
|
|
675
|
+
title: "Remove href",
|
|
676
|
+
description: "If this element is temporarily unavailable, remove href until it can be activated."
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
title: "Prevent navigation when disabled",
|
|
680
|
+
description: "Prevent the click and keyboard activation when the link is disabled so it behaves consistently for all users."
|
|
681
|
+
}
|
|
682
|
+
]
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
// ../../lib/contract/src/diagnostics/aria.ts
|
|
688
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
639
689
|
var AriaDiagnostics = {
|
|
640
690
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
641
691
|
fromViolation(v) {
|
|
642
692
|
return {
|
|
643
|
-
code:
|
|
644
|
-
category:
|
|
693
|
+
code: DiagnosticCode2.AriaViolation,
|
|
694
|
+
category: DiagnosticCategory2.ARIA,
|
|
645
695
|
message: v.message
|
|
646
696
|
};
|
|
647
697
|
},
|
|
648
698
|
attributeInvalid(key, role) {
|
|
649
699
|
return {
|
|
650
|
-
code:
|
|
651
|
-
category:
|
|
700
|
+
code: DiagnosticCode2.AriaAttributeInvalid,
|
|
701
|
+
category: DiagnosticCategory2.ARIA,
|
|
652
702
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
653
703
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
654
704
|
suggestions: [
|
|
@@ -661,8 +711,8 @@ var AriaDiagnostics = {
|
|
|
661
711
|
},
|
|
662
712
|
missingLiveRegion(role, impliedLive) {
|
|
663
713
|
return {
|
|
664
|
-
code:
|
|
665
|
-
category:
|
|
714
|
+
code: DiagnosticCode2.AriaMissingLiveRegion,
|
|
715
|
+
category: DiagnosticCategory2.ARIA,
|
|
666
716
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
667
717
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
668
718
|
suggestions: [
|
|
@@ -676,8 +726,8 @@ var AriaDiagnostics = {
|
|
|
676
726
|
},
|
|
677
727
|
missingAtomic(role) {
|
|
678
728
|
return {
|
|
679
|
-
code:
|
|
680
|
-
category:
|
|
729
|
+
code: DiagnosticCode2.AriaMissingAtomic,
|
|
730
|
+
category: DiagnosticCategory2.ARIA,
|
|
681
731
|
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.`,
|
|
682
732
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
683
733
|
};
|
|
@@ -685,8 +735,8 @@ var AriaDiagnostics = {
|
|
|
685
735
|
relevantInvalidTokens(invalid) {
|
|
686
736
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
687
737
|
return {
|
|
688
|
-
code:
|
|
689
|
-
category:
|
|
738
|
+
code: DiagnosticCode2.AriaRelevantInvalidToken,
|
|
739
|
+
category: DiagnosticCategory2.ARIA,
|
|
690
740
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
691
741
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
692
742
|
suggestions: [
|
|
@@ -699,8 +749,8 @@ var AriaDiagnostics = {
|
|
|
699
749
|
},
|
|
700
750
|
relevantSuperseded() {
|
|
701
751
|
return {
|
|
702
|
-
code:
|
|
703
|
-
category:
|
|
752
|
+
code: DiagnosticCode2.AriaRelevantSuperseded,
|
|
753
|
+
category: DiagnosticCategory2.ARIA,
|
|
704
754
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
705
755
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
706
756
|
suggestions: [
|
|
@@ -713,8 +763,8 @@ var AriaDiagnostics = {
|
|
|
713
763
|
},
|
|
714
764
|
missingAccessibleName(tag) {
|
|
715
765
|
return {
|
|
716
|
-
code:
|
|
717
|
-
category:
|
|
766
|
+
code: DiagnosticCode2.AriaMissingAccessibleName,
|
|
767
|
+
category: DiagnosticCategory2.ARIA,
|
|
718
768
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
719
769
|
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.",
|
|
720
770
|
suggestions: [
|
|
@@ -731,8 +781,8 @@ var AriaDiagnostics = {
|
|
|
731
781
|
},
|
|
732
782
|
attributeOnPresentational(attr, tag) {
|
|
733
783
|
return {
|
|
734
|
-
code:
|
|
735
|
-
category:
|
|
784
|
+
code: DiagnosticCode2.AriaAttributeOnPresentational,
|
|
785
|
+
category: DiagnosticCategory2.ARIA,
|
|
736
786
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
737
787
|
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.',
|
|
738
788
|
suggestions: [
|
|
@@ -745,8 +795,8 @@ var AriaDiagnostics = {
|
|
|
745
795
|
},
|
|
746
796
|
ariaHiddenOnFocusable(tag) {
|
|
747
797
|
return {
|
|
748
|
-
code:
|
|
749
|
-
category:
|
|
798
|
+
code: DiagnosticCode2.AriaHiddenOnFocusable,
|
|
799
|
+
category: DiagnosticCategory2.ARIA,
|
|
750
800
|
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.`,
|
|
751
801
|
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.',
|
|
752
802
|
suggestions: [
|
|
@@ -764,8 +814,8 @@ var AriaDiagnostics = {
|
|
|
764
814
|
invalidAttributeValue(attr, value, expected) {
|
|
765
815
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
766
816
|
return {
|
|
767
|
-
code:
|
|
768
|
-
category:
|
|
817
|
+
code: DiagnosticCode2.AriaInvalidAttributeValue,
|
|
818
|
+
category: DiagnosticCategory2.ARIA,
|
|
769
819
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
770
820
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
771
821
|
suggestions: [
|
|
@@ -778,8 +828,8 @@ var AriaDiagnostics = {
|
|
|
778
828
|
},
|
|
779
829
|
redundantAriaLevel(tag, level) {
|
|
780
830
|
return {
|
|
781
|
-
code:
|
|
782
|
-
category:
|
|
831
|
+
code: DiagnosticCode2.AriaRedundantLevelAttribute,
|
|
832
|
+
category: DiagnosticCategory2.ARIA,
|
|
783
833
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
784
834
|
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>).',
|
|
785
835
|
suggestions: [
|
|
@@ -792,8 +842,8 @@ var AriaDiagnostics = {
|
|
|
792
842
|
},
|
|
793
843
|
requiredProperty(attr, role) {
|
|
794
844
|
return {
|
|
795
|
-
code:
|
|
796
|
-
category:
|
|
845
|
+
code: DiagnosticCode2.AriaRequiredProperty,
|
|
846
|
+
category: DiagnosticCategory2.ARIA,
|
|
797
847
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
798
848
|
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.`,
|
|
799
849
|
suggestions: [
|
|
@@ -806,8 +856,8 @@ var AriaDiagnostics = {
|
|
|
806
856
|
},
|
|
807
857
|
invalidRole(role, tag) {
|
|
808
858
|
return {
|
|
809
|
-
code:
|
|
810
|
-
category:
|
|
859
|
+
code: DiagnosticCode2.AriaInvalidRole,
|
|
860
|
+
category: DiagnosticCategory2.ARIA,
|
|
811
861
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
812
862
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
813
863
|
};
|
|
@@ -815,12 +865,12 @@ var AriaDiagnostics = {
|
|
|
815
865
|
};
|
|
816
866
|
|
|
817
867
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
818
|
-
import { DiagnosticCategory as
|
|
868
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
819
869
|
var ContractDiagnostics = {
|
|
820
870
|
unexpectedChild(typeName, index, context) {
|
|
821
871
|
return {
|
|
822
|
-
code:
|
|
823
|
-
category:
|
|
872
|
+
code: DiagnosticCode3.UnexpectedChild,
|
|
873
|
+
category: DiagnosticCategory3.Contract,
|
|
824
874
|
component: context,
|
|
825
875
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
826
876
|
};
|
|
@@ -828,69 +878,69 @@ var ContractDiagnostics = {
|
|
|
828
878
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
829
879
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
830
880
|
return {
|
|
831
|
-
code:
|
|
832
|
-
category:
|
|
881
|
+
code: DiagnosticCode3.AmbiguousChild,
|
|
882
|
+
category: DiagnosticCategory3.Contract,
|
|
833
883
|
component: context,
|
|
834
884
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
835
885
|
};
|
|
836
886
|
},
|
|
837
887
|
cardinalityMin(ruleName, min, context) {
|
|
838
888
|
return {
|
|
839
|
-
code:
|
|
840
|
-
category:
|
|
889
|
+
code: DiagnosticCode3.CardinalityMin,
|
|
890
|
+
category: DiagnosticCategory3.Contract,
|
|
841
891
|
component: context,
|
|
842
892
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
843
893
|
};
|
|
844
894
|
},
|
|
845
895
|
cardinalityMax(ruleName, max, context) {
|
|
846
896
|
return {
|
|
847
|
-
code:
|
|
848
|
-
category:
|
|
897
|
+
code: DiagnosticCode3.CardinalityMax,
|
|
898
|
+
category: DiagnosticCategory3.Contract,
|
|
849
899
|
component: context,
|
|
850
900
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
851
901
|
};
|
|
852
902
|
},
|
|
853
903
|
positionViolation(ruleName, position, index, context) {
|
|
854
904
|
return {
|
|
855
|
-
code:
|
|
856
|
-
category:
|
|
905
|
+
code: DiagnosticCode3.PositionViolation,
|
|
906
|
+
category: DiagnosticCategory3.Contract,
|
|
857
907
|
component: context,
|
|
858
908
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
859
909
|
};
|
|
860
910
|
},
|
|
861
911
|
unknownVariantDim(component, label2, dim) {
|
|
862
912
|
return {
|
|
863
|
-
code:
|
|
864
|
-
category:
|
|
913
|
+
code: DiagnosticCode3.ContractUnknownVariantDim,
|
|
914
|
+
category: DiagnosticCategory3.Contract,
|
|
865
915
|
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
866
916
|
};
|
|
867
917
|
},
|
|
868
918
|
unknownVariantValue(component, label2, dim, value, valid) {
|
|
869
919
|
return {
|
|
870
|
-
code:
|
|
871
|
-
category:
|
|
920
|
+
code: DiagnosticCode3.ContractUnknownVariantValue,
|
|
921
|
+
category: DiagnosticCategory3.Contract,
|
|
872
922
|
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
873
923
|
};
|
|
874
924
|
},
|
|
875
925
|
unknownRecipeKey(component, key) {
|
|
876
926
|
return {
|
|
877
|
-
code:
|
|
878
|
-
category:
|
|
927
|
+
code: DiagnosticCode3.ContractUnknownRecipeKey,
|
|
928
|
+
category: DiagnosticCategory3.Contract,
|
|
879
929
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
880
930
|
};
|
|
881
931
|
},
|
|
882
932
|
invalidVariantValue(component, key, value) {
|
|
883
933
|
return {
|
|
884
|
-
code:
|
|
885
|
-
category:
|
|
934
|
+
code: DiagnosticCode3.ContractInvalidVariantValue,
|
|
935
|
+
category: DiagnosticCategory3.Contract,
|
|
886
936
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
887
937
|
};
|
|
888
938
|
},
|
|
889
939
|
allowedAsViolation(tag, allowedAs, component) {
|
|
890
940
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
891
941
|
return {
|
|
892
|
-
code:
|
|
893
|
-
category:
|
|
942
|
+
code: DiagnosticCode3.AllowedAsViolation,
|
|
943
|
+
category: DiagnosticCategory3.Contract,
|
|
894
944
|
component,
|
|
895
945
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
896
946
|
};
|
|
@@ -898,68 +948,68 @@ var ContractDiagnostics = {
|
|
|
898
948
|
};
|
|
899
949
|
|
|
900
950
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
901
|
-
import { DiagnosticCategory as
|
|
951
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
902
952
|
var ATTRIBUTE_IGNORED_CODES = {
|
|
903
|
-
checked:
|
|
904
|
-
multiple:
|
|
905
|
-
maxLength:
|
|
906
|
-
minLength:
|
|
907
|
-
pattern:
|
|
908
|
-
min:
|
|
909
|
-
max:
|
|
910
|
-
step:
|
|
911
|
-
accept:
|
|
912
|
-
capture:
|
|
913
|
-
size:
|
|
914
|
-
alt:
|
|
915
|
-
height:
|
|
916
|
-
width:
|
|
953
|
+
checked: DiagnosticCode4.HtmlInputCheckedIgnoredForType,
|
|
954
|
+
multiple: DiagnosticCode4.HtmlInputMultipleIgnoredForType,
|
|
955
|
+
maxLength: DiagnosticCode4.HtmlInputMaxLengthIgnoredForType,
|
|
956
|
+
minLength: DiagnosticCode4.HtmlInputMinLengthIgnoredForType,
|
|
957
|
+
pattern: DiagnosticCode4.HtmlInputPatternIgnoredForType,
|
|
958
|
+
min: DiagnosticCode4.HtmlInputMinIgnoredForType,
|
|
959
|
+
max: DiagnosticCode4.HtmlInputMaxIgnoredForType,
|
|
960
|
+
step: DiagnosticCode4.HtmlInputStepIgnoredForType,
|
|
961
|
+
accept: DiagnosticCode4.HtmlInputAcceptIgnoredForType,
|
|
962
|
+
capture: DiagnosticCode4.HtmlInputCaptureIgnoredForType,
|
|
963
|
+
size: DiagnosticCode4.HtmlInputSizeIgnoredForType,
|
|
964
|
+
alt: DiagnosticCode4.HtmlInputAltIgnoredForType,
|
|
965
|
+
height: DiagnosticCode4.HtmlInputHeightIgnoredForType,
|
|
966
|
+
width: DiagnosticCode4.HtmlInputWidthIgnoredForType
|
|
917
967
|
};
|
|
918
968
|
var HtmlDiagnostics = {
|
|
919
969
|
emptyRole(tag) {
|
|
920
970
|
return {
|
|
921
|
-
code:
|
|
922
|
-
category:
|
|
971
|
+
code: DiagnosticCode4.HtmlEmptyRole,
|
|
972
|
+
category: DiagnosticCategory4.HTML,
|
|
923
973
|
severity: "warning",
|
|
924
974
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
925
975
|
};
|
|
926
976
|
},
|
|
927
977
|
implicitRoleRedundant(tag, implicitRole) {
|
|
928
978
|
return {
|
|
929
|
-
code:
|
|
930
|
-
category:
|
|
979
|
+
code: DiagnosticCode4.HtmlImplicitRoleRedundant,
|
|
980
|
+
category: DiagnosticCategory4.HTML,
|
|
931
981
|
severity: "warning",
|
|
932
982
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
933
983
|
};
|
|
934
984
|
},
|
|
935
985
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
936
986
|
return {
|
|
937
|
-
code:
|
|
938
|
-
category:
|
|
987
|
+
code: DiagnosticCode4.HtmlImplicitRoleOverride,
|
|
988
|
+
category: DiagnosticCategory4.HTML,
|
|
939
989
|
severity: "error",
|
|
940
990
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
941
991
|
};
|
|
942
992
|
},
|
|
943
993
|
standaloneRegionOverride(tag, implicitRole) {
|
|
944
994
|
return {
|
|
945
|
-
code:
|
|
946
|
-
category:
|
|
995
|
+
code: DiagnosticCode4.HtmlStandaloneRegionOverride,
|
|
996
|
+
category: DiagnosticCategory4.HTML,
|
|
947
997
|
severity: "error",
|
|
948
998
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
949
999
|
};
|
|
950
1000
|
},
|
|
951
1001
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
952
1002
|
return {
|
|
953
|
-
code:
|
|
954
|
-
category:
|
|
1003
|
+
code: DiagnosticCode4.HtmlLandmarkRoleOverride,
|
|
1004
|
+
category: DiagnosticCategory4.HTML,
|
|
955
1005
|
severity: "error",
|
|
956
1006
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
957
1007
|
};
|
|
958
1008
|
},
|
|
959
1009
|
invalidChild(child, parent, allowed) {
|
|
960
1010
|
return {
|
|
961
|
-
code:
|
|
962
|
-
category:
|
|
1011
|
+
code: DiagnosticCode4.HtmlInvalidChild,
|
|
1012
|
+
category: DiagnosticCategory4.HTML,
|
|
963
1013
|
severity: "error",
|
|
964
1014
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
965
1015
|
};
|
|
@@ -967,8 +1017,8 @@ var HtmlDiagnostics = {
|
|
|
967
1017
|
roleNotPermitted(tag, role, allowedRoles) {
|
|
968
1018
|
const allowed = allowedRoles.length > 0 ? allowedRoles.map((r) => `"${r}"`).join(", ") : "none \u2014 no explicit role is permitted on this element";
|
|
969
1019
|
return {
|
|
970
|
-
code:
|
|
971
|
-
category:
|
|
1020
|
+
code: DiagnosticCode4.HtmlRoleNotPermitted,
|
|
1021
|
+
category: DiagnosticCategory4.HTML,
|
|
972
1022
|
severity: "error",
|
|
973
1023
|
message: `role="${role}" is not permitted on <${tag}>. Allowed alternate role(s): ${allowed}.`,
|
|
974
1024
|
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.'
|
|
@@ -979,8 +1029,8 @@ var HtmlDiagnostics = {
|
|
|
979
1029
|
input: {
|
|
980
1030
|
unsupportedType(type) {
|
|
981
1031
|
return {
|
|
982
|
-
code:
|
|
983
|
-
category:
|
|
1032
|
+
code: DiagnosticCode4.HtmlInputUnsupportedType,
|
|
1033
|
+
category: DiagnosticCategory4.HTML,
|
|
984
1034
|
severity: "warning",
|
|
985
1035
|
message: `type="${type}" is not a value defined by the HTML specification. Browsers silently fall back to type="text".`,
|
|
986
1036
|
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).',
|
|
@@ -1000,7 +1050,7 @@ var HtmlDiagnostics = {
|
|
|
1000
1050
|
if (!code) throw new Error(`No DiagnosticCode registered for input attribute "${attribute}"`);
|
|
1001
1051
|
return {
|
|
1002
1052
|
code,
|
|
1003
|
-
category:
|
|
1053
|
+
category: DiagnosticCategory4.HTML,
|
|
1004
1054
|
severity: "warning",
|
|
1005
1055
|
message: `"${attribute}" is ignored on <input type="${type}">.`,
|
|
1006
1056
|
rationale: `"${attribute}" only has an effect when type is one of: ${allowed}. Browsers silently ignore it on other input types.`,
|
|
@@ -1012,18 +1062,30 @@ var HtmlDiagnostics = {
|
|
|
1012
1062
|
]
|
|
1013
1063
|
};
|
|
1014
1064
|
}
|
|
1065
|
+
},
|
|
1066
|
+
// Reserved for <a>-specific facts (HTML3201–3299, see codes.ts).
|
|
1067
|
+
anchor: {
|
|
1068
|
+
dangerousHref(href) {
|
|
1069
|
+
return {
|
|
1070
|
+
code: DiagnosticCode4.HtmlAnchorDangerousHref,
|
|
1071
|
+
category: DiagnosticCategory4.HTML,
|
|
1072
|
+
severity: "warning",
|
|
1073
|
+
message: `href="${href}" uses a scheme that executes attacker-controlled content when navigated to. It has been removed.`,
|
|
1074
|
+
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.'
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1015
1077
|
}
|
|
1016
1078
|
};
|
|
1017
1079
|
|
|
1018
1080
|
// ../../lib/contract/src/diagnostics/input-accessibility.ts
|
|
1019
|
-
import { DiagnosticCategory as
|
|
1081
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
|
|
1020
1082
|
function accessibilityFact(input) {
|
|
1021
|
-
return { category:
|
|
1083
|
+
return { category: DiagnosticCategory5.Accessibility, ...input };
|
|
1022
1084
|
}
|
|
1023
1085
|
var InputAccessibilityDiagnostics = {
|
|
1024
1086
|
missingAccessibleName() {
|
|
1025
1087
|
return accessibilityFact({
|
|
1026
|
-
code:
|
|
1088
|
+
code: DiagnosticCode5.A11yInputMissingAccessibleName,
|
|
1027
1089
|
severity: "warning",
|
|
1028
1090
|
message: "This input has no accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1029
1091
|
rationale: "Assistive technology announces a form field by its accessible name; without one, users of screen readers cannot tell what the field is for.",
|
|
@@ -1038,7 +1100,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1038
1100
|
},
|
|
1039
1101
|
placeholderIsNotLabel() {
|
|
1040
1102
|
return accessibilityFact({
|
|
1041
|
-
code:
|
|
1103
|
+
code: DiagnosticCode5.A11yInputPlaceholderNotLabel,
|
|
1042
1104
|
severity: "warning",
|
|
1043
1105
|
message: "Placeholder text does not provide an accessible name. Add an associated <label>, aria-label, or aria-labelledby.",
|
|
1044
1106
|
rationale: "Placeholder text disappears as users interact with the field and is not treated as the control's accessible name by many assistive technologies.",
|
|
@@ -1053,7 +1115,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1053
1115
|
},
|
|
1054
1116
|
passwordMissingAutocomplete() {
|
|
1055
1117
|
return accessibilityFact({
|
|
1056
|
-
code:
|
|
1118
|
+
code: DiagnosticCode5.A11yInputPasswordAutocomplete,
|
|
1057
1119
|
severity: "warning",
|
|
1058
1120
|
message: "Password inputs should specify an autoComplete value.",
|
|
1059
1121
|
rationale: "Without an explicit autocomplete hint, password managers and browsers cannot reliably tell a sign-in field apart from a password-creation field.",
|
|
@@ -1071,7 +1133,7 @@ var InputAccessibilityDiagnostics = {
|
|
|
1071
1133
|
},
|
|
1072
1134
|
requiredReadOnlyConflict() {
|
|
1073
1135
|
return accessibilityFact({
|
|
1074
|
-
code:
|
|
1136
|
+
code: DiagnosticCode5.A11yInputRequiredReadOnlyConflict,
|
|
1075
1137
|
severity: "warning",
|
|
1076
1138
|
message: "The required and readOnly attributes are both present. A read-only field cannot satisfy required validation through user interaction.",
|
|
1077
1139
|
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."
|
|
@@ -1080,28 +1142,28 @@ var InputAccessibilityDiagnostics = {
|
|
|
1080
1142
|
};
|
|
1081
1143
|
|
|
1082
1144
|
// ../../lib/contract/src/diagnostics/slot.ts
|
|
1083
|
-
import { DiagnosticCategory as
|
|
1145
|
+
import { DiagnosticCategory as DiagnosticCategory6, DiagnosticCode as DiagnosticCode6 } from "../_shared/diagnostics.js";
|
|
1084
1146
|
var SlotDiagnostics = {
|
|
1085
1147
|
exclusive(name) {
|
|
1086
1148
|
return {
|
|
1087
|
-
code:
|
|
1088
|
-
category:
|
|
1149
|
+
code: DiagnosticCode6.SlotExclusive,
|
|
1150
|
+
category: DiagnosticCategory6.Contract,
|
|
1089
1151
|
component: name,
|
|
1090
1152
|
message: `${name}: "as" and "asChild" are mutually exclusive`
|
|
1091
1153
|
};
|
|
1092
1154
|
},
|
|
1093
1155
|
singleChildRequired(name, elementTerm) {
|
|
1094
1156
|
return {
|
|
1095
|
-
code:
|
|
1096
|
-
category:
|
|
1157
|
+
code: DiagnosticCode6.SlotSingleChild,
|
|
1158
|
+
category: DiagnosticCategory6.Contract,
|
|
1097
1159
|
component: name,
|
|
1098
1160
|
message: `${name}: asChild requires a ${elementTerm} child`
|
|
1099
1161
|
};
|
|
1100
1162
|
},
|
|
1101
1163
|
singleChildExceeded(name, elementTerm, count) {
|
|
1102
1164
|
return {
|
|
1103
|
-
code:
|
|
1104
|
-
category:
|
|
1165
|
+
code: DiagnosticCode6.SlotSingleChild,
|
|
1166
|
+
category: DiagnosticCategory6.Contract,
|
|
1105
1167
|
component: name,
|
|
1106
1168
|
message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
|
|
1107
1169
|
};
|
|
@@ -1109,16 +1171,16 @@ var SlotDiagnostics = {
|
|
|
1109
1171
|
discardedChildren(name, elementTerm, count) {
|
|
1110
1172
|
const suffix = count === 1 ? "" : "ren";
|
|
1111
1173
|
return {
|
|
1112
|
-
code:
|
|
1113
|
-
category:
|
|
1174
|
+
code: DiagnosticCode6.SlotDiscardedChildren,
|
|
1175
|
+
category: DiagnosticCategory6.Contract,
|
|
1114
1176
|
component: name,
|
|
1115
1177
|
message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
|
|
1116
1178
|
};
|
|
1117
1179
|
},
|
|
1118
1180
|
renderFnRequired(name, received) {
|
|
1119
1181
|
return {
|
|
1120
|
-
code:
|
|
1121
|
-
category:
|
|
1182
|
+
code: DiagnosticCode6.SlotRenderFn,
|
|
1183
|
+
category: DiagnosticCategory6.Contract,
|
|
1122
1184
|
component: name,
|
|
1123
1185
|
message: `${name}: asChild requires a render function as children, got ${received}`
|
|
1124
1186
|
};
|
|
@@ -1864,6 +1926,27 @@ var AriaPolicyEngine = class _AriaPolicyEngine extends InvariantBase {
|
|
|
1864
1926
|
};
|
|
1865
1927
|
|
|
1866
1928
|
// ../../lib/contract/src/aria/factories.ts
|
|
1929
|
+
function invalidWithoutFix(input) {
|
|
1930
|
+
return {
|
|
1931
|
+
valid: false,
|
|
1932
|
+
fixable: false,
|
|
1933
|
+
severity: input.severity,
|
|
1934
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
1935
|
+
...isDefined(input.message) && { message: input.message },
|
|
1936
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic }
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
function invalidWithFix(input) {
|
|
1940
|
+
return {
|
|
1941
|
+
valid: false,
|
|
1942
|
+
fixable: true,
|
|
1943
|
+
severity: input.severity,
|
|
1944
|
+
...isDefined(input.attribute) && { attribute: input.attribute },
|
|
1945
|
+
...isDefined(input.message) && { message: input.message },
|
|
1946
|
+
...isDefined(input.diagnostic) && { diagnostic: input.diagnostic },
|
|
1947
|
+
fix: input.fix
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1867
1950
|
function removeProp(props, key) {
|
|
1868
1951
|
const next = { ...props };
|
|
1869
1952
|
delete next[key];
|
|
@@ -1879,6 +1962,34 @@ function removeAttributeFix(attribute) {
|
|
|
1879
1962
|
}
|
|
1880
1963
|
});
|
|
1881
1964
|
}
|
|
1965
|
+
function defineRuleMetadata(rule, metadata2) {
|
|
1966
|
+
const descriptors = {};
|
|
1967
|
+
for (const key of Object.keys(metadata2)) {
|
|
1968
|
+
descriptors[key] = { value: metadata2[key], enumerable: false };
|
|
1969
|
+
}
|
|
1970
|
+
Object.defineProperties(rule, descriptors);
|
|
1971
|
+
return rule;
|
|
1972
|
+
}
|
|
1973
|
+
function createRemoveAttributeRule(attribute, options) {
|
|
1974
|
+
const { when, severity = "warning", message, diagnostic, readsProps, tags } = options;
|
|
1975
|
+
const fix = removeAttributeFix(attribute);
|
|
1976
|
+
const rule = (context) => {
|
|
1977
|
+
if (!when(context)) return [];
|
|
1978
|
+
return [
|
|
1979
|
+
invalidWithFix({
|
|
1980
|
+
severity,
|
|
1981
|
+
attribute,
|
|
1982
|
+
...isDefined(message) && { message },
|
|
1983
|
+
...isDefined(diagnostic) && { diagnostic: diagnostic(context) },
|
|
1984
|
+
fix
|
|
1985
|
+
})
|
|
1986
|
+
];
|
|
1987
|
+
};
|
|
1988
|
+
return defineRuleMetadata(rule, {
|
|
1989
|
+
...isDefined(readsProps) && { readsProps },
|
|
1990
|
+
...isDefined(tags) && { tags }
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1882
1993
|
|
|
1883
1994
|
// ../../lib/contract/src/children/get-type-name.ts
|
|
1884
1995
|
function getTypeName(value) {
|
|
@@ -2267,6 +2378,52 @@ var P_BLOCKED_TAGS = [
|
|
|
2267
2378
|
"ul"
|
|
2268
2379
|
];
|
|
2269
2380
|
|
|
2381
|
+
// ../core/src/html/anchor-rules.ts
|
|
2382
|
+
var DANGEROUS_URL_SCHEMES = ["javascript:", "data:", "vbscript:"];
|
|
2383
|
+
function normalizeForSchemeCheck(href) {
|
|
2384
|
+
return href.replace(/[\x00-\x20]/g, "").toLowerCase();
|
|
2385
|
+
}
|
|
2386
|
+
function isDangerousUrl(href) {
|
|
2387
|
+
if (!isString(href)) return false;
|
|
2388
|
+
const normalized = normalizeForSchemeCheck(href);
|
|
2389
|
+
return DANGEROUS_URL_SCHEMES.some((scheme) => normalized.startsWith(scheme));
|
|
2390
|
+
}
|
|
2391
|
+
var dangerousHrefRule = createRemoveAttributeRule("href", {
|
|
2392
|
+
when: ({ props }) => isDangerousUrl(props.href),
|
|
2393
|
+
severity: "warning",
|
|
2394
|
+
diagnostic: ({ props }) => HtmlDiagnostics.anchor.dangerousHref(props.href),
|
|
2395
|
+
readsProps: ["href"],
|
|
2396
|
+
tags: ["a"]
|
|
2397
|
+
});
|
|
2398
|
+
var roleButtonWithHrefRule = Object.assign(
|
|
2399
|
+
({ props }) => {
|
|
2400
|
+
if (props.role !== "button" || !isString(props.href) || props.href.length === 0) {
|
|
2401
|
+
return [];
|
|
2402
|
+
}
|
|
2403
|
+
const diagnostic = AnchorAccessibilityDiagnostics.roleButtonWithHref();
|
|
2404
|
+
return [invalidWithoutFix({ severity: diagnostic.severity, attribute: "role", diagnostic })];
|
|
2405
|
+
},
|
|
2406
|
+
{ readsProps: ["role", "href"], tags: ["a"] }
|
|
2407
|
+
);
|
|
2408
|
+
var ariaDisabledInertRule = Object.assign(
|
|
2409
|
+
({ props }) => {
|
|
2410
|
+
const ariaDisabled = props["aria-disabled"];
|
|
2411
|
+
const isDisabled = ariaDisabled === true || ariaDisabled === "true";
|
|
2412
|
+
const hasHref = isString(props.href) && props.href.length > 0;
|
|
2413
|
+
if (!isDisabled || !hasHref) return [];
|
|
2414
|
+
const diagnostic = AnchorAccessibilityDiagnostics.ariaDisabledInert();
|
|
2415
|
+
return [
|
|
2416
|
+
invalidWithoutFix({ severity: diagnostic.severity, attribute: "aria-disabled", diagnostic })
|
|
2417
|
+
];
|
|
2418
|
+
},
|
|
2419
|
+
{ readsProps: ["aria-disabled", "href"], tags: ["a"] }
|
|
2420
|
+
);
|
|
2421
|
+
var ANCHOR_RULES = [
|
|
2422
|
+
dangerousHrefRule,
|
|
2423
|
+
roleButtonWithHrefRule,
|
|
2424
|
+
ariaDisabledInertRule
|
|
2425
|
+
];
|
|
2426
|
+
|
|
2270
2427
|
// ../core/src/html/spec/vocabulary/input.ts
|
|
2271
2428
|
var TEXT_INPUT_TYPES = ["text", "search", "url", "tel", "email", "password"];
|
|
2272
2429
|
var NUMERIC_INPUT_TYPES = [
|
|
@@ -2346,12 +2503,12 @@ function createInputAttributeTypeRule({
|
|
|
2346
2503
|
// ../core/src/html/spec/validators/mutually-exclusive-validator.ts
|
|
2347
2504
|
function createMutuallyExclusiveRule({
|
|
2348
2505
|
props: conflictingProps,
|
|
2349
|
-
diagnostic:
|
|
2506
|
+
diagnostic: createDiagnostic2
|
|
2350
2507
|
}) {
|
|
2351
2508
|
const [first, second] = conflictingProps;
|
|
2352
2509
|
const rule = ({ tag, props }) => {
|
|
2353
2510
|
if (tag !== "input" || !props[first] || !props[second]) return [];
|
|
2354
|
-
const diagnostic =
|
|
2511
|
+
const diagnostic = createDiagnostic2();
|
|
2355
2512
|
return [{ valid: false, fixable: false, severity: diagnostic.severity, diagnostic }];
|
|
2356
2513
|
};
|
|
2357
2514
|
return Object.assign(rule, { readsProps: conflictingProps, tags: ["input"] });
|
|
@@ -2731,7 +2888,8 @@ var HTML_ARIA_RULES = [
|
|
|
2731
2888
|
landmarkRoleRule,
|
|
2732
2889
|
landmarkAccessibleNameRule,
|
|
2733
2890
|
roleNotPermittedRule,
|
|
2734
|
-
...INPUT_RULES
|
|
2891
|
+
...INPUT_RULES,
|
|
2892
|
+
...ANCHOR_RULES
|
|
2735
2893
|
];
|
|
2736
2894
|
|
|
2737
2895
|
// ../core/src/html/contracts/helpers.ts
|
|
@@ -3141,19 +3299,6 @@ function createClassPipeline(resolved) {
|
|
|
3141
3299
|
};
|
|
3142
3300
|
}
|
|
3143
3301
|
|
|
3144
|
-
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3145
|
-
function definePipeline(factory) {
|
|
3146
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
3147
|
-
return (resolved) => {
|
|
3148
|
-
let pipeline = cache.get(resolved);
|
|
3149
|
-
if (!pipeline) {
|
|
3150
|
-
pipeline = factory(resolved);
|
|
3151
|
-
cache.set(resolved, pipeline);
|
|
3152
|
-
}
|
|
3153
|
-
return pipeline;
|
|
3154
|
-
};
|
|
3155
|
-
}
|
|
3156
|
-
|
|
3157
3302
|
// ../core/src/options/resolve-factory-options.ts
|
|
3158
3303
|
import { resolveDiagnostics, silentDiagnostics } from "../_shared/diagnostics.js";
|
|
3159
3304
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
@@ -3257,25 +3402,66 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
|
3257
3402
|
}
|
|
3258
3403
|
}
|
|
3259
3404
|
|
|
3405
|
+
// ../../lib/pipeline-kit/src/factory/define-pipeline.ts
|
|
3406
|
+
function definePipeline(factory) {
|
|
3407
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
3408
|
+
return (resolved) => {
|
|
3409
|
+
let pipeline = cache.get(resolved);
|
|
3410
|
+
if (!pipeline) {
|
|
3411
|
+
pipeline = factory(resolved);
|
|
3412
|
+
cache.set(resolved, pipeline);
|
|
3413
|
+
}
|
|
3414
|
+
return pipeline;
|
|
3415
|
+
};
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
// ../core/src/factory/pipelines/generic.ts
|
|
3419
|
+
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3420
|
+
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3421
|
+
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3422
|
+
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3423
|
+
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3424
|
+
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3425
|
+
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3426
|
+
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3427
|
+
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(
|
|
3428
|
+
createHtmlChildrenEvaluatorPipeline
|
|
3429
|
+
);
|
|
3430
|
+
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3431
|
+
|
|
3432
|
+
// ../core/src/factory/pipelines/aria.ts
|
|
3433
|
+
function resolveAriaRules(resolved) {
|
|
3434
|
+
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3435
|
+
}
|
|
3436
|
+
var createAriaPipeline = (resolved) => {
|
|
3437
|
+
const rules = resolveAriaRules(resolved);
|
|
3438
|
+
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3439
|
+
return (tag, props) => engine.validate(tag, props);
|
|
3440
|
+
};
|
|
3441
|
+
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3442
|
+
function resolveAriaPassthrough(_tag, props) {
|
|
3443
|
+
return { props };
|
|
3444
|
+
}
|
|
3445
|
+
|
|
3260
3446
|
// ../core/src/factory/plugin-invariants.ts
|
|
3261
3447
|
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
3262
3448
|
|
|
3263
3449
|
// ../core/src/factory/plugin-diagnostics.ts
|
|
3264
|
-
import { DiagnosticCategory as
|
|
3450
|
+
import { DiagnosticCategory as DiagnosticCategory7, DiagnosticCode as DiagnosticCode7 } from "../_shared/diagnostics.js";
|
|
3265
3451
|
var PluginDiagnostics = {
|
|
3266
3452
|
invalidShape(received) {
|
|
3267
|
-
const got = received
|
|
3453
|
+
const got = isNull(received) ? "null" : typeof received;
|
|
3268
3454
|
return {
|
|
3269
|
-
code:
|
|
3270
|
-
category:
|
|
3455
|
+
code: DiagnosticCode7.PluginInvalidShape,
|
|
3456
|
+
category: DiagnosticCategory7.Internal,
|
|
3271
3457
|
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
3272
3458
|
};
|
|
3273
3459
|
},
|
|
3274
3460
|
pipelineReturnType(received) {
|
|
3275
|
-
const got = received
|
|
3461
|
+
const got = isNull(received) ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
3276
3462
|
return {
|
|
3277
|
-
code:
|
|
3278
|
-
category:
|
|
3463
|
+
code: DiagnosticCode7.PluginPipelineReturnType,
|
|
3464
|
+
category: DiagnosticCategory7.Internal,
|
|
3279
3465
|
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
3280
3466
|
};
|
|
3281
3467
|
}
|
|
@@ -3283,60 +3469,41 @@ var PluginDiagnostics = {
|
|
|
3283
3469
|
|
|
3284
3470
|
// ../core/src/factory/plugin-invariants.ts
|
|
3285
3471
|
function assertPluginShape(result) {
|
|
3286
|
-
if (result
|
|
3472
|
+
if (isNull(result) || !isObject(result))
|
|
3287
3473
|
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3288
3474
|
const plugin = result;
|
|
3289
|
-
if (
|
|
3290
|
-
throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3475
|
+
if (!isFunction(plugin.pipeline)) throwDiagnostics.error(PluginDiagnostics.invalidShape(result));
|
|
3291
3476
|
}
|
|
3292
3477
|
function guardPipeline(pipeline) {
|
|
3293
3478
|
if (process.env.NODE_ENV === "production") return pipeline;
|
|
3294
3479
|
return function guardedPipeline(tag, props, className, recipe) {
|
|
3295
3480
|
const result = pipeline(tag, props, className, recipe);
|
|
3296
|
-
if (
|
|
3297
|
-
throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3481
|
+
if (!isString(result)) throwDiagnostics.error(PluginDiagnostics.pipelineReturnType(result));
|
|
3298
3482
|
return result;
|
|
3299
3483
|
};
|
|
3300
3484
|
}
|
|
3301
3485
|
|
|
3302
|
-
// ../core/src/factory/
|
|
3303
|
-
var createTagPipeline = (resolved) => makeResolveTag(resolved.defaultTag);
|
|
3304
|
-
var createPropsPipeline = (resolved) => (props) => mergeProps(resolved.defaultProps, props);
|
|
3305
|
-
var createHtmlPropNormalizersPipeline = () => getHtmlPropNormalizers;
|
|
3306
|
-
var createHtmlChildrenEvaluatorPipeline = () => getHtmlChildrenEvaluator;
|
|
3307
|
-
var createStylingClassPipeline = (resolved) => createClassPipeline(resolved);
|
|
3308
|
-
function resolveAriaRules(resolved) {
|
|
3309
|
-
return [.../* @__PURE__ */ new Set([...HTML_ARIA_RULES, ...resolved.ariaRules ?? []])];
|
|
3310
|
-
}
|
|
3311
|
-
var createAriaPipeline = (resolved) => {
|
|
3312
|
-
const rules = resolveAriaRules(resolved);
|
|
3313
|
-
const engine = new AriaPolicyEngine(resolved.diagnostics, rules.length ? { rules } : void 0);
|
|
3314
|
-
return (tag, props) => engine.validate(tag, props);
|
|
3315
|
-
};
|
|
3316
|
-
var memoizedTagPipeline = definePipeline(createTagPipeline);
|
|
3317
|
-
var memoizedPropsPipeline = definePipeline(createPropsPipeline);
|
|
3318
|
-
var memoizedHtmlPropNormalizersPipeline = definePipeline(createHtmlPropNormalizersPipeline);
|
|
3319
|
-
var memoizedHtmlChildrenEvaluatorPipeline = definePipeline(createHtmlChildrenEvaluatorPipeline);
|
|
3320
|
-
var memoizedClassPipeline = definePipeline(createStylingClassPipeline);
|
|
3321
|
-
var memoizedAriaPipeline = definePipeline(createAriaPipeline);
|
|
3322
|
-
function resolveAriaPassthrough(_tag, props) {
|
|
3323
|
-
return { props };
|
|
3324
|
-
}
|
|
3486
|
+
// ../core/src/factory/pipelines/styling.ts
|
|
3325
3487
|
function resolveClassPlugin(factory, resolved, diagnostics) {
|
|
3326
3488
|
if (!factory) return { pluginResult: void 0, classPipeline: memoizedClassPipeline(resolved) };
|
|
3327
3489
|
const pluginResult = factory(resolved, diagnostics);
|
|
3328
3490
|
assertPluginShape(pluginResult);
|
|
3329
3491
|
return { pluginResult, classPipeline: guardPipeline(pluginResult.pipeline) };
|
|
3330
3492
|
}
|
|
3331
|
-
|
|
3493
|
+
|
|
3494
|
+
// ../core/src/factory/create-polymorphic.ts
|
|
3495
|
+
function eraseResolvedShape(resolved) {
|
|
3496
|
+
return resolved;
|
|
3497
|
+
}
|
|
3498
|
+
function createPolymorphic(options = {}) {
|
|
3332
3499
|
const baseResolved = resolveFactoryOptions(options);
|
|
3333
|
-
const anyBaseResolved = baseResolved;
|
|
3500
|
+
const anyBaseResolved = eraseResolvedShape(baseResolved);
|
|
3334
3501
|
const resolved = Object.freeze({
|
|
3335
3502
|
...baseResolved,
|
|
3336
3503
|
htmlPropNormalizersFn: memoizedHtmlPropNormalizersPipeline(anyBaseResolved),
|
|
3337
3504
|
htmlChildrenEvaluatorFn: memoizedHtmlChildrenEvaluatorPipeline(anyBaseResolved)
|
|
3338
3505
|
});
|
|
3339
|
-
const anyResolved = resolved;
|
|
3506
|
+
const anyResolved = eraseResolvedShape(resolved);
|
|
3340
3507
|
if (process.env.NODE_ENV !== "production") {
|
|
3341
3508
|
validateFactoryOptions(resolved, resolved.diagnostics);
|
|
3342
3509
|
}
|
|
@@ -3368,7 +3535,7 @@ function createPolymorphic2(options = {}) {
|
|
|
3368
3535
|
// ../../lib/adapter-utils/src/runtime/build-core-runtime.ts
|
|
3369
3536
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
3370
3537
|
function buildCoreRuntime(normalized) {
|
|
3371
|
-
const runtime =
|
|
3538
|
+
const runtime = createPolymorphic(normalized);
|
|
3372
3539
|
const ownedKeys = "classPlugin" in runtime ? runtime.classPlugin.ownedKeys ?? EMPTY_SET : EMPTY_SET;
|
|
3373
3540
|
return { runtime, ownedKeys };
|
|
3374
3541
|
}
|