chaincss 2.0.6 → 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.
Files changed (159) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/CODE_OF_CONDUCT.md +21 -0
  3. package/CONTRIBUTING.md +28 -0
  4. package/README.md +454 -231
  5. package/demo/demo/node_modules/caniuse-db/fulldata-json/data-2.0.json +1 -0
  6. package/demo/index.html +16 -0
  7. package/demo/package.json +20 -0
  8. package/demo/src/App.tsx +117 -0
  9. package/demo/src/chaincss-barrel.ts +9 -0
  10. package/demo/src/main.tsx +8 -0
  11. package/demo/src/styles.chain.ts +300 -0
  12. package/demo/vite.config.ts +46 -0
  13. package/dist/cli/commands/build.d.ts +0 -1
  14. package/dist/cli/commands/cache.d.ts +1 -0
  15. package/dist/cli/commands/init.d.ts +6 -3
  16. package/dist/cli/commands/timeline.d.ts +0 -1
  17. package/dist/cli/commands/watch.d.ts +0 -1
  18. package/dist/cli/index.d.ts +0 -1
  19. package/dist/cli/index.js +3213 -5296
  20. package/dist/cli/types.d.ts +51 -20
  21. package/dist/cli/utils/config-loader.d.ts +0 -1
  22. package/dist/cli/utils/file-utils.d.ts +27 -3
  23. package/dist/cli/utils/logger.d.ts +0 -1
  24. package/dist/compiler/Chain.d.ts +215 -0
  25. package/dist/compiler/animations.d.ts +76 -0
  26. package/dist/compiler/atomic-optimizer.d.ts +47 -12
  27. package/dist/compiler/breakpoints.d.ts +46 -0
  28. package/dist/compiler/btt.d.ts +36 -60
  29. package/dist/compiler/cache-manager.d.ts +58 -4
  30. package/dist/compiler/commonProps.d.ts +0 -1
  31. package/dist/compiler/content-addressable-cache.d.ts +78 -0
  32. package/dist/compiler/helpers.d.ts +54 -0
  33. package/dist/compiler/index.d.ts +16 -9
  34. package/dist/compiler/index.js +4450 -4316
  35. package/dist/compiler/prefixer.d.ts +17 -1
  36. package/dist/compiler/shorthands.d.ts +28 -0
  37. package/dist/compiler/suggestions.d.ts +43 -0
  38. package/dist/compiler/theme-contract.d.ts +16 -27
  39. package/dist/compiler/token-resolver.d.ts +69 -0
  40. package/dist/compiler/tokens.d.ts +33 -8
  41. package/dist/core/auto-detector.d.ts +34 -0
  42. package/dist/core/common-utils.d.ts +97 -0
  43. package/dist/core/compiler.d.ts +63 -23
  44. package/dist/core/constants.d.ts +137 -36
  45. package/dist/core/smart-chain.d.ts +3 -0
  46. package/dist/core/types.d.ts +122 -15
  47. package/dist/core/utils.d.ts +134 -17
  48. package/dist/index.d.ts +52 -8
  49. package/dist/index.js +7090 -5578
  50. package/dist/plugins/vite.d.ts +7 -5
  51. package/dist/plugins/vite.js +2964 -25641
  52. package/dist/plugins/webpack.d.ts +24 -1
  53. package/dist/plugins/webpack.js +209 -72
  54. package/dist/runtime/Chain.d.ts +32 -0
  55. package/dist/runtime/auto-hooks.d.ts +11 -0
  56. package/dist/runtime/hmr.d.ts +22 -2
  57. package/dist/runtime/index.d.ts +3 -2
  58. package/dist/runtime/index.js +3649 -301
  59. package/dist/runtime/injector.d.ts +39 -71
  60. package/dist/runtime/react.d.ts +17 -12
  61. package/dist/runtime/svelte.d.ts +15 -0
  62. package/dist/runtime/types.d.ts +126 -4
  63. package/dist/runtime/utils.d.ts +0 -1
  64. package/dist/runtime/vue.d.ts +34 -14
  65. package/package.json +59 -66
  66. package/src/cli/commands/build.ts +133 -0
  67. package/src/cli/commands/cache.ts +371 -0
  68. package/src/cli/commands/init.ts +230 -0
  69. package/src/cli/commands/timeline.ts +435 -0
  70. package/src/cli/commands/watch.ts +211 -0
  71. package/src/cli/index.ts +226 -0
  72. package/src/cli/types.ts +100 -0
  73. package/src/cli/utils/config-loader.ts +174 -0
  74. package/src/cli/utils/file-utils.ts +139 -0
  75. package/src/cli/utils/logger.ts +74 -0
  76. package/src/compiler/Chain.ts +831 -0
  77. package/src/compiler/animations.ts +517 -0
  78. package/src/compiler/atomic-optimizer.ts +786 -0
  79. package/src/compiler/breakpoints.ts +347 -0
  80. package/src/compiler/btt.ts +1147 -0
  81. package/src/compiler/cache-manager.ts +446 -0
  82. package/src/compiler/commonProps.ts +18 -0
  83. package/src/compiler/content-addressable-cache.ts +478 -0
  84. package/src/compiler/helpers.ts +407 -0
  85. package/src/compiler/index.ts +72 -0
  86. package/src/compiler/prefixer.ts +724 -0
  87. package/src/compiler/shorthands.ts +558 -0
  88. package/src/compiler/suggestions.ts +436 -0
  89. package/src/compiler/theme-contract.ts +197 -0
  90. package/src/compiler/token-resolver.ts +241 -0
  91. package/src/compiler/tokens.ts +612 -0
  92. package/src/core/auto-detector.ts +187 -0
  93. package/src/core/common-utils.ts +423 -0
  94. package/src/core/compiler.ts +835 -0
  95. package/src/core/constants.ts +424 -0
  96. package/src/core/index.ts +107 -0
  97. package/src/core/smart-chain.ts +163 -0
  98. package/src/core/types.ts +257 -0
  99. package/src/core/utils.ts +598 -0
  100. package/src/index.ts +208 -0
  101. package/src/plugins/vite.d.ts +316 -0
  102. package/src/plugins/vite.ts +424 -0
  103. package/src/plugins/webpack.d.ts +289 -0
  104. package/src/plugins/webpack.ts +416 -0
  105. package/src/runtime/Chain.ts +242 -0
  106. package/src/runtime/auto-hooks.tsx +127 -0
  107. package/src/runtime/auto-vue.ts +72 -0
  108. package/src/runtime/hmr.ts +212 -0
  109. package/src/runtime/index.ts +82 -0
  110. package/src/runtime/injector.ts +273 -0
  111. package/src/runtime/react.tsx +269 -0
  112. package/src/runtime/svelte.ts +15 -0
  113. package/src/runtime/types.ts +256 -0
  114. package/src/runtime/utils.ts +128 -0
  115. package/src/runtime/vite-env.d.ts +120 -0
  116. package/src/runtime/vue.ts +231 -0
  117. package/tsconfig.build.json +41 -0
  118. package/tsconfig.json +25 -0
  119. package/tsconfig.runtimes.json +18 -0
  120. package/dist/cli/cli.cjs +0 -7
  121. package/dist/cli/commands/build.d.ts.map +0 -1
  122. package/dist/cli/commands/compile.d.ts +0 -3
  123. package/dist/cli/commands/compile.d.ts.map +0 -1
  124. package/dist/cli/commands/init.d.ts.map +0 -1
  125. package/dist/cli/commands/timeline.d.ts.map +0 -1
  126. package/dist/cli/commands/watch.d.ts.map +0 -1
  127. package/dist/cli/index.d.ts.map +0 -1
  128. package/dist/cli/types.d.ts.map +0 -1
  129. package/dist/cli/utils/config-loader.d.ts.map +0 -1
  130. package/dist/cli/utils/file-utils.d.ts.map +0 -1
  131. package/dist/cli/utils/logger.d.ts.map +0 -1
  132. package/dist/compiler/atomic-optimizer.d.ts.map +0 -1
  133. package/dist/compiler/btt.d.ts.map +0 -1
  134. package/dist/compiler/cache-manager.d.ts.map +0 -1
  135. package/dist/compiler/commonProps.d.ts.map +0 -1
  136. package/dist/compiler/index.d.ts.map +0 -1
  137. package/dist/compiler/prefixer.d.ts.map +0 -1
  138. package/dist/compiler/theme-contract.d.ts.map +0 -1
  139. package/dist/compiler/tokens.d.ts.map +0 -1
  140. package/dist/compiler/types.d.ts +0 -57
  141. package/dist/compiler/types.d.ts.map +0 -1
  142. package/dist/core/compiler.d.ts.map +0 -1
  143. package/dist/core/constants.d.ts.map +0 -1
  144. package/dist/core/index.d.ts +0 -4
  145. package/dist/core/index.d.ts.map +0 -1
  146. package/dist/core/types.d.ts.map +0 -1
  147. package/dist/core/utils.d.ts.map +0 -1
  148. package/dist/index.d.ts.map +0 -1
  149. package/dist/plugins/vite.d.ts.map +0 -1
  150. package/dist/plugins/webpack.d.ts.map +0 -1
  151. package/dist/runtime/hmr.d.ts.map +0 -1
  152. package/dist/runtime/index.d.ts.map +0 -1
  153. package/dist/runtime/injector.d.ts.map +0 -1
  154. package/dist/runtime/react.d.ts.map +0 -1
  155. package/dist/runtime/react.js +0 -270
  156. package/dist/runtime/types.d.ts.map +0 -1
  157. package/dist/runtime/utils.d.ts.map +0 -1
  158. package/dist/runtime/vue.d.ts.map +0 -1
  159. package/dist/runtime/vue.js +0 -232
package/src/index.ts ADDED
@@ -0,0 +1,208 @@
1
+ // chaincss/src/index.ts --- Main exports for ChainCSS
2
+
3
+ /**
4
+ * ChainCSS - Zero-runtime CSS-in-JS with Atomic CSS optimization
5
+ * @packageDocumentation
6
+ */
7
+
8
+ // ============================================================================
9
+ // 🆕 NEW: Smart Chain API (Auto-detection mixed mode)
10
+ // ============================================================================
11
+ export { smartChain, smartChain as chainV3, buildChain, runtimeChain } from './core/smart-chain.js';
12
+ export { autoDetector, AutoDetector, type ValueType, type Mode } from './core/auto-detector.js';
13
+
14
+ // ============================================================================
15
+ // 🆕 NEW: React Hooks with Auto-Detection
16
+ // ============================================================================
17
+ export { useSmartStyles, createSmartComponent, withSmartStyles } from './runtime/auto-hooks.js';
18
+
19
+ // ============================================================================
20
+ // Core Compiler (unchanged - keep for backward compatibility)
21
+ // ============================================================================
22
+ export { ChainCSSCompiler, compileChainCSS } from './core/compiler.js';
23
+
24
+ // ============================================================================
25
+ // Chain API - Main entry point for style definitions (unchanged)
26
+ // ============================================================================
27
+ export {
28
+ chain,
29
+ chain as $, // Alias for convenience
30
+ recipe, // Variant system
31
+ createTokens, // Design token creation
32
+ configureAtomic, // Atomic CSS configuration
33
+ tokens, // Default token instance
34
+ enableDebug, // Debug mode
35
+ setBreakpoints, // Responsive breakpoints
36
+ enableTimeline, // Style timeline tracking
37
+ getStyleHistory, // Timeline history
38
+ getStyleChanges, // Timeline changes
39
+ getStyleDiff, // Timeline diff
40
+ exportTimeline, // Export timeline
41
+ clearTimeline // Clear timeline
42
+ } from './compiler/btt.js';
43
+
44
+ // ============================================================================
45
+ // Atomic Optimizer (unchanged)
46
+ // ============================================================================
47
+ export { AtomicOptimizer } from './compiler/atomic-optimizer.js';
48
+
49
+ // ============================================================================
50
+ // CSS Prefixer (Autoprefixer alternative) (unchanged)
51
+ // ============================================================================
52
+ export { ChainCSSPrefixer } from './compiler/prefixer.js';
53
+
54
+ // ============================================================================
55
+ // Design Tokens System (unchanged)
56
+ // ============================================================================
57
+ export { DesignTokens, createTokens as createDesignTokens } from './compiler/tokens.js';
58
+
59
+ // ============================================================================
60
+ // Theme Contract System (unchanged)
61
+ // ============================================================================
62
+ export {
63
+ createThemeContract,
64
+ validateTheme,
65
+ createTheme,
66
+ Theme
67
+ } from './compiler/theme-contract.js';
68
+
69
+ // ============================================================================
70
+ // Cache Management (unchanged)
71
+ // ============================================================================
72
+ export { CacheManager } from './compiler/cache-manager.js';
73
+ export { PersistentCache } from './compiler/content-addressable-cache.js';
74
+
75
+ // ============================================================================
76
+ // Shorthands & Macros (unchanged)
77
+ // ============================================================================
78
+ export { shorthandMap, macros, handleShorthand, isShorthand, expandShorthand, getAvailableShorthands } from './compiler/shorthands.js';
79
+
80
+ // ============================================================================
81
+ // Helpers & Utilities (unchanged)
82
+ // ============================================================================
83
+ export { helpers } from './compiler/helpers.js';
84
+ export { animationPresets, createAnimation, getAnimationPreset, hasAnimationPreset, getAnimationPresetNames } from './compiler/animations.js';
85
+ export { getSuggestion, getSuggestions, getPropertySuggestion, getShorthandSuggestion } from './compiler/suggestions.js';
86
+
87
+ // ============================================================================
88
+ // Types - Core Types (unchanged)
89
+ // ============================================================================
90
+ export type {
91
+ StyleDefinition,
92
+ AtRule,
93
+ NestedRule,
94
+ ThemeBlock,
95
+ Recipe,
96
+ RecipeOptions,
97
+ ChainObject
98
+ } from './compiler/btt.js';
99
+
100
+ // ============================================================================
101
+ // Types - Atomic Optimizer (unchanged)
102
+ // ============================================================================
103
+ export type {
104
+ AtomicClass,
105
+ AtomicOptimizerOptions,
106
+ AtomicOptimizerStats,
107
+ ComponentClassMapEntry,
108
+ OptimizeResult
109
+ } from './compiler/atomic-optimizer.js';
110
+
111
+ // ============================================================================
112
+ // Types - Prefixer (unchanged)
113
+ // ============================================================================
114
+ export type {
115
+ PrefixerConfig,
116
+ PrefixerResult
117
+ } from './compiler/prefixer.js';
118
+
119
+ // ============================================================================
120
+ // Types - Theme Contract (unchanged)
121
+ // ============================================================================
122
+ export type {
123
+ ThemeContract,
124
+ ThemeTokens
125
+ } from './compiler/theme-contract.js';
126
+
127
+ export type { TokensStructure } from './compiler/tokens.js';
128
+
129
+ // ============================================================================
130
+ // Types - Configuration (unchanged)
131
+ // ============================================================================
132
+ export type {
133
+ ChainCSSConfig,
134
+ CompileResult,
135
+ ChainCSSPlugin
136
+ } from './core/types.js';
137
+
138
+ // ============================================================================
139
+ // Types - Chain API (unchanged)
140
+ // ============================================================================
141
+ export type { Chain } from './compiler/Chain.js';
142
+
143
+ // ============================================================================
144
+ // Types - Animations (unchanged)
145
+ // ============================================================================
146
+ export type { AnimationConfig, KeyframeDefinition } from './compiler/animations.js';
147
+
148
+ // ============================================================================
149
+ // Types - Breakpoints (unchanged)
150
+ // ============================================================================
151
+ export type { BreakpointsMap, ResponsiveStyle } from './compiler/breakpoints.js';
152
+
153
+ // ============================================================================
154
+ // Runtime Exports (for runtime mode) - unchanged
155
+ // ============================================================================
156
+ export * from './runtime/index.js';
157
+
158
+ // ============================================================================
159
+ // Version - UPDATE to 3.0.0
160
+ // ============================================================================
161
+ export const VERSION = '3.0.0';
162
+
163
+ // ============================================================================
164
+ // Default Export - Keep original chain for backward compatibility
165
+ // ============================================================================
166
+ import { chain } from './compiler/Chain.js';
167
+ export default chain;
168
+
169
+ // ============================================================================
170
+ // 🆕 NEW: Smart Chain as alternative default (optional)
171
+ // ============================================================================
172
+ import { smartChain } from './core/smart-chain.js';
173
+
174
+ // ============================================================================
175
+ // Initialize global defaults (non-blocking) - unchanged
176
+ // ============================================================================
177
+ import { chains } from './compiler/btt.js';
178
+
179
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'test') {
180
+ chains.initializeProperties().catch((err: Error) => {
181
+ if (process.env?.DEBUG) {
182
+ console.warn('[ChainCSS] Failed to load CSS properties:', err.message);
183
+ }
184
+ });
185
+ }
186
+
187
+ // ============================================================================
188
+ // Re-export commonly used types for convenience (unchanged)
189
+ // ============================================================================
190
+ export type {
191
+ Properties as CSSProperties
192
+ } from 'csstype';
193
+
194
+ export type TokenValue<T = string> = T | `$${string}`;
195
+
196
+ export type ResponsiveValue<T> = T | {
197
+ base?: T;
198
+ sm?: T;
199
+ md?: T;
200
+ lg?: T;
201
+ xl?: T;
202
+ '2xl'?: T;
203
+ [key: string]: T | undefined;
204
+ };
205
+
206
+ export type StyleWithTokens<T = any> = T | ((tokens: DesignTokens) => T);
207
+
208
+ import { DesignTokens } from './compiler/tokens.js';
@@ -0,0 +1,316 @@
1
+ // chaincss/src/plugins/vite.d.ts
2
+ import { Plugin } from 'vite';
3
+
4
+ /**
5
+ * ChainCSS Vite Plugin Options
6
+ */
7
+ export interface ChainCSSPluginOptions {
8
+ /**
9
+ * Enable atomic CSS optimization
10
+ * @default true
11
+ */
12
+ atomic?: boolean;
13
+
14
+ /**
15
+ * Enable vendor prefixing
16
+ * @default true
17
+ */
18
+ prefix?: boolean;
19
+
20
+ /**
21
+ * Output directory for generated CSS
22
+ * @default 'public'
23
+ */
24
+ outputDir?: string;
25
+
26
+ /**
27
+ * Generate TypeScript type definitions
28
+ * @default false
29
+ */
30
+ generateTypes?: boolean;
31
+
32
+ /**
33
+ * Minify CSS output
34
+ * @default false in development, true in production
35
+ */
36
+ minify?: boolean;
37
+
38
+ /**
39
+ * Enable verbose logging
40
+ * @default false
41
+ */
42
+ verbose?: boolean;
43
+
44
+ /**
45
+ * Enable Hot Module Replacement
46
+ * @default true
47
+ */
48
+ hmr?: boolean;
49
+
50
+ /**
51
+ * Inject global CSS automatically
52
+ * @default true
53
+ */
54
+ injectGlobal?: boolean;
55
+
56
+ /**
57
+ * Output file for CSS (relative to outputDir)
58
+ * @default 'global.css'
59
+ */
60
+ cssOutput?: string;
61
+
62
+ /**
63
+ * Output file for manifest (relative to outputDir)
64
+ * @default 'chaincss-manifest.json'
65
+ */
66
+ manifestOutput?: string;
67
+
68
+ /**
69
+ * File patterns to include
70
+ * @default ['**\/*.chain.{js,ts}', '**\/*.tsx', '**\/*.jsx']
71
+ */
72
+ include?: string[];
73
+
74
+ /**
75
+ * File patterns to exclude
76
+ * @default ['node_modules/**', '**\/*.test.{js,ts}']
77
+ */
78
+ exclude?: string[];
79
+
80
+ /**
81
+ * Enable source maps
82
+ * @default false
83
+ */
84
+ sourceMap?: boolean;
85
+
86
+ /**
87
+ * Custom CSS class name prefix
88
+ * @default 'chain'
89
+ */
90
+ classPrefix?: string;
91
+
92
+ /**
93
+ * Enable style timeline tracking
94
+ * @default false
95
+ */
96
+ timeline?: boolean;
97
+
98
+ /**
99
+ * Cache configuration
100
+ */
101
+ cache?: {
102
+ /**
103
+ * Enable caching
104
+ * @default true
105
+ */
106
+ enabled?: boolean;
107
+
108
+ /**
109
+ * Cache directory
110
+ * @default './.chaincss-cache'
111
+ */
112
+ directory?: string;
113
+
114
+ /**
115
+ * Max cache age in days
116
+ * @default 30
117
+ */
118
+ maxAge?: number;
119
+ };
120
+
121
+ /**
122
+ * Atomic CSS optimization options
123
+ */
124
+ atomicOptions?: {
125
+ /**
126
+ * Minimum usage threshold for atomic extraction
127
+ * @default 2
128
+ */
129
+ threshold?: number;
130
+
131
+ /**
132
+ * Class naming strategy
133
+ * @default 'hash'
134
+ */
135
+ naming?: 'hash' | 'readable';
136
+
137
+ /**
138
+ * CSS properties that should always be atomic
139
+ */
140
+ alwaysAtomic?: string[];
141
+
142
+ /**
143
+ * CSS properties that should never be atomic
144
+ */
145
+ neverAtomic?: string[];
146
+ };
147
+
148
+ /**
149
+ * Design tokens configuration
150
+ */
151
+ tokens?: {
152
+ /**
153
+ * Enable design tokens
154
+ * @default true
155
+ */
156
+ enabled?: boolean;
157
+
158
+ /**
159
+ * Token prefix
160
+ * @default 'chain'
161
+ */
162
+ prefix?: string;
163
+
164
+ /**
165
+ * Custom token values
166
+ */
167
+ values?: Record<string, any>;
168
+ };
169
+
170
+ /**
171
+ * Breakpoints configuration
172
+ */
173
+ breakpoints?: Record<string, string>;
174
+ }
175
+
176
+ /**
177
+ * ChainCSS Vite Plugin
178
+ *
179
+ * Automatically handles .chain.ts files and injects styles into your entry point.
180
+ * Supports atomic CSS optimization, design tokens, and HMR.
181
+ *
182
+ * @example
183
+ * ```ts
184
+ * // vite.config.ts
185
+ * import chaincss from 'chaincss/plugins/vite';
186
+ *
187
+ * export default {
188
+ * plugins: [
189
+ * chaincss({
190
+ * atomic: true,
191
+ * verbose: true,
192
+ * breakpoints: {
193
+ * mobile: '(max-width: 768px)',
194
+ * desktop: '(min-width: 1024px)'
195
+ * }
196
+ * })
197
+ * ]
198
+ * };
199
+ * ```
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * // Minimal configuration
204
+ * import chaincss from 'chaincss/plugins/vite';
205
+ *
206
+ * export default {
207
+ * plugins: [chaincss()]
208
+ * };
209
+ * ```
210
+ */
211
+ declare function chaincssPlugin(options?: ChainCSSPluginOptions): Plugin;
212
+
213
+ // Default export
214
+ export default chaincssPlugin;
215
+
216
+ // Named export for direct import
217
+ export { chaincssPlugin };
218
+
219
+ // Re-export the Plugin type from Vite for convenience
220
+ export type { Plugin } from 'vite';
221
+
222
+ // Additional helper types for better IDE support
223
+ export namespace ChainCSS {
224
+ /**
225
+ * Injected CSS runtime interface
226
+ */
227
+ interface Runtime {
228
+ /**
229
+ * Set the atomic class manifest
230
+ */
231
+ setManifest(manifest: Record<string, any>): void;
232
+
233
+ /**
234
+ * Get an atomic class name by property-value pair
235
+ */
236
+ getAtomicClass(prop: string, value: string): string | null;
237
+
238
+ /**
239
+ * Get all atomic classes
240
+ */
241
+ getAllAtomicClasses(): Array<{ className: string; prop: string; value: string }>;
242
+
243
+ /**
244
+ * Update CSS dynamically
245
+ */
246
+ updateCSS(css: string): void;
247
+ }
248
+
249
+ /**
250
+ * Style definition for chain() API
251
+ */
252
+ interface StyleDefinition {
253
+ selectors: string[];
254
+ [key: string]: any;
255
+ }
256
+
257
+ /**
258
+ * Component style options
259
+ */
260
+ interface ComponentOptions {
261
+ /**
262
+ * Component name
263
+ */
264
+ name?: string;
265
+
266
+ /**
267
+ * Framework to generate component for
268
+ */
269
+ framework?: 'react' | 'vue' | 'svelte' | 'solid' | 'auto';
270
+
271
+ /**
272
+ * Props definition for the component
273
+ */
274
+ props?: Record<string, any>;
275
+ }
276
+ }
277
+
278
+ // Global augmentation for Vite's import.meta
279
+ declare module 'vite' {
280
+ interface ImportMeta {
281
+ /**
282
+ * ChainCSS HMR API
283
+ */
284
+ hot?: {
285
+ /**
286
+ * Accept ChainCSS HMR updates
287
+ */
288
+ accept(): void;
289
+
290
+ /**
291
+ * Listen to ChainCSS HMR events
292
+ */
293
+ on(event: 'chaincss:update', callback: (data: { css: string; map: Record<string, any> }) => void): void;
294
+
295
+ /**
296
+ * Send ChainCSS HMR events
297
+ */
298
+ send(event: 'chaincss:update', data: any): void;
299
+ };
300
+ }
301
+ }
302
+
303
+ // Global augmentation for window object
304
+ declare global {
305
+ interface Window {
306
+ /**
307
+ * ChainCSS runtime instance
308
+ */
309
+ __CHAINCSS__?: ChainCSS.Runtime;
310
+ }
311
+ }
312
+
313
+ // Export all types
314
+ export type {
315
+ Plugin as VitePlugin
316
+ };