praxis-kit 4.0.1 → 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 +7 -146
- package/dist/eslint/index.js +21 -17
- package/dist/lit/index.d.ts +2 -143
- package/dist/lit/index.js +74 -203
- package/dist/{merge-refs-CEpa0zK1.d.ts → merge-refs-B0YcfdtP.d.ts} +14 -155
- package/dist/preact/index.d.ts +2 -143
- package/dist/preact/index.js +79 -208
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +1 -1
- package/dist/react/legacy.d.ts +3 -2
- package/dist/react/legacy.js +1 -1
- package/dist/solid/index.d.ts +2 -143
- package/dist/solid/index.js +83 -212
- package/dist/svelte/index.d.ts +2 -143
- package/dist/svelte/index.js +83 -212
- package/dist/tailwind/index.d.ts +2 -143
- package/dist/tailwind/index.js +11 -119
- package/dist/vue/index.d.ts +2 -143
- package/dist/vue/index.js +79 -208
- package/dist/web/index.d.ts +2 -143
- package/dist/web/index.js +74 -203
- package/package.json +4 -4
package/dist/lit/index.js
CHANGED
|
@@ -531,159 +531,21 @@ var InvariantBase = class {
|
|
|
531
531
|
}
|
|
532
532
|
};
|
|
533
533
|
|
|
534
|
-
// ../../lib/diagnostics/src/category.ts
|
|
535
|
-
var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => {
|
|
536
|
-
DiagnosticCategory2[DiagnosticCategory2["Contract"] = 0] = "Contract";
|
|
537
|
-
DiagnosticCategory2[DiagnosticCategory2["HTML"] = 1] = "HTML";
|
|
538
|
-
DiagnosticCategory2[DiagnosticCategory2["ARIA"] = 2] = "ARIA";
|
|
539
|
-
DiagnosticCategory2[DiagnosticCategory2["Composition"] = 3] = "Composition";
|
|
540
|
-
DiagnosticCategory2[DiagnosticCategory2["Rendering"] = 4] = "Rendering";
|
|
541
|
-
DiagnosticCategory2[DiagnosticCategory2["Accessibility"] = 5] = "Accessibility";
|
|
542
|
-
DiagnosticCategory2[DiagnosticCategory2["Performance"] = 6] = "Performance";
|
|
543
|
-
DiagnosticCategory2[DiagnosticCategory2["Internal"] = 7] = "Internal";
|
|
544
|
-
DiagnosticCategory2[DiagnosticCategory2["Deprecation"] = 8] = "Deprecation";
|
|
545
|
-
DiagnosticCategory2[DiagnosticCategory2["Lint"] = 9] = "Lint";
|
|
546
|
-
return DiagnosticCategory2;
|
|
547
|
-
})(DiagnosticCategory || {});
|
|
548
|
-
|
|
549
|
-
// ../../lib/diagnostics/src/error.ts
|
|
550
|
-
var PraxisError = class extends Error {
|
|
551
|
-
diagnostic;
|
|
552
|
-
constructor(diagnostic) {
|
|
553
|
-
super(diagnostic.message);
|
|
554
|
-
this.name = "PraxisError";
|
|
555
|
-
this.diagnostic = diagnostic;
|
|
556
|
-
}
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
// ../../lib/diagnostics/src/severity.ts
|
|
560
|
-
var Severity = /* @__PURE__ */ ((Severity2) => {
|
|
561
|
-
Severity2[Severity2["Debug"] = 0] = "Debug";
|
|
562
|
-
Severity2[Severity2["Info"] = 1] = "Info";
|
|
563
|
-
Severity2[Severity2["Warning"] = 2] = "Warning";
|
|
564
|
-
Severity2[Severity2["Error"] = 3] = "Error";
|
|
565
|
-
Severity2[Severity2["Fatal"] = 4] = "Fatal";
|
|
566
|
-
return Severity2;
|
|
567
|
-
})(Severity || {});
|
|
568
|
-
|
|
569
|
-
// ../../lib/diagnostics/src/policy.ts
|
|
570
|
-
var DefaultPolicy = class {
|
|
571
|
-
reportThreshold;
|
|
572
|
-
throwThreshold;
|
|
573
|
-
constructor({
|
|
574
|
-
reportThreshold = 1 /* Info */,
|
|
575
|
-
throwThreshold = 4 /* Fatal */
|
|
576
|
-
} = {}) {
|
|
577
|
-
this.reportThreshold = reportThreshold;
|
|
578
|
-
this.throwThreshold = throwThreshold;
|
|
579
|
-
}
|
|
580
|
-
resolve(diagnostic) {
|
|
581
|
-
if (diagnostic.severity >= this.throwThreshold) return 2 /* Throw */;
|
|
582
|
-
if (diagnostic.severity >= this.reportThreshold) return 1 /* Report */;
|
|
583
|
-
return 0 /* Ignore */;
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
// ../../lib/diagnostics/src/diagnostics.ts
|
|
588
|
-
var Diagnostics = class {
|
|
589
|
-
reporter;
|
|
590
|
-
policy;
|
|
591
|
-
// Pre-computed at construction time: true if Warning-level diagnostics are not ignored.
|
|
592
|
-
active;
|
|
593
|
-
constructor(reporter, policy = new DefaultPolicy()) {
|
|
594
|
-
this.reporter = reporter;
|
|
595
|
-
this.policy = policy;
|
|
596
|
-
this.active = policy.resolve({ severity: 2 /* Warning */ }) !== 0 /* Ignore */;
|
|
597
|
-
}
|
|
598
|
-
report(diagnostic) {
|
|
599
|
-
const enforcement = this.policy.resolve(diagnostic);
|
|
600
|
-
if (enforcement === 0 /* Ignore */) return diagnostic;
|
|
601
|
-
if (enforcement === 2 /* Throw */) throw new PraxisError(diagnostic);
|
|
602
|
-
this.reporter.report(diagnostic);
|
|
603
|
-
return diagnostic;
|
|
604
|
-
}
|
|
605
|
-
warn(input) {
|
|
606
|
-
return this.report({ ...input, severity: 2 /* Warning */ });
|
|
607
|
-
}
|
|
608
|
-
error(input) {
|
|
609
|
-
return this.report({ ...input, severity: 3 /* Error */ });
|
|
610
|
-
}
|
|
611
|
-
info(input) {
|
|
612
|
-
return this.report({ ...input, severity: 1 /* Info */ });
|
|
613
|
-
}
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
// ../../lib/diagnostics/src/formatter.ts
|
|
617
|
-
function formatDiagnostic(diagnostic) {
|
|
618
|
-
const level = Severity[diagnostic.severity];
|
|
619
|
-
const category = DiagnosticCategory[diagnostic.category];
|
|
620
|
-
const prefix = category !== void 0 ? `[${category}] ` : "";
|
|
621
|
-
return `${level} ${diagnostic.code}: ${prefix}${diagnostic.message}`;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
// ../../lib/diagnostics/src/console-reporter.ts
|
|
625
|
-
var ConsoleReporter = class {
|
|
626
|
-
report(diagnostic) {
|
|
627
|
-
const message = formatDiagnostic(diagnostic);
|
|
628
|
-
switch (diagnostic.severity) {
|
|
629
|
-
case 0 /* Debug */:
|
|
630
|
-
console.debug(message);
|
|
631
|
-
break;
|
|
632
|
-
case 1 /* Info */:
|
|
633
|
-
console.info(message);
|
|
634
|
-
break;
|
|
635
|
-
case 2 /* Warning */:
|
|
636
|
-
console.warn(message);
|
|
637
|
-
break;
|
|
638
|
-
case 3 /* Error */:
|
|
639
|
-
case 4 /* Fatal */:
|
|
640
|
-
console.error(message);
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
// ../../lib/diagnostics/src/null-reporter.ts
|
|
647
|
-
var nullReporter = {
|
|
648
|
-
report() {
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
|
|
652
|
-
// ../../lib/diagnostics/src/presets.ts
|
|
653
|
-
var ignoreAllPolicy = {
|
|
654
|
-
resolve(_) {
|
|
655
|
-
return 0 /* Ignore */;
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
var warnOnlyReporter = {
|
|
659
|
-
report(diagnostic) {
|
|
660
|
-
console.warn(formatDiagnostic(diagnostic));
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
var silentDiagnostics = new Diagnostics(nullReporter, ignoreAllPolicy);
|
|
664
|
-
var warnDiagnostics = new Diagnostics(
|
|
665
|
-
warnOnlyReporter,
|
|
666
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 4 /* Fatal */ })
|
|
667
|
-
);
|
|
668
|
-
var throwDiagnostics = new Diagnostics(
|
|
669
|
-
new ConsoleReporter(),
|
|
670
|
-
new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 3 /* Error */ })
|
|
671
|
-
);
|
|
672
|
-
|
|
673
534
|
// ../../lib/contract/src/diagnostics/aria.ts
|
|
535
|
+
import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
|
|
674
536
|
var AriaDiagnostics = {
|
|
675
537
|
/** Generic bridge for violations produced by external AriaRule functions. */
|
|
676
538
|
fromViolation(v) {
|
|
677
539
|
return {
|
|
678
|
-
code:
|
|
679
|
-
category:
|
|
540
|
+
code: DiagnosticCode.AriaViolation,
|
|
541
|
+
category: DiagnosticCategory.ARIA,
|
|
680
542
|
message: v.message
|
|
681
543
|
};
|
|
682
544
|
},
|
|
683
545
|
attributeInvalid(key, role) {
|
|
684
546
|
return {
|
|
685
|
-
code:
|
|
686
|
-
category:
|
|
547
|
+
code: DiagnosticCode.AriaAttributeInvalid,
|
|
548
|
+
category: DiagnosticCategory.ARIA,
|
|
687
549
|
message: `"${key}" is not valid on role="${role}". It will be removed.`,
|
|
688
550
|
rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
|
|
689
551
|
suggestions: [
|
|
@@ -696,8 +558,8 @@ var AriaDiagnostics = {
|
|
|
696
558
|
},
|
|
697
559
|
missingLiveRegion(role, impliedLive) {
|
|
698
560
|
return {
|
|
699
|
-
code:
|
|
700
|
-
category:
|
|
561
|
+
code: DiagnosticCode.AriaMissingLiveRegion,
|
|
562
|
+
category: DiagnosticCategory.ARIA,
|
|
701
563
|
message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
|
|
702
564
|
rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
|
|
703
565
|
suggestions: [
|
|
@@ -711,8 +573,8 @@ var AriaDiagnostics = {
|
|
|
711
573
|
},
|
|
712
574
|
missingAtomic(role) {
|
|
713
575
|
return {
|
|
714
|
-
code:
|
|
715
|
-
category:
|
|
576
|
+
code: DiagnosticCode.AriaMissingAtomic,
|
|
577
|
+
category: DiagnosticCategory.ARIA,
|
|
716
578
|
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.`,
|
|
717
579
|
rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
|
|
718
580
|
};
|
|
@@ -720,8 +582,8 @@ var AriaDiagnostics = {
|
|
|
720
582
|
relevantInvalidTokens(invalid) {
|
|
721
583
|
const quoted = invalid.map((t) => `"${t}"`).join(", ");
|
|
722
584
|
return {
|
|
723
|
-
code:
|
|
724
|
-
category:
|
|
585
|
+
code: DiagnosticCode.AriaRelevantInvalidToken,
|
|
586
|
+
category: DiagnosticCategory.ARIA,
|
|
725
587
|
message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
|
|
726
588
|
rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
|
|
727
589
|
suggestions: [
|
|
@@ -734,8 +596,8 @@ var AriaDiagnostics = {
|
|
|
734
596
|
},
|
|
735
597
|
relevantSuperseded() {
|
|
736
598
|
return {
|
|
737
|
-
code:
|
|
738
|
-
category:
|
|
599
|
+
code: DiagnosticCode.AriaRelevantSuperseded,
|
|
600
|
+
category: DiagnosticCategory.ARIA,
|
|
739
601
|
message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
|
|
740
602
|
rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
|
|
741
603
|
suggestions: [
|
|
@@ -748,8 +610,8 @@ var AriaDiagnostics = {
|
|
|
748
610
|
},
|
|
749
611
|
missingAccessibleName(tag) {
|
|
750
612
|
return {
|
|
751
|
-
code:
|
|
752
|
-
category:
|
|
613
|
+
code: DiagnosticCode.AriaMissingAccessibleName,
|
|
614
|
+
category: DiagnosticCategory.ARIA,
|
|
753
615
|
message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
|
|
754
616
|
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.",
|
|
755
617
|
suggestions: [
|
|
@@ -766,8 +628,8 @@ var AriaDiagnostics = {
|
|
|
766
628
|
},
|
|
767
629
|
attributeOnPresentational(attr, tag) {
|
|
768
630
|
return {
|
|
769
|
-
code:
|
|
770
|
-
category:
|
|
631
|
+
code: DiagnosticCode.AriaAttributeOnPresentational,
|
|
632
|
+
category: DiagnosticCategory.ARIA,
|
|
771
633
|
message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
|
|
772
634
|
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.',
|
|
773
635
|
suggestions: [
|
|
@@ -780,8 +642,8 @@ var AriaDiagnostics = {
|
|
|
780
642
|
},
|
|
781
643
|
ariaHiddenOnFocusable(tag) {
|
|
782
644
|
return {
|
|
783
|
-
code:
|
|
784
|
-
category:
|
|
645
|
+
code: DiagnosticCode.AriaHiddenOnFocusable,
|
|
646
|
+
category: DiagnosticCategory.ARIA,
|
|
785
647
|
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.`,
|
|
786
648
|
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.',
|
|
787
649
|
suggestions: [
|
|
@@ -799,8 +661,8 @@ var AriaDiagnostics = {
|
|
|
799
661
|
invalidAttributeValue(attr, value, expected) {
|
|
800
662
|
const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
|
|
801
663
|
return {
|
|
802
|
-
code:
|
|
803
|
-
category:
|
|
664
|
+
code: DiagnosticCode.AriaInvalidAttributeValue,
|
|
665
|
+
category: DiagnosticCategory.ARIA,
|
|
804
666
|
message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
|
|
805
667
|
rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
|
|
806
668
|
suggestions: [
|
|
@@ -813,8 +675,8 @@ var AriaDiagnostics = {
|
|
|
813
675
|
},
|
|
814
676
|
redundantAriaLevel(tag, level) {
|
|
815
677
|
return {
|
|
816
|
-
code:
|
|
817
|
-
category:
|
|
678
|
+
code: DiagnosticCode.AriaRedundantLevelAttribute,
|
|
679
|
+
category: DiagnosticCategory.ARIA,
|
|
818
680
|
message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
|
|
819
681
|
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>).',
|
|
820
682
|
suggestions: [
|
|
@@ -827,8 +689,8 @@ var AriaDiagnostics = {
|
|
|
827
689
|
},
|
|
828
690
|
requiredProperty(attr, role) {
|
|
829
691
|
return {
|
|
830
|
-
code:
|
|
831
|
-
category:
|
|
692
|
+
code: DiagnosticCode.AriaRequiredProperty,
|
|
693
|
+
category: DiagnosticCategory.ARIA,
|
|
832
694
|
message: `"${attr}" is required for role="${role}" but is missing.`,
|
|
833
695
|
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.`,
|
|
834
696
|
suggestions: [
|
|
@@ -841,8 +703,8 @@ var AriaDiagnostics = {
|
|
|
841
703
|
},
|
|
842
704
|
invalidRole(role, tag) {
|
|
843
705
|
return {
|
|
844
|
-
code:
|
|
845
|
-
category:
|
|
706
|
+
code: DiagnosticCode.AriaInvalidRole,
|
|
707
|
+
category: DiagnosticCategory.ARIA,
|
|
846
708
|
message: `Invalid role "${role ?? ""}" on <${tag}>.`,
|
|
847
709
|
rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
|
|
848
710
|
};
|
|
@@ -850,11 +712,12 @@ var AriaDiagnostics = {
|
|
|
850
712
|
};
|
|
851
713
|
|
|
852
714
|
// ../../lib/contract/src/diagnostics/contract.ts
|
|
715
|
+
import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
|
|
853
716
|
var ContractDiagnostics = {
|
|
854
717
|
unexpectedChild(typeName, index, context) {
|
|
855
718
|
return {
|
|
856
|
-
code:
|
|
857
|
-
category:
|
|
719
|
+
code: DiagnosticCode2.UnexpectedChild,
|
|
720
|
+
category: DiagnosticCategory2.Contract,
|
|
858
721
|
component: context,
|
|
859
722
|
message: `${context}: unexpected child "${typeName}" at index ${index}.`
|
|
860
723
|
};
|
|
@@ -862,69 +725,69 @@ var ContractDiagnostics = {
|
|
|
862
725
|
ambiguousChild(typeName, index, ruleNames, context) {
|
|
863
726
|
const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
|
|
864
727
|
return {
|
|
865
|
-
code:
|
|
866
|
-
category:
|
|
728
|
+
code: DiagnosticCode2.AmbiguousChild,
|
|
729
|
+
category: DiagnosticCategory2.Contract,
|
|
867
730
|
component: context,
|
|
868
731
|
message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
|
|
869
732
|
};
|
|
870
733
|
},
|
|
871
734
|
cardinalityMin(ruleName, min, context) {
|
|
872
735
|
return {
|
|
873
|
-
code:
|
|
874
|
-
category:
|
|
736
|
+
code: DiagnosticCode2.CardinalityMin,
|
|
737
|
+
category: DiagnosticCategory2.Contract,
|
|
875
738
|
component: context,
|
|
876
739
|
message: `${context}: "${ruleName}" requires at least ${min}.`
|
|
877
740
|
};
|
|
878
741
|
},
|
|
879
742
|
cardinalityMax(ruleName, max, context) {
|
|
880
743
|
return {
|
|
881
|
-
code:
|
|
882
|
-
category:
|
|
744
|
+
code: DiagnosticCode2.CardinalityMax,
|
|
745
|
+
category: DiagnosticCategory2.Contract,
|
|
883
746
|
component: context,
|
|
884
747
|
message: `${context}: "${ruleName}" allows at most ${max}.`
|
|
885
748
|
};
|
|
886
749
|
},
|
|
887
750
|
positionViolation(ruleName, position, index, context) {
|
|
888
751
|
return {
|
|
889
|
-
code:
|
|
890
|
-
category:
|
|
752
|
+
code: DiagnosticCode2.PositionViolation,
|
|
753
|
+
category: DiagnosticCategory2.Contract,
|
|
891
754
|
component: context,
|
|
892
755
|
message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
|
|
893
756
|
};
|
|
894
757
|
},
|
|
895
758
|
unknownVariantDim(component, label2, dim) {
|
|
896
759
|
return {
|
|
897
|
-
code:
|
|
898
|
-
category:
|
|
760
|
+
code: DiagnosticCode2.ContractUnknownVariantDim,
|
|
761
|
+
category: DiagnosticCategory2.Contract,
|
|
899
762
|
message: `${component}: ${label2} references unknown variant "${dim}".`
|
|
900
763
|
};
|
|
901
764
|
},
|
|
902
765
|
unknownVariantValue(component, label2, dim, value, valid) {
|
|
903
766
|
return {
|
|
904
|
-
code:
|
|
905
|
-
category:
|
|
767
|
+
code: DiagnosticCode2.ContractUnknownVariantValue,
|
|
768
|
+
category: DiagnosticCategory2.Contract,
|
|
906
769
|
message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
|
|
907
770
|
};
|
|
908
771
|
},
|
|
909
772
|
unknownRecipeKey(component, key) {
|
|
910
773
|
return {
|
|
911
|
-
code:
|
|
912
|
-
category:
|
|
774
|
+
code: DiagnosticCode2.ContractUnknownRecipeKey,
|
|
775
|
+
category: DiagnosticCategory2.Contract,
|
|
913
776
|
message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
|
|
914
777
|
};
|
|
915
778
|
},
|
|
916
779
|
invalidVariantValue(component, key, value) {
|
|
917
780
|
return {
|
|
918
|
-
code:
|
|
919
|
-
category:
|
|
781
|
+
code: DiagnosticCode2.ContractInvalidVariantValue,
|
|
782
|
+
category: DiagnosticCategory2.Contract,
|
|
920
783
|
message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
|
|
921
784
|
};
|
|
922
785
|
},
|
|
923
786
|
allowedAsViolation(tag, allowedAs, component) {
|
|
924
787
|
const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
|
|
925
788
|
return {
|
|
926
|
-
code:
|
|
927
|
-
category:
|
|
789
|
+
code: DiagnosticCode2.AllowedAsViolation,
|
|
790
|
+
category: DiagnosticCategory2.Contract,
|
|
928
791
|
component,
|
|
929
792
|
message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
|
|
930
793
|
};
|
|
@@ -932,46 +795,47 @@ var ContractDiagnostics = {
|
|
|
932
795
|
};
|
|
933
796
|
|
|
934
797
|
// ../../lib/contract/src/diagnostics/html.ts
|
|
798
|
+
import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
|
|
935
799
|
var HtmlDiagnostics = {
|
|
936
800
|
emptyRole(tag) {
|
|
937
801
|
return {
|
|
938
|
-
code:
|
|
939
|
-
category:
|
|
802
|
+
code: DiagnosticCode3.HtmlEmptyRole,
|
|
803
|
+
category: DiagnosticCategory3.HTML,
|
|
940
804
|
message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
|
|
941
805
|
};
|
|
942
806
|
},
|
|
943
807
|
implicitRoleRedundant(tag, implicitRole) {
|
|
944
808
|
return {
|
|
945
|
-
code:
|
|
946
|
-
category:
|
|
809
|
+
code: DiagnosticCode3.HtmlImplicitRoleRedundant,
|
|
810
|
+
category: DiagnosticCategory3.HTML,
|
|
947
811
|
message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
|
|
948
812
|
};
|
|
949
813
|
},
|
|
950
814
|
implicitRoleOverride(tag, implicitRole, role) {
|
|
951
815
|
return {
|
|
952
|
-
code:
|
|
953
|
-
category:
|
|
816
|
+
code: DiagnosticCode3.HtmlImplicitRoleOverride,
|
|
817
|
+
category: DiagnosticCategory3.HTML,
|
|
954
818
|
message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
|
|
955
819
|
};
|
|
956
820
|
},
|
|
957
821
|
standaloneRegionOverride(tag, implicitRole) {
|
|
958
822
|
return {
|
|
959
|
-
code:
|
|
960
|
-
category:
|
|
823
|
+
code: DiagnosticCode3.HtmlStandaloneRegionOverride,
|
|
824
|
+
category: DiagnosticCategory3.HTML,
|
|
961
825
|
message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
|
|
962
826
|
};
|
|
963
827
|
},
|
|
964
828
|
landmarkRoleOverride(tag, implicitRole, role) {
|
|
965
829
|
return {
|
|
966
|
-
code:
|
|
967
|
-
category:
|
|
830
|
+
code: DiagnosticCode3.HtmlLandmarkRoleOverride,
|
|
831
|
+
category: DiagnosticCategory3.HTML,
|
|
968
832
|
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
969
833
|
};
|
|
970
834
|
},
|
|
971
835
|
invalidChild(child, parent, allowed) {
|
|
972
836
|
return {
|
|
973
|
-
code:
|
|
974
|
-
category:
|
|
837
|
+
code: DiagnosticCode3.HtmlInvalidChild,
|
|
838
|
+
category: DiagnosticCategory3.HTML,
|
|
975
839
|
message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
|
|
976
840
|
};
|
|
977
841
|
}
|
|
@@ -2135,6 +1999,7 @@ function createClassPipeline(resolved) {
|
|
|
2135
1999
|
}
|
|
2136
2000
|
|
|
2137
2001
|
// ../core/src/options/resolve-factory-options.ts
|
|
2002
|
+
import { silentDiagnostics } from "../_shared/diagnostics.js";
|
|
2138
2003
|
var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
|
|
2139
2004
|
function composeNormalizers(normalizers, fn) {
|
|
2140
2005
|
if (!normalizers?.length) return fn;
|
|
@@ -2226,21 +2091,25 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
|
|
|
2226
2091
|
}
|
|
2227
2092
|
}
|
|
2228
2093
|
|
|
2094
|
+
// ../core/src/factory/plugin-invariants.ts
|
|
2095
|
+
import { throwDiagnostics } from "../_shared/diagnostics.js";
|
|
2096
|
+
|
|
2229
2097
|
// ../core/src/factory/plugin-diagnostics.ts
|
|
2098
|
+
import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
|
|
2230
2099
|
var PluginDiagnostics = {
|
|
2231
2100
|
invalidShape(received) {
|
|
2232
2101
|
const got = received === null ? "null" : typeof received;
|
|
2233
2102
|
return {
|
|
2234
|
-
code:
|
|
2235
|
-
category:
|
|
2103
|
+
code: DiagnosticCode4.PluginInvalidShape,
|
|
2104
|
+
category: DiagnosticCategory4.Internal,
|
|
2236
2105
|
message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
|
|
2237
2106
|
};
|
|
2238
2107
|
},
|
|
2239
2108
|
pipelineReturnType(received) {
|
|
2240
2109
|
const got = received === null ? "null" : Array.isArray(received) ? "array" : typeof received;
|
|
2241
2110
|
return {
|
|
2242
|
-
code:
|
|
2243
|
-
category:
|
|
2111
|
+
code: DiagnosticCode4.PluginPipelineReturnType,
|
|
2112
|
+
category: DiagnosticCategory4.Internal,
|
|
2244
2113
|
message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
|
|
2245
2114
|
};
|
|
2246
2115
|
}
|
|
@@ -2369,7 +2238,8 @@ function composeFilter(ownedKeys, filterProps) {
|
|
|
2369
2238
|
}
|
|
2370
2239
|
|
|
2371
2240
|
// ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
|
|
2372
|
-
|
|
2241
|
+
import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
|
|
2242
|
+
function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
|
|
2373
2243
|
return {
|
|
2374
2244
|
name: options.name ?? defaultName,
|
|
2375
2245
|
diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
|
|
@@ -2377,10 +2247,11 @@ function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponen
|
|
|
2377
2247
|
}
|
|
2378
2248
|
|
|
2379
2249
|
// ../../adapters/lit/src/build-runtime.ts
|
|
2250
|
+
import { silentDiagnostics as silentDiagnostics3 } from "../_shared/diagnostics.js";
|
|
2380
2251
|
function normalizeOptions(options) {
|
|
2381
2252
|
return {
|
|
2382
2253
|
...options,
|
|
2383
|
-
...resolveAdapterCommonOptions(options, "PolymorphicElement",
|
|
2254
|
+
...resolveAdapterCommonOptions(options, "PolymorphicElement", silentDiagnostics3)
|
|
2384
2255
|
};
|
|
2385
2256
|
}
|
|
2386
2257
|
function buildRuntime(options) {
|