create-kerf-component 5.0.0-beta.9 → 6.0.0-beta.1
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 +75 -3
- package/catalog.js +937 -0
- package/component-composition.schema.json +408 -0
- package/component-metadata.schema.json +282 -0
- package/index.js +30 -3
- package/package.json +9 -2
- package/template/README.md +53 -10
- package/template/component-composition.json +144 -0
- package/template/kerf.components.json +71 -0
- package/template/package.json +16 -4
- package/template/src/counter.css +38 -0
- package/template/src/counter.tsx +18 -3
|
@@ -0,0 +1,408 @@
|
|
|
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
|
+
"rendersAs": {
|
|
173
|
+
"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.",
|
|
174
|
+
"type": "array",
|
|
175
|
+
"minItems": 1,
|
|
176
|
+
"items": { "type": "string", "pattern": "^[^:]+:[^:]+$" },
|
|
177
|
+
"uniqueItems": true
|
|
178
|
+
},
|
|
179
|
+
"jsxExports": {
|
|
180
|
+
"description": "Placement contracts for additional JSX exports from one selection entry. These exports do not stand for the entry's root or its zones.",
|
|
181
|
+
"type": "object",
|
|
182
|
+
"propertyNames": { "pattern": "^[A-Z][A-Za-z0-9]*$" },
|
|
183
|
+
"additionalProperties": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"required": ["parents"],
|
|
186
|
+
"properties": {
|
|
187
|
+
"parents": {
|
|
188
|
+
"type": "object",
|
|
189
|
+
"required": ["mode", "entries"],
|
|
190
|
+
"properties": {
|
|
191
|
+
"mode": { "enum": ["any", "root", "listed"] },
|
|
192
|
+
"entries": { "$ref": "#/$defs/stringList" }
|
|
193
|
+
},
|
|
194
|
+
"additionalProperties": false
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"additionalProperties": false
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"parents": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"required": ["mode", "entries"],
|
|
203
|
+
"properties": {
|
|
204
|
+
"mode": { "enum": ["any", "root", "listed"] },
|
|
205
|
+
"entries": { "$ref": "#/$defs/stringList" }
|
|
206
|
+
},
|
|
207
|
+
"additionalProperties": false
|
|
208
|
+
},
|
|
209
|
+
"contexts": { "$ref": "#/$defs/stringList" },
|
|
210
|
+
"zones": { "type": "array", "items": { "$ref": "#/$defs/zone" } },
|
|
211
|
+
"children": {
|
|
212
|
+
"type": "object",
|
|
213
|
+
"required": ["mode", "concepts", "requiredConcepts"],
|
|
214
|
+
"properties": {
|
|
215
|
+
"mode": { "enum": ["any", "none", "listed"] },
|
|
216
|
+
"concepts": { "$ref": "#/$defs/stringList" },
|
|
217
|
+
"requiredConcepts": { "$ref": "#/$defs/stringList" }
|
|
218
|
+
},
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
},
|
|
221
|
+
"state": { "type": "array", "items": { "$ref": "#/$defs/state" } },
|
|
222
|
+
"wiring": {
|
|
223
|
+
"type": "object",
|
|
224
|
+
"required": ["required", "helpers", "obligations"],
|
|
225
|
+
"properties": {
|
|
226
|
+
"required": { "type": "boolean" },
|
|
227
|
+
"scope": { "enum": ["application", "module"] },
|
|
228
|
+
"helpers": { "$ref": "#/$defs/stringList" },
|
|
229
|
+
"sources": {
|
|
230
|
+
"description": "Application-owned helper exports and their defining source files, relative to the catalog package root.",
|
|
231
|
+
"type": "array",
|
|
232
|
+
"items": {
|
|
233
|
+
"type": "object",
|
|
234
|
+
"required": ["export", "source"],
|
|
235
|
+
"properties": {
|
|
236
|
+
"export": { "type": "string", "minLength": 1 },
|
|
237
|
+
"source": { "type": "string", "minLength": 1 }
|
|
238
|
+
},
|
|
239
|
+
"additionalProperties": false
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"obligations": { "$ref": "#/$defs/stringList" },
|
|
243
|
+
"stateAttributes": {
|
|
244
|
+
"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.",
|
|
245
|
+
"type": "array",
|
|
246
|
+
"items": { "$ref": "#/$defs/stateAttribute" }
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
"additionalProperties": false
|
|
250
|
+
},
|
|
251
|
+
"responsive": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"required": ["owner", "behaviors"],
|
|
254
|
+
"properties": {
|
|
255
|
+
"owner": {
|
|
256
|
+
"enum": ["application", "component", "shared", "not-applicable"]
|
|
257
|
+
},
|
|
258
|
+
"behaviors": { "$ref": "#/$defs/stringList" }
|
|
259
|
+
},
|
|
260
|
+
"additionalProperties": false
|
|
261
|
+
},
|
|
262
|
+
"layout": {
|
|
263
|
+
"type": "object",
|
|
264
|
+
"required": ["roles", "geometry"],
|
|
265
|
+
"properties": {
|
|
266
|
+
"roles": { "$ref": "#/$defs/stringList" },
|
|
267
|
+
"geometry": {
|
|
268
|
+
"type": "object",
|
|
269
|
+
"required": ["margin", "border", "padding"],
|
|
270
|
+
"properties": {
|
|
271
|
+
"margin": {
|
|
272
|
+
"enum": [
|
|
273
|
+
"self",
|
|
274
|
+
"parent",
|
|
275
|
+
"child",
|
|
276
|
+
"none",
|
|
277
|
+
"conditional",
|
|
278
|
+
"composed"
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"border": {
|
|
282
|
+
"enum": [
|
|
283
|
+
"self",
|
|
284
|
+
"parent",
|
|
285
|
+
"child",
|
|
286
|
+
"none",
|
|
287
|
+
"conditional",
|
|
288
|
+
"composed"
|
|
289
|
+
]
|
|
290
|
+
},
|
|
291
|
+
"padding": {
|
|
292
|
+
"enum": [
|
|
293
|
+
"self",
|
|
294
|
+
"parent",
|
|
295
|
+
"child",
|
|
296
|
+
"none",
|
|
297
|
+
"conditional",
|
|
298
|
+
"composed"
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
"notes": { "$ref": "#/$defs/stringList" }
|
|
302
|
+
},
|
|
303
|
+
"additionalProperties": false
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"additionalProperties": false
|
|
307
|
+
},
|
|
308
|
+
"accessibility": {
|
|
309
|
+
"type": "object",
|
|
310
|
+
"required": ["obligations"],
|
|
311
|
+
"properties": { "obligations": { "$ref": "#/$defs/stringList" } },
|
|
312
|
+
"additionalProperties": false
|
|
313
|
+
},
|
|
314
|
+
"cssValueProps": {
|
|
315
|
+
"type": "array",
|
|
316
|
+
"items": { "$ref": "#/$defs/cssValueProp" }
|
|
317
|
+
},
|
|
318
|
+
"boundaries": {
|
|
319
|
+
"type": "object",
|
|
320
|
+
"required": ["rootClass", "publicClasses", "publicTokens"],
|
|
321
|
+
"properties": {
|
|
322
|
+
"rootClass": {
|
|
323
|
+
"oneOf": [
|
|
324
|
+
{ "type": "string", "minLength": 1 },
|
|
325
|
+
{ "type": "null" }
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
"publicClasses": { "$ref": "#/$defs/stringList" },
|
|
329
|
+
"placeableClasses": {
|
|
330
|
+
"$ref": "#/$defs/stringList",
|
|
331
|
+
"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."
|
|
332
|
+
},
|
|
333
|
+
"rootElement": {
|
|
334
|
+
"type": "string",
|
|
335
|
+
"pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
|
|
336
|
+
"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."
|
|
337
|
+
},
|
|
338
|
+
"descendantElements": {
|
|
339
|
+
"$ref": "#/$defs/stringList",
|
|
340
|
+
"description": "Intrinsic element tags that can appear below the component root."
|
|
341
|
+
},
|
|
342
|
+
"descendantRootAttribute": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"pattern": "^data-[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
|
|
345
|
+
"description": "Root data attribute anchoring ownership of arbitrary unclassed descendants."
|
|
346
|
+
},
|
|
347
|
+
"publicTokens": { "$ref": "#/$defs/stringList" },
|
|
348
|
+
"publicParts": { "$ref": "#/$defs/stringList" }
|
|
349
|
+
},
|
|
350
|
+
"additionalProperties": false
|
|
351
|
+
},
|
|
352
|
+
"diagnostics": {
|
|
353
|
+
"type": "array",
|
|
354
|
+
"items": { "$ref": "#/$defs/diagnostic" }
|
|
355
|
+
},
|
|
356
|
+
"provenance": {
|
|
357
|
+
"type": "object",
|
|
358
|
+
"required": ["selection", "composition"],
|
|
359
|
+
"properties": {
|
|
360
|
+
"selection": { "type": "string", "minLength": 1 },
|
|
361
|
+
"composition": { "type": "string", "minLength": 1 }
|
|
362
|
+
},
|
|
363
|
+
"additionalProperties": false
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"additionalProperties": false
|
|
367
|
+
},
|
|
368
|
+
"cssValueProp": {
|
|
369
|
+
"type": "object",
|
|
370
|
+
"required": [
|
|
371
|
+
"path",
|
|
372
|
+
"grammar",
|
|
373
|
+
"helpers",
|
|
374
|
+
"shorthands",
|
|
375
|
+
"canonicalShorthands",
|
|
376
|
+
"exceptionalShorthands",
|
|
377
|
+
"rawPolicy",
|
|
378
|
+
"examples"
|
|
379
|
+
],
|
|
380
|
+
"properties": {
|
|
381
|
+
"path": {
|
|
382
|
+
"type": "string",
|
|
383
|
+
"pattern": "^[A-Za-z][A-Za-z0-9]*(?:\\[\\]\\.[A-Za-z][A-Za-z0-9]*)?$"
|
|
384
|
+
},
|
|
385
|
+
"grammar": {
|
|
386
|
+
"enum": [
|
|
387
|
+
"length",
|
|
388
|
+
"size",
|
|
389
|
+
"flex",
|
|
390
|
+
"color",
|
|
391
|
+
"declarations",
|
|
392
|
+
"media-query",
|
|
393
|
+
"pixels"
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"helpers": { "$ref": "#/$defs/stringList" },
|
|
397
|
+
"nonStandaloneHelpers": { "$ref": "#/$defs/stringList" },
|
|
398
|
+
"shorthands": { "$ref": "#/$defs/stringList" },
|
|
399
|
+
"canonicalShorthands": { "$ref": "#/$defs/stringList" },
|
|
400
|
+
"exceptionalShorthands": { "$ref": "#/$defs/stringList" },
|
|
401
|
+
"rawPolicy": { "enum": ["forbid", "allow", "unsafe-only"] },
|
|
402
|
+
"unsafeHelper": { "type": "string", "minLength": 1 },
|
|
403
|
+
"examples": { "$ref": "#/$defs/stringList" }
|
|
404
|
+
},
|
|
405
|
+
"additionalProperties": false
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|