@mindfiredigital/ignix-lite-engine 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +22 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +283 -0
- package/dist/index.d.ts +171 -0
- package/dist/index.js +2540 -0
- package/dist/index.js.map +1 -0
- package/dist/manifests/accordion.json +61 -0
- package/dist/manifests/alert.json +69 -0
- package/dist/manifests/avatar.json +75 -0
- package/dist/manifests/badge.json +74 -0
- package/dist/manifests/breadcrumb.json +87 -0
- package/dist/manifests/button.json +85 -0
- package/dist/manifests/card.json +91 -0
- package/dist/manifests/checkbox.json +122 -0
- package/dist/manifests/codeblock.json +63 -0
- package/dist/manifests/combobox.json +33 -0
- package/dist/manifests/dialog.json +64 -0
- package/dist/manifests/divider.json +47 -0
- package/dist/manifests/dropdown.json +105 -0
- package/dist/manifests/form.json +81 -0
- package/dist/manifests/grid.json +143 -0
- package/dist/manifests/input.json +99 -0
- package/dist/manifests/meter.json +103 -0
- package/dist/manifests/navigation.json +70 -0
- package/dist/manifests/progress.json +88 -0
- package/dist/manifests/radio.json +121 -0
- package/dist/manifests/select.json +109 -0
- package/dist/manifests/skeleton.json +101 -0
- package/dist/manifests/tab.json +88 -0
- package/dist/manifests/table.json +92 -0
- package/dist/manifests/textarea.json +117 -0
- package/dist/manifests/toast.json +157 -0
- package/dist/manifests/tooltip.json +115 -0
- package/dist/vector-index.json +14015 -0
- package/package.json +33 -0
- package/src/global.d.ts +3 -0
- package/src/index.ts +14 -0
- package/src/manifests/accordion.json +61 -0
- package/src/manifests/alert.json +69 -0
- package/src/manifests/avatar.json +75 -0
- package/src/manifests/badge.json +74 -0
- package/src/manifests/breadcrumb.json +87 -0
- package/src/manifests/button.json +85 -0
- package/src/manifests/card.json +91 -0
- package/src/manifests/checkbox.json +122 -0
- package/src/manifests/codeblock.json +63 -0
- package/src/manifests/combobox.json +33 -0
- package/src/manifests/dialog.json +64 -0
- package/src/manifests/divider.json +47 -0
- package/src/manifests/dropdown.json +105 -0
- package/src/manifests/form.json +81 -0
- package/src/manifests/grid.json +143 -0
- package/src/manifests/index.ts +49 -0
- package/src/manifests/input.json +99 -0
- package/src/manifests/meter.json +103 -0
- package/src/manifests/navigation.json +70 -0
- package/src/manifests/progress.json +88 -0
- package/src/manifests/radio.json +121 -0
- package/src/manifests/select.json +109 -0
- package/src/manifests/skeleton.json +101 -0
- package/src/manifests/tab.json +88 -0
- package/src/manifests/table.json +92 -0
- package/src/manifests/textarea.json +117 -0
- package/src/manifests/toast.json +157 -0
- package/src/manifests/tooltip.json +115 -0
- package/src/tools/build-index.ts +43 -0
- package/src/tools/check-a11y.ts +96 -0
- package/src/tools/embedder.ts +18 -0
- package/src/tools/generate-theme.ts +42 -0
- package/src/tools/get-emmet.ts +64 -0
- package/src/tools/get-manifests.ts +55 -0
- package/src/tools/handoff.ts +302 -0
- package/src/tools/intent-engine.ts +215 -0
- package/src/tools/list-components.ts +20 -0
- package/src/tools/preview.ts +186 -0
- package/src/tools/search-index.ts +82 -0
- package/src/tools/theme-palette.ts +65 -0
- package/src/tools/theme-tokens.ts +176 -0
- package/src/tools/token-counter.ts +59 -0
- package/src/tools/validator.ts +353 -0
- package/src/types.ts +63 -0
- package/src/utils/a11y-rules.ts +873 -0
- package/src/utils/a11y-types.ts +15 -0
- package/src/utils/cosine.ts +15 -0
- package/src/utils/emmet-helpers.ts +283 -0
- package/src/utils/intent-helpers.ts +66 -0
- package/src/utils/intent-parser.ts +175 -0
- package/src/utils/tokenizer.ts +7 -0
- package/tsconfig.json +17 -0
- package/tsup.config.ts +10 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
> @mindfiredigital/ignix-lite-engine@1.1.0 build /home/runner/work/ignix-lite/ignix-lite/packages/engine
|
|
3
|
+
> tsup && copyfiles -u 2 src/manifests/*.json dist/manifests && pnpm build:index
|
|
4
|
+
|
|
5
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
+
[34mCLI[39m tsup v8.5.1
|
|
8
|
+
[34mCLI[39m Using tsup config: /home/runner/work/ignix-lite/ignix-lite/packages/engine/tsup.config.ts
|
|
9
|
+
[34mCLI[39m Target: es2022
|
|
10
|
+
[34mCLI[39m Cleaning output folder
|
|
11
|
+
[34mESM[39m Build start
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m76.59 KB[39m
|
|
13
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m145.43 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 112ms
|
|
15
|
+
[34mDTS[39m Build start
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4433ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.32 KB[39m
|
|
18
|
+
|
|
19
|
+
> @mindfiredigital/ignix-lite-engine@1.1.0 build:index /home/runner/work/ignix-lite/ignix-lite/packages/engine
|
|
20
|
+
> tsx src/tools/build-index.ts
|
|
21
|
+
|
|
22
|
+
Vector index built
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mindfire-test
|
|
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,283 @@
|
|
|
1
|
+
# @mindfiredigital/ignix-lite-engine
|
|
2
|
+
|
|
3
|
+
> The core rules engine powering [Ignix-Lite](https://github.com/mindfiredigital/ignix-lite) — intent resolution, HTML validation, accessibility auditing, theming, component manifests, and visual preview rendering.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@mindfiredigital/ignix-lite-engine)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## What is the Engine?
|
|
11
|
+
|
|
12
|
+
`@mindfiredigital/ignix-lite-engine` is the shared logic layer consumed by both the **CLI** and the **MCP server**. It exposes a set of standalone async functions that you can also use directly in your own tooling, scripts, or Node.js applications.
|
|
13
|
+
|
|
14
|
+
It requires **no external AI API** — all intelligence is local and deterministic.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @mindfiredigital/ignix-lite-engine
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## API Reference
|
|
27
|
+
|
|
28
|
+
### `howToBuild(description: string)`
|
|
29
|
+
|
|
30
|
+
Converts a plain English description into the best-fit Ignix-Lite Emmet shorthand and full HTML. Uses a two-layer intent engine — a hand-crafted pattern table (fast, deterministic) with a vector-index fallback for novel descriptions.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { howToBuild } from '@mindfiredigital/ignix-lite-engine'
|
|
34
|
+
|
|
35
|
+
const result = await howToBuild('a danger button that says Delete')
|
|
36
|
+
const { emmet, html, components_used, confidence, source } = JSON.parse(result.content[0].text)
|
|
37
|
+
|
|
38
|
+
// emmet: "button[data-intent=danger]{Delete}"
|
|
39
|
+
// html: "<button data-intent=\"danger\">Delete</button>"
|
|
40
|
+
// source: "intent-table"
|
|
41
|
+
// confidence: 0.75
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Response fields:**
|
|
45
|
+
|
|
46
|
+
| Field | Type | Description |
|
|
47
|
+
|-------|------|-------------|
|
|
48
|
+
| `emmet` | `string` | Emmet shorthand for the generated UI |
|
|
49
|
+
| `html` | `string` | Expanded full HTML |
|
|
50
|
+
| `components_used` | `string[]` | List of Ignix-Lite component names used |
|
|
51
|
+
| `confidence` | `number` | Match confidence score (0–1) |
|
|
52
|
+
| `source` | `string` | Which layer matched: `intent-table`, `vector-index`, or `no-match` |
|
|
53
|
+
| `tokens` | `number` | Token count of the output |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### `validateHtml(html: string)`
|
|
58
|
+
|
|
59
|
+
Validates HTML markup against Ignix-Lite design rules. Checks for forbidden patterns (`class=`, `color=`, `variant=`), missing required attributes, and incorrect component usage.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { validateHtml } from '@mindfiredigital/ignix-lite-engine'
|
|
63
|
+
|
|
64
|
+
const result = validateHtml('<button class="btn-danger">Delete</button>')
|
|
65
|
+
|
|
66
|
+
console.log(result.valid) // false
|
|
67
|
+
console.log(result.score) // 60
|
|
68
|
+
console.log(result.errors)
|
|
69
|
+
// [{ line: 1, element: 'button', message: 'Use data-intent instead of class', fix: '...' }]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Response fields:**
|
|
73
|
+
|
|
74
|
+
| Field | Type | Description |
|
|
75
|
+
|-------|------|-------------|
|
|
76
|
+
| `valid` | `boolean` | `true` if no violations found |
|
|
77
|
+
| `score` | `number` | Score out of 100 |
|
|
78
|
+
| `errors` | `array` | List of `{ line, element, message, fix }` objects |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### `auditA11y(html: string)`
|
|
83
|
+
|
|
84
|
+
Audits HTML for WCAG 2.2 AA accessibility issues. Checks 15+ rules including missing `alt`, missing `aria-label`, unlabelled inputs, missing `role`, and more.
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { auditA11y } from '@mindfiredigital/ignix-lite-engine'
|
|
88
|
+
|
|
89
|
+
const result = auditA11y('<img src="avatar.png">')
|
|
90
|
+
|
|
91
|
+
console.log(result.score) // 80
|
|
92
|
+
console.log(result.wcag) // "AA"
|
|
93
|
+
console.log(result.issues)
|
|
94
|
+
// [{ rule: 'missing-alt', type: 'error', element: '<img>', message: '...', fix: '...' }]
|
|
95
|
+
console.log(result.passes) // ['has-lang', 'button-has-text', ...]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### `resolveTokens(query: string)` + `buildCss(tokens)`
|
|
101
|
+
|
|
102
|
+
Resolves a theme from a plain English prompt or hex color and builds a `:root` CSS variable block.
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { resolveTokens, buildCss } from '@mindfiredigital/ignix-lite-engine'
|
|
106
|
+
|
|
107
|
+
const tokens = resolveTokens('dark blue modern')
|
|
108
|
+
const css = buildCss(tokens)
|
|
109
|
+
|
|
110
|
+
// css:
|
|
111
|
+
// /* Ignix-Lite Custom Theme Variables */
|
|
112
|
+
// :root {
|
|
113
|
+
// --ix-primary: #1e40af;
|
|
114
|
+
// --ix-primary-hover: ...
|
|
115
|
+
// }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### `generateTheme(prompt: string)`
|
|
121
|
+
|
|
122
|
+
Higher-level theme generator that returns a full MCP-compatible response with the CSS string.
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { generateTheme } from '@mindfiredigital/ignix-lite-engine'
|
|
126
|
+
|
|
127
|
+
const result = await generateTheme('earthy green tones')
|
|
128
|
+
const { css } = JSON.parse(result.content[0].text)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### `preview(args: PreviewArgs)`
|
|
134
|
+
|
|
135
|
+
Renders Emmet shorthand or HTML in a headless browser (Playwright) and returns a base64 PNG screenshot.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import { preview } from '@mindfiredigital/ignix-lite-engine'
|
|
139
|
+
|
|
140
|
+
const result = await preview({
|
|
141
|
+
input: '<button data-intent="primary">Save</button>',
|
|
142
|
+
options: { width: 400, theme: 'dark' }
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const { png } = JSON.parse(result.content[0].text)
|
|
146
|
+
// png: "data:image/png;base64,..."
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**`PreviewOptions`:**
|
|
150
|
+
|
|
151
|
+
| Option | Type | Default | Description |
|
|
152
|
+
|--------|------|---------|-------------|
|
|
153
|
+
| `width` | `number` | `400` | Viewport width in pixels |
|
|
154
|
+
| `theme` | `'light' \| 'dark'` | system | Emulated color scheme |
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### `listComponents()`
|
|
159
|
+
|
|
160
|
+
Returns the list of all 27 available Ignix-Lite components.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
import { listComponents } from '@mindfiredigital/ignix-lite-engine'
|
|
164
|
+
|
|
165
|
+
const result = await listComponents()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### `getManifest(name: string)`
|
|
171
|
+
|
|
172
|
+
Returns the full JSON manifest for a component — props, slots, do/don't rules, and Emmet pattern.
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import { getManifest } from '@mindfiredigital/ignix-lite-engine'
|
|
176
|
+
|
|
177
|
+
const result = await getManifest('button')
|
|
178
|
+
const manifest = JSON.parse(result.content[0].text)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### `getEmmet(name: string)`
|
|
184
|
+
|
|
185
|
+
Returns the default Emmet shorthand for a component.
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
import { getEmmet } from '@mindfiredigital/ignix-lite-engine'
|
|
189
|
+
|
|
190
|
+
const result = await getEmmet('tooltip')
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### `createHandoff(rendered_html: string, metadata?: object)` + `applyHandoff(id, changes)`
|
|
196
|
+
|
|
197
|
+
Multi-agent handoff protocol. Lets multiple AI agents exchange, modify, and patch a shared layout snapshot using lightweight selector diffs.
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import { createHandoff, applyHandoff } from '@mindfiredigital/ignix-lite-engine'
|
|
201
|
+
|
|
202
|
+
const handoff = await createHandoff('<form>...</form>')
|
|
203
|
+
const { handoff_id } = JSON.parse(handoff.content[0].text)
|
|
204
|
+
|
|
205
|
+
const patched = await applyHandoff(handoff_id, [
|
|
206
|
+
{ selector: 'button', attribute: 'data-intent', value: 'danger' }
|
|
207
|
+
])
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
### `getTokenSummary(context_window?: number)`
|
|
213
|
+
|
|
214
|
+
Returns token consumption stats for the current session — useful for tracking agent context budget.
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
import { getTokenSummary } from '@mindfiredigital/ignix-lite-engine'
|
|
218
|
+
|
|
219
|
+
const result = await getTokenSummary(128000)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## All Exports
|
|
225
|
+
|
|
226
|
+
```ts
|
|
227
|
+
export { howToBuild } // Intent → UI
|
|
228
|
+
export { validateHtml, ValidationError } // HTML validation
|
|
229
|
+
export { auditA11y } // Accessibility audit
|
|
230
|
+
export { resolveTokens, buildCss, ThemeTokens }// Theme resolution
|
|
231
|
+
export { resolveColor } // Color utilities
|
|
232
|
+
export { generateTheme } // Full theme generator
|
|
233
|
+
export { preview, PreviewArgs, PreviewOptions }// Headless PNG render
|
|
234
|
+
export { createHandoff, applyHandoff } // Multi-agent handoff
|
|
235
|
+
export { listComponents } // Component list
|
|
236
|
+
export { getManifest } // Component manifest
|
|
237
|
+
export { getEmmet } // Emmet pattern
|
|
238
|
+
export { getTokenSummary, recordCall } // Token tracking
|
|
239
|
+
export { manifests } // Raw manifest data
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Architecture
|
|
245
|
+
|
|
246
|
+
The engine is a **zero-dependency-on-AI** local inference stack:
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
description (text)
|
|
250
|
+
│
|
|
251
|
+
▼
|
|
252
|
+
┌─────────────────────────┐
|
|
253
|
+
│ Layer 1: Intent Table │ ~40 hand-crafted patterns, scored by keyword matching
|
|
254
|
+
│ (intent-engine.ts) │ Fast, deterministic, high confidence
|
|
255
|
+
└────────────┬────────────┘
|
|
256
|
+
│ no match / low confidence
|
|
257
|
+
▼
|
|
258
|
+
┌─────────────────────────┐
|
|
259
|
+
│ Layer 2: Vector Index │ Local tf-idf cosine similarity
|
|
260
|
+
│ (search-index.ts) │ Semantic fallback, no API key needed
|
|
261
|
+
└────────────┬────────────┘
|
|
262
|
+
│
|
|
263
|
+
▼
|
|
264
|
+
┌─────────────────────────┐
|
|
265
|
+
│ interpolateEmmet() │ Injects intent, size, shape, quoted labels
|
|
266
|
+
│ (emmet-helpers.ts) │ into the matched Emmet template
|
|
267
|
+
└─────────────────────────┘
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Related Packages
|
|
273
|
+
|
|
274
|
+
| Package | Description |
|
|
275
|
+
|---------|-------------|
|
|
276
|
+
| [`@mindfiredigital/ignix-lite-cli`](../cli) | CLI tool — init, build, validate, theme, preview, mcp |
|
|
277
|
+
| [`@mindfiredigital/ignix-lite-mcp`](../mcp) | MCP server exposing all engine tools to AI editors |
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## License
|
|
282
|
+
|
|
283
|
+
MIT © [Mindfire Digital](https://www.mindfiredigital.com)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
type ToolName = 'list_components' | 'get_manifest' | 'get_emmet' | 'validate';
|
|
2
|
+
type ToolRequest = {
|
|
3
|
+
params: {
|
|
4
|
+
name: ToolName;
|
|
5
|
+
arguments?: unknown;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
type MCPResponse = {
|
|
9
|
+
content: {
|
|
10
|
+
type: 'text';
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
type ManifestProp = {
|
|
15
|
+
type: string;
|
|
16
|
+
values?: string[];
|
|
17
|
+
default?: string | boolean;
|
|
18
|
+
native?: boolean;
|
|
19
|
+
agent_hint?: string;
|
|
20
|
+
};
|
|
21
|
+
type ManifestSlot = {
|
|
22
|
+
required: boolean;
|
|
23
|
+
element: string[];
|
|
24
|
+
agent_hint?: string;
|
|
25
|
+
};
|
|
26
|
+
type ManifestExample = {
|
|
27
|
+
label: string;
|
|
28
|
+
emmet: string;
|
|
29
|
+
html: string;
|
|
30
|
+
};
|
|
31
|
+
type Manifest = {
|
|
32
|
+
component: string;
|
|
33
|
+
version: string;
|
|
34
|
+
description: string;
|
|
35
|
+
element: string;
|
|
36
|
+
emmet: string;
|
|
37
|
+
tokens: number;
|
|
38
|
+
props: Record<string, ManifestProp>;
|
|
39
|
+
slots?: Record<string, ManifestSlot>;
|
|
40
|
+
states?: string[];
|
|
41
|
+
forbidden_props?: string[];
|
|
42
|
+
required_props?: string[];
|
|
43
|
+
required_slots?: string[];
|
|
44
|
+
required_wrapper?: string;
|
|
45
|
+
methods?: string[];
|
|
46
|
+
do?: string[];
|
|
47
|
+
dont?: string[];
|
|
48
|
+
examples?: ManifestExample[];
|
|
49
|
+
extends?: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
declare const manifests: Record<string, Manifest>;
|
|
53
|
+
|
|
54
|
+
type ErrorType = 'UNKNOWN_ATTRIBUTE' | 'INVALID_VALUE' | 'FORBIDDEN_CLASS' | 'MISSING_REQUIRED' | 'WRONG_ELEMENT' | 'PROP_EXPLOSION' | 'JS_ON_CSS_COMPONENT' | 'MISSING_SLOT';
|
|
55
|
+
type ValidationError = {
|
|
56
|
+
element: string;
|
|
57
|
+
prop: string;
|
|
58
|
+
type: ErrorType;
|
|
59
|
+
message: string;
|
|
60
|
+
suggestion?: string;
|
|
61
|
+
valid_values?: string[];
|
|
62
|
+
fix: string;
|
|
63
|
+
confidence: number;
|
|
64
|
+
line: number;
|
|
65
|
+
};
|
|
66
|
+
declare function validateHtml(html: string): {
|
|
67
|
+
valid: boolean;
|
|
68
|
+
score: number;
|
|
69
|
+
errors: ValidationError[];
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type IssueType = 'error' | 'warning';
|
|
73
|
+
interface A11yIssue {
|
|
74
|
+
type: IssueType;
|
|
75
|
+
rule: string;
|
|
76
|
+
element: string;
|
|
77
|
+
message: string;
|
|
78
|
+
fix: string;
|
|
79
|
+
confidence?: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare function auditA11y(html: string): {
|
|
83
|
+
score: number;
|
|
84
|
+
passes: string[];
|
|
85
|
+
issues: A11yIssue[];
|
|
86
|
+
wcag: string;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
interface ThemeTokens {
|
|
90
|
+
primary: string;
|
|
91
|
+
primaryHover: string;
|
|
92
|
+
primaryContrast: string;
|
|
93
|
+
primaryBg: string;
|
|
94
|
+
danger: string;
|
|
95
|
+
dangerText: string;
|
|
96
|
+
dangerBg: string;
|
|
97
|
+
warning: string;
|
|
98
|
+
warningBg: string;
|
|
99
|
+
success: string;
|
|
100
|
+
successBg: string;
|
|
101
|
+
infoBg: string;
|
|
102
|
+
neutral: string;
|
|
103
|
+
divider: string;
|
|
104
|
+
surface: string;
|
|
105
|
+
surfaceRaised: string;
|
|
106
|
+
text: string;
|
|
107
|
+
textMuted: string;
|
|
108
|
+
border: string;
|
|
109
|
+
radius: string;
|
|
110
|
+
radiusLg: string;
|
|
111
|
+
badgeRadius: string;
|
|
112
|
+
skeletonBg: string;
|
|
113
|
+
skeletonShimmer: string;
|
|
114
|
+
gradientStart: string;
|
|
115
|
+
gradientEnd: string;
|
|
116
|
+
gradientBgEnd: string;
|
|
117
|
+
isDark: boolean;
|
|
118
|
+
resolvedPrimary: string;
|
|
119
|
+
resolvedContrast: string;
|
|
120
|
+
}
|
|
121
|
+
declare function resolveTokens(query: string): ThemeTokens;
|
|
122
|
+
declare function buildCss(t: ThemeTokens): string;
|
|
123
|
+
|
|
124
|
+
interface ColorEntry {
|
|
125
|
+
primary: string;
|
|
126
|
+
contrast: string;
|
|
127
|
+
}
|
|
128
|
+
declare function resolveColor(query: string): ColorEntry;
|
|
129
|
+
|
|
130
|
+
declare function howToBuild(description: string): Promise<MCPResponse>;
|
|
131
|
+
|
|
132
|
+
type PreviewOptions = {
|
|
133
|
+
width?: number;
|
|
134
|
+
theme?: string;
|
|
135
|
+
scale?: number;
|
|
136
|
+
};
|
|
137
|
+
type PreviewArgs = {
|
|
138
|
+
input: string;
|
|
139
|
+
options?: PreviewOptions;
|
|
140
|
+
};
|
|
141
|
+
declare function preview(args: PreviewArgs): Promise<MCPResponse>;
|
|
142
|
+
|
|
143
|
+
declare function createHandoff(args: {
|
|
144
|
+
rendered_html: string;
|
|
145
|
+
metadata?: Record<string, unknown>;
|
|
146
|
+
}): MCPResponse;
|
|
147
|
+
interface HandoffChange {
|
|
148
|
+
selector: string;
|
|
149
|
+
action: 'update' | 'add' | 'remove';
|
|
150
|
+
emmet?: string;
|
|
151
|
+
html?: string;
|
|
152
|
+
}
|
|
153
|
+
declare function applyHandoff(args: {
|
|
154
|
+
handoff_id: string;
|
|
155
|
+
changes: HandoffChange[];
|
|
156
|
+
}): MCPResponse;
|
|
157
|
+
|
|
158
|
+
declare function generateTheme(args: unknown): MCPResponse;
|
|
159
|
+
|
|
160
|
+
declare function getEmmet(args: unknown): MCPResponse;
|
|
161
|
+
|
|
162
|
+
declare function getManifest(args: unknown): MCPResponse;
|
|
163
|
+
|
|
164
|
+
declare function listComponents(): MCPResponse;
|
|
165
|
+
|
|
166
|
+
declare function recordCall(toolName: string, tokensUsed: number): void;
|
|
167
|
+
declare function getTokenSummary(args?: {
|
|
168
|
+
context_window?: number;
|
|
169
|
+
}): MCPResponse;
|
|
170
|
+
|
|
171
|
+
export { type MCPResponse, type Manifest, type ManifestExample, type ManifestProp, type ManifestSlot, type PreviewArgs, type PreviewOptions, type ThemeTokens, type ToolName, type ToolRequest, type ValidationError, applyHandoff, auditA11y, buildCss, createHandoff, generateTheme, getEmmet, getManifest, getTokenSummary, howToBuild, listComponents, manifests, preview, recordCall, resolveColor, resolveTokens, validateHtml };
|