@csszyx/core 0.1.0 β†’ 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 csszyx contributors
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 CHANGED
@@ -1,113 +1,83 @@
1
- # <p align="center">🌊 @csszyx/core</p>
1
+ # @csszyx/core
2
2
 
3
- <p align="center">
4
- <img src="https://img.shields.io/badge/WASM-Powered-624de3?style=for-the-badge&logo=webassembly" alt="WASM Powered" />
5
- <img src="https://img.shields.io/badge/Rust-Core-dea584?style=for-the-badge&logo=rust" alt="Rust Core" />
6
- <img src="https://img.shields.io/badge/TypeScript-Ready-3178c6?style=for-the-badge&logo=typescript" alt="TypeScript Ready" />
7
- </p>
3
+ > Rust/WASM core for csszyx -- encoder, checksum, collision detection, and recovery tokens.
8
4
 
9
- ---
5
+ Compiled to WebAssembly, this package provides the performance-critical operations for the csszyx ecosystem. It runs in Node.js, browsers, and edge environments.
10
6
 
11
- ## ✨ The Engine of csszyx
12
-
13
- `@csszyx/core` is a high-performance, precision-engineered Rust core for the **csszyx** ecosystem. Compiled to WebAssembly, it brings near-native performance to Node.js, Browsers, and Edge environments.
14
-
15
- ### πŸ”₯ Why Core?
16
-
17
- - **Blazing Speed**: Offloads performance-critical operations (Hashing, Transformation, Encoding) to optimized Rust.
18
- - **Universal Integrity**: Ensures bit-perfect mangle map consistency between SSR and hydration.
19
- - **Security-First**: Uses SHA-256 and Base62 for tamper-proof tokens and collision-free variable names.
20
- - **Zero Dependencies**: Lightweight WASM binary with no external runtimes required.
21
-
22
- ---
23
-
24
- ## πŸš€ Quick Start
7
+ ## Installation
25
8
 
26
9
  ```bash
27
10
  pnpm add @csszyx/core
28
11
  ```
29
12
 
30
- ### Initialization
13
+ ## Initialization
31
14
 
32
15
  ```typescript
33
- import { init } from '@csszyx/core';
16
+ import { init } from "@csszyx/core";
34
17
 
35
- async function bootstrap() {
36
- await init();
37
- // Core is ready to flow 🌊
38
- }
18
+ await init();
39
19
  ```
40
20
 
41
- ---
21
+ ## Modules
42
22
 
43
- ## πŸ›  Modules
44
-
45
- ### πŸ—ΊοΈ Mangle Map Integrity
23
+ ### Mangle Map Integrity
46
24
 
47
25
  Deterministic SHA-256 checksums to synchronize server-side class names with client-side hydration.
48
26
 
49
27
  ```typescript
50
- import { compute_mangle_checksum, verify_mangle_checksum } from '@csszyx/core';
28
+ import { compute_mangle_checksum, verify_mangle_checksum } from "@csszyx/core";
51
29
 
52
- const mangleMap = { 'p-4': 'z', 'm-2': 'y' };
30
+ const mangleMap = { "p-4": "z", "m-2": "y" };
53
31
  const checksum = compute_mangle_checksum(mangleMap);
54
- // Results in a deterministic 16-char hex hash
32
+ // Returns a deterministic 16-char hex hash
55
33
  ```
56
34
 
57
- ### 🎭 Transformer
35
+ ### Transformer
58
36
 
59
- Universal conversion of object-based Tailwind syntax into optimized class strings.
37
+ Converts object-based Tailwind syntax into class strings.
60
38
 
61
39
  ```typescript
62
- import { transform_sz } from '@csszyx/core';
40
+ import { transform_sz } from "@csszyx/core";
63
41
 
64
- // Supports: Negatives, Opacity, Nesting, Integers
65
42
  transform_sz({
66
- m: -4,
67
- bg: 'blue-500/20',
68
- hover: { scale: 110 }
43
+ m: -4,
44
+ bg: "blue-500/20",
45
+ hover: { scale: 110 },
69
46
  });
70
47
  // "-m-4 bg-blue-500/20 hover:scale-110"
71
48
  ```
72
49
 
73
- ### πŸ”’ Tiered Encoder
50
+ ### Tiered Encoder
74
51
 
75
- The world's smallest CSS-compliant class name generator.
52
+ CSS-compliant class name generator using reversed tier encoding (z -> y -> x).
76
53
 
77
- | Tier | Range | Format | Example |
78
- | :--- | :--- | :--- | :--- |
79
- | **Tier 1** | 0 - 51 | \[z-aZ-A\] | `z`, `y`, `x` |
80
- | **Tier 2** | 52 - 571 | \[z-aZ-A\]\[9-0\] | `z9`, `y8` |
81
- | **Tier 3** | 572 - 3275 | \[z-aZ-A\]{2} | `zz`, `zy` |
54
+ | Tier | Range | Format | Example |
55
+ | :----- | :--------- | :---------------- | :------------ |
56
+ | Tier 1 | 0 - 51 | \[z-aZ-A\] | `z`, `y`, `x` |
57
+ | Tier 2 | 52 - 571 | \[z-aZ-A\]\[9-0\] | `z9`, `y8` |
58
+ | Tier 3 | 572 - 3275 | \[z-aZ-A\]{2} | `zz`, `zy` |
82
59
 
83
- ### πŸ›‘οΈ Collision Detector
60
+ ### Collision Detector
84
61
 
85
62
  Dual-hash resolution strategy for unique CSS variable names.
86
63
 
87
64
  ```typescript
88
- import { WasmCollisionDetector } from '@csszyx/core';
65
+ import { WasmCollisionDetector } from "@csszyx/core";
89
66
 
90
67
  const detector = new WasmCollisionDetector();
91
- const varId = detector.add('#ff0000'); // "--v-a1b2c3"
68
+ const varId = detector.add("#ff0000"); // "--v-a1b2c3"
92
69
  ```
93
70
 
94
- ---
95
-
96
- ## ⚑ Performance Matrix
97
-
98
- Benchmarks performed on Apple M2 (WASM Node v20 target)
99
-
100
- | Operation | WASM (Rust) | Pure JS (Legacy) | Improvement |
101
- | :--- | :--- | :--- | :--- |
102
- | **Integrity Check** | < 1ms | ~15ms | **15x faster** |
103
- | **ID Encoding** | ~5ns | ~50ns | **10x faster** |
104
- | **Token Auth** | ~25ns | ~250ns | **10x faster** |
105
- | **Transformer** | Optimized | Variable | Stable 🌊 |
71
+ ## Performance
106
72
 
107
- > **Tech Tip**: WASM excels in consistency. Unlike JS which relies on JIT optimization, WASM provides deterministic, high-speed execution from the very first call.
73
+ Benchmarks on Apple M2 (WASM, Node v20):
108
74
 
109
- ---
75
+ | Operation | WASM (Rust) | Pure JS | Speedup |
76
+ | :-------------- | :---------- | :------ | :------ |
77
+ | Integrity Check | < 1ms | ~15ms | 15x |
78
+ | ID Encoding | ~5ns | ~50ns | 10x |
79
+ | Token Auth | ~25ns | ~250ns | 10x |
110
80
 
111
- ## πŸ“„ License
81
+ ## License
112
82
 
113
- MIT Β© 2026 csszyx Team
83
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "WASM core for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -33,14 +33,14 @@
33
33
  "pkg",
34
34
  "pkg-node"
35
35
  ],
36
+ "devDependencies": {
37
+ "vitest": "^1.2.0"
38
+ },
36
39
  "scripts": {
37
40
  "build": "wasm-pack build --target bundler --out-dir pkg && wasm-pack build --target nodejs --out-dir pkg-node && rm -f pkg/.gitignore pkg-node/.gitignore",
38
41
  "build:test": "wasm-pack build --target nodejs --out-dir pkg-node",
39
42
  "test": "npm run build:test && vitest run",
40
43
  "test:watch": "vitest",
41
44
  "clean": "rm -rf pkg pkg-node target"
42
- },
43
- "devDependencies": {
44
- "vitest": "^1.2.0"
45
45
  }
46
- }
46
+ }
package/pkg/README.md CHANGED
@@ -1,113 +1,83 @@
1
- # <p align="center">🌊 @csszyx/core</p>
1
+ # @csszyx/core
2
2
 
3
- <p align="center">
4
- <img src="https://img.shields.io/badge/WASM-Powered-624de3?style=for-the-badge&logo=webassembly" alt="WASM Powered" />
5
- <img src="https://img.shields.io/badge/Rust-Core-dea584?style=for-the-badge&logo=rust" alt="Rust Core" />
6
- <img src="https://img.shields.io/badge/TypeScript-Ready-3178c6?style=for-the-badge&logo=typescript" alt="TypeScript Ready" />
7
- </p>
3
+ > Rust/WASM core for csszyx -- encoder, checksum, collision detection, and recovery tokens.
8
4
 
9
- ---
5
+ Compiled to WebAssembly, this package provides the performance-critical operations for the csszyx ecosystem. It runs in Node.js, browsers, and edge environments.
10
6
 
11
- ## ✨ The Engine of csszyx
12
-
13
- `@csszyx/core` is a high-performance, precision-engineered Rust core for the **csszyx** ecosystem. Compiled to WebAssembly, it brings near-native performance to Node.js, Browsers, and Edge environments.
14
-
15
- ### πŸ”₯ Why Core?
16
-
17
- - **Blazing Speed**: Offloads performance-critical operations (Hashing, Transformation, Encoding) to optimized Rust.
18
- - **Universal Integrity**: Ensures bit-perfect mangle map consistency between SSR and hydration.
19
- - **Security-First**: Uses SHA-256 and Base62 for tamper-proof tokens and collision-free variable names.
20
- - **Zero Dependencies**: Lightweight WASM binary with no external runtimes required.
21
-
22
- ---
23
-
24
- ## πŸš€ Quick Start
7
+ ## Installation
25
8
 
26
9
  ```bash
27
10
  pnpm add @csszyx/core
28
11
  ```
29
12
 
30
- ### Initialization
13
+ ## Initialization
31
14
 
32
15
  ```typescript
33
- import { init } from '@csszyx/core';
16
+ import { init } from "@csszyx/core";
34
17
 
35
- async function bootstrap() {
36
- await init();
37
- // Core is ready to flow 🌊
38
- }
18
+ await init();
39
19
  ```
40
20
 
41
- ---
21
+ ## Modules
42
22
 
43
- ## πŸ›  Modules
44
-
45
- ### πŸ—ΊοΈ Mangle Map Integrity
23
+ ### Mangle Map Integrity
46
24
 
47
25
  Deterministic SHA-256 checksums to synchronize server-side class names with client-side hydration.
48
26
 
49
27
  ```typescript
50
- import { compute_mangle_checksum, verify_mangle_checksum } from '@csszyx/core';
28
+ import { compute_mangle_checksum, verify_mangle_checksum } from "@csszyx/core";
51
29
 
52
- const mangleMap = { 'p-4': 'z', 'm-2': 'y' };
30
+ const mangleMap = { "p-4": "z", "m-2": "y" };
53
31
  const checksum = compute_mangle_checksum(mangleMap);
54
- // Results in a deterministic 16-char hex hash
32
+ // Returns a deterministic 16-char hex hash
55
33
  ```
56
34
 
57
- ### 🎭 Transformer
35
+ ### Transformer
58
36
 
59
- Universal conversion of object-based Tailwind syntax into optimized class strings.
37
+ Converts object-based Tailwind syntax into class strings.
60
38
 
61
39
  ```typescript
62
- import { transform_sz } from '@csszyx/core';
40
+ import { transform_sz } from "@csszyx/core";
63
41
 
64
- // Supports: Negatives, Opacity, Nesting, Integers
65
42
  transform_sz({
66
- m: -4,
67
- bg: 'blue-500/20',
68
- hover: { scale: 110 }
43
+ m: -4,
44
+ bg: "blue-500/20",
45
+ hover: { scale: 110 },
69
46
  });
70
47
  // "-m-4 bg-blue-500/20 hover:scale-110"
71
48
  ```
72
49
 
73
- ### πŸ”’ Tiered Encoder
50
+ ### Tiered Encoder
74
51
 
75
- The world's smallest CSS-compliant class name generator.
52
+ CSS-compliant class name generator using reversed tier encoding (z -> y -> x).
76
53
 
77
- | Tier | Range | Format | Example |
78
- | :--- | :--- | :--- | :--- |
79
- | **Tier 1** | 0 - 51 | \[z-aZ-A\] | `z`, `y`, `x` |
80
- | **Tier 2** | 52 - 571 | \[z-aZ-A\]\[9-0\] | `z9`, `y8` |
81
- | **Tier 3** | 572 - 3275 | \[z-aZ-A\]{2} | `zz`, `zy` |
54
+ | Tier | Range | Format | Example |
55
+ | :----- | :--------- | :---------------- | :------------ |
56
+ | Tier 1 | 0 - 51 | \[z-aZ-A\] | `z`, `y`, `x` |
57
+ | Tier 2 | 52 - 571 | \[z-aZ-A\]\[9-0\] | `z9`, `y8` |
58
+ | Tier 3 | 572 - 3275 | \[z-aZ-A\]{2} | `zz`, `zy` |
82
59
 
83
- ### πŸ›‘οΈ Collision Detector
60
+ ### Collision Detector
84
61
 
85
62
  Dual-hash resolution strategy for unique CSS variable names.
86
63
 
87
64
  ```typescript
88
- import { WasmCollisionDetector } from '@csszyx/core';
65
+ import { WasmCollisionDetector } from "@csszyx/core";
89
66
 
90
67
  const detector = new WasmCollisionDetector();
91
- const varId = detector.add('#ff0000'); // "--v-a1b2c3"
68
+ const varId = detector.add("#ff0000"); // "--v-a1b2c3"
92
69
  ```
93
70
 
94
- ---
95
-
96
- ## ⚑ Performance Matrix
97
-
98
- Benchmarks performed on Apple M2 (WASM Node v20 target)
99
-
100
- | Operation | WASM (Rust) | Pure JS (Legacy) | Improvement |
101
- | :--- | :--- | :--- | :--- |
102
- | **Integrity Check** | < 1ms | ~15ms | **15x faster** |
103
- | **ID Encoding** | ~5ns | ~50ns | **10x faster** |
104
- | **Token Auth** | ~25ns | ~250ns | **10x faster** |
105
- | **Transformer** | Optimized | Variable | Stable 🌊 |
71
+ ## Performance
106
72
 
107
- > **Tech Tip**: WASM excels in consistency. Unlike JS which relies on JIT optimization, WASM provides deterministic, high-speed execution from the very first call.
73
+ Benchmarks on Apple M2 (WASM, Node v20):
108
74
 
109
- ---
75
+ | Operation | WASM (Rust) | Pure JS | Speedup |
76
+ | :-------------- | :---------- | :------ | :------ |
77
+ | Integrity Check | < 1ms | ~15ms | 15x |
78
+ | ID Encoding | ~5ns | ~50ns | 10x |
79
+ | Token Auth | ~25ns | ~250ns | 10x |
110
80
 
111
- ## πŸ“„ License
81
+ ## License
112
82
 
113
- MIT Β© 2026 csszyx Team
83
+ MIT
@@ -79,20 +79,10 @@ export class WasmCollisionDetector {
79
79
  *
80
80
  * # Examples
81
81
  *
82
- * ```
83
- * use csszyx_core::mangle::{compute_mangle_checksum, MangleMap};
84
- * use std::collections::HashMap;
85
- *
86
- * let mut map = HashMap::new();
87
- * map.insert("p-4".to_string(), "a".to_string());
88
- * map.insert("bg-red-500".to_string(), "b".to_string());
89
- *
90
- * let checksum = compute_mangle_checksum(&map);
91
- * assert_eq!(checksum.len(), 16);
92
- *
93
- * // Same map produces same checksum
94
- * let checksum2 = compute_mangle_checksum(&map);
95
- * assert_eq!(checksum, checksum2);
82
+ * ```ignore
83
+ * // This function is wasm_bindgen β€” call from JS, not Rust directly.
84
+ * // Use compute_checksum_internal() for pure-Rust usage.
85
+ * let checksum = compute_mangle_checksum(js_map);
96
86
  * ```
97
87
  */
98
88
  export function compute_mangle_checksum(map: any): string;
@@ -113,20 +113,10 @@ if (Symbol.dispose) WasmCollisionDetector.prototype[Symbol.dispose] = WasmCollis
113
113
  *
114
114
  * # Examples
115
115
  *
116
- * ```
117
- * use csszyx_core::mangle::{compute_mangle_checksum, MangleMap};
118
- * use std::collections::HashMap;
119
- *
120
- * let mut map = HashMap::new();
121
- * map.insert("p-4".to_string(), "a".to_string());
122
- * map.insert("bg-red-500".to_string(), "b".to_string());
123
- *
124
- * let checksum = compute_mangle_checksum(&map);
125
- * assert_eq!(checksum.len(), 16);
126
- *
127
- * // Same map produces same checksum
128
- * let checksum2 = compute_mangle_checksum(&map);
129
- * assert_eq!(checksum, checksum2);
116
+ * ```ignore
117
+ * // This function is wasm_bindgen β€” call from JS, not Rust directly.
118
+ * // Use compute_checksum_internal() for pure-Rust usage.
119
+ * let checksum = compute_mangle_checksum(js_map);
130
120
  * ```
131
121
  * @param {any} map
132
122
  * @returns {string}
Binary file
@@ -1,113 +1,83 @@
1
- # <p align="center">🌊 @csszyx/core</p>
1
+ # @csszyx/core
2
2
 
3
- <p align="center">
4
- <img src="https://img.shields.io/badge/WASM-Powered-624de3?style=for-the-badge&logo=webassembly" alt="WASM Powered" />
5
- <img src="https://img.shields.io/badge/Rust-Core-dea584?style=for-the-badge&logo=rust" alt="Rust Core" />
6
- <img src="https://img.shields.io/badge/TypeScript-Ready-3178c6?style=for-the-badge&logo=typescript" alt="TypeScript Ready" />
7
- </p>
3
+ > Rust/WASM core for csszyx -- encoder, checksum, collision detection, and recovery tokens.
8
4
 
9
- ---
5
+ Compiled to WebAssembly, this package provides the performance-critical operations for the csszyx ecosystem. It runs in Node.js, browsers, and edge environments.
10
6
 
11
- ## ✨ The Engine of csszyx
12
-
13
- `@csszyx/core` is a high-performance, precision-engineered Rust core for the **csszyx** ecosystem. Compiled to WebAssembly, it brings near-native performance to Node.js, Browsers, and Edge environments.
14
-
15
- ### πŸ”₯ Why Core?
16
-
17
- - **Blazing Speed**: Offloads performance-critical operations (Hashing, Transformation, Encoding) to optimized Rust.
18
- - **Universal Integrity**: Ensures bit-perfect mangle map consistency between SSR and hydration.
19
- - **Security-First**: Uses SHA-256 and Base62 for tamper-proof tokens and collision-free variable names.
20
- - **Zero Dependencies**: Lightweight WASM binary with no external runtimes required.
21
-
22
- ---
23
-
24
- ## πŸš€ Quick Start
7
+ ## Installation
25
8
 
26
9
  ```bash
27
10
  pnpm add @csszyx/core
28
11
  ```
29
12
 
30
- ### Initialization
13
+ ## Initialization
31
14
 
32
15
  ```typescript
33
- import { init } from '@csszyx/core';
16
+ import { init } from "@csszyx/core";
34
17
 
35
- async function bootstrap() {
36
- await init();
37
- // Core is ready to flow 🌊
38
- }
18
+ await init();
39
19
  ```
40
20
 
41
- ---
21
+ ## Modules
42
22
 
43
- ## πŸ›  Modules
44
-
45
- ### πŸ—ΊοΈ Mangle Map Integrity
23
+ ### Mangle Map Integrity
46
24
 
47
25
  Deterministic SHA-256 checksums to synchronize server-side class names with client-side hydration.
48
26
 
49
27
  ```typescript
50
- import { compute_mangle_checksum, verify_mangle_checksum } from '@csszyx/core';
28
+ import { compute_mangle_checksum, verify_mangle_checksum } from "@csszyx/core";
51
29
 
52
- const mangleMap = { 'p-4': 'z', 'm-2': 'y' };
30
+ const mangleMap = { "p-4": "z", "m-2": "y" };
53
31
  const checksum = compute_mangle_checksum(mangleMap);
54
- // Results in a deterministic 16-char hex hash
32
+ // Returns a deterministic 16-char hex hash
55
33
  ```
56
34
 
57
- ### 🎭 Transformer
35
+ ### Transformer
58
36
 
59
- Universal conversion of object-based Tailwind syntax into optimized class strings.
37
+ Converts object-based Tailwind syntax into class strings.
60
38
 
61
39
  ```typescript
62
- import { transform_sz } from '@csszyx/core';
40
+ import { transform_sz } from "@csszyx/core";
63
41
 
64
- // Supports: Negatives, Opacity, Nesting, Integers
65
42
  transform_sz({
66
- m: -4,
67
- bg: 'blue-500/20',
68
- hover: { scale: 110 }
43
+ m: -4,
44
+ bg: "blue-500/20",
45
+ hover: { scale: 110 },
69
46
  });
70
47
  // "-m-4 bg-blue-500/20 hover:scale-110"
71
48
  ```
72
49
 
73
- ### πŸ”’ Tiered Encoder
50
+ ### Tiered Encoder
74
51
 
75
- The world's smallest CSS-compliant class name generator.
52
+ CSS-compliant class name generator using reversed tier encoding (z -> y -> x).
76
53
 
77
- | Tier | Range | Format | Example |
78
- | :--- | :--- | :--- | :--- |
79
- | **Tier 1** | 0 - 51 | \[z-aZ-A\] | `z`, `y`, `x` |
80
- | **Tier 2** | 52 - 571 | \[z-aZ-A\]\[9-0\] | `z9`, `y8` |
81
- | **Tier 3** | 572 - 3275 | \[z-aZ-A\]{2} | `zz`, `zy` |
54
+ | Tier | Range | Format | Example |
55
+ | :----- | :--------- | :---------------- | :------------ |
56
+ | Tier 1 | 0 - 51 | \[z-aZ-A\] | `z`, `y`, `x` |
57
+ | Tier 2 | 52 - 571 | \[z-aZ-A\]\[9-0\] | `z9`, `y8` |
58
+ | Tier 3 | 572 - 3275 | \[z-aZ-A\]{2} | `zz`, `zy` |
82
59
 
83
- ### πŸ›‘οΈ Collision Detector
60
+ ### Collision Detector
84
61
 
85
62
  Dual-hash resolution strategy for unique CSS variable names.
86
63
 
87
64
  ```typescript
88
- import { WasmCollisionDetector } from '@csszyx/core';
65
+ import { WasmCollisionDetector } from "@csszyx/core";
89
66
 
90
67
  const detector = new WasmCollisionDetector();
91
- const varId = detector.add('#ff0000'); // "--v-a1b2c3"
68
+ const varId = detector.add("#ff0000"); // "--v-a1b2c3"
92
69
  ```
93
70
 
94
- ---
95
-
96
- ## ⚑ Performance Matrix
97
-
98
- Benchmarks performed on Apple M2 (WASM Node v20 target)
99
-
100
- | Operation | WASM (Rust) | Pure JS (Legacy) | Improvement |
101
- | :--- | :--- | :--- | :--- |
102
- | **Integrity Check** | < 1ms | ~15ms | **15x faster** |
103
- | **ID Encoding** | ~5ns | ~50ns | **10x faster** |
104
- | **Token Auth** | ~25ns | ~250ns | **10x faster** |
105
- | **Transformer** | Optimized | Variable | Stable 🌊 |
71
+ ## Performance
106
72
 
107
- > **Tech Tip**: WASM excels in consistency. Unlike JS which relies on JIT optimization, WASM provides deterministic, high-speed execution from the very first call.
73
+ Benchmarks on Apple M2 (WASM, Node v20):
108
74
 
109
- ---
75
+ | Operation | WASM (Rust) | Pure JS | Speedup |
76
+ | :-------------- | :---------- | :------ | :------ |
77
+ | Integrity Check | < 1ms | ~15ms | 15x |
78
+ | ID Encoding | ~5ns | ~50ns | 10x |
79
+ | Token Auth | ~25ns | ~250ns | 10x |
110
80
 
111
- ## πŸ“„ License
81
+ ## License
112
82
 
113
- MIT Β© 2026 csszyx Team
83
+ MIT
@@ -79,20 +79,10 @@ export class WasmCollisionDetector {
79
79
  *
80
80
  * # Examples
81
81
  *
82
- * ```
83
- * use csszyx_core::mangle::{compute_mangle_checksum, MangleMap};
84
- * use std::collections::HashMap;
85
- *
86
- * let mut map = HashMap::new();
87
- * map.insert("p-4".to_string(), "a".to_string());
88
- * map.insert("bg-red-500".to_string(), "b".to_string());
89
- *
90
- * let checksum = compute_mangle_checksum(&map);
91
- * assert_eq!(checksum.len(), 16);
92
- *
93
- * // Same map produces same checksum
94
- * let checksum2 = compute_mangle_checksum(&map);
95
- * assert_eq!(checksum, checksum2);
82
+ * ```ignore
83
+ * // This function is wasm_bindgen β€” call from JS, not Rust directly.
84
+ * // Use compute_checksum_internal() for pure-Rust usage.
85
+ * let checksum = compute_mangle_checksum(js_map);
96
86
  * ```
97
87
  */
98
88
  export function compute_mangle_checksum(map: any): string;
@@ -116,20 +116,10 @@ exports.WasmCollisionDetector = WasmCollisionDetector;
116
116
  *
117
117
  * # Examples
118
118
  *
119
- * ```
120
- * use csszyx_core::mangle::{compute_mangle_checksum, MangleMap};
121
- * use std::collections::HashMap;
122
- *
123
- * let mut map = HashMap::new();
124
- * map.insert("p-4".to_string(), "a".to_string());
125
- * map.insert("bg-red-500".to_string(), "b".to_string());
126
- *
127
- * let checksum = compute_mangle_checksum(&map);
128
- * assert_eq!(checksum.len(), 16);
129
- *
130
- * // Same map produces same checksum
131
- * let checksum2 = compute_mangle_checksum(&map);
132
- * assert_eq!(checksum, checksum2);
119
+ * ```ignore
120
+ * // This function is wasm_bindgen β€” call from JS, not Rust directly.
121
+ * // Use compute_checksum_internal() for pure-Rust usage.
122
+ * let checksum = compute_mangle_checksum(js_map);
133
123
  * ```
134
124
  * @param {any} map
135
125
  * @returns {string}
Binary file