create-kerf-component 5.0.0-beta.106 → 5.0.0-beta.107

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
@@ -77,6 +77,17 @@ check:styles` runs `kerf-ui-analyze` (from the `@kerfjs/ui` dev dependency)
77
77
  `["@kerfjs/ui:toolbar-control-group"]`), so the `ui-composition` lint treats
78
78
  it as that root. Every key must resolve to an entry generated in the same run
79
79
  or to an installed package's catalog.
80
+ A container that already insets its content in some form (an embedded
81
+ appearance) declares `composition.insetFreeChildren`: prop conditions such as
82
+ `[{ "prop": "appearance", "equals": "embedded" }]`. While one holds, the
83
+ `ui-composition` lint reports a direct child whose geometry is `self` on
84
+ margin, border, and padding as `KUI-L204` (a double inset). An inset-bearing
85
+ component that has an inset-free form declares `composition.insetFreeWhen`
86
+ (`[{ "prop": "flush", "equals": true }]`, where a bare boolean prop equals
87
+ `true`), which the lint accepts and names as the fix. Both fields are
88
+ optional non-empty lists of `{ prop, equals }`; `prop` is a JSX prop name and
89
+ `equals` a string, number, or boolean. The generator copies them into the
90
+ catalog entry unchanged.
80
91
  Each `publicExports` item names a `package.json#exports` subpath that maps to
81
92
  the `src/` file exporting it. A private, bundled application
82
93
  (`package.json#private: true`) has no per-file `dist/` entries and is never
package/catalog.js CHANGED
@@ -84,8 +84,21 @@ function validateSchemaValue(value, rule, path, rootSchema, diagnostics) {
84
84
  validateSchemaValue(value, candidate, path, rootSchema, failures);
85
85
  return failures;
86
86
  });
87
- if (alternatives.every((failures) => failures.length))
88
- diagnostics.push(`${path}: does not match any allowed schema variant`);
87
+ if (alternatives.every((failures) => failures.length)) {
88
+ // A union of bare types (a prop condition's `equals`) names the types.
89
+ const types = rule.anyOf.every(
90
+ (candidate) =>
91
+ Object.keys(candidate).length === 1 &&
92
+ typeof candidate.type === 'string',
93
+ )
94
+ ? rule.anyOf.map((candidate) => candidate.type)
95
+ : null;
96
+ diagnostics.push(
97
+ types
98
+ ? `${path}: expected ${types.join(' or ')}`
99
+ : `${path}: does not match any allowed schema variant`,
100
+ );
101
+ }
89
102
  return;
90
103
  }
91
104
  if (rule.const !== undefined && value !== rule.const)
@@ -739,6 +752,12 @@ function toEntry(packageName, component) {
739
752
  ...(component.composition.rendersAs
740
753
  ? { rendersAs: component.composition.rendersAs }
741
754
  : {}),
755
+ ...(component.composition.insetFreeChildren
756
+ ? { insetFreeChildren: component.composition.insetFreeChildren }
757
+ : {}),
758
+ ...(component.composition.insetFreeWhen
759
+ ? { insetFreeWhen: component.composition.insetFreeWhen }
760
+ : {}),
742
761
  parents: component.composition.parents,
743
762
  contexts: component.composition.contexts,
744
763
  zones: component.composition.zones,
@@ -169,6 +169,18 @@
169
169
  "minItems": 1,
170
170
  "uniqueItems": true
171
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
+ },
172
184
  "rendersAs": {
173
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.",
174
186
  "type": "array",
@@ -369,6 +381,26 @@
369
381
  },
370
382
  "additionalProperties": false
371
383
  },
384
+ "propCondition": {
385
+ "type": "object",
386
+ "required": ["prop", "equals"],
387
+ "properties": {
388
+ "prop": {
389
+ "type": "string",
390
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$",
391
+ "description": "A JSX prop of the element."
392
+ },
393
+ "equals": {
394
+ "anyOf": [
395
+ { "type": "string" },
396
+ { "type": "number" },
397
+ { "type": "boolean" }
398
+ ],
399
+ "description": "The statically written value that satisfies the condition. A bare boolean prop (<Text flush />) equals true."
400
+ }
401
+ },
402
+ "additionalProperties": false
403
+ },
372
404
  "cssValueProp": {
373
405
  "type": "object",
374
406
  "required": [
@@ -24,6 +24,26 @@
24
24
  },
25
25
  "additionalProperties": false,
26
26
  "$defs": {
27
+ "propCondition": {
28
+ "type": "object",
29
+ "required": ["prop", "equals"],
30
+ "properties": {
31
+ "prop": {
32
+ "type": "string",
33
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$",
34
+ "description": "A JSX prop of the element."
35
+ },
36
+ "equals": {
37
+ "anyOf": [
38
+ { "type": "string" },
39
+ { "type": "number" },
40
+ { "type": "boolean" }
41
+ ],
42
+ "description": "The statically written value that satisfies the condition. A bare boolean prop (<Card flush />) equals true."
43
+ }
44
+ },
45
+ "additionalProperties": false
46
+ },
27
47
  "stateAttribute": {
28
48
  "type": "object",
29
49
  "required": ["name", "on", "helper", "meaning"],
@@ -246,6 +266,18 @@
246
266
  "items": { "type": "string", "pattern": "^[^:]+:[^:]+$" },
247
267
  "uniqueItems": true
248
268
  },
269
+ "insetFreeChildren": {
270
+ "description": "Prop values under which this component's direct JSX children must bring no content-item inset (for example an embedded appearance that already insets its content). While any condition holds, a child whose layout.geometry is self on margin, border, and padding double-insets this component unless one of the child's insetFreeWhen conditions holds; eslint-plugin-kerfjs reports it as KUI-L204.",
271
+ "type": "array",
272
+ "items": { "$ref": "#/$defs/propCondition" },
273
+ "minItems": 1
274
+ },
275
+ "insetFreeWhen": {
276
+ "description": "Prop values that render this inset-bearing component with no margin, border, or padding of its own (for example a flush prop). Any one condition makes the element inset-free inside a parent that declares insetFreeChildren.",
277
+ "type": "array",
278
+ "items": { "$ref": "#/$defs/propCondition" },
279
+ "minItems": 1
280
+ },
249
281
  "parents": {
250
282
  "type": "object",
251
283
  "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.106",
3
+ "version": "5.0.0-beta.107",
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",
@@ -39,8 +39,8 @@
39
39
  "kerfjs": "^5.0.0-0"
40
40
  },
41
41
  "devDependencies": {
42
- "kerfjs": "^5.0.0-beta.106",
43
- "@kerfjs/ui": "^5.0.0-beta.106",
42
+ "kerfjs": "^5.0.0-beta.107",
43
+ "@kerfjs/ui": "^5.0.0-beta.107",
44
44
  "tsup": "^8",
45
45
  "typescript": "^5 || ^6"
46
46
  }