praxis-kit 4.0.0 → 4.0.3
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 +212 -0
- package/dist/_shared/diagnostics.js +289 -0
- package/dist/{chunk-TJRHF6MS.js → chunk-DRGZ4ZI2.js} +79 -208
- package/dist/codemod/index.js +23 -15
- package/dist/contract/index.d.ts +246 -2
- package/dist/eslint/index.js +21 -17
- package/dist/lit/index.d.ts +221 -5
- package/dist/lit/index.js +74 -203
- package/dist/merge-refs-B0YcfdtP.d.ts +399 -0
- package/dist/preact/index.d.ts +234 -5
- package/dist/preact/index.js +79 -208
- package/dist/react/index.d.ts +4 -7
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +4 -7
- package/dist/react/legacy.js +1 -1
- package/dist/solid/index.d.ts +234 -5
- package/dist/solid/index.js +83 -212
- package/dist/svelte/index.d.ts +311 -5
- package/dist/svelte/index.js +83 -212
- package/dist/tailwind/index.d.ts +88 -4
- package/dist/tailwind/index.js +11 -119
- package/dist/vite-plugin/index.d.ts +138 -2
- package/dist/vue/index.d.ts +234 -5
- package/dist/vue/index.js +79 -208
- package/dist/web/index.d.ts +221 -6
- package/dist/web/index.js +74 -203
- package/package.json +3 -3
- package/dist/merge-refs-DUuHyTRO.d.ts +0 -144
package/dist/solid/index.js
CHANGED
|
@@ -627,159 +627,21 @@ var InvariantBase = class {
|
|
|
627
627
|
}
|
|
628
628
|
};
|
|
629
629
|
|
|
630
|
-
// ../../lib/diagnostics/src/category.ts
|
|
631
|
-
var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => {
|
|
632
|
-
DiagnosticCategory2[DiagnosticCategory2["Contract"] = 0] = "Contract";
|
|
633
|
-
DiagnosticCategory2[DiagnosticCategory2["HTML"] = 1] = "HTML";
|
|
634
|
-
DiagnosticCategory2[DiagnosticCategory2["ARIA"] = 2] = "ARIA";
|
|
635
|
-
DiagnosticCategory2[DiagnosticCategory2["Composition"] = 3] = "Composition";
|
|
636
|
-
DiagnosticCategory2[DiagnosticCategory2["Rendering"] = 4] = "Rendering";
|
|
637
|
-
DiagnosticCategory2[DiagnosticCategory2["Accessibility"] = 5] = "Accessibility";
|
|
638
|
-
DiagnosticCategory2[DiagnosticCategory2["Performance"] = 6] = "Performance";
|
|
639
|
-
DiagnosticCategory2[DiagnosticCategory2["Internal"] = 7] = "Internal";
|
|
640
|
-
DiagnosticCategory2[DiagnosticCategory2["Deprecation"] = 8] = "Deprecation";
|
|
641
|
-
DiagnosticCategory2[DiagnosticCategory2["Lint"] = 9] = "Lint";
|
|
642
|
-
return DiagnosticCategory2;
|
|
643
|
-
})(DiagnosticCategory || {});
|
|
644
|
-
|
|
645
|
-
// ../../lib/diagnostics/src/error.ts
|
|
646
|
-
var PraxisError = class extends Error {
|
|
647
|
-
diagnostic;
|
|
648
|
-
constructor(diagnostic) {
|
|
649
|
-
super(diagnostic.message);
|
|
650
|
-
this.name = "PraxisError";
|
|
651
|
-
this.diagnostic = diagnostic;
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
// ../../lib/diagnostics/src/severity.ts
|
|
656
|
-
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
657
|
-
Severity2[Severity2["Debug"] = 0] = "Debug";
|
|
658
|
-
Severity2[Severity2["Info"] = 1] = "Info";
|
|
659
|
-
Severity2[Severity2["Warning"] = 2] = "Warning";
|
|
660
|
-
Severity2[Severity2["Error"] = 3] = "Error";
|
|
661
|
-
Severity2[Severity2["Fatal"] = 4] = "Fatal";
|
|
662
|
-
return Severity2;
|
|
663
|
-
})(Severity || {});
|
|
664
|
-
|
|
665
|
-
// ../../lib/diagnostics/src/policy.ts
|
|
666
|
-
var DefaultPolicy = class {
|
|
667
|
-
reportThreshold;
|
|
668
|
-
throwThreshold;
|
|
669
|
-
constructor({
|
|
670
|
-
reportThreshold = 1 /* Info */,
|
|
671
|
-
throwThreshold = 4 /* Fatal */
|
|
672
|
-
} = {}) {
|
|
673
|
-
this.reportThreshold = reportThreshold;
|
|
674
|
-
this.throwThreshold = throwThreshold;
|
|
675
|
-
}
|
|
676
|
-
resolve(diagnostic) {
|
|
677
|
-
if (diagnostic.severity >= this.throwThreshold) return 2 /* Throw */;
|
|
678
|
-
if (diagnostic.severity >= this.reportThreshold) return 1 /* Report */;
|
|
679
|
-
return 0 /* Ignore */;
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
// ../../lib/diagnostics/src/diagnostics.ts
|
|
684
|
-
var Diagnostics = class {
|
|
685
|
-
reporter;
|
|
686
|
-
policy;
|
|
687
|
-
// Pre-computed at construction time: true if Warning-level diagnostics are not ignored.
|
|
688
|
-
active;
|
|
689
|
-
constructor(reporter, policy = new DefaultPolicy()) {
|
|
690
|
-
this.reporter = reporter;
|
|
691
|
-
this.policy = policy;
|
|
692
|
-
this.active = policy.resolve({ severity: 2 /* Warning */ }) !== 0 /* Ignore */;
|
|
693
|
-
}
|
|
694
|
-
report(diagnostic) {
|
|
695
|
-
const enforcement = this.policy.resolve(diagnostic);
|
|
696
|
-
if (enforcement === 0 /* Ignore */) return diagnostic;
|
|
697
|
-
if (enforcement === 2 /* Throw */) throw new PraxisError(diagnostic);
|
|
698
|
-
this.reporter.report(diagnostic);
|
|
699
|
-
return diagnostic;
|
|
700
|
-
}
|
|
701
|
-
warn(input) {
|
|
702
|
-
return this.report({ ...input, severity: 2 /* Warning */ });
|
|
703
|
-
}
|
|
704
|
-
error(input) {
|
|
705
|
-
return this.report({ ...input, severity: 3 /* Error */ });
|
|
706
|
-
}
|
|
707
|
-
info(input) {
|
|
708
|
-
return this.report({ ...input, severity: 1 /* Info */ });
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
// ../../lib/diagnostics/src/formatter.ts
|
|
713
|
-
function formatDiagnostic(diagnostic) {
|
|
714
|
-
const level = Severity[diagnostic.severity];
|
|
715
|
-
const category = DiagnosticCategory[diagnostic.category];
|
|
716
|
-
const prefix = category !== void 0 ? `[${category}] ` : "";
|
|
717
|
-
return `${level} ${diagnostic.code}: ${prefix}${diagnostic.message}`;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
// ../../lib/diagnostics/src/console-reporter.ts
|
|
721
|
-
var ConsoleReporter = class {
|
|
722
|
-
report(diagnostic) {
|
|
723
|
-
const message = formatDiagnostic(diagnostic);
|
|
724
|
-
switch (diagnostic.severity) {
|
|
725
|
-
case 0 /* Debug */:
|
|
726
|
-
console.debug(message);
|
|
727
|
-
break;
|
|
728
|
-
case 1 /* Info */:
|
|
729
|
-
console.info(message);
|
|
730
|
-
break;
|
|
731
|
-
case 2 /* Warning */:
|
|
732
|
-
console.warn(message);
|
|
733
|
-
break;
|
|
734
|
-
case 3 /* Error */:
|
|
735
|
-
case 4 /* Fatal */:
|
|
736
|
-
console.error(message);
|
|
737
|
-
break;
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
// ../../lib/diagnostics/src/null-reporter.ts
|
|
743
|
-
var nullReporter = {
|
|
744
|
-
report() {
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
|
|
748
|
-
// ../../lib/diagnostics/src/presets.ts
|
|
749
|
-
var ignoreAllPolicy = {
|
|
750
|
-
resolve(_) {
|
|
751
|
-
return 0 /* Ignore */;
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
|
-
var warnOnlyReporter = {
|
|
755
|
-
report(diagnostic) {
|
|
756
|
-
console.warn(formatDiagnostic(diagnostic));
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
var silentDiagnostics = new Diagnostics(nullReporter, ignoreAllPolicy);
|
|
760
|
-
var warnDiagnostics = new Diagnostics(
|
|
761
|
-
warnOnlyReporter,
|
|
762
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 4 /* Fatal */ })
|
|
763
|
-
);
|
|
764
|
-
var throwDiagnostics = new Diagnostics(
|
|
765
|
-
new ConsoleReporter(),
|
|
766
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 3 /* Error */ })
|
|
767
|
-
);
|
|
768
|
-
|
|
769
630
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
631
|
+
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
770
632
|
var AriaDiagnostics = {
|
|
771
633
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
772
634
|
fromViolation(v) {
|
|
773
635
|
return {
|
|
774
|
-
code:
|
|
775
|
-
category:
|
|
636
|
+
code: DiagnosticCode.AriaViolation,
|
|
637
|
+
category: DiagnosticCategory.ARIA,
|
|
776
638
|
message: v.message
|
|
777
639
|
};
|
|
778
640
|
},
|
|
779
641
|
attributeInvalid(key, role) {
|
|
780
642
|
return {
|
|
781
|
-
code:
|
|
782
|
-
category:
|
|
643
|
+
code: DiagnosticCode.AriaAttributeInvalid,
|
|
644
|
+
category: DiagnosticCategory.ARIA,
|
|
783
645
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
784
646
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
785
647
|
suggestions: [
|
|
@@ -792,8 +654,8 @@ var AriaDiagnostics = {
|
|
|
792
654
|
},
|
|
793
655
|
missingLiveRegion(role, impliedLive) {
|
|
794
656
|
return {
|
|
795
|
-
code:
|
|
796
|
-
category:
|
|
657
|
+
code: DiagnosticCode.AriaMissingLiveRegion,
|
|
658
|
+
category: DiagnosticCategory.ARIA,
|
|
797
659
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
798
660
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
799
661
|
suggestions: [
|
|
@@ -807,8 +669,8 @@ var AriaDiagnostics = {
|
|
|
807
669
|
},
|
|
808
670
|
missingAtomic(role) {
|
|
809
671
|
return {
|
|
810
|
-
code:
|
|
811
|
-
category:
|
|
672
|
+
code: DiagnosticCode.AriaMissingAtomic,
|
|
673
|
+
category: DiagnosticCategory.ARIA,
|
|
812
674
|
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.`,
|
|
813
675
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
814
676
|
};
|
|
@@ -816,8 +678,8 @@ var AriaDiagnostics = {
|
|
|
816
678
|
relevantInvalidTokens(invalid) {
|
|
817
679
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
818
680
|
return {
|
|
819
|
-
code:
|
|
820
|
-
category:
|
|
681
|
+
code: DiagnosticCode.AriaRelevantInvalidToken,
|
|
682
|
+
category: DiagnosticCategory.ARIA,
|
|
821
683
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
822
684
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
823
685
|
suggestions: [
|
|
@@ -830,8 +692,8 @@ var AriaDiagnostics = {
|
|
|
830
692
|
},
|
|
831
693
|
relevantSuperseded() {
|
|
832
694
|
return {
|
|
833
|
-
code:
|
|
834
|
-
category:
|
|
695
|
+
code: DiagnosticCode.AriaRelevantSuperseded,
|
|
696
|
+
category: DiagnosticCategory.ARIA,
|
|
835
697
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
836
698
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
837
699
|
suggestions: [
|
|
@@ -844,8 +706,8 @@ var AriaDiagnostics = {
|
|
|
844
706
|
},
|
|
845
707
|
missingAccessibleName(tag) {
|
|
846
708
|
return {
|
|
847
|
-
code:
|
|
848
|
-
category:
|
|
709
|
+
code: DiagnosticCode.AriaMissingAccessibleName,
|
|
710
|
+
category: DiagnosticCategory.ARIA,
|
|
849
711
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
850
712
|
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.",
|
|
851
713
|
suggestions: [
|
|
@@ -862,8 +724,8 @@ var AriaDiagnostics = {
|
|
|
862
724
|
},
|
|
863
725
|
attributeOnPresentational(attr, tag) {
|
|
864
726
|
return {
|
|
865
|
-
code:
|
|
866
|
-
category:
|
|
727
|
+
code: DiagnosticCode.AriaAttributeOnPresentational,
|
|
728
|
+
category: DiagnosticCategory.ARIA,
|
|
867
729
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
868
730
|
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.',
|
|
869
731
|
suggestions: [
|
|
@@ -876,8 +738,8 @@ var AriaDiagnostics = {
|
|
|
876
738
|
},
|
|
877
739
|
ariaHiddenOnFocusable(tag) {
|
|
878
740
|
return {
|
|
879
|
-
code:
|
|
880
|
-
category:
|
|
741
|
+
code: DiagnosticCode.AriaHiddenOnFocusable,
|
|
742
|
+
category: DiagnosticCategory.ARIA,
|
|
881
743
|
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.`,
|
|
882
744
|
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.',
|
|
883
745
|
suggestions: [
|
|
@@ -895,8 +757,8 @@ var AriaDiagnostics = {
|
|
|
895
757
|
invalidAttributeValue(attr, value, expected) {
|
|
896
758
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
897
759
|
return {
|
|
898
|
-
code:
|
|
899
|
-
category:
|
|
760
|
+
code: DiagnosticCode.AriaInvalidAttributeValue,
|
|
761
|
+
category: DiagnosticCategory.ARIA,
|
|
900
762
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
901
763
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
902
764
|
suggestions: [
|
|
@@ -909,8 +771,8 @@ var AriaDiagnostics = {
|
|
|
909
771
|
},
|
|
910
772
|
redundantAriaLevel(tag, level) {
|
|
911
773
|
return {
|
|
912
|
-
code:
|
|
913
|
-
category:
|
|
774
|
+
code: DiagnosticCode.AriaRedundantLevelAttribute,
|
|
775
|
+
category: DiagnosticCategory.ARIA,
|
|
914
776
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
915
777
|
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>).',
|
|
916
778
|
suggestions: [
|
|
@@ -923,8 +785,8 @@ var AriaDiagnostics = {
|
|
|
923
785
|
},
|
|
924
786
|
requiredProperty(attr, role) {
|
|
925
787
|
return {
|
|
926
|
-
code:
|
|
927
|
-
category:
|
|
788
|
+
code: DiagnosticCode.AriaRequiredProperty,
|
|
789
|
+
category: DiagnosticCategory.ARIA,
|
|
928
790
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
929
791
|
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.`,
|
|
930
792
|
suggestions: [
|
|
@@ -937,8 +799,8 @@ var AriaDiagnostics = {
|
|
|
937
799
|
},
|
|
938
800
|
invalidRole(role, tag) {
|
|
939
801
|
return {
|
|
940
|
-
code:
|
|
941
|
-
category:
|
|
802
|
+
code: DiagnosticCode.AriaInvalidRole,
|
|
803
|
+
category: DiagnosticCategory.ARIA,
|
|
942
804
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
943
805
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
944
806
|
};
|
|
@@ -946,11 +808,12 @@ var AriaDiagnostics = {
|
|
|
946
808
|
};
|
|
947
809
|
|
|
948
810
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
811
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
949
812
|
var ContractDiagnostics = {
|
|
950
813
|
unexpectedChild(typeName, index, context) {
|
|
951
814
|
return {
|
|
952
|
-
code:
|
|
953
|
-
category:
|
|
815
|
+
code: DiagnosticCode2.UnexpectedChild,
|
|
816
|
+
category: DiagnosticCategory2.Contract,
|
|
954
817
|
component: context,
|
|
955
818
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
956
819
|
};
|
|
@@ -958,69 +821,69 @@ var ContractDiagnostics = {
|
|
|
958
821
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
959
822
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
960
823
|
return {
|
|
961
|
-
code:
|
|
962
|
-
category:
|
|
824
|
+
code: DiagnosticCode2.AmbiguousChild,
|
|
825
|
+
category: DiagnosticCategory2.Contract,
|
|
963
826
|
component: context,
|
|
964
827
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
965
828
|
};
|
|
966
829
|
},
|
|
967
830
|
cardinalityMin(ruleName, min, context) {
|
|
968
831
|
return {
|
|
969
|
-
code:
|
|
970
|
-
category:
|
|
832
|
+
code: DiagnosticCode2.CardinalityMin,
|
|
833
|
+
category: DiagnosticCategory2.Contract,
|
|
971
834
|
component: context,
|
|
972
835
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
973
836
|
};
|
|
974
837
|
},
|
|
975
838
|
cardinalityMax(ruleName, max, context) {
|
|
976
839
|
return {
|
|
977
|
-
code:
|
|
978
|
-
category:
|
|
840
|
+
code: DiagnosticCode2.CardinalityMax,
|
|
841
|
+
category: DiagnosticCategory2.Contract,
|
|
979
842
|
component: context,
|
|
980
843
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
981
844
|
};
|
|
982
845
|
},
|
|
983
846
|
positionViolation(ruleName, position, index, context) {
|
|
984
847
|
return {
|
|
985
|
-
code:
|
|
986
|
-
category:
|
|
848
|
+
code: DiagnosticCode2.PositionViolation,
|
|
849
|
+
category: DiagnosticCategory2.Contract,
|
|
987
850
|
component: context,
|
|
988
851
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
989
852
|
};
|
|
990
853
|
},
|
|
991
854
|
unknownVariantDim(component, label2, dim) {
|
|
992
855
|
return {
|
|
993
|
-
code:
|
|
994
|
-
category:
|
|
856
|
+
code: DiagnosticCode2.ContractUnknownVariantDim,
|
|
857
|
+
category: DiagnosticCategory2.Contract,
|
|
995
858
|
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
996
859
|
};
|
|
997
860
|
},
|
|
998
861
|
unknownVariantValue(component, label2, dim, value, valid) {
|
|
999
862
|
return {
|
|
1000
|
-
code:
|
|
1001
|
-
category:
|
|
863
|
+
code: DiagnosticCode2.ContractUnknownVariantValue,
|
|
864
|
+
category: DiagnosticCategory2.Contract,
|
|
1002
865
|
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
1003
866
|
};
|
|
1004
867
|
},
|
|
1005
868
|
unknownRecipeKey(component, key) {
|
|
1006
869
|
return {
|
|
1007
|
-
code:
|
|
1008
|
-
category:
|
|
870
|
+
code: DiagnosticCode2.ContractUnknownRecipeKey,
|
|
871
|
+
category: DiagnosticCategory2.Contract,
|
|
1009
872
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
1010
873
|
};
|
|
1011
874
|
},
|
|
1012
875
|
invalidVariantValue(component, key, value) {
|
|
1013
876
|
return {
|
|
1014
|
-
code:
|
|
1015
|
-
category:
|
|
877
|
+
code: DiagnosticCode2.ContractInvalidVariantValue,
|
|
878
|
+
category: DiagnosticCategory2.Contract,
|
|
1016
879
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
1017
880
|
};
|
|
1018
881
|
},
|
|
1019
882
|
allowedAsViolation(tag, allowedAs, component) {
|
|
1020
883
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
1021
884
|
return {
|
|
1022
|
-
code:
|
|
1023
|
-
category:
|
|
885
|
+
code: DiagnosticCode2.AllowedAsViolation,
|
|
886
|
+
category: DiagnosticCategory2.Contract,
|
|
1024
887
|
component,
|
|
1025
888
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
1026
889
|
};
|
|
@@ -1028,73 +891,75 @@ var ContractDiagnostics = {
|
|
|
1028
891
|
};
|
|
1029
892
|
|
|
1030
893
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
894
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
1031
895
|
var HtmlDiagnostics = {
|
|
1032
896
|
emptyRole(tag) {
|
|
1033
897
|
return {
|
|
1034
|
-
code:
|
|
1035
|
-
category:
|
|
898
|
+
code: DiagnosticCode3.HtmlEmptyRole,
|
|
899
|
+
category: DiagnosticCategory3.HTML,
|
|
1036
900
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
1037
901
|
};
|
|
1038
902
|
},
|
|
1039
903
|
implicitRoleRedundant(tag, implicitRole) {
|
|
1040
904
|
return {
|
|
1041
|
-
code:
|
|
1042
|
-
category:
|
|
905
|
+
code: DiagnosticCode3.HtmlImplicitRoleRedundant,
|
|
906
|
+
category: DiagnosticCategory3.HTML,
|
|
1043
907
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
1044
908
|
};
|
|
1045
909
|
},
|
|
1046
910
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
1047
911
|
return {
|
|
1048
|
-
code:
|
|
1049
|
-
category:
|
|
912
|
+
code: DiagnosticCode3.HtmlImplicitRoleOverride,
|
|
913
|
+
category: DiagnosticCategory3.HTML,
|
|
1050
914
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
1051
915
|
};
|
|
1052
916
|
},
|
|
1053
917
|
standaloneRegionOverride(tag, implicitRole) {
|
|
1054
918
|
return {
|
|
1055
|
-
code:
|
|
1056
|
-
category:
|
|
919
|
+
code: DiagnosticCode3.HtmlStandaloneRegionOverride,
|
|
920
|
+
category: DiagnosticCategory3.HTML,
|
|
1057
921
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
1058
922
|
};
|
|
1059
923
|
},
|
|
1060
924
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
1061
925
|
return {
|
|
1062
|
-
code:
|
|
1063
|
-
category:
|
|
926
|
+
code: DiagnosticCode3.HtmlLandmarkRoleOverride,
|
|
927
|
+
category: DiagnosticCategory3.HTML,
|
|
1064
928
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1065
929
|
};
|
|
1066
930
|
},
|
|
1067
931
|
invalidChild(child, parent, allowed) {
|
|
1068
932
|
return {
|
|
1069
|
-
code:
|
|
1070
|
-
category:
|
|
933
|
+
code: DiagnosticCode3.HtmlInvalidChild,
|
|
934
|
+
category: DiagnosticCategory3.HTML,
|
|
1071
935
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
1072
936
|
};
|
|
1073
937
|
}
|
|
1074
938
|
};
|
|
1075
939
|
|
|
1076
940
|
// ../../lib/contract/src/diagnostics/slot.ts
|
|
941
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
1077
942
|
var SlotDiagnostics = {
|
|
1078
943
|
exclusive(name) {
|
|
1079
944
|
return {
|
|
1080
|
-
code:
|
|
1081
|
-
category:
|
|
945
|
+
code: DiagnosticCode4.SlotExclusive,
|
|
946
|
+
category: DiagnosticCategory4.Contract,
|
|
1082
947
|
component: name,
|
|
1083
948
|
message: `${name}: "as" and "asChild" are mutually exclusive`
|
|
1084
949
|
};
|
|
1085
950
|
},
|
|
1086
951
|
singleChildRequired(name, elementTerm) {
|
|
1087
952
|
return {
|
|
1088
|
-
code:
|
|
1089
|
-
category:
|
|
953
|
+
code: DiagnosticCode4.SlotSingleChild,
|
|
954
|
+
category: DiagnosticCategory4.Contract,
|
|
1090
955
|
component: name,
|
|
1091
956
|
message: `${name}: asChild requires a ${elementTerm} child`
|
|
1092
957
|
};
|
|
1093
958
|
},
|
|
1094
959
|
singleChildExceeded(name, elementTerm, count) {
|
|
1095
960
|
return {
|
|
1096
|
-
code:
|
|
1097
|
-
category:
|
|
961
|
+
code: DiagnosticCode4.SlotSingleChild,
|
|
962
|
+
category: DiagnosticCategory4.Contract,
|
|
1098
963
|
component: name,
|
|
1099
964
|
message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
|
|
1100
965
|
};
|
|
@@ -1102,16 +967,16 @@ var SlotDiagnostics = {
|
|
|
1102
967
|
discardedChildren(name, elementTerm, count) {
|
|
1103
968
|
const suffix = count === 1 ? "" : "ren";
|
|
1104
969
|
return {
|
|
1105
|
-
code:
|
|
1106
|
-
category:
|
|
970
|
+
code: DiagnosticCode4.SlotDiscardedChildren,
|
|
971
|
+
category: DiagnosticCategory4.Contract,
|
|
1107
972
|
component: name,
|
|
1108
973
|
message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
|
|
1109
974
|
};
|
|
1110
975
|
},
|
|
1111
976
|
renderFnRequired(name, received) {
|
|
1112
977
|
return {
|
|
1113
|
-
code:
|
|
1114
|
-
category:
|
|
978
|
+
code: DiagnosticCode4.SlotRenderFn,
|
|
979
|
+
category: DiagnosticCategory4.Contract,
|
|
1115
980
|
component: name,
|
|
1116
981
|
message: `${name}: asChild requires a render function as children, got ${received}`
|
|
1117
982
|
};
|
|
@@ -2276,6 +2141,7 @@ function createClassPipeline(resolved) {
|
|
|
2276
2141
|
}
|
|
2277
2142
|
|
|
2278
2143
|
// ../core/src/options/resolve-factory-options.ts
|
|
2144
|
+
import { silentDiagnostics } from "../_shared/diagnostics.js";
|
|
2279
2145
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
2280
2146
|
function composeNormalizers(normalizers, fn) {
|
|
2281
2147
|
if (!normalizers?.length) return fn;
|
|
@@ -2367,21 +2233,25 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
|
2367
2233
|
}
|
|
2368
2234
|
}
|
|
2369
2235
|
|
|
2236
|
+
// ../core/src/factory/plugin-invariants.ts
|
|
2237
|
+
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
2238
|
+
|
|
2370
2239
|
// ../core/src/factory/plugin-diagnostics.ts
|
|
2240
|
+
import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
|
|
2371
2241
|
var PluginDiagnostics = {
|
|
2372
2242
|
invalidShape(received) {
|
|
2373
2243
|
const got = received === null ? "null" : typeof received;
|
|
2374
2244
|
return {
|
|
2375
|
-
code:
|
|
2376
|
-
category:
|
|
2245
|
+
code: DiagnosticCode5.PluginInvalidShape,
|
|
2246
|
+
category: DiagnosticCategory5.Internal,
|
|
2377
2247
|
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
2378
2248
|
};
|
|
2379
2249
|
},
|
|
2380
2250
|
pipelineReturnType(received) {
|
|
2381
2251
|
const got = received === null ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
2382
2252
|
return {
|
|
2383
|
-
code:
|
|
2384
|
-
category:
|
|
2253
|
+
code: DiagnosticCode5.PluginPipelineReturnType,
|
|
2254
|
+
category: DiagnosticCategory5.Internal,
|
|
2385
2255
|
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
2386
2256
|
};
|
|
2387
2257
|
}
|
|
@@ -2510,7 +2380,8 @@ function composeFilter(ownedKeys, filterProps) {
|
|
|
2510
2380
|
}
|
|
2511
2381
|
|
|
2512
2382
|
// ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
|
|
2513
|
-
|
|
2383
|
+
import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2384
|
+
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
|
|
2514
2385
|
return {
|
|
2515
2386
|
name: options.name ?? defaultName,
|
|
2516
2387
|
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|