create-kerf-component 5.0.0-beta.122 → 5.0.0-beta.124

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 CHANGED
@@ -58,6 +58,11 @@ check:styles` runs `kerf-ui-analyze` (from the `@kerfjs/ui` dev dependency)
58
58
  string/template/regular-expression literals cannot masquerade as public
59
59
  exports. The scaffold already declares TypeScript; run `npm install` before
60
60
  invoking its copied local checker in a fresh offline directory.
61
+ - **A structured prop schema**, `component-props.json`. `npm run props:generate`
62
+ builds the package, then runs `kerf-ui-props` (from `@kerfjs/ui`) over the
63
+ built declarations, so Kerf UI view tools (the editor, `validateView`,
64
+ `kerf-ui-view`) can use the package's components. `npm run props:check` fails
65
+ when the committed file is stale; `prepublishOnly` regenerates it.
61
66
  A component whose wiring helper writes runtime `data-*` state onto its DOM
62
67
  can declare it under `composition.wiring.stateAttributes` — each item is
63
68
  `{ name, on, helper, meaning }`, where `name` is a `data-*` name, `on` is the
@@ -88,6 +93,13 @@ check:styles` runs `kerf-ui-analyze` (from the `@kerfjs/ui` dev dependency)
88
93
  optional non-empty lists of `{ prop, equals }`; `prop` is a JSX prop name and
89
94
  `equals` a string, number, or boolean. The generator copies them into the
90
95
  catalog entry unchanged.
96
+ A component that renders a native control, link, or label declares
97
+ `composition.content`: `{ "interactive": [{ "kind": "root" }] }` when the
98
+ control is its root, `"contains"` when it renders one inside, and
99
+ `"whenProps": ["href"]` when only those props make it so; `exports` gives
100
+ another JSX export its own rules. `@kerfjs/ui`'s view validator then reports
101
+ a control placed in a `root` component's zones as `KUI-V014`. Omitted, the
102
+ component's placements are unchecked.
91
103
  Each `publicExports` item names a `package.json#exports` subpath that maps to
92
104
  the `src/` file exporting it. A private, bundled application
93
105
  (`package.json#private: true`) has no per-file `dist/` entries and is never
package/catalog.js CHANGED
@@ -763,6 +763,9 @@ function toEntry(packageName, component) {
763
763
  ...(component.composition.insetFreeWhen
764
764
  ? { insetFreeWhen: component.composition.insetFreeWhen }
765
765
  : {}),
766
+ ...(component.composition.content
767
+ ? { content: component.composition.content }
768
+ : {}),
766
769
  parents: component.composition.parents,
767
770
  contexts: component.composition.contexts,
768
771
  zones: component.composition.zones,
@@ -181,6 +181,17 @@
181
181
  "items": { "$ref": "#/$defs/propCondition" },
182
182
  "minItems": 1
183
183
  },
184
+ "content": { "$ref": "#/$defs/interactiveContent" },
185
+ "configTypes": {
186
+ "description": "Prop-value types (definition names in this package's component-props.json) that another component renders as this one, such as a NavStack view's toolbar config. A content field inside such a value is placed in this component, so this component is its parent for placement contracts. `TypeName.field` names one field of a type whose other fields render elsewhere.",
187
+ "type": "array",
188
+ "minItems": 1,
189
+ "items": {
190
+ "type": "string",
191
+ "pattern": "^[A-Z][A-Za-z0-9]*(\\.[a-z][A-Za-z0-9]*)?$"
192
+ },
193
+ "uniqueItems": true
194
+ },
184
195
  "rendersAs": {
185
196
  "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
197
  "type": "array",
@@ -382,6 +393,53 @@
382
393
  },
383
394
  "additionalProperties": false
384
395
  },
396
+ "interactiveContent": {
397
+ "description": "Whether the element renders interactive content (HTML's button, a, input, label, select, textarea, summary, and so on). The view validator reports KUI-V014 for any root or contains element placed, at any depth, in the zones of a root element, because interactive content cannot hold more of it. An omitted field is unchecked.",
398
+ "type": "object",
399
+ "minProperties": 1,
400
+ "properties": {
401
+ "interactive": {
402
+ "type": "array",
403
+ "minItems": 1,
404
+ "items": { "$ref": "#/$defs/interactiveRule" }
405
+ },
406
+ "exports": {
407
+ "description": "The same rules for each additional JSX export of the entry, keyed by export name. Exports do not inherit the entry's rules.",
408
+ "type": "object",
409
+ "additionalProperties": {
410
+ "type": "object",
411
+ "required": ["interactive"],
412
+ "properties": {
413
+ "interactive": {
414
+ "type": "array",
415
+ "minItems": 1,
416
+ "items": { "$ref": "#/$defs/interactiveRule" }
417
+ }
418
+ },
419
+ "additionalProperties": false
420
+ }
421
+ }
422
+ },
423
+ "additionalProperties": false
424
+ },
425
+ "interactiveRule": {
426
+ "type": "object",
427
+ "required": ["kind"],
428
+ "properties": {
429
+ "kind": {
430
+ "description": "root: the control or link is the element's own root. contains: the element renders one inside.",
431
+ "enum": ["root", "contains"]
432
+ },
433
+ "whenProps": {
434
+ "description": "Props that turn the rule on when any one is set to a value other than false. Omitted, the rule always applies.",
435
+ "type": "array",
436
+ "minItems": 1,
437
+ "uniqueItems": true,
438
+ "items": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9]*$" }
439
+ }
440
+ },
441
+ "additionalProperties": false
442
+ },
385
443
  "propCondition": {
386
444
  "type": "object",
387
445
  "required": ["prop", "equals"],
@@ -24,6 +24,25 @@
24
24
  },
25
25
  "additionalProperties": false,
26
26
  "$defs": {
27
+ "interactiveRules": {
28
+ "type": "array",
29
+ "minItems": 1,
30
+ "items": {
31
+ "type": "object",
32
+ "required": ["kind"],
33
+ "properties": {
34
+ "kind": { "enum": ["root", "contains"] },
35
+ "whenProps": {
36
+ "description": "Props that turn the rule on when any one is set to a value other than false. Omitted, the rule always applies.",
37
+ "type": "array",
38
+ "minItems": 1,
39
+ "uniqueItems": true,
40
+ "items": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9]*$" }
41
+ }
42
+ },
43
+ "additionalProperties": false
44
+ }
45
+ },
27
46
  "propCondition": {
28
47
  "type": "object",
29
48
  "required": ["prop", "equals"],
@@ -278,6 +297,26 @@
278
297
  "items": { "$ref": "#/$defs/propCondition" },
279
298
  "minItems": 1
280
299
  },
300
+ "content": {
301
+ "description": "Whether the component renders interactive content (a native button, link, form control, label, or summary). A root rule means the control is the component's own root, so its zones may hold no control or component that renders one; a contains rule means it renders one inside. The @kerfjs/ui view validator reports KUI-V014 for those placements. exports gives the same rules per additional JSX export, which do not inherit the component's. Omitted, placements are unchecked.",
302
+ "type": "object",
303
+ "minProperties": 1,
304
+ "properties": {
305
+ "interactive": { "$ref": "#/$defs/interactiveRules" },
306
+ "exports": {
307
+ "type": "object",
308
+ "additionalProperties": {
309
+ "type": "object",
310
+ "required": ["interactive"],
311
+ "properties": {
312
+ "interactive": { "$ref": "#/$defs/interactiveRules" }
313
+ },
314
+ "additionalProperties": false
315
+ }
316
+ }
317
+ },
318
+ "additionalProperties": false
319
+ },
281
320
  "parents": {
282
321
  "type": "object",
283
322
  "required": ["mode", "entries"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kerf-component",
3
- "version": "5.0.0-beta.122",
3
+ "version": "5.0.0-beta.124",
4
4
  "description": "Scaffold a publishable kerf component package that already follows kerf's hard packaging rules.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -94,8 +94,21 @@ so run `npm install` before the first local catalog command.
94
94
  ```bash
95
95
  npm run catalog:generate # write component-composition.json
96
96
  npm run catalog:check # no writes; fail when metadata, source, or output drift
97
+ npm run props:generate # build, then write component-props.json
98
+ npm run props:check # fail when component-props.json is stale
97
99
  ```
98
100
 
101
+ `component-props.json` is the structured prop schema that Kerf UI view
102
+ tools read: the editor's inspector, `validateView`, and the `kerf-ui-view`
103
+ generator. It is generated from the built declarations by `kerf-ui-props`,
104
+ which ships with `@kerfjs/ui`, and joined to the composition catalog by
105
+ component key. Each component's props are listed with their types, required
106
+ flags, documented defaults, zones, and slots. Add inspector hints (groups,
107
+ order, controls) in an overlay file named by
108
+ `package.json#kerfComponentCatalog.propsOverlay`. Run `props:generate` after
109
+ changing a component's props, then commit the file. `prepublishOnly` regenerates
110
+ it from the fresh build, so the published copy is always current.
111
+
99
112
  The generated catalog ships with the package. AI tools join each entry to
100
113
  Kerf's catalog by its `package:id` key, search this package first for
101
114
  application-specific concepts, and retain both packages' identities when
@@ -19,6 +19,7 @@
19
19
  "dist",
20
20
  "src/counter.css",
21
21
  "component-composition.json",
22
+ "component-props.json",
22
23
  "kerf.components.json",
23
24
  "README.md",
24
25
  "LICENSE"
@@ -27,20 +28,23 @@
27
28
  "build": "tsup",
28
29
  "catalog:generate": "node scripts/kerf-component-catalog.mjs --write",
29
30
  "catalog:check": "node scripts/kerf-component-catalog.mjs --check",
31
+ "props:generate": "npm run build && kerf-ui-props --write",
32
+ "props:check": "kerf-ui-props --check",
30
33
  "check:styles": "kerf-ui-analyze --root . src",
31
34
  "typecheck": "tsc --noEmit",
32
- "prepublishOnly": "npm run catalog:check && npm run check:styles && npm run build"
35
+ "prepublishOnly": "npm run catalog:check && npm run check:styles && npm run build && kerf-ui-props --write"
33
36
  },
34
37
  "kerfComponentCatalog": {
35
38
  "source": "./kerf.components.json",
36
- "output": "./component-composition.json"
39
+ "output": "./component-composition.json",
40
+ "propsOutput": "./component-props.json"
37
41
  },
38
42
  "peerDependencies": {
39
43
  "kerfjs": "^5.0.0-0"
40
44
  },
41
45
  "devDependencies": {
42
- "kerfjs": "^5.0.0-beta.122",
43
- "@kerfjs/ui": "^5.0.0-beta.122",
46
+ "kerfjs": "^5.0.0-beta.124",
47
+ "@kerfjs/ui": "^5.0.0-beta.124",
44
48
  "tsup": "^8",
45
49
  "typescript": "^5 || ^6"
46
50
  }