@hozu/variants 0.9.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.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/config.d.ts +27 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +107 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 olevatorr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<img src="https://raw.githubusercontent.com/olevatorr/Hozu/main/docs/assets/logo.png" alt="Hozu logo" width="72">
|
|
2
|
+
|
|
3
|
+
# @hozu/variants
|
|
4
|
+
|
|
5
|
+
tailwind-variants for Hozu components. It runs when a view is recorded, so pages ship none of it.
|
|
6
|
+
|
|
7
|
+
Part of [Hozu](https://github.com/olevatorr/Hozu#readme), an AI-first web framework. Most apps start from
|
|
8
|
+
`npm create hozu@latest`, which installs the right packages and sets up Claude Code or `AGENTS.md` agents.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install @hozu/variants
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requires Node 22.18 or newer. Documentation: the [README](https://github.com/olevatorr/Hozu#readme) and the
|
|
15
|
+
agent skill that `create-hozu` writes into each app.
|
|
16
|
+
|
|
17
|
+
MIT © olevatorr
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** What the project's Tailwind design system adds to Tailwind's defaults (`designTokens` in `@hozu/css`). */
|
|
2
|
+
export interface DesignTokens {
|
|
3
|
+
theme: string[];
|
|
4
|
+
utilities: string[];
|
|
5
|
+
functional: string[];
|
|
6
|
+
}
|
|
7
|
+
type ClassGroup = string | Record<string, ((value: string) => boolean)[]>;
|
|
8
|
+
export interface TwMergeConfig {
|
|
9
|
+
extend: {
|
|
10
|
+
theme: Record<string, string[]>;
|
|
11
|
+
classGroups: Record<string, ClassGroup[]>;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Maps `@theme` namespaces to tailwind-merge theme scales and `@utility` names to their own class groups. */
|
|
15
|
+
export declare function twMergeConfigOf(tokens: DesignTokens): TwMergeConfig;
|
|
16
|
+
export declare const START: (kit: string) => string;
|
|
17
|
+
export declare const END = "// /hozu:variants-config";
|
|
18
|
+
/** The marked block of `<kit>/tv.ts`, regenerated by `hozu add kit <kit> --sync`. */
|
|
19
|
+
export declare function configBlock(kit: string, config: TwMergeConfig): string;
|
|
20
|
+
export declare const tvModule: (kit: string, config: TwMergeConfig) => string;
|
|
21
|
+
/** `'current'`, `'stale'`, or `'none'` when the file has no marked block for this kit. */
|
|
22
|
+
export declare function configStatus(source: string, kit: string, config: TwMergeConfig): 'current' | 'stale' | 'none';
|
|
23
|
+
/** Rewrites only the marked block; `null` when the file has none. */
|
|
24
|
+
export declare function syncConfig(source: string, kit: string, config: TwMergeConfig): string | null;
|
|
25
|
+
export declare const configLine: (source: string, kit: string) => number | null;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,EAAE,CAAC,CAAA;AAEzE,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAA;KAAE,CAAA;CACvF;AA4BD,8GAA8G;AAC9G,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAwBnE;AA0BD,eAAO,MAAM,KAAK,QAAS,MAAM,WAAqC,CAAA;AACtE,eAAO,MAAM,GAAG,6BAA6B,CAAA;AAE7C,qFAAqF;AACrF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,CAUtE;AAED,eAAO,MAAM,QAAQ,QAAS,MAAM,UAAU,aAAa,WACoE,CAAA;AAe/H,0FAA0F;AAC1F,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,aAAa,GACpB,SAAS,GAAG,OAAO,GAAG,MAAM,CAM9B;AAED,qEAAqE;AACrE,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAG5F;AAED,eAAO,MAAM,UAAU,WAAY,MAAM,OAAO,MAAM,kBAGrD,CAAA"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const SCALES = [
|
|
2
|
+
['--animate-', 'animate'],
|
|
3
|
+
['--aspect-', 'aspect'],
|
|
4
|
+
['--blur-', 'blur'],
|
|
5
|
+
['--breakpoint-', 'breakpoint'],
|
|
6
|
+
['--color-', 'color'],
|
|
7
|
+
['--container-', 'container'],
|
|
8
|
+
['--drop-shadow-', 'drop-shadow'],
|
|
9
|
+
['--ease-', 'ease'],
|
|
10
|
+
['--font-', 'font'],
|
|
11
|
+
['--font-weight-', 'font-weight'],
|
|
12
|
+
['--inset-shadow-', 'inset-shadow'],
|
|
13
|
+
['--leading-', 'leading'],
|
|
14
|
+
['--perspective-', 'perspective'],
|
|
15
|
+
['--radius-', 'radius'],
|
|
16
|
+
['--shadow-', 'shadow'],
|
|
17
|
+
['--spacing-', 'spacing'],
|
|
18
|
+
['--text-', 'text'],
|
|
19
|
+
['--text-shadow-', 'text-shadow'],
|
|
20
|
+
['--tracking-', 'tracking'],
|
|
21
|
+
].sort(([a], [b]) => b.length - a.length);
|
|
22
|
+
const anyValue = (value) => value !== '';
|
|
23
|
+
/** Maps `@theme` namespaces to tailwind-merge theme scales and `@utility` names to their own class groups. */
|
|
24
|
+
export function twMergeConfigOf(tokens) {
|
|
25
|
+
const theme = {};
|
|
26
|
+
for (const key of tokens.theme) {
|
|
27
|
+
const hit = SCALES.find(([prefix]) => key.startsWith(prefix));
|
|
28
|
+
if (!hit)
|
|
29
|
+
continue;
|
|
30
|
+
const name = key.slice(hit[0].length);
|
|
31
|
+
if (!name || name.includes('--'))
|
|
32
|
+
continue;
|
|
33
|
+
theme[hit[1]] ??= new Set();
|
|
34
|
+
theme[hit[1]].add(name);
|
|
35
|
+
}
|
|
36
|
+
const classGroups = {};
|
|
37
|
+
for (const name of [...new Set(tokens.utilities)].sort())
|
|
38
|
+
classGroups[name] = [name];
|
|
39
|
+
for (const name of [...new Set(tokens.functional)].sort())
|
|
40
|
+
classGroups[name] = [...(classGroups[name] ?? []), { [name]: [anyValue] }];
|
|
41
|
+
return {
|
|
42
|
+
extend: {
|
|
43
|
+
theme: Object.fromEntries(Object.keys(theme)
|
|
44
|
+
.sort()
|
|
45
|
+
.map((k) => [k, [...theme[k]].sort()])),
|
|
46
|
+
classGroups,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const key = (k) => (/^[A-Za-z_$][\w$]*$/.test(k) ? k : `'${k}'`);
|
|
51
|
+
const str = (s) => `'${s.replaceAll('\\', '\\\\').replaceAll("'", "\\'")}'`;
|
|
52
|
+
function list(items, indent, prefix) {
|
|
53
|
+
const line = `[${items.join(', ')}]`;
|
|
54
|
+
if (indent.length + prefix.length + line.length + 1 <= 110)
|
|
55
|
+
return line;
|
|
56
|
+
return `[\n${items.map((i) => `${indent} ${i},`).join('\n')}\n${indent}]`;
|
|
57
|
+
}
|
|
58
|
+
const group = (g) => typeof g === 'string'
|
|
59
|
+
? str(g)
|
|
60
|
+
: `{ ${Object.keys(g)
|
|
61
|
+
.map((k) => `${key(k)}: [(value: string) => value !== '']`)
|
|
62
|
+
.join(', ')} }`;
|
|
63
|
+
function objectOf(entries, indent) {
|
|
64
|
+
if (!entries.length)
|
|
65
|
+
return '{}';
|
|
66
|
+
const body = entries.map(([k, items]) => `${indent} ${key(k)}: ${list(items, `${indent} `, `${key(k)}: `)},`);
|
|
67
|
+
return `{\n${body.join('\n')}\n${indent}}`;
|
|
68
|
+
}
|
|
69
|
+
export const START = (kit) => `// hozu:variants-config ${kit}`;
|
|
70
|
+
export const END = '// /hozu:variants-config';
|
|
71
|
+
/** The marked block of `<kit>/tv.ts`, regenerated by `hozu add kit <kit> --sync`. */
|
|
72
|
+
export function configBlock(kit, config) {
|
|
73
|
+
const theme = objectOf(Object.entries(config.extend.theme).map(([k, v]) => [k, v.map(str)]), ' ');
|
|
74
|
+
const groups = objectOf(Object.entries(config.extend.classGroups).map(([k, v]) => [k, v.map(group)]), ' ');
|
|
75
|
+
return `${START(kit)}\nconst twMergeConfig = {\n extend: {\n theme: ${theme},\n classGroups: ${groups},\n },\n}\n${END}`;
|
|
76
|
+
}
|
|
77
|
+
export const tvModule = (kit, config) => `import { createTV } from '@hozu/variants'\n\n${configBlock(kit, config)}\n\nexport const tv = createTV({ twMergeConfig })\n`;
|
|
78
|
+
const blockAt = (source, kit) => {
|
|
79
|
+
const start = source.indexOf(START(kit));
|
|
80
|
+
if (start < 0)
|
|
81
|
+
return null;
|
|
82
|
+
const end = source.indexOf(END, start);
|
|
83
|
+
return end < 0 ? null : { start, end: end + END.length };
|
|
84
|
+
};
|
|
85
|
+
const normalize = (text) => text
|
|
86
|
+
.replace(/\s+/g, '')
|
|
87
|
+
.replaceAll('"', "'")
|
|
88
|
+
.replace(/,(?=[}\]])/g, '');
|
|
89
|
+
/** `'current'`, `'stale'`, or `'none'` when the file has no marked block for this kit. */
|
|
90
|
+
export function configStatus(source, kit, config) {
|
|
91
|
+
const at = blockAt(source, kit);
|
|
92
|
+
if (!at)
|
|
93
|
+
return 'none';
|
|
94
|
+
return normalize(source.slice(at.start, at.end)) === normalize(configBlock(kit, config))
|
|
95
|
+
? 'current'
|
|
96
|
+
: 'stale';
|
|
97
|
+
}
|
|
98
|
+
/** Rewrites only the marked block; `null` when the file has none. */
|
|
99
|
+
export function syncConfig(source, kit, config) {
|
|
100
|
+
const at = blockAt(source, kit);
|
|
101
|
+
return at ? source.slice(0, at.start) + configBlock(kit, config) + source.slice(at.end) : null;
|
|
102
|
+
}
|
|
103
|
+
export const configLine = (source, kit) => {
|
|
104
|
+
const at = blockAt(source, kit);
|
|
105
|
+
return at ? source.slice(0, at.start).split('\n').length : null;
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,GACV;IACE,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,WAAW,EAAE,QAAQ,CAAC;IACvB,CAAC,SAAS,EAAE,MAAM,CAAC;IACnB,CAAC,eAAe,EAAE,YAAY,CAAC;IAC/B,CAAC,UAAU,EAAE,OAAO,CAAC;IACrB,CAAC,cAAc,EAAE,WAAW,CAAC;IAC7B,CAAC,gBAAgB,EAAE,aAAa,CAAC;IACjC,CAAC,SAAS,EAAE,MAAM,CAAC;IACnB,CAAC,SAAS,EAAE,MAAM,CAAC;IACnB,CAAC,gBAAgB,EAAE,aAAa,CAAC;IACjC,CAAC,iBAAiB,EAAE,cAAc,CAAC;IACnC,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,gBAAgB,EAAE,aAAa,CAAC;IACjC,CAAC,WAAW,EAAE,QAAQ,CAAC;IACvB,CAAC,WAAW,EAAE,QAAQ,CAAC;IACvB,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,SAAS,EAAE,MAAM,CAAC;IACnB,CAAC,gBAAgB,EAAE,aAAa,CAAC;IACjC,CAAC,aAAa,EAAE,UAAU,CAAC;CAE9B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,C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AM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACtF,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,OAAO,CAAA;AACb,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,GAAW,EAAE,MAAqB;IAC3E,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAChG,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,GAAW,EAAE,EAAE;IACxD,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/B,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAA;AACjE,CAAC,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ClassValue, type TVCompoundSlots, type TVCompoundVariants, type TVConfig, type TVDefaultVariants, type TVReturnType, type TVReturnTypeLike, type TVVariants } from 'tailwind-variants';
|
|
2
|
+
type Slots = Record<string, ClassValue> | undefined;
|
|
3
|
+
interface Recorded {
|
|
4
|
+
readonly hozu?: 'tv';
|
|
5
|
+
}
|
|
6
|
+
/** tailwind-variants' `TV`, with an intersection result: TS skips a generic call that returns a plain function type while it infers `ui.component`, so inline `styles: tv({…})` would be typed after the render. */
|
|
7
|
+
export type TV = <V extends TVVariants<S, B, EV>, CV extends TVCompoundVariants<V, S, B, EV, ES>, DV extends TVDefaultVariants<V, S, EV, ES>, B extends ClassValue = undefined, S extends Slots = undefined, E extends TVReturnTypeLike<any, any> = TVReturnTypeLike<V, S>, EV extends TVVariants<ES, B, E['variants'], ES> = E['variants'], ES extends Slots = E['slots'] extends Slots ? E['slots'] : undefined>(options: {
|
|
8
|
+
extend?: E;
|
|
9
|
+
base?: B;
|
|
10
|
+
slots?: S;
|
|
11
|
+
variants?: V;
|
|
12
|
+
compoundVariants?: CV;
|
|
13
|
+
compoundSlots?: TVCompoundSlots<V, S, B>;
|
|
14
|
+
defaultVariants?: DV;
|
|
15
|
+
}, settings?: TVConfig) => TVReturnType<V, S, B, EV, ES, E> & Recorded;
|
|
16
|
+
export declare const createTV: (settings: TVConfig) => TV;
|
|
17
|
+
export declare const tv: TV;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEhB,MAAM,mBAAmB,CAAA;AAE1B,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS,CAAA;AAEnD,UAAU,QAAQ;IAChB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAA;CACrB;AAED,oNAAoN;AACpN,MAAM,MAAM,EAAE,GAAG,CACf,CAAC,SAAS,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAC9B,EAAE,SAAS,kBAAkB,CAA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AAAA,OAAO,EAEL,QAAQ,IAAI,UAAU,EAQtB,EAAE,IAAI,MAAM,GACb,MAAM,mBAAmB,CAAA;AA+B1B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAkB,EAAM,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAO,CAAA;AAC9E,MAAM,CAAC,MAAM,EAAE,GAAO,MAAY,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hozu/variants",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "tailwind-variants for Hozu components, run at record time; /config generates the tailwind-merge config",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"hozu",
|
|
7
|
+
"framework",
|
|
8
|
+
"ai",
|
|
9
|
+
"agents",
|
|
10
|
+
"ssr",
|
|
11
|
+
"islands",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/olevatorr/Hozu/tree/main/packages/variants#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/olevatorr/Hozu/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/olevatorr/Hozu.git",
|
|
21
|
+
"directory": "packages/variants"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "olevatorr",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./config": {
|
|
32
|
+
"types": "./dist/config.d.ts",
|
|
33
|
+
"default": "./dist/config.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=22.18"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"tailwind-merge": "3.7.0",
|
|
47
|
+
"tailwind-variants": "3.3.1"
|
|
48
|
+
},
|
|
49
|
+
"sideEffects": false
|
|
50
|
+
}
|