chaincss 1.13.3 → 2.0.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/CHANGELOG.md +81 -0
- package/LICENSE +2 -3
- package/README.md +238 -105
- package/dist/cli/commands/build.d.ts +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/compile.d.ts +3 -0
- package/dist/cli/commands/compile.d.ts.map +1 -0
- package/dist/cli/commands/init.d.ts +5 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/timeline.d.ts +2 -0
- package/dist/cli/commands/timeline.d.ts.map +1 -0
- package/dist/cli/commands/watch.d.ts +6 -0
- package/dist/cli/commands/watch.d.ts.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +5960 -0
- package/dist/cli/types.d.ts +51 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/utils/config-loader.d.ts +8 -0
- package/dist/cli/utils/config-loader.d.ts.map +1 -0
- package/dist/cli/utils/file-utils.d.ts +9 -0
- package/dist/cli/utils/file-utils.d.ts.map +1 -0
- package/dist/cli/utils/logger.d.ts +17 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/compiler/atomic-optimizer.d.ts +76 -0
- package/dist/compiler/atomic-optimizer.d.ts.map +1 -0
- package/dist/compiler/btt.d.ts +138 -0
- package/dist/compiler/btt.d.ts.map +1 -0
- package/dist/compiler/cache-manager.d.ts +20 -0
- package/dist/compiler/cache-manager.d.ts.map +1 -0
- package/dist/compiler/commonProps.d.ts +2 -0
- package/dist/compiler/commonProps.d.ts.map +1 -0
- package/dist/compiler/index.d.ts +12 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +5177 -0
- package/dist/compiler/prefixer.d.ts +42 -0
- package/dist/compiler/prefixer.d.ts.map +1 -0
- package/dist/compiler/theme-contract.d.ts +61 -0
- package/dist/compiler/theme-contract.d.ts.map +1 -0
- package/dist/compiler/tokens.d.ts +52 -0
- package/dist/compiler/tokens.d.ts.map +1 -0
- package/dist/compiler/types.d.ts +57 -0
- package/dist/compiler/types.d.ts.map +1 -0
- package/dist/core/compiler.d.ts +32 -0
- package/dist/core/compiler.d.ts.map +1 -0
- package/dist/core/constants.d.ts +129 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/types.d.ts +88 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/utils.d.ts +37 -0
- package/dist/core/utils.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5667 -0
- package/dist/plugins/vite.d.ts +11 -0
- package/dist/plugins/vite.d.ts.map +1 -0
- package/dist/plugins/vite.js +25839 -0
- package/dist/plugins/webpack.d.ts +45 -0
- package/dist/plugins/webpack.d.ts.map +1 -0
- package/dist/plugins/webpack.js +107 -0
- package/dist/runtime/hmr.d.ts +3 -0
- package/dist/runtime/hmr.d.ts.map +1 -0
- package/dist/runtime/index.d.ts +15 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +552 -0
- package/dist/runtime/injector.d.ts +85 -0
- package/dist/runtime/injector.d.ts.map +1 -0
- package/dist/runtime/react.d.ts +54 -0
- package/dist/runtime/react.d.ts.map +1 -0
- package/dist/runtime/react.js +270 -0
- package/dist/runtime/types.d.ts +45 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/utils.d.ts +62 -0
- package/dist/runtime/utils.d.ts.map +1 -0
- package/dist/runtime/vue.d.ts +52 -0
- package/dist/runtime/vue.d.ts.map +1 -0
- package/dist/runtime/vue.js +232 -0
- package/package.json +90 -119
- package/browser/commonProps.js +0 -14
- package/browser/index.js +0 -3
- package/browser/react-hooks.js +0 -162
- package/browser/rtt.js +0 -400
- package/browser/vue-composables.js +0 -200
- package/node/atomic-optimizer.js +0 -526
- package/node/btt.js +0 -1009
- package/node/cache-manager.js +0 -56
- package/node/chaincss.js +0 -642
- package/node/index.js +0 -2
- package/node/loaders/chaincss-loader.js +0 -62
- package/node/plugins/next-plugin.js +0 -120
- package/node/plugins/vite-plugin.js +0 -383
- package/node/plugins/webpack-plugin.js +0 -41
- package/node/prefixer.js +0 -237
- package/node/strVal.js +0 -92
- package/node/theme-validator.js +0 -32
- package/shared/theme-contract.js +0 -98
- package/shared/tokens.cjs +0 -256
- package/shared/tokens.mjs +0 -320
- package/types.d.ts +0 -325
package/types.d.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
declare module '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
|
-
// Theme method
|
|
38
|
-
theme<T extends Record<string, any>>(
|
|
39
|
-
tokens: T,
|
|
40
|
-
callback: (chain: ChainBuilder) => void
|
|
41
|
-
): ChainBuilder;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface KeyframeBuilder {
|
|
45
|
-
from(styles: Record<string, string>): KeyframeBuilder;
|
|
46
|
-
to(styles: Record<string, string>): KeyframeBuilder;
|
|
47
|
-
[percentage: string]: ((styles: Record<string, string>) => KeyframeBuilder) | any;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// ============================================================================
|
|
51
|
-
// Core Functions
|
|
52
|
-
// ============================================================================
|
|
53
|
-
|
|
54
|
-
export function $(useTokens?: boolean): ChainBuilder;
|
|
55
|
-
export function run(...styles: StyleDefinition[]): string;
|
|
56
|
-
export function compile(styles: Record<string, StyleDefinition>): void;
|
|
57
|
-
export function get(filename: string): any;
|
|
58
|
-
|
|
59
|
-
export const chain: {
|
|
60
|
-
cssOutput: string;
|
|
61
|
-
catcher: any;
|
|
62
|
-
cachedValidProperties: string[];
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// ============================================================================
|
|
66
|
-
// Token System
|
|
67
|
-
// ============================================================================
|
|
68
|
-
|
|
69
|
-
export interface Tokens {
|
|
70
|
-
colors: Record<string, string | Record<string, string>>;
|
|
71
|
-
spacing: Record<string, string>;
|
|
72
|
-
typography: {
|
|
73
|
-
fontFamily: Record<string, string>;
|
|
74
|
-
fontSize: Record<string, string>;
|
|
75
|
-
fontWeight: Record<string, string>;
|
|
76
|
-
lineHeight: Record<string, string>;
|
|
77
|
-
};
|
|
78
|
-
breakpoints: Record<string, string>;
|
|
79
|
-
zIndex: Record<string, string>;
|
|
80
|
-
shadows: Record<string, string>;
|
|
81
|
-
borderRadius: Record<string, string>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export class DesignTokens {
|
|
85
|
-
constructor(tokens: Partial<Tokens>);
|
|
86
|
-
get(path: string, defaultValue?: string): string;
|
|
87
|
-
toCSSVariables(prefix?: string): string;
|
|
88
|
-
createTheme(name: string, overrides: Record<string, any>): DesignTokens;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export const tokens: DesignTokens;
|
|
92
|
-
export function createTokens(customTokens: Partial<Tokens>): DesignTokens;
|
|
93
|
-
export function responsive(values: Record<string, string> | string): string;
|
|
94
|
-
|
|
95
|
-
// ============================================================================
|
|
96
|
-
// React Integration
|
|
97
|
-
// ============================================================================
|
|
98
|
-
|
|
99
|
-
export interface UseChainStylesOptions {
|
|
100
|
-
cache?: boolean;
|
|
101
|
-
namespace?: string;
|
|
102
|
-
watch?: boolean;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function useChainStyles(
|
|
106
|
-
styles: Record<string, any> | (() => Record<string, any>),
|
|
107
|
-
deps?: any[],
|
|
108
|
-
options?: UseChainStylesOptions
|
|
109
|
-
): Record<string, string>;
|
|
110
|
-
|
|
111
|
-
export function useDynamicChainStyles(
|
|
112
|
-
styleFactory: () => Record<string, any>,
|
|
113
|
-
deps?: any[],
|
|
114
|
-
options?: UseChainStylesOptions
|
|
115
|
-
): Record<string, string>;
|
|
116
|
-
|
|
117
|
-
export function useThemeChainStyles(
|
|
118
|
-
styles: Record<string, any> | ((theme: any) => Record<string, any>),
|
|
119
|
-
theme: any,
|
|
120
|
-
deps?: any[],
|
|
121
|
-
options?: UseChainStylesOptions
|
|
122
|
-
): Record<string, string>;
|
|
123
|
-
|
|
124
|
-
export const ChainCSSGlobal: React.FC<{ styles: Record<string, any> }>;
|
|
125
|
-
|
|
126
|
-
export function withChainStyles<P extends object>(
|
|
127
|
-
styles: Record<string, any> | ((props: P) => Record<string, any>),
|
|
128
|
-
options?: UseChainStylesOptions
|
|
129
|
-
): (Component: React.ComponentType<P>) => React.FC<P & { chainStyles?: Record<string, string> }>;
|
|
130
|
-
|
|
131
|
-
export function cx(...classes: (string | undefined | null | false)[]): string;
|
|
132
|
-
|
|
133
|
-
export function enableChainCSSDebug(): void;
|
|
134
|
-
export function disableChainCSSDebug(): void;
|
|
135
|
-
export function isDebugEnabled(): boolean;
|
|
136
|
-
|
|
137
|
-
// ============================================================================
|
|
138
|
-
// Configuration
|
|
139
|
-
// ============================================================================
|
|
140
|
-
|
|
141
|
-
export interface AtomicConfig {
|
|
142
|
-
enabled?: boolean;
|
|
143
|
-
threshold?: number;
|
|
144
|
-
naming?: 'hash' | 'readable' | 'short';
|
|
145
|
-
cache?: boolean;
|
|
146
|
-
cachePath?: string;
|
|
147
|
-
minify?: boolean;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export interface PrefixerConfig {
|
|
151
|
-
mode?: 'auto' | 'full';
|
|
152
|
-
browsers?: string[];
|
|
153
|
-
enabled?: boolean;
|
|
154
|
-
sourceMap?: boolean;
|
|
155
|
-
sourceMapInline?: boolean;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export interface ChainCSSConfig {
|
|
159
|
-
atomic?: AtomicConfig;
|
|
160
|
-
prefixer?: PrefixerConfig;
|
|
161
|
-
sourceMaps?: boolean;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export function configure(config: ChainCSSConfig): void;
|
|
165
|
-
|
|
166
|
-
export const atomicOptimizer: {
|
|
167
|
-
optimize(styles: Record<string, StyleDefinition>): string;
|
|
168
|
-
getStats(): {
|
|
169
|
-
totalStyles: number;
|
|
170
|
-
atomicStyles: number;
|
|
171
|
-
uniqueProperties: number;
|
|
172
|
-
savings?: string;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// ============================================================================
|
|
177
|
-
// Build Tools (Node.js)
|
|
178
|
-
// ============================================================================
|
|
179
|
-
|
|
180
|
-
export function processor(inputFile: string, outputFile: string): Promise<void>;
|
|
181
|
-
export function watch(inputFile: string, outputFile: string): void;
|
|
182
|
-
|
|
183
|
-
// ============================================================================
|
|
184
|
-
// Vite Plugin
|
|
185
|
-
// ============================================================================
|
|
186
|
-
|
|
187
|
-
export interface VitePluginOptions {
|
|
188
|
-
extension?: string;
|
|
189
|
-
minify?: boolean;
|
|
190
|
-
prefix?: boolean;
|
|
191
|
-
hmr?: boolean;
|
|
192
|
-
debug?: boolean;
|
|
193
|
-
treeShake?: boolean;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function vitePlugin(options?: VitePluginOptions): any;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// ============================================================================
|
|
200
|
-
// Vite Plugin Subpath Export
|
|
201
|
-
// ============================================================================
|
|
202
|
-
|
|
203
|
-
declare module 'chaincss/vite-plugin' {
|
|
204
|
-
import { Plugin } from 'vite';
|
|
205
|
-
import { VitePluginOptions } from 'chaincss';
|
|
206
|
-
|
|
207
|
-
export default function chaincssVite(options?: VitePluginOptions): Plugin;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// ============================================================================
|
|
211
|
-
// React Subpath Export
|
|
212
|
-
// ============================================================================
|
|
213
|
-
|
|
214
|
-
declare module 'chaincss/react' {
|
|
215
|
-
export * from 'chaincss';
|
|
216
|
-
|
|
217
|
-
// Re-export React-specific hooks
|
|
218
|
-
export const useChainStyles: typeof import('chaincss').useChainStyles;
|
|
219
|
-
export const useDynamicChainStyles: typeof import('chaincss').useDynamicChainStyles;
|
|
220
|
-
export const useThemeChainStyles: typeof import('chaincss').useThemeChainStyles;
|
|
221
|
-
export const ChainCSSGlobal: typeof import('chaincss').ChainCSSGlobal;
|
|
222
|
-
export const withChainStyles: typeof import('chaincss').withChainStyles;
|
|
223
|
-
export const cx: typeof import('chaincss').cx;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// ============================================================================
|
|
227
|
-
// Recipe - Variants
|
|
228
|
-
// ============================================================================
|
|
229
|
-
|
|
230
|
-
export interface RecipeOptions<TVariants extends Record<string, Record<string, any>>> {
|
|
231
|
-
base?: StyleDefinition;
|
|
232
|
-
variants?: TVariants;
|
|
233
|
-
defaultVariants?: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>;
|
|
234
|
-
compoundVariants?: Array<{
|
|
235
|
-
variants: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>;
|
|
236
|
-
style: StyleDefinition;
|
|
237
|
-
}>;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export type Recipe<TVariants extends Record<string, Record<string, any>>> = {
|
|
241
|
-
(selection?: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>): StyleDefinition;
|
|
242
|
-
variants: TVariants;
|
|
243
|
-
defaultVariants: Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>;
|
|
244
|
-
base: StyleDefinition;
|
|
245
|
-
getAllVariants: () => Array<Partial<{ [K in keyof TVariants]: keyof TVariants[K] }>>;
|
|
246
|
-
compileAll: () => string;
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
export function recipe<TVariants extends Record<string, Record<string, any>>>(
|
|
250
|
-
options: RecipeOptions<TVariants>
|
|
251
|
-
): Recipe<TVariants>;
|
|
252
|
-
|
|
253
|
-
// ============================================================================
|
|
254
|
-
// THEME CONTRACT
|
|
255
|
-
// ============================================================================
|
|
256
|
-
|
|
257
|
-
export interface ThemeContract {
|
|
258
|
-
[key: string]: string | Record<string, any>;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export function defineThemeContract<T extends ThemeContract>(
|
|
262
|
-
contract: T
|
|
263
|
-
): T & { __isContract: true; __validate: (theme: any) => void };
|
|
264
|
-
|
|
265
|
-
export function createTheme<T extends Record<string, any>>(
|
|
266
|
-
contract: T,
|
|
267
|
-
values: T
|
|
268
|
-
): DesignTokens;
|
|
269
|
-
|
|
270
|
-
export function createTokens(
|
|
271
|
-
customTokens: Partial<Tokens>,
|
|
272
|
-
contract?: ThemeContract
|
|
273
|
-
): DesignTokens;
|
|
274
|
-
|
|
275
|
-
export function validateTheme(
|
|
276
|
-
contract: ThemeContract,
|
|
277
|
-
theme: any
|
|
278
|
-
): boolean;
|
|
279
|
-
|
|
280
|
-
// ============================================================================
|
|
281
|
-
// Vue JS composables
|
|
282
|
-
// ============================================================================
|
|
283
|
-
|
|
284
|
-
declare module 'chaincss/vue' {
|
|
285
|
-
import { Ref, ComputedRef, Component } from 'vue';
|
|
286
|
-
|
|
287
|
-
export interface UseAtomicClassesOptions {
|
|
288
|
-
atomic?: boolean;
|
|
289
|
-
global?: boolean;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export interface UseAtomicClassesReturn {
|
|
293
|
-
classes: Ref<Record<string, any>>;
|
|
294
|
-
cx: (name: string) => any;
|
|
295
|
-
cn: (...names: string[]) => string;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export function useAtomicClasses(
|
|
299
|
-
styles: Record<string, any> | Ref<Record<string, any>> | ComputedRef<Record<string, any>>,
|
|
300
|
-
options?: UseAtomicClassesOptions
|
|
301
|
-
): UseAtomicClassesReturn;
|
|
302
|
-
|
|
303
|
-
export const ChainCSSGlobal: Component<{
|
|
304
|
-
styles: Record<string, any>;
|
|
305
|
-
atomic?: boolean;
|
|
306
|
-
}>;
|
|
307
|
-
|
|
308
|
-
export function createStyledComponent(
|
|
309
|
-
styles: Record<string, any> | ((props: any) => Record<string, any>),
|
|
310
|
-
options?: {
|
|
311
|
-
name?: string;
|
|
312
|
-
atomic?: boolean;
|
|
313
|
-
props?: Record<string, any>;
|
|
314
|
-
}
|
|
315
|
-
): Component;
|
|
316
|
-
|
|
317
|
-
export function createTheme<T extends Record<string, any>>(
|
|
318
|
-
themes: T
|
|
319
|
-
): {
|
|
320
|
-
currentTheme: Ref<keyof T>;
|
|
321
|
-
themeStyles: ComputedRef<T[keyof T]>;
|
|
322
|
-
setTheme: (themeName: keyof T) => void;
|
|
323
|
-
toggleTheme: () => void;
|
|
324
|
-
};
|
|
325
|
-
}
|