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 } from 'type-fest';
1
+ import { Diagnostics } from '../_shared/diagnostics.js';
2
+ import { RequireAtLeastOne, Simplify } from 'type-fest';
2
3
 
3
4
  type StringMap<T = unknown> = Record<string, T>;
4
5
  type AnyRecord = StringMap<unknown>;
@@ -13,148 +14,6 @@ type Numberish = number | `${number}`;
13
14
  type Primitive = string | number | boolean;
14
15
  type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
15
16
 
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
17
  type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
159
18
  type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
160
19
  type CompoundVariantConditions<V extends VariantMap> = Simplify<{
@@ -184,118 +184,6 @@ var iterate = Object.freeze({
184
184
  values
185
185
  });
186
186
 
187
- // ../../lib/diagnostics/src/category.ts
188
- var DiagnosticCategory = /* @__PURE__ */ ((DiagnosticCategory2) => {
189
- DiagnosticCategory2[DiagnosticCategory2["Contract"] = 0] = "Contract";
190
- DiagnosticCategory2[DiagnosticCategory2["HTML"] = 1] = "HTML";
191
- DiagnosticCategory2[DiagnosticCategory2["ARIA"] = 2] = "ARIA";
192
- DiagnosticCategory2[DiagnosticCategory2["Composition"] = 3] = "Composition";
193
- DiagnosticCategory2[DiagnosticCategory2["Rendering"] = 4] = "Rendering";
194
- DiagnosticCategory2[DiagnosticCategory2["Accessibility"] = 5] = "Accessibility";
195
- DiagnosticCategory2[DiagnosticCategory2["Performance"] = 6] = "Performance";
196
- DiagnosticCategory2[DiagnosticCategory2["Internal"] = 7] = "Internal";
197
- DiagnosticCategory2[DiagnosticCategory2["Deprecation"] = 8] = "Deprecation";
198
- DiagnosticCategory2[DiagnosticCategory2["Lint"] = 9] = "Lint";
199
- return DiagnosticCategory2;
200
- })(DiagnosticCategory || {});
201
-
202
- // ../../lib/diagnostics/src/error.ts
203
- var PraxisError = class extends Error {
204
- diagnostic;
205
- constructor(diagnostic) {
206
- super(diagnostic.message);
207
- this.name = "PraxisError";
208
- this.diagnostic = diagnostic;
209
- }
210
- };
211
-
212
- // ../../lib/diagnostics/src/severity.ts
213
- var Severity = /* @__PURE__ */ ((Severity2) => {
214
- Severity2[Severity2["Debug"] = 0] = "Debug";
215
- Severity2[Severity2["Info"] = 1] = "Info";
216
- Severity2[Severity2["Warning"] = 2] = "Warning";
217
- Severity2[Severity2["Error"] = 3] = "Error";
218
- Severity2[Severity2["Fatal"] = 4] = "Fatal";
219
- return Severity2;
220
- })(Severity || {});
221
-
222
- // ../../lib/diagnostics/src/policy.ts
223
- var DefaultPolicy = class {
224
- reportThreshold;
225
- throwThreshold;
226
- constructor({
227
- reportThreshold = 1 /* Info */,
228
- throwThreshold = 4 /* Fatal */
229
- } = {}) {
230
- this.reportThreshold = reportThreshold;
231
- this.throwThreshold = throwThreshold;
232
- }
233
- resolve(diagnostic) {
234
- if (diagnostic.severity >= this.throwThreshold) return 2 /* Throw */;
235
- if (diagnostic.severity >= this.reportThreshold) return 1 /* Report */;
236
- return 0 /* Ignore */;
237
- }
238
- };
239
-
240
- // ../../lib/diagnostics/src/diagnostics.ts
241
- var Diagnostics = class {
242
- reporter;
243
- policy;
244
- // Pre-computed at construction time: true if Warning-level diagnostics are not ignored.
245
- active;
246
- constructor(reporter, policy = new DefaultPolicy()) {
247
- this.reporter = reporter;
248
- this.policy = policy;
249
- this.active = policy.resolve({ severity: 2 /* Warning */ }) !== 0 /* Ignore */;
250
- }
251
- report(diagnostic) {
252
- const enforcement = this.policy.resolve(diagnostic);
253
- if (enforcement === 0 /* Ignore */) return diagnostic;
254
- if (enforcement === 2 /* Throw */) throw new PraxisError(diagnostic);
255
- this.reporter.report(diagnostic);
256
- return diagnostic;
257
- }
258
- warn(input) {
259
- return this.report({ ...input, severity: 2 /* Warning */ });
260
- }
261
- error(input) {
262
- return this.report({ ...input, severity: 3 /* Error */ });
263
- }
264
- info(input) {
265
- return this.report({ ...input, severity: 1 /* Info */ });
266
- }
267
- };
268
-
269
- // ../../lib/diagnostics/src/formatter.ts
270
- function formatDiagnostic(diagnostic) {
271
- const level = Severity[diagnostic.severity];
272
- const category = DiagnosticCategory[diagnostic.category];
273
- const prefix = category !== void 0 ? `[${category}] ` : "";
274
- return `${level} ${diagnostic.code}: ${prefix}${diagnostic.message}`;
275
- }
276
-
277
- // ../../lib/diagnostics/src/console-reporter.ts
278
- var ConsoleReporter = class {
279
- report(diagnostic) {
280
- const message = formatDiagnostic(diagnostic);
281
- switch (diagnostic.severity) {
282
- case 0 /* Debug */:
283
- console.debug(message);
284
- break;
285
- case 1 /* Info */:
286
- console.info(message);
287
- break;
288
- case 2 /* Warning */:
289
- console.warn(message);
290
- break;
291
- case 3 /* Error */:
292
- case 4 /* Fatal */:
293
- console.error(message);
294
- break;
295
- }
296
- }
297
- };
298
-
299
187
  // ../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs
300
188
  import { clsx as clsx2 } from "clsx";
301
189
  var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
@@ -649,26 +537,30 @@ var LayoutState = class {
649
537
  }
650
538
  };
651
539
 
540
+ // ../../lib/tailwind/src/create-tailwind-pipeline.ts
541
+ import { ConsoleReporter, Diagnostics, DefaultPolicy, Severity } from "../_shared/diagnostics.js";
542
+
652
543
  // ../../lib/tailwind/src/diagnostics.ts
544
+ import { DiagnosticCategory, DiagnosticCode } from "../_shared/diagnostics.js";
653
545
  var TailwindDiagnostics = {
654
546
  multipleDisplayProps(active) {
655
547
  return {
656
- code: "CSS6001" /* TailwindMultipleDisplayProps */,
657
- category: 0 /* Contract */,
548
+ code: DiagnosticCode.TailwindMultipleDisplayProps,
549
+ category: DiagnosticCategory.Contract,
658
550
  message: `[createTailwindPipeline] Multiple display props set (${active.join(", ")}); "${active[0]}" takes precedence.`
659
551
  };
660
552
  },
661
553
  reservedLayoutLiteral(reserved) {
662
554
  return {
663
- code: "CSS6002" /* TailwindReservedLayoutLiteral */,
664
- category: 0 /* Contract */,
555
+ code: DiagnosticCode.TailwindReservedLayoutLiteral,
556
+ category: DiagnosticCategory.Contract,
665
557
  message: `[createTailwindPipeline] Reserved display class(es) ${reserved.map((r) => `"${r}"`).join(", ")} found in resolved classes. The display mode is controlled by the display props (flex, inline-flex, grid, block, hidden, etc.), not by class strings.`
666
558
  };
667
559
  },
668
560
  deadVariantClass(dim, value, mode, classStr) {
669
561
  return {
670
- code: "CSS6003" /* TailwindDeadVariantClass */,
671
- category: 0 /* Contract */,
562
+ code: DiagnosticCode.TailwindDeadVariantClass,
563
+ category: DiagnosticCategory.Contract,
672
564
  message: `[createTailwindPipeline] Variant "${dim}=${value}" contributes only classes stripped under layout mode "${mode}" ("${classStr}") \u2014 it produces nothing in this mode.`
673
565
  };
674
566
  }
@@ -678,7 +570,7 @@ var TailwindDiagnostics = {
678
570
  var DEV = process.env.NODE_ENV !== "production";
679
571
  var devDiagnostics = new Diagnostics(
680
572
  new ConsoleReporter(),
681
- new DefaultPolicy({ reportThreshold: 2 /* Warning */, throwThreshold: 4 /* Fatal */ })
573
+ new DefaultPolicy({ reportThreshold: Severity.Warning, throwThreshold: Severity.Fatal })
682
574
  );
683
575
  var classifier = new ClassClassifier();
684
576
  var evaluator = new DependencyEvaluator(defaultDependencyRules);
@@ -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
  import * as vue from 'vue';
3
4
  import { AllowedComponentProps } from 'vue';
4
5
 
@@ -24,148 +25,6 @@ type IntrinsicProps = AnyRecord & {
24
25
  };
25
26
  type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
26
27
 
27
- declare enum DiagnosticCategory {
28
- Contract = 0,
29
- HTML = 1,
30
- ARIA = 2,
31
- Composition = 3,
32
- Rendering = 4,
33
- Accessibility = 5,
34
- Performance = 6,
35
- Internal = 7,
36
- Deprecation = 8,
37
- Lint = 9
38
- }
39
-
40
- declare enum DiagnosticCode {
41
- MissingRequiredChild = "COMP1001",
42
- InvalidParent = "COMP1002",
43
- InvalidChild = "COMP1003",
44
- UnexpectedChild = "COMP1004",
45
- AmbiguousChild = "COMP1005",
46
- CardinalityMin = "COMP1006",
47
- CardinalityMax = "COMP1007",
48
- PositionViolation = "COMP1008",
49
- AllowedAsViolation = "COMP1009",
50
- SlotExclusive = "SLOT1001",
51
- SlotSingleChild = "SLOT1002",
52
- SlotDiscardedChildren = "SLOT1003",
53
- SlotRenderFn = "SLOT1004",
54
- MissingAriaRelationship = "ARIA2001",
55
- AriaViolation = "ARIA2002",
56
- AriaAttributeInvalid = "ARIA2003",
57
- AriaMissingLiveRegion = "ARIA2004",
58
- AriaMissingAtomic = "ARIA2005",
59
- AriaRelevantInvalidToken = "ARIA2006",
60
- AriaRelevantSuperseded = "ARIA2007",
61
- AriaInvalidRole = "ARIA2008",
62
- AriaMissingAccessibleName = "ARIA2009",
63
- AriaAttributeOnPresentational = "ARIA2010",
64
- AriaHiddenOnFocusable = "ARIA2011",
65
- AriaRequiredProperty = "ARIA2012",
66
- AriaInvalidAttributeValue = "ARIA2013",
67
- AriaRedundantLevelAttribute = "ARIA2014",
68
- InvalidHeadingHierarchy = "HTML3001",
69
- HtmlEmptyRole = "HTML3002",
70
- HtmlImplicitRoleRedundant = "HTML3003",
71
- HtmlImplicitRoleOverride = "HTML3004",
72
- HtmlStandaloneRegionOverride = "HTML3005",
73
- HtmlLandmarkRoleOverride = "HTML3006",
74
- HtmlInvalidChild = "HTML3007",
75
- InvalidRenderingTarget = "RENDER4001",
76
- LintDeadCompoundKey = "LINT5001",
77
- LintDeadCompoundValue = "LINT5002",
78
- LintDeadCompoundNonLiteral = "LINT5003",
79
- LintMissingStrict = "LINT5004",
80
- LintInvalidDefaultKey = "LINT5005",
81
- LintInvalidDefaultValue = "LINT5006",
82
- LintInvalidDefaultNonLiteral = "LINT5007",
83
- LintNegativeMin = "LINT5008",
84
- LintNegativeMax = "LINT5009",
85
- LintMaxLessThanMin = "LINT5010",
86
- LintZeroMax = "LINT5011",
87
- LintMultipleFirst = "LINT5012",
88
- LintMultipleLast = "LINT5013",
89
- LintMinSumExceedsCapacity = "LINT5014",
90
- LintCardinalityViolation = "LINT5015",
91
- LintAriaTagOverride = "LINT5016",
92
- ContractUnknownVariantDim = "COMP1010",
93
- ContractUnknownVariantValue = "COMP1011",
94
- ContractUnknownRecipeKey = "COMP1012",
95
- ContractInvalidVariantValue = "COMP1013",
96
- TailwindMultipleDisplayProps = "CSS6001",
97
- TailwindReservedLayoutLiteral = "CSS6002",
98
- TailwindDeadVariantClass = "CSS6003",
99
- PluginInvalidShape = "PLUGIN7001",
100
- PluginPipelineReturnType = "PLUGIN7002",
101
- InternalError = "INTERNAL9000"
102
- }
103
-
104
- interface SourcePosition {
105
- line: number;
106
- col: number;
107
- }
108
- interface SourceLocation {
109
- file: string;
110
- start: SourcePosition;
111
- end?: SourcePosition;
112
- }
113
-
114
- declare enum Severity$1 {
115
- Debug = 0,
116
- Info = 1,
117
- Warning = 2,
118
- Error = 3,
119
- Fatal = 4
120
- }
121
-
122
- interface DiagnosticSuggestion {
123
- title: string;
124
- description?: string;
125
- fix?: string;
126
- }
127
-
128
- type Context = AnyRecord;
129
- type Metadata = AnyRecord;
130
- interface Diagnostic {
131
- code: DiagnosticCode;
132
- severity: Severity$1;
133
- category: DiagnosticCategory;
134
- message: string;
135
- rationale?: string;
136
- component?: string;
137
- contract?: string;
138
- location?: SourceLocation;
139
- suggestions?: DiagnosticSuggestion[];
140
- context?: Context;
141
- metadata?: Metadata;
142
- }
143
-
144
- declare enum Enforcement {
145
- Ignore = 0,
146
- Report = 1,
147
- Throw = 2
148
- }
149
- interface DiagnosticPolicy {
150
- resolve(diagnostic: Diagnostic): Enforcement;
151
- }
152
-
153
- interface DiagnosticReporter {
154
- report(diagnostic: Diagnostic): void;
155
- }
156
-
157
- type DiagnosticInput = Except<Diagnostic, 'severity'>;
158
- declare class Diagnostics {
159
- private readonly reporter;
160
- private readonly policy;
161
- readonly active: boolean;
162
- constructor(reporter: DiagnosticReporter, policy?: DiagnosticPolicy);
163
- report(diagnostic: Diagnostic): Diagnostic;
164
- warn(input: DiagnosticInput): Diagnostic;
165
- error(input: DiagnosticInput): Diagnostic;
166
- info(input: DiagnosticInput): Diagnostic;
167
- }
168
-
169
28
  type MinMax = {
170
29
  min: number;
171
30
  max: number;