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.
@@ -517,159 +517,21 @@ var InvariantBase = class {
517
517
  }
518
518
  };
519
519
 
520
- // ../../lib/diagnostics/src/category.ts
521
- var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => {
522
- DiagnosticCategory2[DiagnosticCategory2["Contract"] = 0] = "Contract";
523
- DiagnosticCategory2[DiagnosticCategory2["HTML"] = 1] = "HTML";
524
- DiagnosticCategory2[DiagnosticCategory2["ARIA"] = 2] = "ARIA";
525
- DiagnosticCategory2[DiagnosticCategory2["Composition"] = 3] = "Composition";
526
- DiagnosticCategory2[DiagnosticCategory2["Rendering"] = 4] = "Rendering";
527
- DiagnosticCategory2[DiagnosticCategory2["Accessibility"] = 5] = "Accessibility";
528
- DiagnosticCategory2[DiagnosticCategory2["Performance"] = 6] = "Performance";
529
- DiagnosticCategory2[DiagnosticCategory2["Internal"] = 7] = "Internal";
530
- DiagnosticCategory2[DiagnosticCategory2["Deprecation"] = 8] = "Deprecation";
531
- DiagnosticCategory2[DiagnosticCategory2["Lint"] = 9] = "Lint";
532
- return DiagnosticCategory2;
533
- })(DiagnosticCategory || {});
534
-
535
- // ../../lib/diagnostics/src/error.ts
536
- var PraxisError = class extends Error {
537
- diagnostic;
538
- constructor(diagnostic) {
539
- super(diagnostic.message);
540
- this.name = "PraxisError";
541
- this.diagnostic = diagnostic;
542
- }
543
- };
544
-
545
- // ../../lib/diagnostics/src/severity.ts
546
- var Severity = /* @__PURE__ */ ((Severity2) => {
547
- Severity2[Severity2["Debug"] = 0] = "Debug";
548
- Severity2[Severity2["Info"] = 1] = "Info";
549
- Severity2[Severity2["Warning"] = 2] = "Warning";
550
- Severity2[Severity2["Error"] = 3] = "Error";
551
- Severity2[Severity2["Fatal"] = 4] = "Fatal";
552
- return Severity2;
553
- })(Severity || {});
554
-
555
- // ../../lib/diagnostics/src/policy.ts
556
- var DefaultPolicy = class {
557
- reportThreshold;
558
- throwThreshold;
559
- constructor({
560
- reportThreshold = 1 /* Info */,
561
- throwThreshold = 4 /* Fatal */
562
- } = {}) {
563
- this.reportThreshold = reportThreshold;
564
- this.throwThreshold = throwThreshold;
565
- }
566
- resolve(diagnostic) {
567
- if (diagnostic.severity >= this.throwThreshold) return 2 /* Throw */;
568
- if (diagnostic.severity >= this.reportThreshold) return 1 /* Report */;
569
- return 0 /* Ignore */;
570
- }
571
- };
572
-
573
- // ../../lib/diagnostics/src/diagnostics.ts
574
- var Diagnostics = class {
575
- reporter;
576
- policy;
577
- // Pre-computed at construction time: true if Warning-level diagnostics are not ignored.
578
- active;
579
- constructor(reporter, policy = new DefaultPolicy()) {
580
- this.reporter = reporter;
581
- this.policy = policy;
582
- this.active = policy.resolve({ severity: 2 /* Warning */ }) !== 0 /* Ignore */;
583
- }
584
- report(diagnostic) {
585
- const enforcement = this.policy.resolve(diagnostic);
586
- if (enforcement === 0 /* Ignore */) return diagnostic;
587
- if (enforcement === 2 /* Throw */) throw new PraxisError(diagnostic);
588
- this.reporter.report(diagnostic);
589
- return diagnostic;
590
- }
591
- warn(input) {
592
- return this.report({ ...input, severity: 2 /* Warning */ });
593
- }
594
- error(input) {
595
- return this.report({ ...input, severity: 3 /* Error */ });
596
- }
597
- info(input) {
598
- return this.report({ ...input, severity: 1 /* Info */ });
599
- }
600
- };
601
-
602
- // ../../lib/diagnostics/src/formatter.ts
603
- function formatDiagnostic(diagnostic) {
604
- const level = Severity[diagnostic.severity];
605
- const category = DiagnosticCategory[diagnostic.category];
606
- const prefix = category !== void 0 ? `[${category}] ` : "";
607
- return `${level} ${diagnostic.code}: ${prefix}${diagnostic.message}`;
608
- }
609
-
610
- // ../../lib/diagnostics/src/console-reporter.ts
611
- var ConsoleReporter = class {
612
- report(diagnostic) {
613
- const message = formatDiagnostic(diagnostic);
614
- switch (diagnostic.severity) {
615
- case 0 /* Debug */:
616
- console.debug(message);
617
- break;
618
- case 1 /* Info */:
619
- console.info(message);
620
- break;
621
- case 2 /* Warning */:
622
- console.warn(message);
623
- break;
624
- case 3 /* Error */:
625
- case 4 /* Fatal */:
626
- console.error(message);
627
- break;
628
- }
629
- }
630
- };
631
-
632
- // ../../lib/diagnostics/src/null-reporter.ts
633
- var nullReporter = {
634
- report() {
635
- }
636
- };
637
-
638
- // ../../lib/diagnostics/src/presets.ts
639
- var ignoreAllPolicy = {
640
- resolve(_) {
641
- return 0 /* Ignore */;
642
- }
643
- };
644
- var warnOnlyReporter = {
645
- report(diagnostic) {
646
- console.warn(formatDiagnostic(diagnostic));
647
- }
648
- };
649
- var silentDiagnostics = new Diagnostics(nullReporter, ignoreAllPolicy);
650
- var warnDiagnostics = new Diagnostics(
651
- warnOnlyReporter,
652
- new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 4 /* Fatal */ })
653
- );
654
- var throwDiagnostics = new Diagnostics(
655
- new ConsoleReporter(),
656
- new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 3 /* Error */ })
657
- );
658
-
659
520
  // ../../lib/contract/src/diagnostics/aria.ts
521
+ import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
660
522
  var AriaDiagnostics = {
661
523
  /** Generic bridge for violations produced by external AriaRule functions. */
662
524
  fromViolation(v) {
663
525
  return {
664
- code: "ARIA2002" /* AriaViolation */,
665
- category: 2 /* ARIA */,
526
+ code: DiagnosticCode.AriaViolation,
527
+ category: DiagnosticCategory.ARIA,
666
528
  message: v.message
667
529
  };
668
530
  },
669
531
  attributeInvalid(key, role) {
670
532
  return {
671
- code: "ARIA2003" /* AriaAttributeInvalid */,
672
- category: 2 /* ARIA */,
533
+ code: DiagnosticCode.AriaAttributeInvalid,
534
+ category: DiagnosticCategory.ARIA,
673
535
  message: `"${key}" is not valid on role="${role}". It will be removed.`,
674
536
  rationale: "Invalid ARIA attributes are ignored by assistive technology and may trigger accessibility-tree warnings in browser devtools.",
675
537
  suggestions: [
@@ -682,8 +544,8 @@ var AriaDiagnostics = {
682
544
  },
683
545
  missingLiveRegion(role, impliedLive) {
684
546
  return {
685
- code: "ARIA2004" /* AriaMissingLiveRegion */,
686
- category: 2 /* ARIA */,
547
+ code: DiagnosticCode.AriaMissingLiveRegion,
548
+ category: DiagnosticCategory.ARIA,
687
549
  message: `role="${role}" implies aria-live="${impliedLive}" but it is missing. It has been injected.`,
688
550
  rationale: "Live-region roles announce dynamic content changes to screen readers. Without aria-live the politeness level is unspecified and announcements may be silent.",
689
551
  suggestions: [
@@ -697,8 +559,8 @@ var AriaDiagnostics = {
697
559
  },
698
560
  missingAtomic(role) {
699
561
  return {
700
- code: "ARIA2005" /* AriaMissingAtomic */,
701
- category: 2 /* ARIA */,
562
+ code: DiagnosticCode.AriaMissingAtomic,
563
+ category: DiagnosticCategory.ARIA,
702
564
  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.`,
703
565
  rationale: "aria-atomic controls whether assistive technology announces the entire live region or only the changed nodes. Omitting it leaves the behaviour browser-defined."
704
566
  };
@@ -706,8 +568,8 @@ var AriaDiagnostics = {
706
568
  relevantInvalidTokens(invalid) {
707
569
  const quoted = invalid.map((t) => `"${t}"`).join(", ");
708
570
  return {
709
- code: "ARIA2006" /* AriaRelevantInvalidToken */,
710
- category: 2 /* ARIA */,
571
+ code: DiagnosticCode.AriaRelevantInvalidToken,
572
+ category: DiagnosticCategory.ARIA,
711
573
  message: `aria-relevant contains invalid token(s): ${quoted}. Valid tokens are: additions, removals, text, all.`,
712
574
  rationale: "aria-relevant accepts a space-separated list of change types. Unrecognised tokens are silently ignored by assistive technology, making the attribute ineffective.",
713
575
  suggestions: [
@@ -720,8 +582,8 @@ var AriaDiagnostics = {
720
582
  },
721
583
  relevantSuperseded() {
722
584
  return {
723
- code: "ARIA2007" /* AriaRelevantSuperseded */,
724
- category: 2 /* ARIA */,
585
+ code: DiagnosticCode.AriaRelevantSuperseded,
586
+ category: DiagnosticCategory.ARIA,
725
587
  message: 'aria-relevant includes "all" alongside other tokens. "all" supersedes additions, removals, and text \u2014 use aria-relevant="all" alone.',
726
588
  rationale: '"all" is equivalent to "additions removals text". Combining it with other tokens is redundant and may confuse readers of the markup.',
727
589
  suggestions: [
@@ -734,8 +596,8 @@ var AriaDiagnostics = {
734
596
  },
735
597
  missingAccessibleName(tag) {
736
598
  return {
737
- code: "ARIA2009" /* AriaMissingAccessibleName */,
738
- category: 2 /* ARIA */,
599
+ code: DiagnosticCode.AriaMissingAccessibleName,
600
+ category: DiagnosticCategory.ARIA,
739
601
  message: `<${tag}> has no accessible name. Add aria-label or aria-labelledby.`,
740
602
  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.",
741
603
  suggestions: [
@@ -752,8 +614,8 @@ var AriaDiagnostics = {
752
614
  },
753
615
  attributeOnPresentational(attr, tag) {
754
616
  return {
755
- code: "ARIA2010" /* AriaAttributeOnPresentational */,
756
- category: 2 /* ARIA */,
617
+ code: DiagnosticCode.AriaAttributeOnPresentational,
618
+ category: DiagnosticCategory.ARIA,
757
619
  message: `"${attr}" is not allowed on a presentational <${tag}>. Presentational elements are invisible to assistive technology.`,
758
620
  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.',
759
621
  suggestions: [
@@ -766,8 +628,8 @@ var AriaDiagnostics = {
766
628
  },
767
629
  ariaHiddenOnFocusable(tag) {
768
630
  return {
769
- code: "ARIA2011" /* AriaHiddenOnFocusable */,
770
- category: 2 /* ARIA */,
631
+ code: DiagnosticCode.AriaHiddenOnFocusable,
632
+ category: DiagnosticCategory.ARIA,
771
633
  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.`,
772
634
  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.',
773
635
  suggestions: [
@@ -785,8 +647,8 @@ var AriaDiagnostics = {
785
647
  invalidAttributeValue(attr, value, expected) {
786
648
  const got = value === null ? "null" : value === void 0 ? "undefined" : typeof value === "string" ? `"${value}"` : String(value);
787
649
  return {
788
- code: "ARIA2013" /* AriaInvalidAttributeValue */,
789
- category: 2 /* ARIA */,
650
+ code: DiagnosticCode.AriaInvalidAttributeValue,
651
+ category: DiagnosticCategory.ARIA,
790
652
  message: `"${attr}" has an invalid value (${got}). Expected: ${expected}.`,
791
653
  rationale: "ARIA attributes with invalid values are silently ignored by assistive technology, making the markup semantically inert.",
792
654
  suggestions: [
@@ -799,8 +661,8 @@ var AriaDiagnostics = {
799
661
  },
800
662
  redundantAriaLevel(tag, level) {
801
663
  return {
802
- code: "ARIA2014" /* AriaRedundantLevelAttribute */,
803
- category: 2 /* ARIA */,
664
+ code: DiagnosticCode.AriaRedundantLevelAttribute,
665
+ category: DiagnosticCategory.ARIA,
804
666
  message: `aria-level="${level}" is redundant on <${tag}>: the element already has an implicit heading level of ${level}. Remove the attribute.`,
805
667
  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>).',
806
668
  suggestions: [
@@ -813,8 +675,8 @@ var AriaDiagnostics = {
813
675
  },
814
676
  requiredProperty(attr, role) {
815
677
  return {
816
- code: "ARIA2012" /* AriaRequiredProperty */,
817
- category: 2 /* ARIA */,
678
+ code: DiagnosticCode.AriaRequiredProperty,
679
+ category: DiagnosticCategory.ARIA,
818
680
  message: `"${attr}" is required for role="${role}" but is missing.`,
819
681
  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.`,
820
682
  suggestions: [
@@ -827,8 +689,8 @@ var AriaDiagnostics = {
827
689
  },
828
690
  invalidRole(role, tag) {
829
691
  return {
830
- code: "ARIA2008" /* AriaInvalidRole */,
831
- category: 2 /* ARIA */,
692
+ code: DiagnosticCode.AriaInvalidRole,
693
+ category: DiagnosticCategory.ARIA,
832
694
  message: `Invalid role "${role ?? ""}" on <${tag}>.`,
833
695
  rationale: "An unrecognised or misapplied ARIA role is ignored by assistive technology and may degrade the accessibility of the element."
834
696
  };
@@ -836,11 +698,12 @@ var AriaDiagnostics = {
836
698
  };
837
699
 
838
700
  // ../../lib/contract/src/diagnostics/contract.ts
701
+ import { DiagnosticCategory as DiagnosticCategory2, DiagnosticCode as DiagnosticCode2 } from "../_shared/diagnostics.js";
839
702
  var ContractDiagnostics = {
840
703
  unexpectedChild(typeName, index, context) {
841
704
  return {
842
- code: "COMP1004" /* UnexpectedChild */,
843
- category: 0 /* Contract */,
705
+ code: DiagnosticCode2.UnexpectedChild,
706
+ category: DiagnosticCategory2.Contract,
844
707
  component: context,
845
708
  message: `${context}: unexpected child "${typeName}" at index ${index}.`
846
709
  };
@@ -848,69 +711,69 @@ var ContractDiagnostics = {
848
711
  ambiguousChild(typeName, index, ruleNames, context) {
849
712
  const quoted = ruleNames.map((n) => `"${n}"`).join(" and ");
850
713
  return {
851
- code: "COMP1005" /* AmbiguousChild */,
852
- category: 0 /* Contract */,
714
+ code: DiagnosticCode2.AmbiguousChild,
715
+ category: DiagnosticCategory2.Contract,
853
716
  component: context,
854
717
  message: `${context}: child "${typeName}" at index ${index} matches multiple child rules: ${quoted}.`
855
718
  };
856
719
  },
857
720
  cardinalityMin(ruleName, min, context) {
858
721
  return {
859
- code: "COMP1006" /* CardinalityMin */,
860
- category: 0 /* Contract */,
722
+ code: DiagnosticCode2.CardinalityMin,
723
+ category: DiagnosticCategory2.Contract,
861
724
  component: context,
862
725
  message: `${context}: "${ruleName}" requires at least ${min}.`
863
726
  };
864
727
  },
865
728
  cardinalityMax(ruleName, max, context) {
866
729
  return {
867
- code: "COMP1007" /* CardinalityMax */,
868
- category: 0 /* Contract */,
730
+ code: DiagnosticCode2.CardinalityMax,
731
+ category: DiagnosticCategory2.Contract,
869
732
  component: context,
870
733
  message: `${context}: "${ruleName}" allows at most ${max}.`
871
734
  };
872
735
  },
873
736
  positionViolation(ruleName, position, index, context) {
874
737
  return {
875
- code: "COMP1008" /* PositionViolation */,
876
- category: 0 /* Contract */,
738
+ code: DiagnosticCode2.PositionViolation,
739
+ category: DiagnosticCategory2.Contract,
877
740
  component: context,
878
741
  message: `${context}: "${ruleName}" must be ${position}, got index ${index}`
879
742
  };
880
743
  },
881
744
  unknownVariantDim(component, label2, dim) {
882
745
  return {
883
- code: "COMP1010" /* ContractUnknownVariantDim */,
884
- category: 0 /* Contract */,
746
+ code: DiagnosticCode2.ContractUnknownVariantDim,
747
+ category: DiagnosticCategory2.Contract,
885
748
  message: `${component}: ${label2} references unknown variant "${dim}".`
886
749
  };
887
750
  },
888
751
  unknownVariantValue(component, label2, dim, value, valid) {
889
752
  return {
890
- code: "COMP1011" /* ContractUnknownVariantValue */,
891
- category: 0 /* Contract */,
753
+ code: DiagnosticCode2.ContractUnknownVariantValue,
754
+ category: DiagnosticCategory2.Contract,
892
755
  message: `${component}: ${label2} sets "${dim}" to unknown value "${value}" (valid: ${valid.join(", ")}).`
893
756
  };
894
757
  },
895
758
  unknownRecipeKey(component, key) {
896
759
  return {
897
- code: "COMP1012" /* ContractUnknownRecipeKey */,
898
- category: 0 /* Contract */,
760
+ code: DiagnosticCode2.ContractUnknownRecipeKey,
761
+ category: DiagnosticCategory2.Contract,
899
762
  message: `${component} Unknown recipeKey "${key}" \u2014 no preset with that name exists.`
900
763
  };
901
764
  },
902
765
  invalidVariantValue(component, key, value) {
903
766
  return {
904
- code: "COMP1013" /* ContractInvalidVariantValue */,
905
- category: 0 /* Contract */,
767
+ code: DiagnosticCode2.ContractInvalidVariantValue,
768
+ category: DiagnosticCategory2.Contract,
906
769
  message: `${component} Variant "${key}=${value}" is not a defined value for the "${key}" dimension.`
907
770
  };
908
771
  },
909
772
  allowedAsViolation(tag, allowedAs, component) {
910
773
  const allowed = allowedAs.map((t) => `"${String(t)}"`).join(", ");
911
774
  return {
912
- code: "COMP1009" /* AllowedAsViolation */,
913
- category: 0 /* Contract */,
775
+ code: DiagnosticCode2.AllowedAsViolation,
776
+ category: DiagnosticCategory2.Contract,
914
777
  component,
915
778
  message: `<${component}>: "as" prop received "${tag}" but only [${allowed}] are allowed.`
916
779
  };
@@ -918,73 +781,75 @@ var ContractDiagnostics = {
918
781
  };
919
782
 
920
783
  // ../../lib/contract/src/diagnostics/html.ts
784
+ import { DiagnosticCategory as DiagnosticCategory3, DiagnosticCode as DiagnosticCode3 } from "../_shared/diagnostics.js";
921
785
  var HtmlDiagnostics = {
922
786
  emptyRole(tag) {
923
787
  return {
924
- code: "HTML3002" /* HtmlEmptyRole */,
925
- category: 1 /* HTML */,
788
+ code: DiagnosticCode3.HtmlEmptyRole,
789
+ category: DiagnosticCategory3.HTML,
926
790
  message: `<${tag}> has an explicit empty role="". Omit the attribute instead.`
927
791
  };
928
792
  },
929
793
  implicitRoleRedundant(tag, implicitRole) {
930
794
  return {
931
- code: "HTML3003" /* HtmlImplicitRoleRedundant */,
932
- category: 1 /* HTML */,
795
+ code: DiagnosticCode3.HtmlImplicitRoleRedundant,
796
+ category: DiagnosticCategory3.HTML,
933
797
  message: `<${tag}> already has implicit role="${implicitRole}". Avoid redundant role assignment.`
934
798
  };
935
799
  },
936
800
  implicitRoleOverride(tag, implicitRole, role) {
937
801
  return {
938
- code: "HTML3004" /* HtmlImplicitRoleOverride */,
939
- category: 1 /* HTML */,
802
+ code: DiagnosticCode3.HtmlImplicitRoleOverride,
803
+ category: DiagnosticCategory3.HTML,
940
804
  message: `<${tag}> should not override its implicit role="${implicitRole}" with role="${role}".`
941
805
  };
942
806
  },
943
807
  standaloneRegionOverride(tag, implicitRole) {
944
808
  return {
945
- code: "HTML3005" /* HtmlStandaloneRegionOverride */,
946
- category: 1 /* HTML */,
809
+ code: DiagnosticCode3.HtmlStandaloneRegionOverride,
810
+ category: DiagnosticCategory3.HTML,
947
811
  message: `<${tag}> is a self-contained element with implicit role="${implicitRole}". Assigning role="region" has been removed.`
948
812
  };
949
813
  },
950
814
  landmarkRoleOverride(tag, implicitRole, role) {
951
815
  return {
952
- code: "HTML3006" /* HtmlLandmarkRoleOverride */,
953
- category: 1 /* HTML */,
816
+ code: DiagnosticCode3.HtmlLandmarkRoleOverride,
817
+ category: DiagnosticCategory3.HTML,
954
818
  message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
955
819
  };
956
820
  },
957
821
  invalidChild(child, parent, allowed) {
958
822
  return {
959
- code: "HTML3007" /* HtmlInvalidChild */,
960
- category: 1 /* HTML */,
823
+ code: DiagnosticCode3.HtmlInvalidChild,
824
+ category: DiagnosticCategory3.HTML,
961
825
  message: `<${child}> is not a valid direct child of <${parent}>. Allowed: ${allowed}.`
962
826
  };
963
827
  }
964
828
  };
965
829
 
966
830
  // ../../lib/contract/src/diagnostics/slot.ts
831
+ import { DiagnosticCategory as DiagnosticCategory4, DiagnosticCode as DiagnosticCode4 } from "../_shared/diagnostics.js";
967
832
  var SlotDiagnostics = {
968
833
  exclusive(name) {
969
834
  return {
970
- code: "SLOT1001" /* SlotExclusive */,
971
- category: 0 /* Contract */,
835
+ code: DiagnosticCode4.SlotExclusive,
836
+ category: DiagnosticCategory4.Contract,
972
837
  component: name,
973
838
  message: `${name}: "as" and "asChild" are mutually exclusive`
974
839
  };
975
840
  },
976
841
  singleChildRequired(name, elementTerm) {
977
842
  return {
978
- code: "SLOT1002" /* SlotSingleChild */,
979
- category: 0 /* Contract */,
843
+ code: DiagnosticCode4.SlotSingleChild,
844
+ category: DiagnosticCategory4.Contract,
980
845
  component: name,
981
846
  message: `${name}: asChild requires a ${elementTerm} child`
982
847
  };
983
848
  },
984
849
  singleChildExceeded(name, elementTerm, count) {
985
850
  return {
986
- code: "SLOT1002" /* SlotSingleChild */,
987
- category: 0 /* Contract */,
851
+ code: DiagnosticCode4.SlotSingleChild,
852
+ category: DiagnosticCategory4.Contract,
988
853
  component: name,
989
854
  message: `${name}: asChild requires exactly one ${elementTerm} child, got ${count}`
990
855
  };
@@ -992,16 +857,16 @@ var SlotDiagnostics = {
992
857
  discardedChildren(name, elementTerm, count) {
993
858
  const suffix = count === 1 ? "" : "ren";
994
859
  return {
995
- code: "SLOT1003" /* SlotDiscardedChildren */,
996
- category: 0 /* Contract */,
860
+ code: DiagnosticCode4.SlotDiscardedChildren,
861
+ category: DiagnosticCategory4.Contract,
997
862
  component: name,
998
863
  message: `${name}: asChild discarded ${count} non-element child${suffix} \u2014 only ${elementTerm}s are valid asChild children.`
999
864
  };
1000
865
  },
1001
866
  renderFnRequired(name, received) {
1002
867
  return {
1003
- code: "SLOT1004" /* SlotRenderFn */,
1004
- category: 0 /* Contract */,
868
+ code: DiagnosticCode4.SlotRenderFn,
869
+ category: DiagnosticCategory4.Contract,
1005
870
  component: name,
1006
871
  message: `${name}: asChild requires a render function as children, got ${received}`
1007
872
  };
@@ -2166,6 +2031,7 @@ function createClassPipeline(resolved) {
2166
2031
  }
2167
2032
 
2168
2033
  // ../core/src/options/resolve-factory-options.ts
2034
+ import { silentDiagnostics } from "../_shared/diagnostics.js";
2169
2035
  var EMPTY_VARIANT_KEYS = /* @__PURE__ */ new Set();
2170
2036
  function composeNormalizers(normalizers, fn) {
2171
2037
  if (!normalizers?.length) return fn;
@@ -2257,21 +2123,25 @@ function validateRenderProps(diagnostics, options, props, recipeKey) {
2257
2123
  }
2258
2124
  }
2259
2125
 
2126
+ // ../core/src/factory/plugin-invariants.ts
2127
+ import { throwDiagnostics } from "../_shared/diagnostics.js";
2128
+
2260
2129
  // ../core/src/factory/plugin-diagnostics.ts
2130
+ import { DiagnosticCategory as DiagnosticCategory5, DiagnosticCode as DiagnosticCode5 } from "../_shared/diagnostics.js";
2261
2131
  var PluginDiagnostics = {
2262
2132
  invalidShape(received) {
2263
2133
  const got = received === null ? "null" : typeof received;
2264
2134
  return {
2265
- code: "PLUGIN7001" /* PluginInvalidShape */,
2266
- category: 7 /* Internal */,
2135
+ code: DiagnosticCode5.PluginInvalidShape,
2136
+ category: DiagnosticCategory5.Internal,
2267
2137
  message: `[praxis-kit] Plugin factory must return an object with a 'pipeline' function. Got: ${got}.`
2268
2138
  };
2269
2139
  },
2270
2140
  pipelineReturnType(received) {
2271
2141
  const got = received === null ? "null" : Array.isArray(received) ? "array" : typeof received;
2272
2142
  return {
2273
- code: "PLUGIN7002" /* PluginPipelineReturnType */,
2274
- category: 7 /* Internal */,
2143
+ code: DiagnosticCode5.PluginPipelineReturnType,
2144
+ category: DiagnosticCategory5.Internal,
2275
2145
  message: `[praxis-kit] Plugin pipeline must return a string. Got: ${got}.`
2276
2146
  };
2277
2147
  }
@@ -2400,7 +2270,8 @@ function composeFilter(ownedKeys, filterProps) {
2400
2270
  }
2401
2271
 
2402
2272
  // ../../lib/adapter-utils/src/resolve-adapter-common-options.ts
2403
- function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics) {
2273
+ import { throwDiagnostics as throwDiagnostics2, silentDiagnostics as silentDiagnostics2 } from "../_shared/diagnostics.js";
2274
+ function resolveAdapterCommonOptions(options, defaultName = "PolymorphicComponent", defaultDiagnostics = throwDiagnostics2) {
2404
2275
  return {
2405
2276
  name: options.name ?? defaultName,
2406
2277
  diagnostics: options.enforcement?.diagnostics ?? defaultDiagnostics
@@ -1,7 +1,91 @@
1
- import { VariantMap, ClassPipelineOptions, ClassPlugin } from '@praxis-kit/core';
2
- import { Simplify } from 'type-fest';
3
- import { Diagnostics } from '@praxis-kit/diagnostics';
4
- import { EmptyRecord } from '@praxis-kit/primitive';
1
+ import { Diagnostics } from '../_shared/diagnostics.js';
2
+ import { RequireAtLeastOne, Simplify } from 'type-fest';
3
+
4
+ type StringMap<T = unknown> = Record<string, T>;
5
+ type AnyRecord = StringMap<unknown>;
6
+
7
+ type IntrinsicTag = keyof HTMLElementTagNameMap;
8
+
9
+ type Booleanish = boolean | 'true' | 'false';
10
+ type ClassName = string | string[];
11
+ type EmptyRecord = Record<never, never>;
12
+ type NonEmptyArray<T> = [T, ...T[]];
13
+ type Numberish = number | `${number}`;
14
+ type Primitive = string | number | boolean;
15
+ type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
16
+
17
+ type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
18
+ type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
19
+ type CompoundVariantConditions<V extends VariantMap> = Simplify<{
20
+ [K in keyof V]: CompoundVariantConditionValue<V, K>;
21
+ }>;
22
+ type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
23
+ type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
24
+ type CompoundVariant$1<V extends VariantMap> = CompoundVariantBase<V> & {
25
+ class: VariantValue;
26
+ };
27
+
28
+ interface CVACompounds<V extends VariantMap> {
29
+ compoundVariants?: readonly CompoundVariant$1<V>[];
30
+ }
31
+
32
+ interface CVADefaults<V extends VariantMap> {
33
+ defaultVariants?: DefaultVariants<V>;
34
+ }
35
+
36
+ interface CVAVariants<V extends VariantMap> {
37
+ variants?: V;
38
+ }
39
+
40
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
41
+ type VariantValue = string | string[];
42
+ type VariantStates<K extends string = string> = Record<K, VariantValue>;
43
+ type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
44
+ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
45
+ /**
46
+ * A partial selection of variant states authored at factory definition time.
47
+ *
48
+ * Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
49
+ * resolve the union at constraint-check time without deferred conditional types.
50
+ */
51
+ type VariantSelection$1<V extends VariantMap> = {
52
+ [K in keyof V]?: keyof V[K];
53
+ };
54
+ type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
55
+ type DefaultVariants<V extends VariantMap> = {
56
+ [K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>;
57
+ };
58
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection$1<TVariants>;
59
+
60
+ interface BaseClassOptions {
61
+ baseClassName?: ClassName;
62
+ }
63
+
64
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
65
+
66
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
67
+ recipeMap?: Record<string, RecipeTarget<TVariants>>;
68
+ }
69
+
70
+ interface TagMapOptions {
71
+ tagMap?: TagMap;
72
+ }
73
+
74
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
75
+
76
+ type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
77
+
78
+ type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
79
+
80
+ type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
81
+
82
+ type OwnedPropKeys = ReadonlySet<string>;
83
+
84
+ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
85
+ pipeline: ClassPipelineFn;
86
+ ownedKeys?: OwnedPropKeys;
87
+ readonly _pluginProps?: TProps;
88
+ }>;
5
89
 
6
90
  declare const LAYOUT_FAMILY_MAP: {
7
91
  readonly flex: "flex";