create-kerf-component 5.0.0-beta.95 → 5.0.0-beta.96
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/catalog.js
CHANGED
|
@@ -321,7 +321,7 @@ function validateStringList(value, at, diagnostics, { nonempty = false } = {}) {
|
|
|
321
321
|
);
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
function validateComposition(component, at, diagnostics) {
|
|
324
|
+
function validateComposition(component, at, diagnostics, packageRoot) {
|
|
325
325
|
const composition = component.composition ?? {};
|
|
326
326
|
if (!['any', 'root', 'listed'].includes(composition.parents?.mode))
|
|
327
327
|
diagnostics.push(`${at}.composition.parents.mode: invalid parent mode`);
|
|
@@ -339,11 +339,20 @@ function validateComposition(component, at, diagnostics) {
|
|
|
339
339
|
if (!Array.isArray(composition.zones))
|
|
340
340
|
diagnostics.push(`${at}.composition.zones: expected an array`);
|
|
341
341
|
const zoneIds = new Set();
|
|
342
|
+
const zoneProps = new Set();
|
|
342
343
|
for (const zone of composition.zones ?? []) {
|
|
343
344
|
const zoneAt = `${at}.composition.zones.${zone?.id ?? '<unknown>'}`;
|
|
344
345
|
if (!zone?.id || zoneIds.has(zone.id))
|
|
345
346
|
diagnostics.push(`${zoneAt}.id: expected a unique non-empty id`);
|
|
346
347
|
zoneIds.add(zone?.id);
|
|
348
|
+
const prop = zone?.jsx?.prop;
|
|
349
|
+
if (prop !== undefined) {
|
|
350
|
+
if (zoneProps.has(prop))
|
|
351
|
+
diagnostics.push(
|
|
352
|
+
`${zoneAt}.jsx.prop: ${prop} already fills another zone`,
|
|
353
|
+
);
|
|
354
|
+
zoneProps.add(prop);
|
|
355
|
+
}
|
|
347
356
|
validateStringList(zone?.accepts, `${zoneAt}.accepts`, diagnostics, {
|
|
348
357
|
nonempty: true,
|
|
349
358
|
});
|
|
@@ -412,13 +421,49 @@ function validateComposition(component, at, diagnostics) {
|
|
|
412
421
|
composition.wiring?.helpers,
|
|
413
422
|
`${at}.composition.wiring.helpers`,
|
|
414
423
|
diagnostics,
|
|
415
|
-
{ nonempty: composition.wiring?.required === true },
|
|
416
424
|
);
|
|
425
|
+
if ('actions' in (composition.wiring ?? {}))
|
|
426
|
+
validateStringList(
|
|
427
|
+
composition.wiring.actions,
|
|
428
|
+
`${at}.composition.wiring.actions`,
|
|
429
|
+
diagnostics,
|
|
430
|
+
);
|
|
431
|
+
// Required wiring names something the app must do: a helper to call, or a
|
|
432
|
+
// root-delegated data-action to handle.
|
|
433
|
+
if (
|
|
434
|
+
composition.wiring?.required === true &&
|
|
435
|
+
Array.isArray(composition.wiring.helpers) &&
|
|
436
|
+
!composition.wiring.helpers.length &&
|
|
437
|
+
!composition.wiring.actions?.length
|
|
438
|
+
)
|
|
439
|
+
diagnostics.push(
|
|
440
|
+
`${at}.composition.wiring: required wiring names at least one helper or action`,
|
|
441
|
+
);
|
|
417
442
|
validateStringList(
|
|
418
443
|
composition.wiring?.obligations,
|
|
419
444
|
`${at}.composition.wiring.obligations`,
|
|
420
445
|
diagnostics,
|
|
421
446
|
);
|
|
447
|
+
const helperSourcesSeen = new Set();
|
|
448
|
+
for (const helperSource of composition.wiring?.sources ?? []) {
|
|
449
|
+
const sourceAt = `${at}.composition.wiring.sources.${helperSource?.export}`;
|
|
450
|
+
if (helperSourcesSeen.has(helperSource?.export))
|
|
451
|
+
diagnostics.push(`${sourceAt}: declared more than once`);
|
|
452
|
+
helperSourcesSeen.add(helperSource?.export);
|
|
453
|
+
if (!composition.wiring.helpers?.includes(helperSource?.export))
|
|
454
|
+
diagnostics.push(
|
|
455
|
+
`${sourceAt}: ${helperSource?.export} is not listed in composition.wiring.helpers`,
|
|
456
|
+
);
|
|
457
|
+
const file = resolve(packageRoot, helperSource?.source ?? '');
|
|
458
|
+
if (!helperSource?.source || !existsSync(file))
|
|
459
|
+
diagnostics.push(
|
|
460
|
+
`${sourceAt}.source: file does not exist: ${helperSource?.source}`,
|
|
461
|
+
);
|
|
462
|
+
else if (!exportedNamesFromFile(file).has(helperSource.export))
|
|
463
|
+
diagnostics.push(
|
|
464
|
+
`${sourceAt}: ${helperSource.export} is not exported by ${helperSource.source}`,
|
|
465
|
+
);
|
|
466
|
+
}
|
|
422
467
|
const stateAttributes = composition.wiring?.stateAttributes;
|
|
423
468
|
if (stateAttributes !== undefined && !Array.isArray(stateAttributes))
|
|
424
469
|
diagnostics.push(
|
|
@@ -609,7 +654,7 @@ function validateComponent(
|
|
|
609
654
|
`${at}.sourceLinks: local source link does not exist: ${link}`,
|
|
610
655
|
);
|
|
611
656
|
}
|
|
612
|
-
validateComposition(component, at, diagnostics);
|
|
657
|
+
validateComposition(component, at, diagnostics, packageRoot);
|
|
613
658
|
validateStringList(
|
|
614
659
|
component.boundaries?.publicClasses,
|
|
615
660
|
`${at}.boundaries.publicClasses`,
|
|
@@ -239,6 +239,10 @@
|
|
|
239
239
|
"additionalProperties": false
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
|
+
"actions": {
|
|
243
|
+
"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.",
|
|
244
|
+
"$ref": "#/$defs/stringList"
|
|
245
|
+
},
|
|
242
246
|
"obligations": { "$ref": "#/$defs/stringList" },
|
|
243
247
|
"stateAttributes": {
|
|
244
248
|
"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.",
|
|
@@ -263,6 +263,15 @@
|
|
|
263
263
|
"required": ["id", "accepts", "cardinality", "exclusiveWith"],
|
|
264
264
|
"properties": {
|
|
265
265
|
"id": { "type": "string", "minLength": 1 },
|
|
266
|
+
"jsx": {
|
|
267
|
+
"description": "The JSX prop that fills this zone (children for the default slot), so composition checks can map a prop's value to its zone. Unique per component.",
|
|
268
|
+
"type": "object",
|
|
269
|
+
"required": ["prop"],
|
|
270
|
+
"properties": {
|
|
271
|
+
"prop": { "type": "string", "minLength": 1 }
|
|
272
|
+
},
|
|
273
|
+
"additionalProperties": false
|
|
274
|
+
},
|
|
266
275
|
"accepts": { "$ref": "#/$defs/stringList" },
|
|
267
276
|
"cardinality": { "$ref": "#/$defs/cardinality" },
|
|
268
277
|
"exclusiveWith": { "$ref": "#/$defs/stringList" }
|
|
@@ -298,7 +307,28 @@
|
|
|
298
307
|
"required": ["required", "helpers", "obligations"],
|
|
299
308
|
"properties": {
|
|
300
309
|
"required": { "type": "boolean" },
|
|
310
|
+
"scope": {
|
|
311
|
+
"description": "Where a required helper must run: application (default) anywhere reachable from a profile wiring entry, or module in the module that renders the component.",
|
|
312
|
+
"enum": ["application", "module"]
|
|
313
|
+
},
|
|
301
314
|
"helpers": { "$ref": "#/$defs/stringList" },
|
|
315
|
+
"sources": {
|
|
316
|
+
"description": "Where each application-owned helper in helpers is defined: its export name and source file relative to the package root. UI lint resolves relative imports of these helpers to verify page-root wiring (KUI-L401).",
|
|
317
|
+
"type": "array",
|
|
318
|
+
"items": {
|
|
319
|
+
"type": "object",
|
|
320
|
+
"required": ["export", "source"],
|
|
321
|
+
"properties": {
|
|
322
|
+
"export": { "type": "string", "minLength": 1 },
|
|
323
|
+
"source": { "type": "string", "minLength": 1 }
|
|
324
|
+
},
|
|
325
|
+
"additionalProperties": false
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"actions": {
|
|
329
|
+
"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; UI lint verifies a reachable handler (KUI-L401).",
|
|
330
|
+
"$ref": "#/$defs/stringList"
|
|
331
|
+
},
|
|
302
332
|
"obligations": { "$ref": "#/$defs/stringList" },
|
|
303
333
|
"stateAttributes": {
|
|
304
334
|
"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.",
|
|
@@ -323,7 +353,10 @@
|
|
|
323
353
|
"type": "object",
|
|
324
354
|
"required": ["roles", "geometry"],
|
|
325
355
|
"properties": {
|
|
326
|
-
"roles": {
|
|
356
|
+
"roles": {
|
|
357
|
+
"description": "One or more grouping roles for selection and catalog navigation. Prefer @kerfjs/ui's vocabulary so merged catalogs group consistently: structure, navigation, controls, actions, forms, feedback, foundation, media, layout, helpers, reference-composition (see docs/13-component-packages.md, Layout roles).",
|
|
358
|
+
"$ref": "#/$defs/stringList"
|
|
359
|
+
},
|
|
327
360
|
"geometry": {
|
|
328
361
|
"type": "object",
|
|
329
362
|
"required": ["margin", "border", "padding"],
|
package/package.json
CHANGED
package/template/package.json
CHANGED