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.
@@ -1,4 +1,5 @@
1
- import { Except, RequireAtLeastOne, Simplify, ReadonlyDeep } from 'type-fest';
1
+ import { RequireAtLeastOne, Simplify, ReadonlyDeep } from 'type-fest';
2
+ import { Diagnostics, DiagnosticInput } from '../_shared/diagnostics.js';
2
3
 
3
4
  type StringMap<T = unknown> = Record<string, T>;
4
5
  type AnyRecord = StringMap<unknown>;
@@ -22,148 +23,6 @@ type IntrinsicProps = AnyRecord & {
22
23
  };
23
24
  type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
24
25
 
25
- declare enum DiagnosticCategory {
26
- Contract = 0,
27
- HTML = 1,
28
- ARIA = 2,
29
- Composition = 3,
30
- Rendering = 4,
31
- Accessibility = 5,
32
- Performance = 6,
33
- Internal = 7,
34
- Deprecation = 8,
35
- Lint = 9
36
- }
37
-
38
- declare enum DiagnosticCode {
39
- MissingRequiredChild = "COMP1001",
40
- InvalidParent = "COMP1002",
41
- InvalidChild = "COMP1003",
42
- UnexpectedChild = "COMP1004",
43
- AmbiguousChild = "COMP1005",
44
- CardinalityMin = "COMP1006",
45
- CardinalityMax = "COMP1007",
46
- PositionViolation = "COMP1008",
47
- AllowedAsViolation = "COMP1009",
48
- SlotExclusive = "SLOT1001",
49
- SlotSingleChild = "SLOT1002",
50
- SlotDiscardedChildren = "SLOT1003",
51
- SlotRenderFn = "SLOT1004",
52
- MissingAriaRelationship = "ARIA2001",
53
- AriaViolation = "ARIA2002",
54
- AriaAttributeInvalid = "ARIA2003",
55
- AriaMissingLiveRegion = "ARIA2004",
56
- AriaMissingAtomic = "ARIA2005",
57
- AriaRelevantInvalidToken = "ARIA2006",
58
- AriaRelevantSuperseded = "ARIA2007",
59
- AriaInvalidRole = "ARIA2008",
60
- AriaMissingAccessibleName = "ARIA2009",
61
- AriaAttributeOnPresentational = "ARIA2010",
62
- AriaHiddenOnFocusable = "ARIA2011",
63
- AriaRequiredProperty = "ARIA2012",
64
- AriaInvalidAttributeValue = "ARIA2013",
65
- AriaRedundantLevelAttribute = "ARIA2014",
66
- InvalidHeadingHierarchy = "HTML3001",
67
- HtmlEmptyRole = "HTML3002",
68
- HtmlImplicitRoleRedundant = "HTML3003",
69
- HtmlImplicitRoleOverride = "HTML3004",
70
- HtmlStandaloneRegionOverride = "HTML3005",
71
- HtmlLandmarkRoleOverride = "HTML3006",
72
- HtmlInvalidChild = "HTML3007",
73
- InvalidRenderingTarget = "RENDER4001",
74
- LintDeadCompoundKey = "LINT5001",
75
- LintDeadCompoundValue = "LINT5002",
76
- LintDeadCompoundNonLiteral = "LINT5003",
77
- LintMissingStrict = "LINT5004",
78
- LintInvalidDefaultKey = "LINT5005",
79
- LintInvalidDefaultValue = "LINT5006",
80
- LintInvalidDefaultNonLiteral = "LINT5007",
81
- LintNegativeMin = "LINT5008",
82
- LintNegativeMax = "LINT5009",
83
- LintMaxLessThanMin = "LINT5010",
84
- LintZeroMax = "LINT5011",
85
- LintMultipleFirst = "LINT5012",
86
- LintMultipleLast = "LINT5013",
87
- LintMinSumExceedsCapacity = "LINT5014",
88
- LintCardinalityViolation = "LINT5015",
89
- LintAriaTagOverride = "LINT5016",
90
- ContractUnknownVariantDim = "COMP1010",
91
- ContractUnknownVariantValue = "COMP1011",
92
- ContractUnknownRecipeKey = "COMP1012",
93
- ContractInvalidVariantValue = "COMP1013",
94
- TailwindMultipleDisplayProps = "CSS6001",
95
- TailwindReservedLayoutLiteral = "CSS6002",
96
- TailwindDeadVariantClass = "CSS6003",
97
- PluginInvalidShape = "PLUGIN7001",
98
- PluginPipelineReturnType = "PLUGIN7002",
99
- InternalError = "INTERNAL9000"
100
- }
101
-
102
- interface SourcePosition {
103
- line: number;
104
- col: number;
105
- }
106
- interface SourceLocation {
107
- file: string;
108
- start: SourcePosition;
109
- end?: SourcePosition;
110
- }
111
-
112
- declare enum Severity$1 {
113
- Debug = 0,
114
- Info = 1,
115
- Warning = 2,
116
- Error = 3,
117
- Fatal = 4
118
- }
119
-
120
- interface DiagnosticSuggestion {
121
- title: string;
122
- description?: string;
123
- fix?: string;
124
- }
125
-
126
- type Context = AnyRecord;
127
- type Metadata = AnyRecord;
128
- interface Diagnostic {
129
- code: DiagnosticCode;
130
- severity: Severity$1;
131
- category: DiagnosticCategory;
132
- message: string;
133
- rationale?: string;
134
- component?: string;
135
- contract?: string;
136
- location?: SourceLocation;
137
- suggestions?: DiagnosticSuggestion[];
138
- context?: Context;
139
- metadata?: Metadata;
140
- }
141
-
142
- declare enum Enforcement {
143
- Ignore = 0,
144
- Report = 1,
145
- Throw = 2
146
- }
147
- interface DiagnosticPolicy {
148
- resolve(diagnostic: Diagnostic): Enforcement;
149
- }
150
-
151
- interface DiagnosticReporter {
152
- report(diagnostic: Diagnostic): void;
153
- }
154
-
155
- type DiagnosticInput = Except<Diagnostic, 'severity'>;
156
- declare class Diagnostics {
157
- private readonly reporter;
158
- private readonly policy;
159
- readonly active: boolean;
160
- constructor(reporter: DiagnosticReporter, policy?: DiagnosticPolicy);
161
- report(diagnostic: Diagnostic): Diagnostic;
162
- warn(input: DiagnosticInput): Diagnostic;
163
- error(input: DiagnosticInput): Diagnostic;
164
- info(input: DiagnosticInput): Diagnostic;
165
- }
166
-
167
26
  type MinMax = {
168
27
  min: number;
169
28
  max: number;