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/vue/index.js
CHANGED
|
@@ -553,159 +553,21 @@ var InvariantBase = class {
|
|
|
553
553
|
}
|
|
554
554
|
};
|
|
555
555
|
|
|
556
|
-
// ../../lib/diagnostics/src/category.ts
|
|
557
|
-
var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => {
|
|
558
|
-
DiagnosticCategory2[DiagnosticCategory2["Contract"] = 0] = "Contract";
|
|
559
|
-
DiagnosticCategory2[DiagnosticCategory2["HTML"] = 1] = "HTML";
|
|
560
|
-
DiagnosticCategory2[DiagnosticCategory2["ARIA"] = 2] = "ARIA";
|
|
561
|
-
DiagnosticCategory2[DiagnosticCategory2["Composition"] = 3] = "Composition";
|
|
562
|
-
DiagnosticCategory2[DiagnosticCategory2["Rendering"] = 4] = "Rendering";
|
|
563
|
-
DiagnosticCategory2[DiagnosticCategory2["Accessibility"] = 5] = "Accessibility";
|
|
564
|
-
DiagnosticCategory2[DiagnosticCategory2["Performance"] = 6] = "Performance";
|
|
565
|
-
DiagnosticCategory2[DiagnosticCategory2["Internal"] = 7] = "Internal";
|
|
566
|
-
DiagnosticCategory2[DiagnosticCategory2["Deprecation"] = 8] = "Deprecation";
|
|
567
|
-
DiagnosticCategory2[DiagnosticCategory2["Lint"] = 9] = "Lint";
|
|
568
|
-
return DiagnosticCategory2;
|
|
569
|
-
})(DiagnosticCategory || {});
|
|
570
|
-
|
|
571
|
-
// ../../lib/diagnostics/src/error.ts
|
|
572
|
-
var PraxisError = class extends Error {
|
|
573
|
-
diagnostic;
|
|
574
|
-
constructor(diagnostic) {
|
|
575
|
-
super(diagnostic.message);
|
|
576
|
-
this.name = "PraxisError";
|
|
577
|
-
this.diagnostic = diagnostic;
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
// ../../lib/diagnostics/src/severity.ts
|
|
582
|
-
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
583
|
-
Severity2[Severity2["Debug"] = 0] = "Debug";
|
|
584
|
-
Severity2[Severity2["Info"] = 1] = "Info";
|
|
585
|
-
Severity2[Severity2["Warning"] = 2] = "Warning";
|
|
586
|
-
Severity2[Severity2["Error"] = 3] = "Error";
|
|
587
|
-
Severity2[Severity2["Fatal"] = 4] = "Fatal";
|
|
588
|
-
return Severity2;
|
|
589
|
-
})(Severity || {});
|
|
590
|
-
|
|
591
|
-
// ../../lib/diagnostics/src/policy.ts
|
|
592
|
-
var DefaultPolicy = class {
|
|
593
|
-
reportThreshold;
|
|
594
|
-
throwThreshold;
|
|
595
|
-
constructor({
|
|
596
|
-
reportThreshold = 1 /* Info */,
|
|
597
|
-
throwThreshold = 4 /* Fatal */
|
|
598
|
-
} = {}) {
|
|
599
|
-
this.reportThreshold = reportThreshold;
|
|
600
|
-
this.throwThreshold = throwThreshold;
|
|
601
|
-
}
|
|
602
|
-
resolve(diagnostic) {
|
|
603
|
-
if (diagnostic.severity >= this.throwThreshold) return 2 /* Throw */;
|
|
604
|
-
if (diagnostic.severity >= this.reportThreshold) return 1 /* Report */;
|
|
605
|
-
return 0 /* Ignore */;
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
// ../../lib/diagnostics/src/diagnostics.ts
|
|
610
|
-
var Diagnostics = class {
|
|
611
|
-
reporter;
|
|
612
|
-
policy;
|
|
613
|
-
// Pre-computed at construction time: true if Warning-level diagnostics are not ignored.
|
|
614
|
-
active;
|
|
615
|
-
constructor(reporter, policy = new DefaultPolicy()) {
|
|
616
|
-
this.reporter = reporter;
|
|
617
|
-
this.policy = policy;
|
|
618
|
-
this.active = policy.resolve({ severity: 2 /* Warning */ }) !== 0 /* Ignore */;
|
|
619
|
-
}
|
|
620
|
-
report(diagnostic) {
|
|
621
|
-
const enforcement = this.policy.resolve(diagnostic);
|
|
622
|
-
if (enforcement === 0 /* Ignore */) return diagnostic;
|
|
623
|
-
if (enforcement === 2 /* Throw */) throw new PraxisError(diagnostic);
|
|
624
|
-
this.reporter.report(diagnostic);
|
|
625
|
-
return diagnostic;
|
|
626
|
-
}
|
|
627
|
-
warn(input) {
|
|
628
|
-
return this.report({ ...input, severity: 2 /* Warning */ });
|
|
629
|
-
}
|
|
630
|
-
error(input) {
|
|
631
|
-
return this.report({ ...input, severity: 3 /* Error */ });
|
|
632
|
-
}
|
|
633
|
-
info(input) {
|
|
634
|
-
return this.report({ ...input, severity: 1 /* Info */ });
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
|
|
638
|
-
// ../../lib/diagnostics/src/formatter.ts
|
|
639
|
-
function formatDiagnostic(diagnostic) {
|
|
640
|
-
const level = Severity[diagnostic.severity];
|
|
641
|
-
const category = DiagnosticCategory[diagnostic.category];
|
|
642
|
-
const prefix = category !== void 0 ? `[${category}] ` : "";
|
|
643
|
-
return `${level} ${diagnostic.code}: ${prefix}${diagnostic.message}`;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// ../../lib/diagnostics/src/console-reporter.ts
|
|
647
|
-
var ConsoleReporter = class {
|
|
648
|
-
report(diagnostic) {
|
|
649
|
-
const message = formatDiagnostic(diagnostic);
|
|
650
|
-
switch (diagnostic.severity) {
|
|
651
|
-
case 0 /* Debug */:
|
|
652
|
-
console.debug(message);
|
|
653
|
-
break;
|
|
654
|
-
case 1 /* Info */:
|
|
655
|
-
console.info(message);
|
|
656
|
-
break;
|
|
657
|
-
case 2 /* Warning */:
|
|
658
|
-
console.warn(message);
|
|
659
|
-
break;
|
|
660
|
-
case 3 /* Error */:
|
|
661
|
-
case 4 /* Fatal */:
|
|
662
|
-
console.error(message);
|
|
663
|
-
break;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
// ../../lib/diagnostics/src/null-reporter.ts
|
|
669
|
-
var nullReporter = {
|
|
670
|
-
report() {
|
|
671
|
-
}
|
|
672
|
-
};
|
|
673
|
-
|
|
674
|
-
// ../../lib/diagnostics/src/presets.ts
|
|
675
|
-
var ignoreAllPolicy = {
|
|
676
|
-
resolve(_) {
|
|
677
|
-
return 0 /* Ignore */;
|
|
678
|
-
}
|
|
679
|
-
};
|
|
680
|
-
var warnOnlyReporter = {
|
|
681
|
-
report(diagnostic) {
|
|
682
|
-
console.warn(formatDiagnostic(diagnostic));
|
|
683
|
-
}
|
|
684
|
-
};
|
|
685
|
-
var silentDiagnostics = new Diagnostics(nullReporter, ignoreAllPolicy);
|
|
686
|
-
var warnDiagnostics = new Diagnostics(
|
|
687
|
-
warnOnlyReporter,
|
|
688
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 4 /* Fatal */ })
|
|
689
|
-
);
|
|
690
|
-
var throwDiagnostics = new Diagnostics(
|
|
691
|
-
new ConsoleReporter(),
|
|
692
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 3 /* Error */ })
|
|
693
|
-
);
|
|
694
|
-
|
|
695
556
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
557
|
+
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
696
558
|
var AriaDiagnostics = {
|
|
697
559
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
698
560
|
fromViolation(v) {
|
|
699
561
|
return {
|
|
700
|
-
code:
|
|
701
|
-
category:
|
|
562
|
+
code: DiagnosticCode.AriaViolation,
|
|
563
|
+
category: DiagnosticCategory.ARIA,
|
|
702
564
|
message: v.message
|
|
703
565
|
};
|
|
704
566
|
},
|
|
705
567
|
attributeInvalid(key, role) {
|
|
706
568
|
return {
|
|
707
|
-
code:
|
|
708
|
-
category:
|
|
569
|
+
code: DiagnosticCode.AriaAttributeInvalid,
|
|
570
|
+
category: DiagnosticCategory.ARIA,
|
|
709
571
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
710
572
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
711
573
|
suggestions: [
|
|
@@ -718,8 +580,8 @@ var AriaDiagnostics = {
|
|
|
718
580
|
},
|
|
719
581
|
missingLiveRegion(role, impliedLive) {
|
|
720
582
|
return {
|
|
721
|
-
code:
|
|
722
|
-
category:
|
|
583
|
+
code: DiagnosticCode.AriaMissingLiveRegion,
|
|
584
|
+
category: DiagnosticCategory.ARIA,
|
|
723
585
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
724
586
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
725
587
|
suggestions: [
|
|
@@ -733,8 +595,8 @@ var AriaDiagnostics = {
|
|
|
733
595
|
},
|
|
734
596
|
missingAtomic(role) {
|
|
735
597
|
return {
|
|
736
|
-
code:
|
|
737
|
-
category:
|
|
598
|
+
code: DiagnosticCode.AriaMissingAtomic,
|
|
599
|
+
category: DiagnosticCategory.ARIA,
|
|
738
600
|
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.`,
|
|
739
601
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
740
602
|
};
|
|
@@ -742,8 +604,8 @@ var AriaDiagnostics = {
|
|
|
742
604
|
relevantInvalidTokens(invalid) {
|
|
743
605
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
744
606
|
return {
|
|
745
|
-
code:
|
|
746
|
-
category:
|
|
607
|
+
code: DiagnosticCode.AriaRelevantInvalidToken,
|
|
608
|
+
category: DiagnosticCategory.ARIA,
|
|
747
609
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
748
610
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
749
611
|
suggestions: [
|
|
@@ -756,8 +618,8 @@ var AriaDiagnostics = {
|
|
|
756
618
|
},
|
|
757
619
|
relevantSuperseded() {
|
|
758
620
|
return {
|
|
759
|
-
code:
|
|
760
|
-
category:
|
|
621
|
+
code: DiagnosticCode.AriaRelevantSuperseded,
|
|
622
|
+
category: DiagnosticCategory.ARIA,
|
|
761
623
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
762
624
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
763
625
|
suggestions: [
|
|
@@ -770,8 +632,8 @@ var AriaDiagnostics = {
|
|
|
770
632
|
},
|
|
771
633
|
missingAccessibleName(tag) {
|
|
772
634
|
return {
|
|
773
|
-
code:
|
|
774
|
-
category:
|
|
635
|
+
code: DiagnosticCode.AriaMissingAccessibleName,
|
|
636
|
+
category: DiagnosticCategory.ARIA,
|
|
775
637
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
776
638
|
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.",
|
|
777
639
|
suggestions: [
|
|
@@ -788,8 +650,8 @@ var AriaDiagnostics = {
|
|
|
788
650
|
},
|
|
789
651
|
attributeOnPresentational(attr, tag) {
|
|
790
652
|
return {
|
|
791
|
-
code:
|
|
792
|
-
category:
|
|
653
|
+
code: DiagnosticCode.AriaAttributeOnPresentational,
|
|
654
|
+
category: DiagnosticCategory.ARIA,
|
|
793
655
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
794
656
|
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.',
|
|
795
657
|
suggestions: [
|
|
@@ -802,8 +664,8 @@ var AriaDiagnostics = {
|
|
|
802
664
|
},
|
|
803
665
|
ariaHiddenOnFocusable(tag) {
|
|
804
666
|
return {
|
|
805
|
-
code:
|
|
806
|
-
category:
|
|
667
|
+
code: DiagnosticCode.AriaHiddenOnFocusable,
|
|
668
|
+
category: DiagnosticCategory.ARIA,
|
|
807
669
|
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.`,
|
|
808
670
|
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.',
|
|
809
671
|
suggestions: [
|
|
@@ -821,8 +683,8 @@ var AriaDiagnostics = {
|
|
|
821
683
|
invalidAttributeValue(attr, value, expected) {
|
|
822
684
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
823
685
|
return {
|
|
824
|
-
code:
|
|
825
|
-
category:
|
|
686
|
+
code: DiagnosticCode.AriaInvalidAttributeValue,
|
|
687
|
+
category: DiagnosticCategory.ARIA,
|
|
826
688
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
827
689
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
828
690
|
suggestions: [
|
|
@@ -835,8 +697,8 @@ var AriaDiagnostics = {
|
|
|
835
697
|
},
|
|
836
698
|
redundantAriaLevel(tag, level) {
|
|
837
699
|
return {
|
|
838
|
-
code:
|
|
839
|
-
category:
|
|
700
|
+
code: DiagnosticCode.AriaRedundantLevelAttribute,
|
|
701
|
+
category: DiagnosticCategory.ARIA,
|
|
840
702
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
841
703
|
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>).',
|
|
842
704
|
suggestions: [
|
|
@@ -849,8 +711,8 @@ var AriaDiagnostics = {
|
|
|
849
711
|
},
|
|
850
712
|
requiredProperty(attr, role) {
|
|
851
713
|
return {
|
|
852
|
-
code:
|
|
853
|
-
category:
|
|
714
|
+
code: DiagnosticCode.AriaRequiredProperty,
|
|
715
|
+
category: DiagnosticCategory.ARIA,
|
|
854
716
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
855
717
|
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.`,
|
|
856
718
|
suggestions: [
|
|
@@ -863,8 +725,8 @@ var AriaDiagnostics = {
|
|
|
863
725
|
},
|
|
864
726
|
invalidRole(role, tag) {
|
|
865
727
|
return {
|
|
866
|
-
code:
|
|
867
|
-
category:
|
|
728
|
+
code: DiagnosticCode.AriaInvalidRole,
|
|
729
|
+
category: DiagnosticCategory.ARIA,
|
|
868
730
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
869
731
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
870
732
|
};
|
|
@@ -872,11 +734,12 @@ var AriaDiagnostics = {
|
|
|
872
734
|
};
|
|
873
735
|
|
|
874
736
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
737
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
875
738
|
var ContractDiagnostics = {
|
|
876
739
|
unexpectedChild(typeName, index, context) {
|
|
877
740
|
return {
|
|
878
|
-
code:
|
|
879
|
-
category:
|
|
741
|
+
code: DiagnosticCode2.UnexpectedChild,
|
|
742
|
+
category: DiagnosticCategory2.Contract,
|
|
880
743
|
component: context,
|
|
881
744
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
882
745
|
};
|
|
@@ -884,69 +747,69 @@ var ContractDiagnostics = {
|
|
|
884
747
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
885
748
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
886
749
|
return {
|
|
887
|
-
code:
|
|
888
|
-
category:
|
|
750
|
+
code: DiagnosticCode2.AmbiguousChild,
|
|
751
|
+
category: DiagnosticCategory2.Contract,
|
|
889
752
|
component: context,
|
|
890
753
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
891
754
|
};
|
|
892
755
|
},
|
|
893
756
|
cardinalityMin(ruleName, min, context) {
|
|
894
757
|
return {
|
|
895
|
-
code:
|
|
896
|
-
category:
|
|
758
|
+
code: DiagnosticCode2.CardinalityMin,
|
|
759
|
+
category: DiagnosticCategory2.Contract,
|
|
897
760
|
component: context,
|
|
898
761
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
899
762
|
};
|
|
900
763
|
},
|
|
901
764
|
cardinalityMax(ruleName, max, context) {
|
|
902
765
|
return {
|
|
903
|
-
code:
|
|
904
|
-
category:
|
|
766
|
+
code: DiagnosticCode2.CardinalityMax,
|
|
767
|
+
category: DiagnosticCategory2.Contract,
|
|
905
768
|
component: context,
|
|
906
769
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
907
770
|
};
|
|
908
771
|
},
|
|
909
772
|
positionViolation(ruleName, position, index, context) {
|
|
910
773
|
return {
|
|
911
|
-
code:
|
|
912
|
-
category:
|
|
774
|
+
code: DiagnosticCode2.PositionViolation,
|
|
775
|
+
category: DiagnosticCategory2.Contract,
|
|
913
776
|
component: context,
|
|
914
777
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
915
778
|
};
|
|
916
779
|
},
|
|
917
780
|
unknownVariantDim(component, label, dim) {
|
|
918
781
|
return {
|
|
919
|
-
code:
|
|
920
|
-
category:
|
|
782
|
+
code: DiagnosticCode2.ContractUnknownVariantDim,
|
|
783
|
+
category: DiagnosticCategory2.Contract,
|
|
921
784
|
message: `${component}: ${label} references unknown variant "${dim}".`
|
|
922
785
|
};
|
|
923
786
|
},
|
|
924
787
|
unknownVariantValue(component, label, dim, value, valid) {
|
|
925
788
|
return {
|
|
926
|
-
code:
|
|
927
|
-
category:
|
|
789
|
+
code: DiagnosticCode2.ContractUnknownVariantValue,
|
|
790
|
+
category: DiagnosticCategory2.Contract,
|
|
928
791
|
message: `${component}: ${label} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
929
792
|
};
|
|
930
793
|
},
|
|
931
794
|
unknownRecipeKey(component, key) {
|
|
932
795
|
return {
|
|
933
|
-
code:
|
|
934
|
-
category:
|
|
796
|
+
code: DiagnosticCode2.ContractUnknownRecipeKey,
|
|
797
|
+
category: DiagnosticCategory2.Contract,
|
|
935
798
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
936
799
|
};
|
|
937
800
|
},
|
|
938
801
|
invalidVariantValue(component, key, value) {
|
|
939
802
|
return {
|
|
940
|
-
code:
|
|
941
|
-
category:
|
|
803
|
+
code: DiagnosticCode2.ContractInvalidVariantValue,
|
|
804
|
+
category: DiagnosticCategory2.Contract,
|
|
942
805
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
943
806
|
};
|
|
944
807
|
},
|
|
945
808
|
allowedAsViolation(tag, allowedAs, component) {
|
|
946
809
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
947
810
|
return {
|
|
948
|
-
code:
|
|
949
|
-
category:
|
|
811
|
+
code: DiagnosticCode2.AllowedAsViolation,
|
|
812
|
+
category: DiagnosticCategory2.Contract,
|
|
950
813
|
component,
|
|
951
814
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
952
815
|
};
|
|
@@ -954,73 +817,75 @@ var ContractDiagnostics = {
|
|
|
954
817
|
};
|
|
955
818
|
|
|
956
819
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
820
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
957
821
|
var HtmlDiagnostics = {
|
|
958
822
|
emptyRole(tag) {
|
|
959
823
|
return {
|
|
960
|
-
code:
|
|
961
|
-
category:
|
|
824
|
+
code: DiagnosticCode3.HtmlEmptyRole,
|
|
825
|
+
category: DiagnosticCategory3.HTML,
|
|
962
826
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
963
827
|
};
|
|
964
828
|
},
|
|
965
829
|
implicitRoleRedundant(tag, implicitRole) {
|
|
966
830
|
return {
|
|
967
|
-
code:
|
|
968
|
-
category:
|
|
831
|
+
code: DiagnosticCode3.HtmlImplicitRoleRedundant,
|
|
832
|
+
category: DiagnosticCategory3.HTML,
|
|
969
833
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
970
834
|
};
|
|
971
835
|
},
|
|
972
836
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
973
837
|
return {
|
|
974
|
-
code:
|
|
975
|
-
category:
|
|
838
|
+
code: DiagnosticCode3.HtmlImplicitRoleOverride,
|
|
839
|
+
category: DiagnosticCategory3.HTML,
|
|
976
840
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
977
841
|
};
|
|
978
842
|
},
|
|
979
843
|
standaloneRegionOverride(tag, implicitRole) {
|
|
980
844
|
return {
|
|
981
|
-
code:
|
|
982
|
-
category:
|
|
845
|
+
code: DiagnosticCode3.HtmlStandaloneRegionOverride,
|
|
846
|
+
category: DiagnosticCategory3.HTML,
|
|
983
847
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
984
848
|
};
|
|
985
849
|
},
|
|
986
850
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
987
851
|
return {
|
|
988
|
-
code:
|
|
989
|
-
category:
|
|
852
|
+
code: DiagnosticCode3.HtmlLandmarkRoleOverride,
|
|
853
|
+
category: DiagnosticCategory3.HTML,
|
|
990
854
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
991
855
|
};
|
|
992
856
|
},
|
|
993
857
|
invalidChild(child, parent, allowed) {
|
|
994
858
|
return {
|
|
995
|
-
code:
|
|
996
|
-
category:
|
|
859
|
+
code: DiagnosticCode3.HtmlInvalidChild,
|
|
860
|
+
category: DiagnosticCategory3.HTML,
|
|
997
861
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
998
862
|
};
|
|
999
863
|
}
|
|
1000
864
|
};
|
|
1001
865
|
|
|
1002
866
|
// ../../lib/contract/src/diagnostics/slot.ts
|
|
867
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
1003
868
|
var SlotDiagnostics = {
|
|
1004
869
|
exclusive(name) {
|
|
1005
870
|
return {
|
|
1006
|
-
code:
|
|
1007
|
-
category:
|
|
871
|
+
code: DiagnosticCode4.SlotExclusive,
|
|
872
|
+
category: DiagnosticCategory4.Contract,
|
|
1008
873
|
component: name,
|
|
1009
874
|
message: `${name}: "as" and "asChild" are mutually exclusive`
|
|
1010
875
|
};
|
|
1011
876
|
},
|
|
1012
877
|
singleChildRequired(name, elementTerm) {
|
|
1013
878
|
return {
|
|
1014
|
-
code:
|
|
1015
|
-
category:
|
|
879
|
+
code: DiagnosticCode4.SlotSingleChild,
|
|
880
|
+
category: DiagnosticCategory4.Contract,
|
|
1016
881
|
component: name,
|
|
1017
882
|
message: `${name}: asChild requires a ${elementTerm} child`
|
|
1018
883
|
};
|
|
1019
884
|
},
|
|
1020
885
|
singleChildExceeded(name, elementTerm, count) {
|
|
1021
886
|
return {
|
|
1022
|
-
code:
|
|
1023
|
-
category:
|
|
887
|
+
code: DiagnosticCode4.SlotSingleChild,
|
|
888
|
+
category: DiagnosticCategory4.Contract,
|
|
1024
889
|
component: name,
|
|
1025
890
|
message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
|
|
1026
891
|
};
|
|
@@ -1028,16 +893,16 @@ var SlotDiagnostics = {
|
|
|
1028
893
|
discardedChildren(name, elementTerm, count) {
|
|
1029
894
|
const suffix = count === 1 ? "" : "ren";
|
|
1030
895
|
return {
|
|
1031
|
-
code:
|
|
1032
|
-
category:
|
|
896
|
+
code: DiagnosticCode4.SlotDiscardedChildren,
|
|
897
|
+
category: DiagnosticCategory4.Contract,
|
|
1033
898
|
component: name,
|
|
1034
899
|
message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
|
|
1035
900
|
};
|
|
1036
901
|
},
|
|
1037
902
|
renderFnRequired(name, received) {
|
|
1038
903
|
return {
|
|
1039
|
-
code:
|
|
1040
|
-
category:
|
|
904
|
+
code: DiagnosticCode4.SlotRenderFn,
|
|
905
|
+
category: DiagnosticCategory4.Contract,
|
|
1041
906
|
component: name,
|
|
1042
907
|
message: `${name}: asChild requires a render function as children, got ${received}`
|
|
1043
908
|
};
|
|
@@ -1972,6 +1837,9 @@ var readonlyProps = ({
|
|
|
1972
1837
|
};
|
|
1973
1838
|
};
|
|
1974
1839
|
|
|
1840
|
+
// ../core/src/html/evaluators.ts
|
|
1841
|
+
import { warnDiagnostics as warnDiagnostics2 } from "../_shared/diagnostics.js";
|
|
1842
|
+
|
|
1975
1843
|
// ../core/src/html/aria-rules.ts
|
|
1976
1844
|
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1977
1845
|
var removeLandmarkRoleOverride = {
|
|
@@ -2014,6 +1882,7 @@ function landmarkNameAdvisory(ctx) {
|
|
|
2014
1882
|
}
|
|
2015
1883
|
|
|
2016
1884
|
// ../core/src/html/contracts.ts
|
|
1885
|
+
import { warnDiagnostics } from "../_shared/diagnostics.js";
|
|
2017
1886
|
function isOpenContent(...blockedTags) {
|
|
2018
1887
|
const set2 = new Set(blockedTags);
|
|
2019
1888
|
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set2.has(child.type));
|
|
@@ -2158,7 +2027,7 @@ var htmlContracts = {
|
|
|
2158
2027
|
};
|
|
2159
2028
|
|
|
2160
2029
|
// ../core/src/html/evaluators.ts
|
|
2161
|
-
var htmlDiagnostics =
|
|
2030
|
+
var htmlDiagnostics = warnDiagnostics2;
|
|
2162
2031
|
function buildEvaluatorMap() {
|
|
2163
2032
|
const map2 = /* @__PURE__ */ new Map();
|
|
2164
2033
|
iterate.forEachEntry(htmlContracts, (tag, { children }) => {
|
|
@@ -2217,6 +2086,7 @@ function createVariantPass(activeProps, config) {
|
|
|
2217
2086
|
}
|
|
2218
2087
|
|
|
2219
2088
|
// ../core/src/resolver/resolver.ts
|
|
2089
|
+
import { silentDiagnostics } from "../_shared/diagnostics.js";
|
|
2220
2090
|
function enforceAllowedAs(tag, allowedAs, diagnostics, displayName) {
|
|
2221
2091
|
if (allowedAs.includes(tag)) return;
|
|
2222
2092
|
if (!diagnostics) return;
|
|
@@ -2242,6 +2112,7 @@ function buildEngines(diagnostics, childRules, context) {
|
|
|
2242
2112
|
}
|
|
2243
2113
|
|
|
2244
2114
|
// ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
|
|
2115
|
+
import { throwDiagnostics, silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2245
2116
|
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics) {
|
|
2246
2117
|
return {
|
|
2247
2118
|
name: options.name ?? defaultName,
|