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