create-kerf-component 5.0.0-beta.6 → 5.0.0-beta.60

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.
@@ -0,0 +1,354 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/brianwestphal/kerf/main/ui/ai/component-composition.schema.json",
4
+ "title": "Kerf UI composition catalog",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "package", "compatibility", "entries"],
7
+ "properties": {
8
+ "$schema": { "type": "string" },
9
+ "schemaVersion": {
10
+ "const": 1,
11
+ "description": "Version of the composition catalog format itself, independent of component-catalog.json's own schemaVersion."
12
+ },
13
+ "package": { "type": "string", "minLength": 1 },
14
+ "compatibility": {
15
+ "type": "object",
16
+ "required": ["componentCatalog", "identity"],
17
+ "properties": {
18
+ "componentCatalog": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "description": "Relative path to the component (selection) catalog this composition layer describes, or \"not-applicable\" when the package publishes none."
22
+ },
23
+ "identity": { "const": "package:id" }
24
+ },
25
+ "additionalProperties": false
26
+ },
27
+ "entries": { "type": "array", "items": { "$ref": "#/$defs/entry" } }
28
+ },
29
+ "additionalProperties": false,
30
+ "$defs": {
31
+ "stateAttribute": {
32
+ "type": "object",
33
+ "required": ["name", "on", "helper", "meaning"],
34
+ "properties": {
35
+ "name": {
36
+ "type": "string",
37
+ "minLength": 1,
38
+ "pattern": "^data-[a-z0-9]+(-[a-z0-9]+)*$"
39
+ },
40
+ "on": {
41
+ "type": "string",
42
+ "minLength": 1,
43
+ "description": "The element that carries it: a public class, or the element passed to the helper."
44
+ },
45
+ "helper": {
46
+ "type": "string",
47
+ "minLength": 1,
48
+ "description": "The helper, one of wiring.helpers, that writes it."
49
+ },
50
+ "meaning": {
51
+ "type": "string",
52
+ "minLength": 1,
53
+ "description": "What its presence or value means."
54
+ }
55
+ },
56
+ "additionalProperties": false
57
+ },
58
+ "stringList": {
59
+ "type": "array",
60
+ "items": { "type": "string", "minLength": 1 },
61
+ "uniqueItems": true
62
+ },
63
+ "cardinality": {
64
+ "type": "object",
65
+ "required": ["min", "max"],
66
+ "properties": {
67
+ "min": { "type": "integer", "minimum": 0 },
68
+ "max": {
69
+ "anyOf": [
70
+ { "type": "integer", "minimum": 1 },
71
+ { "const": "unbounded" }
72
+ ]
73
+ }
74
+ },
75
+ "additionalProperties": false
76
+ },
77
+ "zone": {
78
+ "type": "object",
79
+ "required": ["id", "accepts", "cardinality", "exclusiveWith"],
80
+ "properties": {
81
+ "id": { "type": "string", "minLength": 1 },
82
+ "jsx": {
83
+ "type": "object",
84
+ "required": ["prop"],
85
+ "properties": {
86
+ "prop": { "type": "string", "minLength": 1 }
87
+ },
88
+ "additionalProperties": false
89
+ },
90
+ "accepts": { "$ref": "#/$defs/stringList" },
91
+ "cardinality": { "$ref": "#/$defs/cardinality" },
92
+ "exclusiveWith": { "$ref": "#/$defs/stringList" }
93
+ },
94
+ "additionalProperties": false
95
+ },
96
+ "state": {
97
+ "type": "object",
98
+ "required": ["id", "owner", "required"],
99
+ "properties": {
100
+ "id": { "type": "string", "minLength": 1 },
101
+ "owner": { "enum": ["application", "controlled", "component"] },
102
+ "required": { "type": "boolean" }
103
+ },
104
+ "additionalProperties": false
105
+ },
106
+ "diagnostic": {
107
+ "type": "object",
108
+ "required": ["id", "severity", "when", "message"],
109
+ "properties": {
110
+ "id": { "type": "string", "pattern": "^KUI-C[0-9]{3}$" },
111
+ "severity": { "enum": ["error", "warning"] },
112
+ "when": { "type": "string", "minLength": 1 },
113
+ "message": { "type": "string", "minLength": 1 }
114
+ },
115
+ "additionalProperties": false
116
+ },
117
+ "entry": {
118
+ "type": "object",
119
+ "required": [
120
+ "key",
121
+ "package",
122
+ "id",
123
+ "name",
124
+ "kind",
125
+ "source",
126
+ "parents",
127
+ "contexts",
128
+ "zones",
129
+ "children",
130
+ "state",
131
+ "wiring",
132
+ "responsive",
133
+ "layout",
134
+ "accessibility",
135
+ "boundaries",
136
+ "diagnostics",
137
+ "provenance"
138
+ ],
139
+ "properties": {
140
+ "key": { "type": "string", "minLength": 3 },
141
+ "package": { "type": "string", "minLength": 1 },
142
+ "id": { "type": "string", "minLength": 1 },
143
+ "name": { "type": "string", "minLength": 1 },
144
+ "kind": { "enum": ["component", "composition", "recipe"] },
145
+ "purpose": { "type": "string", "minLength": 1 },
146
+ "publicExports": {
147
+ "description": "Each export's name and the package.json#exports subpath that serves it. An entry from a private application omits subpath: the application is bundled, never imported by package name, so the name resolves through the entry's source file.",
148
+ "type": "array",
149
+ "items": {
150
+ "type": "object",
151
+ "required": ["name"],
152
+ "properties": {
153
+ "name": { "type": "string", "minLength": 1 },
154
+ "subpath": { "type": "string", "pattern": "^\\." }
155
+ },
156
+ "additionalProperties": false
157
+ },
158
+ "minItems": 1
159
+ },
160
+ "sourceLinks": { "$ref": "#/$defs/stringList" },
161
+ "source": { "type": "string", "minLength": 1 },
162
+ "rendersAs": {
163
+ "description": "For a wrapper component: the cataloged roots it renders (package-qualified keys), any one of them or nothing. Composition checks treat an element of this entry as each declared root: a zone accepts it only if it accepts every root, and each root's parent contract applies to where it is placed.",
164
+ "type": "array",
165
+ "minItems": 1,
166
+ "items": { "type": "string", "pattern": "^[^:]+:[^:]+$" },
167
+ "uniqueItems": true
168
+ },
169
+ "parents": {
170
+ "type": "object",
171
+ "required": ["mode", "entries"],
172
+ "properties": {
173
+ "mode": { "enum": ["any", "root", "listed"] },
174
+ "entries": { "$ref": "#/$defs/stringList" }
175
+ },
176
+ "additionalProperties": false
177
+ },
178
+ "contexts": { "$ref": "#/$defs/stringList" },
179
+ "zones": { "type": "array", "items": { "$ref": "#/$defs/zone" } },
180
+ "children": {
181
+ "type": "object",
182
+ "required": ["mode", "concepts", "requiredConcepts"],
183
+ "properties": {
184
+ "mode": { "enum": ["any", "none", "listed"] },
185
+ "concepts": { "$ref": "#/$defs/stringList" },
186
+ "requiredConcepts": { "$ref": "#/$defs/stringList" }
187
+ },
188
+ "additionalProperties": false
189
+ },
190
+ "state": { "type": "array", "items": { "$ref": "#/$defs/state" } },
191
+ "wiring": {
192
+ "type": "object",
193
+ "required": ["required", "helpers", "obligations"],
194
+ "properties": {
195
+ "required": { "type": "boolean" },
196
+ "helpers": { "$ref": "#/$defs/stringList" },
197
+ "obligations": { "$ref": "#/$defs/stringList" },
198
+ "stateAttributes": {
199
+ "description": "Wiring-owned state attributes: data-* attributes a wiring helper writes at runtime, which the application must not render, remove, or treat as its own state. Optional for extension catalogs; first-party entries always list it, empty when their helpers write none.",
200
+ "type": "array",
201
+ "items": { "$ref": "#/$defs/stateAttribute" }
202
+ }
203
+ },
204
+ "additionalProperties": false
205
+ },
206
+ "responsive": {
207
+ "type": "object",
208
+ "required": ["owner", "behaviors"],
209
+ "properties": {
210
+ "owner": {
211
+ "enum": ["application", "component", "shared", "not-applicable"]
212
+ },
213
+ "behaviors": { "$ref": "#/$defs/stringList" }
214
+ },
215
+ "additionalProperties": false
216
+ },
217
+ "layout": {
218
+ "type": "object",
219
+ "required": ["roles", "geometry"],
220
+ "properties": {
221
+ "roles": { "$ref": "#/$defs/stringList" },
222
+ "geometry": {
223
+ "type": "object",
224
+ "required": ["margin", "border", "padding"],
225
+ "properties": {
226
+ "margin": {
227
+ "enum": [
228
+ "self",
229
+ "parent",
230
+ "child",
231
+ "none",
232
+ "conditional",
233
+ "composed"
234
+ ]
235
+ },
236
+ "border": {
237
+ "enum": [
238
+ "self",
239
+ "parent",
240
+ "child",
241
+ "none",
242
+ "conditional",
243
+ "composed"
244
+ ]
245
+ },
246
+ "padding": {
247
+ "enum": [
248
+ "self",
249
+ "parent",
250
+ "child",
251
+ "none",
252
+ "conditional",
253
+ "composed"
254
+ ]
255
+ },
256
+ "notes": { "$ref": "#/$defs/stringList" }
257
+ },
258
+ "additionalProperties": false
259
+ }
260
+ },
261
+ "additionalProperties": false
262
+ },
263
+ "accessibility": {
264
+ "type": "object",
265
+ "required": ["obligations"],
266
+ "properties": { "obligations": { "$ref": "#/$defs/stringList" } },
267
+ "additionalProperties": false
268
+ },
269
+ "cssValueProps": {
270
+ "type": "array",
271
+ "items": { "$ref": "#/$defs/cssValueProp" }
272
+ },
273
+ "boundaries": {
274
+ "type": "object",
275
+ "required": ["rootClass", "publicClasses", "publicTokens"],
276
+ "properties": {
277
+ "rootClass": {
278
+ "oneOf": [
279
+ { "type": "string", "minLength": 1 },
280
+ { "type": "null" }
281
+ ]
282
+ },
283
+ "publicClasses": { "$ref": "#/$defs/stringList" },
284
+ "placeableClasses": {
285
+ "$ref": "#/$defs/stringList",
286
+ "description": "The subset of publicClasses an application may place on its own elements. Absent means none: every public class is the component's rendered anatomy, reached by rendering the component."
287
+ },
288
+ "rootElement": {
289
+ "type": "string",
290
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
291
+ "description": "The intrinsic element the component renders at its root. A placeableClasses class on a plain element of this tag recreates the component; the class stays placeable on any other carrier element."
292
+ },
293
+ "publicTokens": { "$ref": "#/$defs/stringList" },
294
+ "publicParts": { "$ref": "#/$defs/stringList" }
295
+ },
296
+ "additionalProperties": false
297
+ },
298
+ "diagnostics": {
299
+ "type": "array",
300
+ "items": { "$ref": "#/$defs/diagnostic" }
301
+ },
302
+ "provenance": {
303
+ "type": "object",
304
+ "required": ["selection", "composition"],
305
+ "properties": {
306
+ "selection": { "type": "string", "minLength": 1 },
307
+ "composition": { "type": "string", "minLength": 1 }
308
+ },
309
+ "additionalProperties": false
310
+ }
311
+ },
312
+ "additionalProperties": false
313
+ },
314
+ "cssValueProp": {
315
+ "type": "object",
316
+ "required": [
317
+ "path",
318
+ "grammar",
319
+ "helpers",
320
+ "shorthands",
321
+ "canonicalShorthands",
322
+ "exceptionalShorthands",
323
+ "rawPolicy",
324
+ "examples"
325
+ ],
326
+ "properties": {
327
+ "path": {
328
+ "type": "string",
329
+ "pattern": "^[A-Za-z][A-Za-z0-9]*(?:\\[\\]\\.[A-Za-z][A-Za-z0-9]*)?$"
330
+ },
331
+ "grammar": {
332
+ "enum": [
333
+ "length",
334
+ "size",
335
+ "flex",
336
+ "color",
337
+ "declarations",
338
+ "media-query",
339
+ "pixels"
340
+ ]
341
+ },
342
+ "helpers": { "$ref": "#/$defs/stringList" },
343
+ "nonStandaloneHelpers": { "$ref": "#/$defs/stringList" },
344
+ "shorthands": { "$ref": "#/$defs/stringList" },
345
+ "canonicalShorthands": { "$ref": "#/$defs/stringList" },
346
+ "exceptionalShorthands": { "$ref": "#/$defs/stringList" },
347
+ "rawPolicy": { "enum": ["forbid", "allow", "unsafe-only"] },
348
+ "unsafeHelper": { "type": "string", "minLength": 1 },
349
+ "examples": { "$ref": "#/$defs/stringList" }
350
+ },
351
+ "additionalProperties": false
352
+ }
353
+ }
354
+ }
@@ -0,0 +1,282 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/brianwestphal/kerf/main/create-kerf-component/component-metadata.schema.json",
4
+ "title": "Kerf consumer component metadata source",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "components"],
7
+ "properties": {
8
+ "$schema": { "type": "string" },
9
+ "schemaVersion": { "const": 1 },
10
+ "componentCatalog": {
11
+ "type": "string",
12
+ "minLength": 1,
13
+ "description": "Relative path to the package's component (selection) catalog, copied into the generated composition catalog's compatibility.componentCatalog; defaults to \"not-applicable\"."
14
+ },
15
+ "components": {
16
+ "type": "array",
17
+ "items": { "$ref": "#/$defs/component" }
18
+ }
19
+ },
20
+ "additionalProperties": false,
21
+ "$defs": {
22
+ "stateAttribute": {
23
+ "type": "object",
24
+ "required": ["name", "on", "helper", "meaning"],
25
+ "properties": {
26
+ "name": {
27
+ "type": "string",
28
+ "minLength": 1,
29
+ "pattern": "^data-[a-z0-9]+(-[a-z0-9]+)*$"
30
+ },
31
+ "on": {
32
+ "type": "string",
33
+ "minLength": 1,
34
+ "description": "The element that carries it: a public class, or the element passed to the helper."
35
+ },
36
+ "helper": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "description": "The helper, one of wiring.helpers, that writes it."
40
+ },
41
+ "meaning": {
42
+ "type": "string",
43
+ "minLength": 1,
44
+ "description": "What its presence or value means."
45
+ }
46
+ },
47
+ "additionalProperties": false
48
+ },
49
+ "stringList": {
50
+ "type": "array",
51
+ "items": { "type": "string", "minLength": 1 },
52
+ "uniqueItems": true
53
+ },
54
+ "cardinality": {
55
+ "type": "object",
56
+ "required": ["min", "max"],
57
+ "properties": {
58
+ "min": { "type": "integer", "minimum": 0 },
59
+ "max": {
60
+ "anyOf": [
61
+ { "type": "integer", "minimum": 1 },
62
+ { "const": "unbounded" }
63
+ ]
64
+ }
65
+ },
66
+ "additionalProperties": false
67
+ },
68
+ "diagnostic": {
69
+ "type": "object",
70
+ "required": ["id", "severity", "when", "message"],
71
+ "properties": {
72
+ "id": { "type": "string", "pattern": "^KUI-C[0-9]{3}$" },
73
+ "severity": { "enum": ["error", "warning"] },
74
+ "when": { "type": "string", "minLength": 1 },
75
+ "message": { "type": "string", "minLength": 1 }
76
+ },
77
+ "additionalProperties": false
78
+ },
79
+ "component": {
80
+ "type": "object",
81
+ "required": [
82
+ "id",
83
+ "name",
84
+ "kind",
85
+ "purpose",
86
+ "source",
87
+ "publicExports",
88
+ "sourceLinks",
89
+ "composition",
90
+ "boundaries",
91
+ "accessibility",
92
+ "diagnostics",
93
+ "provenance"
94
+ ],
95
+ "properties": {
96
+ "id": { "type": "string", "minLength": 1 },
97
+ "name": { "type": "string", "minLength": 1 },
98
+ "kind": { "enum": ["component", "composition", "recipe"] },
99
+ "purpose": { "type": "string", "minLength": 1 },
100
+ "source": { "type": "string", "minLength": 1 },
101
+ "publicExports": {
102
+ "type": "array",
103
+ "minItems": 1,
104
+ "description": "Each export's name and package.json#exports subpath. A private application (package.json#private) may omit subpath; the name is then verified against the component's source file.",
105
+ "items": {
106
+ "type": "object",
107
+ "required": ["name"],
108
+ "properties": {
109
+ "name": { "type": "string", "minLength": 1 },
110
+ "subpath": { "type": "string", "pattern": "^\\." }
111
+ },
112
+ "additionalProperties": false
113
+ }
114
+ },
115
+ "sourceLinks": { "$ref": "#/$defs/stringList" },
116
+ "composition": { "$ref": "#/$defs/composition" },
117
+ "boundaries": {
118
+ "type": "object",
119
+ "required": ["rootClass", "publicClasses", "publicTokens"],
120
+ "properties": {
121
+ "rootClass": {
122
+ "oneOf": [
123
+ { "type": "string", "minLength": 1 },
124
+ { "type": "null" }
125
+ ]
126
+ },
127
+ "publicClasses": { "$ref": "#/$defs/stringList" },
128
+ "placeableClasses": {
129
+ "$ref": "#/$defs/stringList",
130
+ "description": "The subset of publicClasses an application may place on its own elements (a layout utility, item geometry on another carrier). Absent means none: every public class is the component's rendered anatomy, which eslint-plugin-kerfjs reports on an application-owned element as KUI-L103 with the component to render."
131
+ },
132
+ "rootElement": {
133
+ "type": "string",
134
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
135
+ "description": "The intrinsic element the component renders around its own placeableClasses. A placeable class on a plain element of this tag is the component recreated (KUI-L103); another carrier element keeps it. Requires placeableClasses."
136
+ },
137
+ "publicTokens": { "$ref": "#/$defs/stringList" }
138
+ },
139
+ "additionalProperties": false
140
+ },
141
+ "accessibility": {
142
+ "type": "object",
143
+ "required": ["obligations"],
144
+ "properties": { "obligations": { "$ref": "#/$defs/stringList" } },
145
+ "additionalProperties": false
146
+ },
147
+ "diagnostics": {
148
+ "type": "array",
149
+ "items": { "$ref": "#/$defs/diagnostic" }
150
+ },
151
+ "provenance": {
152
+ "type": "object",
153
+ "required": ["selection", "composition"],
154
+ "properties": {
155
+ "selection": { "type": "string", "minLength": 1 },
156
+ "composition": { "type": "string", "minLength": 1 }
157
+ },
158
+ "additionalProperties": false
159
+ }
160
+ },
161
+ "additionalProperties": false
162
+ },
163
+ "composition": {
164
+ "type": "object",
165
+ "required": [
166
+ "parents",
167
+ "contexts",
168
+ "zones",
169
+ "children",
170
+ "state",
171
+ "wiring",
172
+ "responsive",
173
+ "layout"
174
+ ],
175
+ "properties": {
176
+ "rendersAs": {
177
+ "description": "For a wrapper component: the cataloged roots it renders (package-qualified keys such as @kerfjs/ui:toolbar-control-group), any one of them or nothing. UI composition checks treat the wrapper as each declared root.",
178
+ "type": "array",
179
+ "minItems": 1,
180
+ "items": { "type": "string", "pattern": "^[^:]+:[^:]+$" },
181
+ "uniqueItems": true
182
+ },
183
+ "parents": {
184
+ "type": "object",
185
+ "required": ["mode", "entries"],
186
+ "properties": {
187
+ "mode": { "enum": ["any", "root", "listed"] },
188
+ "entries": { "$ref": "#/$defs/stringList" }
189
+ },
190
+ "additionalProperties": false
191
+ },
192
+ "contexts": { "$ref": "#/$defs/stringList" },
193
+ "zones": {
194
+ "type": "array",
195
+ "items": {
196
+ "type": "object",
197
+ "required": ["id", "accepts", "cardinality", "exclusiveWith"],
198
+ "properties": {
199
+ "id": { "type": "string", "minLength": 1 },
200
+ "accepts": { "$ref": "#/$defs/stringList" },
201
+ "cardinality": { "$ref": "#/$defs/cardinality" },
202
+ "exclusiveWith": { "$ref": "#/$defs/stringList" }
203
+ },
204
+ "additionalProperties": false
205
+ }
206
+ },
207
+ "children": {
208
+ "type": "object",
209
+ "required": ["mode", "concepts", "requiredConcepts"],
210
+ "properties": {
211
+ "mode": { "enum": ["any", "none", "listed"] },
212
+ "concepts": { "$ref": "#/$defs/stringList" },
213
+ "requiredConcepts": { "$ref": "#/$defs/stringList" }
214
+ },
215
+ "additionalProperties": false
216
+ },
217
+ "state": {
218
+ "type": "array",
219
+ "items": {
220
+ "type": "object",
221
+ "required": ["id", "owner", "required"],
222
+ "properties": {
223
+ "id": { "type": "string", "minLength": 1 },
224
+ "owner": { "enum": ["application", "controlled", "component"] },
225
+ "required": { "type": "boolean" }
226
+ },
227
+ "additionalProperties": false
228
+ }
229
+ },
230
+ "wiring": {
231
+ "type": "object",
232
+ "required": ["required", "helpers", "obligations"],
233
+ "properties": {
234
+ "required": { "type": "boolean" },
235
+ "helpers": { "$ref": "#/$defs/stringList" },
236
+ "obligations": { "$ref": "#/$defs/stringList" },
237
+ "stateAttributes": {
238
+ "description": "Optional wiring-owned state attributes: data-* attributes a wiring helper writes at runtime, which the application must not render, remove, or treat as its own state.",
239
+ "type": "array",
240
+ "items": { "$ref": "#/$defs/stateAttribute" }
241
+ }
242
+ },
243
+ "additionalProperties": false
244
+ },
245
+ "responsive": {
246
+ "type": "object",
247
+ "required": ["owner", "behaviors"],
248
+ "properties": {
249
+ "owner": {
250
+ "enum": ["application", "component", "shared", "not-applicable"]
251
+ },
252
+ "behaviors": { "$ref": "#/$defs/stringList" }
253
+ },
254
+ "additionalProperties": false
255
+ },
256
+ "layout": {
257
+ "type": "object",
258
+ "required": ["roles", "geometry"],
259
+ "properties": {
260
+ "roles": { "$ref": "#/$defs/stringList" },
261
+ "geometry": {
262
+ "type": "object",
263
+ "required": ["margin", "border", "padding"],
264
+ "properties": {
265
+ "margin": { "$ref": "#/$defs/geometryOwner" },
266
+ "border": { "$ref": "#/$defs/geometryOwner" },
267
+ "padding": { "$ref": "#/$defs/geometryOwner" },
268
+ "notes": { "$ref": "#/$defs/stringList" }
269
+ },
270
+ "additionalProperties": false
271
+ }
272
+ },
273
+ "additionalProperties": false
274
+ }
275
+ },
276
+ "additionalProperties": false
277
+ },
278
+ "geometryOwner": {
279
+ "enum": ["self", "parent", "child", "none", "conditional", "composed"]
280
+ }
281
+ }
282
+ }