create-kerf-component 5.0.0-beta.12 → 5.0.0-beta.120

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,104 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/brianwestphal/kerf/main/ui/ai/component-catalog-extension.schema.json",
4
+ "title": "Kerf UI consumer component catalog extension",
5
+ "type": "object",
6
+ "required": ["schemaVersion", "package", "description", "entries"],
7
+ "properties": {
8
+ "$schema": { "type": "string" },
9
+ "schemaVersion": { "const": 1 },
10
+ "package": { "type": "string", "minLength": 1 },
11
+ "description": { "type": "string", "minLength": 1 },
12
+ "entries": {
13
+ "type": "array",
14
+ "items": { "$ref": "#/$defs/entry" }
15
+ }
16
+ },
17
+ "additionalProperties": false,
18
+ "$defs": {
19
+ "entry": {
20
+ "type": "object",
21
+ "required": [
22
+ "id",
23
+ "name",
24
+ "kind",
25
+ "purpose",
26
+ "useWhen",
27
+ "avoidWhen",
28
+ "geometry"
29
+ ],
30
+ "properties": {
31
+ "id": { "type": "string", "minLength": 1 },
32
+ "name": { "type": "string", "minLength": 1 },
33
+ "kind": { "enum": ["component", "composition"] },
34
+ "purpose": { "type": "string", "minLength": 1 },
35
+ "useWhen": {
36
+ "type": "array",
37
+ "items": { "type": "string" },
38
+ "minItems": 1
39
+ },
40
+ "avoidWhen": {
41
+ "type": "array",
42
+ "items": { "type": "string" },
43
+ "minItems": 1
44
+ },
45
+ "publicClasses": {
46
+ "type": "array",
47
+ "items": { "type": "string" },
48
+ "uniqueItems": true
49
+ },
50
+ "publicTokens": {
51
+ "type": "array",
52
+ "items": { "type": "string" },
53
+ "uniqueItems": true
54
+ },
55
+ "uses": {
56
+ "description": "Directly composed Kerf or consumer catalog entry ids.",
57
+ "type": "array",
58
+ "items": { "type": "string", "minLength": 1 },
59
+ "uniqueItems": true
60
+ },
61
+ "source": { "$ref": "#/$defs/repositoryPath" },
62
+ "styleSources": {
63
+ "description": "Stylesheets owned by this component, relative to the consumer package root. Used by Doctor's opt-in component ownership mode.",
64
+ "type": "array",
65
+ "items": {
66
+ "allOf": [
67
+ { "$ref": "#/$defs/repositoryPath" },
68
+ { "pattern": "\\.css$" }
69
+ ]
70
+ },
71
+ "minItems": 1,
72
+ "uniqueItems": true
73
+ },
74
+ "demoSource": { "$ref": "#/$defs/repositoryPath" },
75
+ "geometry": { "$ref": "#/$defs/geometry" },
76
+ "documentation": { "type": "string", "minLength": 1 }
77
+ },
78
+ "additionalProperties": false
79
+ },
80
+ "geometry": {
81
+ "type": "object",
82
+ "required": ["margin", "border", "padding"],
83
+ "properties": {
84
+ "margin": { "$ref": "#/$defs/geometryOwner" },
85
+ "border": { "$ref": "#/$defs/geometryOwner" },
86
+ "padding": { "$ref": "#/$defs/geometryOwner" },
87
+ "notes": {
88
+ "type": "array",
89
+ "items": { "type": "string", "minLength": 1 },
90
+ "minItems": 1
91
+ }
92
+ },
93
+ "additionalProperties": false
94
+ },
95
+ "geometryOwner": {
96
+ "enum": ["self", "parent", "child", "none", "conditional"]
97
+ },
98
+ "repositoryPath": {
99
+ "description": "A repository-relative POSIX path without traversal or empty segments.",
100
+ "type": "string",
101
+ "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*$"
102
+ }
103
+ }
104
+ }
@@ -0,0 +1,445 @@
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
+ "styleSources": {
163
+ "description": "Stylesheets owned by this component, relative to the catalog package root. Required for an entry to own its CSS in opt-in component ownership mode when no selection catalog supplies it.",
164
+ "type": "array",
165
+ "items": {
166
+ "type": "string",
167
+ "pattern": "^(?!.*(?:^|/)\\.{1,2}(?:/|$))[A-Za-z0-9._-]+(?:/[A-Za-z0-9._-]+)*\\.css$"
168
+ },
169
+ "minItems": 1,
170
+ "uniqueItems": true
171
+ },
172
+ "insetFreeChildren": {
173
+ "description": "Prop values under which the entry's direct JSX children must bring no content-item inset. While any condition holds, a child whose layout.geometry owns its margin, border, and padding (self on all three) double-insets the entry's own geometry unless one of the child's insetFreeWhen conditions holds; eslint-plugin-kerfjs reports it as KUI-L204.",
174
+ "type": "array",
175
+ "items": { "$ref": "#/$defs/propCondition" },
176
+ "minItems": 1
177
+ },
178
+ "insetFreeWhen": {
179
+ "description": "Prop values that render this inset-bearing entry with no margin, border, or padding of its own (Text flush). Any one condition makes the element inset-free.",
180
+ "type": "array",
181
+ "items": { "$ref": "#/$defs/propCondition" },
182
+ "minItems": 1
183
+ },
184
+ "rendersAs": {
185
+ "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.",
186
+ "type": "array",
187
+ "minItems": 1,
188
+ "items": { "type": "string", "pattern": "^[^:]+:[^:]+$" },
189
+ "uniqueItems": true
190
+ },
191
+ "jsxExports": {
192
+ "description": "Placement contracts for additional JSX exports from one selection entry. These exports do not stand for the entry's root or its zones.",
193
+ "type": "object",
194
+ "propertyNames": { "pattern": "^[A-Z][A-Za-z0-9]*$" },
195
+ "additionalProperties": {
196
+ "type": "object",
197
+ "required": ["parents"],
198
+ "properties": {
199
+ "parents": {
200
+ "type": "object",
201
+ "required": ["mode", "entries"],
202
+ "properties": {
203
+ "mode": { "enum": ["any", "root", "listed"] },
204
+ "entries": { "$ref": "#/$defs/stringList" }
205
+ },
206
+ "additionalProperties": false
207
+ }
208
+ },
209
+ "additionalProperties": false
210
+ }
211
+ },
212
+ "parents": {
213
+ "type": "object",
214
+ "required": ["mode", "entries"],
215
+ "properties": {
216
+ "mode": { "enum": ["any", "root", "listed"] },
217
+ "entries": { "$ref": "#/$defs/stringList" }
218
+ },
219
+ "additionalProperties": false
220
+ },
221
+ "contexts": { "$ref": "#/$defs/stringList" },
222
+ "zones": { "type": "array", "items": { "$ref": "#/$defs/zone" } },
223
+ "children": {
224
+ "type": "object",
225
+ "required": ["mode", "concepts", "requiredConcepts"],
226
+ "properties": {
227
+ "mode": { "enum": ["any", "none", "listed"] },
228
+ "concepts": { "$ref": "#/$defs/stringList" },
229
+ "requiredConcepts": { "$ref": "#/$defs/stringList" }
230
+ },
231
+ "additionalProperties": false
232
+ },
233
+ "state": { "type": "array", "items": { "$ref": "#/$defs/state" } },
234
+ "wiring": {
235
+ "type": "object",
236
+ "required": ["required", "helpers", "obligations"],
237
+ "properties": {
238
+ "required": { "type": "boolean" },
239
+ "scope": { "enum": ["application", "module"] },
240
+ "helpers": { "$ref": "#/$defs/stringList" },
241
+ "sources": {
242
+ "description": "Application-owned helper exports and their defining source files, relative to the catalog package root.",
243
+ "type": "array",
244
+ "items": {
245
+ "type": "object",
246
+ "required": ["export", "source"],
247
+ "properties": {
248
+ "export": { "type": "string", "minLength": 1 },
249
+ "source": { "type": "string", "minLength": 1 },
250
+ "returnsDisposer": { "type": "boolean" }
251
+ },
252
+ "additionalProperties": false
253
+ }
254
+ },
255
+ "actions": {
256
+ "description": "data-action values the application must handle with a root-delegated listener (delegate or delegateActions) instead of a named helper. Required wiring names at least one helper or action.",
257
+ "$ref": "#/$defs/stringList"
258
+ },
259
+ "obligations": { "$ref": "#/$defs/stringList" },
260
+ "stateAttributes": {
261
+ "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.",
262
+ "type": "array",
263
+ "items": { "$ref": "#/$defs/stateAttribute" }
264
+ }
265
+ },
266
+ "additionalProperties": false
267
+ },
268
+ "responsive": {
269
+ "type": "object",
270
+ "required": ["owner", "behaviors"],
271
+ "properties": {
272
+ "owner": {
273
+ "enum": ["application", "component", "shared", "not-applicable"]
274
+ },
275
+ "behaviors": { "$ref": "#/$defs/stringList" }
276
+ },
277
+ "additionalProperties": false
278
+ },
279
+ "layout": {
280
+ "type": "object",
281
+ "required": ["roles", "geometry"],
282
+ "properties": {
283
+ "roles": { "$ref": "#/$defs/stringList" },
284
+ "geometry": {
285
+ "type": "object",
286
+ "required": ["margin", "border", "padding"],
287
+ "properties": {
288
+ "margin": {
289
+ "enum": [
290
+ "self",
291
+ "parent",
292
+ "child",
293
+ "none",
294
+ "conditional",
295
+ "composed"
296
+ ]
297
+ },
298
+ "border": {
299
+ "enum": [
300
+ "self",
301
+ "parent",
302
+ "child",
303
+ "none",
304
+ "conditional",
305
+ "composed"
306
+ ]
307
+ },
308
+ "padding": {
309
+ "enum": [
310
+ "self",
311
+ "parent",
312
+ "child",
313
+ "none",
314
+ "conditional",
315
+ "composed"
316
+ ]
317
+ },
318
+ "notes": { "$ref": "#/$defs/stringList" }
319
+ },
320
+ "additionalProperties": false
321
+ }
322
+ },
323
+ "additionalProperties": false
324
+ },
325
+ "accessibility": {
326
+ "type": "object",
327
+ "required": ["obligations"],
328
+ "properties": { "obligations": { "$ref": "#/$defs/stringList" } },
329
+ "additionalProperties": false
330
+ },
331
+ "cssValueProps": {
332
+ "type": "array",
333
+ "items": { "$ref": "#/$defs/cssValueProp" }
334
+ },
335
+ "boundaries": {
336
+ "type": "object",
337
+ "required": ["rootClass", "publicClasses", "publicTokens"],
338
+ "properties": {
339
+ "rootClass": {
340
+ "oneOf": [
341
+ { "type": "string", "minLength": 1 },
342
+ { "type": "null" }
343
+ ]
344
+ },
345
+ "publicClasses": { "$ref": "#/$defs/stringList" },
346
+ "placeableClasses": {
347
+ "$ref": "#/$defs/stringList",
348
+ "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."
349
+ },
350
+ "rootElement": {
351
+ "type": "string",
352
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
353
+ "description": "The intrinsic element the component renders at its root. It identifies composed child roots for ownership checks; a placeableClasses class on a plain element of this tag recreates the component, while the class stays placeable on another carrier."
354
+ },
355
+ "descendantElements": {
356
+ "$ref": "#/$defs/stringList",
357
+ "description": "Intrinsic element tags that can appear below the component root."
358
+ },
359
+ "descendantRootAttribute": {
360
+ "type": "string",
361
+ "pattern": "^data-[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
362
+ "description": "Root data attribute anchoring ownership of arbitrary unclassed descendants."
363
+ },
364
+ "publicTokens": { "$ref": "#/$defs/stringList" },
365
+ "publicParts": { "$ref": "#/$defs/stringList" }
366
+ },
367
+ "additionalProperties": false
368
+ },
369
+ "diagnostics": {
370
+ "type": "array",
371
+ "items": { "$ref": "#/$defs/diagnostic" }
372
+ },
373
+ "provenance": {
374
+ "type": "object",
375
+ "required": ["selection", "composition"],
376
+ "properties": {
377
+ "selection": { "type": "string", "minLength": 1 },
378
+ "composition": { "type": "string", "minLength": 1 }
379
+ },
380
+ "additionalProperties": false
381
+ }
382
+ },
383
+ "additionalProperties": false
384
+ },
385
+ "propCondition": {
386
+ "type": "object",
387
+ "required": ["prop", "equals"],
388
+ "properties": {
389
+ "prop": {
390
+ "type": "string",
391
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$",
392
+ "description": "A JSX prop of the element."
393
+ },
394
+ "equals": {
395
+ "anyOf": [
396
+ { "type": "string" },
397
+ { "type": "number" },
398
+ { "type": "boolean" }
399
+ ],
400
+ "description": "The statically written value that satisfies the condition. A bare boolean prop (<Text flush />) equals true."
401
+ }
402
+ },
403
+ "additionalProperties": false
404
+ },
405
+ "cssValueProp": {
406
+ "type": "object",
407
+ "required": [
408
+ "path",
409
+ "grammar",
410
+ "helpers",
411
+ "shorthands",
412
+ "canonicalShorthands",
413
+ "exceptionalShorthands",
414
+ "rawPolicy",
415
+ "examples"
416
+ ],
417
+ "properties": {
418
+ "path": {
419
+ "type": "string",
420
+ "pattern": "^(?:[A-Za-z][A-Za-z0-9]*(?:\\[\\])?\\.)*[A-Za-z][A-Za-z0-9]*$"
421
+ },
422
+ "grammar": {
423
+ "enum": [
424
+ "length",
425
+ "size",
426
+ "flex",
427
+ "color",
428
+ "declarations",
429
+ "media-query",
430
+ "pixels"
431
+ ]
432
+ },
433
+ "helpers": { "$ref": "#/$defs/stringList" },
434
+ "nonStandaloneHelpers": { "$ref": "#/$defs/stringList" },
435
+ "shorthands": { "$ref": "#/$defs/stringList" },
436
+ "canonicalShorthands": { "$ref": "#/$defs/stringList" },
437
+ "exceptionalShorthands": { "$ref": "#/$defs/stringList" },
438
+ "rawPolicy": { "enum": ["forbid", "allow", "unsafe-only"] },
439
+ "unsafeHelper": { "type": "string", "minLength": 1 },
440
+ "examples": { "$ref": "#/$defs/stringList" }
441
+ },
442
+ "additionalProperties": false
443
+ }
444
+ }
445
+ }