@bookklik/senangstart-css 0.2.5 → 0.2.7

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 (46) hide show
  1. package/.agent/skills/add-utility/scripts/scaffold-utility.js +209 -0
  2. package/.agent/skills/compiler-development/SKILL.md +272 -0
  3. package/.agent/skills/jit-engine/SKILL.md +241 -0
  4. package/.agent/skills/jit-engine/examples/add-visual-utility.js +117 -0
  5. package/.agent/skills/jit-engine/examples/scale-based-utilities.js +130 -0
  6. package/.agent/skills/jit-engine/examples/state-responsive-handling.js +177 -0
  7. package/.agent/skills/senangstart-architecture/SKILL.md +163 -0
  8. package/.agent/skills/tailwind-conversion/SKILL.md +264 -0
  9. package/.agent/workflows/add-utility.md +155 -0
  10. package/.agent/workflows/build.md +97 -0
  11. package/.agent/workflows/dev.md +58 -0
  12. package/.agent/workflows/docs.md +113 -0
  13. package/.agent/workflows/test.md +103 -0
  14. package/dist/senangstart-css.js +99 -56
  15. package/dist/senangstart-css.min.js +36 -27
  16. package/dist/senangstart-tw.js +71 -2
  17. package/dist/senangstart-tw.min.js +1 -1
  18. package/docs/.vitepress/config.js +10 -2
  19. package/docs/guide/getting-started.md +6 -0
  20. package/docs/ms/guide/getting-started.md +6 -0
  21. package/docs/ms/reference/space/height.md +42 -7
  22. package/docs/ms/reference/space/width.md +40 -5
  23. package/docs/ms/reference/visual/divide-reverse.md +66 -0
  24. package/docs/ms/reference/visual/divide-style.md +80 -0
  25. package/docs/ms/reference/visual/divide-width.md +89 -0
  26. package/docs/ms/reference/visual/divide.md +115 -0
  27. package/docs/public/assets/senangstart-css.min.js +36 -27
  28. package/docs/public/llms.txt +40 -1
  29. package/docs/reference/space/height.md +42 -7
  30. package/docs/reference/space/width.md +40 -5
  31. package/docs/reference/visual/divide-reverse.md +66 -0
  32. package/docs/reference/visual/divide-style.md +80 -0
  33. package/docs/reference/visual/divide-width.md +89 -0
  34. package/docs/reference/visual/divide.md +115 -0
  35. package/docs/reference/visual.md +8 -2
  36. package/package.json +1 -1
  37. package/scripts/convert-tailwind.js +105 -2
  38. package/scripts/generate-llms-txt.js +2 -1
  39. package/src/cdn/senangstart-engine.js +128 -40
  40. package/src/cdn/tw-conversion-engine.js +92 -3
  41. package/src/compiler/generators/css.js +107 -3
  42. package/src/definitions/index.js +3 -0
  43. package/src/definitions/space.js +53 -17
  44. package/src/definitions/visual-divide.js +225 -0
  45. package/tests/unit/compiler/generators/css.test.js +75 -3
  46. package/tests/unit/convert-tailwind.test.js +71 -1
@@ -0,0 +1,264 @@
1
+ ---
2
+ name: Tailwind CSS Conversion
3
+ description: Converting Tailwind CSS to SenangStart CSS using the conversion engine
4
+ ---
5
+
6
+ # Tailwind CSS Conversion
7
+
8
+ This skill covers converting Tailwind CSS classes to SenangStart CSS using the built-in conversion engine.
9
+
10
+ ## Conversion Engine Files
11
+
12
+ | File | Purpose |
13
+ |------|---------|
14
+ | `src/cdn/tw-conversion-engine.js` | Browser-based converter |
15
+ | `scripts/convert-tailwind.js` | CLI conversion script |
16
+ | `dist/senangstart-tw.min.js` | CDN-ready converter bundle |
17
+
18
+ ## CLI Usage
19
+
20
+ ### Convert HTML File
21
+ ```bash
22
+ node scripts/convert-tailwind.js input.html -o output.html
23
+ ```
24
+
25
+ ### Convert Inline String
26
+ ```bash
27
+ node scripts/convert-tailwind.js --string "<div class='flex p-4 bg-blue-500'>"
28
+ ```
29
+
30
+ ### Exact Mode (Preserve Numeric Values)
31
+ ```bash
32
+ node scripts/convert-tailwind.js --exact input.html -o output.html
33
+ ```
34
+
35
+ ## Conversion Modes
36
+
37
+ ### Semantic Mode (Default)
38
+
39
+ Maps Tailwind numeric scales to SenangStart semantic names:
40
+
41
+ | Tailwind | SenangStart |
42
+ |----------|-------------|
43
+ | `p-0` | `p:none` |
44
+ | `p-1` | `p:thin` |
45
+ | `p-2` | `p:regular` |
46
+ | `p-4` | `p:small` |
47
+ | `p-8` | `p:big` |
48
+ | `rounded-sm` | `rounded:small` |
49
+ | `rounded-lg` | `rounded:medium` |
50
+ | `text-sm` | `text-size:small` |
51
+ | `text-2xl` | `text-size:giant` |
52
+
53
+ ### Exact Mode (`--exact` or `tw-` prefix)
54
+
55
+ Preserves Tailwind's original values with `tw-` prefix:
56
+
57
+ | Tailwind | SenangStart (Exact) |
58
+ |----------|---------------------|
59
+ | `p-4` | `p:tw-4` |
60
+ | `rounded-lg` | `rounded:tw-lg` |
61
+ | `text-2xl` | `text-size:tw-2xl` |
62
+
63
+ The JIT engine includes CSS variables for all Tailwind values:
64
+ ```css
65
+ :root {
66
+ --tw-4: 1rem;
67
+ --tw-lg: 0.5rem;
68
+ --tw-2xl: 1.5rem;
69
+ /* ... */
70
+ }
71
+ ```
72
+
73
+ ## Scale Mappings
74
+
75
+ ### Spacing Scale (`spacingScale`)
76
+
77
+ ```javascript
78
+ const spacingScale = {
79
+ '0': 'none',
80
+ 'px': 'thin',
81
+ '0.5': 'thin',
82
+ '1': 'regular',
83
+ '1.5': 'thick',
84
+ '2': 'tiny',
85
+ '3': 'tiny-2x',
86
+ '4': 'small',
87
+ '5': 'small-2x',
88
+ '6': 'small-3x',
89
+ '8': 'medium',
90
+ '10': 'medium-2x',
91
+ '12': 'big',
92
+ '16': 'giant',
93
+ '20': 'giant-2x',
94
+ '24': 'vast',
95
+ // ... extended scale
96
+ };
97
+ ```
98
+
99
+ ### Radius Scale (`radiusScale`)
100
+
101
+ ```javascript
102
+ const radiusScale = {
103
+ 'none': 'none',
104
+ 'sm': 'small',
105
+ '': 'small', // default rounded
106
+ 'md': 'small',
107
+ 'lg': 'medium',
108
+ 'xl': 'medium',
109
+ '2xl': 'big',
110
+ '3xl': 'big',
111
+ 'full': 'round'
112
+ };
113
+ ```
114
+
115
+ ### Shadow Scale (`shadowScale`)
116
+
117
+ ```javascript
118
+ const shadowScale = {
119
+ 'sm': 'small',
120
+ '': 'small', // default shadow
121
+ 'md': 'medium',
122
+ 'lg': 'medium',
123
+ 'xl': 'big',
124
+ '2xl': 'giant',
125
+ 'none': 'none'
126
+ };
127
+ ```
128
+
129
+ ### Font Size Scale (`fontSizeScale`)
130
+
131
+ ```javascript
132
+ const fontSizeScale = {
133
+ 'xs': 'tiny',
134
+ 'sm': 'small',
135
+ 'base': 'base',
136
+ 'lg': 'medium',
137
+ 'xl': 'big',
138
+ '2xl': 'giant',
139
+ '3xl': 'vast',
140
+ // ...
141
+ };
142
+ ```
143
+
144
+ ## Class Transformation Examples
145
+
146
+ ### Layout Classes
147
+ ```
148
+ flex → layout="flex"
149
+ grid → layout="grid"
150
+ items-center → layout="items:center"
151
+ justify-between → layout="justify:between"
152
+ hidden → layout="hidden"
153
+ ```
154
+
155
+ ### Spacing Classes
156
+ ```
157
+ p-4 → space="p:small"
158
+ px-6 → space="p-x:small-3x"
159
+ mt-8 → space="m-t:medium"
160
+ gap-4 → space="gap:small"
161
+ w-full → space="w:full"
162
+ h-screen → space="h:screen"
163
+ ```
164
+
165
+ ### Visual Classes
166
+ ```
167
+ bg-blue-500 → visual="bg:blue-500"
168
+ text-white → visual="text:white"
169
+ rounded-lg → visual="rounded:medium"
170
+ shadow-md → visual="shadow:medium"
171
+ opacity-50 → visual="opacity:50"
172
+ ```
173
+
174
+ ### State Variants
175
+ ```
176
+ hover:bg-blue-600 → visual="hover:bg:blue-600"
177
+ focus:ring-2 → visual="focus:ring:regular"
178
+ active:scale-95 → visual="active:scale:95"
179
+ ```
180
+
181
+ ### Responsive Prefixes
182
+ ```
183
+ md:flex → layout="tab:flex"
184
+ lg:grid-cols-3 → layout="lap:cols:3"
185
+ xl:p-8 → space="desk:p:medium"
186
+ ```
187
+
188
+ Breakpoint mapping:
189
+ | Tailwind | SenangStart |
190
+ |----------|-------------|
191
+ | `sm` | `mob` |
192
+ | `md` | `tab` |
193
+ | `lg` | `lap` |
194
+ | `xl` | `desk` |
195
+
196
+ ## CDN Converter Usage
197
+
198
+ Load converter in browser:
199
+ ```html
200
+ <script src="https://unpkg.com/@bookklik/senangstart-css/dist/senangstart-tw.min.js"></script>
201
+ <script>
202
+ // Convert Tailwind classes
203
+ const result = SenangStartTW.convert('flex items-center p-4 bg-blue-500');
204
+ console.log(result);
205
+ // Output: { layout: 'flex items:center', space: 'p:small', visual: 'bg:blue-500' }
206
+ </script>
207
+ ```
208
+
209
+ ## Modifying Conversion Logic
210
+
211
+ ### Adding New Mappings
212
+
213
+ In `src/cdn/tw-conversion-engine.js`:
214
+
215
+ ```javascript
216
+ // Add to appropriate handler
217
+ function convertVisualClass(cls) {
218
+ // ADD: New class pattern
219
+ if (cls.startsWith('my-prefix-')) {
220
+ const value = cls.replace('my-prefix-', '');
221
+ return `my-utility:${myScale[value] || value}`;
222
+ }
223
+ // ... existing handlers
224
+ }
225
+ ```
226
+
227
+ ### Testing Conversions
228
+
229
+ ```bash
230
+ npm run test:unit # Includes convert-tailwind.test.js
231
+ ```
232
+
233
+ Test file: `tests/unit/convert-tailwind.test.js`
234
+
235
+ ## Common Conversion Challenges
236
+
237
+ ### Arbitrary Values
238
+ Tailwind's arbitrary values `[...]` are preserved:
239
+ ```
240
+ text-[#ff0000] → visual="text:[#ff0000]"
241
+ w-[200px] → space="w:[200px]"
242
+ ```
243
+
244
+ ### Compound Classes
245
+ Some Tailwind classes map to multiple SenangStart properties:
246
+ ```
247
+ divide-y → visual="divide-y:thin"
248
+ ring-2 → visual="ring:regular"
249
+ ```
250
+
251
+ ### Unsupported Classes
252
+ Classes without direct mapping are flagged:
253
+ ```
254
+ // In conversion output
255
+ /* UNMAPPED: prose lg:prose-xl */
256
+ ```
257
+
258
+ ## Best Practices
259
+
260
+ 1. **Run in semantic mode first** - Natural names are more maintainable
261
+ 2. **Use exact mode for gradual migration** - When you need pixel-perfect output
262
+ 3. **Check unmapped classes** - Some Tailwind plugins need manual conversion
263
+ 4. **Verify output** - Always test converted HTML in browser
264
+ 5. **Update scales if needed** - Extend SenangStart scales for custom Tailwind values
@@ -0,0 +1,155 @@
1
+ ---
2
+ description: Add new CSS utilities to the framework with definitions, engine, docs, and tests
3
+ ---
4
+
5
+ # Add New Utility Workflow
6
+
7
+ ## Overview
8
+
9
+ Adding a new utility requires updates to 4 areas:
10
+ 1. **Definition** - Single source of truth in `src/definitions/`
11
+ 2. **JIT Engine** - Runtime handler in `src/cdn/senangstart-engine.js`
12
+ 3. **Documentation** - Auto-generated via `npm run docs:generate`
13
+ 4. **Tests** - Unit tests in `tests/unit/`
14
+
15
+ ## Step 1: Create/Update Definition
16
+
17
+ 1. Identify the appropriate definition file:
18
+ - `layout-*.js` - Layout utilities
19
+ - `space.js` - Spacing utilities
20
+ - `visual-*.js` - Visual utilities
21
+
22
+ 2. Add the definition object:
23
+ ```javascript
24
+ export const myUtility = {
25
+ name: 'my-utility',
26
+ property: 'my-css-property',
27
+ category: 'visual', // layout | space | visual
28
+ attribute: 'visual', // Which HTML attribute
29
+ description: 'Does something useful',
30
+ descriptionMs: 'Melakukan sesuatu yang berguna',
31
+ syntax: 'my-utility:<value>',
32
+ values: [
33
+ { name: 'option1', value: 'css-value-1', description: 'Option 1' },
34
+ { name: 'option2', value: 'css-value-2', description: 'Option 2' }
35
+ ],
36
+ examples: [
37
+ { code: 'visual="my-utility:option1"', description: 'Example usage' }
38
+ ],
39
+ notes: 'Additional notes for documentation'
40
+ };
41
+ ```
42
+
43
+ 3. Export in the definition file and `src/definitions/index.js`
44
+
45
+ ## Step 2: Implement in JIT Engine
46
+
47
+ Edit `src/cdn/senangstart-engine.js`:
48
+
49
+ 1. Find the appropriate handler section (layout/space/visual)
50
+ 2. Add the utility pattern matching:
51
+
52
+ ```javascript
53
+ // In generateVisualRule or similar function
54
+ if (prop === 'my-utility') {
55
+ if (value === 'option1') return 'my-css-property: css-value-1';
56
+ if (value === 'option2') return 'my-css-property: css-value-2';
57
+ // Or with scales:
58
+ const scaleValue = config.theme.myScale?.[value];
59
+ if (scaleValue) return `my-css-property: ${scaleValue}`;
60
+ }
61
+ ```
62
+
63
+ 3. If using a new scale, add to `defaultConfig.theme`:
64
+ ```javascript
65
+ myScale: {
66
+ 'small': '4px',
67
+ 'medium': '8px',
68
+ 'big': '16px'
69
+ }
70
+ ```
71
+
72
+ ## Step 3: Generate Documentation
73
+
74
+ // turbo
75
+ 1. Auto-generate reference docs:
76
+ ```bash
77
+ npm run docs:generate
78
+ ```
79
+
80
+ 2. Verify output in:
81
+ - `docs/reference/<category>/<utility-name>.md`
82
+ - `docs/ms/reference/<category>/<utility-name>.md`
83
+
84
+ ## Step 4: Write Tests
85
+
86
+ 1. Add to existing test file or create new one in `tests/unit/`:
87
+
88
+ ```javascript
89
+ import { test, describe } from 'node:test';
90
+ import assert from 'node:assert';
91
+
92
+ describe('my-utility', () => {
93
+ test('generates correct CSS for option1', () => {
94
+ const result = generateVisualRule('my-utility', 'option1', config);
95
+ assert.strictEqual(result, 'my-css-property: css-value-1');
96
+ });
97
+ });
98
+ ```
99
+
100
+ // turbo
101
+ 2. Run tests:
102
+ ```bash
103
+ npm test
104
+ ```
105
+
106
+ ## Step 5: Rebuild Distribution
107
+
108
+ // turbo
109
+ 1. Rebuild to include changes:
110
+ ```bash
111
+ npm run build:dist
112
+ ```
113
+
114
+ ## Verification Checklist
115
+
116
+ - [ ] Definition has all required fields: `name`, `property`, `category`, `attribute`, `description`, `descriptionMs`, `syntax`, `values`, `examples`
117
+ - [ ] JIT engine handles all defined values
118
+ - [ ] Documentation generates correctly for EN and MS
119
+ - [ ] Tests pass
120
+ - [ ] Distribution builds successfully
121
+
122
+ ## Definition Required Fields
123
+
124
+ | Field | Type | Description |
125
+ |-------|------|-------------|
126
+ | `name` | string | Utility name (e.g., 'display', 'bg') |
127
+ | `property` | string/array | CSS property(s) affected |
128
+ | `category` | string | 'layout', 'space', or 'visual' |
129
+ | `attribute` | string | HTML attribute this belongs to |
130
+ | `description` | string | English description |
131
+ | `descriptionMs` | string | Malay description |
132
+ | `syntax` | string | Usage syntax pattern |
133
+ | `values` | array | Possible values with descriptions |
134
+ | `examples` | array | Usage examples |
135
+ | `notes` | string | (Optional) Extra documentation notes |
136
+
137
+ ## Common Patterns
138
+
139
+ **Boolean/Toggle Utility:**
140
+ ```javascript
141
+ values: [{ name: 'true', value: 'inherit', description: 'Enable' }]
142
+ ```
143
+
144
+ **Scale-Based Utility:**
145
+ ```javascript
146
+ values: Object.keys(theme.myScale).map(k => ({ name: k, ... }))
147
+ ```
148
+
149
+ **Arbitrary Value Support:**
150
+ ```javascript
151
+ // In JIT: Allow [value] pattern
152
+ if (value.startsWith('[') && value.endsWith(']')) {
153
+ return `my-property: ${value.slice(1, -1)}`;
154
+ }
155
+ ```
@@ -0,0 +1,97 @@
1
+ ---
2
+ description: Build distribution files and publish to npm
3
+ ---
4
+
5
+ # Build & Release Workflow
6
+
7
+ ## Build Distribution Files
8
+
9
+ // turbo
10
+ 1. Bundle JIT engine and TW converter:
11
+ ```bash
12
+ npm run build:dist
13
+ ```
14
+
15
+ This creates in `dist/`:
16
+ - `senangstart-css.js` - Unminified JIT engine
17
+ - `senangstart-css.min.js` - Minified JIT engine (~42KB)
18
+ - `senangstart-tw.js` - Unminified TW converter
19
+ - `senangstart-tw.min.js` - Minified TW converter
20
+
21
+ Also copies to `docs/public/assets/` for VitePress.
22
+
23
+ ## Full Production Build
24
+
25
+ 1. Build everything (dist + docs):
26
+ ```bash
27
+ npm run build
28
+ ```
29
+
30
+ Sequence:
31
+ 1. `build:dist` - Bundle JS files
32
+ 2. `docs:generate` - Generate reference docs
33
+ 3. `vitepress build docs` - Build static site
34
+ 4. `docs:llms` - Generate LLM context file
35
+
36
+ ## Pre-publish Verification
37
+
38
+ // turbo
39
+ 1. Run all tests before publishing:
40
+ ```bash
41
+ npm test
42
+ ```
43
+
44
+ 2. Verify build succeeds:
45
+ ```bash
46
+ npm run build:dist
47
+ ```
48
+
49
+ 3. Check package.json version is updated
50
+
51
+ ## Publish to npm
52
+
53
+ 1. Login to npm (if not already):
54
+ ```bash
55
+ npm login
56
+ ```
57
+
58
+ 2. Publish the package:
59
+ ```bash
60
+ npm publish
61
+ ```
62
+
63
+ Note: `prepublishOnly` script auto-runs `build:dist` before publish.
64
+
65
+ ## GitHub Pages Deployment
66
+
67
+ Deployment is automated via GitHub Actions (`.github/workflows/deploy-docs.yml`):
68
+
69
+ **Trigger**: Push to `master` branch or manual dispatch
70
+
71
+ **Steps**:
72
+ 1. Checkout code
73
+ 2. Setup Node.js 20
74
+ 3. Install dependencies (`npm ci`)
75
+ 4. Generate docs (`npm run docs:generate`)
76
+ 5. Build with VitePress (`npm run build`)
77
+ 6. Run tests (`npm test`)
78
+ 7. Deploy to GitHub Pages
79
+
80
+ ## Build Outputs
81
+
82
+ | File | Purpose | Size |
83
+ |------|---------|------|
84
+ | `dist/senangstart-css.min.js` | CDN distribution | ~42KB |
85
+ | `dist/senangstart-tw.min.js` | TW converter CDN | ~10KB |
86
+ | `docs/.vitepress/dist/` | Static docs site | - |
87
+
88
+ ## Version Bumping
89
+
90
+ Before release, update version in:
91
+ 1. `package.json` - Main version field
92
+ 2. `scripts/build-dist.js` - Banner comments (optional)
93
+
94
+ Semantic versioning:
95
+ - PATCH (0.2.x) - Bug fixes
96
+ - MINOR (0.x.0) - New features, backward compatible
97
+ - MAJOR (x.0.0) - Breaking changes
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Start development server with hot reload for docs or CLI watch mode
3
+ ---
4
+
5
+ # Development Workflow
6
+
7
+ ## Start Documentation Dev Server
8
+
9
+ // turbo
10
+ 1. Start VitePress dev server:
11
+ ```bash
12
+ npm run docs:dev
13
+ ```
14
+
15
+ This launches the documentation site at `http://localhost:5173` with hot reload.
16
+
17
+ ## CLI Watch Mode
18
+
19
+ // turbo
20
+ 1. Run the CLI in development watch mode:
21
+ ```bash
22
+ npm run dev
23
+ ```
24
+
25
+ Or using the CLI directly:
26
+ ```bash
27
+ senangstart dev
28
+ ```
29
+
30
+ Options:
31
+ - `--no-preflight` - Exclude Preflight base styles
32
+ - `--config <path>` - Custom config file path (default: `senangstart.config.js`)
33
+
34
+ ## Initialize New Project
35
+
36
+ 1. Create a new config file:
37
+ ```bash
38
+ senangstart init
39
+ ```
40
+
41
+ This generates `senangstart.config.js` in the current directory.
42
+
43
+ ## Testing Changes
44
+
45
+ After making changes to source files:
46
+ 1. The docs dev server will auto-reload for `docs/` changes
47
+ 2. For `src/` changes affecting JIT, rebuild with `npm run build:dist`
48
+ 3. Run tests to verify: `npm test`
49
+
50
+ ## Key Development Files
51
+
52
+ | Purpose | Location |
53
+ |---------|----------|
54
+ | JIT Engine | `src/cdn/senangstart-engine.js` |
55
+ | Definitions | `src/definitions/*.js` |
56
+ | CLI Commands | `src/cli/commands/*.js` |
57
+ | Compiler | `src/compiler/` |
58
+ | Config | `src/config/defaults.js` |
@@ -0,0 +1,113 @@
1
+ ---
2
+ description: Generate, build, and manage documentation from definitions
3
+ ---
4
+
5
+ // turbo-all
6
+
7
+ # Documentation Workflow
8
+
9
+ ## Generate Docs from Definitions
10
+
11
+ // turbo
12
+ 1. Auto-generate reference documentation from utility definitions:
13
+ ```bash
14
+ npm run docs:generate
15
+ ```
16
+
17
+ This reads `src/definitions/*.js` and generates markdown files in:
18
+ - `docs/reference/` (English)
19
+ - `docs/ms/reference/` (Malay)
20
+
21
+ Options:
22
+ - `--locale en|ms` - Generate for specific locale
23
+ - `--dry-run` - Preview without writing files
24
+
25
+ ## Check Doc Sync Status
26
+
27
+ // turbo
28
+ 1. Compare generated docs with definitions:
29
+ ```bash
30
+ npm run docs:sync-check
31
+ ```
32
+
33
+ ## Extract Syntax Reference
34
+
35
+ // turbo
36
+ 1. Generate syntax reference files:
37
+ ```bash
38
+ npm run docs:syntax
39
+ ```
40
+
41
+ Outputs:
42
+ - `docs/SYNTAX-REFERENCE.md`
43
+ - `docs/syntax-reference.json`
44
+
45
+ ## Generate LLM Context File
46
+
47
+ // turbo
48
+ 1. Build llms.txt for AI context:
49
+ ```bash
50
+ npm run docs:llms
51
+ ```
52
+
53
+ Creates `docs/public/llms.txt` with utility definitions.
54
+
55
+ ## Build Production Docs
56
+
57
+ 1. Full production build (includes dist + docs):
58
+ ```bash
59
+ npm run build
60
+ ```
61
+
62
+ This runs:
63
+ 1. `npm run build:dist` - Build distribution files
64
+ 2. `npm run docs:generate` - Generate reference docs
65
+ 3. `vitepress build docs` - Build VitePress site
66
+ 4. `npm run docs:llms` - Generate LLM file
67
+
68
+ ## Documentation Structure
69
+
70
+ ```
71
+ docs/
72
+ ├── .vitepress/ # VitePress config
73
+ ├── examples/ # Code examples
74
+ ├── guide/ # User guide pages
75
+ │ ├── getting-started.md
76
+ │ ├── philosophy.md
77
+ │ ├── tri-attribute.md
78
+ │ └── ...
79
+ ├── ms/ # Malay translations
80
+ │ └── reference/ # Auto-generated Malay docs
81
+ ├── public/ # Static assets
82
+ │ ├── assets/ # Bundled JS files
83
+ │ └── llms.txt # LLM context
84
+ └── reference/ # Auto-generated English docs
85
+ ├── layout/
86
+ ├── space/
87
+ └── visual/
88
+ ```
89
+
90
+ ## Adding New Documentation
91
+
92
+ ### Manual Guide Pages
93
+ 1. Create/edit markdown files in `docs/guide/`
94
+ 2. Update `docs/.vitepress/config.js` sidebar if needed
95
+
96
+ ### Auto-Generated Reference Pages
97
+ 1. Add/update definitions in `src/definitions/*.js`
98
+ 2. Run `npm run docs:generate`
99
+ 3. Verify with `npm run docs:sync-check`
100
+
101
+ ## Localization
102
+
103
+ Definitions include both English and Malay descriptions:
104
+ ```javascript
105
+ {
106
+ name: 'display',
107
+ description: 'Controls element display type',
108
+ descriptionMs: 'Mengawal jenis paparan elemen',
109
+ // ...
110
+ }
111
+ ```
112
+
113
+ The generator automatically uses the appropriate description for each locale.