@almadar/patterns 2.33.1 → 2.35.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/component-mapping.json +1 -1
- package/dist/event-contracts.json +1 -1
- package/dist/index.d.ts +362 -136
- package/dist/index.js +325 -162
- package/dist/index.js.map +1 -1
- package/dist/patterns-registry.json +323 -160
- package/dist/registry.json +323 -160
- package/dist/types.d.ts +44 -3
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -25,11 +25,32 @@ import type { EventPayloadValue } from '@almadar/core';
|
|
|
25
25
|
* Each item has a field (default `"event"`, override
|
|
26
26
|
* with {@link PatternPropDef.eventField}) holding a
|
|
27
27
|
* declared event key. Same rename applies per item.
|
|
28
|
+
* - `"entity"` — the prop is the pattern's data INLET: the bound entity
|
|
29
|
+
* record(s) it renders. The inlet half of the circuit,
|
|
30
|
+
* symmetric with the event OUTLET kinds above. Source type:
|
|
31
|
+
* `EntityRecord<T>` / `EntityCollection<T>` from
|
|
32
|
+
* `@almadar/core`; {@link PatternPropDef.cardinality} says
|
|
33
|
+
* which. Consumers bind the domain entity to it without
|
|
34
|
+
* name-matching the prop (replacing the `'entity' in
|
|
35
|
+
* propsSchema` name check).
|
|
28
36
|
*
|
|
29
|
-
* Reserved for future use: `"
|
|
30
|
-
*
|
|
37
|
+
* Reserved for future use: `"config-binding"`. Add here rather than
|
|
38
|
+
* inventing per-consumer markers.
|
|
31
39
|
*/
|
|
32
|
-
export type PropKind = 'event' | 'event-ref' | 'event-listen' | 'event-list' | 'callback';
|
|
40
|
+
export type PropKind = 'event' | 'event-ref' | 'event-listen' | 'event-list' | 'callback' | 'entity';
|
|
41
|
+
/**
|
|
42
|
+
* Recursive structural schema for array elements / nested objects, mirrored
|
|
43
|
+
* into the registry by pattern-sync. Mirrors a tiny subset of JSON Schema
|
|
44
|
+
* (and `PropTypeSchema` in the pattern-sync tool). Lets consumers make
|
|
45
|
+
* element-aware decisions instead of falling back to name-list heuristics.
|
|
46
|
+
*/
|
|
47
|
+
export interface PatternPropTypeSchema {
|
|
48
|
+
types: string[];
|
|
49
|
+
enumValues?: string[];
|
|
50
|
+
items?: PatternPropTypeSchema;
|
|
51
|
+
properties?: Record<string, PatternPropTypeSchema>;
|
|
52
|
+
required?: string[];
|
|
53
|
+
}
|
|
33
54
|
/**
|
|
34
55
|
* One field of an emit/listen payload schema, mirrored into the registry
|
|
35
56
|
* by pattern-sync from a component's `EventEmit<P>` / `EventListen<P>`
|
|
@@ -79,6 +100,26 @@ export interface PatternPropDef {
|
|
|
79
100
|
* omitted. Only meaningful alongside `kind: "event-list"`.
|
|
80
101
|
*/
|
|
81
102
|
eventField?: string;
|
|
103
|
+
/**
|
|
104
|
+
* For `kind: "entity"` (the data inlet): whether the prop binds a single
|
|
105
|
+
* entity record (`"record"`) or a collection of records (`"collection"`).
|
|
106
|
+
* Source: `EntityRecord<T>` vs `EntityCollection<T>` from `@almadar/core`.
|
|
107
|
+
* The structural switch a consumer reads to know list-render vs detail-render
|
|
108
|
+
* — declared, not inferred from `types: ["object"|"array"]`.
|
|
109
|
+
*/
|
|
110
|
+
cardinality?: 'record' | 'collection';
|
|
111
|
+
/**
|
|
112
|
+
* Element schema for array-typed props (mirrors JSON Schema's `items`).
|
|
113
|
+
* Emitted by pattern-sync from the TS element type; present in the registry
|
|
114
|
+
* JSON but previously undeclared here (a typing gap fixed alongside the
|
|
115
|
+
* inlet work). For an `EntityCollection<T>` inlet, its `properties` are the
|
|
116
|
+
* fixed sub-slots when `T` is a concrete interface.
|
|
117
|
+
*/
|
|
118
|
+
items?: PatternPropTypeSchema;
|
|
119
|
+
/** Per-key schemas for object-typed props sourced from a declared interface. */
|
|
120
|
+
properties?: Record<string, PatternPropTypeSchema>;
|
|
121
|
+
/** Required keys for object-typed props sourced from a declared interface. */
|
|
122
|
+
propertyRequired?: string[];
|
|
82
123
|
/**
|
|
83
124
|
* For `kind: "event-ref"` whose source is `EventEmit<P>`: the
|
|
84
125
|
* structural shape of `P` — the bus payload the component fires when
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@almadar/patterns",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.0",
|
|
4
4
|
"description": "Pattern registry and component mappings for Almadar",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
],
|
|
49
49
|
"homepage": "https://github.com/almadar-io/almadar#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@almadar/core": ">=8.
|
|
51
|
+
"@almadar/core": ">=9.8.0"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tsup && tsc -p tsconfig.build.json",
|