praxis-kit 4.0.0 → 4.0.1
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/contract/index.d.ts +385 -2
- package/dist/lit/index.d.ts +362 -5
- package/dist/merge-refs-CEpa0zK1.d.ts +540 -0
- package/dist/preact/index.d.ts +375 -5
- package/dist/react/index.d.ts +3 -7
- package/dist/react/legacy.d.ts +3 -7
- package/dist/solid/index.d.ts +375 -5
- package/dist/svelte/index.d.ts +452 -5
- package/dist/tailwind/index.d.ts +229 -4
- package/dist/vite-plugin/index.d.ts +138 -2
- package/dist/vue/index.d.ts +375 -5
- package/dist/web/index.d.ts +362 -6
- package/package.json +3 -3
- package/dist/merge-refs-DUuHyTRO.d.ts +0 -144
package/dist/tailwind/index.d.ts
CHANGED
|
@@ -1,7 +1,232 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Except, RequireAtLeastOne, Simplify } from 'type-fest';
|
|
2
|
+
|
|
3
|
+
type StringMap<T = unknown> = Record<string, T>;
|
|
4
|
+
type AnyRecord = StringMap<unknown>;
|
|
5
|
+
|
|
6
|
+
type IntrinsicTag = keyof HTMLElementTagNameMap;
|
|
7
|
+
|
|
8
|
+
type Booleanish = boolean | 'true' | 'false';
|
|
9
|
+
type ClassName = string | string[];
|
|
10
|
+
type EmptyRecord = Record<never, never>;
|
|
11
|
+
type NonEmptyArray<T> = [T, ...T[]];
|
|
12
|
+
type Numberish = number | `${number}`;
|
|
13
|
+
type Primitive = string | number | boolean;
|
|
14
|
+
type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
|
|
15
|
+
|
|
16
|
+
declare enum DiagnosticCategory {
|
|
17
|
+
Contract = 0,
|
|
18
|
+
HTML = 1,
|
|
19
|
+
ARIA = 2,
|
|
20
|
+
Composition = 3,
|
|
21
|
+
Rendering = 4,
|
|
22
|
+
Accessibility = 5,
|
|
23
|
+
Performance = 6,
|
|
24
|
+
Internal = 7,
|
|
25
|
+
Deprecation = 8,
|
|
26
|
+
Lint = 9
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare enum DiagnosticCode {
|
|
30
|
+
MissingRequiredChild = "COMP1001",
|
|
31
|
+
InvalidParent = "COMP1002",
|
|
32
|
+
InvalidChild = "COMP1003",
|
|
33
|
+
UnexpectedChild = "COMP1004",
|
|
34
|
+
AmbiguousChild = "COMP1005",
|
|
35
|
+
CardinalityMin = "COMP1006",
|
|
36
|
+
CardinalityMax = "COMP1007",
|
|
37
|
+
PositionViolation = "COMP1008",
|
|
38
|
+
AllowedAsViolation = "COMP1009",
|
|
39
|
+
SlotExclusive = "SLOT1001",
|
|
40
|
+
SlotSingleChild = "SLOT1002",
|
|
41
|
+
SlotDiscardedChildren = "SLOT1003",
|
|
42
|
+
SlotRenderFn = "SLOT1004",
|
|
43
|
+
MissingAriaRelationship = "ARIA2001",
|
|
44
|
+
AriaViolation = "ARIA2002",
|
|
45
|
+
AriaAttributeInvalid = "ARIA2003",
|
|
46
|
+
AriaMissingLiveRegion = "ARIA2004",
|
|
47
|
+
AriaMissingAtomic = "ARIA2005",
|
|
48
|
+
AriaRelevantInvalidToken = "ARIA2006",
|
|
49
|
+
AriaRelevantSuperseded = "ARIA2007",
|
|
50
|
+
AriaInvalidRole = "ARIA2008",
|
|
51
|
+
AriaMissingAccessibleName = "ARIA2009",
|
|
52
|
+
AriaAttributeOnPresentational = "ARIA2010",
|
|
53
|
+
AriaHiddenOnFocusable = "ARIA2011",
|
|
54
|
+
AriaRequiredProperty = "ARIA2012",
|
|
55
|
+
AriaInvalidAttributeValue = "ARIA2013",
|
|
56
|
+
AriaRedundantLevelAttribute = "ARIA2014",
|
|
57
|
+
InvalidHeadingHierarchy = "HTML3001",
|
|
58
|
+
HtmlEmptyRole = "HTML3002",
|
|
59
|
+
HtmlImplicitRoleRedundant = "HTML3003",
|
|
60
|
+
HtmlImplicitRoleOverride = "HTML3004",
|
|
61
|
+
HtmlStandaloneRegionOverride = "HTML3005",
|
|
62
|
+
HtmlLandmarkRoleOverride = "HTML3006",
|
|
63
|
+
HtmlInvalidChild = "HTML3007",
|
|
64
|
+
InvalidRenderingTarget = "RENDER4001",
|
|
65
|
+
LintDeadCompoundKey = "LINT5001",
|
|
66
|
+
LintDeadCompoundValue = "LINT5002",
|
|
67
|
+
LintDeadCompoundNonLiteral = "LINT5003",
|
|
68
|
+
LintMissingStrict = "LINT5004",
|
|
69
|
+
LintInvalidDefaultKey = "LINT5005",
|
|
70
|
+
LintInvalidDefaultValue = "LINT5006",
|
|
71
|
+
LintInvalidDefaultNonLiteral = "LINT5007",
|
|
72
|
+
LintNegativeMin = "LINT5008",
|
|
73
|
+
LintNegativeMax = "LINT5009",
|
|
74
|
+
LintMaxLessThanMin = "LINT5010",
|
|
75
|
+
LintZeroMax = "LINT5011",
|
|
76
|
+
LintMultipleFirst = "LINT5012",
|
|
77
|
+
LintMultipleLast = "LINT5013",
|
|
78
|
+
LintMinSumExceedsCapacity = "LINT5014",
|
|
79
|
+
LintCardinalityViolation = "LINT5015",
|
|
80
|
+
LintAriaTagOverride = "LINT5016",
|
|
81
|
+
ContractUnknownVariantDim = "COMP1010",
|
|
82
|
+
ContractUnknownVariantValue = "COMP1011",
|
|
83
|
+
ContractUnknownRecipeKey = "COMP1012",
|
|
84
|
+
ContractInvalidVariantValue = "COMP1013",
|
|
85
|
+
TailwindMultipleDisplayProps = "CSS6001",
|
|
86
|
+
TailwindReservedLayoutLiteral = "CSS6002",
|
|
87
|
+
TailwindDeadVariantClass = "CSS6003",
|
|
88
|
+
PluginInvalidShape = "PLUGIN7001",
|
|
89
|
+
PluginPipelineReturnType = "PLUGIN7002",
|
|
90
|
+
InternalError = "INTERNAL9000"
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface SourcePosition {
|
|
94
|
+
line: number;
|
|
95
|
+
col: number;
|
|
96
|
+
}
|
|
97
|
+
interface SourceLocation {
|
|
98
|
+
file: string;
|
|
99
|
+
start: SourcePosition;
|
|
100
|
+
end?: SourcePosition;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare enum Severity {
|
|
104
|
+
Debug = 0,
|
|
105
|
+
Info = 1,
|
|
106
|
+
Warning = 2,
|
|
107
|
+
Error = 3,
|
|
108
|
+
Fatal = 4
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
interface DiagnosticSuggestion {
|
|
112
|
+
title: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
fix?: string;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type Context = AnyRecord;
|
|
118
|
+
type Metadata = AnyRecord;
|
|
119
|
+
interface Diagnostic {
|
|
120
|
+
code: DiagnosticCode;
|
|
121
|
+
severity: Severity;
|
|
122
|
+
category: DiagnosticCategory;
|
|
123
|
+
message: string;
|
|
124
|
+
rationale?: string;
|
|
125
|
+
component?: string;
|
|
126
|
+
contract?: string;
|
|
127
|
+
location?: SourceLocation;
|
|
128
|
+
suggestions?: DiagnosticSuggestion[];
|
|
129
|
+
context?: Context;
|
|
130
|
+
metadata?: Metadata;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
declare enum Enforcement {
|
|
134
|
+
Ignore = 0,
|
|
135
|
+
Report = 1,
|
|
136
|
+
Throw = 2
|
|
137
|
+
}
|
|
138
|
+
interface DiagnosticPolicy {
|
|
139
|
+
resolve(diagnostic: Diagnostic): Enforcement;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface DiagnosticReporter {
|
|
143
|
+
report(diagnostic: Diagnostic): void;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
type DiagnosticInput = Except<Diagnostic, 'severity'>;
|
|
147
|
+
declare class Diagnostics {
|
|
148
|
+
private readonly reporter;
|
|
149
|
+
private readonly policy;
|
|
150
|
+
readonly active: boolean;
|
|
151
|
+
constructor(reporter: DiagnosticReporter, policy?: DiagnosticPolicy);
|
|
152
|
+
report(diagnostic: Diagnostic): Diagnostic;
|
|
153
|
+
warn(input: DiagnosticInput): Diagnostic;
|
|
154
|
+
error(input: DiagnosticInput): Diagnostic;
|
|
155
|
+
info(input: DiagnosticInput): Diagnostic;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
|
|
159
|
+
type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
|
|
160
|
+
type CompoundVariantConditions<V extends VariantMap> = Simplify<{
|
|
161
|
+
[K in keyof V]: CompoundVariantConditionValue<V, K>;
|
|
162
|
+
}>;
|
|
163
|
+
type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
|
|
164
|
+
type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
|
|
165
|
+
type CompoundVariant$1<V extends VariantMap> = CompoundVariantBase<V> & {
|
|
166
|
+
class: VariantValue;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
interface CVACompounds<V extends VariantMap> {
|
|
170
|
+
compoundVariants?: readonly CompoundVariant$1<V>[];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
interface CVADefaults<V extends VariantMap> {
|
|
174
|
+
defaultVariants?: DefaultVariants<V>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
interface CVAVariants<V extends VariantMap> {
|
|
178
|
+
variants?: V;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
|
|
182
|
+
type VariantValue = string | string[];
|
|
183
|
+
type VariantStates<K extends string = string> = Record<K, VariantValue>;
|
|
184
|
+
type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
|
|
185
|
+
type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
|
|
186
|
+
/**
|
|
187
|
+
* A partial selection of variant states authored at factory definition time.
|
|
188
|
+
*
|
|
189
|
+
* Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
|
|
190
|
+
* resolve the union at constraint-check time without deferred conditional types.
|
|
191
|
+
*/
|
|
192
|
+
type VariantSelection$1<V extends VariantMap> = {
|
|
193
|
+
[K in keyof V]?: keyof V[K];
|
|
194
|
+
};
|
|
195
|
+
type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
|
|
196
|
+
type DefaultVariants<V extends VariantMap> = {
|
|
197
|
+
[K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>;
|
|
198
|
+
};
|
|
199
|
+
type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection$1<TVariants>;
|
|
200
|
+
|
|
201
|
+
interface BaseClassOptions {
|
|
202
|
+
baseClassName?: ClassName;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string;
|
|
206
|
+
|
|
207
|
+
interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
|
|
208
|
+
recipeMap?: Record<string, RecipeTarget<TVariants>>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
interface TagMapOptions {
|
|
212
|
+
tagMap?: TagMap;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
|
|
216
|
+
|
|
217
|
+
type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
|
|
218
|
+
|
|
219
|
+
type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
|
|
220
|
+
|
|
221
|
+
type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
|
|
222
|
+
|
|
223
|
+
type OwnedPropKeys = ReadonlySet<string>;
|
|
224
|
+
|
|
225
|
+
type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
|
|
226
|
+
pipeline: ClassPipelineFn;
|
|
227
|
+
ownedKeys?: OwnedPropKeys;
|
|
228
|
+
readonly _pluginProps?: TProps;
|
|
229
|
+
}>;
|
|
5
230
|
|
|
6
231
|
declare const LAYOUT_FAMILY_MAP: {
|
|
7
232
|
readonly flex: "flex";
|
|
@@ -1,8 +1,144 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import {
|
|
3
|
-
import { DiagnosticInput } from '@praxis-kit/diagnostics';
|
|
2
|
+
import { Except, Simplify } from 'type-fest';
|
|
4
3
|
import ts from 'typescript';
|
|
5
4
|
|
|
5
|
+
type StringMap<T = unknown> = Record<string, T>;
|
|
6
|
+
type AnyRecord = StringMap<unknown>;
|
|
7
|
+
|
|
8
|
+
declare enum DiagnosticCategory {
|
|
9
|
+
Contract = 0,
|
|
10
|
+
HTML = 1,
|
|
11
|
+
ARIA = 2,
|
|
12
|
+
Composition = 3,
|
|
13
|
+
Rendering = 4,
|
|
14
|
+
Accessibility = 5,
|
|
15
|
+
Performance = 6,
|
|
16
|
+
Internal = 7,
|
|
17
|
+
Deprecation = 8,
|
|
18
|
+
Lint = 9
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare enum DiagnosticCode {
|
|
22
|
+
MissingRequiredChild = "COMP1001",
|
|
23
|
+
InvalidParent = "COMP1002",
|
|
24
|
+
InvalidChild = "COMP1003",
|
|
25
|
+
UnexpectedChild = "COMP1004",
|
|
26
|
+
AmbiguousChild = "COMP1005",
|
|
27
|
+
CardinalityMin = "COMP1006",
|
|
28
|
+
CardinalityMax = "COMP1007",
|
|
29
|
+
PositionViolation = "COMP1008",
|
|
30
|
+
AllowedAsViolation = "COMP1009",
|
|
31
|
+
SlotExclusive = "SLOT1001",
|
|
32
|
+
SlotSingleChild = "SLOT1002",
|
|
33
|
+
SlotDiscardedChildren = "SLOT1003",
|
|
34
|
+
SlotRenderFn = "SLOT1004",
|
|
35
|
+
MissingAriaRelationship = "ARIA2001",
|
|
36
|
+
AriaViolation = "ARIA2002",
|
|
37
|
+
AriaAttributeInvalid = "ARIA2003",
|
|
38
|
+
AriaMissingLiveRegion = "ARIA2004",
|
|
39
|
+
AriaMissingAtomic = "ARIA2005",
|
|
40
|
+
AriaRelevantInvalidToken = "ARIA2006",
|
|
41
|
+
AriaRelevantSuperseded = "ARIA2007",
|
|
42
|
+
AriaInvalidRole = "ARIA2008",
|
|
43
|
+
AriaMissingAccessibleName = "ARIA2009",
|
|
44
|
+
AriaAttributeOnPresentational = "ARIA2010",
|
|
45
|
+
AriaHiddenOnFocusable = "ARIA2011",
|
|
46
|
+
AriaRequiredProperty = "ARIA2012",
|
|
47
|
+
AriaInvalidAttributeValue = "ARIA2013",
|
|
48
|
+
AriaRedundantLevelAttribute = "ARIA2014",
|
|
49
|
+
InvalidHeadingHierarchy = "HTML3001",
|
|
50
|
+
HtmlEmptyRole = "HTML3002",
|
|
51
|
+
HtmlImplicitRoleRedundant = "HTML3003",
|
|
52
|
+
HtmlImplicitRoleOverride = "HTML3004",
|
|
53
|
+
HtmlStandaloneRegionOverride = "HTML3005",
|
|
54
|
+
HtmlLandmarkRoleOverride = "HTML3006",
|
|
55
|
+
HtmlInvalidChild = "HTML3007",
|
|
56
|
+
InvalidRenderingTarget = "RENDER4001",
|
|
57
|
+
LintDeadCompoundKey = "LINT5001",
|
|
58
|
+
LintDeadCompoundValue = "LINT5002",
|
|
59
|
+
LintDeadCompoundNonLiteral = "LINT5003",
|
|
60
|
+
LintMissingStrict = "LINT5004",
|
|
61
|
+
LintInvalidDefaultKey = "LINT5005",
|
|
62
|
+
LintInvalidDefaultValue = "LINT5006",
|
|
63
|
+
LintInvalidDefaultNonLiteral = "LINT5007",
|
|
64
|
+
LintNegativeMin = "LINT5008",
|
|
65
|
+
LintNegativeMax = "LINT5009",
|
|
66
|
+
LintMaxLessThanMin = "LINT5010",
|
|
67
|
+
LintZeroMax = "LINT5011",
|
|
68
|
+
LintMultipleFirst = "LINT5012",
|
|
69
|
+
LintMultipleLast = "LINT5013",
|
|
70
|
+
LintMinSumExceedsCapacity = "LINT5014",
|
|
71
|
+
LintCardinalityViolation = "LINT5015",
|
|
72
|
+
LintAriaTagOverride = "LINT5016",
|
|
73
|
+
ContractUnknownVariantDim = "COMP1010",
|
|
74
|
+
ContractUnknownVariantValue = "COMP1011",
|
|
75
|
+
ContractUnknownRecipeKey = "COMP1012",
|
|
76
|
+
ContractInvalidVariantValue = "COMP1013",
|
|
77
|
+
TailwindMultipleDisplayProps = "CSS6001",
|
|
78
|
+
TailwindReservedLayoutLiteral = "CSS6002",
|
|
79
|
+
TailwindDeadVariantClass = "CSS6003",
|
|
80
|
+
PluginInvalidShape = "PLUGIN7001",
|
|
81
|
+
PluginPipelineReturnType = "PLUGIN7002",
|
|
82
|
+
InternalError = "INTERNAL9000"
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface SourcePosition {
|
|
86
|
+
line: number;
|
|
87
|
+
col: number;
|
|
88
|
+
}
|
|
89
|
+
interface SourceLocation {
|
|
90
|
+
file: string;
|
|
91
|
+
start: SourcePosition;
|
|
92
|
+
end?: SourcePosition;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare enum Severity$1 {
|
|
96
|
+
Debug = 0,
|
|
97
|
+
Info = 1,
|
|
98
|
+
Warning = 2,
|
|
99
|
+
Error = 3,
|
|
100
|
+
Fatal = 4
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface DiagnosticSuggestion {
|
|
104
|
+
title: string;
|
|
105
|
+
description?: string;
|
|
106
|
+
fix?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type Context = AnyRecord;
|
|
110
|
+
type Metadata = AnyRecord;
|
|
111
|
+
interface Diagnostic$1 {
|
|
112
|
+
code: DiagnosticCode;
|
|
113
|
+
severity: Severity$1;
|
|
114
|
+
category: DiagnosticCategory;
|
|
115
|
+
message: string;
|
|
116
|
+
rationale?: string;
|
|
117
|
+
component?: string;
|
|
118
|
+
contract?: string;
|
|
119
|
+
location?: SourceLocation;
|
|
120
|
+
suggestions?: DiagnosticSuggestion[];
|
|
121
|
+
context?: Context;
|
|
122
|
+
metadata?: Metadata;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
type DiagnosticInput = Except<Diagnostic$1, 'severity'>;
|
|
126
|
+
|
|
127
|
+
type MinMax = {
|
|
128
|
+
min: number;
|
|
129
|
+
max: number;
|
|
130
|
+
};
|
|
131
|
+
/** Unboundedness is encoded in the type, not a sentinel value, enabling exhaustive switches. */
|
|
132
|
+
type Cardinality = Simplify<{
|
|
133
|
+
kind: 'bounded';
|
|
134
|
+
} & MinMax> | {
|
|
135
|
+
kind: 'unbounded';
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
type ChildRulePosition = 'first' | 'last' | 'any';
|
|
139
|
+
|
|
140
|
+
type Severity = 'error' | 'warning' | (string & {});
|
|
141
|
+
|
|
6
142
|
/**
|
|
7
143
|
* One enforcement.children rule whose cardinality is statically extractable
|
|
8
144
|
* from the factory call AST. The `Cardinality` discriminated union matches the
|