@cwcss/crosswind 0.1.4 β†’ 0.1.6

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 (86) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +390 -0
  3. package/dist/build.d.ts +24 -0
  4. package/dist/config.d.ts +5 -0
  5. package/dist/generator.d.ts +31 -0
  6. package/dist/index.d.ts +10 -0
  7. package/dist/index.js +12798 -0
  8. package/dist/parser.d.ts +42 -0
  9. package/dist/plugin.d.ts +22 -0
  10. package/dist/preflight-forms.d.ts +5 -0
  11. package/dist/preflight.d.ts +2 -0
  12. package/dist/rules-advanced.d.ts +27 -0
  13. package/dist/rules-effects.d.ts +25 -0
  14. package/dist/rules-forms.d.ts +7 -0
  15. package/dist/rules-grid.d.ts +13 -0
  16. package/dist/rules-interactivity.d.ts +41 -0
  17. package/dist/rules-layout.d.ts +26 -0
  18. package/dist/rules-transforms.d.ts +33 -0
  19. package/dist/rules-typography.d.ts +41 -0
  20. package/dist/rules.d.ts +39 -0
  21. package/dist/scanner.d.ts +18 -0
  22. package/dist/transformer-compile-class.d.ts +37 -0
  23. package/{src/types.ts β†’ dist/types.d.ts} +17 -86
  24. package/package.json +1 -1
  25. package/PLUGIN.md +0 -235
  26. package/benchmark/framework-comparison.bench.ts +0 -850
  27. package/bin/cli.ts +0 -365
  28. package/bin/crosswind +0 -0
  29. package/bin/headwind +0 -0
  30. package/build.ts +0 -8
  31. package/crosswind.config.ts +0 -9
  32. package/example/comprehensive.html +0 -70
  33. package/example/index.html +0 -21
  34. package/example/output.css +0 -236
  35. package/examples/plugin/README.md +0 -112
  36. package/examples/plugin/build.ts +0 -32
  37. package/examples/plugin/src/index.html +0 -34
  38. package/examples/plugin/src/index.ts +0 -7
  39. package/headwind +0 -2
  40. package/src/build.ts +0 -101
  41. package/src/config.ts +0 -529
  42. package/src/generator.ts +0 -2173
  43. package/src/index.ts +0 -10
  44. package/src/parser.ts +0 -1471
  45. package/src/plugin.ts +0 -118
  46. package/src/preflight-forms.ts +0 -229
  47. package/src/preflight.ts +0 -388
  48. package/src/rules-advanced.ts +0 -477
  49. package/src/rules-effects.ts +0 -457
  50. package/src/rules-forms.ts +0 -103
  51. package/src/rules-grid.ts +0 -241
  52. package/src/rules-interactivity.ts +0 -525
  53. package/src/rules-layout.ts +0 -385
  54. package/src/rules-transforms.ts +0 -412
  55. package/src/rules-typography.ts +0 -486
  56. package/src/rules.ts +0 -805
  57. package/src/scanner.ts +0 -84
  58. package/src/transformer-compile-class.ts +0 -275
  59. package/test/advanced-features.test.ts +0 -911
  60. package/test/arbitrary.test.ts +0 -396
  61. package/test/attributify.test.ts +0 -592
  62. package/test/bracket-syntax.test.ts +0 -1133
  63. package/test/build.test.ts +0 -99
  64. package/test/colors.test.ts +0 -934
  65. package/test/flexbox.test.ts +0 -669
  66. package/test/generator.test.ts +0 -597
  67. package/test/grid.test.ts +0 -584
  68. package/test/layout.test.ts +0 -404
  69. package/test/modifiers.test.ts +0 -417
  70. package/test/parser.test.ts +0 -564
  71. package/test/performance-regression.test.ts +0 -376
  72. package/test/performance.test.ts +0 -568
  73. package/test/plugin.test.ts +0 -160
  74. package/test/scanner.test.ts +0 -94
  75. package/test/sizing.test.ts +0 -481
  76. package/test/spacing.test.ts +0 -394
  77. package/test/transformer-compile-class.test.ts +0 -287
  78. package/test/transforms.test.ts +0 -448
  79. package/test/typography.test.ts +0 -632
  80. package/test/variants-form-states.test.ts +0 -225
  81. package/test/variants-group-peer.test.ts +0 -66
  82. package/test/variants-media.test.ts +0 -213
  83. package/test/variants-positional.test.ts +0 -58
  84. package/test/variants-pseudo-elements.test.ts +0 -47
  85. package/test/variants-state.test.ts +0 -62
  86. package/tsconfig.json +0 -18
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 Open Web Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,390 @@
1
+ <p align="center"><img src=".github/art/cover.jpg" alt="Social Card of this repo"></p>
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![GitHub Actions][github-actions-src]][github-actions-href]
5
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
6
+ <!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
7
+ <!-- [![Codecov][codecov-src]][codecov-href] -->
8
+
9
+ # crosswind
10
+
11
+ A blazingly fast, utility-first CSS framework built with Bun. Crosswind generates only the CSS you need by scanning your files for utility classes, providing Tailwind CSS-compatible utilities with exceptional performance.
12
+
13
+ ## Features
14
+
15
+ - ⚑️**Blazingly Fast**- Built with Bun for exceptional performance (1000+ utilities in <10ms)
16
+ - 🎯**On-Demand Generation**- Only generates CSS for utilities you actually use
17
+ - 🎨**Tailwind-Compatible**- Familiar utility classes and syntax
18
+ - πŸ’ͺ**Fully Typed**- Complete TypeScript support with type-safe configuration
19
+ - πŸ”§**Highly Configurable**- Customize theme, colors, spacing, variants, and more
20
+ - πŸ“¦**Zero Runtime Dependencies**- Minimal footprint, maximum performance
21
+ - πŸ”₯**Hot Reload**- Watch mode for instant rebuilds during development
22
+ - 🎭**Variant Support**- Responsive, state (hover, focus, etc.), dark mode, and custom variants
23
+ - ✨**Modern CSS Features**- Grid, Flexbox, animations, transforms, filters, and more
24
+ - πŸ”¨**Class Compilation**- Optimize HTML by compiling utility groups into single class names
25
+ - πŸ§ͺ**Thoroughly Tested**- 1300+ tests including comprehensive performance benchmarks
26
+ - πŸš€**Production Ready**- Minification, preflight CSS, and optimized builds
27
+ - ⌨️**CLI & API**- Use via command line or programmatic API
28
+
29
+ ## Get Started
30
+
31
+ ### Installation
32
+
33
+ ```bash
34
+ bun add crosswind
35
+
36
+ # or
37
+
38
+ npm install crosswind
39
+ ```### Quick Start
40
+
41
+ 1.**Initialize Crosswind**:```bash
42
+
43
+ # Create a config file
44
+
45
+ bunx crosswind init
46
+
47
+ ```This creates a`crosswind.config.ts`file:```typescript
48
+ import type { CrosswindOptions } from 'crosswind'
49
+
50
+ export default {
51
+ content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
52
+ output: './dist/crosswind.css',
53
+ minify: false,
54
+ } satisfies CrosswindOptions
55
+ ```1.**Add utility classes to your HTML**:```html
56
+
57
+ <div class="flex items-center justify-between p-4 bg-blue-500 text-white rounded-lg shadow-md hover:bg-blue-600">
58
+ <h1 class="text-2xl font-bold">Hello Crosswind!</h1>
59
+ </div>
60
+
61
+ ```1.**Build your CSS**:```bash
62
+
63
+ # Build once
64
+
65
+ bunx crosswind build
66
+
67
+ # Build and watch for changes
68
+
69
+ bunx crosswind watch
70
+
71
+ # Build with options
72
+
73
+ bunx crosswind build --output ./dist/styles.css --minify
74
+ ```### Programmatic API
75
+
76
+ You can also use Crosswind programmatically:```typescript
77
+ import { build } from 'crosswind'
78
+
79
+ const result = await build({
80
+ content: ['./src/**/*.html'],
81
+ output: './dist/styles.css',
82
+ minify: true,
83
+ })
84
+
85
+ console.log(`Generated ${result.classes.size} classes in ${result.duration}ms`)
86
+
87
+ ```## CLI Commands
88
+
89
+ Crosswind provides a comprehensive CLI:```bash
90
+ crosswind build # Build CSS once
91
+ crosswind watch # Build and watch for changes
92
+ crosswind init # Create config file
93
+ crosswind analyze # Analyze utility class usage
94
+ crosswind clean # Remove output CSS file
95
+ crosswind preflight # Generate preflight CSS only
96
+ crosswind --version # Show version
97
+ crosswind --help # Show help
98
+ ```## Configuration
99
+
100
+ Crosswind supports extensive configuration options:```typescript
101
+ import type { CrosswindOptions } from 'crosswind'
102
+
103
+ export default {
104
+ // Content sources to scan for utility classes
105
+ content: ['./src/**/*.{html,js,ts,jsx,tsx}'],
106
+
107
+ // Output CSS file path
108
+ output: './dist/styles.css',
109
+
110
+ // Minify output CSS
111
+ minify: false,
112
+
113
+ // Enable watch mode
114
+ watch: false,
115
+
116
+ // Enable verbose logging
117
+ verbose: false,
118
+
119
+ // Theme customization
120
+ theme: {
121
+ colors: {
122
+ primary: '#3b82f6',
123
+ secondary: '#10b981',
124
+ // ... extend or override default colors
125
+ },
126
+ spacing: {
127
+ // ... customize spacing scale
128
+ },
129
+ fontSize: {
130
+ // ... customize font sizes
131
+ },
132
+ // ... and more
133
+ },
134
+
135
+ // Shortcuts (utility aliases)
136
+ shortcuts: {
137
+ btn: 'px-4 py-2 rounded bg-blue-500 text-white hover:bg-blue-600',
138
+ card: 'p-6 bg-white rounded-lg shadow-md',
139
+ },
140
+
141
+ // Custom variants
142
+ variants: {
143
+ // ... configure breakpoints, states, etc.
144
+ },
145
+
146
+ // Safelist (always include these classes)
147
+ safelist: ['bg-red-500', 'text-green-500'],
148
+
149
+ // Blocklist (never include these classes)
150
+ blocklist: ['debug-*'],
151
+
152
+ // Custom rules
153
+ rules: [],
154
+
155
+ // Preflight CSS (normalize/reset styles)
156
+ preflights: [],
157
+
158
+ // Presets
159
+ presets: [],
160
+ } satisfies CrosswindOptions
161
+
162
+ ```For more configuration options, see the [Configuration Guide](https://crosswind.stacksjs.org/config).
163
+
164
+ ## Available Utilities
165
+
166
+ Crosswind provides a comprehensive set of utility classes compatible with Tailwind CSS:
167
+
168
+ -**Layout**: display, position, overflow, z-index, etc.
169
+ -**Flexbox & Grid**: flex, grid, gap, align, justify, etc.
170
+ -**Spacing**: margin, padding with full scale support
171
+ -**Sizing**: width, height, min/max sizes
172
+ -**Typography**: font family, size, weight, line height, text alignment, etc.
173
+ -**Backgrounds**: colors, gradients, images, position, size
174
+ -**Borders**: width, color, radius, style
175
+ -**Effects**: shadow, opacity, blend modes, filters
176
+ -**Transforms**: translate, rotate, scale, skew
177
+ -**Transitions & Animations**: duration, timing, delay
178
+ -**Interactivity**: cursor, pointer events, user select, scroll behavior
179
+ -**Advanced**: mask utilities, backdrop filters, ring utilities
180
+
181
+ ### Variants
182
+
183
+ -**Responsive**:`sm:`, `md:`, `lg:`, `xl:`, `2xl:`-**State**:`hover:`, `focus:`, `active:`, `disabled:`, `visited:`, `checked:`-**Pseudo-elements**:`before:`, `after:`, `placeholder:`, `selection:`-**Group/Peer**:`group-hover:`, `peer-focus:`-**Dark mode**:`dark:`-**Positional**:`first:`, `last:`, `odd:`, `even:`-**Important**:`!`prefix (e.g.,`!text-red-500`)
184
+
185
+ ### Arbitrary Values
186
+
187
+ Crosswind supports arbitrary values for maximum flexibility:
188
+
189
+ ```html
190
+
191
+ <div class="w-[500px] h-[calc(100vh-4rem)] bg-[#1da1f2] text-[clamp(1rem,5vw,3rem)]">
192
+ Custom values!
193
+ </div>
194
+
195
+ ```### Compile Class (HTML Optimization)
196
+
197
+ Optimize your HTML by compiling utility groups into single class names:```html
198
+ <!-- Before -->
199
+ <div class=":hw: flex items-center justify-between px-4 py-2 bg-white rounded-lg shadow-md">
200
+ Content
201
+ </div>
202
+
203
+ <!-- After build -->
204
+ <div class="hw-2k9d3a">
205
+ Content
206
+ </div>
207
+ ```This reduces HTML file size by up to 60%. Learn more in the [Compile Class documentation](https://crosswind.stacksjs.org/features/compile-class).
208
+
209
+ ## Testing
210
+
211
+ Crosswind includes a comprehensive test suite with 1300+ tests:```bash
212
+
213
+ # Run all tests
214
+
215
+ bun test
216
+
217
+ # Run specific test files
218
+
219
+ bun test test/performance.test.ts
220
+
221
+ # Run tests in watch mode
222
+
223
+ bun test --watch
224
+
225
+ ```### Test Coverage
226
+
227
+ -**Core Functionality**: Parser, generator, scanner, builder
228
+ -**Utilities**: Layout, typography, colors, spacing, grid, flexbox
229
+ -**Variants**: Responsive, state, pseudo-elements, combinations
230
+ -**Advanced Features**: Shortcuts, custom rules, arbitrary values
231
+ -**Performance**: Benchmarks for generation speed and memory efficiency
232
+ -**Edge Cases**: Invalid inputs, complex nesting, duplicate handling
233
+
234
+ ## Performance
235
+
236
+ Crosswind is designed for speed. We've benchmarked against other popular utility-first CSS frameworks to demonstrate our performance advantages.
237
+
238
+ ### Benchmark Results
239
+
240
+ Our comprehensive benchmark suite (20 tests) compares Crosswind with UnoCSS, Tailwind CSS v3, and Tailwind CSS v4.
241
+
242
+ | Scenario | Crosswind | UnoCSS | Tailwind v3 | Tailwind v4 | Winner |
243
+ |----------|----------|--------|-------------|-------------|--------|
244
+ |**Simple Utilities**(10 classes) |**2.75¡s**| 31.58¡s | 14.32ms | 46.47ms | Crosswind ⚑ |
245
+ |**Complex Utilities**(11 classes) |**8.61¡s**| 43.77¡s | 14.25ms | 39.26ms | Crosswind ⚑ |
246
+ |**Arbitrary Values**(10 classes) |**41.71¡s**| 64.44¡s | 15.52ms | - | Crosswind ⚑ |
247
+ |**Real-world Components**(~60 classes) |**25.26¡s**| 97.71¡s | 16.12ms | 45.07ms | Crosswind ⚑ |
248
+ |**Large Scale**(500 classes) |**94.89¡s**| 201.30¡s | 14.51ms | 40.06ms | Crosswind ⚑ |
249
+ |**CSS Output**(1000 values) |**1.50ms**| 115.59ms | 16.03ms | - | Crosswind ⚑ |
250
+ |**Color Utilities**(330 classes) |**100.85¡s**| 526.82¡s | 12.89ms | 37.27ms | Crosswind ⚑ |
251
+ |**Responsive**(500 classes) |**100.16¡s**| 211.39¡s | 12.86ms | 41.07ms | Crosswind ⚑ |
252
+ |**Interactive States**(440 classes) |**260.75¡s**| 1.16ms | 13.84ms | 38.06ms | Crosswind ⚑ |
253
+ |**Duplicate Handling**(6000 items) |**43.19¡s**| 1.81ms | 18.47ms | 48.11ms | Crosswind ⚑ |
254
+ |**Typography**(50 classes) |**16.06¡s**| 94.37¡s | 14.37ms | 39.33ms | Crosswind ⚑ |
255
+ |**Flexbox**(50 classes) |**13.77¡s**| 88.62¡s | 13.04ms | 42.38ms | Crosswind ⚑ |
256
+ |**Grid**(55 classes) |**59.89¡s**| 118.31¡s | 15.10ms | 39.00ms | Crosswind ⚑ |
257
+ |**Stacked Variants**(40 classes) |**73.43¡s**| 148.79¡s | 15.65ms | 41.11ms | Crosswind ⚑ |
258
+ |**Transforms**(55 classes) |**78.39¡s**| 100.85¡s | 13.76ms | 44.34ms | Crosswind ⚑ |
259
+ |**Transitions**(30 classes) |**12.96¡s**| 66.47¡s | 14.38ms | 36.46ms | Crosswind ⚑ |
260
+ |**Border & Ring**(45 classes) |**12.55¡s**| 90.45¡s | 10.52ms | 40.58ms | Crosswind ⚑ |
261
+ |**Shadow & Effects**(35 classes) |**6.92¡s**| 62.12¡s | 10.89ms | 36.62ms | Crosswind ⚑ |
262
+ |**Incremental Generation**(200 classes) |**73.91¡s**| 196.35¡s | 14.07ms | 35.58ms | Crosswind ⚑ |
263
+ |**Full Project**(~800 classes) |**649.87¡s**| 1.38ms | 14.41ms | - | Crosswind ⚑ |
264
+
265
+ ### Highlights
266
+
267
+ -**Crosswind wins 20/20 benchmarks**vs all competitors
268
+ -**Simple utilities**: 11x faster than UnoCSS, 5,200x faster than Tailwind v3
269
+ -**Typography**: 6x faster than UnoCSS
270
+ -**Flexbox**: 6.4x faster than UnoCSS
271
+ -**Shadow & Effects**: 9x faster than UnoCSS
272
+ -**Border & Ring**: 7x faster than UnoCSS
273
+ -**Color utilities**: 5x faster than UnoCSS
274
+ -**Interactive states**: 4.5x faster than UnoCSS
275
+ -**Duplicate handling**: 42x faster than UnoCSS
276
+ -**CSS output generation**: 77x faster than UnoCSS
277
+ -**Full project simulation**: 2.1x faster than UnoCSS, 22x faster than Tailwind v3
278
+
279
+ ### Running Benchmarks
280
+
281
+ You can run the benchmarks yourself to see the performance on your hardware:```bash
282
+
283
+ # Run the comprehensive benchmark suite
284
+
285
+ bun run benchmark
286
+
287
+ # Or run from the packages/crosswind directory
288
+
289
+ cd packages/crosswind
290
+ bun run benchmark
291
+ ```All benchmarks use [Mitata](https://github.com/evanwashere/mitata) for accurate measurements and run on Bun runtime. Results may vary based on your hardware.
292
+
293
+ ## Development
294
+
295
+ To contribute to Crosswind development:```bash
296
+
297
+ # Clone the repository
298
+
299
+ git clone <https://github.com/cwcss/crosswind.git>
300
+ cd crosswind
301
+
302
+ # Install dependencies
303
+
304
+ bun install
305
+
306
+ # Run tests
307
+
308
+ bun test
309
+
310
+ # Run tests in watch mode
311
+
312
+ bun test --watch
313
+
314
+ # Run performance benchmarks
315
+
316
+ bun test test/performance.test.ts
317
+
318
+ # Type check
319
+
320
+ bun run typecheck
321
+
322
+ # Build the package
323
+
324
+ bun run build
325
+
326
+ ```
327
+
328
+ ## Documentation
329
+
330
+ For comprehensive documentation, visit [crosswind.stacksjs.org](https://crosswind.stacksjs.org)
331
+
332
+ - [Installation Guide](https://crosswind.stacksjs.org/install)
333
+ - [Usage Guide](https://crosswind.stacksjs.org/usage)
334
+ - [Configuration](https://crosswind.stacksjs.org/config)
335
+ - [CLI Reference](https://crosswind.stacksjs.org/features/cli)
336
+ - [API Reference](https://crosswind.stacksjs.org/api-reference)
337
+
338
+ ## Changelog
339
+
340
+ Please see our [releases](https://github.com/cwcss/crosswind/releases) page for more information on what has changed recently.
341
+
342
+ ## Contributing
343
+
344
+ Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
345
+
346
+ We welcome contributions! Whether it's:
347
+
348
+ - πŸ› Bug reports and fixes
349
+ - ✨ New utility classes or features
350
+ - πŸ“ Documentation improvements
351
+ - ⚑️ Performance optimizations
352
+ - πŸ§ͺ Additional test coverage
353
+
354
+ ## Community
355
+
356
+ For help, discussion about best practices, or any other conversation that would benefit from being searchable:
357
+
358
+ [Discussions on GitHub](https://github.com/cwcss/crosswind/discussions)
359
+
360
+ For casual chit-chat with others using this package:
361
+
362
+ [Join the Stacks Discord Server](https://discord.gg/stacksjs)
363
+
364
+ ## Postcardware
365
+
366
+ β€œSoftware that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
367
+
368
+ Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
369
+
370
+ ## Sponsors
371
+
372
+ We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
373
+
374
+ - [JetBrains](https://www.jetbrains.com/)
375
+ - [The Solana Foundation](https://solana.com/)
376
+
377
+ ## License
378
+
379
+ The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
380
+
381
+ Made with πŸ’™
382
+
383
+ <!-- Badges -->
384
+ [npm-version-src]: <https://img.shields.io/npm/v/crosswind?style=flat-square>
385
+ [npm-version-href]: <https://npmjs.com/package/crosswind>
386
+ [github-actions-src]: <https://img.shields.io/github/actions/workflow/status/cwcss/crosswind/ci.yml?style=flat-square&branch=main>
387
+ [github-actions-href]: <https://github.com/cwcss/crosswind/actions?query=workflow%3Aci>
388
+
389
+ <!-- [codecov-src]: <https://img.shields.io/codecov/c/gh/cwcss/crosswind/main?style=flat-square>
390
+ [codecov-href]: <https://codecov.io/gh/cwcss/crosswind> -->
@@ -0,0 +1,24 @@
1
+ import type { CrosswindConfig } from './types';
2
+ /**
3
+ * Build CSS from content patterns
4
+ */
5
+ export declare function build(config: CrosswindConfig): Promise<BuildResult>;
6
+ /**
7
+ * Write CSS to output file
8
+ */
9
+ export declare function writeCSS(css: string, outputPath: string): Promise<void>;
10
+ /**
11
+ * Write transformed files to disk
12
+ */
13
+ export declare function writeTransformedFiles(transformedFiles: Map<string, string>): Promise<void>;
14
+ /**
15
+ * Build and write CSS to output file
16
+ */
17
+ export declare function buildAndWrite(config: CrosswindConfig): Promise<BuildResult>;
18
+ export declare interface BuildResult {
19
+ css: string
20
+ classes: Set<string>
21
+ duration: number
22
+ compiledClasses?: Map<string, { className: string, utilities: string[] }>
23
+ transformedFiles?: Map<string, string>
24
+ }
@@ -0,0 +1,5 @@
1
+ import type { CrosswindConfig } from './types';
2
+ export declare function getConfig(): Promise<CrosswindConfig>;
3
+ export declare const defaultConfig: CrosswindConfig;
4
+ // For backwards compatibility - synchronous access with default fallback
5
+ export declare const config: CrosswindConfig;
@@ -0,0 +1,31 @@
1
+ import type { CSSRule, CrosswindConfig, ParsedClass } from './types';
2
+ import type { UtilityRule } from './rules';
3
+ /**
4
+ * Generates CSS rules from parsed utility classes
5
+ */
6
+ export declare class CSSGenerator {
7
+ private rules: Map<string, CSSRule[]>;
8
+ private classCache: Set<string>;
9
+ private blocklistRegexCache: RegExp[];
10
+ private blocklistExact: Set<string>;
11
+ private selectorCache: Map<string, string>;
12
+ private mediaQueryCache: Map<string, string | undefined>;
13
+ private ruleCache: Map<string, UtilityRule[]>;
14
+ private variantEnabled: Record<string, boolean>;
15
+ private screenBreakpoints: Map<string, string>;
16
+ private noMatchCache: Set<string>;
17
+ private extendColors: Record<string, string | Record<string, string>> | null;
18
+ private config: CrosswindConfig;
19
+ constructor(config: CrosswindConfig);
20
+ private buildRuleLookup(): void;
21
+ generate(className: string): void;
22
+ private addRule(parsed: ParsedClass, properties: Record<string, string>, childSelector?: string, pseudoElement?: string): void;
23
+ private buildSelector(parsed: ParsedClass): string;
24
+ private getMediaQuery(parsed: ParsedClass): string | undefined;
25
+ private escapeSelector(className: string): string;
26
+ toCSS(includePreflight?: any, minify?: any): string;
27
+ private rulesToCSS(rules: CSSRule[], minify: boolean): string;
28
+ private groupRulesBySelector(rules: CSSRule[]): Map<string, Map<string, string>>;
29
+ private generateCSSVariables(): string | null;
30
+ reset(): void;
31
+ }
@@ -0,0 +1,10 @@
1
+ export * from './build';
2
+ export * from './config';
3
+ export * from './generator';
4
+ export * from './parser';
5
+ export * from './plugin';
6
+ export * from './preflight';
7
+ export * from './preflight-forms';
8
+ export * from './rules';
9
+ export * from './scanner';
10
+ export * from './types';