@jxsuite/schema 0.10.1 → 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 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
@@ -29,5 +29,5 @@
29
29
  "upgrade": "bunx npm-check-updates -u && bun install"
30
30
  },
31
31
  "type": "module",
32
- "version": "0.10.1"
32
+ "version": "0.11.0"
33
33
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://jxsuite.com/schema/project/v1",
4
4
  "title": "Jx Project",
5
- "description": "Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, content collections, and build configuration.",
5
+ "description": "Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, content types, and build configuration.",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "name": {
@@ -160,8 +160,8 @@
160
160
  "description": "Site-wide reactive state available to all pages.",
161
161
  "type": "object"
162
162
  },
163
- "collections": {
164
- "description": "Content collection definitions. Each key is a collection name; the value defines the source glob, frontmatter schema, and element dependencies.",
163
+ "contentTypes": {
164
+ "description": "Content type definitions. Each key is a content type name; the value defines the source glob, frontmatter schema, and element dependencies.",
165
165
  "type": "object",
166
166
  "additionalProperties": {
167
167
  "type": "object",
@@ -175,11 +175,11 @@
175
175
  ]
176
176
  },
177
177
  "schema": {
178
- "description": "JSON Schema for validating frontmatter of collection entries.",
178
+ "description": "JSON Schema for validating frontmatter of content type entries.",
179
179
  "type": "object"
180
180
  },
181
181
  "$elements": {
182
- "description": "Custom elements available in markdown directives for this collection.",
182
+ "description": "Custom elements available in markdown directives for this content type.",
183
183
  "type": "array",
184
184
  "items": {
185
185
  "oneOf": [
package/src/schema.js CHANGED
@@ -1022,7 +1022,7 @@ export function generateProjectSchema() {
1022
1022
  description:
1023
1023
  "Schema for Jx project.json files. " +
1024
1024
  "A project.json file is the root anchor file for a Jx project, " +
1025
- "declaring site metadata, default settings, global styles, content collections, " +
1025
+ "declaring site metadata, default settings, global styles, content types, " +
1026
1026
  "and build configuration.",
1027
1027
  type: "object",
1028
1028
 
@@ -1141,9 +1141,9 @@ export function generateProjectSchema() {
1141
1141
  description: "Site-wide reactive state available to all pages.",
1142
1142
  type: "object",
1143
1143
  },
1144
- collections: {
1144
+ contentTypes: {
1145
1145
  description:
1146
- "Content collection definitions. Each key is a collection name; " +
1146
+ "Content type definitions. Each key is a content type name; " +
1147
1147
  "the value defines the source glob, frontmatter schema, and element dependencies.",
1148
1148
  type: "object",
1149
1149
  additionalProperties: {
@@ -1155,11 +1155,12 @@ export function generateProjectSchema() {
1155
1155
  examples: ["./blog/**/*.md", "./docs/**/*.md"],
1156
1156
  },
1157
1157
  schema: {
1158
- description: "JSON Schema for validating frontmatter of collection entries.",
1158
+ description: "JSON Schema for validating frontmatter of content type entries.",
1159
1159
  type: "object",
1160
1160
  },
1161
1161
  $elements: {
1162
- description: "Custom elements available in markdown directives for this collection.",
1162
+ description:
1163
+ "Custom elements available in markdown directives for this content type.",
1163
1164
  type: "array",
1164
1165
  items: {
1165
1166
  oneOf: [