chaincss 2.0.7 → 2.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.
- package/CHANGELOG.md +30 -0
- package/CODE_OF_CONDUCT.md +21 -0
- package/CONTRIBUTING.md +28 -0
- package/README.md +455 -226
- package/demo/demo/node_modules/caniuse-db/fulldata-json/data-2.0.json +1 -0
- package/demo/index.html +16 -0
- package/demo/package.json +20 -0
- package/demo/src/App.tsx +117 -0
- package/demo/src/chaincss-barrel.ts +9 -0
- package/demo/src/main.tsx +8 -0
- package/demo/src/styles.chain.ts +300 -0
- package/demo/vite.config.ts +46 -0
- package/dist/cli/commands/build.d.ts +0 -1
- package/dist/cli/commands/cache.d.ts +1 -0
- package/dist/cli/commands/init.d.ts +6 -3
- package/dist/cli/commands/timeline.d.ts +0 -1
- package/dist/cli/commands/watch.d.ts +0 -1
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +3213 -5296
- package/dist/cli/types.d.ts +51 -20
- package/dist/cli/utils/config-loader.d.ts +0 -1
- package/dist/cli/utils/file-utils.d.ts +27 -3
- package/dist/cli/utils/logger.d.ts +0 -1
- package/dist/compiler/Chain.d.ts +215 -0
- package/dist/compiler/animations.d.ts +76 -0
- package/dist/compiler/atomic-optimizer.d.ts +47 -12
- package/dist/compiler/breakpoints.d.ts +46 -0
- package/dist/compiler/btt.d.ts +36 -60
- package/dist/compiler/cache-manager.d.ts +58 -4
- package/dist/compiler/commonProps.d.ts +0 -1
- package/dist/compiler/content-addressable-cache.d.ts +78 -0
- package/dist/compiler/helpers.d.ts +54 -0
- package/dist/compiler/index.d.ts +16 -9
- package/dist/compiler/index.js +4450 -4316
- package/dist/compiler/prefixer.d.ts +17 -1
- package/dist/compiler/shorthands.d.ts +28 -0
- package/dist/compiler/suggestions.d.ts +43 -0
- package/dist/compiler/theme-contract.d.ts +16 -27
- package/dist/compiler/token-resolver.d.ts +69 -0
- package/dist/compiler/tokens.d.ts +33 -8
- package/dist/core/auto-detector.d.ts +34 -0
- package/dist/core/common-utils.d.ts +97 -0
- package/dist/core/compiler.d.ts +63 -23
- package/dist/core/constants.d.ts +137 -36
- package/dist/core/smart-chain.d.ts +3 -0
- package/dist/core/types.d.ts +122 -15
- package/dist/core/utils.d.ts +134 -17
- package/dist/index.d.ts +52 -8
- package/dist/index.js +7090 -5578
- package/dist/plugins/vite.d.ts +7 -5
- package/dist/plugins/vite.js +2964 -25641
- package/dist/plugins/webpack.d.ts +24 -1
- package/dist/plugins/webpack.js +209 -72
- package/dist/runtime/Chain.d.ts +32 -0
- package/dist/runtime/auto-hooks.d.ts +11 -0
- package/dist/runtime/hmr.d.ts +22 -2
- package/dist/runtime/index.d.ts +3 -2
- package/dist/runtime/index.js +3648 -301
- package/dist/runtime/injector.d.ts +39 -72
- package/dist/runtime/react.d.ts +17 -12
- package/dist/runtime/svelte.d.ts +15 -0
- package/dist/runtime/types.d.ts +126 -4
- package/dist/runtime/utils.d.ts +0 -1
- package/dist/runtime/vue.d.ts +34 -14
- package/package.json +59 -66
- package/src/cli/commands/build.ts +133 -0
- package/src/cli/commands/cache.ts +371 -0
- package/src/cli/commands/init.ts +230 -0
- package/src/cli/commands/timeline.ts +435 -0
- package/src/cli/commands/watch.ts +211 -0
- package/src/cli/index.ts +226 -0
- package/src/cli/types.ts +100 -0
- package/src/cli/utils/config-loader.ts +174 -0
- package/src/cli/utils/file-utils.ts +139 -0
- package/src/cli/utils/logger.ts +74 -0
- package/src/compiler/Chain.ts +831 -0
- package/src/compiler/animations.ts +517 -0
- package/src/compiler/atomic-optimizer.ts +786 -0
- package/src/compiler/breakpoints.ts +347 -0
- package/src/compiler/btt.ts +1147 -0
- package/src/compiler/cache-manager.ts +446 -0
- package/src/compiler/commonProps.ts +18 -0
- package/src/compiler/content-addressable-cache.ts +478 -0
- package/src/compiler/helpers.ts +407 -0
- package/src/compiler/index.ts +72 -0
- package/src/compiler/prefixer.ts +724 -0
- package/src/compiler/shorthands.ts +558 -0
- package/src/compiler/suggestions.ts +436 -0
- package/src/compiler/theme-contract.ts +197 -0
- package/src/compiler/token-resolver.ts +241 -0
- package/src/compiler/tokens.ts +612 -0
- package/src/core/auto-detector.ts +187 -0
- package/src/core/common-utils.ts +423 -0
- package/src/core/compiler.ts +835 -0
- package/src/core/constants.ts +424 -0
- package/src/core/index.ts +107 -0
- package/src/core/smart-chain.ts +163 -0
- package/src/core/types.ts +257 -0
- package/src/core/utils.ts +598 -0
- package/src/index.ts +208 -0
- package/src/plugins/vite.d.ts +316 -0
- package/src/plugins/vite.ts +424 -0
- package/src/plugins/webpack.d.ts +289 -0
- package/src/plugins/webpack.ts +416 -0
- package/src/runtime/Chain.ts +242 -0
- package/src/runtime/auto-hooks.tsx +127 -0
- package/src/runtime/auto-vue.ts +72 -0
- package/src/runtime/hmr.ts +212 -0
- package/src/runtime/index.ts +82 -0
- package/src/runtime/injector.ts +273 -0
- package/src/runtime/react.tsx +269 -0
- package/src/runtime/svelte.ts +15 -0
- package/src/runtime/types.ts +256 -0
- package/src/runtime/utils.ts +128 -0
- package/src/runtime/vite-env.d.ts +120 -0
- package/src/runtime/vue.ts +231 -0
- package/tsconfig.build.json +41 -0
- package/tsconfig.json +25 -0
- package/tsconfig.runtimes.json +18 -0
- package/dist/cli/cli.cjs +0 -7
- package/dist/cli/commands/build.d.ts.map +0 -1
- package/dist/cli/commands/compile.d.ts +0 -3
- package/dist/cli/commands/compile.d.ts.map +0 -1
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/timeline.d.ts.map +0 -1
- package/dist/cli/commands/watch.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/utils/config-loader.d.ts.map +0 -1
- package/dist/cli/utils/file-utils.d.ts.map +0 -1
- package/dist/cli/utils/logger.d.ts.map +0 -1
- package/dist/compiler/atomic-optimizer.d.ts.map +0 -1
- package/dist/compiler/btt.d.ts.map +0 -1
- package/dist/compiler/cache-manager.d.ts.map +0 -1
- package/dist/compiler/commonProps.d.ts.map +0 -1
- package/dist/compiler/index.d.ts.map +0 -1
- package/dist/compiler/prefixer.d.ts.map +0 -1
- package/dist/compiler/theme-contract.d.ts.map +0 -1
- package/dist/compiler/tokens.d.ts.map +0 -1
- package/dist/compiler/types.d.ts +0 -57
- package/dist/compiler/types.d.ts.map +0 -1
- package/dist/core/compiler.d.ts.map +0 -1
- package/dist/core/constants.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/utils.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/plugins/vite.d.ts.map +0 -1
- package/dist/plugins/webpack.d.ts.map +0 -1
- package/dist/runtime/hmr.d.ts.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/injector.d.ts.map +0 -1
- package/dist/runtime/react.d.ts.map +0 -1
- package/dist/runtime/react.js +0 -324
- package/dist/runtime/types.d.ts.map +0 -1
- package/dist/runtime/utils.d.ts.map +0 -1
- package/dist/runtime/vue.d.ts.map +0 -1
- package/dist/runtime/vue.js +0 -286
package/dist/cli/types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ChainCSSConfig as CoreChainCSSConfig } from '../core/types.js';
|
|
2
|
+
export type ChainCSSConfig = CoreChainCSSConfig;
|
|
1
3
|
export interface CLIOptions {
|
|
2
4
|
input?: string;
|
|
3
5
|
output?: string;
|
|
@@ -25,27 +27,56 @@ export interface BuildOptions {
|
|
|
25
27
|
config?: string;
|
|
26
28
|
watch?: boolean;
|
|
27
29
|
verbose?: boolean;
|
|
30
|
+
atomic?: boolean;
|
|
31
|
+
minify?: boolean;
|
|
28
32
|
}
|
|
29
|
-
export interface
|
|
30
|
-
|
|
33
|
+
export interface WatchOptions {
|
|
34
|
+
config?: string;
|
|
35
|
+
verbose?: boolean;
|
|
36
|
+
atomic?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface CacheOptions {
|
|
39
|
+
action: 'clear' | 'stats' | 'prune' | 'list' | 'inspect' | 'delete' | 'validate' | 'backup';
|
|
40
|
+
key?: string;
|
|
41
|
+
force?: boolean;
|
|
42
|
+
maxAge?: number;
|
|
43
|
+
maxSize?: number;
|
|
44
|
+
output?: string;
|
|
45
|
+
verbose?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface TimelineOptions {
|
|
48
|
+
action: 'list' | 'diff' | 'changes' | 'stats' | 'export' | 'clear' | 'watch';
|
|
49
|
+
snapshot1?: string;
|
|
50
|
+
snapshot2?: string;
|
|
31
51
|
output?: string;
|
|
32
|
-
tokens?: {
|
|
33
|
-
enabled?: boolean;
|
|
34
|
-
prefix?: string;
|
|
35
|
-
};
|
|
36
|
-
atomic?: {
|
|
37
|
-
enabled?: boolean;
|
|
38
|
-
threshold?: number;
|
|
39
|
-
naming?: 'hash' | 'readable';
|
|
40
|
-
minify?: boolean;
|
|
41
|
-
mode?: 'standard' | 'atomic' | 'hybrid';
|
|
42
|
-
verbose?: boolean;
|
|
43
|
-
};
|
|
44
|
-
prefixer?: {
|
|
45
|
-
enabled?: boolean;
|
|
46
|
-
browsers?: string[];
|
|
47
|
-
};
|
|
48
|
-
watch?: boolean;
|
|
49
52
|
verbose?: boolean;
|
|
50
53
|
}
|
|
51
|
-
|
|
54
|
+
export interface InitOptions {
|
|
55
|
+
force?: boolean;
|
|
56
|
+
template?: 'full' | 'minimal';
|
|
57
|
+
typescript?: boolean;
|
|
58
|
+
framework?: 'react' | 'vue' | 'svelte' | 'solid';
|
|
59
|
+
}
|
|
60
|
+
export type CommandHandler<T = any> = (options: T) => Promise<void> | void;
|
|
61
|
+
export interface CLICommand {
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
options?: Array<{
|
|
65
|
+
flags: string;
|
|
66
|
+
description: string;
|
|
67
|
+
defaultValue?: any;
|
|
68
|
+
}>;
|
|
69
|
+
handler: CommandHandler;
|
|
70
|
+
}
|
|
71
|
+
export interface BuildResult {
|
|
72
|
+
success: boolean;
|
|
73
|
+
compiledFiles: number;
|
|
74
|
+
duration: number;
|
|
75
|
+
errors: Error[];
|
|
76
|
+
warnings: string[];
|
|
77
|
+
stats?: {
|
|
78
|
+
totalStyles: number;
|
|
79
|
+
atomicStyles: number;
|
|
80
|
+
cssSize: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -1,9 +1,33 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface FindOptions {
|
|
2
|
+
ignore?: string[];
|
|
3
|
+
absolute?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function findInputFiles(patterns: string[], options?: FindOptions): string[];
|
|
2
6
|
export declare function ensureDirectory(dir: string): void;
|
|
3
7
|
export declare function getRelativePath(filePath: string, baseDir: string): string;
|
|
4
|
-
export declare function getOutputPath(inputFile: string, outputDir: string): string;
|
|
8
|
+
export declare function getOutputPath(inputFile: string, outputDir: string, extension?: string): string;
|
|
5
9
|
export declare function fileExists(filePath: string): boolean;
|
|
6
10
|
export declare function readFile(filePath: string): string;
|
|
7
11
|
export declare function writeFile(filePath: string, content: string): void;
|
|
8
12
|
export declare function deleteFile(filePath: string): void;
|
|
9
|
-
|
|
13
|
+
export declare function copyFile(source: string, destination: string): void;
|
|
14
|
+
export declare function getFileSize(filePath: string): number;
|
|
15
|
+
export declare function getFileHash(filePath: string): string;
|
|
16
|
+
export declare function isDirectory(dirPath: string): boolean;
|
|
17
|
+
export declare function ensureCleanDir(dir: string): void;
|
|
18
|
+
declare const _default: {
|
|
19
|
+
findInputFiles: typeof findInputFiles;
|
|
20
|
+
ensureDirectory: typeof ensureDirectory;
|
|
21
|
+
getRelativePath: typeof getRelativePath;
|
|
22
|
+
getOutputPath: typeof getOutputPath;
|
|
23
|
+
fileExists: typeof fileExists;
|
|
24
|
+
readFile: typeof readFile;
|
|
25
|
+
writeFile: typeof writeFile;
|
|
26
|
+
deleteFile: typeof deleteFile;
|
|
27
|
+
copyFile: typeof copyFile;
|
|
28
|
+
getFileSize: typeof getFileSize;
|
|
29
|
+
getFileHash: typeof getFileHash;
|
|
30
|
+
isDirectory: typeof isDirectory;
|
|
31
|
+
ensureCleanDir: typeof ensureCleanDir;
|
|
32
|
+
};
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import * as CSS from 'csstype';
|
|
2
|
+
import { shorthandMap } from './shorthands.js';
|
|
3
|
+
import { AnimationConfig } from './animations.js';
|
|
4
|
+
/**
|
|
5
|
+
* Helper to extract the correct CSS value type for a shorthand
|
|
6
|
+
*/
|
|
7
|
+
type GetCSSValue<T extends string> = T extends keyof CSS.Properties ? CSS.Properties[T] : any;
|
|
8
|
+
/**
|
|
9
|
+
* Automatically generate methods for standard 1-to-1 shorthands
|
|
10
|
+
*/
|
|
11
|
+
type ShorthandMethods = {
|
|
12
|
+
[K in keyof typeof shorthandMap]: (value: GetCSSValue<typeof shorthandMap[K]>) => Chain;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Special handler methods
|
|
16
|
+
*/
|
|
17
|
+
interface SpecialMethods {
|
|
18
|
+
mx(value: string | number): Chain;
|
|
19
|
+
my(value: string | number): Chain;
|
|
20
|
+
px(value: string | number): Chain;
|
|
21
|
+
py(value: string | number): Chain;
|
|
22
|
+
size(value: string | number): Chain;
|
|
23
|
+
inset(value: string | number | {
|
|
24
|
+
top?: any;
|
|
25
|
+
right?: any;
|
|
26
|
+
bottom?: any;
|
|
27
|
+
left?: any;
|
|
28
|
+
}): Chain;
|
|
29
|
+
insetX(value: string | number): Chain;
|
|
30
|
+
insetY(value: string | number): Chain;
|
|
31
|
+
gap(value: string | number): Chain;
|
|
32
|
+
gapX(value: string | number): Chain;
|
|
33
|
+
gapY(value: string | number): Chain;
|
|
34
|
+
borderX(value: string): Chain;
|
|
35
|
+
borderY(value: string): Chain;
|
|
36
|
+
border(value: string | number): Chain;
|
|
37
|
+
flex(value?: string | boolean): Chain;
|
|
38
|
+
inlineFlex(value?: any): Chain;
|
|
39
|
+
grid(value?: string | boolean): Chain;
|
|
40
|
+
inlineGrid(value?: any): Chain;
|
|
41
|
+
cols(value: number | string): Chain;
|
|
42
|
+
rows(value: number | string): Chain;
|
|
43
|
+
center(type?: 'flex' | 'inline'): Chain;
|
|
44
|
+
flexCenter(dir?: 'row' | 'col' | 'column'): Chain;
|
|
45
|
+
gridCenter(): Chain;
|
|
46
|
+
stack(config: string | number | 'row' | {
|
|
47
|
+
spacing: any;
|
|
48
|
+
dir?: 'row' | 'col';
|
|
49
|
+
}): Chain;
|
|
50
|
+
gridTable(minWidth: string | number): Chain;
|
|
51
|
+
aspect(ratio: 'square' | 'video' | 'golden' | string): Chain;
|
|
52
|
+
hide(): Chain;
|
|
53
|
+
show(): Chain;
|
|
54
|
+
unselectable(): Chain;
|
|
55
|
+
scrollable(axis?: 'x' | 'y' | 'both'): Chain;
|
|
56
|
+
safeArea(edge?: 'top' | 'bottom' | 'left' | 'right' | 'all' | string[]): Chain;
|
|
57
|
+
absolute(coords?: {
|
|
58
|
+
top?: any;
|
|
59
|
+
right?: any;
|
|
60
|
+
bottom?: any;
|
|
61
|
+
left?: any;
|
|
62
|
+
}): Chain;
|
|
63
|
+
fixed(coords?: {
|
|
64
|
+
top?: any;
|
|
65
|
+
right?: any;
|
|
66
|
+
bottom?: any;
|
|
67
|
+
left?: any;
|
|
68
|
+
}): Chain;
|
|
69
|
+
sticky(coords?: {
|
|
70
|
+
top?: any;
|
|
71
|
+
right?: any;
|
|
72
|
+
bottom?: any;
|
|
73
|
+
left?: any;
|
|
74
|
+
}): Chain;
|
|
75
|
+
relative(coords?: {
|
|
76
|
+
top?: any;
|
|
77
|
+
right?: any;
|
|
78
|
+
bottom?: any;
|
|
79
|
+
left?: any;
|
|
80
|
+
}): Chain;
|
|
81
|
+
circle(size: string | number): Chain;
|
|
82
|
+
square(size: string | number): Chain;
|
|
83
|
+
truncate(): Chain;
|
|
84
|
+
fluidText(config: {
|
|
85
|
+
min: number | string;
|
|
86
|
+
max: number | string;
|
|
87
|
+
vw?: string;
|
|
88
|
+
}): Chain;
|
|
89
|
+
glass(blur?: string | number): Chain;
|
|
90
|
+
glow(config: string | {
|
|
91
|
+
color: string;
|
|
92
|
+
size?: number;
|
|
93
|
+
}): Chain;
|
|
94
|
+
textGradient(colors: string[] | {
|
|
95
|
+
colors: string[];
|
|
96
|
+
angle?: number;
|
|
97
|
+
}): Chain;
|
|
98
|
+
meshGradient(colors: string[]): Chain;
|
|
99
|
+
noise(opacity?: number): Chain;
|
|
100
|
+
skeleton(active: boolean | {
|
|
101
|
+
active: boolean;
|
|
102
|
+
color?: string;
|
|
103
|
+
highlight?: string;
|
|
104
|
+
}): Chain;
|
|
105
|
+
clickScale(amount?: number): Chain;
|
|
106
|
+
onInteracting(callback: (css: Chain) => void): Chain;
|
|
107
|
+
children(callback: (css: Chain) => void): Chain;
|
|
108
|
+
dark(callback: (css: Chain) => void): Chain;
|
|
109
|
+
light(callback: (css: Chain) => void): Chain;
|
|
110
|
+
scale(value: number): Chain;
|
|
111
|
+
rotate(value: string | number): Chain;
|
|
112
|
+
x(value: string | number): Chain;
|
|
113
|
+
y(value: string | number): Chain;
|
|
114
|
+
skew(value: string | number): Chain;
|
|
115
|
+
pill(): Chain;
|
|
116
|
+
containerMacro(maxWidth?: string | number): Chain;
|
|
117
|
+
fullScreen(zIndex?: number): Chain;
|
|
118
|
+
shimmer(): Chain;
|
|
119
|
+
bento(cols?: number): Chain;
|
|
120
|
+
pressable(): Chain;
|
|
121
|
+
focusRing(color?: string): Chain;
|
|
122
|
+
outlineDebug(): Chain;
|
|
123
|
+
parallax(scale?: number): Chain;
|
|
124
|
+
lineClamp(lines?: number): Chain;
|
|
125
|
+
frostedNav(blur?: number | string): Chain;
|
|
126
|
+
}
|
|
127
|
+
interface ChainBase {
|
|
128
|
+
$el(...selectors: string[]): any;
|
|
129
|
+
end(): Chain;
|
|
130
|
+
hover(): Chain;
|
|
131
|
+
nest(selector: string, callback: (css: Chain) => void): Chain;
|
|
132
|
+
use(mixin: Record<string, any>): Chain;
|
|
133
|
+
when(condition: boolean, callback: (css: Chain) => void): Chain;
|
|
134
|
+
responsive(breakpoint: string, callback: (css: Chain) => void): Chain;
|
|
135
|
+
media(query: string, callback: (css: Chain) => void): Chain;
|
|
136
|
+
supports(condition: string, callback: (css: Chain) => void): Chain;
|
|
137
|
+
containerQuery(condition: string, callback: (css: Chain) => void): Chain;
|
|
138
|
+
layer(name: string, callback: (css: Chain) => void): Chain;
|
|
139
|
+
keyframes(name: string, steps: Record<string, any>): Chain;
|
|
140
|
+
fontFace(properties: Record<string, string>): Chain;
|
|
141
|
+
componentName(name: string): Chain;
|
|
142
|
+
component(framework?: 'react' | 'vue' | 'svelte' | 'solid' | 'auto'): Chain;
|
|
143
|
+
props(propsDefinition?: Record<string, any>): Chain;
|
|
144
|
+
animation(name: string, config?: AnimationConfig): Chain;
|
|
145
|
+
animate(name: string, keyframes: Record<string, any>, config?: AnimationConfig): Chain;
|
|
146
|
+
duration(v: string): Chain;
|
|
147
|
+
delay(v: string): Chain;
|
|
148
|
+
timing(v: string): Chain;
|
|
149
|
+
iteration(v: string | number): Chain;
|
|
150
|
+
infinite(): Chain;
|
|
151
|
+
calc(expr: string): any;
|
|
152
|
+
add(...args: any[]): any;
|
|
153
|
+
subtract(...args: any[]): any;
|
|
154
|
+
sub(...args: any[]): any;
|
|
155
|
+
multiply(...args: any[]): any;
|
|
156
|
+
mul(...args: any[]): any;
|
|
157
|
+
divide(...args: any[]): any;
|
|
158
|
+
div(...args: any[]): any;
|
|
159
|
+
mpx(v: number | string): string;
|
|
160
|
+
rem(v: number | string): string;
|
|
161
|
+
em(v: number | string): string;
|
|
162
|
+
percent(v: number | string): string;
|
|
163
|
+
vw(v: number | string): string;
|
|
164
|
+
vh(v: number | string): string;
|
|
165
|
+
min(...args: any[]): any;
|
|
166
|
+
max(...args: any[]): any;
|
|
167
|
+
clamp(min: any, val: any, max: any): any;
|
|
168
|
+
debug(): Chain;
|
|
169
|
+
explain(shorthand: string): Chain;
|
|
170
|
+
}
|
|
171
|
+
type CSSMethods = {
|
|
172
|
+
[K in keyof CSS.Properties]-?: (value: CSS.Properties[K]) => Chain;
|
|
173
|
+
};
|
|
174
|
+
export type Chain = SpecialMethods & ChainBase & CSSMethods & ShorthandMethods;
|
|
175
|
+
export declare function setTokenContext(context: any): void;
|
|
176
|
+
export declare function getTokenContext(): any;
|
|
177
|
+
export declare function enableDebug(enable?: boolean): void;
|
|
178
|
+
export declare class ChainClass {
|
|
179
|
+
private catcher;
|
|
180
|
+
private useTokens;
|
|
181
|
+
private hoverCatcher;
|
|
182
|
+
private valueCache;
|
|
183
|
+
private readonly MAX_CACHE_SIZE;
|
|
184
|
+
__proxy: any;
|
|
185
|
+
constructor(useTokens?: boolean);
|
|
186
|
+
private resolveValue;
|
|
187
|
+
private setTransform;
|
|
188
|
+
private setProperty;
|
|
189
|
+
get(prop: string | symbol): any;
|
|
190
|
+
private finalize;
|
|
191
|
+
private macroHandler;
|
|
192
|
+
private createHover;
|
|
193
|
+
private endHover;
|
|
194
|
+
private useMixin;
|
|
195
|
+
private whenCondition;
|
|
196
|
+
private nestSelector;
|
|
197
|
+
private setComponentName;
|
|
198
|
+
private setComponent;
|
|
199
|
+
private setProps;
|
|
200
|
+
private enableDebugMode;
|
|
201
|
+
private explainShorthand;
|
|
202
|
+
private applyAnimation;
|
|
203
|
+
private createAnimation;
|
|
204
|
+
private applyResponsive;
|
|
205
|
+
private applyMedia;
|
|
206
|
+
private defineKeyframes;
|
|
207
|
+
private defineFontFace;
|
|
208
|
+
private applySupports;
|
|
209
|
+
private applyContainerQuery;
|
|
210
|
+
private applyLayer;
|
|
211
|
+
private clear;
|
|
212
|
+
}
|
|
213
|
+
export declare function createChain(useTokens?: boolean): Chain;
|
|
214
|
+
export declare const chain: (useTokens?: boolean) => Chain;
|
|
215
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export interface AnimationConfig {
|
|
2
|
+
duration?: string;
|
|
3
|
+
delay?: string;
|
|
4
|
+
timing?: string;
|
|
5
|
+
iteration?: string | number;
|
|
6
|
+
direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
|
7
|
+
fillMode?: 'none' | 'forwards' | 'backwards' | 'both';
|
|
8
|
+
playState?: 'running' | 'paused';
|
|
9
|
+
name?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface KeyframeDefinition {
|
|
12
|
+
[key: string]: Record<string, string | number>;
|
|
13
|
+
}
|
|
14
|
+
export declare const animationPresets: Record<string, KeyframeDefinition>;
|
|
15
|
+
export declare const DEFAULT_ANIMATION_CONFIG: Required<AnimationConfig>;
|
|
16
|
+
export declare const timingFunctions: {
|
|
17
|
+
linear: string;
|
|
18
|
+
ease: string;
|
|
19
|
+
easeIn: string;
|
|
20
|
+
easeOut: string;
|
|
21
|
+
easeInOut: string;
|
|
22
|
+
bounce: string;
|
|
23
|
+
elastic: string;
|
|
24
|
+
smooth: string;
|
|
25
|
+
sharp: string;
|
|
26
|
+
};
|
|
27
|
+
export declare function createAnimation(animationName: string, config?: AnimationConfig): Record<string, any>;
|
|
28
|
+
export declare function createKeyframesCSS(name: string, steps: KeyframeDefinition, prefix?: boolean): string;
|
|
29
|
+
export declare function getAnimationPreset(name: string): KeyframeDefinition | undefined;
|
|
30
|
+
export declare function hasAnimationPreset(name: string): boolean;
|
|
31
|
+
export declare function getAnimationPresetNames(): string[];
|
|
32
|
+
export declare function registerAnimationPreset(name: string, steps: KeyframeDefinition, overwrite?: boolean): boolean;
|
|
33
|
+
export declare function registerAnimationPresets(presets: Record<string, KeyframeDefinition>, overwrite?: boolean): void;
|
|
34
|
+
export declare function combineAnimations(animations: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
duration?: string;
|
|
37
|
+
delay?: string;
|
|
38
|
+
}>): Record<string, any>;
|
|
39
|
+
export declare function staggerChildren(baseDelay?: string, increment?: string, count?: number): Record<number, string>;
|
|
40
|
+
export declare function msToTime(ms: number): string;
|
|
41
|
+
export interface AnimationStep {
|
|
42
|
+
name: string;
|
|
43
|
+
duration?: string;
|
|
44
|
+
delay?: string;
|
|
45
|
+
}
|
|
46
|
+
export declare function createAnimationSequence(steps: AnimationStep[]): Record<string, any>;
|
|
47
|
+
export declare function isValidAnimation(name: string): boolean;
|
|
48
|
+
export declare function getAnimationSuggestion(name: string): string | null;
|
|
49
|
+
declare const _default: {
|
|
50
|
+
animationPresets: Record<string, KeyframeDefinition>;
|
|
51
|
+
createAnimation: typeof createAnimation;
|
|
52
|
+
createKeyframesCSS: typeof createKeyframesCSS;
|
|
53
|
+
getAnimationPreset: typeof getAnimationPreset;
|
|
54
|
+
hasAnimationPreset: typeof hasAnimationPreset;
|
|
55
|
+
getAnimationPresetNames: typeof getAnimationPresetNames;
|
|
56
|
+
registerAnimationPreset: typeof registerAnimationPreset;
|
|
57
|
+
registerAnimationPresets: typeof registerAnimationPresets;
|
|
58
|
+
combineAnimations: typeof combineAnimations;
|
|
59
|
+
staggerChildren: typeof staggerChildren;
|
|
60
|
+
createAnimationSequence: typeof createAnimationSequence;
|
|
61
|
+
isValidAnimation: typeof isValidAnimation;
|
|
62
|
+
getAnimationSuggestion: typeof getAnimationSuggestion;
|
|
63
|
+
timingFunctions: {
|
|
64
|
+
linear: string;
|
|
65
|
+
ease: string;
|
|
66
|
+
easeIn: string;
|
|
67
|
+
easeOut: string;
|
|
68
|
+
easeInOut: string;
|
|
69
|
+
bounce: string;
|
|
70
|
+
elastic: string;
|
|
71
|
+
smooth: string;
|
|
72
|
+
sharp: string;
|
|
73
|
+
};
|
|
74
|
+
DEFAULT_ANIMATION_CONFIG: Required<AnimationConfig>;
|
|
75
|
+
};
|
|
76
|
+
export default _default;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export interface AtomicClass {
|
|
2
2
|
className: string;
|
|
3
3
|
prop: string;
|
|
4
|
-
value:
|
|
4
|
+
value: any;
|
|
5
5
|
usageCount: number;
|
|
6
|
+
rules?: string;
|
|
7
|
+
createdAt?: number;
|
|
8
|
+
hash?: string;
|
|
6
9
|
}
|
|
7
10
|
export interface AtomicOptimizerStats {
|
|
8
11
|
totalStyles: number;
|
|
@@ -10,6 +13,7 @@ export interface AtomicOptimizerStats {
|
|
|
10
13
|
standardStyles: number;
|
|
11
14
|
uniqueProperties: number;
|
|
12
15
|
savings: string;
|
|
16
|
+
cacheHitRate?: number;
|
|
13
17
|
}
|
|
14
18
|
export interface AtomicOptimizerOptions {
|
|
15
19
|
enabled?: boolean;
|
|
@@ -34,6 +38,7 @@ export interface ComponentClassMapEntry {
|
|
|
34
38
|
atomicClasses: string[];
|
|
35
39
|
hoverAtomicClasses: string[];
|
|
36
40
|
selectors: string[];
|
|
41
|
+
componentClassName?: string;
|
|
37
42
|
}
|
|
38
43
|
export interface OptimizeResult {
|
|
39
44
|
css: string;
|
|
@@ -44,9 +49,11 @@ export interface OptimizeResult {
|
|
|
44
49
|
componentMap?: Map<string, ComponentClassMapEntry>;
|
|
45
50
|
}
|
|
46
51
|
export declare class AtomicOptimizer {
|
|
52
|
+
private config;
|
|
47
53
|
options: Required<AtomicOptimizerOptions>;
|
|
48
|
-
usageCount
|
|
49
|
-
atomicClasses
|
|
54
|
+
private usageCount;
|
|
55
|
+
private atomicClasses;
|
|
56
|
+
atomicMap: Record<string, string>;
|
|
50
57
|
componentClassMap: Map<string, ComponentClassMapEntry>;
|
|
51
58
|
stats: {
|
|
52
59
|
totalStyles: number;
|
|
@@ -54,23 +61,51 @@ export declare class AtomicOptimizer {
|
|
|
54
61
|
standardStyles: number;
|
|
55
62
|
uniqueProperties: number;
|
|
56
63
|
savings: number;
|
|
64
|
+
cacheHits: number;
|
|
65
|
+
cacheMisses: number;
|
|
57
66
|
};
|
|
58
|
-
constructor(
|
|
67
|
+
constructor(config: any);
|
|
68
|
+
componentMap: Map<string, ComponentClassMapEntry>;
|
|
69
|
+
/**
|
|
70
|
+
* Get usage count for a specific property-value pair
|
|
71
|
+
*/
|
|
72
|
+
getUsageCount(prop: string, value: string, context?: string): number;
|
|
73
|
+
/**
|
|
74
|
+
* Increment usage count for a specific property-value pair
|
|
75
|
+
*/
|
|
76
|
+
incrementUsageCount(prop: string, value: string, context?: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Get the usage count map for debugging
|
|
79
|
+
*/
|
|
80
|
+
getUsageCountMap(): Map<string, number>;
|
|
59
81
|
private loadCache;
|
|
60
82
|
private saveCache;
|
|
61
|
-
|
|
83
|
+
trackStyles(styles: any[]): void;
|
|
84
|
+
process(styleChain: string): void;
|
|
85
|
+
private processStyleObject;
|
|
86
|
+
private generateClassName;
|
|
62
87
|
private incrementUsage;
|
|
63
88
|
private shouldBeAtomic;
|
|
64
|
-
private generateClassName;
|
|
65
89
|
private getOrCreateAtomic;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
90
|
+
getKeyFromClassName(className: string): string | null;
|
|
91
|
+
generateAtomicCSS(): string;
|
|
92
|
+
generateComponentCSS(style: any, selectors: string[], context?: string): {
|
|
93
|
+
css: string;
|
|
94
|
+
atomicClasses: string[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Generate a clean component name without any prefixes
|
|
98
|
+
*/
|
|
99
|
+
private getCleanComponentName;
|
|
100
|
+
private generatePseudoCSS;
|
|
101
|
+
optimize(styles: Record<string, any>): OptimizeResult;
|
|
102
|
+
private processPseudoState;
|
|
103
|
+
reset(): void;
|
|
70
104
|
getStats(): AtomicOptimizerStats;
|
|
71
|
-
getAtomicClass(prop: string, value: string): string | null;
|
|
105
|
+
getAtomicClass(prop: string, value: string, context?: string): string | null;
|
|
72
106
|
getAllAtomicClasses(): AtomicClass[];
|
|
73
107
|
clearCache(): void;
|
|
108
|
+
getComponentMapEntry(name: string): ComponentClassMapEntry | undefined;
|
|
109
|
+
getAtomicMap(): Record<string, string>;
|
|
74
110
|
}
|
|
75
111
|
export { AtomicOptimizer as default };
|
|
76
|
-
//# sourceMappingURL=atomic-optimizer.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface BreakpointConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
minWidth?: number;
|
|
4
|
+
maxWidth?: number;
|
|
5
|
+
query: string;
|
|
6
|
+
priority?: number;
|
|
7
|
+
}
|
|
8
|
+
export type BreakpointsMap = Record<string, string>;
|
|
9
|
+
export type BreakpointValues = Record<string, number>;
|
|
10
|
+
export declare const BREAKPOINT_VALUES: Record<string, number>;
|
|
11
|
+
export declare let currentBreakpoints: BreakpointsMap;
|
|
12
|
+
export declare function setBreakpoints(breakpoints: Partial<BreakpointsMap>): void;
|
|
13
|
+
export declare function getBreakpoint(name: string): string | undefined;
|
|
14
|
+
export declare function getAllBreakpoints(): BreakpointsMap;
|
|
15
|
+
export declare function resetBreakpoints(): void;
|
|
16
|
+
export declare function addBreakpoint(name: string, query: string): void;
|
|
17
|
+
export declare function removeBreakpoint(name: string): boolean;
|
|
18
|
+
export declare function createMediaQuery(min?: number | string, max?: number | string, unit?: 'px' | 'rem' | 'em'): string;
|
|
19
|
+
export declare function getBreakpointValue(name: string): number | undefined;
|
|
20
|
+
export declare function getBreakpointRange(name: string): {
|
|
21
|
+
min: number;
|
|
22
|
+
max: number;
|
|
23
|
+
} | null;
|
|
24
|
+
export declare function generateBreakpointCSS(selector: string, styles: Record<string, any>): string;
|
|
25
|
+
export declare function getSortedBreakpoints(): Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
query: string;
|
|
28
|
+
minWidth: number;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function getBreakpointForWidth(width: number): string | null;
|
|
31
|
+
export declare function hasBreakpoint(name: string): boolean;
|
|
32
|
+
export declare function getBreakpointNames(): string[];
|
|
33
|
+
export interface ResponsiveStyle<T = any> {
|
|
34
|
+
base?: T;
|
|
35
|
+
sm?: T;
|
|
36
|
+
md?: T;
|
|
37
|
+
lg?: T;
|
|
38
|
+
xl?: T;
|
|
39
|
+
'2xl'?: T;
|
|
40
|
+
[key: string]: T | undefined;
|
|
41
|
+
}
|
|
42
|
+
export declare function generateResponsiveCSS(selector: string, styles: ResponsiveStyle<Record<string, any>>): string;
|
|
43
|
+
export declare function responsive<T>(value: T | ResponsiveStyle<T>, defaultBreakpoint?: keyof ResponsiveStyle): ResponsiveStyle<T>;
|
|
44
|
+
export declare function mergeResponsiveStyles(...styles: ResponsiveStyle<any>[]): ResponsiveStyle<any>;
|
|
45
|
+
export declare function getBreakpointQuery(name: string, unit?: 'px' | 'rem' | 'em'): string | undefined;
|
|
46
|
+
export declare function logBreakpoints(): void;
|