@csszyx/types 0.6.2 → 0.8.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/README.md +2 -0
- package/dist/compiler.cjs +2 -0
- package/dist/{compiler.d.ts → compiler.d.cts} +1 -1
- package/dist/compiler.d.mts +431 -0
- package/dist/compiler.mjs +1 -0
- package/dist/config.cjs +55 -0
- package/dist/{config.d.ts → config.d.cts} +34 -1
- package/dist/config.d.mts +261 -0
- package/dist/{chunk-IFAXISDF.js → config.mjs} +9 -17
- package/dist/index.cjs +16 -0
- package/dist/{index.d.ts → index.d.cts} +48 -41
- package/dist/index.d.mts +133 -0
- package/dist/index.mjs +6 -0
- package/dist/jsx.d.ts +43 -37
- package/dist/runtime.cjs +7 -0
- package/dist/{runtime.d.ts → runtime.d.cts} +6 -1
- package/dist/runtime.d.mts +262 -0
- package/dist/{chunk-QAJB64L5.js → runtime.mjs} +1 -4
- package/package.json +21 -17
- package/dist/compiler.js +0 -0
- package/dist/config.js +0 -18
- package/dist/index.js +0 -26
- package/dist/runtime.js +0 -6
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for csszyx.
|
|
3
|
+
*
|
|
4
|
+
* This module defines all configuration interfaces and types used
|
|
5
|
+
* throughout the csszyx framework.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Development mode configuration options.
|
|
9
|
+
*/
|
|
10
|
+
interface DevelopmentConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Enable strict mode - fail build on warnings.
|
|
13
|
+
* When enabled, warnings are treated as errors.
|
|
14
|
+
*
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
strictMode: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Enable debug logging during build.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
debug: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Production mode configuration options.
|
|
27
|
+
*/
|
|
28
|
+
interface ProductionConfig {
|
|
29
|
+
/**
|
|
30
|
+
* Enable global class name mangling.
|
|
31
|
+
* Minifies class names to single characters (a, b, c, etc.).
|
|
32
|
+
*
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
mangle: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Enable content hashing for immutable caching.
|
|
38
|
+
*
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
contentHashing: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Inject checksum for SSR hydration validation.
|
|
44
|
+
*
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
injectChecksum: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Enable incremental build caching.
|
|
50
|
+
*
|
|
51
|
+
* @default true
|
|
52
|
+
*/
|
|
53
|
+
incrementalBuild: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Minify output (class names and attributes).
|
|
56
|
+
*
|
|
57
|
+
* @default true in production
|
|
58
|
+
*/
|
|
59
|
+
minify: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Build pipeline configuration.
|
|
63
|
+
*/
|
|
64
|
+
interface BuildConfig {
|
|
65
|
+
/**
|
|
66
|
+
* Build ID (git hash or timestamp).
|
|
67
|
+
* Auto-generated if not provided.
|
|
68
|
+
*/
|
|
69
|
+
buildId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Path to Tailwind config file.
|
|
72
|
+
*
|
|
73
|
+
* @default "tailwind.config.js"
|
|
74
|
+
*/
|
|
75
|
+
tailwindConfig?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Output directory for generated files.
|
|
78
|
+
*
|
|
79
|
+
* @default ".csszyx"
|
|
80
|
+
*/
|
|
81
|
+
outputDir?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Cache directory for incremental builds.
|
|
84
|
+
*
|
|
85
|
+
* @default ".csszyx/cache"
|
|
86
|
+
*/
|
|
87
|
+
cacheDir?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Maximum AST nodes per file before warning.
|
|
90
|
+
*
|
|
91
|
+
* @default 50000
|
|
92
|
+
*/
|
|
93
|
+
astBudgetLimit?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Source parser used for JSX/TSX sz transforms.
|
|
96
|
+
*
|
|
97
|
+
* `oxc` is the default parser. `babel` remains available as a compatibility
|
|
98
|
+
* fallback while the migration keeps Babel dependencies installed.
|
|
99
|
+
*
|
|
100
|
+
* @default "oxc"
|
|
101
|
+
*/
|
|
102
|
+
parser?: 'babel' | 'oxc';
|
|
103
|
+
/**
|
|
104
|
+
* CSS file(s) to scan for Tailwind v4 @theme blocks.
|
|
105
|
+
* When set, the plugin generates .csszyx/theme.d.ts with TypeScript augmentation
|
|
106
|
+
* for custom design tokens, enabling IntelliSense for user-defined colors, spacings, etc.
|
|
107
|
+
*
|
|
108
|
+
* Accepts a single glob/path or an array of globs/paths.
|
|
109
|
+
*
|
|
110
|
+
* @example ['src/styles/theme.css', 'src/styles/tokens.css']
|
|
111
|
+
*/
|
|
112
|
+
scanCss?: string | string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* File patterns accepted by csszyx plugin filters.
|
|
116
|
+
*
|
|
117
|
+
* String patterns may be literal paths (`src/generated/icon-dump.tsx`) or
|
|
118
|
+
* simple globs such as `src/generated/**` or any TSX file. RegExp patterns are matched
|
|
119
|
+
* against both absolute paths and paths relative to the project root.
|
|
120
|
+
*/
|
|
121
|
+
type FilePattern = string | RegExp;
|
|
122
|
+
/**
|
|
123
|
+
* Hydration safety configuration.
|
|
124
|
+
*/
|
|
125
|
+
interface HydrationConfig {
|
|
126
|
+
/**
|
|
127
|
+
* Enable strict hydration checks.
|
|
128
|
+
* When enabled, hydration mismatches trigger abort protocol.
|
|
129
|
+
*
|
|
130
|
+
* @default true
|
|
131
|
+
*/
|
|
132
|
+
strict: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Default recovery mode for components without explicit szRecover.
|
|
135
|
+
*
|
|
136
|
+
* @default null (no recovery)
|
|
137
|
+
*/
|
|
138
|
+
defaultRecoveryMode?: 'csr' | 'dev-only' | null;
|
|
139
|
+
/**
|
|
140
|
+
* Enable hydration audit logging.
|
|
141
|
+
*
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
auditLog: boolean;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Performance optimization configuration.
|
|
148
|
+
*/
|
|
149
|
+
interface PerformanceConfig {
|
|
150
|
+
/**
|
|
151
|
+
* Enable parallel processing during build.
|
|
152
|
+
*
|
|
153
|
+
* @default true
|
|
154
|
+
*/
|
|
155
|
+
parallel: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Number of worker threads for parallel processing.
|
|
158
|
+
* Auto-detected if not provided.
|
|
159
|
+
*/
|
|
160
|
+
workers?: number;
|
|
161
|
+
/**
|
|
162
|
+
* Enable CSS variable optimization.
|
|
163
|
+
*
|
|
164
|
+
* @default true
|
|
165
|
+
*/
|
|
166
|
+
optimizeVariables: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Enable zero-runtime optimization for static cases.
|
|
169
|
+
*
|
|
170
|
+
* @default true
|
|
171
|
+
*/
|
|
172
|
+
zeroRuntime: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Main csszyx configuration.
|
|
176
|
+
*/
|
|
177
|
+
interface CsszyxConfig {
|
|
178
|
+
/**
|
|
179
|
+
* Development mode configuration.
|
|
180
|
+
*/
|
|
181
|
+
development: DevelopmentConfig;
|
|
182
|
+
/**
|
|
183
|
+
* Production mode configuration.
|
|
184
|
+
*/
|
|
185
|
+
production: ProductionConfig;
|
|
186
|
+
/**
|
|
187
|
+
* Build pipeline configuration.
|
|
188
|
+
*/
|
|
189
|
+
build: BuildConfig;
|
|
190
|
+
/**
|
|
191
|
+
* Hydration safety configuration.
|
|
192
|
+
*/
|
|
193
|
+
hydration: HydrationConfig;
|
|
194
|
+
/**
|
|
195
|
+
* Performance optimization configuration.
|
|
196
|
+
*/
|
|
197
|
+
performance: PerformanceConfig;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Partial configuration for user-provided config.
|
|
201
|
+
* All fields are optional and will be merged with defaults.
|
|
202
|
+
*/
|
|
203
|
+
type PartialCsszyxConfig = {
|
|
204
|
+
/**
|
|
205
|
+
* Restrict source files that csszyx transforms.
|
|
206
|
+
*
|
|
207
|
+
* CSS files used for Tailwind class discovery are still processed unless
|
|
208
|
+
* excluded explicitly, so narrow source includes do not accidentally disable
|
|
209
|
+
* CSS safelist injection.
|
|
210
|
+
*/
|
|
211
|
+
include?: FilePattern | FilePattern[];
|
|
212
|
+
/**
|
|
213
|
+
* Exclude files from csszyx processing before parsing.
|
|
214
|
+
*
|
|
215
|
+
* Use this for large generated source files that happen to contain an `sz`
|
|
216
|
+
* marker and would otherwise hit the AST budget guard.
|
|
217
|
+
*/
|
|
218
|
+
exclude?: FilePattern | FilePattern[];
|
|
219
|
+
development?: Partial<DevelopmentConfig>;
|
|
220
|
+
production?: Partial<ProductionConfig>;
|
|
221
|
+
build?: Partial<BuildConfig>;
|
|
222
|
+
hydration?: Partial<HydrationConfig>;
|
|
223
|
+
performance?: Partial<PerformanceConfig>;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Default development configuration.
|
|
227
|
+
*/
|
|
228
|
+
declare const DEFAULT_DEVELOPMENT_CONFIG: DevelopmentConfig;
|
|
229
|
+
/**
|
|
230
|
+
* Default production configuration.
|
|
231
|
+
*/
|
|
232
|
+
declare const DEFAULT_PRODUCTION_CONFIG: ProductionConfig;
|
|
233
|
+
/**
|
|
234
|
+
* Default build configuration.
|
|
235
|
+
*/
|
|
236
|
+
declare const DEFAULT_BUILD_CONFIG: BuildConfig;
|
|
237
|
+
/**
|
|
238
|
+
* Default hydration configuration.
|
|
239
|
+
*/
|
|
240
|
+
declare const DEFAULT_HYDRATION_CONFIG: HydrationConfig;
|
|
241
|
+
/**
|
|
242
|
+
* Default performance configuration.
|
|
243
|
+
*/
|
|
244
|
+
declare const DEFAULT_PERFORMANCE_CONFIG: PerformanceConfig;
|
|
245
|
+
/**
|
|
246
|
+
* Default csszyx configuration.
|
|
247
|
+
*/
|
|
248
|
+
declare const DEFAULT_CSSZYX_CONFIG: CsszyxConfig;
|
|
249
|
+
/**
|
|
250
|
+
* Environment type.
|
|
251
|
+
*/
|
|
252
|
+
type Environment = 'development' | 'production' | 'test';
|
|
253
|
+
/**
|
|
254
|
+
* Gets the current environment.
|
|
255
|
+
*
|
|
256
|
+
* @returns {Environment} Current environment
|
|
257
|
+
*/
|
|
258
|
+
declare function getCurrentEnvironment(): Environment;
|
|
259
|
+
|
|
260
|
+
export { DEFAULT_BUILD_CONFIG, DEFAULT_CSSZYX_CONFIG, DEFAULT_DEVELOPMENT_CONFIG, DEFAULT_HYDRATION_CONFIG, DEFAULT_PERFORMANCE_CONFIG, DEFAULT_PRODUCTION_CONFIG, getCurrentEnvironment };
|
|
261
|
+
export type { BuildConfig, CsszyxConfig, DevelopmentConfig, Environment, FilePattern, HydrationConfig, PartialCsszyxConfig, PerformanceConfig, ProductionConfig };
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
var DEFAULT_DEVELOPMENT_CONFIG = {
|
|
1
|
+
const DEFAULT_DEVELOPMENT_CONFIG = {
|
|
3
2
|
strictMode: false,
|
|
4
3
|
debug: false
|
|
5
4
|
};
|
|
6
|
-
|
|
5
|
+
const DEFAULT_PRODUCTION_CONFIG = {
|
|
7
6
|
mangle: true,
|
|
8
7
|
contentHashing: true,
|
|
9
8
|
injectChecksum: true,
|
|
10
9
|
incrementalBuild: true,
|
|
11
10
|
minify: true
|
|
12
11
|
};
|
|
13
|
-
|
|
12
|
+
const DEFAULT_BUILD_CONFIG = {
|
|
14
13
|
tailwindConfig: "tailwind.config.js",
|
|
15
14
|
outputDir: ".csszyx",
|
|
16
15
|
cacheDir: ".csszyx/cache",
|
|
17
|
-
astBudgetLimit: 5e4
|
|
16
|
+
astBudgetLimit: 5e4,
|
|
17
|
+
parser: "oxc"
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
const DEFAULT_HYDRATION_CONFIG = {
|
|
20
20
|
strict: true,
|
|
21
21
|
defaultRecoveryMode: null,
|
|
22
22
|
auditLog: true
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
const DEFAULT_PERFORMANCE_CONFIG = {
|
|
25
25
|
parallel: true,
|
|
26
26
|
optimizeVariables: true,
|
|
27
27
|
zeroRuntime: true
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
const DEFAULT_CSSZYX_CONFIG = {
|
|
30
30
|
development: DEFAULT_DEVELOPMENT_CONFIG,
|
|
31
31
|
production: DEFAULT_PRODUCTION_CONFIG,
|
|
32
32
|
build: DEFAULT_BUILD_CONFIG,
|
|
@@ -44,12 +44,4 @@ function getCurrentEnvironment() {
|
|
|
44
44
|
return "development";
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export {
|
|
48
|
-
DEFAULT_DEVELOPMENT_CONFIG,
|
|
49
|
-
DEFAULT_PRODUCTION_CONFIG,
|
|
50
|
-
DEFAULT_BUILD_CONFIG,
|
|
51
|
-
DEFAULT_HYDRATION_CONFIG,
|
|
52
|
-
DEFAULT_PERFORMANCE_CONFIG,
|
|
53
|
-
DEFAULT_CSSZYX_CONFIG,
|
|
54
|
-
getCurrentEnvironment
|
|
55
|
-
};
|
|
47
|
+
export { DEFAULT_BUILD_CONFIG, DEFAULT_CSSZYX_CONFIG, DEFAULT_DEVELOPMENT_CONFIG, DEFAULT_HYDRATION_CONFIG, DEFAULT_PERFORMANCE_CONFIG, DEFAULT_PRODUCTION_CONFIG, getCurrentEnvironment };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const config = require('./config.cjs');
|
|
4
|
+
const runtime = require('./runtime.cjs');
|
|
5
|
+
|
|
6
|
+
const VERSION = "0.0.0";
|
|
7
|
+
|
|
8
|
+
exports.DEFAULT_BUILD_CONFIG = config.DEFAULT_BUILD_CONFIG;
|
|
9
|
+
exports.DEFAULT_CSSZYX_CONFIG = config.DEFAULT_CSSZYX_CONFIG;
|
|
10
|
+
exports.DEFAULT_DEVELOPMENT_CONFIG = config.DEFAULT_DEVELOPMENT_CONFIG;
|
|
11
|
+
exports.DEFAULT_HYDRATION_CONFIG = config.DEFAULT_HYDRATION_CONFIG;
|
|
12
|
+
exports.DEFAULT_PERFORMANCE_CONFIG = config.DEFAULT_PERFORMANCE_CONFIG;
|
|
13
|
+
exports.DEFAULT_PRODUCTION_CONFIG = config.DEFAULT_PRODUCTION_CONFIG;
|
|
14
|
+
exports.getCurrentEnvironment = config.getCurrentEnvironment;
|
|
15
|
+
exports.isCsszyxWindow = runtime.isCsszyxWindow;
|
|
16
|
+
exports.VERSION = VERSION;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { BuildPhase, BuildPhaseResult, BuildPhaseStatus, BuildResult, BuildStatistics, CacheEntry, CacheManager, CollisionResult, CompilerContext, CompilerOptions, CompilerPlugin, FileCompilationResult, GeneratedToken, MangleMapEntry, NodeLocation, TokenMetadata, TransformOptions, ValidationError, ValidationResult } from './compiler.js';
|
|
1
|
+
export { BuildPhase, BuildPhaseResult, BuildPhaseStatus, BuildResult, BuildStatistics, CacheEntry, CacheManager, CollisionResult, CompilerContext, CompilerOptions, CompilerPlugin, FileCompilationResult, GeneratedToken, MangleMapEntry, NodeLocation, TokenMetadata, TransformOptions, ValidationError, ValidationResult } from './compiler.cjs';
|
|
2
|
+
export { BuildConfig, CsszyxConfig, DEFAULT_BUILD_CONFIG, DEFAULT_CSSZYX_CONFIG, DEFAULT_DEVELOPMENT_CONFIG, DEFAULT_HYDRATION_CONFIG, DEFAULT_PERFORMANCE_CONFIG, DEFAULT_PRODUCTION_CONFIG, DevelopmentConfig, Environment, HydrationConfig, PartialCsszyxConfig, PerformanceConfig, ProductionConfig, getCurrentEnvironment } from './config.cjs';
|
|
4
3
|
import { SzPropValue, RecoveryMode } from '@csszyx/compiler';
|
|
5
4
|
export { SzPropValue, SzProps } from '@csszyx/compiler';
|
|
5
|
+
export { AuditLogEntry, ComponentPropsWithSz, CsszyxWindow, HydrationError, HydrationErrorType, MangleMap, MangleMapMetadata, PerformanceMetrics, RecoveryManifest, RecoveryMode, RuntimeState, SzProp, TokenData, VerificationResult, isCsszyxWindow } from './runtime.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @csszyx/types - Core WASM Contract
|
|
@@ -60,54 +60,60 @@ interface CsszyxCorePkg {
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
declare module 'react' {
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
|
-
interface HTMLAttributes<T> {
|
|
68
63
|
/**
|
|
69
|
-
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
70
64
|
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```tsx
|
|
73
|
-
* <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
|
|
74
|
-
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
75
|
-
* ```
|
|
76
65
|
*/
|
|
77
|
-
|
|
66
|
+
|
|
78
67
|
/**
|
|
79
|
-
* Hydration recovery mode for the element. The csszyx unplugin
|
|
80
|
-
* compiles this attribute into a `data-sz-recovery-token` and
|
|
81
|
-
* registers the element in the SSR recovery manifest read by
|
|
82
|
-
* `@csszyx/runtime/verify` at hydration time.
|
|
83
68
|
*
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
*/
|
|
70
|
+
interface HTMLAttributes<T> {
|
|
71
|
+
/**
|
|
72
|
+
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
|
|
77
|
+
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
sz?: SzPropValue;
|
|
81
|
+
/**
|
|
82
|
+
* Hydration recovery mode for the element. The csszyx unplugin
|
|
83
|
+
* compiles this attribute into a `data-sz-recovery-token` and
|
|
84
|
+
* registers the element in the SSR recovery manifest read by
|
|
85
|
+
* `@csszyx/runtime/verify` at hydration time.
|
|
86
|
+
*
|
|
87
|
+
* - `'csr'` — recovery permitted in both dev and production
|
|
88
|
+
* - `'dev-only'` — recovery permitted in development only;
|
|
89
|
+
* stripped from the production manifest at build time.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <section szRecover="csr">…</section>
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
szRecover?: RecoveryMode;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
87
100
|
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```tsx
|
|
90
|
-
* <section szRecover="csr">…</section>
|
|
91
|
-
* ```
|
|
92
101
|
*/
|
|
93
|
-
szRecover?: RecoveryMode;
|
|
94
|
-
}
|
|
95
102
|
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
*/
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
|
-
interface SVGAttributes<T> {
|
|
101
103
|
/**
|
|
102
|
-
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
103
104
|
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```tsx
|
|
106
|
-
* <svg sz={{ fill: 'red-500', stroke: 'current' }} />
|
|
107
|
-
* ```
|
|
108
105
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
interface SVGAttributes<T> {
|
|
107
|
+
/**
|
|
108
|
+
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <svg sz={{ fill: 'red-500', stroke: 'current' }} />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
sz?: SzPropValue;
|
|
116
|
+
}
|
|
111
117
|
}
|
|
112
118
|
|
|
113
119
|
/**
|
|
@@ -123,4 +129,5 @@ declare module 'react' {
|
|
|
123
129
|
*/
|
|
124
130
|
declare const VERSION = "0.0.0";
|
|
125
131
|
|
|
126
|
-
export {
|
|
132
|
+
export { VERSION };
|
|
133
|
+
export type { CsszyxCorePkg, CsszyxCoreWasm };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export { BuildPhase, BuildPhaseResult, BuildPhaseStatus, BuildResult, BuildStatistics, CacheEntry, CacheManager, CollisionResult, CompilerContext, CompilerOptions, CompilerPlugin, FileCompilationResult, GeneratedToken, MangleMapEntry, NodeLocation, TokenMetadata, TransformOptions, ValidationError, ValidationResult } from './compiler.mjs';
|
|
2
|
+
export { BuildConfig, CsszyxConfig, DEFAULT_BUILD_CONFIG, DEFAULT_CSSZYX_CONFIG, DEFAULT_DEVELOPMENT_CONFIG, DEFAULT_HYDRATION_CONFIG, DEFAULT_PERFORMANCE_CONFIG, DEFAULT_PRODUCTION_CONFIG, DevelopmentConfig, Environment, HydrationConfig, PartialCsszyxConfig, PerformanceConfig, ProductionConfig, getCurrentEnvironment } from './config.mjs';
|
|
3
|
+
import { SzPropValue, RecoveryMode } from '@csszyx/compiler';
|
|
4
|
+
export { SzPropValue, SzProps } from '@csszyx/compiler';
|
|
5
|
+
export { AuditLogEntry, ComponentPropsWithSz, CsszyxWindow, HydrationError, HydrationErrorType, MangleMap, MangleMapMetadata, PerformanceMetrics, RecoveryManifest, RecoveryMode, RuntimeState, SzProp, TokenData, VerificationResult, isCsszyxWindow } from './runtime.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @csszyx/types - Core WASM Contract
|
|
9
|
+
*
|
|
10
|
+
* This file defines the strict interface between the Rust/WASM core
|
|
11
|
+
* and the TypeScript world. This is the source of truth for "The Forge" workstream.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
interface CsszyxCoreWasm {
|
|
17
|
+
/**
|
|
18
|
+
* Encodes a numeric index into a compact tier-based class name (z, y, x...).
|
|
19
|
+
*/
|
|
20
|
+
encode(index: number): string;
|
|
21
|
+
/**
|
|
22
|
+
* Generates a unique cryptographic recovery token for SSR hydration safety.
|
|
23
|
+
*/
|
|
24
|
+
generate_token(componentName: string, filePath: string, line: number, column: number, recoveryMode: 'csr' | 'dev-only', buildId: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Verifies if a recovery token is valid for the given context.
|
|
27
|
+
*/
|
|
28
|
+
verify_token(token: string, componentName: string, filePath: string, line: number, column: number, recoveryMode: 'csr' | 'dev-only', buildId: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Computes a dual-hash for a CSS class name to prevent collisions.
|
|
31
|
+
*/
|
|
32
|
+
compute_dual_hash(className: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the current version of the core engine.
|
|
35
|
+
*/
|
|
36
|
+
version(): string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The expected structure of the WASM initialization output.
|
|
40
|
+
*/
|
|
41
|
+
interface CsszyxCorePkg {
|
|
42
|
+
default: () => Promise<void>;
|
|
43
|
+
encode: (index: number) => string;
|
|
44
|
+
generate_token: (componentName: string, filePath: string, line: number, column: number, recoveryMode: string, buildId: string) => string;
|
|
45
|
+
verify_token: (token: string, componentName: string, filePath: string, line: number, column: number, recoveryMode: string, buildId: string) => boolean;
|
|
46
|
+
compute_dual_hash: (className: string) => string;
|
|
47
|
+
version: () => string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* JSX type augmentation for csszyx sz prop.
|
|
52
|
+
*
|
|
53
|
+
* This module extends React's JSX namespace to add the `sz` prop
|
|
54
|
+
* to all HTML elements. Types are re-exported from @csszyx/compiler
|
|
55
|
+
* for IntelliSense and autocompletion.
|
|
56
|
+
*
|
|
57
|
+
* @module @csszyx/types/jsx
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
declare module 'react' {
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
interface HTMLAttributes<T> {
|
|
71
|
+
/**
|
|
72
|
+
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
|
|
77
|
+
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
sz?: SzPropValue;
|
|
81
|
+
/**
|
|
82
|
+
* Hydration recovery mode for the element. The csszyx unplugin
|
|
83
|
+
* compiles this attribute into a `data-sz-recovery-token` and
|
|
84
|
+
* registers the element in the SSR recovery manifest read by
|
|
85
|
+
* `@csszyx/runtime/verify` at hydration time.
|
|
86
|
+
*
|
|
87
|
+
* - `'csr'` — recovery permitted in both dev and production
|
|
88
|
+
* - `'dev-only'` — recovery permitted in development only;
|
|
89
|
+
* stripped from the production manifest at build time.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```tsx
|
|
93
|
+
* <section szRecover="csr">…</section>
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
szRecover?: RecoveryMode;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
*/
|
|
106
|
+
interface SVGAttributes<T> {
|
|
107
|
+
/**
|
|
108
|
+
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <svg sz={{ fill: 'red-500', stroke: 'current' }} />
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
sz?: SzPropValue;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @csszyx/types - Shared TypeScript types for csszyx.
|
|
121
|
+
*
|
|
122
|
+
* This package provides comprehensive type definitions used across
|
|
123
|
+
* the csszyx framework, including configuration, runtime, and compiler types.
|
|
124
|
+
*
|
|
125
|
+
* @module @csszyx/types
|
|
126
|
+
*/
|
|
127
|
+
/**
|
|
128
|
+
* Package version.
|
|
129
|
+
*/
|
|
130
|
+
declare const VERSION = "0.0.0";
|
|
131
|
+
|
|
132
|
+
export { VERSION };
|
|
133
|
+
export type { CsszyxCorePkg, CsszyxCoreWasm };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DEFAULT_BUILD_CONFIG, DEFAULT_CSSZYX_CONFIG, DEFAULT_DEVELOPMENT_CONFIG, DEFAULT_HYDRATION_CONFIG, DEFAULT_PERFORMANCE_CONFIG, DEFAULT_PRODUCTION_CONFIG, getCurrentEnvironment } from './config.mjs';
|
|
2
|
+
export { isCsszyxWindow } from './runtime.mjs';
|
|
3
|
+
|
|
4
|
+
const VERSION = "0.0.0";
|
|
5
|
+
|
|
6
|
+
export { VERSION };
|
package/dist/jsx.d.ts
CHANGED
|
@@ -15,52 +15,58 @@ import type { RecoveryMode, SzProps, SzPropValue } from '@csszyx/compiler';
|
|
|
15
15
|
export type { RecoveryMode, SzProps, SzPropValue };
|
|
16
16
|
|
|
17
17
|
declare module 'react' {
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
interface HTMLAttributes<T> {
|
|
23
18
|
/**
|
|
24
|
-
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
25
19
|
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```tsx
|
|
28
|
-
* <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
|
|
29
|
-
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
30
|
-
* ```
|
|
31
20
|
*/
|
|
32
|
-
|
|
21
|
+
|
|
33
22
|
/**
|
|
34
|
-
* Hydration recovery mode for the element. The csszyx unplugin
|
|
35
|
-
* compiles this attribute into a `data-sz-recovery-token` and
|
|
36
|
-
* registers the element in the SSR recovery manifest read by
|
|
37
|
-
* `@csszyx/runtime/verify` at hydration time.
|
|
38
23
|
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
24
|
+
*/
|
|
25
|
+
interface HTMLAttributes<T> {
|
|
26
|
+
/**
|
|
27
|
+
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <div sz={{ p: 4, bg: 'blue-500', hover: { bg: 'blue-700' } }} />
|
|
32
|
+
* <div sz="p-4 bg-blue-500 hover:bg-blue-700" />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
sz?: SzPropValue;
|
|
36
|
+
/**
|
|
37
|
+
* Hydration recovery mode for the element. The csszyx unplugin
|
|
38
|
+
* compiles this attribute into a `data-sz-recovery-token` and
|
|
39
|
+
* registers the element in the SSR recovery manifest read by
|
|
40
|
+
* `@csszyx/runtime/verify` at hydration time.
|
|
41
|
+
*
|
|
42
|
+
* - `'csr'` — recovery permitted in both dev and production
|
|
43
|
+
* - `'dev-only'` — recovery permitted in development only;
|
|
44
|
+
* stripped from the production manifest at build time.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <section szRecover="csr">…</section>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
szRecover?: RecoveryMode;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
42
55
|
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* <section szRecover="csr">…</section>
|
|
46
|
-
* ```
|
|
47
56
|
*/
|
|
48
|
-
szRecover?: RecoveryMode;
|
|
49
|
-
}
|
|
50
57
|
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
53
|
-
*/
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
55
|
-
interface SVGAttributes<T> {
|
|
56
58
|
/**
|
|
57
|
-
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
58
59
|
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```tsx
|
|
61
|
-
* <svg sz={{ fill: 'red-500', stroke: 'current' }} />
|
|
62
|
-
* ```
|
|
63
60
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
interface SVGAttributes<T> {
|
|
62
|
+
/**
|
|
63
|
+
* csszyx styling prop — Tailwind CSS via object syntax or class string.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```tsx
|
|
67
|
+
* <svg sz={{ fill: 'red-500', stroke: 'current' }} />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
sz?: SzPropValue;
|
|
71
|
+
}
|
|
66
72
|
}
|