@jxsuite/schema 0.10.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# `@jxsuite/schema`
|
|
2
|
+
|
|
3
|
+
> JSON Schema 2020-12 meta-schema generator for Jx documents.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@jxsuite/schema` generates three validator schemas that cover every Jx source file type. The component schema is derived at generation time from web standards data, ensuring it stays current with browser capabilities.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bun add @jxsuite/schema
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Generated schemas
|
|
16
|
+
|
|
17
|
+
| File | `$id` | Validates |
|
|
18
|
+
| --------------------- | --------------------------------------- | ------------------------------- |
|
|
19
|
+
| `schema.json` | `https://jxsuite.com/schema/v1` | Components, pages, and layouts |
|
|
20
|
+
| `project-schema.json` | `https://jxsuite.com/schema/project/v1` | `project.json` config files |
|
|
21
|
+
| `class-schema.json` | `https://jxsuite.com/schema/class/v1` | `.class.json` class definitions |
|
|
22
|
+
|
|
23
|
+
## Regenerating schemas
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bun run schema
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This re-fetches the latest `@webref/css`, `@webref/elements`, and `@webref/idl` data and writes all three files.
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import {
|
|
35
|
+
generateSchema,
|
|
36
|
+
generateProjectSchema,
|
|
37
|
+
generateClassSchema,
|
|
38
|
+
validateDocument,
|
|
39
|
+
} from "@jxsuite/schema";
|
|
40
|
+
|
|
41
|
+
const schema = await generateSchema(); // component meta-schema object
|
|
42
|
+
const valid = await validateDocument(doc); // validate a Jx document
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Component schema coverage
|
|
46
|
+
|
|
47
|
+
- **`tagName`** — all standard HTML element names from `@webref/elements`
|
|
48
|
+
- **Element properties** — all DOM IDL properties from `@webref/idl`
|
|
49
|
+
- **`style`** — all CSSOM camelCase properties from `@webref/css`
|
|
50
|
+
- **Event handlers** — all `EventHandler` names (`onclick`, `oninput`, …)
|
|
51
|
+
- **`state` shapes** — naked value, typed value, computed, function, external class
|
|
52
|
+
- **Built-in `$prototype` values** — `Request`, `LocalStorage`, `SessionStorage`, `Cookie`, `IndexedDB`, `Array`, `Set`, `Map`, `Blob`, `ReadableStream`, `URLSearchParams`, `FormData`
|
|
53
|
+
|
|
54
|
+
## VSCode / editor integration
|
|
55
|
+
|
|
56
|
+
Add the `$schema` field to any Jx file to get autocomplete and validation in any JSON Schema-aware editor:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{ "$schema": "https://jxsuite.com/schema/v1" }
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Dependencies
|
|
63
|
+
|
|
64
|
+
| Package | Purpose |
|
|
65
|
+
| ------------------ | ----------------------------- |
|
|
66
|
+
| `@webref/css` | CSS property definitions |
|
|
67
|
+
| `@webref/elements` | HTML element definitions |
|
|
68
|
+
| `@webref/idl` | Web IDL interface definitions |
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
package/package.json
CHANGED