@jxsuite/schema
v1.0.0
Published
JSON Schema 2020-12 meta-schema generator for Jx documents
Readme
@jxsuite/schema
JSON Schema 2020-12 meta-schema generator for Jx documents.
Overview
@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.
Installation
bun add @jxsuite/schemaGenerated schemas
| File | $id | Validates |
| --------------------- | --------------------------------------- | ------------------------------- |
| schema.json | https://jxsuite.com/schema/v1 | Components, pages, and layouts |
| project-schema.json | https://jxsuite.com/schema/project/v1 | project.json config files |
| class-schema.json | https://jxsuite.com/schema/class/v1 | .class.json class definitions |
Regenerating schemas
bun run schemaThis re-fetches the latest @webref/css, @webref/elements, and @webref/idl data and writes all three files.
API
import {
generateSchema,
generateProjectSchema,
generateClassSchema,
validateDocument,
} from "@jxsuite/schema";
const schema = await generateSchema(); // component meta-schema object
const valid = await validateDocument(doc); // validate a Jx documentComponent schema coverage
tagName— all standard HTML element names from@webref/elements- Element properties — all DOM IDL properties from
@webref/idl style— all CSSOM camelCase properties from@webref/css- Event handlers — all
EventHandlernames (onclick,oninput, …) stateshapes — naked value, typed value, computed, function, external class- Built-in
$prototypevalues —Request,LocalStorage,SessionStorage,Cookie,IndexedDB,Array,Set,Map,Blob,ReadableStream,URLSearchParams,FormData
VSCode / editor integration
Add the $schema field to any Jx file to get autocomplete and validation in any JSON Schema-aware editor:
{ "$schema": "https://jxsuite.com/schema/v1" }Dependencies
| Package | Purpose |
| ------------------ | ----------------------------- |
| @webref/css | CSS property definitions |
| @webref/elements | HTML element definitions |
| @webref/idl | Web IDL interface definitions |
License
MIT
