@almadar/patterns 2.20.0 → 2.20.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/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +40 -1
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -28,7 +28,28 @@
|
|
|
28
28
|
* Reserved for future use: `"entity"`, `"config-binding"`. Add here
|
|
29
29
|
* rather than inventing per-consumer markers.
|
|
30
30
|
*/
|
|
31
|
-
export type PropKind = 'event' | 'event-list';
|
|
31
|
+
export type PropKind = 'event' | 'event-ref' | 'event-listen' | 'event-list' | 'callback';
|
|
32
|
+
/**
|
|
33
|
+
* One field of an emit/listen payload schema, mirrored into the registry
|
|
34
|
+
* by pattern-sync from a component's `EventEmit<P>` / `EventListen<P>`
|
|
35
|
+
* brand. Validator (L2.2) compares this against the trait's declared
|
|
36
|
+
* `emits { EVENT { ... } }` / `listens` payload shape.
|
|
37
|
+
*/
|
|
38
|
+
export interface PatternPayloadField {
|
|
39
|
+
name: string;
|
|
40
|
+
type: string;
|
|
41
|
+
required?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* One positional parameter of a React callback prop. Validator (L2.2)
|
|
45
|
+
* uses the names to verify name-and-type parity with the trait's declared
|
|
46
|
+
* event payload; codegen (C2) uses the same names to wrap the dispatch
|
|
47
|
+
* site as `(name) => dispatch('EVENT', { name })`.
|
|
48
|
+
*/
|
|
49
|
+
export interface PatternCallbackArg {
|
|
50
|
+
name: string;
|
|
51
|
+
type: string;
|
|
52
|
+
}
|
|
32
53
|
/**
|
|
33
54
|
* Schema describing a single prop in a pattern's propsSchema. Emitted
|
|
34
55
|
* by the pattern-sync tool (`tools/almadar-pattern-sync/`) from a
|
|
@@ -57,4 +78,22 @@ export interface PatternPropDef {
|
|
|
57
78
|
* omitted. Only meaningful alongside `kind: "event-list"`.
|
|
58
79
|
*/
|
|
59
80
|
eventField?: string;
|
|
81
|
+
/**
|
|
82
|
+
* For `kind: "event-ref"` whose source is `EventEmit<P>`: the
|
|
83
|
+
* structural shape of `P` — the bus payload the component fires when
|
|
84
|
+
* the prop is bound. Validator compares against the trait's declared
|
|
85
|
+
* `emits { EVENT { ... } }` payload.
|
|
86
|
+
*/
|
|
87
|
+
emitPayloadSchema?: PatternPayloadField[];
|
|
88
|
+
/**
|
|
89
|
+
* For `kind: "event-listen"` whose source is `EventListen<P>`: the
|
|
90
|
+
* structural shape of `P` — the payload the component subscribes to.
|
|
91
|
+
*/
|
|
92
|
+
listenPayloadSchema?: PatternPayloadField[];
|
|
93
|
+
/**
|
|
94
|
+
* For `kind: "callback"`: positional parameter list of the function
|
|
95
|
+
* type. C2 uses these names to build the named-arg → object-payload
|
|
96
|
+
* wrapper at the dispatch site.
|
|
97
|
+
*/
|
|
98
|
+
callbackArgs?: PatternCallbackArg[];
|
|
60
99
|
}
|