@jxsuite/schema 0.23.1 → 0.24.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/defs/cem.schema.ts +30 -0
- package/defs/children-value.schema.ts +28 -0
- package/defs/class-def.schema.ts +169 -0
- package/defs/content-type-def.schema.ts +34 -0
- package/defs/element-def.schema.ts +98 -0
- package/defs/expression-node.schema.ts +140 -0
- package/defs/external-class-def.schema.ts +107 -0
- package/defs/function-def.schema.ts +59 -0
- package/defs/head-entry.schema.ts +17 -0
- package/defs/image-config.schema.ts +20 -0
- package/defs/index.ts +76 -0
- package/defs/json-schema-type.schema.ts +4 -0
- package/defs/project-config.schema.ts +199 -0
- package/defs/pure-type-def.schema.ts +26 -0
- package/defs/ref-object.schema.ts +70 -0
- package/defs/state-entry.schema.ts +54 -0
- package/defs/string-or-ref.schema.ts +11 -0
- package/defs/style-object.schema.ts +19 -0
- package/defs/tag-name.schema.ts +6 -0
- package/defs/typed-state-def.schema.ts +31 -0
- package/package.json +12 -5
- package/project-schema.json +105 -39
- package/schema.json +610 -479
- package/src/schema.ts +529 -0
- package/types.ts +236 -0
- package/src/schema.js +0 -1661
package/types.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { FromSchema } from "json-schema-to-ts";
|
|
2
|
+
|
|
3
|
+
import { headEntrySchema } from "./defs/head-entry.schema";
|
|
4
|
+
import { imageConfigSchema } from "./defs/image-config.schema";
|
|
5
|
+
import { cemParameterSchema, cemEventSchema } from "./defs/cem.schema";
|
|
6
|
+
import { contentTypeDefSchema } from "./defs/content-type-def.schema";
|
|
7
|
+
import { projectConfigSchema } from "./defs/project-config.schema";
|
|
8
|
+
import { refObjectSchema } from "./defs/ref-object.schema";
|
|
9
|
+
import { styleObjectSchema } from "./defs/style-object.schema";
|
|
10
|
+
import { elementDefSchema } from "./defs/element-def.schema";
|
|
11
|
+
import { functionDefSchema } from "./defs/function-def.schema";
|
|
12
|
+
import { externalClassDefSchema } from "./defs/external-class-def.schema";
|
|
13
|
+
import { typedStateDefSchema } from "./defs/typed-state-def.schema";
|
|
14
|
+
import { pureTypeDefSchema } from "./defs/pure-type-def.schema";
|
|
15
|
+
import { expressionNodeSchema, expressionEntrySchema } from "./defs/expression-node.schema";
|
|
16
|
+
import { stateEntrySchema, stateMapSchema, defsMapSchema } from "./defs/state-entry.schema";
|
|
17
|
+
import {
|
|
18
|
+
classDefSchema,
|
|
19
|
+
classFieldDefSchema,
|
|
20
|
+
classMethodDefSchema,
|
|
21
|
+
classParameterDefSchema,
|
|
22
|
+
classConstructorDefSchema,
|
|
23
|
+
} from "./defs/class-def.schema";
|
|
24
|
+
|
|
25
|
+
// ─── Strict Schema-Derived Types ────────────────────────────────────────────────
|
|
26
|
+
// These are the precise types derived from the JSON Schema defs via FromSchema.
|
|
27
|
+
// Use these when you need exact schema conformance (e.g., validation, serialization).
|
|
28
|
+
|
|
29
|
+
export namespace Strict {
|
|
30
|
+
export type HeadEntry = FromSchema<typeof headEntrySchema>;
|
|
31
|
+
export type ImageConfig = FromSchema<typeof imageConfigSchema>;
|
|
32
|
+
export type CemParameter = FromSchema<typeof cemParameterSchema>;
|
|
33
|
+
export type CemEvent = FromSchema<typeof cemEventSchema>;
|
|
34
|
+
export type ContentTypeDef = FromSchema<typeof contentTypeDefSchema>;
|
|
35
|
+
export type RefObject = FromSchema<typeof refObjectSchema>;
|
|
36
|
+
export type Style = FromSchema<typeof styleObjectSchema>;
|
|
37
|
+
export type Element = FromSchema<typeof elementDefSchema>;
|
|
38
|
+
export type FunctionDef = FromSchema<typeof functionDefSchema>;
|
|
39
|
+
export type ExternalClassDef = FromSchema<typeof externalClassDefSchema>;
|
|
40
|
+
export type TypedStateDef = FromSchema<typeof typedStateDefSchema>;
|
|
41
|
+
export type PureTypeDef = FromSchema<typeof pureTypeDefSchema>;
|
|
42
|
+
export type ExpressionNode = FromSchema<typeof expressionNodeSchema>;
|
|
43
|
+
export type ExpressionEntry = FromSchema<typeof expressionEntrySchema>;
|
|
44
|
+
export type StateDefinition = FromSchema<typeof stateEntrySchema>;
|
|
45
|
+
export type StateMap = FromSchema<typeof stateMapSchema>;
|
|
46
|
+
export type DefsMap = FromSchema<typeof defsMapSchema>;
|
|
47
|
+
export type ClassDef = FromSchema<typeof classDefSchema>;
|
|
48
|
+
export type ClassFieldDef = FromSchema<typeof classFieldDefSchema>;
|
|
49
|
+
export type ClassMethodDef = FromSchema<typeof classMethodDefSchema>;
|
|
50
|
+
export type ClassParameterDef = FromSchema<typeof classParameterDefSchema>;
|
|
51
|
+
export type ClassConstructorDef = FromSchema<typeof classConstructorDefSchema>;
|
|
52
|
+
export type ProjectConfig = FromSchema<typeof projectConfigSchema>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ─── Consumer-Friendly Types ────────────────────────────────────────────────────
|
|
56
|
+
// Relaxed types for everyday use in the runtime/compiler/studio. These add an index
|
|
57
|
+
// signature for dynamic property access while preserving the known property structure.
|
|
58
|
+
|
|
59
|
+
export interface JxHeadEntry {
|
|
60
|
+
tagName: string;
|
|
61
|
+
attributes?: Record<string, string | boolean>;
|
|
62
|
+
textContent?: string;
|
|
63
|
+
children?: (JxHeadEntry | string)[];
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface ImageConfig {
|
|
68
|
+
optimize?: boolean;
|
|
69
|
+
widths?: number[];
|
|
70
|
+
formats?: string[];
|
|
71
|
+
quality?: { webp?: number; avif?: number; jpeg?: number; png?: number };
|
|
72
|
+
sizes?: string;
|
|
73
|
+
lazyLoad?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type CemParameter = FromSchema<typeof cemParameterSchema>;
|
|
77
|
+
export type CemEvent = FromSchema<typeof cemEventSchema>;
|
|
78
|
+
|
|
79
|
+
export type ContentTypeDef = FromSchema<typeof contentTypeDefSchema>;
|
|
80
|
+
|
|
81
|
+
export type RefObject = FromSchema<typeof refObjectSchema>;
|
|
82
|
+
|
|
83
|
+
export type JxStyle = {
|
|
84
|
+
[property: string]: string | number | JxStyle | undefined;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export interface JxElement {
|
|
88
|
+
tagName?: string;
|
|
89
|
+
textContent?: string | null;
|
|
90
|
+
innerHTML?: string;
|
|
91
|
+
children?: (JxElement | string)[] | JxMappedArray;
|
|
92
|
+
style?: JxStyle;
|
|
93
|
+
attributes?: Record<string, unknown>;
|
|
94
|
+
className?: string;
|
|
95
|
+
id?: string;
|
|
96
|
+
hidden?: boolean;
|
|
97
|
+
tabIndex?: number;
|
|
98
|
+
title?: string;
|
|
99
|
+
lang?: string;
|
|
100
|
+
dir?: string;
|
|
101
|
+
$ref?: string;
|
|
102
|
+
$props?: Record<string, unknown>;
|
|
103
|
+
$switch?: { $ref: string };
|
|
104
|
+
cases?: Record<string, JxElement>;
|
|
105
|
+
$prototype?: string;
|
|
106
|
+
$static?: boolean;
|
|
107
|
+
$prerendered?: boolean;
|
|
108
|
+
$title?: string;
|
|
109
|
+
$id?: string;
|
|
110
|
+
$src?: string;
|
|
111
|
+
observedAttributes?: string[];
|
|
112
|
+
state?: Record<string, JxStateDefinition>;
|
|
113
|
+
[key: string]: unknown;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface JxMappedArray {
|
|
117
|
+
$prototype: "Array";
|
|
118
|
+
items: { $ref: string } | unknown;
|
|
119
|
+
map?: JxElement;
|
|
120
|
+
filter?: { $ref: string } | unknown;
|
|
121
|
+
sort?: { $ref: string } | unknown;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface JxDocument extends JxElement {
|
|
125
|
+
state?: Record<string, JxStateDefinition>;
|
|
126
|
+
$elements?: (JxElement | string)[];
|
|
127
|
+
$head?: JxHeadEntry[];
|
|
128
|
+
$media?: Record<string, string>;
|
|
129
|
+
$defs?: Record<string, unknown>;
|
|
130
|
+
imports?: Record<string, string>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type FunctionDef = FromSchema<typeof functionDefSchema>;
|
|
134
|
+
|
|
135
|
+
export type ExternalClassDef = FromSchema<typeof externalClassDefSchema>;
|
|
136
|
+
|
|
137
|
+
export type TypedStateDef = FromSchema<typeof typedStateDefSchema>;
|
|
138
|
+
|
|
139
|
+
export type PureTypeDef = FromSchema<typeof pureTypeDefSchema>;
|
|
140
|
+
|
|
141
|
+
export type ExpressionNode = FromSchema<typeof expressionNodeSchema>;
|
|
142
|
+
export type ExpressionEntry = FromSchema<typeof expressionEntrySchema>;
|
|
143
|
+
|
|
144
|
+
export type JxStateDefinition = string | number | boolean | null | JxStateObject | JxPrototypeDef;
|
|
145
|
+
|
|
146
|
+
export interface JxStateObject {
|
|
147
|
+
type?: string;
|
|
148
|
+
default?: unknown;
|
|
149
|
+
properties?: Record<string, unknown>;
|
|
150
|
+
items?: unknown;
|
|
151
|
+
enum?: unknown[];
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface JxPrototypeDef {
|
|
156
|
+
$prototype: string;
|
|
157
|
+
$src?: string;
|
|
158
|
+
$export?: string;
|
|
159
|
+
body?: string;
|
|
160
|
+
parameters?: string[];
|
|
161
|
+
arguments?: string[];
|
|
162
|
+
timing?: "compiler" | "server" | "client";
|
|
163
|
+
default?: unknown;
|
|
164
|
+
debounce?: number;
|
|
165
|
+
contentType?: string;
|
|
166
|
+
filter?: Record<string, unknown>;
|
|
167
|
+
sort?: { field: string; order?: string };
|
|
168
|
+
limit?: number;
|
|
169
|
+
id?: string | { $ref: string };
|
|
170
|
+
[key: string]: unknown;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export type StateMap = FromSchema<typeof stateMapSchema>;
|
|
174
|
+
export type DefsMap = FromSchema<typeof defsMapSchema>;
|
|
175
|
+
|
|
176
|
+
export type ClassDef = FromSchema<typeof classDefSchema>;
|
|
177
|
+
export type ClassFieldDef = FromSchema<typeof classFieldDefSchema>;
|
|
178
|
+
export type ClassMethodDef = FromSchema<typeof classMethodDefSchema>;
|
|
179
|
+
export type ClassParameterDef = FromSchema<typeof classParameterDefSchema>;
|
|
180
|
+
export type ClassConstructorDef = FromSchema<typeof classConstructorDefSchema>;
|
|
181
|
+
|
|
182
|
+
export interface ProjectConfig {
|
|
183
|
+
name?: string;
|
|
184
|
+
url?: string;
|
|
185
|
+
state?: Record<string, unknown>;
|
|
186
|
+
$media?: Record<string, string>;
|
|
187
|
+
$elements?: (string | JxElement)[];
|
|
188
|
+
$head?: JxHeadEntry[];
|
|
189
|
+
$defs?: Record<string, unknown>;
|
|
190
|
+
build?: { adapter?: string; [key: string]: unknown };
|
|
191
|
+
images?: ImageConfig;
|
|
192
|
+
imports?: Record<string, string>;
|
|
193
|
+
contentTypes?: Record<string, ContentTypeDef>;
|
|
194
|
+
defaults?: { layout?: string; lang?: string; charset?: string; [key: string]: unknown };
|
|
195
|
+
style?: JxStyle;
|
|
196
|
+
[key: string]: unknown;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// ─── Editor/Mutation Types ──────────────────────────────────────────────────────
|
|
200
|
+
|
|
201
|
+
export interface JxMutableNode {
|
|
202
|
+
tagName?: string;
|
|
203
|
+
textContent?: string | null;
|
|
204
|
+
innerHTML?: string;
|
|
205
|
+
children?: (JxMutableNode | string)[];
|
|
206
|
+
style?: Record<string, any>;
|
|
207
|
+
attributes?: Record<string, any>;
|
|
208
|
+
className?: string;
|
|
209
|
+
id?: string;
|
|
210
|
+
$ref?: string;
|
|
211
|
+
$props?: Record<string, unknown>;
|
|
212
|
+
$switch?: string | { $ref: string };
|
|
213
|
+
cases?: Record<string, JxMutableNode>;
|
|
214
|
+
$prototype?: string;
|
|
215
|
+
$title?: string;
|
|
216
|
+
$id?: string;
|
|
217
|
+
$src?: string;
|
|
218
|
+
state?: Record<string, any>;
|
|
219
|
+
$elements?: (JxMutableNode | string | { $ref: string })[];
|
|
220
|
+
$head?: JxHeadEntry[];
|
|
221
|
+
$media?: Record<string, string>;
|
|
222
|
+
$defs?: Record<string, any>;
|
|
223
|
+
[key: string]: any;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ─── Paths ──────────────────────────────────────────────────────────────────────
|
|
227
|
+
|
|
228
|
+
export type JxPath = (string | number)[];
|
|
229
|
+
|
|
230
|
+
// ─── Content Type Schema ────────────────────────────────────────────────────────
|
|
231
|
+
|
|
232
|
+
export interface ContentTypeSchema {
|
|
233
|
+
properties?: Record<string, any>;
|
|
234
|
+
required?: string[];
|
|
235
|
+
[key: string]: unknown;
|
|
236
|
+
}
|