chaincss 1.12.8

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/types.d.ts ADDED
@@ -0,0 +1,239 @@
1
+ /// <reference types="react" />
2
+
3
+ declare module '@melcanz85/chaincss' {
4
+ // ============================================================================
5
+ // Core Types
6
+ // ============================================================================
7
+
8
+ export interface StyleDefinition {
9
+ selectors: string[];
10
+ hover?: Record<string, string | number>;
11
+ [cssProperty: string]: any;
12
+ }
13
+
14
+ export interface ChainBuilder {
15
+ // CSS Properties - dynamic
16
+ [key: string]: (value: string | number) => ChainBuilder;
17
+
18
+ // Special Methods
19
+ block(...selectors: string[]): StyleDefinition;
20
+ hover(): ChainBuilder;
21
+ end(): ChainBuilder;
22
+ token?(path: string): ChainBuilder;
23
+
24
+ // At-Rules
25
+ media(query: string, cb: (chain: ChainBuilder) => void): ChainBuilder;
26
+ keyframes(name: string, cb: (keyframes: KeyframeBuilder) => void): ChainBuilder;
27
+ fontFace(cb: (chain: ChainBuilder) => void): ChainBuilder;
28
+ supports(condition: string, cb: (chain: ChainBuilder) => void): ChainBuilder;
29
+ container(condition: string, cb: (chain: ChainBuilder) => void): ChainBuilder;
30
+ layer(name: string, cb: (chain: ChainBuilder) => void): ChainBuilder;
31
+ counterStyle(name: string, cb: (chain: ChainBuilder) => void): ChainBuilder;
32
+ property(name: string, cb: (chain: ChainBuilder) => void): ChainBuilder;
33
+
34
+ // Selector shortcut
35
+ $(selector: string): ChainBuilder;
36
+ }
37
+
38
+ export interface KeyframeBuilder {
39
+ from(styles: Record<string, string>): KeyframeBuilder;
40
+ to(styles: Record<string, string>): KeyframeBuilder;
41
+ [percentage: string]: ((styles: Record<string, string>) => KeyframeBuilder) | any;
42
+ }
43
+
44
+ // ============================================================================
45
+ // Core Functions
46
+ // ============================================================================
47
+
48
+ export function $(useTokens?: boolean): ChainBuilder;
49
+ export function run(...styles: StyleDefinition[]): string;
50
+ export function compile(styles: Record<string, StyleDefinition>): void;
51
+ export function get(filename: string): any;
52
+
53
+ export const chain: {
54
+ cssOutput: string;
55
+ catcher: any;
56
+ cachedValidProperties: string[];
57
+ };
58
+
59
+ // ============================================================================
60
+ // Token System
61
+ // ============================================================================
62
+
63
+ export interface Tokens {
64
+ colors: Record<string, string | Record<string, string>>;
65
+ spacing: Record<string, string>;
66
+ typography: {
67
+ fontFamily: Record<string, string>;
68
+ fontSize: Record<string, string>;
69
+ fontWeight: Record<string, string>;
70
+ lineHeight: Record<string, string>;
71
+ };
72
+ breakpoints: Record<string, string>;
73
+ zIndex: Record<string, string>;
74
+ shadows: Record<string, string>;
75
+ borderRadius: Record<string, string>;
76
+ }
77
+
78
+ export class DesignTokens {
79
+ constructor(tokens: Partial<Tokens>);
80
+ get(path: string, defaultValue?: string): string;
81
+ toCSSVariables(prefix?: string): string;
82
+ createTheme(name: string, overrides: Record<string, any>): DesignTokens;
83
+ }
84
+
85
+ export const tokens: DesignTokens;
86
+ export function createTokens(customTokens: Partial<Tokens>): DesignTokens;
87
+ export function responsive(values: Record<string, string> | string): string;
88
+
89
+ // ============================================================================
90
+ // React Integration
91
+ // ============================================================================
92
+
93
+ export interface UseChainStylesOptions {
94
+ cache?: boolean;
95
+ namespace?: string;
96
+ watch?: boolean;
97
+ }
98
+
99
+ export function useChainStyles(
100
+ styles: Record<string, any> | (() => Record<string, any>),
101
+ deps?: any[],
102
+ options?: UseChainStylesOptions
103
+ ): Record<string, string>;
104
+
105
+ export function useDynamicChainStyles(
106
+ styleFactory: () => Record<string, any>,
107
+ deps?: any[],
108
+ options?: UseChainStylesOptions
109
+ ): Record<string, string>;
110
+
111
+ export function useThemeChainStyles(
112
+ styles: Record<string, any> | ((theme: any) => Record<string, any>),
113
+ theme: any,
114
+ deps?: any[],
115
+ options?: UseChainStylesOptions
116
+ ): Record<string, string>;
117
+
118
+ export const ChainCSSGlobal: React.FC<{ styles: Record<string, any> }>;
119
+
120
+ export function withChainStyles<P extends object>(
121
+ styles: Record<string, any> | ((props: P) => Record<string, any>),
122
+ options?: UseChainStylesOptions
123
+ ): (Component: React.ComponentType<P>) => React.FC<P & { chainStyles?: Record<string, string> }>;
124
+
125
+ export function cx(...classes: (string | undefined | null | false)[]): string;
126
+
127
+ // ============================================================================
128
+ // Configuration
129
+ // ============================================================================
130
+
131
+ export interface AtomicConfig {
132
+ enabled?: boolean;
133
+ threshold?: number;
134
+ naming?: 'hash' | 'readable' | 'short';
135
+ cache?: boolean;
136
+ cachePath?: string;
137
+ minify?: boolean;
138
+ }
139
+
140
+ export interface PrefixerConfig {
141
+ mode?: 'auto' | 'full';
142
+ browsers?: string[];
143
+ enabled?: boolean;
144
+ sourceMap?: boolean;
145
+ sourceMapInline?: boolean;
146
+ }
147
+
148
+ export interface ChainCSSConfig {
149
+ atomic?: AtomicConfig;
150
+ prefixer?: PrefixerConfig;
151
+ sourceMaps?: boolean;
152
+ }
153
+
154
+ export function configure(config: ChainCSSConfig): void;
155
+
156
+ export const atomicOptimizer: {
157
+ optimize(styles: Record<string, StyleDefinition>): string;
158
+ getStats(): {
159
+ totalStyles: number;
160
+ atomicStyles: number;
161
+ uniqueProperties: number;
162
+ savings?: string;
163
+ };
164
+ };
165
+
166
+ // ============================================================================
167
+ // Build Tools (Node.js)
168
+ // ============================================================================
169
+
170
+ export function processor(inputFile: string, outputFile: string): Promise<void>;
171
+ export function watch(inputFile: string, outputFile: string): void;
172
+
173
+ // ============================================================================
174
+ // Vite Plugin
175
+ // ============================================================================
176
+
177
+ export interface VitePluginOptions {
178
+ extension?: string;
179
+ minify?: boolean;
180
+ prefix?: boolean;
181
+ hmr?: boolean;
182
+ }
183
+
184
+ export function vitePlugin(options?: VitePluginOptions): any;
185
+ }
186
+
187
+ // ============================================================================
188
+ // Vite Plugin Subpath Export
189
+ // ============================================================================
190
+
191
+ declare module '@melcanz85/chaincss/vite-plugin' {
192
+ import { Plugin } from 'vite';
193
+ import { VitePluginOptions } from '@melcanz85/chaincss';
194
+
195
+ export default function chaincssVite(options?: VitePluginOptions): Plugin;
196
+ }
197
+
198
+ // ============================================================================
199
+ // React Subpath Export
200
+ // ============================================================================
201
+
202
+ declare module '@melcanz85/chaincss/react' {
203
+ export * from '@melcanz85/chaincss';
204
+
205
+ // Re-export React-specific hooks
206
+ export const useChainStyles: typeof import('@melcanz85/chaincss').useChainStyles;
207
+ export const useDynamicChainStyles: typeof import('@melcanz85/chaincss').useDynamicChainStyles;
208
+ export const useThemeChainStyles: typeof import('@melcanz85/chaincss').useThemeChainStyles;
209
+ export const ChainCSSGlobal: typeof import('@melcanz85/chaincss').ChainCSSGlobal;
210
+ export const withChainStyles: typeof import('@melcanz85/chaincss').withChainStyles;
211
+ export const cx: typeof import('@melcanz85/chaincss').cx;
212
+ }
213
+
214
+ // ============================================================================
215
+ // Recipe - Variants
216
+ // ============================================================================
217
+
218
+ export interface RecipeOptions<TVariants extends Record<string, Record<string, any>>> {
219
+ base?: StyleDefinition;
220
+ variants?: TVariants;
221
+ defaultVariants?: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>;
222
+ compoundVariants?: Array<{
223
+ variants: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>;
224
+ style: StyleDefinition;
225
+ }>;
226
+ }
227
+
228
+ export type Recipe<TVariants extends Record<string, Record<string, any>>> = {
229
+ (selection?: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>): StyleDefinition;
230
+ variants: TVariants;
231
+ defaultVariants: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>;
232
+ base: StyleDefinition;
233
+ getAllVariants: () => Array<Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>>;
234
+ compileAll: () => string;
235
+ };
236
+
237
+ export function recipe<TVariants extends Record<string, Record<string, any>>>(
238
+ options: RecipeOptions<TVariants>
239
+ ): Recipe<TVariants>;