@almadar/patterns 2.14.1 → 2.16.0

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/dist/types.d.ts CHANGED
@@ -3,8 +3,58 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- /** Schema describing a single prop in a pattern's propsSchema */
7
- export type PatternPropDef = {
6
+ /**
7
+ * Semantic kind marker for a pattern prop. Complements the structural
8
+ * `types` field (which declares "string" / "array" / "object" / ...)
9
+ * with meaning — *what is this value, beyond its JSON shape?*
10
+ *
11
+ * Consumers of the patterns registry (the Rust compiler's inline phase
12
+ * in `orbital-compiler`, the JS preprocess in `@almadar/runtime`, and
13
+ * verifiers in `@almadar-io/verify`) read `kind` to decide whether a
14
+ * prop participates in call-site `events: { OLD: NEW }` renames,
15
+ * entity substitutions, and similar structural rewrites. Without this
16
+ * marker, consumers fall back to name-matching heuristics that drift
17
+ * between implementations — the problem this field eliminates.
18
+ *
19
+ * Kinds:
20
+ * - `"event"` — the prop value is a declared event key (string).
21
+ * Inline phase rewrites via the trait's events map.
22
+ * Source type: `EventKey` from `@almadar/core`.
23
+ * - `"event-list"` — the prop is an array of action-descriptor objects.
24
+ * Each item has a field (default `"event"`, override
25
+ * with {@link PatternPropDef.eventField}) holding a
26
+ * declared event key. Same rename applies per item.
27
+ *
28
+ * Reserved for future use: `"entity"`, `"config-binding"`. Add here
29
+ * rather than inventing per-consumer markers.
30
+ */
31
+ export type PropKind = 'event' | 'event-list';
32
+ /**
33
+ * Schema describing a single prop in a pattern's propsSchema. Emitted
34
+ * by the pattern-sync tool (`tools/almadar-pattern-sync/`) from a
35
+ * component's TypeScript Props interface, consumed by every part of
36
+ * the stack that inspects pattern shape.
37
+ */
38
+ export interface PatternPropDef {
39
+ /** Structural JSON types this prop accepts ("string", "array", ...). */
8
40
  types?: string[];
41
+ /** Whether the prop is required at the pattern call site. */
9
42
  required?: boolean;
10
- };
43
+ /** Human-readable prop description (from TS JSDoc when available). */
44
+ description?: string;
45
+ /** Allowed literal values when the TS type is a string-literal union. */
46
+ enumValues?: string[];
47
+ /**
48
+ * Semantic marker layered over {@link PatternPropDef.types}. Set by
49
+ * the pattern-sync tool when the prop's TS type references a
50
+ * semantic alias (e.g. `EventKey` from `@almadar/core`). Absent when
51
+ * the prop has no additional semantic meaning beyond its JSON shape.
52
+ */
53
+ kind?: PropKind;
54
+ /**
55
+ * For `kind: "event-list"`: the name of the field inside each array
56
+ * item that holds the event key. Defaults to `"event"` when
57
+ * omitted. Only meaningful alongside `kind: "event-list"`.
58
+ */
59
+ eventField?: string;
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/patterns",
3
- "version": "2.14.1",
3
+ "version": "2.16.0",
4
4
  "description": "Pattern registry and component mappings for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",