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
@@ -0,0 +1,127 @@
1
+ // src/runtime/auto-hooks.tsx
2
+
3
+ import React, { useEffect, useRef, useState } from 'react';
4
+ import { smartChain } from '../core/smart-chain.js';
5
+ import { styleInjector, compileRuntime } from './injector.js';
6
+
7
+ export interface UseSmartStylesOptions {
8
+ debug?: boolean;
9
+ ssr?: boolean;
10
+ moduleId?: string;
11
+ }
12
+
13
+ export function useSmartStyles<T extends Record<string, any>>(
14
+ styleBuilder: (chain: any) => any,
15
+ deps: any[] = [],
16
+ options: UseSmartStylesOptions = {}
17
+ ): Record<string, string> {
18
+ const moduleId = useRef(options.moduleId || `smart-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`);
19
+ const [classMap, setClassMap] = useState<Record<string, string>>({});
20
+ const isMounted = useRef(true);
21
+
22
+ useEffect(() => {
23
+ isMounted.current = true;
24
+
25
+ // Clean up previous styles
26
+ if (moduleId.current) {
27
+ styleInjector.removeModule(moduleId.current);
28
+ }
29
+
30
+ // Build styles with auto-detection
31
+ const chainInstance = smartChain();
32
+ const result = styleBuilder(chainInstance);
33
+
34
+ // Check if we got a hybrid result
35
+ if (result && (result as any).__isHybrid) {
36
+ const hybrid = result as any;
37
+
38
+ // Static styles are already handled, just need to inject dynamic parts
39
+ if (hybrid.__runtimeClasses && typeof hybrid.__runtimeClasses === 'object') {
40
+ const dynamicMap = compileRuntime(hybrid.__runtimeClasses, moduleId.current);
41
+
42
+ if (isMounted.current) {
43
+ setClassMap({
44
+ ...(typeof hybrid.__buildClasses === 'object' ? hybrid.__buildClasses : {}),
45
+ ...dynamicMap
46
+ });
47
+ }
48
+
49
+ if (options.debug) {
50
+ console.log('[ChainCSS Smart] Hybrid styles - Static:', hybrid.__buildClasses, 'Dynamic:', dynamicMap);
51
+ }
52
+ } else if (isMounted.current) {
53
+ setClassMap(typeof hybrid === 'object' ? hybrid : {});
54
+ }
55
+ }
56
+ // Pure runtime or build result
57
+ else if (result && typeof result === 'object' && Object.keys(result).length > 0) {
58
+ // Check if it needs injection (runtime mode)
59
+ const needsInjection = Object.values(result).some(v =>
60
+ typeof v === 'object' && v !== null && !String(v).startsWith('c-')
61
+ );
62
+
63
+ if (needsInjection && !options.ssr) {
64
+ const injected = compileRuntime(result, moduleId.current);
65
+ if (isMounted.current) {
66
+ setClassMap(injected);
67
+ }
68
+ } else if (isMounted.current) {
69
+ setClassMap(result);
70
+ }
71
+ }
72
+
73
+ return () => {
74
+ isMounted.current = false;
75
+ if (moduleId.current) {
76
+ styleInjector.removeModule(moduleId.current);
77
+ }
78
+ };
79
+ }, deps);
80
+
81
+ return classMap;
82
+ }
83
+
84
+ export function createSmartComponent<P extends Record<string, any>>(
85
+ Component: React.ComponentType<P>,
86
+ baseStyles?: (chain: any) => any
87
+ ): React.FC<P & { className?: string }> {
88
+ const SmartComponent: React.FC<P & { className?: string }> = (props) => {
89
+ const styles = useSmartStyles((chain) => {
90
+ let instance = chain();
91
+
92
+ if (baseStyles) {
93
+ instance = baseStyles(instance);
94
+ }
95
+
96
+ if (props.className) {
97
+ instance = instance.className(props.className);
98
+ }
99
+
100
+ return instance.$el();
101
+ }, [props.className]);
102
+
103
+ return React.createElement(Component, {
104
+ ...props,
105
+ className: styles.root || props.className
106
+ });
107
+ };
108
+
109
+ SmartComponent.displayName = `SmartComponent(${Component.displayName || Component.name || 'Component'})`;
110
+
111
+ return SmartComponent;
112
+ }
113
+
114
+ // HOC for wrapping components with smart styles
115
+ export function withSmartStyles<P extends Record<string, any>>(
116
+ WrappedComponent: React.ComponentType<P>,
117
+ styles: (chain: any) => any
118
+ ): React.FC<P> {
119
+ const WithSmartStylesComponent: React.FC<P> = (props) => {
120
+ const classMap = useSmartStyles(styles, []);
121
+ return React.createElement(WrappedComponent, { ...props, ...classMap });
122
+ };
123
+
124
+ WithSmartStylesComponent.displayName = `WithSmartStyles(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`;
125
+
126
+ return WithSmartStylesComponent;
127
+ }
@@ -0,0 +1,72 @@
1
+ // src/runtime/auto-vue.ts
2
+
3
+ import { ref, watch, onUnmounted, type Ref } from 'vue';
4
+ import { smartChain } from '../core/smart-chain.js';
5
+ import { styleInjector, compileRuntime } from './injector.js';
6
+
7
+ export interface UseSmartStylesOptions {
8
+ debug?: boolean;
9
+ ssr?: boolean;
10
+ }
11
+
12
+ export function useSmartStyles<T extends Record<string, any>>(
13
+ styleBuilder: (chain: any) => any,
14
+ deps?: Ref<any>[],
15
+ options: UseSmartStylesOptions = {}
16
+ ): Ref<Record<string, string>> {
17
+ const moduleId = `smart-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
18
+ const classMap = ref<Record<string, string>>({});
19
+
20
+ const updateStyles = () => {
21
+ // Clean up previous styles
22
+ styleInjector.removeModule(moduleId);
23
+
24
+ // Build styles with auto-detection
25
+ const chainInstance = smartChain();
26
+ const result = styleBuilder(chainInstance);
27
+
28
+ // Handle hybrid result
29
+ if (result && result.__isHybrid) {
30
+ const hybrid = result as any;
31
+
32
+ if (hybrid.__runtimeClasses && typeof hybrid.__runtimeClasses === 'object') {
33
+ const dynamicMap = compileRuntime(hybrid.__runtimeClasses, moduleId);
34
+ classMap.value = {
35
+ ...(typeof hybrid.__buildClasses === 'object' ? hybrid.__buildClasses : {}),
36
+ ...dynamicMap
37
+ };
38
+ } else {
39
+ classMap.value = typeof hybrid === 'object' ? hybrid : {};
40
+ }
41
+ }
42
+ // Pure result
43
+ else if (result && typeof result === 'object') {
44
+ const needsInjection = Object.values(result).some(v =>
45
+ typeof v === 'object' && v !== null && !String(v).startsWith('c-')
46
+ );
47
+
48
+ if (needsInjection && !options.ssr) {
49
+ classMap.value = compileRuntime(result, moduleId);
50
+ } else {
51
+ classMap.value = result;
52
+ }
53
+ }
54
+
55
+ if (options.debug) {
56
+ console.log('[ChainCSS Vue Smart] Updated styles:', classMap.value);
57
+ }
58
+ };
59
+
60
+ updateStyles();
61
+
62
+ // Watch dependencies if provided
63
+ if (deps && deps.length > 0) {
64
+ watch(deps, updateStyles, { deep: true });
65
+ }
66
+
67
+ onUnmounted(() => {
68
+ styleInjector.removeModule(moduleId);
69
+ });
70
+
71
+ return classMap;
72
+ }
@@ -0,0 +1,212 @@
1
+ // src/runtime/hmr.ts (fixed version)
2
+
3
+ import { styleInjector, compileRuntime } from './injector.js';
4
+
5
+ interface HMRPayload {
6
+ file: string;
7
+ css?: string;
8
+ map?: Record<string, string>;
9
+ styles?: Record<string, any>;
10
+ timestamp?: number;
11
+ }
12
+
13
+ // Type detection for different bundlers
14
+ function getHMREnvironment(): 'vite' | 'webpack' | 'none' {
15
+ if (typeof window === 'undefined') return 'none';
16
+
17
+ // Check for Vite HMR
18
+ if (typeof import.meta !== 'undefined' && (import.meta as any).hot) {
19
+ return 'vite';
20
+ }
21
+
22
+ // Check for Webpack HMR
23
+ if ((module as any).hot) {
24
+ return 'webpack';
25
+ }
26
+
27
+ return 'none';
28
+ }
29
+
30
+ export function setupHMR(): void {
31
+ const env = getHMREnvironment();
32
+
33
+ if (env === 'vite') {
34
+ setupViteHMR();
35
+ } else if (env === 'webpack') {
36
+ setupWebpackHMR();
37
+ }
38
+ }
39
+
40
+ function setupViteHMR(): void {
41
+ if (typeof window === 'undefined') return;
42
+
43
+ const hot = (import.meta as any).hot;
44
+ if (!hot) return;
45
+
46
+ // Listen for ChainCSS update events
47
+ hot.on('chaincss:update', (payload: HMRPayload) => {
48
+ console.log(`[ChainCSS HMR] ๐Ÿ”„ Updating styles for ${payload.file}`);
49
+
50
+ // If new CSS is provided, inject it
51
+ if (payload.css) {
52
+ const styleId = 'chaincss-hmr-styles';
53
+ let styleElement = document.getElementById(styleId) as HTMLStyleElement;
54
+
55
+ if (!styleElement) {
56
+ styleElement = document.createElement('style');
57
+ styleElement.id = styleId;
58
+ styleElement.setAttribute('data-chaincss', 'hmr');
59
+ document.head.appendChild(styleElement);
60
+ }
61
+
62
+ styleElement.textContent = payload.css;
63
+ console.log(`[ChainCSS HMR] โœ… Injected ${payload.css.length} bytes of CSS`);
64
+ }
65
+
66
+ // If new manifest is provided, update atomic mapping
67
+ if (payload.map) {
68
+ // Update manifest (would be handled by manifest system)
69
+ if (typeof window !== 'undefined') {
70
+ (window as any).__CHAINCSS_MANIFEST__ = payload.map;
71
+ }
72
+ console.log(`[ChainCSS HMR] โœ… Updated manifest with ${Object.keys(payload.map).length} entries`);
73
+ }
74
+
75
+ // If full styles are provided, recompile and inject
76
+ if (payload.styles) {
77
+ const moduleId = `hmr-${payload.file}-${payload.timestamp || Date.now()}`;
78
+ const result = compileRuntime(payload.styles, moduleId);
79
+ console.log(`[ChainCSS HMR] โœ… Recompiled ${Object.keys(result).length} styles`);
80
+ }
81
+ });
82
+
83
+ // Listen for before update to clean up
84
+ hot.on('vite:beforeUpdate', () => {
85
+ console.log('[ChainCSS HMR] ๐Ÿงน Clearing runtime styles before update');
86
+ styleInjector.removeAll();
87
+ });
88
+
89
+ console.log('[ChainCSS HMR] โœ… Vite HMR setup complete');
90
+ }
91
+
92
+ function setupWebpackHMR(): void {
93
+ if (typeof window === 'undefined') return;
94
+
95
+ const hot = (module as any).hot;
96
+ if (!hot) return;
97
+
98
+ // Webpack HMR uses accept() pattern
99
+ hot.accept((err: Error | null) => {
100
+ if (err) {
101
+ console.error('[ChainCSS HMR] โŒ Update failed:', err);
102
+ return;
103
+ }
104
+
105
+ console.log('[ChainCSS HMR] ๐Ÿ”„ Webpack HMR update');
106
+ styleInjector.removeAll();
107
+ });
108
+
109
+ hot.dispose(() => {
110
+ console.log('[ChainCSS HMR] ๐Ÿงน Cleaning up styles');
111
+ styleInjector.removeAll();
112
+ });
113
+
114
+ console.log('[ChainCSS HMR] โœ… Webpack HMR setup complete');
115
+ }
116
+
117
+ /**
118
+ * Register a module for HMR updates
119
+ * @param moduleId - Unique identifier for the module
120
+ * @param styles - Current styles object (optional)
121
+ * @param callback - Callback when module updates (optional)
122
+ */
123
+ export function registerForHMR(
124
+ moduleId: string,
125
+ styles?: Record<string, any>,
126
+ callback?: (newStyles: Record<string, any>) => void
127
+ ): void {
128
+ const env = getHMREnvironment();
129
+
130
+ if (env === 'vite') {
131
+ registerViteHMR(moduleId, styles, callback);
132
+ } else if (env === 'webpack') {
133
+ registerWebpackHMR(moduleId, styles, callback);
134
+ }
135
+ }
136
+
137
+ function registerViteHMR(
138
+ moduleId: string,
139
+ styles?: Record<string, any>,
140
+ callback?: (newStyles: Record<string, any>) => void
141
+ ): void {
142
+ const hot = (import.meta as any).hot;
143
+ if (!hot) return;
144
+
145
+ // Accept updates for this module
146
+ hot.accept(() => {
147
+ console.log(`[ChainCSS HMR] ๐Ÿ”„ Accepting update for ${moduleId}`);
148
+
149
+ // Clean up old styles
150
+ styleInjector.removeModule(moduleId);
151
+
152
+ // If callback provided, call it with new styles
153
+ if (callback && styles) {
154
+ callback(styles);
155
+ }
156
+ });
157
+
158
+ // Handle disposal
159
+ hot.dispose(() => {
160
+ console.log(`[ChainCSS HMR] ๐Ÿงน Disposing module: ${moduleId}`);
161
+ styleInjector.removeModule(moduleId);
162
+ });
163
+ }
164
+
165
+ function registerWebpackHMR(
166
+ moduleId: string,
167
+ styles?: Record<string, any>,
168
+ callback?: (newStyles: Record<string, any>) => void
169
+ ): void {
170
+ const hot = (module as any).hot;
171
+ if (!hot) return;
172
+
173
+ hot.accept(() => {
174
+ console.log(`[ChainCSS HMR] ๐Ÿ”„ Webpack HMR accept for ${moduleId}`);
175
+
176
+ if (callback && styles) {
177
+ callback(styles);
178
+ }
179
+ });
180
+
181
+ hot.dispose(() => {
182
+ console.log(`[ChainCSS HMR] ๐Ÿงน Webpack HMR dispose for ${moduleId}`);
183
+ styleInjector.removeModule(moduleId);
184
+ });
185
+ }
186
+
187
+ /**
188
+ * Get HMR status
189
+ */
190
+ export function isHMRSupported(): boolean {
191
+ return getHMREnvironment() !== 'none';
192
+ }
193
+
194
+ /**
195
+ * Get current HMR environment
196
+ */
197
+ export function getHMRType(): string {
198
+ return getHMREnvironment();
199
+ }
200
+
201
+ // Auto-setup in browser
202
+ if (typeof window !== 'undefined') {
203
+ setupHMR();
204
+ }
205
+
206
+ // Export utilities
207
+ export default {
208
+ setupHMR,
209
+ registerForHMR,
210
+ isHMRSupported,
211
+ getHMRType
212
+ };
@@ -0,0 +1,82 @@
1
+ // chaincss/src/runtime/index.ts
2
+
3
+ /**
4
+ * ChainCSS Runtime Module
5
+ *
6
+ * WARNING: Importing from this module adds ~3.2KB to your bundle.
7
+ * For production, use build-time compilation with chaincss/plugin/vite instead.
8
+ */
9
+
10
+ // Core runtime
11
+ export { compileRuntime as compile, runRuntime as run, styleInjector } from './injector.js';
12
+ export { $, $t, chain, setManifest } from './Chain.js';
13
+
14
+ // React hooks
15
+ export {
16
+ useChainStyles,
17
+ useDynamicChainStyles,
18
+ useThemeChainStyles,
19
+ ChainCSSGlobal,
20
+ cx,
21
+ withChainStyles,
22
+ enableChainCSSDebug,
23
+ disableChainCSSDebug,
24
+ isDebugEnabled,
25
+ createStyledComponent,
26
+ useComputedStyles
27
+ } from './react.js';
28
+
29
+ // Vue composables
30
+ export {
31
+ useAtomicClasses,
32
+ ChainCSSGlobal as ChainCSSGlobalVue,
33
+ createStyledComponent as createStyledVueComponent, // This is fine - it renames
34
+ createStyledComponents as createStyledVueComponents,
35
+ useComputedStyles as useComputedStylesVue, // This renames useComputedStyles
36
+ provideStyleContext,
37
+ injectStyleContext
38
+ } from './vue.js';
39
+
40
+ // Svelte
41
+ export {
42
+ useAtomicClasses as useAtomicClassesSvelte,
43
+ cx as cxSvelte,
44
+ ChainCSSGlobal as ChainCSSGlobalSvelte,
45
+ createStyledComponent as createStyledSvelteComponent,
46
+ createStyledComponents as createStyledSvelteComponents,
47
+ useComputedStyles as useComputedStylesSvelte,
48
+ provideStyleContext as provideStyleContextSvelte,
49
+ injectStyleContext as injectStyleContextSvelte,
50
+ chainStyles
51
+ } from './svelte.js';
52
+
53
+ // HMR
54
+ export { setupHMR, registerForHMR } from './hmr.js';
55
+
56
+ // Utilities
57
+ export {
58
+ generateStyleId,
59
+ hashString,
60
+ kebabCase,
61
+ isBrowser,
62
+ isDevelopment,
63
+ isProduction,
64
+ debounce,
65
+ memoize,
66
+ cn as cnUtils,
67
+ devWarn,
68
+ devLog,
69
+ logError,
70
+ createDebugger
71
+ } from './utils.js';
72
+
73
+ // Types
74
+ export type {
75
+ RuntimeStyleDefinition,
76
+ UseChainStylesOptions,
77
+ RuntimeCompiledResult,
78
+ StyleInjector,
79
+ UseAtomicClassesReturn,
80
+ HMRPayload,
81
+ ChainCSSDebugger
82
+ } from './types.js';