praxis-kit 0.1.0

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.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +77 -0
  3. package/dist/_shared/diagnostics.d.ts +312 -0
  4. package/dist/_shared/diagnostics.js +360 -0
  5. package/dist/build-runtime-CJ_nQEaZ.js +5065 -0
  6. package/dist/codemod/index.d.ts +2 -0
  7. package/dist/codemod/index.js +176520 -0
  8. package/dist/contract/index.d.ts +677 -0
  9. package/dist/contract/index.js +341 -0
  10. package/dist/eslint/index.d.ts +90 -0
  11. package/dist/eslint/index.js +1047 -0
  12. package/dist/guards/index.d.ts +78 -0
  13. package/dist/guards/index.js +118 -0
  14. package/dist/html/index.d.ts +151 -0
  15. package/dist/html/index.js +1244 -0
  16. package/dist/index-BIBd_iPD.d.ts +951 -0
  17. package/dist/lit/index.d.ts +862 -0
  18. package/dist/lit/index.js +4893 -0
  19. package/dist/preact/index.d.ts +796 -0
  20. package/dist/preact/index.js +5043 -0
  21. package/dist/react/index.d.ts +28 -0
  22. package/dist/react/index.js +205 -0
  23. package/dist/react/legacy.d.ts +29 -0
  24. package/dist/react/legacy.js +80 -0
  25. package/dist/solid/index.d.ts +728 -0
  26. package/dist/solid/index.js +4821 -0
  27. package/dist/svelte/Polymorphic.svelte +190 -0
  28. package/dist/svelte/_polymorphic-runtime.d.ts +102 -0
  29. package/dist/svelte/_polymorphic-runtime.js +371 -0
  30. package/dist/svelte/index.d.ts +994 -0
  31. package/dist/svelte/index.js +4482 -0
  32. package/dist/tailwind/index.d.ts +197 -0
  33. package/dist/tailwind/index.js +767 -0
  34. package/dist/tailwind/safelist.css +20 -0
  35. package/dist/ts-plugin/index.cjs +166 -0
  36. package/dist/ts-plugin/index.d.cts +9 -0
  37. package/dist/utils/index.d.ts +19 -0
  38. package/dist/utils/index.js +21 -0
  39. package/dist/vite-plugin/index.d.ts +200 -0
  40. package/dist/vite-plugin/index.js +2106 -0
  41. package/dist/vue/index.d.ts +729 -0
  42. package/dist/vue/index.js +4945 -0
  43. package/dist/web/index.d.ts +832 -0
  44. package/dist/web/index.js +4868 -0
  45. package/package.json +258 -0
@@ -0,0 +1,197 @@
1
+ import "clsx";
2
+ import { DiagnosticCode, Diagnostics } from "../_shared/diagnostics.js";
3
+ import { RequireAtLeastOne, Simplify } from "type-fest";
4
+ //#region ../../lib/tailwind/src/layout-keys.d.ts
5
+ /**
6
+ * Canonical list of reserved layout prop names.
7
+ *
8
+ * This array is the single source of truth for every supported CSS `display`
9
+ * value exposed as a boolean prop. The `LayoutKey` type is derived directly
10
+ * from this list.
11
+ *
12
+ * To add a new display mode:
13
+ * 1. Add the display value here.
14
+ * 2. Register its layout family in `LAYOUT_FAMILY_MAP`.
15
+ *
16
+ * Prop names intentionally match the corresponding Tailwind/CSS display
17
+ * utilities, so no additional prop-to-class mapping is required.
18
+ */
19
+ export declare const layoutKeys: readonly ["flex", "inline-flex", "grid", "inline-grid", "block", "inline-block", "inline", "hidden", "contents", "flow-root", "list-item", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row"];
20
+ //#endregion
21
+ //#region ../../lib/foundation/src/string-map.d.ts
22
+ /**
23
+ * A string-keyed object whose values are of type `T`.
24
+ */
25
+ type StringMap<T = unknown> = Record<string, T>;
26
+ /**
27
+ * A string-keyed object with values of unknown type.
28
+ */
29
+ type AnyRecord = StringMap<unknown>;
30
+ //#endregion
31
+ //#region ../../lib/primitive/src/types/any-record.d.ts
32
+ /**
33
+ * An object type with no named properties.
34
+ *
35
+ * Unlike `{}`, this excludes arbitrary properties during type operations while
36
+ * still satisfying `extends object`.
37
+ */
38
+ type EmptyRecord = Record<never, never>;
39
+ //#endregion
40
+ //#region ../../lib/primitive/src/types/intrinsic-tag.d.ts
41
+ type IntrinsicTag = keyof HTMLElementTagNameMap;
42
+ //#endregion
43
+ //#region ../../lib/primitive/src/types/primitives/index.d.ts
44
+ type Booleanish = boolean | 'true' | 'false';
45
+ type ClassName = string | string[];
46
+ type NonEmptyArray<T> = [T, ...T[]];
47
+ type Numberish = number | `${number}`;
48
+ type Primitive = string | number | boolean;
49
+ type TagMap = Partial<Record<IntrinsicTag | (string & {}), ClassName>>;
50
+ //#endregion
51
+ //#region ../../lib/primitive/src/types/variants/string-to-boolean.d.ts
52
+ type StringToBoolean<T> = T extends 'true' | 'false' ? boolean : T;
53
+ //#endregion
54
+ //#region ../../lib/primitive/src/types/variants/variant-value.d.ts
55
+ type VariantValue = string | string[];
56
+ //#endregion
57
+ //#region ../../lib/primitive/src/types/variants/variant-states.d.ts
58
+ type VariantStates<K extends string = string> = Record<K, VariantValue>;
59
+ //#endregion
60
+ //#region ../../lib/primitive/src/types/variants/variant-map.d.ts
61
+ type VariantMap<V extends string = string, K extends string = string> = Record<V, VariantStates<K>>;
62
+ //#endregion
63
+ //#region ../../lib/primitive/src/types/variants/variant-key.d.ts
64
+ type VariantKey<V extends VariantMap, K extends keyof V> = StringToBoolean<keyof V[K] & string>;
65
+ //#endregion
66
+ //#region ../../lib/primitive/src/types/variants/variant-selection.d.ts
67
+ /**
68
+ * A partial selection of variant states authored at factory definition time.
69
+ *
70
+ * Uses `keyof V[K]` directly (not `VariantKey`) so TypeScript can eagerly
71
+ * resolve the union at constraint-check time without deferred conditional types.
72
+ */
73
+ type VariantSelection<V extends VariantMap> = { [K in keyof V]?: keyof V[K]; };
74
+ //#endregion
75
+ //#region ../../lib/primitive/src/types/variants/default-variants.d.ts
76
+ type NormalizedVariantValue<K extends string> = string extends K ? Primitive : K extends 'true' | 'false' ? Booleanish : K extends `${number}` ? Numberish : K;
77
+ type DefaultVariants<V extends VariantMap> = { [K in keyof V]?: NormalizedVariantValue<keyof V[K] & string>; };
78
+ //#endregion
79
+ //#region ../../lib/primitive/src/types/variants/recipe-target.d.ts
80
+ type RecipeTarget<TVariants extends VariantMap = VariantMap> = VariantSelection<TVariants>;
81
+ //#endregion
82
+ //#region ../../lib/primitive/src/types/variants/compound/compound-variant.d.ts
83
+ type RequireAtLeastOneIfNotEmpty<T> = keyof T extends never ? EmptyRecord : RequireAtLeastOne<T>;
84
+ type CompoundVariantConditionValue<V extends VariantMap, K extends keyof V> = VariantKey<V, K> | NonEmptyArray<VariantKey<V, K>>;
85
+ type CompoundVariantConditions<V extends VariantMap> = Simplify<{ [K in keyof V]: CompoundVariantConditionValue<V, K>; }>;
86
+ type CompoundVariantRequiredConditions<V extends VariantMap> = RequireAtLeastOneIfNotEmpty<CompoundVariantConditions<V>>;
87
+ type CompoundVariantBase<V extends VariantMap> = keyof V extends never ? EmptyRecord : CompoundVariantRequiredConditions<V>;
88
+ type CompoundVariant<V extends VariantMap> = CompoundVariantBase<V> & {
89
+ class: VariantValue;
90
+ };
91
+ //#endregion
92
+ //#region ../../lib/primitive/src/types/variants/compound/cva-compounds.d.ts
93
+ interface CVACompounds<V extends VariantMap> {
94
+ compoundVariants?: readonly CompoundVariant<V>[];
95
+ }
96
+ //#endregion
97
+ //#region ../../lib/primitive/src/types/variants/compound/cva-defaults.d.ts
98
+ interface CVADefaults<V extends VariantMap> {
99
+ defaultVariants?: DefaultVariants<V>;
100
+ }
101
+ //#endregion
102
+ //#region ../../lib/primitive/src/types/variants/compound/cva-variants.d.ts
103
+ interface CVAVariants<V extends VariantMap> {
104
+ variants?: V;
105
+ }
106
+ //#endregion
107
+ //#region ../../lib/primitive/src/types/pipeline/base-class-options.d.ts
108
+ interface BaseClassOptions {
109
+ baseClassName?: ClassName;
110
+ }
111
+ //#endregion
112
+ //#region ../../lib/primitive/src/types/pipeline/class-pipeline-fn.d.ts
113
+ type ClassPipelineFn = (tag: unknown, props: AnyRecord, className?: ClassName, recipe?: string) => string | undefined;
114
+ //#endregion
115
+ //#region ../../lib/primitive/src/types/pipeline/recipe-options.d.ts
116
+ interface RecipeOptions<TVariants extends VariantMap = VariantMap> {
117
+ recipeMap?: StringMap<RecipeTarget<TVariants>>;
118
+ }
119
+ //#endregion
120
+ //#region ../../lib/primitive/src/types/pipeline/tag-map-options.d.ts
121
+ interface TagMapOptions {
122
+ tagMap?: TagMap;
123
+ }
124
+ //#endregion
125
+ //#region ../../lib/primitive/src/types/pipeline/composition-options.d.ts
126
+ type CompositionOptions<TVariants extends VariantMap = VariantMap> = Simplify<TagMapOptions & RecipeOptions<TVariants>>;
127
+ //#endregion
128
+ //#region ../../lib/primitive/src/types/pipeline/cva-system-options.d.ts
129
+ type CVASystemOptions<TVariants extends VariantMap = VariantMap> = Simplify<CVAVariants<TVariants> & CVADefaults<TVariants> & CVACompounds<TVariants>>;
130
+ //#endregion
131
+ //#region ../../lib/primitive/src/types/pipeline/style-options.d.ts
132
+ type StyleOptions<TVariants extends VariantMap = VariantMap> = Simplify<BaseClassOptions & CVASystemOptions<TVariants>>;
133
+ //#endregion
134
+ //#region ../../lib/primitive/src/types/pipeline/class-pipeline-options.d.ts
135
+ type ClassPipelineOptions<TVariants extends VariantMap = VariantMap> = Simplify<StyleOptions<TVariants> & CompositionOptions<TVariants>>;
136
+ //#endregion
137
+ //#region ../../lib/primitive/src/types/class/owned-prop-keys.d.ts
138
+ type OwnedPropKeys = ReadonlySet<string>;
139
+ //#endregion
140
+ //#region ../../lib/primitive/src/types/class/class-plugin.d.ts
141
+ type ClassPlugin<TProps extends AnyRecord = EmptyRecord> = Readonly<{
142
+ pipeline: ClassPipelineFn;
143
+ ownedKeys?: OwnedPropKeys;
144
+ readonly _pluginProps?: TProps;
145
+ }>;
146
+ //#endregion
147
+ //#region ../../lib/tailwind/src/types/layout.d.ts
148
+ type TupleValues<T extends readonly unknown[]> = T[number];
149
+ type LayoutKey<T extends readonly string[]> = TupleValues<T>;
150
+ type ResolvedLayout<T extends readonly string[]> = LayoutKey<T> | 'none';
151
+ type ExclusiveTrueProp<K extends PropertyKey> = { [P in K]: Simplify<Record<P, true> & Partial<Record<Exclude<K, P>, never>>>; }[K];
152
+ /**
153
+ * Mutually exclusive layout shorthand props.
154
+ *
155
+ * Exactly one layout prop may be `true`, or none at all. Multiple `true`
156
+ * props produce a compile-time error. If invalid props reach runtime, the
157
+ * resolver warns and uses the first declared layout.
158
+ */
159
+ type LayoutProps<T extends readonly string[]> = ExclusiveTrueProp<LayoutKey<T>> | Partial<Record<LayoutKey<T>, never>>;
160
+ //#endregion
161
+ //#region ../../lib/tailwind/src/create-tailwind-pipeline.d.ts
162
+ /**
163
+ * Layout-aware class pipeline for Tailwind CSS utility class strings.
164
+ *
165
+ * This is a `ClassPluginFactory` — the runtime calls it with the component's
166
+ * resolved pipeline options and strict mode. Do NOT call it yourself; pass the
167
+ * function reference as `styling.plugin` and let the runtime invoke it.
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * // CORRECT — pass the reference; the runtime calls it
172
+ * createContractComponent({
173
+ * tag: 'div',
174
+ * styling: {
175
+ * base: 'items-center',
176
+ * plugin: createTailwindPipeline,
177
+ * },
178
+ * })
179
+ *
180
+ * // WRONG — calling it manually produces a ClassPlugin where a ClassPluginFactory is expected
181
+ * createContractComponent({
182
+ * tag: 'div',
183
+ * styling: {
184
+ * plugin: createTailwindPipeline({ base: 'items-center' }, false),
185
+ * },
186
+ * })
187
+ * ```
188
+ *
189
+ * With the plugin active, pass any display prop (`flex`, `inline-flex`, `grid`,
190
+ * `inline-grid`, `block`, `hidden`, etc.) as a boolean to control the display
191
+ * mode. The pipeline injects the display class and strips conflicting utilities:
192
+ * flex-family modes strip `grid-*`; grid-family modes strip `flex-*`; all other
193
+ * display values (and no prop) strip both `flex-*` and `grid-*`.
194
+ */
195
+ export declare function createTailwindPipeline<V extends VariantMap = VariantMap>(options: ClassPipelineOptions<V>, diagnostics: Diagnostics): ClassPlugin<LayoutProps<typeof layoutKeys>>;
196
+ //#endregion
197
+ export type { LayoutKey, LayoutProps, ResolvedLayout };